diff --git a/ChangeLog b/ChangeLog index 20ff3ad5c5..efdab4d0dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2003-03-05 Manish Singh + + * configure.in: require GTK+ 2.2. The 2.0.x series is no longer + maintained, and there are some very real bugs that won't go away. + + * app/gui/about-dialog.c + * app/widgets/gimppreviewrenderer.c + * app/widgets/gimptoolbox-color-area.c + * plug-ins/common/uniteditor.c: remove special casing for GTK+ 2.0 + vs. 2.2 + + * app/widgets/gtkwrapbox.[ch] + * app/widgets/gtkhwrapbox.[ch] + * app/widgets/gtkvwrapbox.[ch]: remove deprecated functions + + * app/gui/gui.c: free return value of gdk_get_display () + + * app/widgets/gimpcontainertreeview.c: use gtk_list_store_move_before () + for reordering. + 2003-03-05 Sven Neumann * app/config/Makefile.am diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c index f45693ea47..ec5a175a15 100644 --- a/app/dialogs/about-dialog.c +++ b/app/dialogs/about-dialog.c @@ -334,22 +334,9 @@ about_dialog_load_logo (GtkWidget *window) gc = gdk_gc_new (logo_pixmap); - /* FIXME: remove when we no longer support GTK 2.0.x */ -#if GTK_CHECK_VERSION(2,2,0) gdk_draw_pixbuf (GDK_DRAWABLE (logo_pixmap), gc, pixbuf, 0, 0, 0, 0, logo_width, logo_height, GDK_RGB_DITHER_NORMAL, 0, 0); -#else - gdk_pixbuf_render_to_drawable (pixbuf, - GDK_DRAWABLE (logo_pixmap), - gc, - 0, 0, - 0, 0, - logo_width, - logo_height, - GDK_RGB_DITHER_NORMAL, - 0, 0); -#endif g_object_unref (gc); g_object_unref (pixbuf); diff --git a/app/gui/about-dialog.c b/app/gui/about-dialog.c index f45693ea47..ec5a175a15 100644 --- a/app/gui/about-dialog.c +++ b/app/gui/about-dialog.c @@ -334,22 +334,9 @@ about_dialog_load_logo (GtkWidget *window) gc = gdk_gc_new (logo_pixmap); - /* FIXME: remove when we no longer support GTK 2.0.x */ -#if GTK_CHECK_VERSION(2,2,0) gdk_draw_pixbuf (GDK_DRAWABLE (logo_pixmap), gc, pixbuf, 0, 0, 0, 0, logo_width, logo_height, GDK_RGB_DITHER_NORMAL, 0, 0); -#else - gdk_pixbuf_render_to_drawable (pixbuf, - GDK_DRAWABLE (logo_pixmap), - gc, - 0, 0, - 0, 0, - logo_width, - logo_height, - GDK_RGB_DITHER_NORMAL, - 0, 0); -#endif g_object_unref (gc); g_object_unref (pixbuf); diff --git a/app/gui/gui.c b/app/gui/gui.c index fc306ab5ee..eb90f71509 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -127,7 +127,7 @@ gui_libs_init (gint *argc, void gui_environ_init (Gimp *gimp) { - gchar *name = NULL; + gchar *display, *name = NULL; #if defined (GDK_WINDOWING_X11) name = "DISPLAY"; @@ -138,9 +138,11 @@ gui_environ_init (Gimp *gimp) /* TODO: Need to care about display migration with GTK+ 2.2 at some point */ if (name) - gimp_environ_table_add (gimp->environ_table, - name, gdk_get_display (), - NULL); + { + display = gdk_get_display (); + gimp_environ_table_add (gimp->environ_table, name, display, NULL); + g_free (display); + } } void diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c index d74075cbfd..211bdbed81 100644 --- a/app/widgets/gimpcontainertreeview.c +++ b/app/widgets/gimpcontainertreeview.c @@ -399,61 +399,27 @@ gimp_container_tree_view_reorder_item (GimpContainerView *view, if (iter) { - GtkTreeIter selected_iter; - gboolean selected; + GtkTreeModel *model; + GtkTreePath *path; + GtkTreeIter place_iter; - selected = gtk_tree_selection_get_selected (tree_view->selection, - NULL, &selected_iter); - - if (selected) - { - GimpViewable *selected_viewable; - - gtk_tree_model_get (GTK_TREE_MODEL (tree_view->list), &selected_iter, - COLUMN_VIEWABLE, &selected_viewable, - -1); - - if (selected_viewable != viewable) - selected = FALSE; - - g_object_unref (selected_viewable); - } - - if (selected) - g_signal_handlers_block_by_func (tree_view->selection, - gimp_container_tree_view_selection_changed, - tree_view); - - gtk_list_store_remove (tree_view->list, iter); + model = GTK_TREE_MODEL (tree_view->list); if (new_index == -1) - gtk_list_store_append (tree_view->list, iter); - else - gtk_list_store_insert (tree_view->list, iter, new_index); + new_index = gtk_tree_model_iter_n_children (model, NULL) - 1; + + path = gtk_tree_path_new_from_indices (new_index, NULL); - gimp_container_tree_view_set (tree_view, iter, viewable); - - if (selected) - { - GtkTreePath *path; - - gtk_tree_selection_select_iter (tree_view->selection, iter); - - g_signal_handlers_unblock_by_func (tree_view->selection, - gimp_container_tree_view_selection_changed, - tree_view); - - path = gtk_tree_model_get_path (GTK_TREE_MODEL (tree_view->list), - iter); + gtk_tree_model_get_iter (model, &place_iter, path); + gtk_list_store_move_before (tree_view->list, iter, &place_iter); #ifdef __GNUC__ #warning FIXME: use use_align == FALSE as soon as implemented by GtkTreeView #endif - gtk_tree_view_scroll_to_cell (tree_view->view, path, - NULL, TRUE, 0.5, 0.0); + gtk_tree_view_scroll_to_cell (tree_view->view, path, + NULL, TRUE, 0.5, 0.0); - gtk_tree_path_free (path); - } + gtk_tree_path_free (path); } } diff --git a/app/widgets/gimppreviewrenderer.c b/app/widgets/gimppreviewrenderer.c index ed98762195..7d2fa404a6 100644 --- a/app/widgets/gimppreviewrenderer.c +++ b/app/widgets/gimppreviewrenderer.c @@ -509,8 +509,6 @@ gimp_preview_renderer_draw (GimpPreviewRenderer *renderer, if (gdk_rectangle_intersect (&buf_rect, expose_area, &render_rect)) { - /* FIXME: remove when we no longer support GTK 2.0.x */ -#if GTK_CHECK_VERSION(2,2,0) gdk_draw_pixbuf (GDK_DRAWABLE (window), widget->style->bg_gc[widget->state], renderer->no_preview_pixbuf, @@ -523,20 +521,6 @@ gimp_preview_renderer_draw (GimpPreviewRenderer *renderer, GDK_RGB_DITHER_NORMAL, expose_area->x - draw_area->x, expose_area->y - draw_area->y); -#else - gdk_pixbuf_render_to_drawable (renderer->no_preview_pixbuf, - window, - widget->style->bg_gc[widget->state], - render_rect.x - buf_rect.x, - render_rect.y - buf_rect.y, - render_rect.x, - render_rect.y, - render_rect.width, - render_rect.height, - GDK_RGB_DITHER_NORMAL, - expose_area->x - draw_area->x, - expose_area->y - draw_area->y); -#endif } } else if (renderer->buffer) diff --git a/app/widgets/gimptoolbox-color-area.c b/app/widgets/gimptoolbox-color-area.c index b993dab259..6150ccbc48 100644 --- a/app/widgets/gimptoolbox-color-area.c +++ b/app/widgets/gimptoolbox-color-area.c @@ -319,17 +319,9 @@ color_area_draw (GimpContext *context) GTK_ICON_SIZE_MENU, NULL); w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); - /* FIXME: remove when we no longer support GTK 2.0.x */ -#if GTK_CHECK_VERSION(2,2,0) gdk_draw_pixbuf (color_area->window, NULL, pixbuf, 0, 0, 0, height - h, w, h, GDK_RGB_DITHER_MAX, 0, 0); -#else - gdk_pixbuf_render_to_drawable_alpha (pixbuf, color_area->window, - 0, 0, 0, height - h, w, h, - GDK_PIXBUF_ALPHA_FULL, 127, - GDK_RGB_DITHER_MAX, 0, 0); -#endif g_object_unref (pixbuf); /* draw the swap colors pixbuf */ @@ -337,17 +329,9 @@ color_area_draw (GimpContext *context) GTK_ICON_SIZE_MENU, NULL); w = gdk_pixbuf_get_width (pixbuf); h = gdk_pixbuf_get_height (pixbuf); - /* FIXME: remove when we no longer support GTK 2.0.x */ -#if GTK_CHECK_VERSION(2,2,0) gdk_draw_pixbuf (color_area->window, NULL, pixbuf, 0, 0, width - w, 0, w, h, GDK_RGB_DITHER_MAX, 0, 0); -#else - gdk_pixbuf_render_to_drawable_alpha (pixbuf, color_area->window, - 0, 0, width - w, 0, w, h, - GDK_PIXBUF_ALPHA_FULL, 127, - GDK_RGB_DITHER_MAX, 0, 0); -#endif g_object_unref (pixbuf); } diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c index ed98762195..7d2fa404a6 100644 --- a/app/widgets/gimpviewrenderer.c +++ b/app/widgets/gimpviewrenderer.c @@ -509,8 +509,6 @@ gimp_preview_renderer_draw (GimpPreviewRenderer *renderer, if (gdk_rectangle_intersect (&buf_rect, expose_area, &render_rect)) { - /* FIXME: remove when we no longer support GTK 2.0.x */ -#if GTK_CHECK_VERSION(2,2,0) gdk_draw_pixbuf (GDK_DRAWABLE (window), widget->style->bg_gc[widget->state], renderer->no_preview_pixbuf, @@ -523,20 +521,6 @@ gimp_preview_renderer_draw (GimpPreviewRenderer *renderer, GDK_RGB_DITHER_NORMAL, expose_area->x - draw_area->x, expose_area->y - draw_area->y); -#else - gdk_pixbuf_render_to_drawable (renderer->no_preview_pixbuf, - window, - widget->style->bg_gc[widget->state], - render_rect.x - buf_rect.x, - render_rect.y - buf_rect.y, - render_rect.x, - render_rect.y, - render_rect.width, - render_rect.height, - GDK_RGB_DITHER_NORMAL, - expose_area->x - draw_area->x, - expose_area->y - draw_area->y); -#endif } } else if (renderer->buffer) diff --git a/app/widgets/gtkhwrapbox.c b/app/widgets/gtkhwrapbox.c index 7543bad4d6..a86eec44c6 100644 --- a/app/widgets/gtkhwrapbox.c +++ b/app/widgets/gtkhwrapbox.c @@ -22,17 +22,10 @@ #include "config.h" -#ifdef __GNUC__ -#warning GTK_DISABLE_DEPRECATED -#endif -#undef GTK_DISABLE_DEPRECATED - -#include +#include "gtkhwrapbox.h" #include "libgimpmath/gimpmath.h" -#include "gtkhwrapbox.h" - /* --- prototypes --- */ static void gtk_hwrap_box_class_init (GtkHWrapBoxClass *klass); @@ -53,26 +46,28 @@ static gpointer parent_class = NULL; /* --- functions --- */ -GtkType +GType gtk_hwrap_box_get_type (void) { - static GtkType hwrap_box_type = 0; + static GType hwrap_box_type = 0; if (!hwrap_box_type) { - static const GtkTypeInfo hwrap_box_info = + static const GTypeInfo hwrap_box_info = { - "GtkHWrapBox", - sizeof (GtkHWrapBox), sizeof (GtkHWrapBoxClass), - (GtkClassInitFunc) gtk_hwrap_box_class_init, - (GtkObjectInitFunc) gtk_hwrap_box_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_hwrap_box_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkHWrapBox), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_hwrap_box_init, }; - hwrap_box_type = gtk_type_unique (GTK_TYPE_WRAP_BOX, &hwrap_box_info); + hwrap_box_type = g_type_register_static (GTK_TYPE_WRAP_BOX, "GtkHWrapBox", + &hwrap_box_info, 0); } return hwrap_box_type; @@ -81,17 +76,17 @@ gtk_hwrap_box_get_type (void) static void gtk_hwrap_box_class_init (GtkHWrapBoxClass *class) { - GtkObjectClass *object_class; + GObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkWrapBoxClass *wrap_box_class; - object_class = GTK_OBJECT_CLASS (class); + object_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); container_class = GTK_CONTAINER_CLASS (class); wrap_box_class = GTK_WRAP_BOX_CLASS (class); - parent_class = gtk_type_class (GTK_TYPE_WRAP_BOX); + parent_class = g_type_class_peek_parent (class); widget_class->size_request = gtk_hwrap_box_size_request; widget_class->size_allocate = gtk_hwrap_box_size_allocate; @@ -109,13 +104,7 @@ gtk_hwrap_box_init (GtkHWrapBox *hwbox) GtkWidget* gtk_hwrap_box_new (gboolean homogeneous) { - GtkHWrapBox *hwbox; - - hwbox = GTK_HWRAP_BOX (gtk_widget_new (GTK_TYPE_HWRAP_BOX, NULL)); - - GTK_WRAP_BOX (hwbox)->homogeneous = homogeneous ? TRUE : FALSE; - - return GTK_WIDGET (hwbox); + return g_object_new (GTK_TYPE_HWRAP_BOX, "homogeneous", homogeneous, NULL); } static inline void diff --git a/app/widgets/gtkhwrapbox.h b/app/widgets/gtkhwrapbox.h index cb894836db..e677957d5b 100644 --- a/app/widgets/gtkhwrapbox.h +++ b/app/widgets/gtkhwrapbox.h @@ -31,11 +31,11 @@ G_BEGIN_DECLS /* --- type macros --- */ #define GTK_TYPE_HWRAP_BOX (gtk_hwrap_box_get_type ()) -#define GTK_HWRAP_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HWRAP_BOX, GtkHWrapBox)) -#define GTK_HWRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HWRAP_BOX, GtkHWrapBoxClass)) -#define GTK_IS_HWRAP_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_HWRAP_BOX)) -#define GTK_IS_HWRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HWRAP_BOX)) -#define GTK_HWRAP_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_HWRAP_BOX, GtkHWrapBoxClass)) +#define GTK_HWRAP_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HWRAP_BOX, GtkHWrapBox)) +#define GTK_HWRAP_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HWRAP_BOX, GtkHWrapBoxClass)) +#define GTK_IS_HWRAP_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HWRAP_BOX)) +#define GTK_IS_HWRAP_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HWRAP_BOX)) +#define GTK_HWRAP_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HWRAP_BOX, GtkHWrapBoxClass)) /* --- typedefs --- */ @@ -61,7 +61,7 @@ struct _GtkHWrapBoxClass /* --- prototypes --- */ -GtkType gtk_hwrap_box_get_type (void) G_GNUC_CONST; +GType gtk_hwrap_box_get_type (void) G_GNUC_CONST; GtkWidget * gtk_hwrap_box_new (gboolean homogeneous); diff --git a/app/widgets/gtkvwrapbox.c b/app/widgets/gtkvwrapbox.c index a0eb252eea..654b89467c 100644 --- a/app/widgets/gtkvwrapbox.c +++ b/app/widgets/gtkvwrapbox.c @@ -22,17 +22,10 @@ #include "config.h" -#ifdef __GNUC__ -#warning GTK_DISABLE_DEPRECATED -#endif -#undef GTK_DISABLE_DEPRECATED - -#include +#include "gtkvwrapbox.h" #include "libgimpmath/gimpmath.h" -#include "gtkvwrapbox.h" - /* --- prototypes --- */ static void gtk_vwrap_box_class_init (GtkVWrapBoxClass *klass); @@ -53,26 +46,28 @@ static gpointer parent_class = NULL; /* --- functions --- */ -GtkType +GType gtk_vwrap_box_get_type (void) { - static GtkType vwrap_box_type = 0; + static GType vwrap_box_type = 0; if (!vwrap_box_type) { - static const GtkTypeInfo vwrap_box_info = + static const GTypeInfo vwrap_box_info = { - "GtkVWrapBox", - sizeof (GtkVWrapBox), sizeof (GtkVWrapBoxClass), - (GtkClassInitFunc) gtk_vwrap_box_class_init, - (GtkObjectInitFunc) gtk_vwrap_box_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_vwrap_box_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkVWrapBox), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_vwrap_box_init, }; - vwrap_box_type = gtk_type_unique (GTK_TYPE_WRAP_BOX, &vwrap_box_info); + vwrap_box_type = g_type_register_static (GTK_TYPE_WRAP_BOX, "GtkVWrapBox", + &vwrap_box_info, 0); } return vwrap_box_type; @@ -81,17 +76,17 @@ gtk_vwrap_box_get_type (void) static void gtk_vwrap_box_class_init (GtkVWrapBoxClass *class) { - GtkObjectClass *object_class; + GObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkWrapBoxClass *wrap_box_class; - object_class = GTK_OBJECT_CLASS (class); + object_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); container_class = GTK_CONTAINER_CLASS (class); wrap_box_class = GTK_WRAP_BOX_CLASS (class); - parent_class = gtk_type_class (GTK_TYPE_WRAP_BOX); + parent_class = g_type_class_peek_parent (class); widget_class->size_request = gtk_vwrap_box_size_request; widget_class->size_allocate = gtk_vwrap_box_size_allocate; @@ -109,13 +104,7 @@ gtk_vwrap_box_init (GtkVWrapBox *vwbox) GtkWidget* gtk_vwrap_box_new (gboolean homogeneous) { - GtkVWrapBox *vwbox; - - vwbox = GTK_VWRAP_BOX (gtk_widget_new (GTK_TYPE_VWRAP_BOX, NULL)); - - GTK_WRAP_BOX (vwbox)->homogeneous = homogeneous ? TRUE : FALSE; - - return GTK_WIDGET (vwbox); + return g_object_new (GTK_TYPE_VWRAP_BOX, "homogeneous", homogeneous, NULL); } static inline void diff --git a/app/widgets/gtkvwrapbox.h b/app/widgets/gtkvwrapbox.h index 83122b2ec6..4c32017168 100644 --- a/app/widgets/gtkvwrapbox.h +++ b/app/widgets/gtkvwrapbox.h @@ -31,11 +31,11 @@ G_BEGIN_DECLS /* --- type macros --- */ #define GTK_TYPE_VWRAP_BOX (gtk_vwrap_box_get_type ()) -#define GTK_VWRAP_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_VWRAP_BOX, GtkVWrapBox)) -#define GTK_VWRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_VWRAP_BOX, GtkVWrapBoxClass)) -#define GTK_IS_VWRAP_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_VWRAP_BOX)) -#define GTK_IS_VWRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VWRAP_BOX)) -#define GTK_VWRAP_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_VWRAP_BOX, GtkVWrapBoxClass)) +#define GTK_VWRAP_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_VWRAP_BOX, GtkVWrapBox)) +#define GTK_VWRAP_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_VWRAP_BOX, GtkVWrapBoxClass)) +#define GTK_IS_VWRAP_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_VWRAP_BOX)) +#define GTK_IS_VWRAP_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VWRAP_BOX)) +#define GTK_VWRAP_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_VWRAP_BOX, GtkVWrapBoxClass)) /* --- typedefs --- */ @@ -61,7 +61,7 @@ struct _GtkVWrapBoxClass /* --- prototypes --- */ -GtkType gtk_vwrap_box_get_type (void) G_GNUC_CONST; +GType gtk_vwrap_box_get_type (void) G_GNUC_CONST; GtkWidget * gtk_vwrap_box_new (gboolean homogeneous); diff --git a/app/widgets/gtkwrapbox.c b/app/widgets/gtkwrapbox.c index dde2b5c25a..16ce987440 100644 --- a/app/widgets/gtkwrapbox.c +++ b/app/widgets/gtkwrapbox.c @@ -22,26 +22,22 @@ #include "config.h" -#ifdef __GNUC__ -#warning GTK_DISABLE_DEPRECATED -#endif -#undef GTK_DISABLE_DEPRECATED - #include "gtkwrapbox.h" -/* --- arguments --- */ +/* --- properties --- */ enum { - ARG_0, - ARG_HOMOGENEOUS, - ARG_JUSTIFY, - ARG_HSPACING, - ARG_VSPACING, - ARG_LINE_JUSTIFY, - ARG_ASPECT_RATIO, - ARG_CURRENT_RATIO, - ARG_CHILD_LIMIT + PROP_0, + PROP_HOMOGENEOUS, + PROP_JUSTIFY, + PROP_HSPACING, + PROP_VSPACING, + PROP_LINE_JUSTIFY, + PROP_ASPECT_RATIO, + PROP_CURRENT_RATIO, + PROP_CHILD_LIMIT }; + enum { CHILD_PROP_0, CHILD_PROP_POSITION, @@ -56,12 +52,14 @@ enum { /* --- prototypes --- */ static void gtk_wrap_box_class_init (GtkWrapBoxClass *klass); static void gtk_wrap_box_init (GtkWrapBox *wbox); -static void gtk_wrap_box_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); -static void gtk_wrap_box_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id); +static void gtk_wrap_box_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_wrap_box_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); static void gtk_wrap_box_set_child_property (GtkContainer *container, GtkWidget *child, guint property_id, @@ -84,7 +82,7 @@ static void gtk_wrap_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); -static GtkType gtk_wrap_box_child_type (GtkContainer *container); +static GType gtk_wrap_box_child_type (GtkContainer *container); /* --- variables --- */ @@ -92,26 +90,28 @@ static gpointer parent_class = NULL; /* --- functions --- */ -GtkType +GType gtk_wrap_box_get_type (void) { - static GtkType wrap_box_type = 0; + static GType wrap_box_type = 0; if (!wrap_box_type) { - static const GtkTypeInfo wrap_box_info = + static const GTypeInfo wrap_box_info = { - "GtkWrapBox", - sizeof (GtkWrapBox), sizeof (GtkWrapBoxClass), - (GtkClassInitFunc) gtk_wrap_box_class_init, - (GtkObjectInitFunc) gtk_wrap_box_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_wrap_box_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkWrapBox), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_wrap_box_init, }; - wrap_box_type = gtk_type_unique (GTK_TYPE_CONTAINER, &wrap_box_info); + wrap_box_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkWrapBox", + &wrap_box_info, 0); } return wrap_box_type; @@ -120,18 +120,18 @@ gtk_wrap_box_get_type (void) static void gtk_wrap_box_class_init (GtkWrapBoxClass *class) { - GtkObjectClass *object_class; + GObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; - object_class = GTK_OBJECT_CLASS (class); + object_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); container_class = GTK_CONTAINER_CLASS (class); parent_class = g_type_class_peek_parent (class); - object_class->set_arg = gtk_wrap_box_set_arg; - object_class->get_arg = gtk_wrap_box_get_arg; + object_class->set_property = gtk_wrap_box_set_property; + object_class->get_property = gtk_wrap_box_get_property; widget_class->map = gtk_wrap_box_map; widget_class->unmap = gtk_wrap_box_unmap; @@ -145,46 +145,121 @@ gtk_wrap_box_class_init (GtkWrapBoxClass *class) container_class->get_child_property = gtk_wrap_box_get_child_property; class->rlist_line_children = NULL; - - gtk_object_add_arg_type ("GtkWrapBox::homogeneous", - GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HOMOGENEOUS); - gtk_object_add_arg_type ("GtkWrapBox::justify", - GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFY); - gtk_object_add_arg_type ("GtkWrapBox::hspacing", - GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_HSPACING); - gtk_object_add_arg_type ("GtkWrapBox::vspacing", - GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_VSPACING); - gtk_object_add_arg_type ("GtkWrapBox::line_justify", - GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_LINE_JUSTIFY); - gtk_object_add_arg_type ("GtkWrapBox::aspect_ratio", - GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_ASPECT_RATIO); - gtk_object_add_arg_type ("GtkWrapBox::current_ratio", - GTK_TYPE_FLOAT, GTK_ARG_READABLE, ARG_CURRENT_RATIO); - gtk_object_add_arg_type ("GtkWrapBox::max_children_per_line", - GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_CHILD_LIMIT); - gtk_container_class_install_child_property (container_class, CHILD_PROP_POSITION, - g_param_spec_int ("position", NULL, NULL, + g_object_class_install_property (object_class, + PROP_HOMOGENEOUS, + g_param_spec_boolean ("homogeneous", + NULL, + NULL, + FALSE, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_JUSTIFY, + g_param_spec_enum ("justify", + NULL, + NULL, + GTK_TYPE_JUSTIFICATION, + GTK_JUSTIFY_LEFT, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_HSPACING, + g_param_spec_uint ("hspacing", + NULL, + NULL, + 0, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_VSPACING, + g_param_spec_uint ("vspacing", + NULL, + NULL, + 0, + G_MAXINT, + 0, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_LINE_JUSTIFY, + g_param_spec_enum ("line_justify", + NULL, + NULL, + GTK_TYPE_JUSTIFICATION, + GTK_JUSTIFY_BOTTOM, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_ASPECT_RATIO, + g_param_spec_float ("aspect_ratio", + NULL, + NULL, + 0.0, + G_MAXFLOAT, + 1.0, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, + PROP_CURRENT_RATIO, + g_param_spec_float ("current_ratio", + NULL, + NULL, + 0.0, + G_MAXFLOAT, + 1.0, + G_PARAM_READABLE)); + + g_object_class_install_property (object_class, + PROP_CHILD_LIMIT, + g_param_spec_uint ("max_children_per_line", + NULL, + NULL, + 1, + 32767, + 32767, + G_PARAM_READWRITE)); + + gtk_container_class_install_child_property (container_class, + CHILD_PROP_POSITION, + g_param_spec_int ("position", + NULL, + NULL, -1, G_MAXINT, 0, G_PARAM_READWRITE)); - gtk_container_class_install_child_property (container_class, CHILD_PROP_HEXPAND, - g_param_spec_boolean ("hexpand", NULL, NULL, + gtk_container_class_install_child_property (container_class, + CHILD_PROP_HEXPAND, + g_param_spec_boolean ("hexpand", + NULL, + NULL, FALSE, G_PARAM_READWRITE)); - gtk_container_class_install_child_property (container_class, CHILD_PROP_HFILL, - g_param_spec_boolean ("hfill", NULL, NULL, + gtk_container_class_install_child_property (container_class, + CHILD_PROP_HFILL, + g_param_spec_boolean ("hfill", + NULL, + NULL, FALSE, G_PARAM_READWRITE)); - gtk_container_class_install_child_property (container_class, CHILD_PROP_VEXPAND, - g_param_spec_boolean ("vexpand", NULL, NULL, + gtk_container_class_install_child_property (container_class, + CHILD_PROP_VEXPAND, + g_param_spec_boolean ("vexpand", + NULL, + NULL, FALSE, G_PARAM_READWRITE)); - gtk_container_class_install_child_property (container_class, CHILD_PROP_VFILL, - g_param_spec_boolean ("vfill", NULL, NULL, + gtk_container_class_install_child_property (container_class, + CHILD_PROP_VFILL, + g_param_spec_boolean ("vfill", + NULL, + NULL, FALSE, G_PARAM_READWRITE)); - gtk_container_class_install_child_property (container_class, CHILD_PROP_VFILL, - g_param_spec_boolean ("wrapped", NULL, NULL, + gtk_container_class_install_child_property (container_class, + CHILD_PROP_VFILL, + g_param_spec_boolean ("wrapped", + NULL, + NULL, FALSE, G_PARAM_READWRITE)); } @@ -201,84 +276,86 @@ gtk_wrap_box_init (GtkWrapBox *wbox) wbox->line_justify = GTK_JUSTIFY_BOTTOM; wbox->n_children = 0; wbox->children = NULL; - wbox->aspect_ratio = 1; + wbox->aspect_ratio = 1.0; wbox->child_limit = 32767; } static void -gtk_wrap_box_set_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_wrap_box_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) { GtkWrapBox *wbox = GTK_WRAP_BOX (object); - switch (arg_id) + switch (property_id) { - case ARG_HOMOGENEOUS: - gtk_wrap_box_set_homogeneous (wbox, GTK_VALUE_BOOL (*arg)); + case PROP_HOMOGENEOUS: + gtk_wrap_box_set_homogeneous (wbox, g_value_get_boolean (value)); break; - case ARG_JUSTIFY: - gtk_wrap_box_set_justify (wbox, GTK_VALUE_ENUM (*arg)); + case PROP_JUSTIFY: + gtk_wrap_box_set_justify (wbox, g_value_get_enum (value)); break; - case ARG_LINE_JUSTIFY: - gtk_wrap_box_set_line_justify (wbox, GTK_VALUE_ENUM (*arg)); + case PROP_LINE_JUSTIFY: + gtk_wrap_box_set_line_justify (wbox, g_value_get_enum (value)); break; - case ARG_HSPACING: - gtk_wrap_box_set_hspacing (wbox, GTK_VALUE_UINT (*arg)); + case PROP_HSPACING: + gtk_wrap_box_set_hspacing (wbox, g_value_get_uint (value)); break; - case ARG_VSPACING: - gtk_wrap_box_set_vspacing (wbox, GTK_VALUE_UINT (*arg)); + case PROP_VSPACING: + gtk_wrap_box_set_vspacing (wbox, g_value_get_uint (value)); break; - case ARG_ASPECT_RATIO: - gtk_wrap_box_set_aspect_ratio (wbox, GTK_VALUE_FLOAT (*arg)); + case PROP_ASPECT_RATIO: + gtk_wrap_box_set_aspect_ratio (wbox, g_value_get_float (value)); break; - case ARG_CHILD_LIMIT: - if (wbox->child_limit != GTK_VALUE_UINT (*arg)) - { - wbox->child_limit = CLAMP (GTK_VALUE_UINT (*arg), 1, 32767); - gtk_widget_queue_resize (GTK_WIDGET (wbox)); - } + case PROP_CHILD_LIMIT: + if (wbox->child_limit != g_value_get_uint (value)) + gtk_widget_queue_resize (GTK_WIDGET (wbox)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void -gtk_wrap_box_get_arg (GtkObject *object, - GtkArg *arg, - guint arg_id) +gtk_wrap_box_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) { GtkWrapBox *wbox = GTK_WRAP_BOX (object); GtkWidget *widget = GTK_WIDGET (object); - switch (arg_id) + switch (property_id) { - case ARG_HOMOGENEOUS: - GTK_VALUE_BOOL (*arg) = wbox->homogeneous; + case PROP_HOMOGENEOUS: + g_value_set_boolean (value, wbox->homogeneous); break; - case ARG_JUSTIFY: - GTK_VALUE_ENUM (*arg) = wbox->justify; + case PROP_JUSTIFY: + g_value_set_enum (value, wbox->justify); break; - case ARG_LINE_JUSTIFY: - GTK_VALUE_ENUM (*arg) = wbox->line_justify; + case PROP_LINE_JUSTIFY: + g_value_set_enum (value, wbox->line_justify); break; - case ARG_HSPACING: - GTK_VALUE_UINT (*arg) = wbox->hspacing; + case PROP_HSPACING: + g_value_set_uint (value, wbox->hspacing); break; - case ARG_VSPACING: - GTK_VALUE_UINT (*arg) = wbox->vspacing; + case PROP_VSPACING: + g_value_set_uint (value, wbox->vspacing); break; - case ARG_ASPECT_RATIO: - GTK_VALUE_FLOAT (*arg) = wbox->aspect_ratio; + case PROP_ASPECT_RATIO: + g_value_set_float (value, wbox->aspect_ratio); break; - case ARG_CURRENT_RATIO: - GTK_VALUE_FLOAT (*arg) = (((gfloat) widget->allocation.width) / - ((gfloat) widget->allocation.height)); + case PROP_CURRENT_RATIO: + g_value_set_float (value, (((gfloat) widget->allocation.width) / + ((gfloat) widget->allocation.height))); break; - case ARG_CHILD_LIMIT: - GTK_VALUE_UINT (*arg) = wbox->child_limit; + case PROP_CHILD_LIMIT: + g_value_set_uint (value, wbox->child_limit); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } @@ -291,10 +368,15 @@ gtk_wrap_box_set_child_property (GtkContainer *container, GParamSpec *pspec) { GtkWrapBox *wbox = GTK_WRAP_BOX (container); - gboolean hexpand = FALSE, hfill = FALSE, vexpand = FALSE, vfill = FALSE, wrapped = FALSE; - + gboolean hexpand = FALSE, hfill = FALSE; + gboolean vexpand = FALSE, vfill = FALSE; + gboolean wrapped = FALSE; + if (property_id != CHILD_PROP_POSITION) - gtk_wrap_box_query_child_packing (wbox, child, &hexpand, &hfill, &vexpand, &vfill, &wrapped); + gtk_wrap_box_query_child_packing (wbox, child, + &hexpand, &hfill, + &vexpand, &vfill, + &wrapped); switch (property_id) { @@ -345,10 +427,15 @@ gtk_wrap_box_get_child_property (GtkContainer *container, GParamSpec *pspec) { GtkWrapBox *wbox = GTK_WRAP_BOX (container); - gboolean hexpand = FALSE, hfill = FALSE, vexpand = FALSE, vfill = FALSE, wrapped = FALSE; + gboolean hexpand = FALSE, hfill = FALSE; + gboolean vexpand = FALSE, vfill = FALSE; + gboolean wrapped = FALSE; if (property_id != CHILD_PROP_POSITION) - gtk_wrap_box_query_child_packing (wbox, child, &hexpand, &hfill, &vexpand, &vfill, &wrapped); + gtk_wrap_box_query_child_packing (wbox, child, + &hexpand, &hfill, + &vexpand, &vfill, + &wrapped); switch (property_id) { @@ -385,7 +472,7 @@ gtk_wrap_box_get_child_property (GtkContainer *container, } } -static GtkType +static GType gtk_wrap_box_child_type (GtkContainer *container) { return GTK_TYPE_WIDGET; diff --git a/app/widgets/gtkwrapbox.h b/app/widgets/gtkwrapbox.h index de204449f2..d173f97ae8 100644 --- a/app/widgets/gtkwrapbox.h +++ b/app/widgets/gtkwrapbox.h @@ -31,11 +31,11 @@ G_BEGIN_DECLS /* --- type macros --- */ #define GTK_TYPE_WRAP_BOX (gtk_wrap_box_get_type ()) -#define GTK_WRAP_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_WRAP_BOX, GtkWrapBox)) -#define GTK_WRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_WRAP_BOX, GtkWrapBoxClass)) -#define GTK_IS_WRAP_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_WRAP_BOX)) -#define GTK_IS_WRAP_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WRAP_BOX)) -#define GTK_WRAP_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_WRAP_BOX, GtkWrapBoxClass)) +#define GTK_WRAP_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_WRAP_BOX, GtkWrapBox)) +#define GTK_WRAP_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WRAP_BOX, GtkWrapBoxClass)) +#define GTK_IS_WRAP_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_WRAP_BOX)) +#define GTK_IS_WRAP_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WRAP_BOX)) +#define GTK_WRAP_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WRAP_BOX, GtkWrapBoxClass)) /* --- typedefs --- */ @@ -84,7 +84,7 @@ struct _GtkWrapBoxChild /* --- prototypes --- */ -GtkType gtk_wrap_box_get_type (void) G_GNUC_CONST; +GType gtk_wrap_box_get_type (void) G_GNUC_CONST; void gtk_wrap_box_set_homogeneous (GtkWrapBox *wbox, gboolean homogeneous); void gtk_wrap_box_set_hspacing (GtkWrapBox *wbox, diff --git a/configure.in b/configure.in index 8c218d8c3d..d338e19f64 100644 --- a/configure.in +++ b/configure.in @@ -14,7 +14,7 @@ AC_INIT(app/core/gimp.c) # Versioning ############ -GLIB_REQUIRED_VERSION=2.0.0 +GLIB_REQUIRED_VERSION=2.2.0 GTK_REQUIRED_VERSION=$GLIB_REQUIRED_VERSION PANGOFT2_REQUIRED_VERSION=1.0.0 GTKDOC_REQUIRED_VERSION=1.0 diff --git a/plug-ins/common/uniteditor.c b/plug-ins/common/uniteditor.c index d3fe531f24..aac85cf203 100644 --- a/plug-ins/common/uniteditor.c +++ b/plug-ins/common/uniteditor.c @@ -575,17 +575,13 @@ unit_editor_dialog (void) gtk_widget_show (tv); rend = gtk_cell_renderer_toggle_new (); - col = gtk_tree_view_column_new_with_attributes (gettext (columns[SAVE].title), - rend, - - "active", SAVE, - "activatable", USER_UNIT, - - (GTK_CHECK_VERSION (2,2,0) ? - "cell-background-gdk" : NULL), - BG_COLOR, - - NULL); + col = + gtk_tree_view_column_new_with_attributes (gettext (columns[SAVE].title), + rend, + "active", SAVE, + "activatable", USER_UNIT, + "cell-background-gdk", BG_COLOR, + NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (tv), col);