From fbb2e3f4f51a4c0ccc8f2bf511f4766293fc4af0 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Wed, 23 Nov 2005 18:06:58 +0000 Subject: deprecated floating/sink API and implemented it in terms of the GObject Wed Nov 23 18:55:47 2005 Tim Janik * gtk/gtkobject.[hc]: deprecated floating/sink API and implemented it in terms of the GObject floating/sink API. * gtk/gtkaboutdialog.c: * gtk/gtkaction.c: * gtk/gtkcellview.c: * gtk/gtkclist.c: * gtk/gtkcolorsel.c: * gtk/gtkcombobox.c: * gtk/gtkfilechooserdefault.c: * gtk/gtkiconview.c: * gtk/gtkinvisible.c: * gtk/gtkitemfactory.c: * gtk/gtklayout.c: * gtk/gtkmenu.c: * gtk/gtkmenutoolbutton.c: * gtk/gtknotebook.c: * gtk/gtkprogress.c: * gtk/gtkrange.c: * gtk/gtkspinbutton.c: * gtk/gtkstatusicon.c: * gtk/gtktext.c: * gtk/gtktextview.c: * gtk/gtktoolbar.c: * gtk/gtktoolbutton.c: * gtk/gtktoolitem.c: * gtk/gtktreeitem.c: * gtk/gtktreeview.c: * gtk/gtktreeviewcolumn.c: * gtk/gtkuimanager.c: * gtk/gtkviewport.c: * gtk/gtkwidget.c: * gtk/gtkwindow.c: ported to use GObject's g_object_ref_sink(). * gtk/gtkcolorsel.c: * gtk/gtkfilechooserdefault.c: * gtk/gtkaboutdialog.c: fixed compiler warnings. --- ChangeLog | 42 ++++++++++++++++++++++++++++++++++++++++++ ChangeLog.pre-2-10 | 42 ++++++++++++++++++++++++++++++++++++++++++ gtk/gtk.symbols | 2 +- gtk/gtkaboutdialog.c | 5 ++--- gtk/gtkaction.c | 3 +-- gtk/gtkcellview.c | 6 ++---- gtk/gtkclist.c | 6 ++---- gtk/gtkcolorsel.c | 7 +++---- gtk/gtkcombobox.c | 9 +++------ gtk/gtkfilechooserdefault.c | 21 +++++++++------------ gtk/gtkiconview.c | 12 ++++-------- gtk/gtkinvisible.c | 3 +-- gtk/gtkitemfactory.c | 6 ++---- gtk/gtklayout.c | 6 ++---- gtk/gtkmenu.c | 12 +++++------- gtk/gtkmenutoolbutton.c | 3 +-- gtk/gtknotebook.c | 6 ++---- gtk/gtkobject.c | 22 ++++------------------ gtk/gtkobject.h | 6 ++++++ gtk/gtkprogress.c | 3 +-- gtk/gtkrange.c | 3 +-- gtk/gtkspinbutton.c | 3 +-- gtk/gtkstatusicon.c | 3 +-- gtk/gtktext.c | 6 ++---- gtk/gtktextview.c | 6 ++---- gtk/gtktoolbar.c | 6 ++---- gtk/gtktoolbutton.c | 6 ++---- gtk/gtktoolitem.c | 3 +-- gtk/gtktreeitem.c | 6 ++---- gtk/gtktreeview.c | 9 +++------ gtk/gtktreeviewcolumn.c | 11 +++-------- gtk/gtkuimanager.c | 39 +++++++++++++-------------------------- gtk/gtkviewport.c | 3 +-- gtk/gtkwidget.c | 6 ++---- gtk/gtkwindow.c | 3 +-- 35 files changed, 172 insertions(+), 163 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f6c6adea..f24b58575 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,45 @@ +Wed Nov 23 18:55:47 2005 Tim Janik + + * gtk/gtkobject.[hc]: deprecated floating/sink API and implemented it + in terms of the GObject floating/sink API. + + * gtk/gtkaboutdialog.c: + * gtk/gtkaction.c: + * gtk/gtkcellview.c: + * gtk/gtkclist.c: + * gtk/gtkcolorsel.c: + * gtk/gtkcombobox.c: + * gtk/gtkfilechooserdefault.c: + * gtk/gtkiconview.c: + * gtk/gtkinvisible.c: + * gtk/gtkitemfactory.c: + * gtk/gtklayout.c: + * gtk/gtkmenu.c: + * gtk/gtkmenutoolbutton.c: + * gtk/gtknotebook.c: + * gtk/gtkprogress.c: + * gtk/gtkrange.c: + * gtk/gtkspinbutton.c: + * gtk/gtkstatusicon.c: + * gtk/gtktext.c: + * gtk/gtktextview.c: + * gtk/gtktoolbar.c: + * gtk/gtktoolbutton.c: + * gtk/gtktoolitem.c: + * gtk/gtktreeitem.c: + * gtk/gtktreeview.c: + * gtk/gtktreeviewcolumn.c: + * gtk/gtkuimanager.c: + * gtk/gtkviewport.c: + * gtk/gtkwidget.c: + * gtk/gtkwindow.c: + ported to use GObject's g_object_ref_sink(). + + * gtk/gtkcolorsel.c: + * gtk/gtkfilechooserdefault.c: + * gtk/gtkaboutdialog.c: + fixed compiler warnings. + 2005-11-23 Matthias Clasen * gtk/gtksettings.c (gtk_settings_class_init): Add some docs diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4f6c6adea..f24b58575 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,45 @@ +Wed Nov 23 18:55:47 2005 Tim Janik + + * gtk/gtkobject.[hc]: deprecated floating/sink API and implemented it + in terms of the GObject floating/sink API. + + * gtk/gtkaboutdialog.c: + * gtk/gtkaction.c: + * gtk/gtkcellview.c: + * gtk/gtkclist.c: + * gtk/gtkcolorsel.c: + * gtk/gtkcombobox.c: + * gtk/gtkfilechooserdefault.c: + * gtk/gtkiconview.c: + * gtk/gtkinvisible.c: + * gtk/gtkitemfactory.c: + * gtk/gtklayout.c: + * gtk/gtkmenu.c: + * gtk/gtkmenutoolbutton.c: + * gtk/gtknotebook.c: + * gtk/gtkprogress.c: + * gtk/gtkrange.c: + * gtk/gtkspinbutton.c: + * gtk/gtkstatusicon.c: + * gtk/gtktext.c: + * gtk/gtktextview.c: + * gtk/gtktoolbar.c: + * gtk/gtktoolbutton.c: + * gtk/gtktoolitem.c: + * gtk/gtktreeitem.c: + * gtk/gtktreeview.c: + * gtk/gtktreeviewcolumn.c: + * gtk/gtkuimanager.c: + * gtk/gtkviewport.c: + * gtk/gtkwidget.c: + * gtk/gtkwindow.c: + ported to use GObject's g_object_ref_sink(). + + * gtk/gtkcolorsel.c: + * gtk/gtkfilechooserdefault.c: + * gtk/gtkaboutdialog.c: + fixed compiler warnings. + 2005-11-23 Matthias Clasen * gtk/gtksettings.c (gtk_settings_class_init): Add some docs diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 97e88e449..e9413cac4 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -2306,10 +2306,10 @@ gtk_object_set_data_by_id gtk_object_set_data_by_id_full gtk_object_set_data_full gtk_object_set_user_data +gtk_object_sink #endif gtk_object_destroy gtk_object_get_type G_GNUC_CONST -gtk_object_sink #endif #endif diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index 037809dfe..3b4e13ed3 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -1979,7 +1979,7 @@ add_credits_page (GtkAboutDialog *about, { GtkTextIter end; gchar *link; - gchar *link_type; + const gchar *link_type; GtkTextTag *tag; gtk_text_buffer_insert_at_cursor (buffer, q0, q1 - q0); @@ -2283,8 +2283,7 @@ gtk_show_about_dialog (GtkWindow *parent, { dialog = gtk_about_dialog_new (); - g_object_ref (dialog); - gtk_object_sink (GTK_OBJECT (dialog)); + g_object_ref_sink (dialog); g_signal_connect (dialog, "delete_event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); diff --git a/gtk/gtkaction.c b/gtk/gtkaction.c index 45611d34b..df9aee544 100644 --- a/gtk/gtkaction.c +++ b/gtk/gtkaction.c @@ -779,8 +779,7 @@ gtk_action_create_menu_proxy (GtkToolItem *tool_item, { menu_item = gtk_action_create_menu_item (action); - g_object_ref (menu_item); - gtk_object_sink (GTK_OBJECT (menu_item)); + g_object_ref_sink (menu_item); gtk_tool_item_set_proxy_menu_item (tool_item, "gtk-action-menu-item", menu_item); diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c index 0df21966e..36d985b05 100644 --- a/gtk/gtkcellview.c +++ b/gtk/gtkcellview.c @@ -590,8 +590,7 @@ gtk_cell_view_cell_layout_pack_start (GtkCellLayout *layout, g_return_if_fail (GTK_IS_CELL_RENDERER (renderer)); g_return_if_fail (!gtk_cell_view_get_cell_info (cellview, renderer)); - g_object_ref (renderer); - gtk_object_sink (GTK_OBJECT (renderer)); + g_object_ref_sink (renderer); info = g_new0 (GtkCellViewCellInfo, 1); info->cell = renderer; @@ -613,8 +612,7 @@ gtk_cell_view_cell_layout_pack_end (GtkCellLayout *layout, g_return_if_fail (GTK_IS_CELL_RENDERER (renderer)); g_return_if_fail (!gtk_cell_view_get_cell_info (cellview, renderer)); - g_object_ref (renderer); - gtk_object_sink (GTK_OBJECT (renderer)); + g_object_ref_sink (renderer); info = g_new0 (GtkCellViewCellInfo, 1); info->cell = renderer; diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 9a8220c91..8b636003d 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -1187,8 +1187,7 @@ gtk_clist_set_hadjustment (GtkCList *clist, if (clist->hadjustment) { - gtk_object_ref (GTK_OBJECT (clist->hadjustment)); - gtk_object_sink (GTK_OBJECT (clist->hadjustment)); + g_object_ref_sink (clist->hadjustment); gtk_signal_connect (GTK_OBJECT (clist->hadjustment), "changed", (GtkSignalFunc) hadjustment_changed, @@ -1235,8 +1234,7 @@ gtk_clist_set_vadjustment (GtkCList *clist, if (clist->vadjustment) { - gtk_object_ref (GTK_OBJECT (clist->vadjustment)); - gtk_object_sink (GTK_OBJECT (clist->vadjustment)); + g_object_ref_sink (clist->vadjustment); gtk_signal_connect (GTK_OBJECT (clist->vadjustment), "changed", (GtkSignalFunc) vadjustment_changed, diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 0ffb70d3b..a94401c6c 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -1289,7 +1289,7 @@ mouse_release (GtkWidget *invisible, GdkEventButton *event, gpointer data) { - GtkColorSelection *colorsel = data; + /* GtkColorSelection *colorsel = data; */ if (event->button != 1) return FALSE; @@ -1391,7 +1391,7 @@ mouse_press (GtkWidget *invisible, GdkEventButton *event, gpointer data) { - GtkColorSelection *colorsel = data; + /* GtkColorSelection *colorsel = data; */ if (event->type == GDK_BUTTON_PRESS && event->button == 1) @@ -1931,8 +1931,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel) priv->default_alpha_set = FALSE; priv->tooltips = gtk_tooltips_new (); - g_object_ref (priv->tooltips); - gtk_object_sink (GTK_OBJECT (priv->tooltips)); + g_object_ref_sink (priv->tooltips); gtk_box_set_spacing (GTK_BOX (colorsel), 4); top_hbox = gtk_hbox_new (FALSE, 8); diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 526b16c75..2a09ed166 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2535,8 +2535,7 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box, /* the column is needed in tree_column_row_is_sensitive() */ combo_box->priv->column = gtk_tree_view_column_new (); - g_object_ref (combo_box->priv->column); - gtk_object_sink (GTK_OBJECT (combo_box->priv->column)); + g_object_ref_sink (combo_box->priv->column); gtk_combo_box_sync_cells (combo_box, GTK_CELL_LAYOUT (combo_box->priv->column)); @@ -3837,8 +3836,7 @@ gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout, combo_box = GTK_COMBO_BOX (layout); - g_object_ref (cell); - gtk_object_sink (GTK_OBJECT (cell)); + g_object_ref_sink (cell); info = g_new0 (ComboCellInfo, 1); info->cell = cell; @@ -3894,8 +3892,7 @@ gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout, combo_box = GTK_COMBO_BOX (layout); - g_object_ref (cell); - gtk_object_sink (GTK_OBJECT (cell)); + g_object_ref_sink (cell); info = g_new0 (ComboCellInfo, 1); info->cell = cell; diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 0fcf7967d..2fd00ac89 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -676,8 +676,7 @@ gtk_file_chooser_default_init (GtkFileChooserDefault *impl) gtk_box_set_spacing (GTK_BOX (impl), 12); impl->tooltips = gtk_tooltips_new (); - g_object_ref (impl->tooltips); - gtk_object_sink (GTK_OBJECT (impl->tooltips)); + g_object_ref_sink (impl->tooltips); profile_end ("end", NULL); } @@ -5775,8 +5774,7 @@ gtk_file_chooser_default_add_filter (GtkFileChooser *chooser, return; } - g_object_ref (filter); - gtk_object_sink (GTK_OBJECT (filter)); + g_object_ref_sink (filter); impl->filters = g_slist_append (impl->filters, filter); name = gtk_file_filter_get_name (filter); @@ -6583,8 +6581,7 @@ set_current_filter (GtkFileChooserDefault *impl, impl->current_filter = filter; if (impl->current_filter) { - g_object_ref (impl->current_filter); - gtk_object_sink (GTK_OBJECT (filter)); + g_object_ref_sink (impl->current_filter); } if (impl->filters) @@ -6920,7 +6917,7 @@ path_bar_clicked (GtkPathBar *path_bar, */ if (child_path != NULL) { - gtk_file_chooser_default_select_path (impl, child_path, NULL); + gtk_file_chooser_default_select_path (GTK_FILE_CHOOSER (impl), child_path, NULL); browse_files_center_selected_row (impl); } } @@ -7075,7 +7072,7 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column, { GtkFileChooserDefault *impl; const GtkFileInfo *info; - GtkFileTime time_mtime, time_now; + GtkFileTime time_mtime; GDate mtime, now; int days_diff; char buf[256]; @@ -7099,10 +7096,10 @@ list_mtime_data_func (GtkTreeViewColumn *tree_column, strcpy (buf, _("Unknown")); else { - g_date_set_time (&mtime, (GTime) time_mtime); - - time_now = (GTime ) time (NULL); - g_date_set_time (&now, (GTime) time_now); + time_t time_now; + g_date_set_time_t (&mtime, time_mtime); + time_now = time (NULL); + g_date_set_time_t (&now, time_now); days_diff = g_date_get_julian (&now) - g_date_get_julian (&mtime); diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 97bccbdea..6657c7185 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -2220,8 +2220,7 @@ gtk_icon_view_set_adjustments (GtkIconView *icon_view, if (icon_view->priv->hadjustment != hadj) { icon_view->priv->hadjustment = hadj; - g_object_ref (icon_view->priv->hadjustment); - gtk_object_sink (GTK_OBJECT (icon_view->priv->hadjustment)); + g_object_ref_sink (icon_view->priv->hadjustment); g_signal_connect (icon_view->priv->hadjustment, "value_changed", G_CALLBACK (gtk_icon_view_adjustment_changed), @@ -2232,8 +2231,7 @@ gtk_icon_view_set_adjustments (GtkIconView *icon_view, if (icon_view->priv->vadjustment != vadj) { icon_view->priv->vadjustment = vadj; - g_object_ref (icon_view->priv->vadjustment); - gtk_object_sink (GTK_OBJECT (icon_view->priv->vadjustment)); + g_object_ref_sink (icon_view->priv->vadjustment); g_signal_connect (icon_view->priv->vadjustment, "value_changed", G_CALLBACK (gtk_icon_view_adjustment_changed), @@ -4166,8 +4164,7 @@ gtk_icon_view_cell_layout_pack_start (GtkCellLayout *layout, g_return_if_fail (GTK_IS_CELL_RENDERER (renderer)); g_return_if_fail (!gtk_icon_view_get_cell_info (icon_view, renderer)); - g_object_ref (renderer); - gtk_object_sink (GTK_OBJECT (renderer)); + g_object_ref_sink (renderer); info = g_new0 (GtkIconViewCellInfo, 1); info->cell = renderer; @@ -4190,8 +4187,7 @@ gtk_icon_view_cell_layout_pack_end (GtkCellLayout *layout, g_return_if_fail (GTK_IS_CELL_RENDERER (renderer)); g_return_if_fail (!gtk_icon_view_get_cell_info (icon_view, renderer)); - g_object_ref (renderer); - gtk_object_sink (GTK_OBJECT (renderer)); + g_object_ref_sink (renderer); info = g_new0 (GtkIconViewCellInfo, 1); info->cell = renderer; diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c index 954e9b1f4..afdb51ead 100644 --- a/gtk/gtkinvisible.c +++ b/gtk/gtkinvisible.c @@ -128,8 +128,7 @@ gtk_invisible_init (GtkInvisible *invisible) GTK_WIDGET_UNSET_FLAGS (invisible, GTK_NO_WINDOW); GTK_WIDGET_SET_FLAGS (invisible, GTK_TOPLEVEL); - g_object_ref (invisible); - gtk_object_sink (GTK_OBJECT (invisible)); + g_object_ref_sink (invisible); invisible->has_user_ref_count = TRUE; invisible->screen = gdk_screen_get_default (); diff --git a/gtk/gtkitemfactory.c b/gtk/gtkitemfactory.c index 548000379..2bfc856f9 100644 --- a/gtk/gtkitemfactory.c +++ b/gtk/gtkitemfactory.c @@ -453,8 +453,7 @@ gtk_item_factory_construct (GtkItemFactory *ifactory, ifactory->widget = g_object_connect (gtk_widget_new (container_type, NULL), "signal::destroy", gtk_widget_destroyed, &ifactory->widget, NULL); - g_object_ref (ifactory); - gtk_object_sink (GTK_OBJECT (ifactory)); + g_object_ref_sink (ifactory); gtk_item_factory_add_item (ifactory, "", NULL, @@ -525,8 +524,7 @@ gtk_item_factory_destroy (GtkObject *object) dobj = GTK_OBJECT (ifactory->widget); - g_object_ref (dobj); - gtk_object_sink (dobj); + g_object_ref_sink (dobj); gtk_object_destroy (dobj); g_object_unref (dobj); diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index 07d272f6a..9adb36364 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -228,8 +228,7 @@ gtk_layout_set_adjustments (GtkLayout *layout, if (layout->hadjustment != hadj) { layout->hadjustment = hadj; - g_object_ref (layout->hadjustment); - gtk_object_sink (GTK_OBJECT (layout->hadjustment)); + g_object_ref_sink (layout->hadjustment); gtk_layout_set_adjustment_upper (layout->hadjustment, layout->width, FALSE); g_signal_connect (layout->hadjustment, "value_changed", @@ -241,8 +240,7 @@ gtk_layout_set_adjustments (GtkLayout *layout, if (layout->vadjustment != vadj) { layout->vadjustment = vadj; - g_object_ref (layout->vadjustment); - gtk_object_sink (GTK_OBJECT (layout->vadjustment)); + g_object_ref_sink (layout->vadjustment); gtk_layout_set_adjustment_upper (layout->vadjustment, layout->height, FALSE); g_signal_connect (layout->vadjustment, "value_changed", diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index ae5d48ec2..8e656c219 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -877,7 +877,7 @@ gtk_menu_init (GtkMenu *menu) /* Refloat the menu, so that reference counting for the menu isn't * affected by it being a child of the toplevel */ - GTK_WIDGET_SET_FLAGS (menu, GTK_FLOATING); + g_object_force_floating (G_OBJECT (menu)); menu->needs_destruction_ref_count = TRUE; menu->view_window = NULL; @@ -1031,8 +1031,7 @@ gtk_menu_attach_to_widget (GtkMenu *menu, return; } - g_object_ref (menu); - gtk_object_sink (GTK_OBJECT (menu)); + g_object_ref_sink (menu); data = g_new (GtkMenuAttachData, 1); data->attach_widget = attach_widget; @@ -3904,10 +3903,9 @@ gtk_menu_reparent (GtkMenu *menu, { GtkObject *object = GTK_OBJECT (menu); GtkWidget *widget = GTK_WIDGET (menu); - gboolean was_floating = GTK_OBJECT_FLOATING (object); + gboolean was_floating = g_object_is_floating (object); - g_object_ref (object); - gtk_object_sink (object); + g_object_ref_sink (object); if (unrealize) { @@ -3920,7 +3918,7 @@ gtk_menu_reparent (GtkMenu *menu, gtk_widget_reparent (GTK_WIDGET (menu), new_parent); if (was_floating) - GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING); + g_object_force_floating (G_OBJECT (object)); else g_object_unref (object); } diff --git a/gtk/gtkmenutoolbutton.c b/gtk/gtkmenutoolbutton.c index b8210613b..cefa6d323 100644 --- a/gtk/gtkmenutoolbutton.c +++ b/gtk/gtkmenutoolbutton.c @@ -573,8 +573,7 @@ gtk_menu_tool_button_set_menu (GtkMenuToolButton *button, if (priv->menu) { - g_object_ref (priv->menu); - gtk_object_sink (GTK_OBJECT (priv->menu)); + g_object_ref_sink (priv->menu); gtk_widget_set_sensitive (priv->arrow_button, TRUE); diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index af31a0fb9..541d49409 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -4355,8 +4355,7 @@ gtk_notebook_insert_page_menu (GtkNotebook *notebook, page->default_menu = TRUE; else { - g_object_ref (page->menu_label); - gtk_object_sink (GTK_OBJECT (page->menu_label)); + g_object_ref_sink (page->menu_label); } if (notebook->menu) @@ -5207,8 +5206,7 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook, if (menu_label) { page->menu_label = menu_label; - g_object_ref (page->menu_label); - gtk_object_sink (GTK_OBJECT(page->menu_label)); + g_object_ref_sink (page->menu_label); page->default_menu = FALSE; } else diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index e5df6f804..953670d40 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -348,7 +348,6 @@ static void gtk_object_init (GtkObject *object, GtkObjectClass *klass) { - GTK_OBJECT_FLAGS (object) = GTK_FLOATING; } /******************************************** @@ -396,13 +395,12 @@ gtk_object_finalize (GObject *gobject) { GtkObject *object = GTK_OBJECT (gobject); - if (GTK_OBJECT_FLOATING (object)) + 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 gtk_object_sink() after a normal\n" - "reference is obtained with g_object_ref()."); + "and must be removed with g_object_ref_sink()."); } gtk_object_notify_weaks (object); @@ -449,24 +447,12 @@ gtk_object_get_property (GObject *object, } } -/***************************************** - * gtk_object_sink: - * - * arguments: - * - * results: - *****************************************/ - void gtk_object_sink (GtkObject *object) { g_return_if_fail (GTK_IS_OBJECT (object)); - - if (GTK_OBJECT_FLOATING (object)) - { - GTK_OBJECT_UNSET_FLAGS (object, GTK_FLOATING); - g_object_unref (object); - } + g_object_ref_sink (object); + g_object_unref (object); } /***************************************** diff --git a/gtk/gtkobject.h b/gtk/gtkobject.h index 0bf6f9c06..2461d54f4 100644 --- a/gtk/gtkobject.h +++ b/gtk/gtkobject.h @@ -58,7 +58,9 @@ G_BEGIN_DECLS typedef enum { GTK_IN_DESTRUCTION = 1 << 0, /* Used internally during dispose */ +#ifndef GTK_DISABLE_DEPRECATED GTK_FLOATING = 1 << 1, +#endif GTK_RESERVED_1 = 1 << 2, GTK_RESERVED_2 = 1 << 3 } GtkObjectFlags; @@ -66,7 +68,9 @@ typedef enum /* Macros for extracting the object_flags from GtkObject. */ #define GTK_OBJECT_FLAGS(obj) (GTK_OBJECT (obj)->flags) +#ifndef GTK_DISABLE_DEPRECATED #define GTK_OBJECT_FLOATING(obj) ((GTK_OBJECT_FLAGS (obj) & GTK_FLOATING) != 0) +#endif /* Macros for setting and clearing bits in the object_flags field of GtkObject. */ @@ -117,7 +121,9 @@ struct _GtkObjectClass GtkType gtk_object_get_type (void) G_GNUC_CONST; +#ifndef GTK_DISABLE_DEPRECATED void gtk_object_sink (GtkObject *object); +#endif void gtk_object_destroy (GtkObject *object); /****************************************************************/ diff --git a/gtk/gtkprogress.c b/gtk/gtkprogress.c index b0ba79b8e..94babf875 100644 --- a/gtk/gtkprogress.c +++ b/gtk/gtkprogress.c @@ -535,8 +535,7 @@ gtk_progress_set_adjustment (GtkProgress *progress, progress->adjustment = adjustment; if (adjustment) { - g_object_ref (adjustment); - gtk_object_sink (GTK_OBJECT (adjustment)); + g_object_ref_sink (adjustment); g_signal_connect (adjustment, "changed", G_CALLBACK (gtk_progress_changed), progress); diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index f8e409899..eb39e10d1 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -619,8 +619,7 @@ gtk_range_set_adjustment (GtkRange *range, } range->adjustment = adjustment; - g_object_ref (adjustment); - gtk_object_sink (GTK_OBJECT (adjustment)); + g_object_ref_sink (adjustment); g_signal_connect (adjustment, "changed", G_CALLBACK (gtk_range_adjustment_changed), diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 18b1d29e2..45b4ca874 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -1686,8 +1686,7 @@ gtk_spin_button_set_adjustment (GtkSpinButton *spin_button, spin_button->adjustment = adjustment; if (adjustment) { - g_object_ref (adjustment); - gtk_object_sink (GTK_OBJECT (adjustment)); + g_object_ref_sink (adjustment); g_signal_connect (adjustment, "value_changed", G_CALLBACK (gtk_spin_button_value_changed), spin_button); diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index 18a504e13..1ddb45adc 100755 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -407,8 +407,7 @@ gtk_status_icon_init (GtkStatusIcon *status_icon) gtk_widget_show (status_icon->priv->tray_icon); status_icon->priv->tooltips = gtk_tooltips_new (); - g_object_ref (status_icon->priv->tooltips); - gtk_object_sink (GTK_OBJECT (status_icon->priv->tooltips)); + g_object_ref_sink (status_icon->priv->tooltips); #endif #ifdef GDK_WINDOWING_WIN32 diff --git a/gtk/gtktext.c b/gtk/gtktext.c index ba0f37d26..643c03419 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -877,8 +877,7 @@ gtk_text_set_adjustments (GtkText *text, if (text->hadj != hadj) { text->hadj = hadj; - gtk_object_ref (GTK_OBJECT (text->hadj)); - gtk_object_sink (GTK_OBJECT (text->hadj)); + g_object_ref_sink (text->hadj); gtk_signal_connect (GTK_OBJECT (text->hadj), "changed", (GtkSignalFunc) gtk_text_adjustment, @@ -897,8 +896,7 @@ gtk_text_set_adjustments (GtkText *text, if (text->vadj != vadj) { text->vadj = vadj; - gtk_object_ref (GTK_OBJECT (text->vadj)); - gtk_object_sink (GTK_OBJECT (text->vadj)); + g_object_ref_sink (text->vadj); gtk_signal_connect (GTK_OBJECT (text->vadj), "changed", (GtkSignalFunc) gtk_text_adjustment, diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 9fd7e74bf..4544066bf 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -6437,8 +6437,7 @@ gtk_text_view_set_scroll_adjustments (GtkTextView *text_view, if (text_view->hadjustment != hadj) { text_view->hadjustment = hadj; - g_object_ref (text_view->hadjustment); - gtk_object_sink (GTK_OBJECT (text_view->hadjustment)); + g_object_ref_sink (text_view->hadjustment); g_signal_connect (text_view->hadjustment, "value_changed", G_CALLBACK (gtk_text_view_value_changed), @@ -6449,8 +6448,7 @@ gtk_text_view_set_scroll_adjustments (GtkTextView *text_view, if (text_view->vadjustment != vadj) { text_view->vadjustment = vadj; - g_object_ref (text_view->vadjustment); - gtk_object_sink (GTK_OBJECT (text_view->vadjustment)); + g_object_ref_sink (text_view->vadjustment); g_signal_connect (text_view->vadjustment, "value_changed", G_CALLBACK (gtk_text_view_value_changed), diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 10f054256..8edd4ed54 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -696,8 +696,7 @@ gtk_toolbar_init (GtkToolbar *toolbar) toolbar->style = DEFAULT_TOOLBAR_STYLE; toolbar->icon_size = DEFAULT_ICON_SIZE; toolbar->tooltips = gtk_tooltips_new (); - g_object_ref (toolbar->tooltips); - gtk_object_sink (GTK_OBJECT (toolbar->tooltips)); + g_object_ref_sink (toolbar->tooltips); priv->arrow_button = gtk_toggle_button_new (); g_signal_connect (priv->arrow_button, "button_press_event", @@ -2286,8 +2285,7 @@ gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar, if (priv->highlight_tool_item) g_object_unref (priv->highlight_tool_item); - g_object_ref (tool_item); - gtk_object_sink (GTK_OBJECT (tool_item)); + g_object_ref_sink (tool_item); priv->highlight_tool_item = tool_item; diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c index 959104087..7d529c686 100644 --- a/gtk/gtktoolbutton.c +++ b/gtk/gtktoolbutton.c @@ -925,8 +925,7 @@ gtk_tool_button_set_icon_widget (GtkToolButton *button, if (icon_widget) { - g_object_ref (icon_widget); - gtk_object_sink (GTK_OBJECT (icon_widget)); + g_object_ref_sink (icon_widget); } button->priv->icon_widget = icon_widget; @@ -972,8 +971,7 @@ gtk_tool_button_set_label_widget (GtkToolButton *button, if (label_widget) { - g_object_ref (label_widget); - gtk_object_sink (GTK_OBJECT (label_widget)); + g_object_ref_sink (label_widget); } button->priv->label_widget = label_widget; diff --git a/gtk/gtktoolitem.c b/gtk/gtktoolitem.c index 88feeab1e..a20c0a345 100644 --- a/gtk/gtktoolitem.c +++ b/gtk/gtktoolitem.c @@ -1109,8 +1109,7 @@ gtk_tool_item_set_proxy_menu_item (GtkToolItem *tool_item, if (menu_item) { - g_object_ref (menu_item); - gtk_object_sink (GTK_OBJECT (menu_item)); + g_object_ref_sink (menu_item); gtk_widget_set_sensitive (menu_item, GTK_WIDGET_SENSITIVE (tool_item)); diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 46fa3a4aa..90e6f79cb 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -248,8 +248,7 @@ gtk_tree_item_init (GtkTreeItem *tree_item) gtk_container_add (GTK_CONTAINER (eventbox), pixmapwid); gtk_widget_show (pixmapwid); tree_item->plus_pix_widget = pixmapwid; - gtk_widget_ref (tree_item->plus_pix_widget); - gtk_object_sink (GTK_OBJECT (tree_item->plus_pix_widget)); + g_object_ref_sink (tree_item->plus_pix_widget); /* create pixmap for button '-' */ pixmapwid = gtk_type_new (gtk_pixmap_get_type ()); @@ -257,8 +256,7 @@ gtk_tree_item_init (GtkTreeItem *tree_item) gtk_container_add (GTK_CONTAINER (eventbox), pixmapwid); gtk_widget_show (pixmapwid); tree_item->minus_pix_widget = pixmapwid; - gtk_widget_ref (tree_item->minus_pix_widget); - gtk_object_sink (GTK_OBJECT (tree_item->minus_pix_widget)); + g_object_ref_sink (tree_item->minus_pix_widget); gtk_widget_set_parent (eventbox, GTK_WIDGET (tree_item)); } diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 8d7ae1144..baa238623 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -6988,8 +6988,7 @@ gtk_tree_view_set_adjustments (GtkTreeView *tree_view, if (tree_view->priv->hadjustment != hadj) { tree_view->priv->hadjustment = hadj; - g_object_ref (tree_view->priv->hadjustment); - gtk_object_sink (GTK_OBJECT (tree_view->priv->hadjustment)); + g_object_ref_sink (tree_view->priv->hadjustment); g_signal_connect (tree_view->priv->hadjustment, "value_changed", G_CALLBACK (gtk_tree_view_adjustment_changed), @@ -7000,8 +6999,7 @@ gtk_tree_view_set_adjustments (GtkTreeView *tree_view, if (tree_view->priv->vadjustment != vadj) { tree_view->priv->vadjustment = vadj; - g_object_ref (tree_view->priv->vadjustment); - gtk_object_sink (GTK_OBJECT (tree_view->priv->vadjustment)); + g_object_ref_sink (tree_view->priv->vadjustment); g_signal_connect (tree_view->priv->vadjustment, "value_changed", G_CALLBACK (gtk_tree_view_adjustment_changed), @@ -9987,8 +9985,7 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view, g_return_val_if_fail (gtk_tree_view_column_get_sizing (column) == GTK_TREE_VIEW_COLUMN_FIXED, -1); - g_object_ref (column); - gtk_object_sink (GTK_OBJECT (column)); + g_object_ref_sink (column); if (tree_view->priv->n_columns == 0 && GTK_WIDGET_REALIZED (tree_view) && diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index 31d57b278..32493d7f7 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -642,8 +642,7 @@ gtk_tree_view_column_cell_layout_pack_start (GtkCellLayout *cell_layout, column = GTK_TREE_VIEW_COLUMN (cell_layout); g_return_if_fail (! gtk_tree_view_column_get_cell_info (column, cell)); - g_object_ref (cell); - gtk_object_sink (GTK_OBJECT (cell)); + g_object_ref_sink (cell); cell_info = g_new0 (GtkTreeViewColumnCellInfo, 1); cell_info->cell = cell; @@ -667,8 +666,7 @@ gtk_tree_view_column_cell_layout_pack_end (GtkCellLayout *cell_layout, column = GTK_TREE_VIEW_COLUMN (cell_layout); g_return_if_fail (! gtk_tree_view_column_get_cell_info (column, cell)); - g_object_ref (cell); - gtk_object_sink (GTK_OBJECT (cell)); + g_object_ref_sink (cell); cell_info = g_new0 (GtkTreeViewColumnCellInfo, 1); cell_info->cell = cell; @@ -2218,10 +2216,7 @@ gtk_tree_view_column_set_widget (GtkTreeViewColumn *tree_column, g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget)); if (widget) - { - g_object_ref (widget); - gtk_object_sink (GTK_OBJECT (widget)); - } + g_object_ref_sink (widget); if (tree_column->child) g_object_unref (tree_column->child); diff --git a/gtk/gtkuimanager.c b/gtk/gtkuimanager.c index b39997745..c624ba898 100644 --- a/gtk/gtkuimanager.c +++ b/gtk/gtkuimanager.c @@ -2209,8 +2209,7 @@ update_node (GtkUIManager *self, if (info->proxy == NULL) { info->proxy = gtk_menu_bar_new (); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); gtk_widget_set_name (info->proxy, info->name); gtk_widget_show (info->proxy); g_signal_emit (self, ui_manager_signals[ADD_WIDGET], 0, info->proxy); @@ -2220,8 +2219,7 @@ update_node (GtkUIManager *self, if (info->proxy == NULL) { info->proxy = gtk_menu_new (); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); } gtk_widget_set_name (info->proxy, info->name); break; @@ -2278,16 +2276,14 @@ update_node (GtkUIManager *self, if (NODE_INFO (node->parent)->type == NODE_TYPE_TOOLITEM) { info->proxy = menu; - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (NODE_INFO (node->parent)->proxy), menu); } else { info->proxy = gtk_action_create_menu_item (action); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); g_signal_connect (info->proxy, "notify::visible", G_CALLBACK (update_smart_separators), NULL); gtk_widget_set_name (info->proxy, info->name); @@ -2331,8 +2327,7 @@ update_node (GtkUIManager *self, if (info->proxy == NULL) { info->proxy = gtk_toolbar_new (); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); gtk_widget_set_name (info->proxy, info->name); gtk_widget_show (info->proxy); g_signal_emit (self, ui_manager_signals[ADD_WIDGET], 0, info->proxy); @@ -2366,8 +2361,7 @@ update_node (GtkUIManager *self, if (find_menu_position (node, &menushell, &pos)) { info->proxy = gtk_separator_menu_item_new (); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); g_object_set_data (G_OBJECT (info->proxy), I_("gtk-separator-mode"), GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN)); @@ -2376,8 +2370,7 @@ update_node (GtkUIManager *self, NODE_INFO (node)->proxy, pos); info->extra = gtk_separator_menu_item_new (); - g_object_ref (info->extra); - gtk_object_sink (GTK_OBJECT (info->extra)); + g_object_ref_sink (info->extra); g_object_set_data (G_OBJECT (info->extra), I_("gtk-separator-mode"), GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN)); @@ -2419,8 +2412,7 @@ update_node (GtkUIManager *self, item = gtk_separator_tool_item_new (); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos); info->proxy = GTK_WIDGET (item); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); g_object_set_data (G_OBJECT (info->proxy), I_("gtk-separator-mode"), GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN)); @@ -2429,8 +2421,7 @@ update_node (GtkUIManager *self, item = gtk_separator_tool_item_new (); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos+1); info->extra = GTK_WIDGET (item); - g_object_ref (info->extra); - gtk_object_sink (GTK_OBJECT (info->extra)); + g_object_ref_sink (info->extra); g_object_set_data (G_OBJECT (info->extra), I_("gtk-separator-mode"), GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN)); @@ -2461,8 +2452,7 @@ update_node (GtkUIManager *self, if (find_menu_position (node, &menushell, &pos)) { info->proxy = gtk_action_create_menu_item (action); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); gtk_widget_set_name (info->proxy, info->name); gtk_menu_shell_insert (GTK_MENU_SHELL (menushell), @@ -2512,8 +2502,7 @@ update_node (GtkUIManager *self, if (find_toolbar_position (node, &toolbar, &pos)) { info->proxy = gtk_action_create_tool_item (action); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); gtk_widget_set_name (info->proxy, info->name); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), @@ -2558,8 +2547,7 @@ update_node (GtkUIManager *self, GtkToolItem *item = gtk_separator_tool_item_new (); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos); info->proxy = GTK_WIDGET (item); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); gtk_widget_set_no_show_all (info->proxy, TRUE); if (info->expand) { @@ -2593,8 +2581,7 @@ update_node (GtkUIManager *self, if (find_menu_position (node, &menushell, &pos)) { info->proxy = gtk_separator_menu_item_new (); - g_object_ref (info->proxy); - gtk_object_sink (GTK_OBJECT (info->proxy)); + g_object_ref_sink (info->proxy); gtk_widget_set_no_show_all (info->proxy, TRUE); g_object_set_data (G_OBJECT (info->proxy), I_("gtk-separator-mode"), diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 9fc40e416..e89b2119e 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -467,8 +467,7 @@ viewport_set_adjustment (GtkViewport *viewport, if (*adjustmentp) g_object_unref (*adjustmentp); *adjustmentp = adjustment; - g_object_ref (adjustment); - gtk_object_sink (GTK_OBJECT (adjustment)); + g_object_ref_sink (adjustment); if (orientation == GTK_ORIENTATION_HORIZONTAL) viewport_set_hadjustment_values (viewport, &value_changed); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 09b4c91a2..2ee47887f 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -4489,8 +4489,7 @@ gtk_widget_set_parent (GtkWidget *widget, /* keep this function in sync with gtk_menu_attach_to_widget() */ - g_object_ref (widget); - gtk_object_sink (GTK_OBJECT (widget)); + g_object_ref_sink (widget); widget->parent = parent; if (GTK_WIDGET_STATE (parent) != GTK_STATE_NORMAL) @@ -7131,8 +7130,7 @@ gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass, return; } - g_param_spec_ref (pspec); - g_param_spec_sink (pspec); + g_param_spec_ref_sink (pspec); g_param_spec_set_qdata (pspec, quark_property_parser, (gpointer) parser); g_param_spec_pool_insert (style_property_spec_pool, pspec, G_OBJECT_CLASS_TYPE (klass)); } diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 0edd23ff6..8410a0168 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -810,8 +810,7 @@ gtk_window_init (GtkWindow *window) if (colormap) gtk_widget_set_colormap (GTK_WIDGET (window), colormap); - g_object_ref (window); - gtk_object_sink (GTK_OBJECT (window)); + g_object_ref_sink (window); window->has_user_ref_count = TRUE; toplevel_list = g_slist_prepend (toplevel_list, window); -- cgit v1.2.1