diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index 673c8a64ff..6e5f06a5a8 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -118,7 +118,7 @@ static void gtk_accel_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gtk_accel_label_destroy (GtkObject *object); +static void gtk_accel_label_destroy (GtkWidget *widget); static void gtk_accel_label_finalize (GObject *object); static gboolean gtk_accel_label_draw (GtkWidget *widget, cairo_t *cr); @@ -138,17 +138,15 @@ static void gtk_accel_label_class_init (GtkAccelLabelClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); gobject_class->finalize = gtk_accel_label_finalize; gobject_class->set_property = gtk_accel_label_set_property; gobject_class->get_property = gtk_accel_label_get_property; - - object_class->destroy = gtk_accel_label_destroy; - + widget_class->draw = gtk_accel_label_draw; widget_class->get_preferred_width = gtk_accel_label_get_preferred_width; + widget_class->destroy = gtk_accel_label_destroy; class->signal_quote1 = g_strdup ("<:"); class->signal_quote2 = g_strdup (":>"); @@ -288,14 +286,14 @@ gtk_accel_label_new (const gchar *string) } static void -gtk_accel_label_destroy (GtkObject *object) +gtk_accel_label_destroy (GtkWidget *widget) { - GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (object); + GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (widget); gtk_accel_label_set_accel_widget (accel_label, NULL); gtk_accel_label_set_accel_closure (accel_label, NULL); - - GTK_OBJECT_CLASS (gtk_accel_label_parent_class)->destroy (object); + + GTK_WIDGET_CLASS (gtk_accel_label_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c index 00b40606c9..ce3d8d0a6a 100644 --- a/gtk/gtkassistant.c +++ b/gtk/gtkassistant.c @@ -114,7 +114,7 @@ struct _GtkAssistantPrivate static void gtk_assistant_class_init (GtkAssistantClass *class); static void gtk_assistant_init (GtkAssistant *assistant); -static void gtk_assistant_destroy (GtkObject *object); +static void gtk_assistant_destroy (GtkWidget *widget); static void gtk_assistant_style_set (GtkWidget *widget, GtkStyle *old_style); static void gtk_assistant_size_request (GtkWidget *widget, @@ -200,17 +200,14 @@ static void gtk_assistant_class_init (GtkAssistantClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; gobject_class = (GObjectClass *) class; - object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; container_class = (GtkContainerClass *) class; - object_class->destroy = gtk_assistant_destroy; - + widget_class->destroy = gtk_assistant_destroy; widget_class->style_set = gtk_assistant_style_set; widget_class->size_request = gtk_assistant_size_request; widget_class->size_allocate = gtk_assistant_size_allocate; @@ -1005,9 +1002,9 @@ remove_page (GtkAssistant *assistant, } static void -gtk_assistant_destroy (GtkObject *object) +gtk_assistant_destroy (GtkWidget *widget) { - GtkAssistant *assistant = GTK_ASSISTANT (object); + GtkAssistant *assistant = GTK_ASSISTANT (widget); GtkAssistantPrivate *priv = assistant->priv; if (priv->header_image) @@ -1056,9 +1053,9 @@ gtk_assistant_destroy (GtkObject *object) priv->current_page = NULL; while (priv->pages) - remove_page (GTK_ASSISTANT (object), priv->pages); - - GTK_OBJECT_CLASS (gtk_assistant_parent_class)->destroy (object); + remove_page (assistant, priv->pages); + + GTK_WIDGET_CLASS (gtk_assistant_parent_class)->destroy (widget); } static GList* diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index e36e8e8211..b862ebf077 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -109,7 +109,7 @@ struct _GtkButtonPrivate GtkAction *action; }; -static void gtk_button_destroy (GtkObject *object); +static void gtk_button_destroy (GtkWidget *widget); static void gtk_button_dispose (GObject *object); static void gtk_button_set_property (GObject *object, guint prop_id, @@ -189,12 +189,10 @@ static void gtk_button_class_init (GtkButtonClass *klass) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; gobject_class = G_OBJECT_CLASS (klass); - object_class = (GtkObjectClass*) klass; widget_class = (GtkWidgetClass*) klass; container_class = (GtkContainerClass*) klass; @@ -203,10 +201,9 @@ gtk_button_class_init (GtkButtonClass *klass) gobject_class->set_property = gtk_button_set_property; gobject_class->get_property = gtk_button_get_property; - object_class->destroy = gtk_button_destroy; - widget_class->get_preferred_width = gtk_button_get_preferred_width; widget_class->get_preferred_height = gtk_button_get_preferred_height; + widget_class->destroy = gtk_button_destroy; widget_class->screen_changed = gtk_button_screen_changed; widget_class->realize = gtk_button_realize; widget_class->unrealize = gtk_button_unrealize; @@ -358,7 +355,7 @@ gtk_button_class_init (GtkButtonClass *klass) */ button_signals[PRESSED] = g_signal_new (I_("pressed"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkButtonClass, pressed), NULL, NULL, @@ -375,7 +372,7 @@ gtk_button_class_init (GtkButtonClass *klass) */ button_signals[RELEASED] = g_signal_new (I_("released"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkButtonClass, released), NULL, NULL, @@ -390,7 +387,7 @@ gtk_button_class_init (GtkButtonClass *klass) */ button_signals[CLICKED] = g_signal_new (I_("clicked"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkButtonClass, clicked), NULL, NULL, @@ -407,7 +404,7 @@ gtk_button_class_init (GtkButtonClass *klass) */ button_signals[ENTER] = g_signal_new (I_("enter"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkButtonClass, enter), NULL, NULL, @@ -424,7 +421,7 @@ gtk_button_class_init (GtkButtonClass *klass) */ button_signals[LEAVE] = g_signal_new (I_("leave"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkButtonClass, leave), NULL, NULL, @@ -442,7 +439,7 @@ gtk_button_class_init (GtkButtonClass *klass) */ button_signals[ACTIVATE] = g_signal_new (I_("activate"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkButtonClass, activate), NULL, NULL, @@ -587,17 +584,17 @@ gtk_button_init (GtkButton *button) } static void -gtk_button_destroy (GtkObject *object) +gtk_button_destroy (GtkWidget *widget) { - GtkButton *button = GTK_BUTTON (object); - + GtkButton *button = GTK_BUTTON (widget); + if (button->label_text) { g_free (button->label_text); button->label_text = NULL; } - GTK_OBJECT_CLASS (gtk_button_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_button_parent_class)->destroy (widget); } static GObject* diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index dddb6f364b..0cfad5860e 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -335,7 +335,7 @@ struct _GtkCalendarPrivate #define GTK_CALENDAR_GET_PRIVATE(widget) (GTK_CALENDAR (widget)->priv) static void gtk_calendar_finalize (GObject *calendar); -static void gtk_calendar_destroy (GtkObject *calendar); +static void gtk_calendar_destroy (GtkWidget *widget); static void gtk_calendar_set_property (GObject *object, guint prop_id, const GValue *value, @@ -432,19 +432,16 @@ static void gtk_calendar_class_init (GtkCalendarClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; gobject_class = (GObjectClass*) class; - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; gobject_class->set_property = gtk_calendar_set_property; gobject_class->get_property = gtk_calendar_get_property; gobject_class->finalize = gtk_calendar_finalize; - object_class->destroy = gtk_calendar_destroy; - + widget_class->destroy = gtk_calendar_destroy; widget_class->realize = gtk_calendar_realize; widget_class->unrealize = gtk_calendar_unrealize; widget_class->draw = gtk_calendar_draw; @@ -1376,11 +1373,11 @@ gtk_calendar_finalize (GObject *object) } static void -gtk_calendar_destroy (GtkObject *object) +gtk_calendar_destroy (GtkWidget *widget) { - GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (object); + GtkCalendarPrivate *priv = GTK_CALENDAR_GET_PRIVATE (widget); - calendar_stop_spinning (GTK_CALENDAR (object)); + calendar_stop_spinning (GTK_CALENDAR (widget)); /* Call the destroy function for the extra display callback: */ if (priv->detail_func_destroy && priv->detail_func_user_data) @@ -1390,7 +1387,7 @@ gtk_calendar_destroy (GtkObject *object) priv->detail_func_destroy = NULL; } - GTK_OBJECT_CLASS (gtk_calendar_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_calendar_parent_class)->destroy (widget); } diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index d9b55de326..ce808e73e7 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -159,7 +159,7 @@ struct _GtkColorSelectionPrivate }; -static void gtk_color_selection_destroy (GtkObject *object); +static void gtk_color_selection_destroy (GtkWidget *widget); static void gtk_color_selection_finalize (GObject *object); static void update_color (GtkColorSelection *colorsel); static void gtk_color_selection_set_property (GObject *object, @@ -289,7 +289,6 @@ static void gtk_color_selection_class_init (GtkColorSelectionClass *klass) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; gobject_class = G_OBJECT_CLASS (klass); @@ -297,10 +296,8 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass) gobject_class->set_property = gtk_color_selection_set_property; gobject_class->get_property = gtk_color_selection_get_property; - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = gtk_color_selection_destroy; - widget_class = GTK_WIDGET_CLASS (klass); + widget_class->destroy = gtk_color_selection_destroy; widget_class->realize = gtk_color_selection_realize; widget_class->unrealize = gtk_color_selection_unrealize; widget_class->show_all = gtk_color_selection_show_all; @@ -337,7 +334,7 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass) color_selection_signals[COLOR_CHANGED] = g_signal_new (I_("color-changed"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkColorSelectionClass, color_changed), NULL, NULL, @@ -605,12 +602,12 @@ gtk_color_selection_get_property (GObject *object, } } -/* GtkObject methods */ +/* GtkWidget methods */ static void -gtk_color_selection_destroy (GtkObject *object) +gtk_color_selection_destroy (GtkWidget *widget) { - GtkColorSelection *cselection = GTK_COLOR_SELECTION (object); + GtkColorSelection *cselection = GTK_COLOR_SELECTION (widget); GtkColorSelectionPrivate *priv = cselection->private_data; if (priv->dropper_grab_widget) @@ -619,11 +616,9 @@ gtk_color_selection_destroy (GtkObject *object) priv->dropper_grab_widget = NULL; } - GTK_OBJECT_CLASS (gtk_color_selection_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_color_selection_parent_class)->destroy (widget); } -/* GtkWidget methods */ - static void gtk_color_selection_realize (GtkWidget *widget) { diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 6feaef6f96..ba7a2f8b32 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -221,7 +221,7 @@ static void gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface); static void gtk_combo_box_cell_editable_init (GtkCellEditableIface *iface); static void gtk_combo_box_dispose (GObject *object); static void gtk_combo_box_finalize (GObject *object); -static void gtk_combo_box_destroy (GtkObject *object); +static void gtk_combo_box_destroy (GtkWidget *widget); static void gtk_combo_box_set_property (GObject *object, guint prop_id, @@ -496,7 +496,6 @@ static void gtk_combo_box_class_init (GtkComboBoxClass *klass) { GObjectClass *object_class; - GtkObjectClass *gtk_object_class; GtkContainerClass *container_class; GtkWidgetClass *widget_class; GtkBindingSet *binding_set; @@ -520,9 +519,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass) widget_class->get_preferred_height = gtk_combo_box_get_preferred_height; widget_class->get_preferred_height_for_width = gtk_combo_box_get_preferred_height_for_width; widget_class->get_preferred_width_for_height = gtk_combo_box_get_preferred_width_for_height; - - gtk_object_class = (GtkObjectClass *)klass; - gtk_object_class->destroy = gtk_combo_box_destroy; + widget_class->destroy = gtk_combo_box_destroy; object_class = (GObjectClass *)klass; object_class->dispose = gtk_combo_box_dispose; @@ -5420,9 +5417,9 @@ gtk_combo_box_grab_focus (GtkWidget *widget) } static void -gtk_combo_box_destroy (GtkObject *object) +gtk_combo_box_destroy (GtkWidget *widget) { - GtkComboBox *combo_box = GTK_COMBO_BOX (object); + GtkComboBox *combo_box = GTK_COMBO_BOX (widget); if (combo_box->priv->popup_idle_id > 0) { @@ -5439,7 +5436,7 @@ gtk_combo_box_destroy (GtkObject *object) combo_box->priv->row_separator_data = NULL; combo_box->priv->row_separator_destroy = NULL; - GTK_OBJECT_CLASS (gtk_combo_box_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->destroy (widget); combo_box->priv->cell_view = NULL; } diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 73e42486ae..c38153ca27 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -80,7 +80,7 @@ static void gtk_container_base_class_init (GtkContainerClass *klass); static void gtk_container_base_class_finalize (GtkContainerClass *klass); static void gtk_container_class_init (GtkContainerClass *klass); static void gtk_container_init (GtkContainer *container); -static void gtk_container_destroy (GtkObject *object); +static void gtk_container_destroy (GtkWidget *widget); static void gtk_container_set_property (GObject *object, guint prop_id, const GValue *value, @@ -224,7 +224,6 @@ static void gtk_container_class_init (GtkContainerClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); parent_class = g_type_class_peek_parent (class); @@ -235,8 +234,7 @@ gtk_container_class_init (GtkContainerClass *class) gobject_class->set_property = gtk_container_set_property; gobject_class->get_property = gtk_container_get_property; - object_class->destroy = gtk_container_destroy; - + widget_class->destroy = gtk_container_destroy; widget_class->show_all = gtk_container_show_all; widget_class->hide_all = gtk_container_hide_all; widget_class->draw = gtk_container_draw; @@ -281,7 +279,7 @@ gtk_container_class_init (GtkContainerClass *class) GTK_PARAM_WRITABLE)); container_signals[ADD] = g_signal_new (I_("add"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkContainerClass, add), NULL, NULL, @@ -290,7 +288,7 @@ gtk_container_class_init (GtkContainerClass *class) GTK_TYPE_WIDGET); container_signals[REMOVE] = g_signal_new (I_("remove"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkContainerClass, remove), NULL, NULL, @@ -299,7 +297,7 @@ gtk_container_class_init (GtkContainerClass *class) GTK_TYPE_WIDGET); container_signals[CHECK_RESIZE] = g_signal_new (I_("check-resize"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkContainerClass, check_resize), NULL, NULL, @@ -307,7 +305,7 @@ gtk_container_class_init (GtkContainerClass *class) G_TYPE_NONE, 0); container_signals[SET_FOCUS_CHILD] = g_signal_new (I_("set-focus-child"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkContainerClass, set_focus_child), NULL, NULL, @@ -1083,9 +1081,9 @@ gtk_container_init (GtkContainer *container) } static void -gtk_container_destroy (GtkObject *object) +gtk_container_destroy (GtkWidget *widget) { - GtkContainer *container = GTK_CONTAINER (object); + GtkContainer *container = GTK_CONTAINER (widget); GtkContainerPrivate *priv = container->priv; if (GTK_CONTAINER_RESIZE_PENDING (container)) @@ -1105,7 +1103,7 @@ gtk_container_destroy (GtkObject *object) gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL); - GTK_OBJECT_CLASS (parent_class)->destroy (object); + GTK_WIDGET_CLASS (parent_class)->destroy (widget); } static void diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 149043a1c6..040d35bb45 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -236,7 +236,7 @@ typedef enum DISPLAY_BLANK /* In invisible mode, nothing shown at all */ } DisplayMode; -/* GObject, GtkObject methods +/* GObject methods */ static void gtk_entry_editable_init (GtkEditableInterface *iface); static void gtk_entry_cell_editable_init (GtkCellEditableIface *iface); @@ -249,11 +249,11 @@ static void gtk_entry_get_property (GObject *object, GValue *value, GParamSpec *pspec); static void gtk_entry_finalize (GObject *object); -static void gtk_entry_destroy (GtkObject *object); static void gtk_entry_dispose (GObject *object); /* GtkWidget methods */ +static void gtk_entry_destroy (GtkWidget *widget); static void gtk_entry_realize (GtkWidget *widget); static void gtk_entry_unrealize (GtkWidget *widget); static void gtk_entry_map (GtkWidget *widget); @@ -564,17 +564,16 @@ gtk_entry_class_init (GtkEntryClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); GtkWidgetClass *widget_class; - GtkObjectClass *gtk_object_class; GtkBindingSet *binding_set; widget_class = (GtkWidgetClass*) class; - gtk_object_class = (GtkObjectClass *)class; gobject_class->dispose = gtk_entry_dispose; gobject_class->finalize = gtk_entry_finalize; gobject_class->set_property = gtk_entry_set_property; gobject_class->get_property = gtk_entry_get_property; + widget_class->destroy = gtk_entry_destroy; widget_class->map = gtk_entry_map; widget_class->unmap = gtk_entry_unmap; widget_class->realize = gtk_entry_realize; @@ -610,8 +609,6 @@ gtk_entry_class_init (GtkEntryClass *class) widget_class->popup_menu = gtk_entry_popup_menu; - gtk_object_class->destroy = gtk_entry_destroy; - class->move_cursor = gtk_entry_move_cursor; class->insert_at_cursor = gtk_entry_insert_at_cursor; class->delete_from_cursor = gtk_entry_delete_from_cursor; @@ -2425,9 +2422,9 @@ emit_changed (GtkEntry *entry) } static void -gtk_entry_destroy (GtkObject *object) +gtk_entry_destroy (GtkWidget *widget) { - GtkEntry *entry = GTK_ENTRY (object); + GtkEntry *entry = GTK_ENTRY (widget); entry->current_pos = entry->selection_bound = 0; _gtk_entry_reset_im_context (entry); @@ -2445,7 +2442,7 @@ gtk_entry_destroy (GtkObject *object) entry->recompute_idle = 0; } - GTK_OBJECT_CLASS (gtk_entry_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_entry_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index a42fceffcd..cf5f1b8e82 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -78,8 +78,7 @@ static void gtk_expander_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void gtk_expander_destroy (GtkObject *object); - +static void gtk_expander_destroy (GtkWidget *widget); static void gtk_expander_realize (GtkWidget *widget); static void gtk_expander_unrealize (GtkWidget *widget); static void gtk_expander_size_allocate (GtkWidget *widget, @@ -157,20 +156,17 @@ static void gtk_expander_class_init (GtkExpanderClass *klass) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; gobject_class = (GObjectClass *) klass; - object_class = (GtkObjectClass *) klass; widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; gobject_class->set_property = gtk_expander_set_property; gobject_class->get_property = gtk_expander_get_property; - object_class->destroy = gtk_expander_destroy; - + widget_class->destroy = gtk_expander_destroy; widget_class->realize = gtk_expander_realize; widget_class->unrealize = gtk_expander_unrealize; widget_class->size_allocate = gtk_expander_size_allocate; @@ -414,17 +410,17 @@ gtk_expander_get_property (GObject *object, } static void -gtk_expander_destroy (GtkObject *object) +gtk_expander_destroy (GtkWidget *widget) { - GtkExpanderPrivate *priv = GTK_EXPANDER (object)->priv; - + GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv; + if (priv->animation_timeout) { g_source_remove (priv->animation_timeout); priv->animation_timeout = 0; } - - GTK_OBJECT_CLASS (gtk_expander_parent_class)->destroy (object); + + GTK_WIDGET_CLASS (gtk_expander_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index 217f8b286e..f2af98a5ed 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -207,10 +207,8 @@ static void gtk_file_chooser_button_get_property (GObject *ob GParamSpec *pspec); static void gtk_file_chooser_button_finalize (GObject *object); -/* GtkObject Functions */ -static void gtk_file_chooser_button_destroy (GtkObject *object); - /* GtkWidget Functions */ +static void gtk_file_chooser_button_destroy (GtkWidget *widget); static void gtk_file_chooser_button_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, @@ -317,11 +315,9 @@ static void gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) { GObjectClass *gobject_class; - GtkObjectClass *gtkobject_class; GtkWidgetClass *widget_class; gobject_class = G_OBJECT_CLASS (class); - gtkobject_class = GTK_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); gobject_class->constructor = gtk_file_chooser_button_constructor; @@ -329,8 +325,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class) gobject_class->get_property = gtk_file_chooser_button_get_property; gobject_class->finalize = gtk_file_chooser_button_finalize; - gtkobject_class->destroy = gtk_file_chooser_button_destroy; - + widget_class->destroy = gtk_file_chooser_button_destroy; widget_class->drag_data_received = gtk_file_chooser_button_drag_data_received; widget_class->show_all = gtk_file_chooser_button_show_all; widget_class->hide_all = gtk_file_chooser_button_hide_all; @@ -883,13 +878,13 @@ gtk_file_chooser_button_finalize (GObject *object) } /* ********************* * - * GtkObject Functions * + * GtkWidget Functions * * ********************* */ static void -gtk_file_chooser_button_destroy (GtkObject *object) +gtk_file_chooser_button_destroy (GtkWidget *widget) { - GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (object); + GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget); GtkFileChooserButtonPrivate *priv = button->priv; GtkTreeIter iter; GSList *l; @@ -949,14 +944,9 @@ gtk_file_chooser_button_destroy (GtkObject *object) priv->fs = NULL; } - GTK_OBJECT_CLASS (gtk_file_chooser_button_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->destroy (widget); } - -/* ********************* * - * GtkWidget Functions * - * ********************* */ - struct DndSelectFolderData { GtkFileSystem *file_system; diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c index 62b418215d..973dc4ba3a 100644 --- a/gtk/gtkhsv.c +++ b/gtk/gtkhsv.c @@ -85,7 +85,7 @@ enum { LAST_SIGNAL }; -static void gtk_hsv_destroy (GtkObject *object); +static void gtk_hsv_destroy (GtkWidget *widget); static void gtk_hsv_map (GtkWidget *widget); static void gtk_hsv_unmap (GtkWidget *widget); static void gtk_hsv_realize (GtkWidget *widget); @@ -118,18 +118,15 @@ static void gtk_hsv_class_init (GtkHSVClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkHSVClass *hsv_class; GtkBindingSet *binding_set; gobject_class = (GObjectClass *) class; - object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; hsv_class = GTK_HSV_CLASS (class); - - object_class->destroy = gtk_hsv_destroy; - + + widget_class->destroy = gtk_hsv_destroy; widget_class->map = gtk_hsv_map; widget_class->unmap = gtk_hsv_unmap; widget_class->realize = gtk_hsv_realize; @@ -147,7 +144,7 @@ gtk_hsv_class_init (GtkHSVClass *class) hsv_signals[CHANGED] = g_signal_new (I_("changed"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkHSVClass, changed), NULL, NULL, @@ -156,7 +153,7 @@ gtk_hsv_class_init (GtkHSVClass *class) hsv_signals[MOVE] = g_signal_new (I_("move"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkHSVClass, move), NULL, NULL, @@ -221,9 +218,9 @@ gtk_hsv_init (GtkHSV *hsv) /* Destroy handler for the HSV color selector */ static void -gtk_hsv_destroy (GtkObject *object) +gtk_hsv_destroy (GtkWidget *widget) { - GTK_OBJECT_CLASS (gtk_hsv_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_hsv_parent_class)->destroy (widget); } /* Default signal handlers */ diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index d2d7cd705d..88f983086d 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -245,11 +245,8 @@ static void gtk_icon_view_get_property (GObject guint prop_id, GValue *value, GParamSpec *pspec); - -/* GtkObject vfuncs */ -static void gtk_icon_view_destroy (GtkObject *object); - /* GtkWidget vfuncs */ +static void gtk_icon_view_destroy (GtkWidget *widget); static void gtk_icon_view_realize (GtkWidget *widget); static void gtk_icon_view_unrealize (GtkWidget *widget); static void gtk_icon_view_style_set (GtkWidget *widget, @@ -487,7 +484,6 @@ static void gtk_icon_view_class_init (GtkIconViewClass *klass) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkBindingSet *binding_set; @@ -497,7 +493,6 @@ gtk_icon_view_class_init (GtkIconViewClass *klass) g_type_class_add_private (klass, sizeof (GtkIconViewPrivate)); gobject_class = (GObjectClass *) klass; - object_class = (GtkObjectClass *) klass; widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; @@ -505,8 +500,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass) gobject_class->set_property = gtk_icon_view_set_property; gobject_class->get_property = gtk_icon_view_get_property; - object_class->destroy = gtk_icon_view_destroy; - + widget_class->destroy = gtk_icon_view_destroy; widget_class->realize = gtk_icon_view_realize; widget_class->unrealize = gtk_icon_view_unrealize; widget_class->style_set = gtk_icon_view_style_set; @@ -1136,46 +1130,6 @@ gtk_icon_view_init (GtkIconView *icon_view) icon_view->priv->draw_focus = TRUE; } -static void -gtk_icon_view_destroy (GtkObject *object) -{ - GtkIconView *icon_view; - - icon_view = GTK_ICON_VIEW (object); - - gtk_icon_view_stop_editing (icon_view, TRUE); - - gtk_icon_view_set_model (icon_view, NULL); - - if (icon_view->priv->layout_idle_id != 0) - { - g_source_remove (icon_view->priv->layout_idle_id); - icon_view->priv->layout_idle_id = 0; - } - - if (icon_view->priv->scroll_to_path != NULL) - { - gtk_tree_row_reference_free (icon_view->priv->scroll_to_path); - icon_view->priv->scroll_to_path = NULL; - } - - remove_scroll_timeout (icon_view); - - if (icon_view->priv->hadjustment != NULL) - { - g_object_unref (icon_view->priv->hadjustment); - icon_view->priv->hadjustment = NULL; - } - - if (icon_view->priv->vadjustment != NULL) - { - g_object_unref (icon_view->priv->vadjustment); - icon_view->priv->vadjustment = NULL; - } - - GTK_OBJECT_CLASS (gtk_icon_view_parent_class)->destroy (object); -} - /* GObject methods */ static void gtk_icon_view_finalize (GObject *object) @@ -1317,7 +1271,45 @@ gtk_icon_view_get_property (GObject *object, } } -/* GtkWidget signals */ +/* GtkWidget methods */ +static void +gtk_icon_view_destroy (GtkWidget *widget) +{ + GtkIconView *icon_view = GTK_ICON_VIEW (widget); + + gtk_icon_view_stop_editing (icon_view, TRUE); + + gtk_icon_view_set_model (icon_view, NULL); + + if (icon_view->priv->layout_idle_id != 0) + { + g_source_remove (icon_view->priv->layout_idle_id); + icon_view->priv->layout_idle_id = 0; + } + + if (icon_view->priv->scroll_to_path != NULL) + { + gtk_tree_row_reference_free (icon_view->priv->scroll_to_path); + icon_view->priv->scroll_to_path = NULL; + } + + remove_scroll_timeout (icon_view); + + if (icon_view->priv->hadjustment != NULL) + { + g_object_unref (icon_view->priv->hadjustment); + icon_view->priv->hadjustment = NULL; + } + + if (icon_view->priv->vadjustment != NULL) + { + g_object_unref (icon_view->priv->vadjustment); + icon_view->priv->vadjustment = NULL; + } + + GTK_WIDGET_CLASS (gtk_icon_view_parent_class)->destroy (widget); +} + static void gtk_icon_view_realize (GtkWidget *widget) { diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 0d8b1b92db..bbc96122cd 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -165,7 +165,7 @@ static void gtk_image_style_set (GtkWidget *widget, GtkStyle *prev_style); static void gtk_image_screen_changed (GtkWidget *widget, GdkScreen *prev_screen); -static void gtk_image_destroy (GtkObject *object); +static void gtk_image_destroy (GtkWidget *widget); static void gtk_image_reset (GtkImage *image); static void gtk_image_calc_size (GtkImage *image); @@ -205,21 +205,16 @@ static void gtk_image_class_init (GtkImageClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; gobject_class = G_OBJECT_CLASS (class); gobject_class->set_property = gtk_image_set_property; gobject_class->get_property = gtk_image_get_property; - - object_class = GTK_OBJECT_CLASS (class); - - object_class->destroy = gtk_image_destroy; widget_class = GTK_WIDGET_CLASS (class); - widget_class->draw = gtk_image_draw; + widget_class->destroy = gtk_image_destroy; widget_class->size_request = gtk_image_size_request; widget_class->unmap = gtk_image_unmap; widget_class->unrealize = gtk_image_unrealize; @@ -335,7 +330,7 @@ gtk_image_class_init (GtkImageClass *class) GTK_IMAGE_EMPTY, GTK_PARAM_READABLE)); - g_type_class_add_private (object_class, sizeof (GtkImagePrivate)); + g_type_class_add_private (class, sizeof (GtkImagePrivate)); } static void @@ -359,13 +354,13 @@ gtk_image_init (GtkImage *image) } static void -gtk_image_destroy (GtkObject *object) +gtk_image_destroy (GtkWidget *widget) { - GtkImage *image = GTK_IMAGE (object); + GtkImage *image = GTK_IMAGE (widget); gtk_image_reset (image); - - GTK_OBJECT_CLASS (gtk_image_parent_class)->destroy (object); + + GTK_WIDGET_CLASS (gtk_image_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkimagemenuitem.c b/gtk/gtkimagemenuitem.c index acfc7ba480..16d8ddca42 100644 --- a/gtk/gtkimagemenuitem.c +++ b/gtk/gtkimagemenuitem.c @@ -61,7 +61,7 @@ enum { static GtkActivatableIface *parent_activatable_iface; -static void gtk_image_menu_item_destroy (GtkObject *object); +static void gtk_image_menu_item_destroy (GtkWidget *widget); static void gtk_image_menu_item_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_image_menu_item_size_allocate (GtkWidget *widget, @@ -111,13 +111,11 @@ static void gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass) { GObjectClass *gobject_class = (GObjectClass*) klass; - GtkObjectClass *object_class = (GtkObjectClass*) klass; GtkWidgetClass *widget_class = (GtkWidgetClass*) klass; GtkMenuItemClass *menu_item_class = (GtkMenuItemClass*) klass; GtkContainerClass *container_class = (GtkContainerClass*) klass; - object_class->destroy = gtk_image_menu_item_destroy; - + widget_class->destroy = gtk_image_menu_item_destroy; widget_class->screen_changed = gtk_image_menu_item_screen_changed; widget_class->size_request = gtk_image_menu_item_size_request; widget_class->size_allocate = gtk_image_menu_item_size_allocate; @@ -197,7 +195,7 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass) TRUE, GTK_PARAM_READWRITE)); - g_type_class_add_private (object_class, sizeof (GtkImageMenuItemPrivate)); + g_type_class_add_private (klass, sizeof (GtkImageMenuItemPrivate)); } static void @@ -309,16 +307,16 @@ gtk_image_menu_item_map (GtkWidget *widget) } static void -gtk_image_menu_item_destroy (GtkObject *object) +gtk_image_menu_item_destroy (GtkWidget *widget) { - GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (object); + GtkImageMenuItem *image_menu_item = GTK_IMAGE_MENU_ITEM (widget); GtkImageMenuItemPrivate *priv = image_menu_item->priv; if (priv->image) gtk_container_remove (GTK_CONTAINER (image_menu_item), priv->image); - GTK_OBJECT_CLASS (gtk_image_menu_item_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_image_menu_item_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c index b8a5e67b3b..e08f62da24 100644 --- a/gtk/gtkinvisible.c +++ b/gtk/gtkinvisible.c @@ -42,7 +42,7 @@ enum { LAST_ARG }; -static void gtk_invisible_destroy (GtkObject *object); +static void gtk_invisible_destroy (GtkWidget *widget); static void gtk_invisible_realize (GtkWidget *widget); static void gtk_invisible_style_set (GtkWidget *widget, GtkStyle *previous_style); @@ -68,19 +68,17 @@ static void gtk_invisible_class_init (GtkInvisibleClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; widget_class = (GtkWidgetClass*) class; - object_class = (GtkObjectClass*) class; gobject_class = (GObjectClass*) class; widget_class->realize = gtk_invisible_realize; widget_class->style_set = gtk_invisible_style_set; widget_class->show = gtk_invisible_show; widget_class->size_allocate = gtk_invisible_size_allocate; + widget_class->destroy = gtk_invisible_destroy; - object_class->destroy = gtk_invisible_destroy; gobject_class->set_property = gtk_invisible_set_property; gobject_class->get_property = gtk_invisible_get_property; gobject_class->constructor = gtk_invisible_constructor; @@ -116,9 +114,9 @@ gtk_invisible_init (GtkInvisible *invisible) } static void -gtk_invisible_destroy (GtkObject *object) +gtk_invisible_destroy (GtkWidget *widget) { - GtkInvisible *invisible = GTK_INVISIBLE (object); + GtkInvisible *invisible = GTK_INVISIBLE (widget); GtkInvisiblePrivate *priv = invisible->priv; if (priv->has_user_ref_count) @@ -127,7 +125,7 @@ gtk_invisible_destroy (GtkObject *object) g_object_unref (invisible); } - GTK_OBJECT_CLASS (gtk_invisible_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_invisible_parent_class)->destroy (widget); } /** diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index f9e71093ae..241862f5fa 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -197,8 +197,8 @@ static void gtk_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gtk_label_destroy (GtkObject *object); static void gtk_label_finalize (GObject *object); +static void gtk_label_destroy (GtkWidget *widget); static void gtk_label_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_label_state_changed (GtkWidget *widget, @@ -379,7 +379,6 @@ static void gtk_label_class_init (GtkLabelClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); GtkBindingSet *binding_set; @@ -387,8 +386,7 @@ gtk_label_class_init (GtkLabelClass *class) gobject_class->get_property = gtk_label_get_property; gobject_class->finalize = gtk_label_finalize; - object_class->destroy = gtk_label_destroy; - + widget_class->destroy = gtk_label_destroy; widget_class->size_allocate = gtk_label_size_allocate; widget_class->state_changed = gtk_label_state_changed; widget_class->style_set = gtk_label_style_set; @@ -516,7 +514,7 @@ gtk_label_class_init (GtkLabelClass *class) */ signals[ACTIVATE_CURRENT_LINK] = g_signal_new_class_handler ("activate-current-link", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_CALLBACK (gtk_label_activate_current_link), NULL, NULL, @@ -538,7 +536,7 @@ gtk_label_class_init (GtkLabelClass *class) */ signals[ACTIVATE_LINK] = g_signal_new ("activate-link", - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GtkLabelClass, activate_link), _gtk_boolean_handled_accumulator, NULL, @@ -2951,13 +2949,13 @@ gtk_label_get_line_wrap_mode (GtkLabel *label) } static void -gtk_label_destroy (GtkObject *object) +gtk_label_destroy (GtkWidget *widget) { - GtkLabel *label = GTK_LABEL (object); + GtkLabel *label = GTK_LABEL (widget); gtk_label_set_mnemonic_widget (label, NULL); - GTK_OBJECT_CLASS (gtk_label_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_label_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 61799196af..ee02d3b356 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -171,7 +171,7 @@ static void gtk_menu_get_child_property(GtkContainer *container, guint property_id, GValue *value, GParamSpec *pspec); -static void gtk_menu_destroy (GtkObject *object); +static void gtk_menu_destroy (GtkWidget *widget); static void gtk_menu_realize (GtkWidget *widget); static void gtk_menu_unrealize (GtkWidget *widget); static void gtk_menu_size_allocate (GtkWidget *widget, @@ -459,7 +459,6 @@ static void gtk_menu_class_init (GtkMenuClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class); GtkMenuShellClass *menu_shell_class = GTK_MENU_SHELL_CLASS (class); @@ -468,8 +467,7 @@ gtk_menu_class_init (GtkMenuClass *class) gobject_class->set_property = gtk_menu_set_property; gobject_class->get_property = gtk_menu_get_property; - object_class->destroy = gtk_menu_destroy; - + widget_class->destroy = gtk_menu_destroy; widget_class->realize = gtk_menu_realize; widget_class->unrealize = gtk_menu_unrealize; widget_class->size_allocate = gtk_menu_size_allocate; @@ -505,7 +503,7 @@ gtk_menu_class_init (GtkMenuClass *class) menu_signals[MOVE_SCROLL] = g_signal_new_class_handler (I_("move-scroll"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_CALLBACK (gtk_menu_real_move_scroll), NULL, NULL, @@ -1082,15 +1080,15 @@ gtk_menu_init (GtkMenu *menu) } static void -gtk_menu_destroy (GtkObject *object) +gtk_menu_destroy (GtkWidget *widget) { - GtkMenu *menu = GTK_MENU (object); + GtkMenu *menu = GTK_MENU (widget); GtkMenuAttachData *data; GtkMenuPrivate *priv; gtk_menu_remove_scroll_timeout (menu); - data = g_object_get_data (G_OBJECT (object), attach_data_key); + data = g_object_get_data (G_OBJECT (widget), attach_data_key); if (data) gtk_menu_detach (menu); @@ -1106,7 +1104,7 @@ gtk_menu_destroy (GtkObject *object) if (menu->needs_destruction_ref_count) { menu->needs_destruction_ref_count = FALSE; - g_object_ref (object); + g_object_ref (widget); } if (menu->accel_group) @@ -1142,7 +1140,7 @@ gtk_menu_destroy (GtkObject *object) priv->position_func_data_destroy = NULL; } - GTK_OBJECT_CLASS (gtk_menu_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_menu_parent_class)->destroy (widget); } static void @@ -5111,7 +5109,7 @@ gtk_menu_reparent (GtkMenu *menu, GtkWidget *new_parent, gboolean unrealize) { - GtkObject *object = GTK_OBJECT (menu); + GObject *object = G_OBJECT (menu); GtkWidget *widget = GTK_WIDGET (menu); gboolean was_floating = g_object_is_floating (object); @@ -5125,10 +5123,10 @@ gtk_menu_reparent (GtkMenu *menu, g_object_unref (object); } else - gtk_widget_reparent (GTK_WIDGET (menu), new_parent); - + gtk_widget_reparent (widget, new_parent); + if (was_floating) - g_object_force_floating (G_OBJECT (object)); + g_object_force_floating (object); else g_object_unref (object); } diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index 8a0529b785..3fb01ee45c 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -78,7 +78,7 @@ static void gtk_menu_item_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gtk_menu_item_destroy (GtkObject *object); +static void gtk_menu_item_destroy (GtkWidget *widget); static void gtk_menu_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_menu_item_realize (GtkWidget *widget); @@ -177,7 +177,6 @@ static void gtk_menu_item_class_init (GtkMenuItemClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); @@ -185,8 +184,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) gobject_class->set_property = gtk_menu_item_set_property; gobject_class->get_property = gtk_menu_item_get_property; - object_class->destroy = gtk_menu_item_destroy; - + widget_class->destroy = gtk_menu_item_destroy; widget_class->size_allocate = gtk_menu_item_size_allocate; widget_class->draw = gtk_menu_item_draw; widget_class->realize = gtk_menu_item_realize; @@ -414,7 +412,7 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass) 0, G_MAXINT, 12, GTK_PARAM_READABLE)); - g_type_class_add_private (object_class, sizeof (GtkMenuItemPrivate)); + g_type_class_add_private (klass, sizeof (GtkMenuItemPrivate)); } static void @@ -567,14 +565,14 @@ gtk_menu_item_get_property (GObject *object, } static void -gtk_menu_item_destroy (GtkObject *object) +gtk_menu_item_destroy (GtkWidget *widget) { - GtkMenuItem *menu_item = GTK_MENU_ITEM (object); + GtkMenuItem *menu_item = GTK_MENU_ITEM (widget); if (menu_item->submenu) gtk_widget_destroy (menu_item->submenu); - GTK_OBJECT_CLASS (gtk_menu_item_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkmenutoolbutton.c b/gtk/gtkmenutoolbutton.c index f5654585ab..65bffeb901 100644 --- a/gtk/gtkmenutoolbutton.c +++ b/gtk/gtkmenutoolbutton.c @@ -44,7 +44,7 @@ struct _GtkMenuToolButtonPrivate GtkMenu *menu; }; -static void gtk_menu_tool_button_destroy (GtkObject *object); +static void gtk_menu_tool_button_destroy (GtkWidget *widget); static int menu_deactivate_cb (GtkMenuShell *menu_shell, GtkMenuToolButton *button); @@ -203,19 +203,19 @@ static void gtk_menu_tool_button_class_init (GtkMenuToolButtonClass *klass) { GObjectClass *object_class; - GtkObjectClass *gtk_object_class; GtkWidgetClass *widget_class; GtkToolItemClass *toolitem_class; object_class = (GObjectClass *)klass; - gtk_object_class = (GtkObjectClass *)klass; widget_class = (GtkWidgetClass *)klass; toolitem_class = (GtkToolItemClass *)klass; object_class->set_property = gtk_menu_tool_button_set_property; object_class->get_property = gtk_menu_tool_button_get_property; - gtk_object_class->destroy = gtk_menu_tool_button_destroy; + + widget_class->destroy = gtk_menu_tool_button_destroy; widget_class->state_changed = gtk_menu_tool_button_state_changed; + toolitem_class->toolbar_reconfigured = gtk_menu_tool_button_toolbar_reconfigured; /** @@ -431,11 +431,9 @@ gtk_menu_tool_button_init (GtkMenuToolButton *button) } static void -gtk_menu_tool_button_destroy (GtkObject *object) +gtk_menu_tool_button_destroy (GtkWidget *widget) { - GtkMenuToolButton *button; - - button = GTK_MENU_TOOL_BUTTON (object); + GtkMenuToolButton *button = GTK_MENU_TOOL_BUTTON (widget); if (button->priv->menu) { @@ -452,7 +450,7 @@ gtk_menu_tool_button_destroy (GtkObject *object) button); } - GTK_OBJECT_CLASS (gtk_menu_tool_button_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_menu_tool_button_parent_class)->destroy (widget); } /** diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 207aff5cef..d6c018eb84 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -262,8 +262,7 @@ static void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook, gboolean *fill, GtkPackType *pack_type); -/*** GtkObject Methods ***/ -static void gtk_notebook_destroy (GtkObject *object); +/*** GObject Methods ***/ static void gtk_notebook_set_property (GObject *object, guint prop_id, const GValue *value, @@ -274,6 +273,7 @@ static void gtk_notebook_get_property (GObject *object, GParamSpec *pspec); /*** GtkWidget Methods ***/ +static void gtk_notebook_destroy (GtkWidget *widget); static void gtk_notebook_map (GtkWidget *widget); static void gtk_notebook_unmap (GtkWidget *widget); static void gtk_notebook_realize (GtkWidget *widget); @@ -537,15 +537,14 @@ static void gtk_notebook_class_init (GtkNotebookClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class); GtkBindingSet *binding_set; gobject_class->set_property = gtk_notebook_set_property; gobject_class->get_property = gtk_notebook_get_property; - object_class->destroy = gtk_notebook_destroy; + widget_class->destroy = gtk_notebook_destroy; widget_class->map = gtk_notebook_map; widget_class->unmap = gtk_notebook_unmap; widget_class->realize = gtk_notebook_realize; @@ -1453,36 +1452,11 @@ gtk_notebook_new (void) return g_object_new (GTK_TYPE_NOTEBOOK, NULL); } -/* Private GtkObject Methods : - * - * gtk_notebook_destroy - * gtk_notebook_set_arg - * gtk_notebook_get_arg +/* Private GObject Methods : + * + * gtk_notebook_set_property + * gtk_notebook_get_property */ -static void -gtk_notebook_destroy (GtkObject *object) -{ - GtkNotebook *notebook = GTK_NOTEBOOK (object); - GtkNotebookPrivate *priv = notebook->priv; - - if (priv->menu) - gtk_notebook_popup_disable (notebook); - - if (priv->source_targets) - { - gtk_target_list_unref (priv->source_targets); - priv->source_targets = NULL; - } - - if (priv->switch_tab_timer) - { - g_source_remove (priv->switch_tab_timer); - priv->switch_tab_timer = 0; - } - - GTK_OBJECT_CLASS (gtk_notebook_parent_class)->destroy (object); -} - static void gtk_notebook_set_property (GObject *object, guint prop_id, @@ -1564,7 +1538,8 @@ gtk_notebook_get_property (GObject *object, } /* Private GtkWidget Methods : - * + * + * gtk_notebook_destroy * gtk_notebook_map * gtk_notebook_unmap * gtk_notebook_realize @@ -1588,6 +1563,30 @@ gtk_notebook_get_property (GObject *object, * gtk_notebook_drag_data_get * gtk_notebook_drag_data_received */ +static void +gtk_notebook_destroy (GtkWidget *widget) +{ + GtkNotebook *notebook = GTK_NOTEBOOK (widget); + GtkNotebookPrivate *priv = notebook->priv; + + if (priv->menu) + gtk_notebook_popup_disable (notebook); + + if (priv->source_targets) + { + gtk_target_list_unref (priv->source_targets); + priv->source_targets = NULL; + } + + if (priv->switch_tab_timer) + { + g_source_remove (priv->switch_tab_timer); + priv->switch_tab_timer = 0; + } + + GTK_WIDGET_CLASS (gtk_notebook_parent_class)->destroy (widget); +} + static gboolean gtk_notebook_get_event_window_position (GtkNotebook *notebook, GdkRectangle *rectangle) diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index b67e32097b..3b655a048d 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -206,12 +206,10 @@ static void gtk_path_bar_class_init (GtkPathBarClass *path_bar_class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; gobject_class = (GObjectClass *) path_bar_class; - object_class = (GtkObjectClass *) path_bar_class; widget_class = (GtkWidgetClass *) path_bar_class; container_class = (GtkContainerClass *) path_bar_class; @@ -238,7 +236,7 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class) path_bar_signals [PATH_CLICKED] = g_signal_new (I_("path-clicked"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkPathBarClass, path_clicked), NULL, NULL, diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c index 9e91add08b..d760d4f920 100644 --- a/gtk/gtkradiobutton.c +++ b/gtk/gtkradiobutton.c @@ -114,7 +114,7 @@ enum { }; -static void gtk_radio_button_destroy (GtkObject *object); +static void gtk_radio_button_destroy (GtkWidget *widget); static gboolean gtk_radio_button_focus (GtkWidget *widget, GtkDirectionType direction); static void gtk_radio_button_clicked (GtkButton *button); @@ -137,13 +137,11 @@ static void gtk_radio_button_class_init (GtkRadioButtonClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkButtonClass *button_class; GtkCheckButtonClass *check_button_class; GtkWidgetClass *widget_class; gobject_class = G_OBJECT_CLASS (class); - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; button_class = (GtkButtonClass*) class; check_button_class = (GtkCheckButtonClass*) class; @@ -163,8 +161,7 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class) P_("The radio button whose group this widget belongs to."), GTK_TYPE_RADIO_BUTTON, GTK_PARAM_WRITABLE)); - object_class->destroy = gtk_radio_button_destroy; - + widget_class->destroy = gtk_radio_button_destroy; widget_class->focus = gtk_radio_button_focus; button_class->clicked = gtk_radio_button_clicked; @@ -187,7 +184,7 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class) * Since: 2.4 */ group_changed_signal = g_signal_new (I_("group-changed"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed), NULL, NULL, @@ -561,10 +558,10 @@ gtk_radio_button_get_group (GtkRadioButton *radio_button) static void -gtk_radio_button_destroy (GtkObject *object) +gtk_radio_button_destroy (GtkWidget *widget) { GtkWidget *old_group_singleton = NULL; - GtkRadioButton *radio_button = GTK_RADIO_BUTTON (object); + GtkRadioButton *radio_button = GTK_RADIO_BUTTON (widget); GtkRadioButtonPrivate *priv = radio_button->priv; GtkRadioButton *tmp_button; GSList *tmp_list; @@ -594,7 +591,7 @@ gtk_radio_button_destroy (GtkObject *object) if (was_in_group) g_signal_emit (radio_button, group_changed_signal, 0); - GTK_OBJECT_CLASS (gtk_radio_button_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_radio_button_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c index e85cb5e106..e8750266fa 100644 --- a/gtk/gtkradiomenuitem.c +++ b/gtk/gtkradiomenuitem.c @@ -44,7 +44,7 @@ enum { }; -static void gtk_radio_menu_item_destroy (GtkObject *object); +static void gtk_radio_menu_item_destroy (GtkWidget *widget); static void gtk_radio_menu_item_activate (GtkMenuItem *menu_item); static void gtk_radio_menu_item_set_property (GObject *object, guint prop_id, @@ -346,16 +346,20 @@ static void gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass) { GObjectClass *gobject_class; - GtkObjectClass *object_class; + GtkWidgetClass *widget_class; GtkMenuItemClass *menu_item_class; gobject_class = G_OBJECT_CLASS (klass); - object_class = GTK_OBJECT_CLASS (klass); + widget_class = GTK_WIDGET_CLASS (klass); menu_item_class = GTK_MENU_ITEM_CLASS (klass); gobject_class->set_property = gtk_radio_menu_item_set_property; gobject_class->get_property = gtk_radio_menu_item_get_property; + widget_class->destroy = gtk_radio_menu_item_destroy; + + menu_item_class->activate = gtk_radio_menu_item_activate; + /** * GtkRadioMenuItem:group: * @@ -371,10 +375,6 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass) GTK_TYPE_RADIO_MENU_ITEM, GTK_PARAM_WRITABLE)); - object_class->destroy = gtk_radio_menu_item_destroy; - - menu_item_class->activate = gtk_radio_menu_item_activate; - /** * GtkStyle::group-changed: * @style: the object which received the signal @@ -389,7 +389,7 @@ gtk_radio_menu_item_class_init (GtkRadioMenuItemClass *klass) * Since: 2.4 */ group_changed_signal = g_signal_new (I_("group-changed"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GtkRadioMenuItemClass, group_changed), NULL, NULL, @@ -414,9 +414,9 @@ gtk_radio_menu_item_init (GtkRadioMenuItem *radio_menu_item) } static void -gtk_radio_menu_item_destroy (GtkObject *object) +gtk_radio_menu_item_destroy (GtkWidget *widget) { - GtkRadioMenuItem *radio_menu_item = GTK_RADIO_MENU_ITEM (object); + GtkRadioMenuItem *radio_menu_item = GTK_RADIO_MENU_ITEM (widget); GtkRadioMenuItemPrivate *priv = radio_menu_item->priv; GtkWidget *old_group_singleton = NULL; GtkRadioMenuItem *tmp_menu_item; @@ -447,7 +447,7 @@ gtk_radio_menu_item_destroy (GtkObject *object) if (was_in_group) g_signal_emit (radio_menu_item, group_changed_signal, 0); - GTK_OBJECT_CLASS (gtk_radio_menu_item_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_radio_menu_item_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 80943053dc..07d89e1480 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -180,7 +180,7 @@ static void gtk_range_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gtk_range_destroy (GtkObject *object); +static void gtk_range_destroy (GtkWidget *widget); static void gtk_range_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_range_size_allocate (GtkWidget *widget, @@ -279,18 +279,15 @@ static void gtk_range_class_init (GtkRangeClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; gobject_class = G_OBJECT_CLASS (class); - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; gobject_class->set_property = gtk_range_set_property; gobject_class->get_property = gtk_range_get_property; - object_class->destroy = gtk_range_destroy; - + widget_class->destroy = gtk_range_destroy; widget_class->size_request = gtk_range_size_request; widget_class->size_allocate = gtk_range_size_allocate; widget_class->realize = gtk_range_realize; @@ -1510,9 +1507,9 @@ should_invert (GtkRange *range) } static void -gtk_range_destroy (GtkObject *object) +gtk_range_destroy (GtkWidget *widget) { - GtkRange *range = GTK_RANGE (object); + GtkRange *range = GTK_RANGE (widget); GtkRangePrivate *priv = range->priv; gtk_range_remove_step_timer (range); @@ -1543,7 +1540,7 @@ gtk_range_destroy (GtkObject *object) priv->n_marks = 0; } - GTK_OBJECT_CLASS (gtk_range_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_range_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index e930308ddc..55fccbac83 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -109,7 +109,6 @@ enum LAST_SIGNAL }; -static void gtk_scrolled_window_destroy (GtkObject *object); static void gtk_scrolled_window_set_property (GObject *object, guint prop_id, const GValue *value, @@ -119,6 +118,7 @@ static void gtk_scrolled_window_get_property (GObject *objec GValue *value, GParamSpec *pspec); +static void gtk_scrolled_window_destroy (GtkWidget *widget); static void gtk_scrolled_window_screen_changed (GtkWidget *widget, GdkScreen *previous_screen); static gboolean gtk_scrolled_window_draw (GtkWidget *widget, @@ -206,20 +206,17 @@ static void gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkBindingSet *binding_set; - object_class = (GtkObjectClass*) class; widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; gobject_class->set_property = gtk_scrolled_window_set_property; gobject_class->get_property = gtk_scrolled_window_get_property; - object_class->destroy = gtk_scrolled_window_destroy; - + widget_class->destroy = gtk_scrolled_window_destroy; widget_class->screen_changed = gtk_scrolled_window_screen_changed; widget_class->draw = gtk_scrolled_window_draw; widget_class->size_allocate = gtk_scrolled_window_size_allocate; @@ -345,7 +342,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) signals[SCROLL_CHILD] = g_signal_new (I_("scroll-child"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkScrolledWindowClass, scroll_child), NULL, NULL, @@ -355,7 +352,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class) G_TYPE_BOOLEAN); signals[MOVE_FOCUS_OUT] = g_signal_new (I_("move-focus-out"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkScrolledWindowClass, move_focus_out), NULL, NULL, @@ -910,9 +907,9 @@ gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window) } static void -gtk_scrolled_window_destroy (GtkObject *object) +gtk_scrolled_window_destroy (GtkWidget *widget) { - GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object); + GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget); GtkScrolledWindowPrivate *priv = scrolled_window->priv; if (priv->hscrollbar) @@ -936,7 +933,7 @@ gtk_scrolled_window_destroy (GtkObject *object) priv->vscrollbar = NULL; } - GTK_OBJECT_CLASS (gtk_scrolled_window_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 50f48d353e..d7117691d7 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -106,7 +106,7 @@ static void gtk_spin_button_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void gtk_spin_button_destroy (GtkObject *object); +static void gtk_spin_button_destroy (GtkWidget *widget); static void gtk_spin_button_map (GtkWidget *widget); static void gtk_spin_button_unmap (GtkWidget *widget); static void gtk_spin_button_realize (GtkWidget *widget); @@ -187,7 +187,6 @@ static void gtk_spin_button_class_init (GtkSpinButtonClass *class) { GObjectClass *gobject_class = G_OBJECT_CLASS (class); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); GtkEntryClass *entry_class = GTK_ENTRY_CLASS (class); GtkBindingSet *binding_set; @@ -196,7 +195,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) gobject_class->set_property = gtk_spin_button_set_property; gobject_class->get_property = gtk_spin_button_get_property; - object_class->destroy = gtk_spin_button_destroy; + widget_class->destroy = gtk_spin_button_destroy; widget_class->map = gtk_spin_button_map; widget_class->unmap = gtk_spin_button_unmap; widget_class->realize = gtk_spin_button_realize; @@ -539,11 +538,11 @@ gtk_spin_button_finalize (GObject *object) } static void -gtk_spin_button_destroy (GtkObject *object) +gtk_spin_button_destroy (GtkWidget *widget) { - gtk_spin_button_stop_spinning (GTK_SPIN_BUTTON (object)); + gtk_spin_button_stop_spinning (GTK_SPIN_BUTTON (widget)); - GTK_OBJECT_CLASS (gtk_spin_button_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->destroy (widget); } static void diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index 55379bcc4c..d5e84f2410 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -116,10 +116,10 @@ static void gtk_statusbar_buildable_interface_init (GtkBuildableIface *if static GObject *gtk_statusbar_buildable_get_internal_child (GtkBuildable *buildable, GtkBuilder *builder, const gchar *childname); -static void gtk_statusbar_destroy (GtkObject *object); static void gtk_statusbar_update (GtkStatusbar *statusbar, guint context_id, const gchar *text); +static void gtk_statusbar_destroy (GtkWidget *widget); static void gtk_statusbar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_statusbar_realize (GtkWidget *widget); @@ -163,18 +163,15 @@ static void gtk_statusbar_class_init (GtkStatusbarClass *class) { GObjectClass *gobject_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; gobject_class = (GObjectClass *) class; - object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; gobject_class->set_property = gtk_statusbar_set_property; gobject_class->get_property = gtk_statusbar_get_property; - object_class->destroy = gtk_statusbar_destroy; - + widget_class->destroy = gtk_statusbar_destroy; widget_class->realize = gtk_statusbar_realize; widget_class->unrealize = gtk_statusbar_unrealize; widget_class->map = gtk_statusbar_map; @@ -691,9 +688,9 @@ gtk_statusbar_get_message_area (GtkStatusbar *statusbar) } static void -gtk_statusbar_destroy (GtkObject *object) +gtk_statusbar_destroy (GtkWidget *widget) { - GtkStatusbar *statusbar = GTK_STATUSBAR (object); + GtkStatusbar *statusbar = GTK_STATUSBAR (widget); GtkStatusbarPrivate *priv = statusbar->priv; GSList *list; @@ -713,7 +710,7 @@ gtk_statusbar_destroy (GtkObject *object) g_slist_free (priv->keys); priv->keys = NULL; - GTK_OBJECT_CLASS (gtk_statusbar_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_statusbar_parent_class)->destroy (widget); } static void diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 41b5bc5a7a..9a1ef38949 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -260,7 +260,6 @@ enum PROP_IM_MODULE }; -static void gtk_text_view_destroy (GtkObject *object); static void gtk_text_view_finalize (GObject *object); static void gtk_text_view_set_property (GObject *object, guint prop_id, @@ -270,6 +269,7 @@ static void gtk_text_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void gtk_text_view_destroy (GtkWidget *widget); static void gtk_text_view_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_text_view_size_allocate (GtkWidget *widget, @@ -563,7 +563,6 @@ static void gtk_text_view_class_init (GtkTextViewClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); GtkBindingSet *binding_set; @@ -572,10 +571,9 @@ gtk_text_view_class_init (GtkTextViewClass *klass) */ gobject_class->set_property = gtk_text_view_set_property; gobject_class->get_property = gtk_text_view_get_property; - - object_class->destroy = gtk_text_view_destroy; gobject_class->finalize = gtk_text_view_finalize; + widget_class->destroy = gtk_text_view_destroy; widget_class->realize = gtk_text_view_realize; widget_class->unrealize = gtk_text_view_unrealize; widget_class->style_set = gtk_text_view_style_set; @@ -1090,7 +1088,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass) */ signals[SELECT_ALL] = g_signal_new_class_handler (I_("select-all"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_CALLBACK (gtk_text_view_select_all), NULL, NULL, @@ -1109,7 +1107,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass) */ signals[TOGGLE_CURSOR_VISIBLE] = g_signal_new_class_handler (I_("toggle-cursor-visible"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_CALLBACK (gtk_text_view_toggle_cursor_visible), NULL, NULL, @@ -1132,7 +1130,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass) */ signals[PREEDIT_CHANGED] = g_signal_new_class_handler (I_("preedit-changed"), - G_OBJECT_CLASS_TYPE (object_class), + G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, NULL, NULL, NULL, @@ -3009,12 +3007,12 @@ gtk_text_view_remove_validate_idles (GtkTextView *text_view) } static void -gtk_text_view_destroy (GtkObject *object) +gtk_text_view_destroy (GtkWidget *widget) { GtkTextView *text_view; GtkTextViewPrivate *priv; - text_view = GTK_TEXT_VIEW (object); + text_view = GTK_TEXT_VIEW (widget); priv = text_view->priv; gtk_text_view_remove_validate_idles (text_view); @@ -3033,7 +3031,7 @@ gtk_text_view_destroy (GtkObject *object) priv->im_spot_idle = 0; } - GTK_OBJECT_CLASS (gtk_text_view_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_text_view_parent_class)->destroy (widget); } static void diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 3095ee313a..3da1d7c9d6 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -158,10 +158,8 @@ static void gtk_tree_view_get_property (GObject *object, GValue *value, GParamSpec *pspec); -/* gtkobject signals */ -static void gtk_tree_view_destroy (GtkObject *object); - /* gtkwidget signals */ +static void gtk_tree_view_destroy (GtkWidget *widget); static void gtk_tree_view_realize (GtkWidget *widget); static void gtk_tree_view_unrealize (GtkWidget *widget); static void gtk_tree_view_map (GtkWidget *widget); @@ -495,7 +493,6 @@ static void gtk_tree_view_class_init (GtkTreeViewClass *class) { GObjectClass *o_class; - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkBindingSet *binding_set; @@ -503,7 +500,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) binding_set = gtk_binding_set_by_class (class); o_class = (GObjectClass *) class; - object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; container_class = (GtkContainerClass *) class; @@ -512,10 +508,8 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) o_class->get_property = gtk_tree_view_get_property; o_class->finalize = gtk_tree_view_finalize; - /* GtkObject signals */ - object_class->destroy = gtk_tree_view_destroy; - /* GtkWidget signals */ + widget_class->destroy = gtk_tree_view_destroy; widget_class->map = gtk_tree_view_map; widget_class->realize = gtk_tree_view_realize; widget_class->unrealize = gtk_tree_view_unrealize; @@ -1021,7 +1015,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[MOVE_CURSOR] = g_signal_new (I_("move-cursor"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, move_cursor), NULL, NULL, @@ -1032,7 +1026,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[SELECT_ALL] = g_signal_new (I_("select-all"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, select_all), NULL, NULL, @@ -1041,7 +1035,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[UNSELECT_ALL] = g_signal_new (I_("unselect-all"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, unselect_all), NULL, NULL, @@ -1050,7 +1044,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[SELECT_CURSOR_ROW] = g_signal_new (I_("select-cursor-row"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, select_cursor_row), NULL, NULL, @@ -1060,7 +1054,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[TOGGLE_CURSOR_ROW] = g_signal_new (I_("toggle-cursor-row"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, toggle_cursor_row), NULL, NULL, @@ -1069,7 +1063,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[EXPAND_COLLAPSE_CURSOR_ROW] = g_signal_new (I_("expand-collapse-cursor-row"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, expand_collapse_cursor_row), NULL, NULL, @@ -1081,7 +1075,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[SELECT_CURSOR_PARENT] = g_signal_new (I_("select-cursor-parent"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, select_cursor_parent), NULL, NULL, @@ -1090,7 +1084,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) tree_view_signals[START_INTERACTIVE_SEARCH] = g_signal_new (I_("start-interactive-search"), - G_TYPE_FROM_CLASS (object_class), + G_TYPE_FROM_CLASS (o_class), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkTreeViewClass, start_interactive_search), NULL, NULL, @@ -1568,7 +1562,7 @@ gtk_tree_view_buildable_get_internal_child (GtkBuildable *buildable, childname); } -/* GtkObject Methods +/* GtkWidget Methods */ static void @@ -1586,9 +1580,9 @@ gtk_tree_view_free_rbtree (GtkTreeView *tree_view) } static void -gtk_tree_view_destroy (GtkObject *object) +gtk_tree_view_destroy (GtkWidget *widget) { - GtkTreeView *tree_view = GTK_TREE_VIEW (object); + GtkTreeView *tree_view = GTK_TREE_VIEW (widget); GList *list; gtk_tree_view_stop_editing (tree_view, TRUE); @@ -1702,14 +1696,9 @@ gtk_tree_view_destroy (GtkObject *object) tree_view->priv->vadjustment = NULL; } - GTK_OBJECT_CLASS (gtk_tree_view_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->destroy (widget); } - - -/* GtkWidget Methods - */ - /* GtkWidget::map helper */ static void gtk_tree_view_map_buttons (GtkTreeView *tree_view) diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index fcf2b8d74a..3c04d31202 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -72,7 +72,6 @@ enum { static void gtk_viewport_finalize (GObject *object); -static void gtk_viewport_destroy (GtkObject *object); static void gtk_viewport_set_property (GObject *object, guint prop_id, const GValue *value, @@ -84,6 +83,7 @@ static void gtk_viewport_get_property (GObject *object, static void gtk_viewport_set_scroll_adjustments (GtkViewport *viewport, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); +static void gtk_viewport_destroy (GtkWidget *widget); static void gtk_viewport_realize (GtkWidget *widget); static void gtk_viewport_unrealize (GtkWidget *widget); static gint gtk_viewport_draw (GtkWidget *widget, @@ -110,12 +110,10 @@ G_DEFINE_TYPE (GtkViewport, gtk_viewport, GTK_TYPE_BIN) static void gtk_viewport_class_init (GtkViewportClass *class) { - GtkObjectClass *object_class; GObjectClass *gobject_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; - object_class = (GtkObjectClass*) class; gobject_class = G_OBJECT_CLASS (class); widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; @@ -123,8 +121,8 @@ gtk_viewport_class_init (GtkViewportClass *class) gobject_class->finalize = gtk_viewport_finalize; gobject_class->set_property = gtk_viewport_set_property; gobject_class->get_property = gtk_viewport_get_property; - object_class->destroy = gtk_viewport_destroy; - + + widget_class->destroy = gtk_viewport_destroy; widget_class->realize = gtk_viewport_realize; widget_class->unrealize = gtk_viewport_unrealize; widget_class->draw = gtk_viewport_draw; @@ -315,14 +313,14 @@ gtk_viewport_finalize (GObject *object) } static void -gtk_viewport_destroy (GtkObject *object) +gtk_viewport_destroy (GtkWidget *widget) { - GtkViewport *viewport = GTK_VIEWPORT (object); + GtkViewport *viewport = GTK_VIEWPORT (widget); viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_HORIZONTAL); viewport_disconnect_adjustment (viewport, GTK_ORIENTATION_VERTICAL); - GTK_OBJECT_CLASS (gtk_viewport_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_viewport_parent_class)->destroy (widget); } /** diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 2b614a0295..686e52b181 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -150,6 +150,8 @@ struct _GtkWidgetPrivate /* unused bits in our 32-bit block */ guint reserved : 10; + guint in_destruction : 1; + /* The widget's name. If the widget does not have a name * (the name is NULL), then its name (as returned by * "gtk_widget_get_name") is its class's name. @@ -184,6 +186,7 @@ struct _GtkWidgetPrivate }; enum { + DESTROY, SHOW, HIDE, MAP, @@ -513,8 +516,8 @@ gtk_widget_get_type (void) NULL /* interface data */ }; - widget_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkWidget", - &widget_info, G_TYPE_FLAG_ABSTRACT); + widget_type = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, "GtkWidget", + &widget_info, G_TYPE_FLAG_ABSTRACT); g_type_add_interface_static (widget_type, ATK_TYPE_IMPLEMENTOR, &accessibility_info) ; @@ -1037,6 +1040,23 @@ gtk_widget_class_init (GtkWidgetClass *klass) 0, GTK_PARAM_READWRITE)); + /** + * GtkWidget::destroy: + * @object: the object which received the signal + * + * Signals that all holders of a reference to the widget should release + * the reference that they hold. May result in finalization of the widget + * if all references are released. + */ + widget_signals[DESTROY] = + g_signal_new (I_("destroy"), + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, + G_STRUCT_OFFSET (GtkWidgetClass, destroy), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); + /** * GtkWidget::show: * @widget: the object which received the signal. @@ -3432,8 +3452,9 @@ gtk_widget_unparent (GtkWidget *widget) * gtk_widget_destroy: * @widget: a #GtkWidget * - * Destroys a widget. Equivalent to gtk_object_destroy(), except that - * you don't have to cast the widget to #GtkObject. When a widget is + * Destroys a widget. + * + * When a widget is * destroyed, it will break any references it holds to other objects. * If the widget is inside a container, the widget will be removed * from the container. If the widget is a toplevel (derived from @@ -3452,7 +3473,8 @@ gtk_widget_destroy (GtkWidget *widget) { g_return_if_fail (GTK_IS_WIDGET (widget)); - gtk_object_destroy ((GtkObject*) widget); + if (!widget->priv->in_destruction) + g_object_run_dispose (G_OBJECT (widget)); } /** @@ -9344,7 +9366,14 @@ gtk_widget_dispose (GObject *object) GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE); if (gtk_widget_get_realized (widget)) gtk_widget_unrealize (widget); - + + if (!priv->in_destruction) + { + priv->in_destruction = TRUE; + g_signal_emit (object, widget_signals[DESTROY], 0); + priv->in_destruction = FALSE; + } + G_OBJECT_CLASS (gtk_widget_parent_class)->dispose (object); } @@ -9367,8 +9396,6 @@ gtk_widget_real_destroy (GtkObject *object) g_object_unref (priv->style); priv->style = gtk_widget_get_default_style (); g_object_ref (priv->style); - - GTK_OBJECT_CLASS (gtk_widget_parent_class)->destroy (object); } static void @@ -9394,6 +9421,12 @@ gtk_widget_finalize (GObject *object) if (accessible) g_object_unref (accessible); + if (g_object_is_floating (object)) + g_warning ("A floating object was finalized. This means that someone\n" + "called g_object_unref() on an object that had only a floating\n" + "reference; the initial floating reference is not owned by anyone\n" + "and must be removed with g_object_ref_sink()."); + G_OBJECT_CLASS (gtk_widget_parent_class)->finalize (object); } diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index 03fa0f4d9d..a5746aa498 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -255,7 +255,7 @@ struct _GtkWidget * allows a GtkWidget pointer to be cast to a * GtkObject pointer. */ - GtkObject object; + GInitiallyUnowned object; /* internally used private flags. */ guint GSEAL (private_flags) : 16; @@ -306,7 +306,7 @@ struct _GtkWidget */ struct _GtkWidgetClass { - GtkObjectClass parent_class; + GInitiallyUnownedClass parent_class; /*< public >*/ @@ -322,6 +322,7 @@ struct _GtkWidgetClass GParamSpec **pspecs); /* basics */ + void (* destroy) (GtkWidget *widget); void (* show) (GtkWidget *widget); void (* show_all) (GtkWidget *widget); void (* hide) (GtkWidget *widget); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index a7e7aa556f..974cfbfa18 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -285,8 +285,8 @@ struct _GtkWindowGroupPrivate }; static void gtk_window_dispose (GObject *object); -static void gtk_window_destroy (GtkObject *object); static void gtk_window_finalize (GObject *object); +static void gtk_window_destroy (GtkWidget *widget); static void gtk_window_show (GtkWidget *widget); static void gtk_window_hide (GtkWidget *widget); static void gtk_window_map (GtkWidget *widget); @@ -509,12 +509,10 @@ static void gtk_window_class_init (GtkWindowClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkContainerClass *container_class; GtkBindingSet *binding_set; - - object_class = (GtkObjectClass*) klass; + widget_class = (GtkWidgetClass*) klass; container_class = (GtkContainerClass*) klass; @@ -528,9 +526,8 @@ gtk_window_class_init (GtkWindowClass *klass) gobject_class->set_property = gtk_window_set_property; gobject_class->get_property = gtk_window_get_property; - - object_class->destroy = gtk_window_destroy; + widget_class->destroy = gtk_window_destroy; widget_class->show = gtk_window_show; widget_class->hide = gtk_window_hide; widget_class->map = gtk_window_map; @@ -4310,9 +4307,9 @@ gtk_window_reshow_with_initial_size (GtkWindow *window) } static void -gtk_window_destroy (GtkObject *object) +gtk_window_destroy (GtkWidget *widget) { - GtkWindow *window = GTK_WINDOW (object); + GtkWindow *window = GTK_WINDOW (widget); GtkWindowPrivate *priv = window->priv; toplevel_list = g_slist_remove (toplevel_list, window); @@ -4334,7 +4331,7 @@ gtk_window_destroy (GtkObject *object) gtk_window_free_key_hash (window); - GTK_OBJECT_CLASS (gtk_window_parent_class)->destroy (object); + GTK_WIDGET_CLASS (gtk_window_parent_class)->destroy (widget); } static void