From 28bc53032b1bea0fe22798a8542f8036d3f735b3 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Thu, 10 Oct 2002 01:02:25 +0000 Subject: [PATCH] Deprecation cleanup Wed Oct 9 17:40:13 2002 Manish Singh * gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c gtk/gtkobject.c gtk/gtkoldeditable.c gtk/gtkrc.c gtk/gtkspinbutton.[ch] gtk/gtktable.[ch] gtk/gtkthemes.c: Deprecation cleanup --- ChangeLog | 6 ++ ChangeLog.pre-2-10 | 6 ++ ChangeLog.pre-2-2 | 6 ++ ChangeLog.pre-2-4 | 6 ++ ChangeLog.pre-2-6 | 6 ++ ChangeLog.pre-2-8 | 6 ++ gtk/gtkaccelmap.c | 2 +- gtk/gtkfixed.c | 37 ++++++------- gtk/gtkfixed.h | 12 ++-- gtk/gtkkeyhash.c | 3 +- gtk/gtkmenu.c | 2 +- gtk/gtkobject.c | 10 ++-- gtk/gtkoldeditable.c | 4 +- gtk/gtkrc.c | 49 ++++++++--------- gtk/gtkspinbutton.c | 128 ++++++++++++++++++++++--------------------- gtk/gtkspinbutton.h | 12 ++-- gtk/gtktable.c | 34 ++++++------ gtk/gtktable.h | 12 ++-- gtk/gtkthemes.c | 6 +- 19 files changed, 194 insertions(+), 153 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad0d0a35dc..8ba95656d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Oct 9 17:40:13 2002 Manish Singh + + * gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c + gtk/gtkobject.c gtk/gtkoldeditable.c gtk/gtkrc.c gtk/gtkspinbutton.[ch] + gtk/gtktable.[ch] gtk/gtkthemes.c: Deprecation cleanup + Wed Oct 9 16:52:53 2002 Manish Singh * gtk/gtkclipboard.[ch] gtk/gtkeditable.[ch] gtk/gtkgc.c diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ad0d0a35dc..8ba95656d9 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Wed Oct 9 17:40:13 2002 Manish Singh + + * gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c + gtk/gtkobject.c gtk/gtkoldeditable.c gtk/gtkrc.c gtk/gtkspinbutton.[ch] + gtk/gtktable.[ch] gtk/gtkthemes.c: Deprecation cleanup + Wed Oct 9 16:52:53 2002 Manish Singh * gtk/gtkclipboard.[ch] gtk/gtkeditable.[ch] gtk/gtkgc.c diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index ad0d0a35dc..8ba95656d9 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Wed Oct 9 17:40:13 2002 Manish Singh + + * gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c + gtk/gtkobject.c gtk/gtkoldeditable.c gtk/gtkrc.c gtk/gtkspinbutton.[ch] + gtk/gtktable.[ch] gtk/gtkthemes.c: Deprecation cleanup + Wed Oct 9 16:52:53 2002 Manish Singh * gtk/gtkclipboard.[ch] gtk/gtkeditable.[ch] gtk/gtkgc.c diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ad0d0a35dc..8ba95656d9 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Wed Oct 9 17:40:13 2002 Manish Singh + + * gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c + gtk/gtkobject.c gtk/gtkoldeditable.c gtk/gtkrc.c gtk/gtkspinbutton.[ch] + gtk/gtktable.[ch] gtk/gtkthemes.c: Deprecation cleanup + Wed Oct 9 16:52:53 2002 Manish Singh * gtk/gtkclipboard.[ch] gtk/gtkeditable.[ch] gtk/gtkgc.c diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ad0d0a35dc..8ba95656d9 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Wed Oct 9 17:40:13 2002 Manish Singh + + * gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c + gtk/gtkobject.c gtk/gtkoldeditable.c gtk/gtkrc.c gtk/gtkspinbutton.[ch] + gtk/gtktable.[ch] gtk/gtkthemes.c: Deprecation cleanup + Wed Oct 9 16:52:53 2002 Manish Singh * gtk/gtkclipboard.[ch] gtk/gtkeditable.[ch] gtk/gtkgc.c diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ad0d0a35dc..8ba95656d9 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Wed Oct 9 17:40:13 2002 Manish Singh + + * gtk/gtkaccelmap.c gtk/gtkfixed.[ch] gtk/gtkkeyhash.c gtk/gtkmenu.c + gtk/gtkobject.c gtk/gtkoldeditable.c gtk/gtkrc.c gtk/gtkspinbutton.[ch] + gtk/gtktable.[ch] gtk/gtkthemes.c: Deprecation cleanup + Wed Oct 9 16:52:53 2002 Manish Singh * gtk/gtkclipboard.[ch] gtk/gtkeditable.[ch] gtk/gtkgc.c diff --git a/gtk/gtkaccelmap.c b/gtk/gtkaccelmap.c index 5dd21c04ed..709b7115b5 100644 --- a/gtk/gtkaccelmap.c +++ b/gtk/gtkaccelmap.c @@ -515,7 +515,7 @@ gtk_accel_map_load_scanner (GScanner *scanner) scanner->config->symbol_2_token = FALSE; saved_symbol = g_scanner_lookup_symbol (scanner, "gtk_accel_path"); g_scanner_scope_add_symbol (scanner, 0, "gtk_accel_path", - (gpointer) accel_map_parse_accel_path); + accel_map_parse_accel_path); /* outer parsing loop */ diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index d48c6604c2..10a03fb4be 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -48,7 +48,7 @@ static void gtk_fixed_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); -static GtkType gtk_fixed_child_type (GtkContainer *container); +static GType gtk_fixed_child_type (GtkContainer *container); static void gtk_fixed_set_child_property (GtkContainer *container, GtkWidget *child, @@ -64,26 +64,28 @@ static void gtk_fixed_get_child_property (GtkContainer *container, static GtkContainerClass *parent_class = NULL; -GtkType +GType gtk_fixed_get_type (void) { - static GtkType fixed_type = 0; + static GType fixed_type = 0; if (!fixed_type) { - static const GtkTypeInfo fixed_info = + static const GTypeInfo fixed_info = { - "GtkFixed", - sizeof (GtkFixed), sizeof (GtkFixedClass), - (GtkClassInitFunc) gtk_fixed_class_init, - (GtkObjectInitFunc) gtk_fixed_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_fixed_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkFixed), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_fixed_init, }; - fixed_type = gtk_type_unique (GTK_TYPE_CONTAINER, &fixed_info); + fixed_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkFixed", + &fixed_info, 0); } return fixed_type; @@ -92,15 +94,13 @@ gtk_fixed_get_type (void) static void gtk_fixed_class_init (GtkFixedClass *class) { - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; - parent_class = gtk_type_class (GTK_TYPE_CONTAINER); + parent_class = g_type_class_peek_parent (class); widget_class->realize = gtk_fixed_realize; widget_class->size_request = gtk_fixed_size_request; @@ -135,7 +135,7 @@ gtk_fixed_class_init (GtkFixedClass *class) G_PARAM_READWRITE)); } -static GtkType +static GType gtk_fixed_child_type (GtkContainer *container) { return GTK_TYPE_WIDGET; @@ -152,10 +152,7 @@ gtk_fixed_init (GtkFixed *fixed) GtkWidget* gtk_fixed_new (void) { - GtkFixed *fixed; - - fixed = gtk_type_new (GTK_TYPE_FIXED); - return GTK_WIDGET (fixed); + return g_object_new (GTK_TYPE_FIXED, NULL); } static GtkFixedChild* diff --git a/gtk/gtkfixed.h b/gtk/gtkfixed.h index ba07df8cbb..53fdd80fdd 100644 --- a/gtk/gtkfixed.h +++ b/gtk/gtkfixed.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_FIXED (gtk_fixed_get_type ()) -#define GTK_FIXED(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FIXED, GtkFixed)) -#define GTK_FIXED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FIXED, GtkFixedClass)) -#define GTK_IS_FIXED(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FIXED)) -#define GTK_IS_FIXED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FIXED)) -#define GTK_FIXED_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_FIXED, GtkFixedClass)) +#define GTK_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FIXED, GtkFixed)) +#define GTK_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FIXED, GtkFixedClass)) +#define GTK_IS_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FIXED)) +#define GTK_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FIXED)) +#define GTK_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FIXED, GtkFixedClass)) typedef struct _GtkFixed GtkFixed; @@ -69,7 +69,7 @@ struct _GtkFixedChild }; -GtkType gtk_fixed_get_type (void) G_GNUC_CONST; +GType gtk_fixed_get_type (void) G_GNUC_CONST; GtkWidget* gtk_fixed_new (void); void gtk_fixed_put (GtkFixed *fixed, GtkWidget *widget, diff --git a/gtk/gtkkeyhash.c b/gtk/gtkkeyhash.c index 7dbfcf67ee..659461c19f 100644 --- a/gtk/gtkkeyhash.c +++ b/gtk/gtkkeyhash.c @@ -168,7 +168,8 @@ void _gtk_key_hash_free (GtkKeyHash *key_hash) { g_signal_handlers_disconnect_by_func (key_hash->keymap, - G_CALLBACK (key_hash_keys_changed), key_hash); + key_hash_keys_changed, + key_hash); if (key_hash->keycode_hash) { diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index b535bb1497..9c247d7e6c 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -175,7 +175,7 @@ gtk_menu_get_private (GtkMenu *menu) private->have_position = FALSE; g_object_set_qdata_full (G_OBJECT (menu), private_quark, - private, (GDestroyNotify) g_free); + private, g_free); } return private; diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index e520ed37d0..42ba9a4864 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -72,10 +72,10 @@ static GQuark quark_weakrefs = 0; * ****************************************************/ -GtkType +GType gtk_object_get_type (void) { - static GtkType object_type = 0; + static GType object_type = 0; if (!object_type) { @@ -88,9 +88,9 @@ gtk_object_get_type (void) NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GtkObject), - 16, /* n_preallocs */ + 16, /* n_preallocs */ (GInstanceInitFunc) gtk_object_init, - NULL, /* value_table */ + NULL, /* value_table */ }; object_type = g_type_register_static (G_TYPE_OBJECT, "GtkObject", @@ -383,7 +383,7 @@ gtk_object_dispose (GObject *gobject) static void gtk_object_real_destroy (GtkObject *object) { - g_signal_handlers_destroy (G_OBJECT (object)); + g_signal_handlers_destroy (object); } static void diff --git a/gtk/gtkoldeditable.c b/gtk/gtkoldeditable.c index de50000396..f52332cdce 100644 --- a/gtk/gtkoldeditable.c +++ b/gtk/gtkoldeditable.c @@ -142,9 +142,9 @@ gtk_old_editable_get_type (void) NULL, /* class_finalize */ NULL, /* class_data */ sizeof (GtkOldEditable), - 0, /* n_preallocs */ + 0, /* n_preallocs */ (GInstanceInitFunc) gtk_old_editable_init, - NULL /* value_table */ + NULL, /* value_table */ }; static const GInterfaceInfo editable_info = diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 1379de7387..c28fc48062 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -885,11 +885,11 @@ gtk_rc_parse (const gchar *filename) GType gtk_rc_style_get_type (void) { - static GType object_type = 0; + static GType rc_style_type = 0; - if (!object_type) + if (!rc_style_type) { - static const GTypeInfo object_info = + static const GTypeInfo rc_style_info = { sizeof (GtkRcStyleClass), (GBaseInitFunc) NULL, @@ -902,12 +902,11 @@ gtk_rc_style_get_type (void) (GInstanceInitFunc) gtk_rc_style_init, }; - object_type = g_type_register_static (G_TYPE_OBJECT, - "GtkRcStyle", - &object_info, 0); + rc_style_type = g_type_register_static (G_TYPE_OBJECT, "GtkRcStyle", + &rc_style_info, 0); } - return object_type; + return rc_style_type; } static void @@ -978,7 +977,7 @@ gtk_rc_style_finalize (GObject *object) { GSList *rc_styles = tmp_list1->data; GtkStyle *style = g_hash_table_lookup (realized_style_ht, rc_styles); - gtk_style_unref (style); + g_object_unref (style); /* Remove the list of styles from the other rc_styles * in the list @@ -1021,8 +1020,7 @@ gtk_rc_style_finalize (GObject *object) tmp_list1 = rc_style->icon_factories; while (tmp_list1) { - g_object_unref (G_OBJECT (tmp_list1->data)); - + g_object_unref (tmp_list1->data); tmp_list1 = tmp_list1->next; } g_slist_free (rc_style->icon_factories); @@ -1064,19 +1062,19 @@ gtk_rc_style_copy (GtkRcStyle *orig) } void -gtk_rc_style_ref (GtkRcStyle *rc_style) +gtk_rc_style_ref (GtkRcStyle *rc_style) { g_return_if_fail (GTK_IS_RC_STYLE (rc_style)); - g_object_ref (G_OBJECT (rc_style)); + g_object_ref (rc_style); } void -gtk_rc_style_unref (GtkRcStyle *rc_style) +gtk_rc_style_unref (GtkRcStyle *rc_style) { g_return_if_fail (GTK_IS_RC_STYLE (rc_style)); - g_object_unref (G_OBJECT (rc_style)); + g_object_unref (rc_style); } static GtkRcStyle * @@ -1283,7 +1281,7 @@ gtk_rc_reset_widgets (GtkSettings *settings) if (gtk_widget_get_screen (list->data) == settings->screen) { gtk_widget_reset_rc_styles (list->data); - gtk_widget_unref (list->data); + g_object_unref (list->data); } } g_list_free (toplevels); @@ -1639,16 +1637,16 @@ gtk_rc_get_style (GtkWidget *widget) if (context->rc_sets_class) { - GtkType type; + GType type; - type = GTK_OBJECT_TYPE (widget); + type = G_TYPE_FROM_INSTANCE (widget); while (type) { const gchar *path; gchar *path_reversed; guint path_length; - path = gtk_type_name (type); + path = g_type_name (type); path_length = strlen (path); path_reversed = g_strdup (path); g_strreverse (path_reversed); @@ -1656,14 +1654,13 @@ gtk_rc_get_style (GtkWidget *widget) rc_styles = gtk_rc_styles_match (rc_styles, context->rc_sets_class, path_length, path, path_reversed); g_free (path_reversed); - type = gtk_type_parent (type); + type = g_type_parent (type); } } rc_styles = sort_and_dereference_sets (rc_styles); - widget_rc_style = gtk_object_get_data_by_id (GTK_OBJECT (widget), - rc_style_key_id); + widget_rc_style = g_object_get_qdata (G_OBJECT (widget), rc_style_key_id); if (widget_rc_style) rc_styles = g_slist_prepend (rc_styles, widget_rc_style); @@ -2089,7 +2086,7 @@ gtk_rc_init_style (GtkRcContext *context, iter = factories; while (iter != NULL) { - g_object_ref (G_OBJECT (iter->data)); + g_object_ref (iter->data); iter = g_slist_next (iter); } @@ -2586,7 +2583,7 @@ gtk_rc_parse_style (GtkRcContext *context, factories = parent_style->icon_factories; while (factories != NULL) { - g_object_ref (G_OBJECT (factories->data)); + g_object_ref (factories->data); factories = factories->next; } } @@ -3166,7 +3163,7 @@ gtk_rc_parse_engine (GtkRcContext *context, if (result != G_TOKEN_NONE) { - g_object_unref (G_OBJECT (new_style)); + g_object_unref (new_style); new_style = NULL; } } @@ -3198,8 +3195,8 @@ gtk_rc_parse_engine (GtkRcContext *context, if (new_style) { new_style->engine_specified = TRUE; - - g_object_unref (G_OBJECT (*rc_style)); + + g_object_unref (*rc_style); *rc_style = new_style; } diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index d9922f997c..8063511e5d 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -37,7 +37,6 @@ #include "gtkspinbutton.h" #include "gtkmain.h" #include "gtkmarshalers.h" -#include "gtksignal.h" #include "gtksettings.h" #include "gtkintl.h" @@ -146,23 +145,24 @@ static guint spinbutton_signals[LAST_SIGNAL] = {0}; #define NO_ARROW 2 -GtkType +GType gtk_spin_button_get_type (void) { - static GtkType spin_button_type = 0; + static GType spin_button_type = 0; if (!spin_button_type) { - static const GtkTypeInfo spin_button_info = + static const GTypeInfo spin_button_info = { - "GtkSpinButton", - sizeof (GtkSpinButton), sizeof (GtkSpinButtonClass), - (GtkClassInitFunc) gtk_spin_button_class_init, - (GtkObjectInitFunc) gtk_spin_button_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) gtk_spin_button_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkSpinButton), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_spin_button_init, }; static const GInterfaceInfo editable_info = @@ -172,7 +172,10 @@ gtk_spin_button_get_type (void) NULL /* interface_data */ }; - spin_button_type = gtk_type_unique (GTK_TYPE_ENTRY, &spin_button_info); + spin_button_type = + g_type_register_static (GTK_TYPE_ENTRY, "GtkSpinButton", + &spin_button_info, 0); + g_type_add_interface_static (spin_button_type, GTK_TYPE_EDITABLE, &editable_info); @@ -198,7 +201,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) widget_class = (GtkWidgetClass*) class; entry_class = (GtkEntryClass*) class; - parent_class = gtk_type_class (GTK_TYPE_ENTRY); + parent_class = g_type_class_peek_parent (class); gobject_class->finalize = gtk_spin_button_finalize; @@ -309,34 +312,37 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) G_PARAM_READABLE), gtk_rc_property_parse_enum); spinbutton_signals[INPUT] = - gtk_signal_new ("input", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkSpinButtonClass, input), - _gtk_marshal_INT__POINTER, - GTK_TYPE_INT, 1, GTK_TYPE_POINTER); + g_signal_new ("input", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkSpinButtonClass, input), + NULL, NULL, + _gtk_marshal_INT__POINTER, + G_TYPE_INT, 1, + G_TYPE_POINTER); spinbutton_signals[OUTPUT] = g_signal_new ("output", - G_TYPE_FROM_CLASS(object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET(GtkSpinButtonClass, output), - _gtk_boolean_handled_accumulator, NULL, - _gtk_marshal_BOOLEAN__VOID, - G_TYPE_BOOLEAN, 0); + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkSpinButtonClass, output), + _gtk_boolean_handled_accumulator, NULL, + _gtk_marshal_BOOLEAN__VOID, + G_TYPE_BOOLEAN, 0); spinbutton_signals[VALUE_CHANGED] = - gtk_signal_new ("value_changed", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (GtkSpinButtonClass, value_changed), - _gtk_marshal_VOID__VOID, - GTK_TYPE_NONE, 0); + g_signal_new ("value_changed", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GtkSpinButtonClass, value_changed), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); /* Action signals */ spinbutton_signals[CHANGE_VALUE] = g_signal_new ("change_value", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkSpinButtonClass, change_value), NULL, NULL, @@ -522,7 +528,7 @@ gtk_spin_button_realize (GtkWidget *widget) GdkWindowAttr attributes; gint attributes_mask; guint real_width; - gint return_val; + gboolean return_val; gint arrow_size; spin_button = GTK_SPIN_BUTTON (widget); @@ -562,8 +568,7 @@ gtk_spin_button_realize (GtkWidget *widget) gtk_style_set_background (widget->style, spin_button->panel, GTK_STATE_NORMAL); return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (spin_button), spinbutton_signals[OUTPUT], - &return_val); + g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val); if (return_val == FALSE) gtk_spin_button_default_output (spin_button); @@ -750,7 +755,7 @@ gtk_spin_button_expose (GtkWidget *widget, rect.x = 0; rect.y = 0; - gdk_window_get_size (spin->panel, &rect.width, &rect.height); + gdk_drawable_get_size (spin->panel, &rect.width, &rect.height); shadow_type = spin_button_get_shadow_type (spin); @@ -1200,16 +1205,16 @@ static void gtk_spin_button_value_changed (GtkAdjustment *adjustment, GtkSpinButton *spin_button) { - gint return_val; + gboolean return_val; + + g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment)); return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (spin_button), spinbutton_signals[OUTPUT], - &return_val); + g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val); if (return_val == FALSE) gtk_spin_button_default_output (spin_button); - gtk_signal_emit (GTK_OBJECT (spin_button), - spinbutton_signals[VALUE_CHANGED]); + g_signal_emit (spin_button, spinbutton_signals[VALUE_CHANGED], 0); spin_button_redraw (spin_button); @@ -1334,8 +1339,7 @@ gtk_spin_button_snap (GtkSpinButton *spin_button, else { gint return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (spin_button), spinbutton_signals[OUTPUT], - &return_val); + g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val); if (return_val == FALSE) gtk_spin_button_default_output (spin_button); } @@ -1547,7 +1551,7 @@ gtk_spin_button_new (GtkAdjustment *adjustment, if (adjustment) g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL); - spin = gtk_type_new (GTK_TYPE_SPIN_BUTTON); + spin = g_object_new (GTK_TYPE_SPIN_BUTTON, NULL); gtk_spin_button_configure (spin, adjustment, climb_rate, digits); @@ -1580,7 +1584,7 @@ gtk_spin_button_new_with_range (gdouble min, g_return_val_if_fail (min < max, NULL); g_return_val_if_fail (step != 0.0, NULL); - spin = gtk_type_new (GTK_TYPE_SPIN_BUTTON); + spin = g_object_new (GTK_TYPE_SPIN_BUTTON, NULL); adj = gtk_adjustment_new (min, min, max, step, 10 * step, 0); @@ -1630,21 +1634,25 @@ gtk_spin_button_set_adjustment (GtkSpinButton *spin_button, { if (spin_button->adjustment) { - gtk_signal_disconnect_by_data (GTK_OBJECT (spin_button->adjustment), - (gpointer) spin_button); - gtk_object_unref (GTK_OBJECT (spin_button->adjustment)); + g_signal_handlers_disconnect_by_func (spin_button->adjustment, + gtk_spin_button_value_changed, + spin_button); + g_signal_handlers_disconnect_by_func (spin_button->adjustment, + adjustment_changed_cb, + spin_button); + g_object_unref (spin_button->adjustment); } spin_button->adjustment = adjustment; if (adjustment) { - gtk_object_ref (GTK_OBJECT (adjustment)); + g_object_ref (adjustment); gtk_object_sink (GTK_OBJECT (adjustment)); - gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed", - (GtkSignalFunc) gtk_spin_button_value_changed, - (gpointer) spin_button); - gtk_signal_connect (GTK_OBJECT (adjustment), "changed", - (GtkSignalFunc) adjustment_changed_cb, - (gpointer) spin_button); + g_signal_connect (adjustment, "value_changed", + G_CALLBACK (gtk_spin_button_value_changed), + spin_button); + g_signal_connect (adjustment, "changed", + G_CALLBACK (adjustment_changed_cb), + spin_button); spin_button->timer_step = spin_button->adjustment->step_increment; } @@ -1861,8 +1869,7 @@ gtk_spin_button_set_value (GtkSpinButton *spin_button, else { gint return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (spin_button), spinbutton_signals[OUTPUT], - &return_val); + g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, &return_val); if (return_val == FALSE) gtk_spin_button_default_output (spin_button); } @@ -2157,8 +2164,7 @@ gtk_spin_button_update (GtkSpinButton *spin_button) g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (spin_button), spinbutton_signals[INPUT], - &val, &return_val); + g_signal_emit (spin_button, spinbutton_signals[INPUT], 0, &val, &return_val); if (return_val == FALSE) { return_val = gtk_spin_button_default_input (spin_button, &val); @@ -2194,8 +2200,8 @@ gtk_spin_button_update (GtkSpinButton *spin_button) else { return_val = FALSE; - gtk_signal_emit (GTK_OBJECT (spin_button), spinbutton_signals[OUTPUT], - &return_val); + g_signal_emit (spin_button, spinbutton_signals[OUTPUT], 0, + &return_val); if (return_val == FALSE) gtk_spin_button_default_output (spin_button); } diff --git a/gtk/gtkspinbutton.h b/gtk/gtkspinbutton.h index 0c23cb28d3..6804f4e4dd 100644 --- a/gtk/gtkspinbutton.h +++ b/gtk/gtkspinbutton.h @@ -42,11 +42,11 @@ extern "C" { #define GTK_TYPE_SPIN_BUTTON (gtk_spin_button_get_type ()) -#define GTK_SPIN_BUTTON(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_SPIN_BUTTON, GtkSpinButton)) -#define GTK_SPIN_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_SPIN_BUTTON, GtkSpinButtonClass)) -#define GTK_IS_SPIN_BUTTON(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_SPIN_BUTTON)) -#define GTK_IS_SPIN_BUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SPIN_BUTTON)) -#define GTK_SPIN_BUTTON_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_SPIN_BUTTON, GtkSpinButtonClass)) +#define GTK_SPIN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SPIN_BUTTON, GtkSpinButton)) +#define GTK_SPIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SPIN_BUTTON, GtkSpinButtonClass)) +#define GTK_IS_SPIN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SPIN_BUTTON)) +#define GTK_IS_SPIN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SPIN_BUTTON)) +#define GTK_SPIN_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SPIN_BUTTON, GtkSpinButtonClass)) #define GTK_INPUT_ERROR -1 @@ -119,7 +119,7 @@ struct _GtkSpinButtonClass }; -GtkType gtk_spin_button_get_type (void) G_GNUC_CONST; +GType gtk_spin_button_get_type (void) G_GNUC_CONST; void gtk_spin_button_configure (GtkSpinButton *spin_button, GtkAdjustment *adjustment, diff --git a/gtk/gtktable.c b/gtk/gtktable.c index d7d66cf26a..8b473f19b1 100644 --- a/gtk/gtktable.c +++ b/gtk/gtktable.c @@ -84,7 +84,7 @@ static void gtk_table_get_child_property (GtkContainer *container, guint property_id, GValue *value, GParamSpec *pspec); -static GtkType gtk_table_child_type (GtkContainer *container); +static GType gtk_table_child_type (GtkContainer *container); static void gtk_table_size_request_init (GtkTable *table); @@ -100,26 +100,28 @@ static void gtk_table_size_allocate_pass2 (GtkTable *table); static GtkContainerClass *parent_class = NULL; -GtkType +GType gtk_table_get_type (void) { - static GtkType table_type = 0; + static GType table_type = 0; if (!table_type) { - static const GtkTypeInfo table_info = + static const GTypeInfo table_info = { - "GtkTable", - sizeof (GtkTable), sizeof (GtkTableClass), - (GtkClassInitFunc) gtk_table_class_init, - (GtkObjectInitFunc) gtk_table_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, + NULL, + (GClassInitFunc) gtk_table_class_init, + NULL, + NULL, + sizeof (GtkTable), + 0, + (GInstanceInitFunc) gtk_table_init, }; - table_type = gtk_type_unique (gtk_container_get_type (), &table_info); + table_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkTable", + &table_info, 0); } return table_type; @@ -252,7 +254,7 @@ gtk_table_class_init (GtkTableClass *class) G_PARAM_READWRITE)); } -static GtkType +static GType gtk_table_child_type (GtkContainer *container) { return GTK_TYPE_WIDGET; @@ -490,11 +492,11 @@ gtk_table_new (guint rows, GtkTable *table; if (rows == 0) - rows = 1; + rows = 1; if (columns == 0) - columns = 1; + columns = 1; - table = gtk_type_new (gtk_table_get_type ()); + table = g_object_new (GTK_TYPE_TABLE, NULL); table->homogeneous = (homogeneous ? TRUE : FALSE); diff --git a/gtk/gtktable.h b/gtk/gtktable.h index e87aa356e4..24fc2527e2 100644 --- a/gtk/gtktable.h +++ b/gtk/gtktable.h @@ -38,11 +38,11 @@ extern "C" { #define GTK_TYPE_TABLE (gtk_table_get_type ()) -#define GTK_TABLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TABLE, GtkTable)) -#define GTK_TABLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TABLE, GtkTableClass)) -#define GTK_IS_TABLE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TABLE)) -#define GTK_IS_TABLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TABLE)) -#define GTK_TABLE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TABLE, GtkTableClass)) +#define GTK_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TABLE, GtkTable)) +#define GTK_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TABLE, GtkTableClass)) +#define GTK_IS_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TABLE)) +#define GTK_IS_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TABLE)) +#define GTK_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TABLE, GtkTableClass)) typedef struct _GtkTable GtkTable; @@ -99,7 +99,7 @@ struct _GtkTableRowCol }; -GtkType gtk_table_get_type (void) G_GNUC_CONST; +GType gtk_table_get_type (void) G_GNUC_CONST; GtkWidget* gtk_table_new (guint rows, guint columns, gboolean homogeneous); diff --git a/gtk/gtkthemes.c b/gtk/gtkthemes.c index b17668eb8a..70201b75c5 100644 --- a/gtk/gtkthemes.c +++ b/gtk/gtkthemes.c @@ -147,7 +147,9 @@ gtk_theme_engine_get_type (void) NULL, /* instance_init */ }; - theme_engine_type = g_type_register_static (G_TYPE_TYPE_MODULE, "GtkThemeEngine", &theme_engine_info, 0); + theme_engine_type = + g_type_register_static (G_TYPE_TYPE_MODULE, "GtkThemeEngine", + &theme_engine_info, 0); } return theme_engine_type; @@ -167,7 +169,7 @@ gtk_theme_engine_get (const gchar *name) if (!result) { - result = GTK_THEME_ENGINE (g_object_new (GTK_TYPE_THEME_ENGINE, NULL)); + result = g_object_new (GTK_TYPE_THEME_ENGINE, NULL); g_type_module_set_name (G_TYPE_MODULE (result), name); result->name = g_strdup (name);