added a priv pointer to the instance struct and changed the GET_PRIVATE()

2006-01-25  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpzoompreview.[ch]: added a priv pointer to the
	instance struct and changed the GET_PRIVATE() macro to access the
	private data via that pointer.
This commit is contained in:
Sven Neumann 2006-01-25 14:40:31 +00:00 committed by Sven Neumann
parent b614bf5e85
commit 3e30eeb6e5
3 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2006-01-25 Sven Neumann <sven@gimp.org>
* libgimp/gimpzoompreview.[ch]: added a priv pointer to the
instance struct and changed the GET_PRIVATE() macro to access the
private data via that pointer.
2006-01-25 Sven Neumann <sven@gimp.org> 2006-01-25 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpintcombobox.[ch] * libgimpwidgets/gimpintcombobox.[ch]
@ -13,7 +19,7 @@
that derived widgets can be implemented without accessing private that derived widgets can be implemented without accessing private
data. data.
* libgimp/gimpzoompreview.c: changed accordingly. * libgimp/gimpzoompreview.c: use gimp_scrolled_preview_[freeze|thaw].
* libgimp/gimpfontselectbutton.[ch]: let the priv pointer be an * libgimp/gimpfontselectbutton.[ch]: let the priv pointer be an
anonymous void pointer. anonymous void pointer.

View File

@ -38,16 +38,16 @@
#define SELECTION_BORDER 2 #define SELECTION_BORDER 2
typedef struct _GimpZoomPreviewPrivate GimpZoomPreviewPrivate; typedef struct GimpZoomPreviewPrivate
struct _GimpZoomPreviewPrivate
{ {
GimpDrawable *drawable; GimpDrawable *drawable;
GimpZoomModel *model; GimpZoomModel *model;
GdkRectangle extents; GdkRectangle extents;
}; } GimpZoomPreviewPrivate;
#define GIMP_ZOOM_PREVIEW_GET_PRIVATE(obj) \
((GimpZoomPreviewPrivate *) ((GimpZoomPreview *) (obj))->priv)
#define GIMP_ZOOM_PREVIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIMP_TYPE_ZOOM_PREVIEW, GimpZoomPreviewPrivate))
static void gimp_zoom_preview_set_adjustments (GimpZoomPreview *preview, static void gimp_zoom_preview_set_adjustments (GimpZoomPreview *preview,
gdouble old_factor, gdouble old_factor,
@ -74,8 +74,7 @@ static gboolean gimp_zoom_preview_get_bounds (GimpDrawable *drawable,
gint *xmax, gint *xmax,
gint *ymax); gint *ymax);
G_DEFINE_TYPE (GimpZoomPreview, gimp_zoom_preview, G_DEFINE_TYPE (GimpZoomPreview, gimp_zoom_preview, GIMP_TYPE_SCROLLED_PREVIEW)
GIMP_TYPE_SCROLLED_PREVIEW)
#define parent_class gimp_zoom_preview_parent_class #define parent_class gimp_zoom_preview_parent_class
static void static void
@ -97,10 +96,16 @@ gimp_zoom_preview_class_init (GimpZoomPreviewClass *klass)
static void static void
gimp_zoom_preview_init (GimpZoomPreview *preview) gimp_zoom_preview_init (GimpZoomPreview *preview)
{ {
GimpZoomPreviewPrivate *priv;
GtkWidget *button_bar; GtkWidget *button_bar;
GtkWidget *button; GtkWidget *button;
GtkWidget *box; GtkWidget *box;
GimpZoomPreviewPrivate *priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
preview->priv = G_TYPE_INSTANCE_GET_PRIVATE (preview,
GIMP_TYPE_ZOOM_PREVIEW,
GimpZoomPreviewPrivate);
priv = GIMP_ZOOM_PREVIEW_GET_PRIVATE (preview);
priv->model = gimp_zoom_model_new (); priv->model = gimp_zoom_model_new ();
gimp_zoom_model_set_range (GIMP_ZOOM_MODEL (priv->model), 1.0, 256.0); gimp_zoom_model_set_range (GIMP_ZOOM_MODEL (priv->model), 1.0, 256.0);

View File

@ -38,11 +38,15 @@ G_BEGIN_DECLS
#define GIMP_IS_ZOOM_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ZOOM_PREVIEW)) #define GIMP_IS_ZOOM_PREVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ZOOM_PREVIEW))
#define GIMP_ZOOM_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ZOOM_PREVIEW, GimpZoomPreviewClass)) #define GIMP_ZOOM_PREVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_ZOOM_PREVIEW, GimpZoomPreviewClass))
typedef struct _GimpZoomPreviewClass GimpZoomPreviewClass; typedef struct _GimpZoomPreviewClass GimpZoomPreviewClass;
struct _GimpZoomPreview struct _GimpZoomPreview
{ {
GimpScrolledPreview parent_instance; GimpScrolledPreview parent_instance;
/*< private >*/
gpointer priv;
}; };
struct _GimpZoomPreviewClass struct _GimpZoomPreviewClass