From f18d5d35104bf4cb3998dfbee43f056649cb24b2 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Fri, 11 Oct 2002 22:57:11 +0000 Subject: [PATCH] Deprecation cleanup Fri Oct 11 15:56:20 2002 Manish Singh * gtk/gtkaccellabel.[ch] gtk/gtkaccessible.[ch] gtk/gtkbutton.[ch] gtk/gtkcheckbutton.[ch] gtk/gtkcolorseldialog.[ch] gtk/gtkdialog.[ch] gtk/gtkhandlebox.[ch] gtk/gtkinputdialog.[ch] gtk/gtkmessagedialog.[ch] gtk/gtktearoffmenuitem.[ch] gtk/gtktogglebutton.[ch]: Deprecation cleanup --- ChangeLog | 8 ++ ChangeLog.pre-2-10 | 8 ++ ChangeLog.pre-2-2 | 8 ++ ChangeLog.pre-2-4 | 8 ++ ChangeLog.pre-2-6 | 8 ++ ChangeLog.pre-2-8 | 8 ++ gtk/gtkaccellabel.c | 47 ++++++----- gtk/gtkaccellabel.h | 12 +-- gtk/gtkaccessible.c | 23 ++--- gtk/gtkaccessible.h | 16 ++-- gtk/gtkbutton.c | 126 +++++++++++++++------------- gtk/gtkbutton.h | 12 +-- gtk/gtkcheckbutton.c | 29 ++++--- gtk/gtkcheckbutton.h | 12 +-- gtk/gtkcolorseldialog.c | 34 ++++---- gtk/gtkcolorseldialog.h | 12 +-- gtk/gtkdialog.c | 157 +++++++++++++++++----------------- gtk/gtkdialog.h | 12 +-- gtk/gtkhandlebox.c | 91 ++++++++++---------- gtk/gtkhandlebox.h | 14 ++-- gtk/gtkinputdialog.c | 176 +++++++++++++++++++++------------------ gtk/gtkinputdialog.h | 12 +-- gtk/gtkmessagedialog.c | 33 ++++---- gtk/gtkmessagedialog.h | 12 +-- gtk/gtktearoffmenuitem.c | 53 ++++++------ gtk/gtktearoffmenuitem.h | 12 +-- gtk/gtktogglebutton.c | 50 +++++------ gtk/gtktogglebutton.h | 12 +-- 28 files changed, 545 insertions(+), 460 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1995b1bee6..ac53a9c6a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Oct 11 15:56:20 2002 Manish Singh + + * gtk/gtkaccellabel.[ch] gtk/gtkaccessible.[ch] gtk/gtkbutton.[ch] + gtk/gtkcheckbutton.[ch] gtk/gtkcolorseldialog.[ch] gtk/gtkdialog.[ch] + gtk/gtkhandlebox.[ch] gtk/gtkinputdialog.[ch] gtk/gtkmessagedialog.[ch] + gtk/gtktearoffmenuitem.[ch] gtk/gtktogglebutton.[ch]: Deprecation + cleanup + 2002-10-11 Matthias Clasen * examples/gtkdial/gtkdial.c (gtk_dial_destroy): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 1995b1bee6..ac53a9c6a2 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Fri Oct 11 15:56:20 2002 Manish Singh + + * gtk/gtkaccellabel.[ch] gtk/gtkaccessible.[ch] gtk/gtkbutton.[ch] + gtk/gtkcheckbutton.[ch] gtk/gtkcolorseldialog.[ch] gtk/gtkdialog.[ch] + gtk/gtkhandlebox.[ch] gtk/gtkinputdialog.[ch] gtk/gtkmessagedialog.[ch] + gtk/gtktearoffmenuitem.[ch] gtk/gtktogglebutton.[ch]: Deprecation + cleanup + 2002-10-11 Matthias Clasen * examples/gtkdial/gtkdial.c (gtk_dial_destroy): diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 1995b1bee6..ac53a9c6a2 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Fri Oct 11 15:56:20 2002 Manish Singh + + * gtk/gtkaccellabel.[ch] gtk/gtkaccessible.[ch] gtk/gtkbutton.[ch] + gtk/gtkcheckbutton.[ch] gtk/gtkcolorseldialog.[ch] gtk/gtkdialog.[ch] + gtk/gtkhandlebox.[ch] gtk/gtkinputdialog.[ch] gtk/gtkmessagedialog.[ch] + gtk/gtktearoffmenuitem.[ch] gtk/gtktogglebutton.[ch]: Deprecation + cleanup + 2002-10-11 Matthias Clasen * examples/gtkdial/gtkdial.c (gtk_dial_destroy): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 1995b1bee6..ac53a9c6a2 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Fri Oct 11 15:56:20 2002 Manish Singh + + * gtk/gtkaccellabel.[ch] gtk/gtkaccessible.[ch] gtk/gtkbutton.[ch] + gtk/gtkcheckbutton.[ch] gtk/gtkcolorseldialog.[ch] gtk/gtkdialog.[ch] + gtk/gtkhandlebox.[ch] gtk/gtkinputdialog.[ch] gtk/gtkmessagedialog.[ch] + gtk/gtktearoffmenuitem.[ch] gtk/gtktogglebutton.[ch]: Deprecation + cleanup + 2002-10-11 Matthias Clasen * examples/gtkdial/gtkdial.c (gtk_dial_destroy): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 1995b1bee6..ac53a9c6a2 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Fri Oct 11 15:56:20 2002 Manish Singh + + * gtk/gtkaccellabel.[ch] gtk/gtkaccessible.[ch] gtk/gtkbutton.[ch] + gtk/gtkcheckbutton.[ch] gtk/gtkcolorseldialog.[ch] gtk/gtkdialog.[ch] + gtk/gtkhandlebox.[ch] gtk/gtkinputdialog.[ch] gtk/gtkmessagedialog.[ch] + gtk/gtktearoffmenuitem.[ch] gtk/gtktogglebutton.[ch]: Deprecation + cleanup + 2002-10-11 Matthias Clasen * examples/gtkdial/gtkdial.c (gtk_dial_destroy): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 1995b1bee6..ac53a9c6a2 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Fri Oct 11 15:56:20 2002 Manish Singh + + * gtk/gtkaccellabel.[ch] gtk/gtkaccessible.[ch] gtk/gtkbutton.[ch] + gtk/gtkcheckbutton.[ch] gtk/gtkcolorseldialog.[ch] gtk/gtkdialog.[ch] + gtk/gtkhandlebox.[ch] gtk/gtkinputdialog.[ch] gtk/gtkmessagedialog.[ch] + gtk/gtktearoffmenuitem.[ch] gtk/gtktogglebutton.[ch]: Deprecation + cleanup + 2002-10-11 Matthias Clasen * examples/gtkdial/gtkdial.c (gtk_dial_destroy): diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 291f58aa3d..d05376247e 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -26,14 +26,14 @@ * files for a list of changes. These files are distributed with * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ + +#include + #include "gtkaccellabel.h" #include "gtkaccelmap.h" #include "gtkmain.h" -#include "gtksignal.h" #include "gtkintl.h" -#include - enum { PROP_0, PROP_ACCEL_CLOSURE, @@ -58,30 +58,32 @@ static gboolean gtk_accel_label_expose_event (GtkWidget *widget, GdkEventExpose *event); static gboolean gtk_accel_label_refetch_idle (GtkAccelLabel *accel_label); -static GtkAccelLabelClass *accel_label_class = NULL; static GtkLabelClass *parent_class = NULL; -GtkType +GType gtk_accel_label_get_type (void) { - static GtkType accel_label_type = 0; + static GType accel_label_type = 0; if (!accel_label_type) { - static const GtkTypeInfo accel_label_info = + static const GTypeInfo accel_label_info = { - "GtkAccelLabel", - sizeof (GtkAccelLabel), sizeof (GtkAccelLabelClass), - (GtkClassInitFunc) gtk_accel_label_class_init, - (GtkObjectInitFunc) gtk_accel_label_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_accel_label_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkAccelLabel), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_accel_label_init, }; - accel_label_type = gtk_type_unique (GTK_TYPE_LABEL, &accel_label_info); + accel_label_type = + g_type_register_static (GTK_TYPE_LABEL, "GtkAccelLabel", + &accel_label_info, 0); } return accel_label_type; @@ -94,7 +96,6 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class) GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - accel_label_class = class; parent_class = g_type_class_peek_parent (class); gobject_class->finalize = gtk_accel_label_finalize; @@ -130,14 +131,14 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class) class->accel_seperator = g_strdup (" / "); class->latin1_to_char = TRUE; - g_object_class_install_property (G_OBJECT_CLASS (object_class), + g_object_class_install_property (gobject_class, PROP_ACCEL_CLOSURE, g_param_spec_boxed ("accel_closure", _("Accelerator Closure"), _("The closure to be monitored for accelerator changes"), G_TYPE_CLOSURE, G_PARAM_READABLE | G_PARAM_WRITABLE)); - g_object_class_install_property (G_OBJECT_CLASS (object_class), + g_object_class_install_property (gobject_class, PROP_ACCEL_WIDGET, g_param_spec_object ("accel_widget", _("Accelerator Widget"), @@ -214,7 +215,7 @@ gtk_accel_label_new (const gchar *string) g_return_val_if_fail (string != NULL, NULL); - accel_label = gtk_type_new (GTK_TYPE_ACCEL_LABEL); + accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL); gtk_label_set_text (GTK_LABEL (accel_label), string); @@ -289,7 +290,7 @@ gtk_accel_label_size_request (GtkWidget *widget, pango_layout_get_pixel_size (layout, &width, NULL); accel_label->accel_string_width = width; - g_object_unref (G_OBJECT (layout)); + g_object_unref (layout); } static gboolean @@ -335,7 +336,7 @@ gtk_accel_label_expose_event (GtkWidget *widget, x, y, layout); - g_object_unref (G_OBJECT (layout)); + g_object_unref (layout); } else { @@ -388,7 +389,7 @@ gtk_accel_label_set_accel_widget (GtkAccelLabel *accel_label, { gtk_accel_label_set_accel_closure (accel_label, NULL); g_signal_handlers_disconnect_by_func (accel_label->accel_widget, - (gpointer) refetch_widget_accel_closure, + refetch_widget_accel_closure, accel_label); g_object_unref (accel_label->accel_widget); } @@ -448,7 +449,7 @@ gtk_accel_label_set_accel_closure (GtkAccelLabel *accel_label, if (accel_label->accel_closure) { g_signal_handlers_disconnect_by_func (accel_label->accel_group, - (gpointer) check_accel_changed, + check_accel_changed, accel_label); accel_label->accel_group = NULL; g_closure_unref (accel_label->accel_closure); diff --git a/gtk/gtkaccellabel.h b/gtk/gtkaccellabel.h index bef97381f5..08826d4394 100644 --- a/gtk/gtkaccellabel.h +++ b/gtk/gtkaccellabel.h @@ -40,11 +40,11 @@ extern "C" { #define GTK_TYPE_ACCEL_LABEL (gtk_accel_label_get_type ()) -#define GTK_ACCEL_LABEL(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ACCEL_LABEL, GtkAccelLabel)) -#define GTK_ACCEL_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_LABEL, GtkAccelLabelClass)) -#define GTK_IS_ACCEL_LABEL(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ACCEL_LABEL)) -#define GTK_IS_ACCEL_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_LABEL)) -#define GTK_ACCEL_LABEL_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ACCEL_LABEL, GtkAccelLabelClass)) +#define GTK_ACCEL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACCEL_LABEL, GtkAccelLabel)) +#define GTK_ACCEL_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_LABEL, GtkAccelLabelClass)) +#define GTK_IS_ACCEL_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACCEL_LABEL)) +#define GTK_IS_ACCEL_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_LABEL)) +#define GTK_ACCEL_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_LABEL, GtkAccelLabelClass)) typedef struct _GtkAccelLabel GtkAccelLabel; @@ -87,7 +87,7 @@ struct _GtkAccelLabelClass #define gtk_accel_label_accelerator_width gtk_accel_label_get_accel_width #endif /* GTK_DISABLE_DEPRECATED */ -GtkType gtk_accel_label_get_type (void) G_GNUC_CONST; +GType gtk_accel_label_get_type (void) G_GNUC_CONST; GtkWidget* gtk_accel_label_new (const gchar *string); GtkWidget* gtk_accel_label_get_accel_widget (GtkAccelLabel *accel_label); guint gtk_accel_label_get_accel_width (GtkAccelLabel *accel_label); diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c index 817fab77dd..0b48bca4e4 100644 --- a/gtk/gtkaccessible.c +++ b/gtk/gtkaccessible.c @@ -18,18 +18,18 @@ */ #include -#include -#include -#include + +#include "gtkwidget.h" +#include "gtkaccessible.h" static void gtk_accessible_class_init (GtkAccessibleClass *klass); static void gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible); -GtkType +GType gtk_accessible_get_type (void) { - static GtkType accessible_type = 0; + static GType accessible_type = 0; if (!accessible_type) { @@ -46,7 +46,9 @@ gtk_accessible_get_type (void) (GInstanceInitFunc) NULL, }; - accessible_type = g_type_register_static (ATK_TYPE_OBJECT, "GtkAccessible", &accessible_info, 0); + accessible_type = + g_type_register_static (ATK_TYPE_OBJECT, "GtkAccessible", + &accessible_info, 0); } return accessible_type; @@ -56,7 +58,6 @@ static void gtk_accessible_class_init (GtkAccessibleClass *klass) { klass->connect_widget_destroyed = gtk_accessible_real_connect_widget_destroyed; - } /** @@ -84,9 +85,9 @@ gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible) { if (accessible->widget) { - gtk_signal_connect (GTK_OBJECT (accessible->widget), - "destroy", - GTK_SIGNAL_FUNC (gtk_widget_destroyed), - &accessible->widget); + g_signal_connect (accessible->widget, + "destroy", + G_CALLBACK (gtk_widget_destroyed), + &accessible->widget); } } diff --git a/gtk/gtkaccessible.h b/gtk/gtkaccessible.h index 35e4937fbc..0dedcd7981 100644 --- a/gtk/gtkaccessible.h +++ b/gtk/gtkaccessible.h @@ -28,11 +28,11 @@ extern "C" { #endif /* __cplusplus */ #define GTK_TYPE_ACCESSIBLE (gtk_accessible_get_type ()) -#define GTK_ACCESSIBLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ACCESSIBLE, GtkAccessible)) -#define GTK_ACCESSIBLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCESSIBLE, GtkAccessibleClass)) -#define GTK_IS_ACCESSIBLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ACCESSIBLE)) -#define GTK_IS_ACCESSIBLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCESSIBLE)) -#define GTK_ACCESSIBLE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_ACCESSIBLE, GtkAccessibleClass)) +#define GTK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACCESSIBLE, GtkAccessible)) +#define GTK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCESSIBLE, GtkAccessibleClass)) +#define GTK_IS_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACCESSIBLE)) +#define GTK_IS_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCESSIBLE)) +#define GTK_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCESSIBLE, GtkAccessibleClass)) typedef struct _GtkAccessible GtkAccessible; typedef struct _GtkAccessibleClass GtkAccessibleClass; @@ -50,11 +50,8 @@ struct _GtkAccessible * accessible instance. */ GtkWidget *widget; - }; -GtkType gtk_accessible_get_type (void); - struct _GtkAccessibleClass { AtkObjectClass parent_class; @@ -68,7 +65,10 @@ struct _GtkAccessibleClass void (*_gtk_reserved4) (void); }; +GType gtk_accessible_get_type (void); + void gtk_accessible_connect_widget_destroyed (GtkAccessible *accessible); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 2647ec0cef..92dbd20628 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -30,7 +30,6 @@ #include "gtklabel.h" #include "gtkmain.h" #include "gtkmarshalers.h" -#include "gtksignal.h" #include "gtkimage.h" #include "gtkhbox.h" #include "gtkstock.h" @@ -98,9 +97,9 @@ static gint gtk_button_leave_notify (GtkWidget *widget, GdkEventCrossing *event); static void gtk_real_button_pressed (GtkButton *button); static void gtk_real_button_released (GtkButton *button); -static void gtk_real_button_activate (GtkButton *button); +static void gtk_real_button_activate (GtkButton *button); static void gtk_button_update_state (GtkButton *button); -static GtkType gtk_button_child_type (GtkContainer *container); +static GType gtk_button_child_type (GtkContainer *container); static void gtk_button_finish_activate (GtkButton *button, gboolean do_it); @@ -114,10 +113,10 @@ static GtkBinClass *parent_class = NULL; static guint button_signals[LAST_SIGNAL] = { 0 }; -GtkType +GType gtk_button_get_type (void) { - static GtkType button_type = 0; + static GType button_type = 0; if (!button_type) { @@ -134,7 +133,8 @@ gtk_button_get_type (void) (GInstanceInitFunc) gtk_button_init, }; - button_type = g_type_register_static (GTK_TYPE_BIN, "GtkButton", &button_info, 0); + button_type = g_type_register_static (GTK_TYPE_BIN, "GtkButton", + &button_info, 0); } return button_type; @@ -143,21 +143,21 @@ gtk_button_get_type (void) static void gtk_button_class_init (GtkButtonClass *klass) { - GObjectClass *g_object_class; + GObjectClass *gobject_class; GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; - g_object_class = G_OBJECT_CLASS (klass); + gobject_class = G_OBJECT_CLASS (klass); object_class = (GtkObjectClass*) klass; widget_class = (GtkWidgetClass*) klass; container_class = (GtkContainerClass*) klass; parent_class = g_type_class_peek_parent (klass); - g_object_class->constructor = gtk_button_constructor; - g_object_class->set_property = gtk_button_set_property; - g_object_class->get_property = gtk_button_get_property; + gobject_class->constructor = gtk_button_constructor; + gobject_class->set_property = gtk_button_set_property; + gobject_class->get_property = gtk_button_get_property; object_class->destroy = gtk_button_destroy; @@ -183,7 +183,7 @@ gtk_button_class_init (GtkButtonClass *klass) klass->leave = gtk_button_update_state; klass->activate = gtk_real_button_activate; - g_object_class_install_property (G_OBJECT_CLASS(object_class), + g_object_class_install_property (gobject_class, PROP_LABEL, g_param_spec_string ("label", _("Label"), @@ -191,7 +191,7 @@ gtk_button_class_init (GtkButtonClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - g_object_class_install_property (G_OBJECT_CLASS(object_class), + g_object_class_install_property (gobject_class, PROP_USE_UNDERLINE, g_param_spec_boolean ("use_underline", _("Use underline"), @@ -199,7 +199,7 @@ gtk_button_class_init (GtkButtonClass *klass) FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - g_object_class_install_property (G_OBJECT_CLASS(object_class), + g_object_class_install_property (gobject_class, PROP_USE_STOCK, g_param_spec_boolean ("use_stock", _("Use stock"), @@ -207,7 +207,7 @@ gtk_button_class_init (GtkButtonClass *klass) FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); - g_object_class_install_property (G_OBJECT_CLASS(object_class), + g_object_class_install_property (gobject_class, PROP_RELIEF, g_param_spec_enum ("relief", _("Border relief"), @@ -217,47 +217,53 @@ gtk_button_class_init (GtkButtonClass *klass) G_PARAM_READABLE | G_PARAM_WRITABLE)); button_signals[PRESSED] = - gtk_signal_new ("pressed", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkButtonClass, pressed), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("pressed", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkButtonClass, pressed), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); button_signals[RELEASED] = - gtk_signal_new ("released", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkButtonClass, released), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("released", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkButtonClass, released), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); button_signals[CLICKED] = - gtk_signal_new ("clicked", - GTK_RUN_FIRST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkButtonClass, clicked), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("clicked", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkButtonClass, clicked), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); button_signals[ENTER] = - gtk_signal_new ("enter", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkButtonClass, enter), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("enter", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkButtonClass, enter), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); button_signals[LEAVE] = - gtk_signal_new ("leave", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkButtonClass, leave), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("leave", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkButtonClass, leave), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); button_signals[ACTIVATE] = - gtk_signal_new ("activate", - GTK_RUN_FIRST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkButtonClass, activate), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("activate", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkButtonClass, activate), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); widget_class->activate_signal = button_signals[ACTIVATE]; gtk_widget_class_install_style_property (widget_class, @@ -345,13 +351,13 @@ gtk_button_constructor (GType type, } -static GtkType +static GType gtk_button_child_type (GtkContainer *container) { if (!GTK_BIN (container)->child) return GTK_TYPE_WIDGET; else - return GTK_TYPE_NONE; + return G_TYPE_NONE; } static void @@ -417,7 +423,7 @@ gtk_button_get_property (GObject *object, GtkWidget* gtk_button_new (void) { - return GTK_WIDGET (gtk_type_new (gtk_button_get_type ())); + return g_object_new (GTK_TYPE_BUTTON, NULL); } static void @@ -530,7 +536,7 @@ gtk_button_pressed (GtkButton *button) { g_return_if_fail (GTK_IS_BUTTON (button)); - gtk_signal_emit (GTK_OBJECT (button), button_signals[PRESSED]); + g_signal_emit (button, button_signals[PRESSED], 0); } void @@ -538,7 +544,7 @@ gtk_button_released (GtkButton *button) { g_return_if_fail (GTK_IS_BUTTON (button)); - gtk_signal_emit (GTK_OBJECT (button), button_signals[RELEASED]); + g_signal_emit (button, button_signals[RELEASED], 0); } void @@ -546,7 +552,7 @@ gtk_button_clicked (GtkButton *button) { g_return_if_fail (GTK_IS_BUTTON (button)); - gtk_signal_emit (GTK_OBJECT (button), button_signals[CLICKED]); + g_signal_emit (button, button_signals[CLICKED], 0); } void @@ -554,7 +560,7 @@ gtk_button_enter (GtkButton *button) { g_return_if_fail (GTK_IS_BUTTON (button)); - gtk_signal_emit (GTK_OBJECT (button), button_signals[ENTER]); + g_signal_emit (button, button_signals[ENTER], 0); } void @@ -562,7 +568,7 @@ gtk_button_leave (GtkButton *button) { g_return_if_fail (GTK_IS_BUTTON (button)); - gtk_signal_emit (GTK_OBJECT (button), button_signals[LEAVE]); + g_signal_emit (button, button_signals[LEAVE], 0); } void @@ -617,7 +623,7 @@ gtk_button_realize (GtkWidget *widget) attributes_mask = GDK_WA_X | GDK_WA_Y; widget->window = gtk_widget_get_parent_window (widget); - gdk_window_ref (widget->window); + g_object_ref (widget->window); button->event_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); diff --git a/gtk/gtkbutton.h b/gtk/gtkbutton.h index acdb05e255..f3500c3f2a 100644 --- a/gtk/gtkbutton.h +++ b/gtk/gtkbutton.h @@ -38,11 +38,11 @@ extern "C" { #endif /* __cplusplus */ #define GTK_TYPE_BUTTON (gtk_button_get_type ()) -#define GTK_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_BUTTON, GtkButton)) -#define GTK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_BUTTON, GtkButtonClass)) -#define GTK_IS_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_BUTTON)) -#define GTK_IS_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BUTTON)) -#define GTK_BUTTON_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_BUTTON, GtkButtonClass)) +#define GTK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BUTTON, GtkButton)) +#define GTK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BUTTON, GtkButtonClass)) +#define GTK_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BUTTON)) +#define GTK_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BUTTON)) +#define GTK_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BUTTON, GtkButtonClass)) typedef struct _GtkButton GtkButton; @@ -87,7 +87,7 @@ struct _GtkButtonClass }; -GtkType gtk_button_get_type (void) G_GNUC_CONST; +GType gtk_button_get_type (void) G_GNUC_CONST; GtkWidget* gtk_button_new (void); GtkWidget* gtk_button_new_with_label (const gchar *label); GtkWidget* gtk_button_new_from_stock (const gchar *stock_id); diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 5e3ef30d51..1fa1c1f832 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -51,26 +51,29 @@ static void gtk_real_check_button_draw_indicator (GtkCheckButton *check_but static GtkToggleButtonClass *parent_class = NULL; -GtkType +GType gtk_check_button_get_type (void) { - static GtkType check_button_type = 0; + static GType check_button_type = 0; if (!check_button_type) { - static const GtkTypeInfo check_button_info = + static const GTypeInfo check_button_info = { - "GtkCheckButton", - sizeof (GtkCheckButton), sizeof (GtkCheckButtonClass), - (GtkClassInitFunc) gtk_check_button_class_init, - (GtkObjectInitFunc) gtk_check_button_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_check_button_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkCheckButton), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_check_button_init, }; - check_button_type = gtk_type_unique (GTK_TYPE_TOGGLE_BUTTON, &check_button_info); + check_button_type = + g_type_register_static (GTK_TYPE_TOGGLE_BUTTON, "GtkCheckButton", + &check_button_info, 0); } return check_button_type; @@ -82,7 +85,7 @@ gtk_check_button_class_init (GtkCheckButtonClass *class) GtkWidgetClass *widget_class; widget_class = (GtkWidgetClass*) class; - parent_class = gtk_type_class (gtk_toggle_button_get_type ()); + parent_class = g_type_class_peek_parent (class); widget_class->size_request = gtk_check_button_size_request; widget_class->size_allocate = gtk_check_button_size_allocate; @@ -120,7 +123,7 @@ gtk_check_button_init (GtkCheckButton *check_button) GtkWidget* gtk_check_button_new (void) { - return gtk_widget_new (GTK_TYPE_CHECK_BUTTON, NULL); + return g_object_new (GTK_TYPE_CHECK_BUTTON, NULL); } diff --git a/gtk/gtkcheckbutton.h b/gtk/gtkcheckbutton.h index 62587f5f53..b2f3e1eaef 100644 --- a/gtk/gtkcheckbutton.h +++ b/gtk/gtkcheckbutton.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_CHECK_BUTTON (gtk_check_button_get_type ()) -#define GTK_CHECK_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CHECK_BUTTON, GtkCheckButton)) -#define GTK_CHECK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_BUTTON, GtkCheckButtonClass)) -#define GTK_IS_CHECK_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CHECK_BUTTON)) -#define GTK_IS_CHECK_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_BUTTON)) -#define GTK_CHECK_BUTTON_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CHECK_BUTTON, GtkCheckButtonClass)) +#define GTK_CHECK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CHECK_BUTTON, GtkCheckButton)) +#define GTK_CHECK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHECK_BUTTON, GtkCheckButtonClass)) +#define GTK_IS_CHECK_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CHECK_BUTTON)) +#define GTK_IS_CHECK_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHECK_BUTTON)) +#define GTK_CHECK_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CHECK_BUTTON, GtkCheckButtonClass)) typedef struct _GtkCheckButton GtkCheckButton; @@ -68,7 +68,7 @@ struct _GtkCheckButtonClass }; -GtkType gtk_check_button_get_type (void) G_GNUC_CONST; +GType gtk_check_button_get_type (void) G_GNUC_CONST; GtkWidget* gtk_check_button_new (void); GtkWidget* gtk_check_button_new_with_label (const gchar *label); GtkWidget* gtk_check_button_new_with_mnemonic (const gchar *label); diff --git a/gtk/gtkcolorseldialog.c b/gtk/gtkcolorseldialog.c index aa010b02d2..3d16c0a029 100644 --- a/gtk/gtkcolorseldialog.c +++ b/gtk/gtkcolorseldialog.c @@ -42,26 +42,29 @@ static GtkWindowClass *color_selection_dialog_parent_class = NULL; /* GtkColorSelectionDialog */ /***************************/ -GtkType +GType gtk_color_selection_dialog_get_type (void) { - static GtkType color_selection_dialog_type = 0; + static GType color_selection_dialog_type = 0; if (!color_selection_dialog_type) { - GtkTypeInfo colorsel_diag_info = + static const GTypeInfo colorsel_diag_info = { - "GtkColorSelectionDialog", - sizeof (GtkColorSelectionDialog), sizeof (GtkColorSelectionDialogClass), - (GtkClassInitFunc) gtk_color_selection_dialog_class_init, - (GtkObjectInitFunc) gtk_color_selection_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_color_selection_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkColorSelectionDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_color_selection_dialog_init, }; - color_selection_dialog_type = gtk_type_unique (GTK_TYPE_DIALOG, &colorsel_diag_info); + color_selection_dialog_type = + g_type_register_static (GTK_TYPE_DIALOG, "GtkColorSelectionDialog", + &colorsel_diag_info, 0); } return color_selection_dialog_type; @@ -70,11 +73,7 @@ gtk_color_selection_dialog_get_type (void) static void gtk_color_selection_dialog_class_init (GtkColorSelectionDialogClass *klass) { - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - color_selection_dialog_parent_class = gtk_type_class (GTK_TYPE_DIALOG); + color_selection_dialog_parent_class = g_type_class_peek_parent (klass); } static void @@ -118,9 +117,8 @@ gtk_color_selection_dialog_new (const gchar *title) { GtkColorSelectionDialog *colorseldiag; - colorseldiag = gtk_type_new (GTK_TYPE_COLOR_SELECTION_DIALOG); + colorseldiag = g_object_new (GTK_TYPE_COLOR_SELECTION_DIALOG, NULL); gtk_window_set_title (GTK_WINDOW (colorseldiag), title); - gtk_window_set_policy(GTK_WINDOW (colorseldiag), FALSE, FALSE, TRUE); return GTK_WIDGET (colorseldiag); } diff --git a/gtk/gtkcolorseldialog.h b/gtk/gtkcolorseldialog.h index 276df5b2ab..6a1c657de3 100644 --- a/gtk/gtkcolorseldialog.h +++ b/gtk/gtkcolorseldialog.h @@ -35,11 +35,11 @@ extern "C" { #endif /* __cplusplus */ #define GTK_TYPE_COLOR_SELECTION_DIALOG (gtk_color_selection_dialog_get_type ()) -#define GTK_COLOR_SELECTION_DIALOG(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_COLOR_SELECTION_DIALOG, GtkColorSelectionDialog)) -#define GTK_COLOR_SELECTION_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_SELECTION_DIALOG, GtkColorSelectionDialogClass)) -#define GTK_IS_COLOR_SELECTION_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_COLOR_SELECTION_DIALOG)) -#define GTK_IS_COLOR_SELECTION_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_SELECTION_DIALOG)) -#define GTK_COLOR_SELECTION_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_COLOR_SELECTION_DIALOG, GtkColorSelectionDialogClass)) +#define GTK_COLOR_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COLOR_SELECTION_DIALOG, GtkColorSelectionDialog)) +#define GTK_COLOR_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_SELECTION_DIALOG, GtkColorSelectionDialogClass)) +#define GTK_IS_COLOR_SELECTION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COLOR_SELECTION_DIALOG)) +#define GTK_IS_COLOR_SELECTION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_SELECTION_DIALOG)) +#define GTK_COLOR_SELECTION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COLOR_SELECTION_DIALOG, GtkColorSelectionDialogClass)) typedef struct _GtkColorSelectionDialog GtkColorSelectionDialog; @@ -69,7 +69,7 @@ struct _GtkColorSelectionDialogClass /* ColorSelectionDialog */ -GtkType gtk_color_selection_dialog_get_type (void) G_GNUC_CONST; +GType gtk_color_selection_dialog_get_type (void) G_GNUC_CONST; GtkWidget* gtk_color_selection_dialog_new (const gchar *title); diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 228a6decc0..f5c5614a09 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -30,7 +30,6 @@ #include "gtkhseparator.h" #include "gtkmarshalers.h" #include "gtkvbox.h" -#include "gtksignal.h" #include "gdkkeysyms.h" #include "gtkmain.h" #include "gtkintl.h" @@ -75,26 +74,28 @@ enum { static gpointer parent_class; static guint dialog_signals[LAST_SIGNAL]; -GtkType +GType gtk_dialog_get_type (void) { - static GtkType dialog_type = 0; + static GType dialog_type = 0; if (!dialog_type) { - static const GtkTypeInfo dialog_info = + static const GTypeInfo dialog_info = { - "GtkDialog", - sizeof (GtkDialog), sizeof (GtkDialogClass), - (GtkClassInitFunc) gtk_dialog_class_init, - (GtkObjectInitFunc) gtk_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_dialog_init, }; - dialog_type = gtk_type_unique (GTK_TYPE_WINDOW, &dialog_info); + dialog_type = g_type_register_static (GTK_TYPE_WINDOW, "GtkDialog", + &dialog_info, 0); } return dialog_type; @@ -104,12 +105,10 @@ static void gtk_dialog_class_init (GtkDialogClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkBindingSet *binding_set; gobject_class = G_OBJECT_CLASS (class); - object_class = GTK_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); parent_class = g_type_class_peek_parent (class); @@ -131,21 +130,23 @@ gtk_dialog_class_init (GtkDialogClass *class) G_PARAM_READWRITE)); dialog_signals[RESPONSE] = - gtk_signal_new ("response", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkDialogClass, response), - _gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); + g_signal_new ("response", + G_OBJECT_CLASS_TYPE (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkDialogClass, response), + NULL, NULL, + _gtk_marshal_NONE__INT, + G_TYPE_NONE, 1, + G_TYPE_INT); dialog_signals[CLOSE] = - gtk_signal_new ("close", - GTK_RUN_LAST | GTK_RUN_ACTION, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkDialogClass, close), - _gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("close", + G_OBJECT_CLASS_TYPE (class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (GtkDialogClass, close), + NULL, NULL, + _gtk_marshal_NONE__NONE, + G_TYPE_NONE, 0); gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("content_area_border", @@ -213,10 +214,10 @@ gtk_dialog_init (GtkDialog *dialog) * by connecting a handler, we have to have the FIRST signal * connection on the dialog. */ - gtk_signal_connect (GTK_OBJECT (dialog), - "delete_event", - GTK_SIGNAL_FUNC (gtk_dialog_delete_event_handler), - NULL); + g_signal_connect (dialog, + "delete_event", + G_CALLBACK (gtk_dialog_delete_event_handler), + NULL); dialog->vbox = gtk_vbox_new (FALSE, 0); @@ -364,7 +365,7 @@ gtk_dialog_close (GtkDialog *dialog) GtkWidget* gtk_dialog_new (void) { - return GTK_WIDGET (gtk_type_new (GTK_TYPE_DIALOG)); + return g_object_new (GTK_TYPE_DIALOG, NULL); } static GtkWidget* @@ -374,7 +375,7 @@ gtk_dialog_new_empty (const gchar *title, { GtkDialog *dialog; - dialog = GTK_DIALOG (g_object_new (GTK_TYPE_DIALOG, NULL)); + dialog = g_object_new (GTK_TYPE_DIALOG, NULL); if (title) gtk_window_set_title (GTK_WINDOW (dialog), title); @@ -468,17 +469,17 @@ struct _ResponseData static ResponseData* get_response_data (GtkWidget *widget) { - ResponseData *ad = gtk_object_get_data (GTK_OBJECT (widget), - "gtk-dialog-response-data"); + ResponseData *ad = g_object_get_data (G_OBJECT (widget), + "gtk-dialog-response-data"); if (ad == NULL) { ad = g_new (ResponseData, 1); - gtk_object_set_data_full (GTK_OBJECT (widget), - "gtk-dialog-response-data", - ad, - g_free); + g_object_set_data_full (G_OBJECT (widget), + "gtk-dialog-response-data", + ad, + g_free); } return ad; @@ -502,6 +503,7 @@ action_widget_activated (GtkWidget *widget, GtkDialog *dialog) gtk_dialog_response (dialog, response_id); } + /** * gtk_dialog_add_action_widget: * @dialog: a #GtkDialog @@ -516,9 +518,9 @@ action_widget_activated (GtkWidget *widget, GtkDialog *dialog) * action_area field of the #GtkDialog struct. **/ void -gtk_dialog_add_action_widget (GtkDialog *dialog, - GtkWidget *child, - gint response_id) +gtk_dialog_add_action_widget (GtkDialog *dialog, + GtkWidget *child, + gint response_id) { ResponseData *ad; gint signal_id = 0; @@ -531,21 +533,21 @@ gtk_dialog_add_action_widget (GtkDialog *dialog, ad->response_id = response_id; if (GTK_IS_BUTTON (child)) - { - signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON); - } + signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON); else signal_id = GTK_WIDGET_GET_CLASS (child)->activate_signal != 0; if (signal_id) { - const gchar* name = gtk_signal_name (signal_id); + GClosure *closure; - gtk_signal_connect_while_alive (GTK_OBJECT (child), - name, - GTK_SIGNAL_FUNC (action_widget_activated), - dialog, - GTK_OBJECT (dialog)); + closure = g_cclosure_new_object (G_CALLBACK (action_widget_activated), + G_OBJECT (dialog)); + g_signal_connect_closure_by_id (child, + signal_id, + 0, + closure, + FALSE); } else g_warning ("Only 'activatable' widgets can be packed into the action area of a GtkDialog"); @@ -797,9 +799,10 @@ gtk_dialog_response (GtkDialog *dialog, { g_return_if_fail (GTK_IS_DIALOG (dialog)); - gtk_signal_emit (GTK_OBJECT (dialog), - dialog_signals[RESPONSE], - response_id); + g_signal_emit (dialog, + dialog_signals[RESPONSE], + 0, + response_id); } typedef struct @@ -915,7 +918,7 @@ gtk_dialog_run (GtkDialog *dialog) g_return_val_if_fail (GTK_IS_DIALOG (dialog), -1); - gtk_object_ref (GTK_OBJECT (dialog)); + g_object_ref (dialog); if (!GTK_WIDGET_VISIBLE (dialog)) gtk_widget_show (GTK_WIDGET (dialog)); @@ -925,30 +928,30 @@ gtk_dialog_run (GtkDialog *dialog) gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); response_handler = - gtk_signal_connect (GTK_OBJECT (dialog), - "response", - GTK_SIGNAL_FUNC (run_response_handler), - &ri); + g_signal_connect (dialog, + "response", + G_CALLBACK (run_response_handler), + &ri); unmap_handler = - gtk_signal_connect (GTK_OBJECT (dialog), - "unmap", - GTK_SIGNAL_FUNC (run_unmap_handler), - &ri); + g_signal_connect (dialog, + "unmap", + G_CALLBACK (run_unmap_handler), + &ri); delete_handler = - gtk_signal_connect (GTK_OBJECT (dialog), - "delete_event", - GTK_SIGNAL_FUNC (run_delete_handler), - &ri); + g_signal_connect (dialog, + "delete_event", + G_CALLBACK (run_delete_handler), + &ri); destroy_handler = - gtk_signal_connect (GTK_OBJECT (dialog), - "destroy", - GTK_SIGNAL_FUNC (run_destroy_handler), - &ri); + g_signal_connect (dialog, + "destroy", + G_CALLBACK (run_destroy_handler), + &ri); - ri.loop = g_main_new (FALSE); + ri.loop = g_main_loop_new (NULL, FALSE); GDK_THREADS_LEAVE (); g_main_loop_run (ri.loop); @@ -964,13 +967,13 @@ gtk_dialog_run (GtkDialog *dialog) if (!was_modal) gtk_window_set_modal (GTK_WINDOW(dialog), FALSE); - gtk_signal_disconnect (GTK_OBJECT (dialog), response_handler); - gtk_signal_disconnect (GTK_OBJECT (dialog), unmap_handler); - gtk_signal_disconnect (GTK_OBJECT (dialog), delete_handler); - gtk_signal_disconnect (GTK_OBJECT (dialog), destroy_handler); + g_signal_handler_disconnect (dialog, response_handler); + g_signal_handler_disconnect (dialog, unmap_handler); + g_signal_handler_disconnect (dialog, delete_handler); + g_signal_handler_disconnect (dialog, destroy_handler); } - gtk_object_unref (GTK_OBJECT (dialog)); + g_object_unref (dialog); return ri.response_id; } diff --git a/gtk/gtkdialog.h b/gtk/gtkdialog.h index ebe7bcf619..953857c465 100644 --- a/gtk/gtkdialog.h +++ b/gtk/gtkdialog.h @@ -83,11 +83,11 @@ typedef enum #define GTK_TYPE_DIALOG (gtk_dialog_get_type ()) -#define GTK_DIALOG(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_DIALOG, GtkDialog)) -#define GTK_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIALOG, GtkDialogClass)) -#define GTK_IS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_DIALOG)) -#define GTK_IS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIALOG)) -#define GTK_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_DIALOG, GtkDialogClass)) +#define GTK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIALOG, GtkDialog)) +#define GTK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIALOG, GtkDialogClass)) +#define GTK_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIALOG)) +#define GTK_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIALOG)) +#define GTK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIALOG, GtkDialogClass)) typedef struct _GtkDialog GtkDialog; @@ -123,7 +123,7 @@ struct _GtkDialogClass }; -GtkType gtk_dialog_get_type (void) G_GNUC_CONST; +GType gtk_dialog_get_type (void) G_GNUC_CONST; GtkWidget* gtk_dialog_new (void); GtkWidget* gtk_dialog_new_with_buttons (const gchar *title, diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index 4c72df49d8..41f5afd2bb 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -29,7 +29,6 @@ #include "gtkhandlebox.h" #include "gtkmain.h" #include "gtkmarshalers.h" -#include "gtksignal.h" #include "gtkwindow.h" #include "gtkintl.h" @@ -136,26 +135,28 @@ static GtkBinClass *parent_class; static guint handle_box_signals[SIGNAL_LAST] = { 0 }; -GtkType +GType gtk_handle_box_get_type (void) { - static GtkType handle_box_type = 0; + static GType handle_box_type = 0; if (!handle_box_type) { - static const GtkTypeInfo handle_box_info = + static const GTypeInfo handle_box_info = { - "GtkHandleBox", - sizeof (GtkHandleBox), sizeof (GtkHandleBoxClass), - (GtkClassInitFunc) gtk_handle_box_class_init, - (GtkObjectInitFunc) gtk_handle_box_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_handle_box_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkHandleBox), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_handle_box_init, }; - handle_box_type = gtk_type_unique (GTK_TYPE_BIN, &handle_box_info); + handle_box_type = g_type_register_static (GTK_TYPE_BIN, "GtkHandleBox", + &handle_box_info, 0); } return handle_box_type; @@ -174,7 +175,7 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) widget_class = (GtkWidgetClass *) class; container_class = (GtkContainerClass *) class; - parent_class = gtk_type_class (GTK_TYPE_BIN); + parent_class = g_type_class_peek_parent (class); gobject_class->set_property = gtk_handle_box_set_property; gobject_class->get_property = gtk_handle_box_get_property; @@ -212,6 +213,7 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) GTK_TYPE_POSITION_TYPE, GTK_POS_TOP, G_PARAM_READABLE | G_PARAM_WRITABLE)); + object_class->destroy = gtk_handle_box_destroy; widget_class->map = gtk_handle_box_map; @@ -234,21 +236,23 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) class->child_detached = NULL; handle_box_signals[SIGNAL_CHILD_ATTACHED] = - gtk_signal_new ("child_attached", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_attached), - _gtk_marshal_VOID__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_WIDGET); + g_signal_new ("child_attached", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkHandleBoxClass, child_attached), + NULL, NULL, + _gtk_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GTK_TYPE_WIDGET); handle_box_signals[SIGNAL_CHILD_DETACHED] = - gtk_signal_new ("child_detached", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkHandleBoxClass, child_detached), - _gtk_marshal_VOID__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_WIDGET); + g_signal_new ("child_detached", + G_OBJECT_CLASS_TYPE (gobject_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GtkHandleBoxClass, child_detached), + NULL, NULL, + _gtk_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GTK_TYPE_WIDGET); } static void @@ -322,7 +326,7 @@ gtk_handle_box_get_property (GObject *object, GtkWidget* gtk_handle_box_new (void) { - return GTK_WIDGET (gtk_type_new (gtk_handle_box_get_type ())); + return g_object_new (GTK_TYPE_HANDLE_BOX, NULL); } static void @@ -818,7 +822,7 @@ gtk_handle_box_paint (GtkWidget *widget, bin = GTK_BIN (widget); hb = GTK_HANDLE_BOX (widget); - gdk_window_get_size (hb->bin_window, &width, &height); + gdk_drawable_get_size (hb->bin_window, &width, &height); if (!event) gtk_paint_box (widget->style, @@ -961,7 +965,7 @@ gtk_handle_box_button_changed (GtkWidget *widget, gdk_window_get_deskrelative_origin (hb->bin_window, &desk_x, &desk_y); gdk_window_get_origin (hb->bin_window, &root_x, &root_y); - gdk_window_get_size (hb->bin_window, &width, &height); + gdk_drawable_get_size (hb->bin_window, &width, &height); hb->float_allocation.x = root_x - event->x_root; hb->float_allocation.y = root_y - event->y_root; @@ -972,7 +976,7 @@ gtk_handle_box_button_changed (GtkWidget *widget, hb->deskoff_y = desk_y - root_y; gdk_window_get_origin (widget->window, &root_x, &root_y); - gdk_window_get_size (widget->window, &width, &height); + gdk_drawable_get_size (widget->window, &width, &height); hb->attach_allocation.x = root_x; hb->attach_allocation.y = root_y; @@ -994,7 +998,7 @@ gtk_handle_box_button_changed (GtkWidget *widget, hb->in_drag = FALSE; } - gdk_cursor_destroy (fleur); + gdk_cursor_unref (fleur); event_handled = TRUE; } else if (hb->child_detached) /* Double click */ @@ -1112,9 +1116,10 @@ gtk_handle_box_motion (GtkWidget *widget, gdk_window_hide (hb->float_window); gdk_window_reparent (hb->bin_window, widget->window, 0, 0); hb->float_window_mapped = FALSE; - gtk_signal_emit (GTK_OBJECT (hb), - handle_box_signals[SIGNAL_CHILD_ATTACHED], - GTK_BIN (hb)->child); + g_signal_emit (hb, + handle_box_signals[SIGNAL_CHILD_ATTACHED], + 0, + GTK_BIN (hb)->child); gtk_widget_queue_resize (widget); } @@ -1123,7 +1128,7 @@ gtk_handle_box_motion (GtkWidget *widget, { gint width, height; - gdk_window_get_size (hb->float_window, &width, &height); + gdk_drawable_get_size (hb->float_window, &width, &height); new_x += hb->deskoff_x; new_y += hb->deskoff_y; @@ -1187,9 +1192,10 @@ gtk_handle_box_motion (GtkWidget *widget, gdk_window_move (hb->float_window, new_x, new_y); gdk_display_sync (gtk_widget_get_display (widget)); #endif /* 0 */ - gtk_signal_emit (GTK_OBJECT (hb), - handle_box_signals[SIGNAL_CHILD_DETACHED], - GTK_BIN (hb)->child); + g_signal_emit (hb, + handle_box_signals[SIGNAL_CHILD_DETACHED], + 0, + GTK_BIN (hb)->child); gtk_handle_box_draw_ghost (hb); gtk_widget_queue_resize (widget); @@ -1246,9 +1252,10 @@ gtk_handle_box_reattach (GtkHandleBox *hb) gdk_window_reparent (hb->bin_window, widget->window, 0, 0); if (GTK_BIN (hb)->child) - gtk_signal_emit (GTK_OBJECT (hb), - handle_box_signals[SIGNAL_CHILD_ATTACHED], - GTK_BIN (hb)->child); + g_signal_emit (hb, + handle_box_signals[SIGNAL_CHILD_ATTACHED], + 0, + GTK_BIN (hb)->child); } hb->float_window_mapped = FALSE; diff --git a/gtk/gtkhandlebox.h b/gtk/gtkhandlebox.h index 1f6ec3e292..07010ba071 100644 --- a/gtk/gtkhandlebox.h +++ b/gtk/gtkhandlebox.h @@ -44,11 +44,11 @@ extern "C" { #define GTK_TYPE_HANDLE_BOX (gtk_handle_box_get_type ()) -#define GTK_HANDLE_BOX(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBox)) -#define GTK_HANDLE_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass)) -#define GTK_IS_HANDLE_BOX(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_HANDLE_BOX)) -#define GTK_IS_HANDLE_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HANDLE_BOX)) -#define GTK_HANDLE_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass)) +#define GTK_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBox)) +#define GTK_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass)) +#define GTK_IS_HANDLE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HANDLE_BOX)) +#define GTK_IS_HANDLE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HANDLE_BOX)) +#define GTK_HANDLE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HANDLE_BOX, GtkHandleBoxClass)) typedef struct _GtkHandleBox GtkHandleBox; @@ -94,8 +94,8 @@ struct _GtkHandleBoxClass }; -GtkType gtk_handle_box_get_type (void) G_GNUC_CONST; -GtkWidget* gtk_handle_box_new (void); +GType gtk_handle_box_get_type (void) G_GNUC_CONST; +GtkWidget* gtk_handle_box_new (void); void gtk_handle_box_set_shadow_type (GtkHandleBox *handle_box, GtkShadowType type); GtkShadowType gtk_handle_box_get_shadow_type (GtkHandleBox *handle_box); diff --git a/gtk/gtkinputdialog.c b/gtk/gtkinputdialog.c index 7d9a3af7a1..3bb0584aef 100644 --- a/gtk/gtkinputdialog.c +++ b/gtk/gtkinputdialog.c @@ -49,7 +49,6 @@ #include "gtknotebook.h" #include "gtkoptionmenu.h" #include "gtkscrolledwindow.h" -#include "gtksignal.h" #include "gtkstock.h" #include "gtktable.h" #include "gtkvbox.h" @@ -76,6 +75,8 @@ enum #define KEYS_LIST_WIDTH 200 #define KEYS_LIST_HEIGHT 175 +#define GTK_INPUT_DIALOG_KEY "gtk-input-dialog-key" + /* Forward declarations */ static void gtk_input_dialog_class_init (GtkInputDialogClass *klass); @@ -104,27 +105,29 @@ static void gtk_input_dialog_fill_keys (GtkInputDialog *inputd, static GtkObjectClass *parent_class = NULL; static guint input_dialog_signals[LAST_SIGNAL] = { 0 }; -GtkType +GType gtk_input_dialog_get_type (void) { - static GtkType input_dialog_type = 0; + static GType input_dialog_type = 0; if (!input_dialog_type) { - static const GtkTypeInfo input_dialog_info = + static const GTypeInfo input_dialog_info = { - "GtkInputDialog", - sizeof (GtkInputDialog), sizeof (GtkInputDialogClass), - (GtkClassInitFunc) gtk_input_dialog_class_init, - (GtkObjectInitFunc) gtk_input_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_input_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkInputDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_input_dialog_init, }; - input_dialog_type = gtk_type_unique (GTK_TYPE_DIALOG, - &input_dialog_info); + input_dialog_type = + g_type_register_static (GTK_TYPE_DIALOG, "GtkInputDialog", + &input_dialog_info, 0); } return input_dialog_type; @@ -133,30 +136,30 @@ gtk_input_dialog_get_type (void) static void gtk_input_dialog_class_init (GtkInputDialogClass *klass) { - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (GTK_TYPE_DIALOG); + parent_class = g_type_class_peek_parent (klass); klass->enable_device = NULL; klass->disable_device = NULL; input_dialog_signals[ENABLE_DEVICE] = - gtk_signal_new ("enable_device", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkInputDialogClass, enable_device), - _gtk_marshal_VOID__OBJECT, - GTK_TYPE_NONE, 1, GDK_TYPE_DEVICE); + g_signal_new ("enable_device", + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkInputDialogClass, enable_device), + NULL, NULL, + _gtk_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GDK_TYPE_DEVICE); input_dialog_signals[DISABLE_DEVICE] = - gtk_signal_new ("disable_device", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkInputDialogClass, disable_device), - _gtk_marshal_VOID__OBJECT, - GTK_TYPE_NONE, 1, GDK_TYPE_DEVICE); + g_signal_new ("disable_device", + G_OBJECT_CLASS_TYPE (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkInputDialogClass, disable_device), + NULL, NULL, + _gtk_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + GDK_TYPE_DEVICE); } static void @@ -204,14 +207,15 @@ gtk_input_dialog_init (GtkInputDialog *inputd) GdkDevice *info = (GdkDevice *)(tmp_list->data); if (info != gdk_device_get_core_pointer ()) { - menuitem = gtk_menu_item_new_with_label(info->name); + menuitem = gtk_menu_item_new_with_label (info->name); gtk_menu_shell_append (GTK_MENU_SHELL (device_menu), menuitem); gtk_widget_show (menuitem); - gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - (GtkSignalFunc) gtk_input_dialog_set_device, - info); + g_object_set_data (G_OBJECT (menuitem), GTK_INPUT_DIALOG_KEY, + inputd); + g_signal_connect (menuitem, "activate", + G_CALLBACK (gtk_input_dialog_set_device), + info); } } @@ -237,27 +241,27 @@ gtk_input_dialog_init (GtkInputDialog *inputd) menuitem = gtk_menu_item_new_with_label(_("Disabled")); gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem); - gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd); + g_object_set_data (G_OBJECT (menuitem), GTK_INPUT_DIALOG_KEY, inputd); gtk_widget_show (menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - (GtkSignalFunc) gtk_input_dialog_set_mapping_mode, - GINT_TO_POINTER (GDK_MODE_DISABLED)); + g_signal_connect (menuitem, "activate", + G_CALLBACK (gtk_input_dialog_set_mapping_mode), + GINT_TO_POINTER (GDK_MODE_DISABLED)); menuitem = gtk_menu_item_new_with_label(_("Screen")); gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem); - gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd); + g_object_set_data (G_OBJECT (menuitem), GTK_INPUT_DIALOG_KEY, inputd); gtk_widget_show (menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - (GtkSignalFunc) gtk_input_dialog_set_mapping_mode, - GINT_TO_POINTER (GDK_MODE_SCREEN)); + g_signal_connect (menuitem, "activate", + G_CALLBACK (gtk_input_dialog_set_mapping_mode), + GINT_TO_POINTER (GDK_MODE_SCREEN)); menuitem = gtk_menu_item_new_with_label(_("Window")); gtk_menu_shell_append (GTK_MENU_SHELL (mapping_menu), menuitem); - gtk_object_set_user_data (GTK_OBJECT (menuitem), inputd); + g_object_set_data (G_OBJECT (menuitem), GTK_INPUT_DIALOG_KEY, inputd); gtk_widget_show (menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - (GtkSignalFunc) gtk_input_dialog_set_mapping_mode, - GINT_TO_POINTER (GDK_MODE_WINDOW)); + g_signal_connect (menuitem, "activate", + G_CALLBACK (gtk_input_dialog_set_mapping_mode), + GINT_TO_POINTER (GDK_MODE_WINDOW)); label = gtk_label_new_with_mnemonic (_("_Mode: ")); gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2); @@ -296,7 +300,8 @@ gtk_input_dialog_init (GtkInputDialog *inputd) gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->axis_listbox), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_usize (inputd->axis_listbox, AXIS_LIST_WIDTH, AXIS_LIST_HEIGHT); + gtk_widget_set_size_request (inputd->axis_listbox, + AXIS_LIST_WIDTH, AXIS_LIST_HEIGHT); gtk_notebook_append_page (GTK_NOTEBOOK(notebook), inputd->axis_listbox, label); @@ -309,10 +314,11 @@ gtk_input_dialog_init (GtkInputDialog *inputd) label = gtk_label_new_with_mnemonic (_("_Keys")); inputd->keys_listbox = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_set_usize (inputd->keys_listbox, KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->keys_listbox), + gtk_widget_set_size_request (inputd->keys_listbox, + KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (inputd->keys_listbox), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_notebook_append_page (GTK_NOTEBOOK(notebook), + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), inputd->keys_listbox, label); gtk_widget_show (inputd->keys_listbox); @@ -320,7 +326,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd) inputd->keys_list = 0; /* ...set_device expects to get input dialog from widget user data */ - gtk_object_set_user_data (GTK_OBJECT (inputd), inputd); + g_object_set_data (G_OBJECT (inputd), GTK_INPUT_DIALOG_KEY, inputd); gtk_input_dialog_set_device (GTK_WIDGET(inputd), device_info->data); } @@ -355,34 +361,34 @@ gtk_input_dialog_new (void) { GtkInputDialog *inputd; - inputd = gtk_type_new (GTK_TYPE_INPUT_DIALOG); + inputd = g_object_new (GTK_TYPE_INPUT_DIALOG, NULL); return GTK_WIDGET (inputd); } static void -gtk_input_dialog_set_device(GtkWidget *widget, gpointer data) +gtk_input_dialog_set_device (GtkWidget *w, + gpointer data) { GdkDevice *device = data; - - GtkInputDialog *inputd = GTK_INPUT_DIALOG( - gtk_object_get_user_data(GTK_OBJECT(widget))); + GtkInputDialog *inputd = + GTK_INPUT_DIALOG (g_object_get_data (G_OBJECT (w), GTK_INPUT_DIALOG_KEY)); inputd->current_device = device; - gtk_input_dialog_fill_axes(inputd, device); - gtk_input_dialog_fill_keys(inputd, device); + gtk_input_dialog_fill_axes (inputd, device); + gtk_input_dialog_fill_keys (inputd, device); - gtk_option_menu_set_history(GTK_OPTION_MENU(inputd->mode_optionmenu), - device->mode); + gtk_option_menu_set_history (GTK_OPTION_MENU (inputd->mode_optionmenu), + device->mode); } static void gtk_input_dialog_set_mapping_mode (GtkWidget *w, gpointer data) { - GtkInputDialog *inputd = GTK_INPUT_DIALOG( - gtk_object_get_user_data(GTK_OBJECT(w))); + GtkInputDialog *inputd = + GTK_INPUT_DIALOG (g_object_get_data (G_OBJECT (w), GTK_INPUT_DIALOG_KEY)); GdkDevice *info = inputd->current_device; GdkInputMode old_mode = info->mode; GdkInputMode mode = GPOINTER_TO_INT (data); @@ -392,13 +398,15 @@ gtk_input_dialog_set_mapping_mode (GtkWidget *w, if (gdk_device_set_mode (inputd->current_device, mode)) { if (mode == GDK_MODE_DISABLED) - gtk_signal_emit (GTK_OBJECT (inputd), - input_dialog_signals[DISABLE_DEVICE], - info); + g_signal_emit (inputd, + input_dialog_signals[DISABLE_DEVICE], + 0, + info); else - gtk_signal_emit (GTK_OBJECT (inputd), - input_dialog_signals[ENABLE_DEVICE], - info); + g_signal_emit (inputd, + input_dialog_signals[ENABLE_DEVICE], + 0, + info); } else gtk_option_menu_set_history (GTK_OPTION_MENU (inputd->mode_optionmenu), @@ -409,12 +417,14 @@ gtk_input_dialog_set_mapping_mode (GtkWidget *w, } static void -gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data) +gtk_input_dialog_set_axis (GtkWidget *w, + gpointer data) { GdkAxisUse use = GPOINTER_TO_INT(data) & 0xFFFF; GdkAxisUse old_use; GdkAxisUse *new_axes; - GtkInputDialog *inputd = GTK_INPUT_DIALOG (gtk_object_get_user_data (GTK_OBJECT (widget))); + GtkInputDialog *inputd = + GTK_INPUT_DIALOG (g_object_get_data (G_OBJECT (w), GTK_INPUT_DIALOG_KEY)); GdkDevice *info = inputd->current_device; gint axis = (GPOINTER_TO_INT(data) >> 16) - 1; @@ -522,10 +532,11 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDevice *info) sprintf (buffer,"%d",j+1); menu_item = gtk_menu_item_new_with_label (buffer); } - gtk_object_set_user_data (GTK_OBJECT (menu_item), inputd); - gtk_signal_connect (GTK_OBJECT (menu_item), "activate", - (GtkSignalFunc) gtk_input_dialog_set_axis, - GINT_TO_POINTER (0x10000 * (j + 1) + i)); + g_object_set_data (G_OBJECT (menu_item), GTK_INPUT_DIALOG_KEY, + inputd); + g_signal_connect (menu_item, "activate", + G_CALLBACK (gtk_input_dialog_set_axis), + GINT_TO_POINTER (0x10000 * (j + 1) + i)); gtk_widget_show (menu_item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); } @@ -599,7 +610,7 @@ gtk_input_dialog_key_press (GtkWidget *widget, gdk_device_set_key (key->inputd->current_device, key->index, event->keyval, event->state & 0xFF); - gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "key_press_event"); + g_signal_stop_emission_by_name (widget, "key_press_event"); return TRUE; } @@ -656,11 +667,10 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDevice *info) GTK_EXPAND | GTK_FILL , 0, 2, 2); gtk_widget_show (key->entry); - gtk_signal_connect (GTK_OBJECT(key->entry), "key_press_event", - GTK_SIGNAL_FUNC (gtk_input_dialog_key_press), key); - gtk_signal_connect (GTK_OBJECT(key->entry), "destroy", - GTK_SIGNAL_FUNC (gtk_input_dialog_destroy_key), - key); + g_signal_connect (key->entry, "key_press_event", + G_CALLBACK (gtk_input_dialog_key_press), key); + g_signal_connect (key->entry, "destroy", + G_CALLBACK (gtk_input_dialog_destroy_key), key); /* and clear button */ @@ -669,8 +679,8 @@ gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDevice *info) 0, 0, 2, 2); gtk_widget_show (button); - gtk_signal_connect (GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC (gtk_input_dialog_clear_key), key); + g_signal_connect (button, "clicked", + G_CALLBACK (gtk_input_dialog_clear_key), key); gtk_input_dialog_set_key (key, info->keys[i].keyval, info->keys[i].modifiers); diff --git a/gtk/gtkinputdialog.h b/gtk/gtkinputdialog.h index ae9ddecc9e..e386240722 100644 --- a/gtk/gtkinputdialog.h +++ b/gtk/gtkinputdialog.h @@ -48,11 +48,11 @@ extern "C" { #define GTK_TYPE_INPUT_DIALOG (gtk_input_dialog_get_type ()) -#define GTK_INPUT_DIALOG(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_INPUT_DIALOG, GtkInputDialog)) -#define GTK_INPUT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_INPUT_DIALOG, GtkInputDialogClass)) -#define GTK_IS_INPUT_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_INPUT_DIALOG)) -#define GTK_IS_INPUT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_INPUT_DIALOG)) -#define GTK_INPUT_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_INPUT_DIALOG, GtkInputDialogClass)) +#define GTK_INPUT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_INPUT_DIALOG, GtkInputDialog)) +#define GTK_INPUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_INPUT_DIALOG, GtkInputDialogClass)) +#define GTK_IS_INPUT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_INPUT_DIALOG)) +#define GTK_IS_INPUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_INPUT_DIALOG)) +#define GTK_INPUT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_INPUT_DIALOG, GtkInputDialogClass)) typedef struct _GtkInputDialog GtkInputDialog; @@ -93,7 +93,7 @@ struct _GtkInputDialogClass }; -GtkType gtk_input_dialog_get_type (void) G_GNUC_CONST; +GType gtk_input_dialog_get_type (void) G_GNUC_CONST; GtkWidget* gtk_input_dialog_new (void); diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index 41899e19f7..66bf533fdd 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -58,26 +58,28 @@ enum { static gpointer parent_class; -GtkType +GType gtk_message_dialog_get_type (void) { - static GtkType dialog_type = 0; + static GType dialog_type = 0; if (!dialog_type) { - static const GtkTypeInfo dialog_info = + static const GTypeInfo dialog_info = { - "GtkMessageDialog", - sizeof (GtkMessageDialog), sizeof (GtkMessageDialogClass), - (GtkClassInitFunc) gtk_message_dialog_class_init, - (GtkObjectInitFunc) gtk_message_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_message_dialog_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkMessageDialog), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_message_dialog_init, }; - dialog_type = gtk_type_unique (GTK_TYPE_DIALOG, &dialog_info); + dialog_type = g_type_register_static (GTK_TYPE_DIALOG, "GtkMessageDialog", + &dialog_info, 0); } return dialog_type; @@ -301,9 +303,10 @@ gtk_message_dialog_new (GtkWindow *parent, gchar* msg = 0; va_list args; - widget = GTK_WIDGET (g_object_new (GTK_TYPE_MESSAGE_DIALOG, - "message_type", type, - "buttons", buttons, 0)); + widget = g_object_new (GTK_TYPE_MESSAGE_DIALOG, + "message_type", type, + "buttons", buttons, + NULL); dialog = GTK_DIALOG (widget); if (flags & GTK_DIALOG_NO_SEPARATOR) @@ -315,7 +318,7 @@ gtk_message_dialog_new (GtkWindow *parent, if (message_format) { va_start (args, message_format); - msg = g_strdup_vprintf(message_format, args); + msg = g_strdup_vprintf (message_format, args); va_end (args); diff --git a/gtk/gtkmessagedialog.h b/gtk/gtkmessagedialog.h index d1ac786f24..68c1b409fd 100644 --- a/gtk/gtkmessagedialog.h +++ b/gtk/gtkmessagedialog.h @@ -52,11 +52,11 @@ typedef enum } GtkButtonsType; #define GTK_TYPE_MESSAGE_DIALOG (gtk_message_dialog_get_type ()) -#define GTK_MESSAGE_DIALOG(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialog)) -#define GTK_MESSAGE_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialogClass)) -#define GTK_IS_MESSAGE_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_MESSAGE_DIALOG)) -#define GTK_IS_MESSAGE_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MESSAGE_DIALOG)) -#define GTK_MESSAGE_DIALOG_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialogClass)) +#define GTK_MESSAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialog)) +#define GTK_MESSAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialogClass)) +#define GTK_IS_MESSAGE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MESSAGE_DIALOG)) +#define GTK_IS_MESSAGE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MESSAGE_DIALOG)) +#define GTK_MESSAGE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MESSAGE_DIALOG, GtkMessageDialogClass)) typedef struct _GtkMessageDialog GtkMessageDialog; @@ -83,7 +83,7 @@ struct _GtkMessageDialogClass void (*_gtk_reserved4) (void); }; -GtkType gtk_message_dialog_get_type (void); +GType gtk_message_dialog_get_type (void); GtkWidget* gtk_message_dialog_new (GtkWindow *parent, GtkDialogFlags flags, diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c index fd8dd9cabf..8ca1dccf93 100644 --- a/gtk/gtktearoffmenuitem.c +++ b/gtk/gtktearoffmenuitem.c @@ -25,7 +25,6 @@ */ #include "gtkmenu.h" -#include "gtksignal.h" #include "gtktearoffmenuitem.h" #define ARROW_SIZE 10 @@ -42,26 +41,29 @@ static void gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item); static gint gtk_tearoff_menu_item_delete_cb (GtkMenuItem *menu_item, GdkEventAny *event); -GtkType +GType gtk_tearoff_menu_item_get_type (void) { - static GtkType tearoff_menu_item_type = 0; + static GType tearoff_menu_item_type = 0; if (!tearoff_menu_item_type) { - static const GtkTypeInfo tearoff_menu_item_info = + static const GTypeInfo tearoff_menu_item_info = { - "GtkTearoffMenuItem", - sizeof (GtkTearoffMenuItem), sizeof (GtkTearoffMenuItemClass), - (GtkClassInitFunc) gtk_tearoff_menu_item_class_init, - (GtkObjectInitFunc) gtk_tearoff_menu_item_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_tearoff_menu_item_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkTearoffMenuItem), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_tearoff_menu_item_init, }; - tearoff_menu_item_type = gtk_type_unique (gtk_menu_item_get_type (), &tearoff_menu_item_info); + tearoff_menu_item_type = + g_type_register_static (GTK_TYPE_MENU_ITEM, "GtkTearoffMenuItem", + &tearoff_menu_item_info, 0); } return tearoff_menu_item_type; @@ -70,7 +72,7 @@ gtk_tearoff_menu_item_get_type (void) GtkWidget* gtk_tearoff_menu_item_new (void) { - return GTK_WIDGET (gtk_type_new (gtk_tearoff_menu_item_get_type ())); + return g_object_new (GTK_TYPE_TEAROFF_MENU_ITEM, NULL); } static void @@ -172,17 +174,20 @@ gtk_tearoff_menu_item_paint (GtkWidget *widget, x += 2 * ARROW_SIZE; } - gtk_draw_arrow (widget->style, widget->window, - widget->state, shadow_type, GTK_ARROW_LEFT, FALSE, - arrow_x, y + height / 2 - 5, - ARROW_SIZE, ARROW_SIZE); + gtk_paint_arrow (widget->style, widget->window, + widget->state, shadow_type, + NULL, widget, "tearoffmenuitem", + GTK_ARROW_LEFT, FALSE, + arrow_x, y + height / 2 - 5, + ARROW_SIZE, ARROW_SIZE); } while (x < right_max) { - gtk_draw_hline (widget->style, widget->window, GTK_STATE_NORMAL, - x, MIN (x+TEAR_LENGTH, right_max), - y + (height - widget->style->ythickness)/2); + gtk_paint_hline (widget->style, widget->window, GTK_STATE_NORMAL, + NULL, widget, "tearoffmenuitem", + x, MIN (x + TEAR_LENGTH, right_max), + y + (height - widget->style->ythickness) / 2); x += 2 * TEAR_LENGTH; } } @@ -223,10 +228,10 @@ gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item) tearoff_menu_item->torn_off); if (need_connect) - gtk_signal_connect_object (GTK_OBJECT (menu->tearoff_window), - "delete_event", - GTK_SIGNAL_FUNC (gtk_tearoff_menu_item_delete_cb), - GTK_OBJECT (menu_item)); + g_signal_connect_swapped (menu->tearoff_window, + "delete_event", + G_CALLBACK (gtk_tearoff_menu_item_delete_cb), + menu_item); } } diff --git a/gtk/gtktearoffmenuitem.h b/gtk/gtktearoffmenuitem.h index e6503ef408..ba5ff76a8a 100644 --- a/gtk/gtktearoffmenuitem.h +++ b/gtk/gtktearoffmenuitem.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_TEAROFF_MENU_ITEM (gtk_tearoff_menu_item_get_type ()) -#define GTK_TEAROFF_MENU_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItem)) -#define GTK_TEAROFF_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass)) -#define GTK_IS_TEAROFF_MENU_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TEAROFF_MENU_ITEM)) -#define GTK_IS_TEAROFF_MENU_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEAROFF_MENU_ITEM)) -#define GTK_TEAROFF_MENU_ITEM_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass)) +#define GTK_TEAROFF_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItem)) +#define GTK_TEAROFF_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass)) +#define GTK_IS_TEAROFF_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEAROFF_MENU_ITEM)) +#define GTK_IS_TEAROFF_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEAROFF_MENU_ITEM)) +#define GTK_TEAROFF_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEAROFF_MENU_ITEM, GtkTearoffMenuItemClass)) typedef struct _GtkTearoffMenuItem GtkTearoffMenuItem; @@ -67,7 +67,7 @@ struct _GtkTearoffMenuItemClass }; -GtkType gtk_tearoff_menu_item_get_type (void) G_GNUC_CONST; +GType gtk_tearoff_menu_item_get_type (void) G_GNUC_CONST; GtkWidget* gtk_tearoff_menu_item_new (void); #ifdef __cplusplus diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 45aaae9252..b6c57a165b 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -27,7 +27,6 @@ #include "gtklabel.h" #include "gtkmain.h" #include "gtkmarshalers.h" -#include "gtksignal.h" #include "gtktogglebutton.h" #include "gtkintl.h" @@ -70,26 +69,29 @@ static void gtk_toggle_button_update_state (GtkButton *button); static guint toggle_button_signals[LAST_SIGNAL] = { 0 }; static GtkContainerClass *parent_class = NULL; -GtkType +GType gtk_toggle_button_get_type (void) { - static GtkType toggle_button_type = 0; + static GType toggle_button_type = 0; if (!toggle_button_type) { - static const GtkTypeInfo toggle_button_info = + static const GTypeInfo toggle_button_info = { - "GtkToggleButton", - sizeof (GtkToggleButton), sizeof (GtkToggleButtonClass), - (GtkClassInitFunc) gtk_toggle_button_class_init, - (GtkObjectInitFunc) gtk_toggle_button_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_toggle_button_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkToggleButton), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_toggle_button_init, }; - toggle_button_type = gtk_type_unique (GTK_TYPE_BUTTON, &toggle_button_info); + toggle_button_type = + g_type_register_static (GTK_TYPE_BUTTON, "GtkToggleButton", + &toggle_button_info, 0); } return toggle_button_type; @@ -98,20 +100,17 @@ gtk_toggle_button_get_type (void) static void gtk_toggle_button_class_init (GtkToggleButtonClass *class) { - GtkObjectClass *object_class; - GObjectClass *gobject_class; + GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkButtonClass *button_class; - object_class = (GtkObjectClass*) class; gobject_class = G_OBJECT_CLASS (class); widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; button_class = (GtkButtonClass*) class; - parent_class = gtk_type_class (GTK_TYPE_BUTTON); - + parent_class = g_type_class_peek_parent (class); gobject_class->set_property = gtk_toggle_button_set_property; gobject_class->get_property = gtk_toggle_button_get_property; @@ -152,12 +151,13 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class) G_PARAM_READWRITE)); toggle_button_signals[TOGGLED] = - gtk_signal_new ("toggled", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkToggleButtonClass, 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 (GtkToggleButtonClass, toggled), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -172,7 +172,7 @@ gtk_toggle_button_init (GtkToggleButton *toggle_button) GtkWidget* gtk_toggle_button_new (void) { - return GTK_WIDGET (gtk_type_new (gtk_toggle_button_get_type ())); + return g_object_new (GTK_TYPE_TOGGLE_BUTTON, NULL); } GtkWidget* @@ -333,7 +333,7 @@ gtk_toggle_button_toggled (GtkToggleButton *toggle_button) { g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button)); - gtk_signal_emit (GTK_OBJECT (toggle_button), toggle_button_signals[TOGGLED]); + g_signal_emit (toggle_button, toggle_button_signals[TOGGLED], 0); } /** diff --git a/gtk/gtktogglebutton.h b/gtk/gtktogglebutton.h index dcf5d8df33..5ab74ec5f7 100644 --- a/gtk/gtktogglebutton.h +++ b/gtk/gtktogglebutton.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_TOGGLE_BUTTON (gtk_toggle_button_get_type ()) -#define GTK_TOGGLE_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButton)) -#define GTK_TOGGLE_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButtonClass)) -#define GTK_IS_TOGGLE_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TOGGLE_BUTTON)) -#define GTK_IS_TOGGLE_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOGGLE_BUTTON)) -#define GTK_TOGGLE_BUTTON_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButtonClass)) +#define GTK_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButton)) +#define GTK_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButtonClass)) +#define GTK_IS_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TOGGLE_BUTTON)) +#define GTK_IS_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOGGLE_BUTTON)) +#define GTK_TOGGLE_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TOGGLE_BUTTON, GtkToggleButtonClass)) typedef struct _GtkToggleButton GtkToggleButton; @@ -71,7 +71,7 @@ struct _GtkToggleButtonClass }; -GtkType gtk_toggle_button_get_type (void) G_GNUC_CONST; +GType gtk_toggle_button_get_type (void) G_GNUC_CONST; GtkWidget* gtk_toggle_button_new (void); GtkWidget* gtk_toggle_button_new_with_label (const gchar *label);