diff options
author | Manish Singh <yosh@gimp.org> | 2002-10-05 01:51:16 +0000 |
---|---|---|
committer | Manish Singh <yosh@src.gnome.org> | 2002-10-05 01:51:16 +0000 |
commit | 8409ada92ff408f41c3014ffa6401ce97da0e5ed (patch) | |
tree | 8ad6ffbe5247c05db1fa3231e51b773319499e38 /gtk | |
parent | 2ffa58f11d0fdfdee4859f37dd69bcec21b34e41 (diff) | |
download | gdk-pixbuf-8409ada92ff408f41c3014ffa6401ce97da0e5ed.tar.gz |
Deprecation cleanup
Fri Oct 4 18:40:50 2002 Manish Singh <yosh@gimp.org>
* gtkcheckmenuitem.[ch] gtkimagemenuitem.[ch] gtkmenu.[ch]
gtkmenubar.[ch] gtkmenuitem.[ch] gtkmenushell.[ch]
gtkradiomenuitem.[ch]: Deprecation cleanup
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcheckmenuitem.c | 59 | ||||
-rw-r--r-- | gtk/gtkcheckmenuitem.h | 12 | ||||
-rw-r--r-- | gtk/gtkimagemenuitem.c | 38 | ||||
-rw-r--r-- | gtk/gtkimagemenuitem.h | 12 | ||||
-rw-r--r-- | gtk/gtkmenu.c | 141 | ||||
-rw-r--r-- | gtk/gtkmenu.h | 12 | ||||
-rw-r--r-- | gtk/gtkmenubar.c | 33 | ||||
-rw-r--r-- | gtk/gtkmenubar.h | 12 | ||||
-rw-r--r-- | gtk/gtkmenuitem.c | 78 | ||||
-rw-r--r-- | gtk/gtkmenuitem.h | 12 | ||||
-rw-r--r-- | gtk/gtkmenushell.c | 127 | ||||
-rw-r--r-- | gtk/gtkmenushell.h | 12 | ||||
-rw-r--r-- | gtk/gtkradiomenuitem.c | 31 | ||||
-rw-r--r-- | gtk/gtkradiomenuitem.h | 12 |
14 files changed, 304 insertions, 287 deletions
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index cb5943aa6..7c1ee30a7 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -26,7 +26,6 @@ #include "gtkcheckmenuitem.h" #include "gtkaccellabel.h" -#include "gtksignal.h" #include "gtkintl.h" #include "gtkmarshalers.h" @@ -68,26 +67,29 @@ static GtkMenuItemClass *parent_class = NULL; static guint check_menu_item_signals[LAST_SIGNAL] = { 0 }; -GtkType +GType gtk_check_menu_item_get_type (void) { - static GtkType check_menu_item_type = 0; + static GType check_menu_item_type = 0; if (!check_menu_item_type) { - static const GtkTypeInfo check_menu_item_info = + static const GTypeInfo check_menu_item_info = { - "GtkCheckMenuItem", - sizeof (GtkCheckMenuItem), sizeof (GtkCheckMenuItemClass), - (GtkClassInitFunc) gtk_check_menu_item_class_init, - (GtkObjectInitFunc) gtk_check_menu_item_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_check_menu_item_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkCheckMenuItem), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_check_menu_item_init, }; - check_menu_item_type = gtk_type_unique (GTK_TYPE_MENU_ITEM, &check_menu_item_info); + check_menu_item_type = + g_type_register_static (GTK_TYPE_MENU_ITEM, "GtkCheckMenuItem", + &check_menu_item_info, 0); } return check_menu_item_type; @@ -96,20 +98,20 @@ gtk_check_menu_item_get_type (void) static void gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass) { - GtkObjectClass *object_class; + GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; - object_class = (GtkObjectClass*) klass; + gobject_class = G_OBJECT_CLASS (klass); widget_class = (GtkWidgetClass*) klass; menu_item_class = (GtkMenuItemClass*) klass; - parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM); + parent_class = g_type_class_peek_parent (klass); - G_OBJECT_CLASS(object_class)->set_property = gtk_check_menu_item_set_property; - G_OBJECT_CLASS(object_class)->get_property = gtk_check_menu_item_get_property; + gobject_class->set_property = gtk_check_menu_item_set_property; + gobject_class->get_property = gtk_check_menu_item_get_property; - g_object_class_install_property (G_OBJECT_CLASS (object_class), + g_object_class_install_property (gobject_class, PROP_ACTIVE, g_param_spec_boolean ("active", _("Active"), @@ -117,7 +119,7 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass) FALSE, G_PARAM_READWRITE)); - g_object_class_install_property (G_OBJECT_CLASS (object_class), + g_object_class_install_property (gobject_class, PROP_INCONSISTENT, g_param_spec_boolean ("inconsistent", _("Inconsistent"), @@ -135,18 +137,19 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass) klass->draw_indicator = gtk_real_check_menu_item_draw_indicator; check_menu_item_signals[TOGGLED] = - gtk_signal_new ("toggled", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkCheckMenuItemClass, toggled), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("toggled", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkCheckMenuItemClass, toggled), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); } GtkWidget* gtk_check_menu_item_new (void) { - return GTK_WIDGET (gtk_type_new (GTK_TYPE_CHECK_MENU_ITEM)); + return g_object_new (GTK_TYPE_CHECK_MENU_ITEM, NULL); } GtkWidget* @@ -184,7 +187,7 @@ gtk_check_menu_item_new_with_mnemonic (const gchar *label) GtkWidget *accel_label; check_menu_item = gtk_check_menu_item_new (); - accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); + accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); @@ -247,7 +250,7 @@ gtk_check_menu_item_set_show_toggle (GtkCheckMenuItem *menu_item, void gtk_check_menu_item_toggled (GtkCheckMenuItem *check_menu_item) { - gtk_signal_emit (GTK_OBJECT (check_menu_item), check_menu_item_signals[TOGGLED]); + g_signal_emit (check_menu_item, check_menu_item_signals[TOGGLED], 0); } /** diff --git a/gtk/gtkcheckmenuitem.h b/gtk/gtkcheckmenuitem.h index f3ac659f9..cdf16ce2f 100644 --- a/gtk/gtkcheckmenuitem.h +++ b/gtk/gtkcheckmenuitem.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_CHECK_MENU_ITEM (gtk_check_menu_item_get_type ()) -#define GTK_CHECK_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItem)) -#define GTK_CHECK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass)) -#define GTK_IS_CHECK_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CHECK_MENU_ITEM)) -#define GTK_IS_CHECK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_MENU_ITEM)) -#define GTK_CHECK_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass)) +#define GTK_CHECK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItem)) +#define GTK_CHECK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass)) +#define GTK_IS_CHECK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CHECK_MENU_ITEM)) +#define GTK_IS_CHECK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_MENU_ITEM)) +#define GTK_CHECK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CHECK_MENU_ITEM, GtkCheckMenuItemClass)) typedef struct _GtkCheckMenuItem GtkCheckMenuItem; @@ -73,7 +73,7 @@ struct _GtkCheckMenuItemClass }; -GtkType gtk_check_menu_item_get_type (void) G_GNUC_CONST; +GType gtk_check_menu_item_get_type (void) G_GNUC_CONST; GtkWidget* gtk_check_menu_item_new (void); GtkWidget* gtk_check_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_check_menu_item_new_with_mnemonic (const gchar *label); diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index a51ccf024..fa349474b 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -26,7 +26,6 @@ #include "gtkimagemenuitem.h" #include "gtkaccellabel.h" -#include "gtksignal.h" #include "gtkintl.h" #include "gtkstock.h" #include "gtkiconfactory.h" @@ -65,26 +64,29 @@ enum { static GtkMenuItemClass *parent_class = NULL; -GtkType +GType gtk_image_menu_item_get_type (void) { - static GtkType image_menu_item_type = 0; + static GType image_menu_item_type = 0; if (!image_menu_item_type) { - static const GtkTypeInfo image_menu_item_info = + static const GTypeInfo image_menu_item_info = { - "GtkImageMenuItem", - sizeof (GtkImageMenuItem), sizeof (GtkImageMenuItemClass), - (GtkClassInitFunc) gtk_image_menu_item_class_init, - (GtkObjectInitFunc) gtk_image_menu_item_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_image_menu_item_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkImageMenuItem), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_image_menu_item_init, }; - image_menu_item_type = gtk_type_unique (GTK_TYPE_MENU_ITEM, &image_menu_item_info); + image_menu_item_type = + g_type_register_static (GTK_TYPE_MENU_ITEM, "GtkImageMenuItem", + &image_menu_item_info, 0); } return image_menu_item_type; @@ -94,18 +96,16 @@ static void gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; GtkContainerClass *container_class; gobject_class = (GObjectClass*) klass; - object_class = (GtkObjectClass*) klass; widget_class = (GtkWidgetClass*) klass; menu_item_class = (GtkMenuItemClass*) klass; container_class = (GtkContainerClass*) klass; - parent_class = gtk_type_class (GTK_TYPE_MENU_ITEM); + parent_class = g_type_class_peek_parent (klass); widget_class->size_request = gtk_image_menu_item_size_request; widget_class->size_allocate = gtk_image_menu_item_size_allocate; @@ -301,8 +301,7 @@ gtk_image_menu_item_new_with_label (const gchar *label) GtkImageMenuItem *image_menu_item; GtkWidget *accel_label; - image_menu_item = GTK_IMAGE_MENU_ITEM (g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, - NULL)); + image_menu_item = g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, NULL); accel_label = gtk_accel_label_new (label); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); @@ -332,10 +331,9 @@ gtk_image_menu_item_new_with_mnemonic (const gchar *label) GtkImageMenuItem *image_menu_item; GtkWidget *accel_label; - image_menu_item = GTK_IMAGE_MENU_ITEM (g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, - NULL)); + image_menu_item = g_object_new (GTK_TYPE_IMAGE_MENU_ITEM, NULL); - accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); + accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); diff --git a/gtk/gtkimagemenuitem.h b/gtk/gtkimagemenuitem.h index d3fbc32e7..2cefa4113 100644 --- a/gtk/gtkimagemenuitem.h +++ b/gtk/gtkimagemenuitem.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_IMAGE_MENU_ITEM (gtk_image_menu_item_get_type ()) -#define GTK_IMAGE_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItem)) -#define GTK_IMAGE_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass)) -#define GTK_IS_IMAGE_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMAGE_MENU_ITEM)) -#define GTK_IS_IMAGE_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_MENU_ITEM)) -#define GTK_IMAGE_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass)) +#define GTK_IMAGE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItem)) +#define GTK_IMAGE_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass)) +#define GTK_IS_IMAGE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE_MENU_ITEM)) +#define GTK_IS_IMAGE_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_MENU_ITEM)) +#define GTK_IMAGE_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_MENU_ITEM, GtkImageMenuItemClass)) typedef struct _GtkImageMenuItem GtkImageMenuItem; @@ -62,7 +62,7 @@ struct _GtkImageMenuItemClass }; -GtkType gtk_image_menu_item_get_type (void) G_GNUC_CONST; +GType gtk_image_menu_item_get_type (void) G_GNUC_CONST; GtkWidget* gtk_image_menu_item_new (void); GtkWidget* gtk_image_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_image_menu_item_new_with_mnemonic (const gchar *label); diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index c643669d2..b535bb149 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -24,6 +24,8 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ +#define GTK_MENU_INTERNALS + #include <string.h> /* memset */ #include "gdk/gdkkeysyms.h" #include "gtkaccelmap.h" @@ -32,7 +34,6 @@ #include "gtkmain.h" #include "gtkmenu.h" #include "gtkmenuitem.h" -#include "gtksignal.h" #include "gtkwindow.h" #include "gtkhbox.h" #include "gtkvscrollbar.h" @@ -180,26 +181,28 @@ gtk_menu_get_private (GtkMenu *menu) return private; } -GtkType +GType gtk_menu_get_type (void) { - static GtkType menu_type = 0; + static GType menu_type = 0; if (!menu_type) { - static const GtkTypeInfo menu_info = + static const GTypeInfo menu_info = { - "GtkMenu", - sizeof (GtkMenu), sizeof (GtkMenuClass), - (GtkClassInitFunc) gtk_menu_class_init, - (GtkObjectInitFunc) gtk_menu_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_menu_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkMenu), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_menu_init, }; - menu_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_info); + menu_type = g_type_register_static (GTK_TYPE_MENU_SHELL, "GtkMenu", + &menu_info, 0); } return menu_type; @@ -228,6 +231,7 @@ gtk_menu_class_init (GtkMenuClass *class) _("A title that may be displayed by the window manager when this menu is torn-off"), "", G_PARAM_READABLE | G_PARAM_WRITABLE)); + object_class->destroy = gtk_menu_destroy; widget_class->realize = gtk_menu_realize; @@ -351,8 +355,8 @@ gtk_menu_window_event (GtkWidget *window, { gboolean handled = FALSE; - gtk_widget_ref (window); - gtk_widget_ref (menu); + g_object_ref (window); + g_object_ref (menu); switch (event->type) { @@ -364,8 +368,8 @@ gtk_menu_window_event (GtkWidget *window, break; } - gtk_widget_unref (window); - gtk_widget_unref (menu); + g_object_unref (window); + g_object_unref (menu); return handled; } @@ -396,16 +400,15 @@ gtk_menu_init (GtkMenu *menu) menu->position_func_data = NULL; menu->toggle_size = 0; - menu->toplevel = g_object_connect (gtk_widget_new (GTK_TYPE_WINDOW, - "type", GTK_WINDOW_POPUP, - "child", menu, - NULL), + menu->toplevel = g_object_connect (g_object_new (GTK_TYPE_WINDOW, + "type", GTK_WINDOW_POPUP, + "child", menu, + NULL), "signal::event", gtk_menu_window_event, menu, "signal::size_request", gtk_menu_window_size_request, menu, "signal::destroy", gtk_widget_destroyed, &menu->toplevel, NULL); - gtk_window_set_policy (GTK_WINDOW (menu->toplevel), - FALSE, FALSE, TRUE); + gtk_window_set_resizable (GTK_WINDOW (menu->toplevel), FALSE); gtk_window_set_mnemonic_modifier (GTK_WINDOW (menu->toplevel), 0); /* Refloat the menu, so that reference counting for the menu isn't @@ -449,7 +452,7 @@ gtk_menu_destroy (GtkObject *object) gtk_menu_stop_scrolling (menu); - data = gtk_object_get_data (object, attach_data_key); + data = g_object_get_data (G_OBJECT (object), attach_data_key); if (data) gtk_menu_detach (menu); @@ -457,7 +460,7 @@ gtk_menu_destroy (GtkObject *object) if (menu->old_active_menu_item) { - gtk_widget_unref (menu->old_active_menu_item); + g_object_unref (menu->old_active_menu_item); menu->old_active_menu_item = NULL; } @@ -465,7 +468,7 @@ gtk_menu_destroy (GtkObject *object) if (menu->needs_destruction_ref_count) { menu->needs_destruction_ref_count = FALSE; - gtk_object_ref (object); + g_object_ref (object); } if (menu->accel_group) @@ -506,21 +509,21 @@ gtk_menu_attach_to_widget (GtkMenu *menu, /* keep this function in sync with gtk_widget_set_parent() */ - data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); + data = g_object_get_data (G_OBJECT (menu), attach_data_key); if (data) { g_warning ("gtk_menu_attach_to_widget(): menu already attached to %s", - gtk_type_name (GTK_OBJECT_TYPE (data->attach_widget))); + g_type_name (G_TYPE_FROM_INSTANCE (data->attach_widget))); return; } - gtk_object_ref (GTK_OBJECT (menu)); + g_object_ref (menu); gtk_object_sink (GTK_OBJECT (menu)); data = g_new (GtkMenuAttachData, 1); data->attach_widget = attach_widget; data->detacher = detacher; - gtk_object_set_data (GTK_OBJECT (menu), attach_data_key, data); + g_object_set_data (G_OBJECT (menu), attach_data_key, data); if (GTK_WIDGET_STATE (menu) != GTK_STATE_NORMAL) gtk_widget_set_state (GTK_WIDGET (menu), GTK_STATE_NORMAL); @@ -540,7 +543,7 @@ gtk_menu_get_attach_widget (GtkMenu *menu) g_return_val_if_fail (GTK_IS_MENU (menu), NULL); - data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); + data = g_object_get_data (G_OBJECT (menu), attach_data_key); if (data) return data->attach_widget; return NULL; @@ -555,13 +558,13 @@ gtk_menu_detach (GtkMenu *menu) /* keep this function in sync with gtk_widget_unparent() */ - data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); + data = g_object_get_data (G_OBJECT (menu), attach_data_key); if (!data) { g_warning ("gtk_menu_detach(): menu is not attached"); return; } - gtk_object_remove_data (GTK_OBJECT (menu), attach_data_key); + g_object_set_data (G_OBJECT (menu), attach_data_key, NULL); data->detacher (data->attach_widget, menu); @@ -573,7 +576,7 @@ gtk_menu_detach (GtkMenu *menu) /* Fallback title for menu comes from attach widget */ gtk_menu_update_title (menu); - gtk_widget_unref (GTK_WIDGET (menu)); + g_object_unref (menu); } static void @@ -590,7 +593,7 @@ gtk_menu_remove (GtkContainer *container, */ if (menu->old_active_menu_item == widget) { - gtk_widget_unref (menu->old_active_menu_item); + g_object_unref (menu->old_active_menu_item); menu->old_active_menu_item = NULL; } @@ -601,7 +604,7 @@ gtk_menu_remove (GtkContainer *container, GtkWidget* gtk_menu_new (void) { - return GTK_WIDGET (gtk_type_new (gtk_menu_get_type ())); + return g_object_new (GTK_TYPE_MENU, NULL); } static void @@ -636,24 +639,24 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu) gc = gdk_gc_new_with_values (widget->window, &gc_values, GDK_GC_SUBWINDOW); - gdk_window_get_size (menu->tearoff_window->window, &width, &height); + gdk_drawable_get_size (menu->tearoff_window->window, &width, &height); pixmap = gdk_pixmap_new (menu->tearoff_window->window, width, height, -1); - gdk_draw_pixmap (pixmap, gc, - menu->tearoff_window->window, - 0, 0, 0, 0, -1, -1); - gdk_gc_unref (gc); + gdk_draw_drawable (pixmap, gc, + menu->tearoff_window->window, + 0, 0, 0, 0, -1, -1); + g_object_unref (gc); - gtk_widget_set_usize (menu->tearoff_window, - width, - height); + gtk_widget_set_size_request (menu->tearoff_window, + width, + height); gdk_window_set_back_pixmap (menu->tearoff_window->window, pixmap, FALSE); - gdk_pixmap_unref (pixmap); + g_object_unref (pixmap); } } @@ -710,7 +713,7 @@ gtk_menu_popup (GtkMenu *menu, * attached to a widget, try to get screen from its * toplevel window else go with the default */ - attach_data = gtk_object_get_data (GTK_OBJECT (menu), attach_data_key); + attach_data = g_object_get_data (G_OBJECT (menu), attach_data_key); if (attach_data) { if (!GTK_WIDGET_REALIZED (menu)) @@ -879,9 +882,9 @@ gtk_menu_popdown (GtkMenu *menu) if (menu_shell->active_menu_item) { if (menu->old_active_menu_item) - gtk_widget_unref (menu->old_active_menu_item); + g_object_unref (menu->old_active_menu_item); menu->old_active_menu_item = menu_shell->active_menu_item; - gtk_widget_ref (menu->old_active_menu_item); + g_object_ref (menu->old_active_menu_item); } gtk_menu_shell_deselect (menu_shell); @@ -892,7 +895,7 @@ gtk_menu_popdown (GtkMenu *menu) if (menu->torn_off) { - gtk_widget_set_usize (menu->tearoff_window, -1, -1); + gtk_widget_set_size_request (menu->tearoff_window, -1, -1); if (GTK_BIN (menu->toplevel)->child) { @@ -954,7 +957,7 @@ gtk_menu_get_active (GtkMenu *menu) menu->old_active_menu_item = child; if (menu->old_active_menu_item) - gtk_widget_ref (menu->old_active_menu_item); + g_object_ref (menu->old_active_menu_item); } return menu->old_active_menu_item; @@ -976,9 +979,9 @@ gtk_menu_set_active (GtkMenu *menu, if (GTK_BIN (child)->child) { if (menu->old_active_menu_item) - gtk_widget_unref (menu->old_active_menu_item); + g_object_unref (menu->old_active_menu_item); menu->old_active_menu_item = child; - gtk_widget_ref (menu->old_active_menu_item); + g_object_ref (menu->old_active_menu_item); } } } @@ -992,10 +995,10 @@ gtk_menu_set_accel_group (GtkMenu *menu, if (menu->accel_group != accel_group) { if (menu->accel_group) - gtk_accel_group_unref (menu->accel_group); + g_object_unref (menu->accel_group); menu->accel_group = accel_group; if (menu->accel_group) - gtk_accel_group_ref (menu->accel_group); + g_object_ref (menu->accel_group); _gtk_menu_refresh_accel_paths (menu, TRUE); } } @@ -1191,7 +1194,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu, menu->tearoff_hbox = gtk_hbox_new (FALSE, FALSE); gtk_container_add (GTK_CONTAINER (menu->tearoff_window), menu->tearoff_hbox); - gdk_window_get_size (GTK_WIDGET (menu)->window, &width, &height); + gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height); menu->tearoff_adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, @@ -1199,7 +1202,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu, MENU_SCROLL_STEP, height/2, height)); - g_object_connect (GTK_OBJECT (menu->tearoff_adjustment), + g_object_connect (menu->tearoff_adjustment, "signal::value_changed", gtk_menu_scrollbar_changed, menu, NULL); menu->tearoff_scrollbar = gtk_vscrollbar_new (menu->tearoff_adjustment); @@ -1216,7 +1219,7 @@ gtk_menu_set_tearoff_state (GtkMenu *menu, gtk_menu_reparent (menu, menu->tearoff_hbox, FALSE); - gdk_window_get_size (GTK_WIDGET (menu)->window, &width, NULL); + gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, NULL); /* Update menu->requisition */ @@ -1297,7 +1300,7 @@ gtk_menu_get_title (GtkMenu *menu) { g_return_val_if_fail (GTK_IS_MENU (menu), NULL); - return gtk_object_get_data (GTK_OBJECT (menu), "gtk-menu-title"); + return g_object_get_data (G_OBJECT (menu), "gtk-menu-title"); } void @@ -1697,7 +1700,7 @@ gtk_menu_paint (GtkWidget *widget, border_x = GTK_CONTAINER (widget)->border_width + widget->style->xthickness; border_y = GTK_CONTAINER (widget)->border_width + widget->style->ythickness; - gdk_window_get_size (widget->window, &width, &height); + gdk_drawable_get_size (widget->window, &width, &height); if (event->window == widget->window) { @@ -1839,7 +1842,7 @@ gtk_menu_key_press (GtkWidget *widget, if (event->keyval == keyval && (mods & event->state) == mods) { - gtk_signal_emit_by_name (GTK_OBJECT (menu), "cancel"); + g_signal_emit_by_name (menu, "cancel", 0); } g_free (accel); @@ -1975,7 +1978,7 @@ gtk_menu_motion_notify (GtkWidget *widget, menu_shell->ignore_enter = FALSE; - gdk_window_get_size (event->window, &width, &height); + gdk_drawable_get_size (event->window, &width, &height); if (event->x >= 0 && event->x < width && event->y >= 0 && event->y < height) { @@ -2033,7 +2036,7 @@ gtk_menu_scroll_timeout (gpointer data) if ((menu->scroll_offset >= 0) && (offset < 0)) offset = 0; - gdk_window_get_size (widget->window, &view_width, &view_height); + gdk_drawable_get_size (widget->window, &view_width, &view_height); /* Don't scroll past the bottom if we weren't before: */ if (menu->scroll_offset > 0) @@ -2064,7 +2067,7 @@ gtk_menu_handle_scrolling (GtkMenu *menu, gboolean enter) menu_shell = GTK_MENU_SHELL (menu); gdk_window_get_pointer (GTK_WIDGET (menu)->window, &x, &y, NULL); - gdk_window_get_size (GTK_WIDGET (menu)->window, &width, &height); + gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height); border = GTK_CONTAINER (menu)->border_width + GTK_WIDGET (menu)->style->ythickness; @@ -2301,11 +2304,11 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu, event_widget = gtk_get_event_widget ((GdkEvent*) event); gdk_window_get_origin (menu_item->submenu->window, &submenu_left, &submenu_top); - gdk_window_get_size (menu_item->submenu->window, &width, &height); + gdk_drawable_get_size (menu_item->submenu->window, &width, &height); submenu_right = submenu_left + width; submenu_bottom = submenu_top + height; - gdk_window_get_size (event_widget->window, &width, &height); + gdk_drawable_get_size (event_widget->window, &width, &height); if (event->x >= 0 && event->x < width) { @@ -2613,7 +2616,7 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell, if (child == menu_item) { y = menu->scroll_offset; - gdk_window_get_size (GTK_WIDGET (menu)->window, &width, &height); + gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height); height -= 2*GTK_CONTAINER (menu)->border_width + 2*GTK_WIDGET (menu)->style->ythickness; @@ -2707,15 +2710,15 @@ gtk_menu_reparent (GtkMenu *menu, GtkWidget *widget = GTK_WIDGET (menu); gboolean was_floating = GTK_OBJECT_FLOATING (object); - gtk_object_ref (object); + g_object_ref (object); gtk_object_sink (object); if (unrealize) { - gtk_object_ref (object); + g_object_ref (object); gtk_container_remove (GTK_CONTAINER (widget->parent), widget); gtk_container_add (GTK_CONTAINER (new_parent), widget); - gtk_object_unref (object); + g_object_unref (object); } else gtk_widget_reparent (GTK_WIDGET (menu), new_parent); @@ -2723,7 +2726,7 @@ gtk_menu_reparent (GtkMenu *menu, if (was_floating) GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING); else - gtk_object_unref (object); + g_object_unref (object); } static void diff --git a/gtk/gtkmenu.h b/gtk/gtkmenu.h index 5c1d47d08..103906995 100644 --- a/gtk/gtkmenu.h +++ b/gtk/gtkmenu.h @@ -38,11 +38,11 @@ extern "C" { #endif /* __cplusplus */ #define GTK_TYPE_MENU (gtk_menu_get_type ()) -#define GTK_MENU(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU, GtkMenu)) -#define GTK_MENU_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass)) -#define GTK_IS_MENU(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU)) -#define GTK_IS_MENU_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU)) -#define GTK_MENU_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass)) +#define GTK_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU, GtkMenu)) +#define GTK_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU, GtkMenuClass)) +#define GTK_IS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU)) +#define GTK_IS_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU)) +#define GTK_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass)) typedef struct _GtkMenu GtkMenu; @@ -121,7 +121,7 @@ struct _GtkMenuClass }; -GtkType gtk_menu_get_type (void) G_GNUC_CONST; +GType gtk_menu_get_type (void) G_GNUC_CONST; GtkWidget* gtk_menu_new (void); /* Display the menu onscreen */ diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index 6f36f6c66..c76e55b8d 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -35,7 +35,6 @@ #include "gtksettings.h" #include "gtkintl.h" #include "gtkwindow.h" -#include "gtksignal.h" #define BORDER_SPACING 0 @@ -57,26 +56,28 @@ static GtkShadowType get_shadow_type (GtkMenuBar *menubar); static GtkMenuShellClass *parent_class = NULL; -GtkType +GType gtk_menu_bar_get_type (void) { - static GtkType menu_bar_type = 0; + static GType menu_bar_type = 0; if (!menu_bar_type) { - static const GtkTypeInfo menu_bar_info = + static const GTypeInfo menu_bar_info = { - "GtkMenuBar", - sizeof (GtkMenuBar), sizeof (GtkMenuBarClass), - (GtkClassInitFunc) gtk_menu_bar_class_init, - (GtkObjectInitFunc) NULL, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_menu_bar_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkMenuBar), + 0, /* n_preallocs */ + NULL, /* instance_init */ }; - menu_bar_type = gtk_type_unique (gtk_menu_shell_get_type (), &menu_bar_info); + menu_bar_type = g_type_register_static (GTK_TYPE_MENU_SHELL, "GtkMenuBar", + &menu_bar_info, 0); } return menu_bar_type; @@ -168,7 +169,7 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class) GtkWidget* gtk_menu_bar_new (void) { - return GTK_WIDGET (gtk_type_new (gtk_menu_bar_get_type ())); + return g_object_new (GTK_TYPE_MENU_BAR, NULL); } static void @@ -472,7 +473,7 @@ add_to_window (GtkWindow *window, if (!menubars) { - g_signal_connect (G_OBJECT (window), + g_signal_connect (window, "key_press_event", G_CALLBACK (window_key_press_handler), NULL); @@ -494,8 +495,8 @@ remove_from_window (GtkWindow *window, if (!menubars) { - g_signal_handlers_disconnect_by_func (G_OBJECT (window), - (gpointer) window_key_press_handler, + g_signal_handlers_disconnect_by_func (window, + window_key_press_handler, NULL); } diff --git a/gtk/gtkmenubar.h b/gtk/gtkmenubar.h index 767812241..f7a1831e6 100644 --- a/gtk/gtkmenubar.h +++ b/gtk/gtkmenubar.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_MENU_BAR (gtk_menu_bar_get_type ()) -#define GTK_MENU_BAR(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU_BAR, GtkMenuBar)) -#define GTK_MENU_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_BAR, GtkMenuBarClass)) -#define GTK_IS_MENU_BAR(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU_BAR)) -#define GTK_IS_MENU_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_BAR)) -#define GTK_MENU_BAR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU_BAR, GtkMenuBarClass)) +#define GTK_MENU_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_BAR, GtkMenuBar)) +#define GTK_MENU_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_BAR, GtkMenuBarClass)) +#define GTK_IS_MENU_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_BAR)) +#define GTK_IS_MENU_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_BAR)) +#define GTK_MENU_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_BAR, GtkMenuBarClass)) typedef struct _GtkMenuBar GtkMenuBar; @@ -65,7 +65,7 @@ struct _GtkMenuBarClass }; -GtkType gtk_menu_bar_get_type (void) G_GNUC_CONST; +GType gtk_menu_bar_get_type (void) G_GNUC_CONST; GtkWidget* gtk_menu_bar_new (void); #ifndef GTK_DISABLE_DEPRECATED diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 0589ba18b..c510a09e4 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -34,7 +34,6 @@ #include "gtkmenubar.h" #include "gtkmenuitem.h" #include "gtkseparatormenuitem.h" -#include "gtksignal.h" #define BORDER_SPACING 3 @@ -103,10 +102,10 @@ static guint32 last_submenu_deselect_time = 0; -GtkType +GType gtk_menu_item_get_type (void) { - static GtkType menu_item_type = 0; + static GType menu_item_type = 0; if (!menu_item_type) { @@ -123,7 +122,8 @@ gtk_menu_item_get_type (void) (GInstanceInitFunc) gtk_menu_item_init, }; - menu_item_type = g_type_register_static (GTK_TYPE_ITEM, "GtkMenuItem", &menu_item_info, 0); + menu_item_type = g_type_register_static (GTK_TYPE_ITEM, "GtkMenuItem", + &menu_item_info, 0); } return menu_item_type; @@ -169,39 +169,43 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) klass->hide_on_activate = TRUE; menu_item_signals[ACTIVATE] = - gtk_signal_new ("activate", - GTK_RUN_FIRST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("activate", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkMenuItemClass, activate), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); widget_class->activate_signal = menu_item_signals[ACTIVATE]; menu_item_signals[ACTIVATE_ITEM] = - gtk_signal_new ("activate_item", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuItemClass, activate_item), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); + g_signal_new ("activate_item", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkMenuItemClass, activate_item), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); menu_item_signals[TOGGLE_SIZE_REQUEST] = - gtk_signal_new ("toggle_size_request", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuItemClass, toggle_size_request), - _gtk_marshal_VOID__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); + g_signal_new ("toggle_size_request", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkMenuItemClass, toggle_size_request), + NULL, NULL, + _gtk_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); menu_item_signals[TOGGLE_SIZE_ALLOCATE] = - gtk_signal_new ("toggle_size_allocate", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuItemClass, toggle_size_allocate), - _gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); + g_signal_new ("toggle_size_allocate", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkMenuItemClass, toggle_size_allocate), + NULL, NULL, + _gtk_marshal_NONE__INT, + G_TYPE_NONE, 1, + G_TYPE_INT); gtk_widget_class_install_style_property_parser (widget_class, g_param_spec_enum ("selected_shadow_type", @@ -232,7 +236,7 @@ gtk_menu_item_init (GtkMenuItem *menu_item) GtkWidget* gtk_menu_item_new (void) { - return GTK_WIDGET (gtk_type_new (gtk_menu_item_get_type ())); + return g_object_new (GTK_TYPE_MENU_ITEM, NULL); } GtkWidget* @@ -270,7 +274,7 @@ gtk_menu_item_new_with_mnemonic (const gchar *label) GtkWidget *accel_label; menu_item = gtk_menu_item_new (); - accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); + accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); @@ -399,7 +403,7 @@ gtk_menu_item_activate (GtkMenuItem *menu_item) { g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); - gtk_signal_emit (GTK_OBJECT (menu_item), menu_item_signals[ACTIVATE]); + g_signal_emit (menu_item, menu_item_signals[ACTIVATE], 0); } void @@ -408,7 +412,7 @@ gtk_menu_item_toggle_size_request (GtkMenuItem *menu_item, { g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); - gtk_signal_emit (GTK_OBJECT (menu_item), menu_item_signals[TOGGLE_SIZE_REQUEST], requisition); + g_signal_emit (menu_item, menu_item_signals[TOGGLE_SIZE_REQUEST], 0, requisition); } void @@ -417,7 +421,7 @@ gtk_menu_item_toggle_size_allocate (GtkMenuItem *menu_item, { g_return_if_fail (GTK_IS_MENU_ITEM (menu_item)); - gtk_signal_emit (GTK_OBJECT (menu_item), menu_item_signals[TOGGLE_SIZE_ALLOCATE], allocation); + g_signal_emit (menu_item, menu_item_signals[TOGGLE_SIZE_ALLOCATE], 0, allocation); } static void @@ -540,7 +544,7 @@ gtk_menu_item_realize (GtkWidget *widget) GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); widget->window = gtk_widget_get_parent_window (widget); - gdk_window_ref (widget->window); + g_object_ref (widget->window); attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; @@ -773,7 +777,7 @@ gtk_menu_item_mnemonic_activate (GtkWidget *widget, } else - gtk_signal_emit (GTK_OBJECT (widget), menu_item_signals[ACTIVATE_ITEM]); + g_signal_emit (widget, menu_item_signals[ACTIVATE_ITEM], 0); return TRUE; } diff --git a/gtk/gtkmenuitem.h b/gtk/gtkmenuitem.h index e8e45c550..a75061d93 100644 --- a/gtk/gtkmenuitem.h +++ b/gtk/gtkmenuitem.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_MENU_ITEM (gtk_menu_item_get_type ()) -#define GTK_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem)) -#define GTK_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM, GtkMenuItemClass)) -#define GTK_IS_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU_ITEM)) -#define GTK_IS_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_ITEM)) -#define GTK_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItemClass)) +#define GTK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItem)) +#define GTK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM, GtkMenuItemClass)) +#define GTK_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_ITEM)) +#define GTK_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_ITEM)) +#define GTK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM, GtkMenuItemClass)) typedef struct _GtkMenuItem GtkMenuItem; @@ -94,7 +94,7 @@ struct _GtkMenuItemClass }; -GtkType gtk_menu_item_get_type (void) G_GNUC_CONST; +GType gtk_menu_item_get_type (void) G_GNUC_CONST; GtkWidget* gtk_menu_item_new (void); GtkWidget* gtk_menu_item_new_with_label (const gchar *label); GtkWidget* gtk_menu_item_new_with_mnemonic (const gchar *label); diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index dd7e1a5ff..6f90e6154 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -33,7 +33,6 @@ #include "gtkmenubar.h" #include "gtkmenuitem.h" #include "gtkmenushell.h" -#include "gtksignal.h" #include "gtktearoffmenuitem.h" #include "gtkwindow.h" @@ -140,7 +139,7 @@ static gint gtk_menu_shell_is_item (GtkMenuShell *menu_shell, GtkWidget *child); static GtkWidget *gtk_menu_shell_get_item (GtkMenuShell *menu_shell, GdkEvent *event); -static GtkType gtk_menu_shell_child_type (GtkContainer *container); +static GType gtk_menu_shell_child_type (GtkContainer *container); static void gtk_menu_shell_real_select_item (GtkMenuShell *menu_shell, GtkWidget *menu_item); static void gtk_menu_shell_select_submenu_first (GtkMenuShell *menu_shell); @@ -157,10 +156,10 @@ static GtkContainerClass *parent_class = NULL; static guint menu_shell_signals[LAST_SIGNAL] = { 0 }; -GtkType +GType gtk_menu_shell_get_type (void) { - static GtkType menu_shell_type = 0; + static GType menu_shell_type = 0; if (!menu_shell_type) { @@ -169,17 +168,18 @@ gtk_menu_shell_get_type (void) sizeof (GtkMenuShellClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) gtk_menu_shell_class_init, + (GClassInitFunc) gtk_menu_shell_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GtkMenuShell), - 0, /* n_preallocs */ - (GInstanceInitFunc) gtk_menu_shell_init, - NULL /* value_table */ + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_menu_shell_init, + NULL, /* value_table */ }; - menu_shell_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkMenuShell", - &menu_shell_info, G_TYPE_FLAG_ABSTRACT); + menu_shell_type = + g_type_register_static (GTK_TYPE_CONTAINER, "GtkMenuShell", + &menu_shell_info, G_TYPE_FLAG_ABSTRACT); } return menu_shell_type; @@ -217,17 +217,17 @@ binding_signal_new (const gchar *signal_name, static void gtk_menu_shell_class_init (GtkMenuShellClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkBindingSet *binding_set; - object_class = (GtkObjectClass*) klass; + object_class = (GObjectClass*) klass; widget_class = (GtkWidgetClass*) klass; container_class = (GtkContainerClass*) klass; - parent_class = gtk_type_class (gtk_container_get_type ()); + parent_class = g_type_class_peek_parent (klass); widget_class->realize = gtk_menu_shell_realize; widget_class->button_press_event = gtk_menu_shell_button_press; @@ -251,50 +251,55 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass) klass->insert = gtk_menu_shell_real_insert; menu_shell_signals[DEACTIVATE] = - gtk_signal_new ("deactivate", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuShellClass, deactivate), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("deactivate", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkMenuShellClass, deactivate), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); menu_shell_signals[SELECTION_DONE] = - gtk_signal_new ("selection-done", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuShellClass, selection_done), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("selection-done", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkMenuShellClass, selection_done), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); menu_shell_signals[MOVE_CURRENT] = - gtk_signal_new ("move_current", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuShellClass, move_current), - _gtk_marshal_VOID__ENUM, - GTK_TYPE_NONE, 1, - GTK_TYPE_MENU_DIRECTION_TYPE); + g_signal_new ("move_current", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkMenuShellClass, move_current), + NULL, NULL, + _gtk_marshal_VOID__ENUM, + G_TYPE_NONE, 1, + GTK_TYPE_MENU_DIRECTION_TYPE); menu_shell_signals[ACTIVATE_CURRENT] = - gtk_signal_new ("activate_current", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuShellClass, activate_current), - _gtk_marshal_VOID__BOOLEAN, - GTK_TYPE_NONE, 1, - GTK_TYPE_BOOL); + g_signal_new ("activate_current", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkMenuShellClass, activate_current), + NULL, NULL, + _gtk_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, + G_TYPE_BOOLEAN); menu_shell_signals[CANCEL] = - gtk_signal_new ("cancel", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkMenuShellClass, cancel), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("cancel", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkMenuShellClass, cancel), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); menu_shell_signals[CYCLE_FOCUS] = binding_signal_new ("cycle_focus", G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | GTK_RUN_ACTION, + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_CALLBACK (gtk_real_menu_shell_cycle_focus), NULL, NULL, _gtk_marshal_VOID__ENUM, - GTK_TYPE_NONE, 1, + G_TYPE_NONE, 1, GTK_TYPE_DIRECTION_TYPE); @@ -305,22 +310,22 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass) gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "activate_current", 1, - GTK_TYPE_BOOL, + G_TYPE_BOOLEAN, TRUE); gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "activate_current", 1, - GTK_TYPE_BOOL, + G_TYPE_BOOLEAN, TRUE); gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "activate_current", 1, - GTK_TYPE_BOOL, + G_TYPE_BOOLEAN, FALSE); gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0, "activate_current", 1, - GTK_TYPE_BOOL, + G_TYPE_BOOLEAN, FALSE); gtk_binding_entry_add_signal (binding_set, GDK_F10, 0, @@ -332,7 +337,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass) GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD); } -static GtkType +static GType gtk_menu_shell_child_type (GtkContainer *container) { return GTK_TYPE_MENU_ITEM; @@ -398,7 +403,7 @@ gtk_menu_shell_deactivate (GtkMenuShell *menu_shell) { g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell)); - gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[DEACTIVATE]); + g_signal_emit (menu_shell, menu_shell_signals[DEACTIVATE], 0); } static void @@ -492,7 +497,7 @@ gtk_menu_shell_button_press (GtkWidget *widget, if (widget == GTK_WIDGET (menu_shell)) { gtk_menu_shell_deactivate (menu_shell); - gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]); + g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0); } } @@ -590,7 +595,7 @@ gtk_menu_shell_button_release (GtkWidget *widget, if (deactivate) { gtk_menu_shell_deactivate (menu_shell); - gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]); + g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0); } } @@ -910,7 +915,7 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell, if (!deactivate) deactivate = GTK_MENU_ITEM_GET_CLASS (menu_item)->hide_on_activate; - gtk_widget_ref (GTK_WIDGET (menu_shell)); + g_object_ref (menu_shell); if (deactivate) { @@ -918,7 +923,7 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell, do { - gtk_widget_ref (GTK_WIDGET (parent_menu_shell)); + g_object_ref (parent_menu_shell); shells = g_slist_prepend (shells, parent_menu_shell); parent_menu_shell = (GtkMenuShell*) parent_menu_shell->parent_menu_shell; } @@ -937,12 +942,12 @@ gtk_menu_shell_activate_item (GtkMenuShell *menu_shell, for (slist = shells; slist; slist = slist->next) { - gtk_signal_emit (slist->data, menu_shell_signals[SELECTION_DONE]); - gtk_widget_unref (slist->data); + g_signal_emit (slist->data, menu_shell_signals[SELECTION_DONE], 0); + g_object_unref (slist->data); } g_slist_free (shells); - gtk_widget_unref (GTK_WIDGET (menu_shell)); + g_object_unref (menu_shell); } /* Distance should be +/- 1 */ @@ -1162,7 +1167,7 @@ gtk_real_menu_shell_cancel (GtkMenuShell *menu_shell) gtk_menu_shell_deselect (menu_shell); gtk_menu_shell_deactivate (menu_shell); - gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]); + g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0); } static void diff --git a/gtk/gtkmenushell.h b/gtk/gtkmenushell.h index a2167875a..ec1150073 100644 --- a/gtk/gtkmenushell.h +++ b/gtk/gtkmenushell.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ()) -#define GTK_MENU_SHELL(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell)) -#define GTK_MENU_SHELL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass)) -#define GTK_IS_MENU_SHELL(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MENU_SHELL)) -#define GTK_IS_MENU_SHELL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL)) -#define GTK_MENU_SHELL_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass)) +#define GTK_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell)) +#define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass)) +#define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_SHELL)) +#define GTK_IS_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL)) +#define GTK_MENU_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass)) typedef struct _GtkMenuShell GtkMenuShell; @@ -95,7 +95,7 @@ struct _GtkMenuShellClass }; -GtkType gtk_menu_shell_get_type (void) G_GNUC_CONST; +GType gtk_menu_shell_get_type (void) G_GNUC_CONST; void gtk_menu_shell_append (GtkMenuShell *menu_shell, GtkWidget *child); void gtk_menu_shell_prepend (GtkMenuShell *menu_shell, diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c index 0debaffb1..99834a746 100644 --- a/gtk/gtkradiomenuitem.c +++ b/gtk/gtkradiomenuitem.c @@ -37,26 +37,29 @@ static void gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_men static GtkCheckMenuItemClass *parent_class = NULL; -GtkType +GType gtk_radio_menu_item_get_type (void) { - static GtkType radio_menu_item_type = 0; + static GType radio_menu_item_type = 0; if (!radio_menu_item_type) { - static const GtkTypeInfo radio_menu_item_info = + static const GTypeInfo radio_menu_item_info = { - "GtkRadioMenuItem", - sizeof (GtkRadioMenuItem), sizeof (GtkRadioMenuItemClass), - (GtkClassInitFunc) gtk_radio_menu_item_class_init, - (GtkObjectInitFunc) gtk_radio_menu_item_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_radio_menu_item_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkRadioMenuItem), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_radio_menu_item_init, }; - radio_menu_item_type = gtk_type_unique (gtk_check_menu_item_get_type (), &radio_menu_item_info); + radio_menu_item_type = + g_type_register_static (GTK_TYPE_CHECK_MENU_ITEM, "GtkRadioMenuItem", + &radio_menu_item_info, 0); } return radio_menu_item_type; @@ -67,7 +70,7 @@ gtk_radio_menu_item_new (GSList *group) { GtkRadioMenuItem *radio_menu_item; - radio_menu_item = gtk_type_new (gtk_radio_menu_item_get_type ()); + radio_menu_item = g_object_new (GTK_TYPE_RADIO_MENU_ITEM, NULL); gtk_radio_menu_item_set_group (radio_menu_item, group); @@ -157,7 +160,7 @@ gtk_radio_menu_item_new_with_mnemonic (GSList *group, GtkWidget *accel_label; radio_menu_item = gtk_radio_menu_item_new (group); - accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); + accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL); gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label); gtk_misc_set_alignment (GTK_MISC (accel_label), 0.0, 0.5); @@ -188,7 +191,7 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass) menu_item_class = (GtkMenuItemClass*) klass; check_menu_item_class = (GtkCheckMenuItemClass*) klass; - parent_class = gtk_type_class (gtk_check_menu_item_get_type ()); + parent_class = g_type_class_peek_parent (klass); object_class->destroy = gtk_radio_menu_item_destroy; diff --git a/gtk/gtkradiomenuitem.h b/gtk/gtkradiomenuitem.h index af7aa028f..4bbc8898d 100644 --- a/gtk/gtkradiomenuitem.h +++ b/gtk/gtkradiomenuitem.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_RADIO_MENU_ITEM (gtk_radio_menu_item_get_type ()) -#define GTK_RADIO_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItem)) -#define GTK_RADIO_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass)) -#define GTK_IS_RADIO_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_RADIO_MENU_ITEM)) -#define GTK_IS_RADIO_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_MENU_ITEM)) -#define GTK_RADIO_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass)) +#define GTK_RADIO_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItem)) +#define GTK_RADIO_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass)) +#define GTK_IS_RADIO_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RADIO_MENU_ITEM)) +#define GTK_IS_RADIO_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_MENU_ITEM)) +#define GTK_RADIO_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RADIO_MENU_ITEM, GtkRadioMenuItemClass)) typedef struct _GtkRadioMenuItem GtkRadioMenuItem; @@ -67,7 +67,7 @@ struct _GtkRadioMenuItemClass }; -GtkType gtk_radio_menu_item_get_type (void) G_GNUC_CONST; +GType gtk_radio_menu_item_get_type (void) G_GNUC_CONST; GtkWidget* gtk_radio_menu_item_new (GSList *group); GtkWidget* gtk_radio_menu_item_new_with_label (GSList *group, const gchar *label); |