[gtk+/wip/baedert/gtk-widget-destroy: 1/5] gtk: Stop using gtk_widget_destroy
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/gtk-widget-destroy: 1/5] gtk: Stop using gtk_widget_destroy
- Date: Tue, 26 Sep 2017 15:12:05 +0000 (UTC)
commit 348faf291b1a73c6ea7ca19236f553712ac87597
Author: Timm Bäder <mail baedert org>
Date: Tue Sep 26 11:10:16 2017 +0200
gtk: Stop using gtk_widget_destroy
gtk/gtkaboutdialog.c | 2 +-
gtk/gtkappchooserbutton.c | 4 ++--
gtk/gtkappchooserdialog.c | 2 +-
gtk/gtkappchooserwidget.c | 2 +-
gtk/gtkapplicationwindow.c | 4 ++--
gtk/gtkclipboard.c | 2 +-
gtk/gtkcolorbutton.c | 2 +-
gtk/gtkcolorchooserwidget.c | 2 +-
gtk/gtkcolorswatch.c | 2 +-
gtk/gtkcontainer.c | 7 ++-----
gtk/gtkdialog.c | 4 ++--
gtk/gtkemojichooser.c | 4 ++--
gtk/gtkentry.c | 10 +++++-----
gtk/gtkentrycompletion.c | 4 ++--
gtk/gtkfilechooser.c | 2 +-
gtk/gtkfilechooserbutton.c | 2 +-
gtk/gtkfilechooserdialog.c | 4 ++--
gtk/gtkfilechoosernative.c | 2 +-
gtk/gtkfilechoosernativeportal.c | 2 +-
gtk/gtkfilechooserwidget.c | 12 ++++++------
gtk/gtkflowbox.c | 5 +++--
gtk/gtkfontbutton.c | 2 +-
gtk/gtkheaderbar.c | 7 ++-----
gtk/gtklabel.c | 4 ++--
gtk/gtklinkbutton.c | 2 +-
gtk/gtkmain.c | 7 ++++---
gtk/gtkmenu.c | 17 ++++++++---------
gtk/gtkmenubutton.c | 6 ++++--
gtk/gtkmenuitem.c | 4 ++--
gtk/gtkmenusectionbox.c | 2 +-
gtk/gtkmenushell.c | 3 ++-
gtk/gtkmenutoolbutton.c | 2 +-
gtk/gtkmessagedialog.c | 4 ++--
gtk/gtkmodelmenuitem.c | 2 +-
gtk/gtkmountoperation.c | 10 +++++-----
gtk/gtknotebook.c | 8 +++++---
gtk/gtkpagesetupunixdialog.c | 2 +-
gtk/gtkpathbar.c | 2 +-
gtk/gtkplacessidebar.c | 18 +++++++++++-------
gtk/gtkplacesview.c | 15 ++++++++-------
gtk/gtkpopover.c | 2 +-
gtk/gtkprintbackend.c | 2 +-
gtk/gtkprinteroptionwidget.c | 19 ++++++++-----------
gtk/gtkprintoperation-unix.c | 4 ++--
gtk/gtkprintoperation-win32.c | 4 ++--
gtk/gtkprintoperation.c | 6 +++---
gtk/gtkprintunixdialog.c | 14 +++++++-------
gtk/gtkrecentchooserdefault.c | 2 +-
gtk/gtkrecentchooserdialog.c | 2 +-
gtk/gtkscalebutton.c | 7 ++-----
gtk/gtkscrolledwindow.c | 2 +-
gtk/gtkshortcutlabel.c | 4 +++-
gtk/gtkshortcutsgroup.c | 2 +-
gtk/gtkshortcutssection.c | 7 +++----
gtk/gtksidebarrow.c | 4 ++--
gtk/gtkstackswitcher.c | 2 +-
gtk/gtktextchild.c | 2 +-
gtk/gtktextview.c | 13 +++++++------
gtk/gtktoolbar.c | 2 +-
gtk/gtktoolbutton.c | 2 +-
gtk/gtktooltip.c | 3 ++-
gtk/gtktreemenu.c | 12 ++++++------
gtk/gtktreeview.c | 2 +-
gtk/gtkwidget.c | 2 +-
gtk/gtkwindow.c | 20 ++++++++++----------
gtk/gtkwindow.h | 6 +++---
gtk/inspector/actions.c | 2 +-
gtk/inspector/css-editor.c | 4 ++--
gtk/inspector/css-node-tree.c | 2 +-
gtk/inspector/general.c | 9 ++++-----
gtk/inspector/misc-info.c | 3 ++-
gtk/inspector/prop-list.c | 2 +-
gtk/inspector/recorder.c | 4 ++--
gtk/inspector/strv-editor.c | 9 +++------
74 files changed, 189 insertions(+), 190 deletions(-)
---
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
index 23482c6..3ca4363 100644
--- a/gtk/gtkaboutdialog.c
+++ b/gtk/gtkaboutdialog.c
@@ -1060,7 +1060,7 @@ gtk_about_dialog_activate_link (GtkAboutDialog *about,
g_error_free (error);
g_signal_connect (dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
+ G_CALLBACK (gtk_window_destroy), NULL);
gtk_window_present (GTK_WINDOW (dialog));
}
diff --git a/gtk/gtkappchooserbutton.c b/gtk/gtkappchooserbutton.c
index 90838d1..955b4dc 100644
--- a/gtk/gtkappchooserbutton.c
+++ b/gtk/gtkappchooserbutton.c
@@ -232,13 +232,13 @@ other_application_dialog_response_cb (GtkDialog *dialog,
* 'Other application…'
*/
gtk_combo_box_set_active (GTK_COMBO_BOX (self), self->priv->last_active);
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
return;
}
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
/* refresh the combobox to get the new application */
gtk_app_chooser_refresh (GTK_APP_CHOOSER (self));
diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c
index ee33f0f..7927e85 100644
--- a/gtk/gtkappchooserdialog.c
+++ b/gtk/gtkappchooserdialog.c
@@ -432,7 +432,7 @@ show_error_dialog (const gchar *primary,
gtk_widget_show (message_dialog);
g_signal_connect (message_dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
+ G_CALLBACK (gtk_window_destroy), NULL);
}
static void
diff --git a/gtk/gtkappchooserwidget.c b/gtk/gtkappchooserwidget.c
index 54b22a2..eee6302 100644
--- a/gtk/gtkappchooserwidget.c
+++ b/gtk/gtkappchooserwidget.c
@@ -251,7 +251,7 @@ widget_button_press_event_cb (GtkWidget *widget,
return FALSE;
if (self->priv->popup_menu)
- gtk_widget_destroy (self->priv->popup_menu);
+ gtk_window_destroy (GTK_WINDOW (self->priv->popup_menu));
self->priv->popup_menu = menu = gtk_menu_new ();
gtk_menu_attach_to_widget (GTK_MENU (menu), GTK_WIDGET (self), popup_menu_detach);
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index df4b27b..9f36cc4 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -758,7 +758,7 @@ gtk_application_window_dispose (GObject *object)
if (window->priv->help_overlay)
{
- gtk_widget_destroy (GTK_WIDGET (window->priv->help_overlay));
+ gtk_window_destroy (GTK_WINDOW (window->priv->help_overlay));
g_clear_object (&window->priv->help_overlay);
}
@@ -961,7 +961,7 @@ gtk_application_window_set_help_overlay (GtkApplicationWindow *window,
g_return_if_fail (help_overlay == NULL || GTK_IS_SHORTCUTS_WINDOW (help_overlay));
if (window->priv->help_overlay)
- gtk_widget_destroy (GTK_WIDGET (window->priv->help_overlay));
+ gtk_window_destroy (GTK_WINDOW (window->priv->help_overlay));
g_set_object (&window->priv->help_overlay, help_overlay);
if (!window->priv->help_overlay)
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index 329299e..521c1fe 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -964,7 +964,7 @@ selection_received (GtkWidget *widget,
g_free (request_info);
if (widget != get_clipboard_widget (gtk_widget_get_display (widget)))
- gtk_widget_destroy (widget);
+ g_object_unref (G_OBJECT (widget));
}
/**
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index e583cda..0dd7057 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -443,7 +443,7 @@ gtk_color_button_finalize (GObject *object)
GtkColorButtonPrivate *priv = button->priv;
if (priv->cs_dialog != NULL)
- gtk_widget_destroy (priv->cs_dialog);
+ gtk_window_destroy (GTK_WINDOW (priv->cs_dialog));
g_free (priv->title);
gtk_widget_unparent (priv->button);
diff --git a/gtk/gtkcolorchooserwidget.c b/gtk/gtkcolorchooserwidget.c
index 57b93c7..5a40c2b 100644
--- a/gtk/gtkcolorchooserwidget.c
+++ b/gtk/gtkcolorchooserwidget.c
@@ -739,7 +739,7 @@ add_custom_color (GtkColorChooserWidget *cc,
if (last == GTK_WIDGET (cc->priv->current))
cc->priv->current = NULL;
- gtk_widget_destroy (last);
+ gtk_container_remove (GTK_CONTAINER (cc->priv->custom), last);
}
g_list_free (children);
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 4b2bf62..97787bc 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -509,7 +509,7 @@ swatch_dispose (GObject *object)
if (swatch->priv->popover)
{
- gtk_widget_destroy (swatch->priv->popover);
+ g_object_unref (G_OBJECT (swatch->priv->popover));
swatch->priv->popover = NULL;
}
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 7aea3ab..9193cc0 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1592,7 +1592,7 @@ gtk_container_destroy (GtkWidget *widget)
if (priv->has_focus_chain)
gtk_container_unset_focus_chain (container);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
+ gtk_container_foreach (container, (GtkCallback) gtk_container_remove_callback, container);
GTK_WIDGET_CLASS (parent_class)->destroy (widget);
}
@@ -1652,10 +1652,7 @@ gtk_container_add (GtkContainer *container,
* may be the last reference held; so removing a widget from its
* container can destroy that widget. If you want to use @widget
* again, you need to add a reference to it before removing it from
- * a container, using g_object_ref(). If you don’t want to use @widget
- * again it’s usually more efficient to simply destroy it directly
- * using gtk_widget_destroy() since this will remove it from the
- * container and help break any circular reference count cycles.
+ * a container, using g_object_ref().
**/
void
gtk_container_remove (GtkContainer *container,
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index 78e4fe8..64dbaa3 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -120,7 +120,7 @@
*
* g_signal_connect_swapped (dialog,
* "response",
- * G_CALLBACK (gtk_widget_destroy),
+ * G_CALLBACK (gtk_window_destroy),
* dialog);
*
* // Add the label, and show everything we’ve added
@@ -1178,7 +1178,7 @@ run_destroy_handler (GtkDialog *dialog, gpointer data)
* do_nothing_since_dialog_was_cancelled ();
* break;
* }
- * gtk_widget_destroy (dialog);
+ * gtk_window_destory (GTK_WINDOW (dialog));
* ]|
*
* Note that even though the recursive main loop gives the effect of a
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index c1dcd61..162e98f 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -170,13 +170,13 @@ add_recent_item (GtkEmojiChooser *chooser,
if (modifier == modifier2 && g_variant_equal (item, item2))
{
- gtk_widget_destroy (GTK_WIDGET (l->data));
+ gtk_container_remove (GTK_CONTAINER (chooser->recent.box), GTK_WIDGET (l->data));
i--;
continue;
}
if (i >= MAX_RECENT)
{
- gtk_widget_destroy (GTK_WIDGET (l->data));
+ gtk_container_remove (GTK_CONTAINER (chooser->recent.box), GTK_WIDGET (l->data));
continue;
}
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 225f3e9..ffd247b 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -2691,10 +2691,10 @@ gtk_entry_finalize (GObject *object)
g_source_remove (priv->blink_timeout);
if (priv->selection_bubble)
- gtk_widget_destroy (priv->selection_bubble);
+ g_object_unref (G_OBJECT (priv->selection_bubble));
if (priv->magnifier_popover)
- gtk_widget_destroy (priv->magnifier_popover);
+ g_object_unref (G_OBJECT (priv->magnifier_popover));
if (priv->text_handle)
g_object_unref (priv->text_handle);
@@ -3012,7 +3012,7 @@ gtk_entry_unrealize (GtkWidget *widget)
if (priv->popup_menu)
{
- gtk_widget_destroy (priv->popup_menu);
+ g_object_unref (G_OBJECT (priv->popup_menu));
priv->popup_menu = NULL;
}
@@ -8490,7 +8490,7 @@ popup_targets_received (GtkClipboard *clipboard,
clipboard_contains_text = gtk_selection_data_targets_include_text (data);
if (info_entry_priv->popup_menu)
- gtk_widget_destroy (info_entry_priv->popup_menu);
+ g_object_unref (G_OBJECT (info_entry_priv->popup_menu));
info_entry_priv->popup_menu = menu = gtk_menu_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (menu),
@@ -8683,7 +8683,7 @@ bubble_targets_received (GtkClipboard *clipboard,
}
if (priv->selection_bubble)
- gtk_widget_destroy (priv->selection_bubble);
+ g_object_unref (G_OBJECT (priv->selection_bubble));
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (entry));
gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c
index 848f687..bb9f00b 100644
--- a/gtk/gtkentrycompletion.c
+++ b/gtk/gtkentrycompletion.c
@@ -790,7 +790,7 @@ gtk_entry_completion_dispose (GObject *object)
if (priv->tree_view)
{
- gtk_widget_destroy (priv->tree_view);
+ gtk_container_remove (GTK_CONTAINER (priv->scrolled_window), priv->tree_view);
priv->tree_view = NULL;
}
@@ -811,7 +811,7 @@ gtk_entry_completion_dispose (GObject *object)
if (priv->popup_window)
{
- gtk_widget_destroy (priv->popup_window);
+ gtk_window_destroy (GTK_WINDOW (priv->popup_window));
priv->popup_window = NULL;
}
diff --git a/gtk/gtkfilechooser.c b/gtk/gtkfilechooser.c
index 8463ce4..ccfc27e 100644
--- a/gtk/gtkfilechooser.c
+++ b/gtk/gtkfilechooser.c
@@ -354,7 +354,7 @@ gtk_file_chooser_default_init (GtkFileChooserInterface *iface)
* if (gtk_dialog_run (chooser) == GTK_RESPONSE_ACCEPT)
* save_to_file (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
*
- * gtk_widget_destroy (chooser);
+ * gtk_window_destroy (GTK_WINDOW (chooser));
* ]|
*
* Returns: a #GtkFileChooserConfirmation value that indicates which
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 48d13cb..f37e7e5 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -1093,7 +1093,7 @@ gtk_file_chooser_button_destroy (GtkWidget *widget)
if (priv->dialog != NULL)
{
- gtk_widget_destroy (priv->dialog);
+ gtk_window_destroy (GTK_WINDOW (priv->dialog));
priv->dialog = NULL;
}
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index 57bef49..bfb2e85 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -92,7 +92,7 @@
* g_free (filename);
* }
*
- * gtk_widget_destroy (dialog);
+ * gtk_window_destroy (GTK_WINDOW (dialog));
* ]|
*
* To use a dialog for saving, you can use this:
@@ -132,7 +132,7 @@
* g_free (filename);
* }
*
- * gtk_widget_destroy (dialog);
+ * gtk_window_destroy (GTK_WINDOW (dialog));
* ]|
*
* ## Setting up a file chooser dialog ## {#gtkfilechooserdialog-setting-up}
diff --git a/gtk/gtkfilechoosernative.c b/gtk/gtkfilechoosernative.c
index b66e5a7..a1d401a 100644
--- a/gtk/gtkfilechoosernative.c
+++ b/gtk/gtkfilechoosernative.c
@@ -514,7 +514,7 @@ gtk_file_chooser_native_finalize (GObject *object)
g_clear_pointer (&self->accept_label, g_free);
g_clear_pointer (&self->cancel_label, g_free);
- gtk_widget_destroy (self->dialog);
+ gtk_window_destroy (GTK_WINDOW (self->dialog));
g_slist_free_full (self->custom_files, g_object_unref);
g_slist_free_full (self->choices, (GDestroyNotify)gtk_file_chooser_native_choice_free);
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index b6fa011..5a82e07 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -74,7 +74,7 @@ filechooser_portal_data_free (FilechooserPortalData *data)
if (data->grab_widget)
{
gtk_grab_remove (data->grab_widget);
- gtk_widget_destroy (data->grab_widget);
+ g_object_unref (G_OBJECT (data->grab_widget));
}
g_clear_object (&data->self);
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index a077fb7..c49714c 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -745,7 +745,7 @@ error_message_with_parent (GtkWindow *parent,
GTK_WINDOW (dialog));
gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
/* Returns a toplevel GtkWindow, or NULL if none */
@@ -936,7 +936,7 @@ update_preview_widget_visibility (GtkFileChooserWidget *impl)
{
if (priv->preview_label)
{
- gtk_widget_destroy (priv->preview_label);
+ gtk_container_remove (GTK_CONTAINER (priv->preview_box), priv->preview_label);
priv->preview_label = NULL;
}
}
@@ -1489,7 +1489,7 @@ confirm_delete (GtkFileChooserWidget *impl,
response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
return (response == GTK_RESPONSE_ACCEPT);
}
@@ -2741,7 +2741,7 @@ save_widgets_destroy (GtkFileChooserWidget *impl)
if (priv->save_widgets == NULL)
return;
- gtk_widget_destroy (priv->save_widgets);
+ gtk_container_remove (GTK_CONTAINER (priv->box), priv->save_widgets);
priv->save_widgets = NULL;
priv->save_widgets_table = NULL;
priv->location_entry = NULL;
@@ -3642,7 +3642,7 @@ gtk_file_chooser_widget_dispose (GObject *object)
if (priv->browse_files_popover)
{
- gtk_widget_destroy (priv->browse_files_popover);
+ g_object_unref (G_OBJECT (priv->browse_files_popover));
priv->browse_files_popover = NULL;
}
@@ -6372,7 +6372,7 @@ confirm_dialog_should_accept_filename (GtkFileChooserWidget *impl,
response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
return (response == GTK_RESPONSE_ACCEPT);
}
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 9c32be9..e5e6db6 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -3745,7 +3745,7 @@ gtk_flow_box_bound_model_changed (GListModel *list,
GtkFlowBoxChild *child;
child = gtk_flow_box_get_child_at_index (box, position);
- gtk_widget_destroy (GTK_WIDGET (child));
+ gtk_container_remove (GTK_CONTAINER (box), GTK_WIDGET (child));
}
for (i = 0; i < added; i++)
@@ -4073,7 +4073,8 @@ gtk_flow_box_bind_model (GtkFlowBox *box,
g_clear_object (&priv->bound_model);
}
- gtk_flow_box_forall (GTK_CONTAINER (box), (GtkCallback) gtk_widget_destroy, NULL);
+ gtk_flow_box_forall (GTK_CONTAINER (box),
+ (GtkCallback) gtk_container_remove_callback, box);
if (model == NULL)
return;
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index ada2258..93582ca 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -668,7 +668,7 @@ gtk_font_button_finalize (GObject *object)
GtkFontButtonPrivate *priv = font_button->priv;
if (priv->font_dialog != NULL)
- gtk_widget_destroy (priv->font_dialog);
+ gtk_window_destroy (GTK_WINDOW (priv->font_dialog));
g_free (priv->title);
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index de25017..fd74d17 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -355,7 +355,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
if (!_gtk_header_bar_update_window_icon (bar, window))
{
- gtk_widget_destroy (button);
+ g_object_unref (G_OBJECT (button));
priv->titlebar_icon = NULL;
button = NULL;
}
@@ -1389,10 +1389,7 @@ gtk_header_bar_destroy (GtkWidget *widget)
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
if (priv->label_sizing_box)
- {
- gtk_widget_destroy (priv->label_sizing_box);
- g_clear_object (&priv->label_sizing_box);
- }
+ g_clear_object (&priv->label_sizing_box);
if (priv->custom_title)
{
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 5d47794..862155e 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -4171,7 +4171,7 @@ gtk_label_unmap (GtkWidget *widget)
{
if (priv->select_info->popup_menu)
{
- gtk_widget_destroy (priv->select_info->popup_menu);
+ g_object_unref (G_OBJECT (priv->select_info->popup_menu));
priv->select_info->popup_menu = NULL;
}
}
@@ -6054,7 +6054,7 @@ gtk_label_do_popup (GtkLabel *label,
return;
if (priv->select_info->popup_menu)
- gtk_widget_destroy (priv->select_info->popup_menu);
+ g_object_unref (G_OBJECT (priv->select_info->popup_menu));
priv->select_info->popup_menu = menu = gtk_menu_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (menu),
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index 37aaf10..77dfe0c 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -355,7 +355,7 @@ gtk_link_button_do_popup (GtkLinkButton *link_button,
GtkWidget *menu_item;
if (priv->popup_menu)
- gtk_widget_destroy (priv->popup_menu);
+ g_object_unref (G_OBJECT (priv->popup_menu));
priv->popup_menu = gtk_menu_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (priv->popup_menu),
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 40b939f..544a5da 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1733,7 +1733,7 @@ gtk_main_do_event (GdkEvent *event)
g_object_ref (event_widget);
if ((!gtk_window_group_get_current_grab (window_group) || gtk_widget_get_toplevel
(gtk_window_group_get_current_grab (window_group)) == event_widget) &&
!gtk_widget_event (event_widget, event))
- gtk_widget_destroy (event_widget);
+ gtk_window_destroy (GTK_WINDOW (event_widget));
g_object_unref (event_widget);
break;
@@ -1741,12 +1741,13 @@ gtk_main_do_event (GdkEvent *event)
/* Unexpected GDK_DESTROY from the outside, ignore for
* child windows, handle like a GDK_DELETE for toplevels
*/
- if (!gtk_widget_get_parent (event_widget))
+ if (!gtk_widget_get_parent (event_widget) &&
+ GTK_IS_WINDOW (event_widget))
{
g_object_ref (event_widget);
if (!gtk_widget_event (event_widget, event) &&
gtk_widget_get_realized (event_widget))
- gtk_widget_destroy (event_widget);
+ gtk_window_destroy (GTK_WINDOW (event_widget));
g_object_unref (event_widget);
}
break;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 6d5eb92..1da329e 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -228,7 +228,7 @@ static void gtk_menu_get_child_property(GtkContainer *container,
guint property_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_menu_destroy (GtkWidget *widget);
+static void gtk_menu_dispose (GObject *object);
static void gtk_menu_realize (GtkWidget *widget);
static void gtk_menu_unrealize (GtkWidget *widget);
static void gtk_menu_size_allocate (GtkWidget *widget,
@@ -508,8 +508,8 @@ gtk_menu_class_init (GtkMenuClass *class)
gobject_class->set_property = gtk_menu_set_property;
gobject_class->get_property = gtk_menu_get_property;
gobject_class->finalize = gtk_menu_finalize;
+ gobject_class->dispose = gtk_menu_dispose;
- 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;
@@ -1230,15 +1230,15 @@ moved_to_rect_cb (GdkWindow *window,
}
static void
-gtk_menu_destroy (GtkWidget *widget)
+gtk_menu_dispose (GObject *object)
{
- GtkMenu *menu = GTK_MENU (widget);
+ GtkMenu *menu = GTK_MENU (object);
GtkMenuPrivate *priv = menu->priv;
GtkMenuAttachData *data;
gtk_menu_remove_scroll_timeout (menu);
- data = g_object_get_data (G_OBJECT (widget), attach_data_key);
+ data = g_object_get_data (object, attach_data_key);
if (data)
gtk_menu_detach (menu);
@@ -1250,7 +1250,7 @@ gtk_menu_destroy (GtkWidget *widget)
if (priv->needs_destruction_ref)
{
priv->needs_destruction_ref = FALSE;
- g_object_ref (widget);
+ g_object_ref (object);
}
g_clear_object (&priv->accel_group);
@@ -1258,7 +1258,7 @@ gtk_menu_destroy (GtkWidget *widget)
if (priv->toplevel)
{
g_signal_handlers_disconnect_by_func (priv->toplevel, moved_to_rect_cb, menu);
- gtk_widget_destroy (priv->toplevel);
+ gtk_window_destroy (GTK_WINDOW (priv->toplevel));
}
g_clear_pointer (&priv->heights, g_free);
@@ -1270,7 +1270,7 @@ gtk_menu_destroy (GtkWidget *widget)
priv->position_func_data_destroy = NULL;
}
- GTK_WIDGET_CLASS (gtk_menu_parent_class)->destroy (widget);
+ G_OBJECT_CLASS (gtk_menu_parent_class)->dispose (object);
}
static void
@@ -2922,7 +2922,6 @@ static void gtk_menu_measure (GtkWidget *widget,
NULL, NULL);
max_toggle_size = indicator_width;
- gtk_widget_destroy (menu_item);
g_object_ref_sink (menu_item);
g_object_unref (menu_item);
}
diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c
index 7bfc8ec..2154d65 100644
--- a/gtk/gtkmenubutton.c
+++ b/gtk/gtkmenubutton.c
@@ -1038,7 +1038,7 @@ gtk_menu_button_dispose (GObject *object)
if (priv->popover)
{
- gtk_widget_destroy (priv->popover);
+ g_object_unref (G_OBJECT (priv->popover));
priv->popover = NULL;
}
@@ -1139,7 +1139,7 @@ gtk_menu_button_set_popover (GtkMenuButton *menu_button,
menu_deactivate_cb,
menu_button);
- gtk_popover_set_relative_to (GTK_POPOVER (priv->popover), NULL);
+ g_object_unref (priv->popover);
}
priv->popover = popover;
@@ -1151,6 +1151,8 @@ gtk_menu_button_set_popover (GtkMenuButton *menu_button,
G_CALLBACK (menu_deactivate_cb), menu_button);
update_popover_direction (menu_button);
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (menu_button)),
"menu-button");
+
+ g_object_ref (popover);
}
if (popover && priv->menu)
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index efddab5..76e56ab 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -833,7 +833,7 @@ gtk_menu_item_destroy (GtkWidget *widget)
GtkMenuItemPrivate *priv = menu_item->priv;
if (priv->submenu)
- gtk_widget_destroy (priv->submenu);
+ g_object_unref (G_OBJECT (priv->submenu));
GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->destroy (widget);
}
@@ -1006,7 +1006,7 @@ gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
if (submenu)
{
- priv->submenu = submenu;
+ priv->submenu = g_object_ref (submenu);
gtk_menu_attach_to_widget (GTK_MENU (submenu),
widget,
gtk_menu_item_detacher);
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
index 3179290..aa25228 100644
--- a/gtk/gtkmenusectionbox.c
+++ b/gtk/gtkmenusectionbox.c
@@ -214,7 +214,7 @@ gtk_menu_section_box_remove_func (gint position,
gtk_container_remove (GTK_CONTAINER (stack), subbox);
}
- gtk_widget_destroy (g_list_nth_data (children, position));
+ gtk_container_remove (GTK_CONTAINER (box->item_box), g_list_nth_data (children, position));
g_list_free (children);
gtk_menu_section_box_schedule_separator_sync (box);
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 97532e0..a093b2d 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -1804,7 +1804,8 @@ gtk_menu_shell_tracker_remove_func (gint position,
* the attached-to from the submenu holds a ref on the item and a
* simple gtk_container_remove() isn't good enough to break that.
*/
- gtk_widget_destroy (child);
+ /* TODO: ^^^ ??? */
+ gtk_container_remove (GTK_CONTAINER (menu_shell), child);
}
static void
diff --git a/gtk/gtkmenutoolbutton.c b/gtk/gtkmenutoolbutton.c
index d34d02d..a6c6f47 100644
--- a/gtk/gtkmenutoolbutton.c
+++ b/gtk/gtkmenutoolbutton.c
@@ -160,7 +160,7 @@ gtk_menu_tool_button_construct_contents (GtkMenuToolButton *button)
/* Note: we are not destroying the button and the arrow_button
* here because they were removed from their container above
*/
- gtk_widget_destroy (priv->box);
+ gtk_container_remove (GTK_CONTAINER (button), priv->box);
}
priv->box = box;
diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
index c013d56..14fb89f 100644
--- a/gtk/gtkmessagedialog.c
+++ b/gtk/gtkmessagedialog.c
@@ -69,7 +69,7 @@
* filename,
* g_strerror (errno));
* gtk_dialog_run (GTK_DIALOG (dialog));
- * gtk_widget_destroy (dialog);
+ * gtk_window_destroy (GTK_WINDOW (dialog));
* ]|
*
* You might do a non-modal #GtkMessageDialog as follows:
@@ -89,7 +89,7 @@
* // (e.g. clicks a button)
*
* g_signal_connect_swapped (dialog, "response",
- * G_CALLBACK (gtk_widget_destroy),
+ * G_CALLBACK (gtk_window_destroy),
* dialog);
* ]|
*
diff --git a/gtk/gtkmodelmenuitem.c b/gtk/gtkmodelmenuitem.c
index 9afca43..e007519 100644
--- a/gtk/gtkmodelmenuitem.c
+++ b/gtk/gtkmodelmenuitem.c
@@ -153,7 +153,7 @@ gtk_model_menu_item_set_icon (GtkModelMenuItem *item,
while (children)
{
if (GTK_IS_IMAGE (children->data))
- gtk_widget_destroy (children->data);
+ gtk_container_remove (GTK_CONTAINER (child), GTK_WIDGET (children->data));
children = g_list_delete_link (children, children);
}
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index 0979bd0..7335127 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -358,7 +358,7 @@ pw_dialog_got_response (GtkDialog *dialog,
priv->dialog = NULL;
g_object_notify (G_OBJECT (op), "is-showing");
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (op);
}
@@ -832,7 +832,7 @@ question_dialog_button_clicked (GtkDialog *dialog,
priv->dialog = NULL;
g_object_notify (G_OBJECT (operation), "is-showing");
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (op);
}
@@ -987,7 +987,7 @@ show_processes_button_clicked (GtkDialog *dialog,
priv->dialog = NULL;
g_object_notify (G_OBJECT (operation), "is-showing");
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (op);
}
@@ -1274,7 +1274,7 @@ on_end_process_activated (GtkMenuItem *item,
* destroy the dialog in that case
*/
if (response != GTK_RESPONSE_NONE)
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_error_free (error);
}
@@ -1622,7 +1622,7 @@ gtk_mount_operation_aborted (GMountOperation *op)
if (priv->dialog != NULL)
{
- gtk_widget_destroy (GTK_WIDGET (priv->dialog));
+ gtk_window_destroy (GTK_WINDOW (priv->dialog));
priv->dialog = NULL;
g_object_notify (G_OBJECT (op), "is-showing");
g_object_unref (op);
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index d1f90ab..95f3267 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -4242,7 +4242,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
g_object_ref (tab_label);
gtk_notebook_remove_tab_label (notebook, page);
if (destroying)
- gtk_widget_destroy (tab_label);
+ gtk_widget_unparent (tab_label); /* parent is page->tab_widget */
g_object_unref (tab_label);
}
@@ -6122,7 +6122,7 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
children = children->next;
if (page->default_tab)
{
- gtk_widget_destroy (page->tab_label);
+ gtk_widget_unparent (page->tab_label);
page->tab_label = NULL;
}
else
@@ -6409,7 +6409,9 @@ gtk_notebook_popup_disable (GtkNotebook *notebook)
gtk_container_foreach (GTK_CONTAINER (priv->menu),
(GtkCallback) gtk_notebook_menu_label_unparent, NULL);
- gtk_widget_destroy (priv->menu);
+
+ gtk_menu_detach (GTK_MENU (priv->menu));
+ priv->menu = NULL;
g_object_notify_by_pspec (G_OBJECT (notebook), properties[PROP_ENABLE_POPUP]);
}
diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c
index 368f03a..664ce83 100644
--- a/gtk/gtkpagesetupunixdialog.c
+++ b/gtk/gtkpagesetupunixdialog.c
@@ -748,7 +748,7 @@ custom_paper_dialog_response_cb (GtkDialog *custom_paper_dialog,
/* Update printer page list */
printer_changed_callback (GTK_COMBO_BOX (priv->printer_combo), page_setup_dialog);
- gtk_widget_destroy (GTK_WIDGET (custom_paper_dialog));
+ gtk_window_destroy (GTK_WINDOW (custom_paper_dialog));
}
static void
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 899fc1b..b82c50c 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -1583,7 +1583,7 @@ gtk_path_bar_set_file_finish (struct SetFileInfo *info,
ButtonData *button_data;
button_data = BUTTON_DATA (l->data);
- gtk_widget_destroy (button_data->button);
+ gtk_container_remove (GTK_CONTAINER (info->path_bar), GTK_WIDGET (button_data->button));
}
g_list_free (info->new_buttons);
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 8cb1a4f..1026ac9 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -999,8 +999,8 @@ update_places (GtkPlacesSidebar *sidebar)
* ending a drag */
stop_drop_feedback (sidebar);
gtk_container_foreach (GTK_CONTAINER (sidebar->list_box),
- (GtkCallback) gtk_widget_destroy,
- NULL);
+ (GtkCallback) gtk_container_remove_callback,
+ sidebar->list_box);
network_mounts = network_volumes = NULL;
@@ -1655,7 +1655,11 @@ stop_drop_feedback (GtkPlacesSidebar *sidebar)
if (sidebar->row_placeholder != NULL)
{
- gtk_widget_destroy (sidebar->row_placeholder);
+ /* Can be a child of the listbox, or not */
+ if (gtk_widget_get_parent (sidebar->row_placeholder) != NULL)
+ gtk_container_remove (GTK_CONTAINER (sidebar->list_box), sidebar->row_placeholder);
+
+ g_object_unref (sidebar->row_placeholder);
sidebar->row_placeholder = NULL;
}
@@ -3541,7 +3545,7 @@ build_popup_menu_using_gmenu (GtkSidebarRow *row)
G_ACTION_GROUP (cloud_provider_action_group));
add_actions (sidebar);
if (sidebar->popover)
- gtk_widget_destroy (sidebar->popover);
+ g_object_unref (G_OBJECT (sidebar->popover));
sidebar->popover = gtk_popover_new_from_model (GTK_WIDGET (sidebar),
G_MENU_MODEL (menu));
@@ -3644,7 +3648,7 @@ show_row_popover (GtkSidebarRow *row)
g_object_get (row, "sidebar", &sidebar, NULL);
if (sidebar->popover)
- gtk_widget_destroy (sidebar->popover);
+ g_object_unref (G_OBJECT (sidebar->popover));
create_row_popover (sidebar, row);
@@ -4223,13 +4227,13 @@ gtk_places_sidebar_dispose (GObject *object)
if (sidebar->popover)
{
- gtk_widget_destroy (sidebar->popover);
+ g_object_unref (G_OBJECT (sidebar->popover));
sidebar->popover = NULL;
}
if (sidebar->rename_popover)
{
- gtk_widget_destroy (sidebar->rename_popover);
+ g_object_unref (G_OBJECT (sidebar->rename_popover));
sidebar->rename_popover = NULL;
sidebar->rename_entry = NULL;
sidebar->rename_button = NULL;
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index f9dfc76..7bd96b5 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -519,7 +519,6 @@ populate_servers (GtkPlacesView *view)
{
GtkPlacesViewPrivate *priv;
GBookmarkFile *server_list;
- GList *children;
gchar **uris;
gsize num_uris;
gint i;
@@ -542,8 +541,9 @@ populate_servers (GtkPlacesView *view)
}
/* clear previous items */
- children = gtk_container_get_children (GTK_CONTAINER (priv->recent_servers_listbox));
- g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
+ gtk_container_foreach (GTK_CONTAINER (priv->recent_servers_listbox),
+ (GtkCallback)gtk_container_remove_callback,
+ priv->recent_servers_listbox);
gtk_list_store_clear (priv->completion_store);
@@ -1091,7 +1091,6 @@ static void
update_places (GtkPlacesView *view)
{
GtkPlacesViewPrivate *priv;
- GList *children;
GList *mounts;
GList *volumes;
GList *drives;
@@ -1102,8 +1101,10 @@ update_places (GtkPlacesView *view)
priv = gtk_places_view_get_instance_private (view);
/* Clear all previously added items */
- children = gtk_container_get_children (GTK_CONTAINER (priv->listbox));
- g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
+ gtk_container_foreach (GTK_CONTAINER (priv->listbox),
+ (GtkCallback)gtk_container_remove_callback,
+ priv->listbox);
+
priv->network_placeholder = NULL;
/* Inform clients that we started loading */
gtk_places_view_set_loading (view, TRUE);
@@ -1693,7 +1694,7 @@ popup_menu (GtkPlacesViewRow *row,
view = gtk_widget_get_ancestor (GTK_WIDGET (row), GTK_TYPE_PLACES_VIEW);
priv = gtk_places_view_get_instance_private (GTK_PLACES_VIEW (view));
- g_clear_pointer (&priv->popup_menu, gtk_widget_destroy);
+ g_clear_pointer (&priv->popup_menu, gtk_window_destroy);
build_popup_menu (GTK_PLACES_VIEW (view), row);
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index d31e30c..5c75c8b 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -2319,7 +2319,7 @@ gtk_popover_bind_model (GtkPopover *popover,
child = gtk_bin_get_child (GTK_BIN (popover));
if (child)
- gtk_widget_destroy (child);
+ gtk_container_remove (GTK_CONTAINER (popover), child);
style_context = gtk_widget_get_style_context (popover->priv->contents_widget);
diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c
index 4094279..a4fd8ea 100644
--- a/gtk/gtkprintbackend.c
+++ b/gtk/gtkprintbackend.c
@@ -728,7 +728,7 @@ password_dialog_response (GtkWidget *dialog,
g_clear_pointer (&priv->auth_info, g_free);
g_clear_pointer (&priv->auth_info_required, g_strfreev);
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_object_unref (backend);
}
diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c
index 2bd5832..cff4b49 100644
--- a/gtk/gtkprinteroptionwidget.c
+++ b/gtk/gtkprinteroptionwidget.c
@@ -432,38 +432,35 @@ deconstruct_widgets (GtkPrinterOptionWidget *widget)
if (priv->check)
{
- gtk_widget_destroy (priv->check);
+ gtk_container_remove (GTK_CONTAINER (widget), priv->check);
priv->check = NULL;
}
if (priv->combo)
{
- gtk_widget_destroy (priv->combo);
+ gtk_container_remove (GTK_CONTAINER (widget), priv->combo);
priv->combo = NULL;
}
if (priv->entry)
{
- gtk_widget_destroy (priv->entry);
+ gtk_container_remove (GTK_CONTAINER (widget), priv->entry);
priv->entry = NULL;
}
if (priv->image)
{
- gtk_widget_destroy (priv->image);
+ gtk_container_remove (GTK_CONTAINER (widget), priv->image);
priv->image = NULL;
}
- if (priv->label)
- {
- gtk_widget_destroy (priv->label);
- priv->label = NULL;
- }
if (priv->info_label)
{
- gtk_widget_destroy (priv->info_label);
+ gtk_container_remove (GTK_CONTAINER (widget), priv->info_label);
priv->info_label = NULL;
}
+
+ /* Ownership of priv->label transferred to someone else by _get_external_label */
}
static void
@@ -505,7 +502,7 @@ dialog_response_callback (GtkDialog *dialog,
g_free (filename);
}
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
if (new_location)
uri = new_location;
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index dee683f..fd89418 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -660,7 +660,7 @@ handle_print_response (GtkWidget *dialog,
if (settings)
g_object_unref (settings);
- gtk_widget_destroy (GTK_WIDGET (pd));
+ gtk_window_destroy (GTK_WINDOW (pd));
}
@@ -927,7 +927,7 @@ handle_page_setup_response (GtkWidget *dialog,
if (response == GTK_RESPONSE_OK)
rdata->page_setup = gtk_page_setup_unix_dialog_get_page_setup (psd);
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
if (rdata->done_cb)
rdata->done_cb (rdata->page_setup, rdata->data);
diff --git a/gtk/gtkprintoperation-win32.c b/gtk/gtkprintoperation-win32.c
index 2d11bce..19d8bff 100644
--- a/gtk/gtkprintoperation-win32.c
+++ b/gtk/gtkprintoperation-win32.c
@@ -1386,7 +1386,7 @@ pageDlgProc (HWND wnd, UINT message, WPARAM wparam, LPARAM lparam)
op_win32 = op->priv->platform_data;
g_signal_emit_by_name (op, "custom-widget-apply", op->priv->custom_widget);
- gtk_widget_destroy (op_win32->embed_widget);
+ g_object_unref (G_OBJECT (op_win32->embed_widget));
op_win32->embed_widget = NULL;
op->priv->custom_widget = NULL;
}
@@ -1911,7 +1911,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op,
GlobalFree (printdlgex);
if (invisible)
- gtk_widget_destroy (invisible);
+ g_object_unref (G_OBJECT (invisible));
return result;
}
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index 329a07a..ba4868e 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -2334,7 +2334,7 @@ print_pages_idle_done (gpointer user_data)
}
if (data->progress)
- gtk_widget_destroy (data->progress);
+ gtk_window_destroy (GTK_WINDOW (data->progress));
if (priv->rloop && !data->is_preview)
g_main_loop_quit (priv->rloop);
@@ -3043,7 +3043,7 @@ print_pages (GtkPrintOperation *op,
GTK_WINDOW (error_dialog));
g_signal_connect (error_dialog, "response",
- G_CALLBACK (gtk_widget_destroy), NULL);
+ G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (error_dialog);
@@ -3169,7 +3169,7 @@ gtk_print_operation_get_error (GtkPrintOperation *op,
* "Error printing file:\n%s",
* error->message);
* g_signal_connect (error_dialog, "response",
- * G_CALLBACK (gtk_widget_destroy), NULL);
+ * G_CALLBACK (gtk_window_destroy), NULL);
* gtk_widget_show (error_dialog);
* g_error_free (error);
* }
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 5a31fd5..2f5f796 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -685,7 +685,7 @@ error_dialogs (GtkPrintUnixDialog *print_dialog,
response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_free (dirname);
g_free (basename);
@@ -1633,7 +1633,7 @@ update_dialog_from_settings (GtkPrintUnixDialog *dialog)
nrows = grid_rows (GTK_GRID (table));
if (nrows == 0)
- gtk_widget_destroy (table);
+ g_object_unref (G_OBJECT (table));
else
{
has_advanced = TRUE;
@@ -1986,13 +1986,13 @@ clear_per_printer_ui (GtkPrintUnixDialog *dialog)
return;
gtk_container_foreach (GTK_CONTAINER (priv->finishing_table),
- (GtkCallback)gtk_widget_destroy, NULL);
+ (GtkCallback)gtk_container_remove_callback, priv->finishing_table);
gtk_container_foreach (GTK_CONTAINER (priv->image_quality_table),
- (GtkCallback)gtk_widget_destroy, NULL);
+ (GtkCallback)gtk_container_remove_callback, priv->image_quality_table);
gtk_container_foreach (GTK_CONTAINER (priv->color_table),
- (GtkCallback)gtk_widget_destroy, NULL);
+ (GtkCallback)gtk_container_remove_callback, priv->color_table);
gtk_container_foreach (GTK_CONTAINER (priv->advanced_vbox),
- (GtkCallback)gtk_widget_destroy, NULL);
+ (GtkCallback)gtk_container_remove_callback, priv->advanced_vbox);
extension_point_clear_children (GTK_CONTAINER (priv->extension_point));
}
@@ -3275,7 +3275,7 @@ custom_paper_dialog_response_cb (GtkDialog *custom_paper_dialog,
}
}
- gtk_widget_destroy (GTK_WIDGET (custom_paper_dialog));
+ gtk_window_destroy (GTK_WINDOW (custom_paper_dialog));
}
static void
diff --git a/gtk/gtkrecentchooserdefault.c b/gtk/gtkrecentchooserdefault.c
index 04166c2..1520709 100644
--- a/gtk/gtkrecentchooserdefault.c
+++ b/gtk/gtkrecentchooserdefault.c
@@ -596,7 +596,7 @@ error_message_with_parent (GtkWindow *parent,
GTK_WINDOW (dialog));
gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
/* Returns a toplevel GtkWindow, or NULL if none */
diff --git a/gtk/gtkrecentchooserdialog.c b/gtk/gtkrecentchooserdialog.c
index 24e781c..c28418b 100644
--- a/gtk/gtkrecentchooserdialog.c
+++ b/gtk/gtkrecentchooserdialog.c
@@ -73,7 +73,7 @@
* gtk_recent_info_unref (info);
* }
*
- * gtk_widget_destroy (dialog);
+ * gtk_window_destroy (GTK_WINDOW (dialog));
* ]|
*
* Recently used files are supported since GTK+ 2.10.
diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c
index 7e78735..7e31dc7 100644
--- a/gtk/gtkscalebutton.c
+++ b/gtk/gtkscalebutton.c
@@ -362,6 +362,7 @@ gtk_scale_button_init (GtkScaleButton *button)
gtk_widget_init_template (GTK_WIDGET (button));
gtk_popover_set_relative_to (GTK_POPOVER (priv->dock), GTK_WIDGET (button));
+ g_object_ref (G_OBJECT (priv->dock));
/* Need a local reference to the adjustment */
priv->adjustment = gtk_adjustment_new (0, 0, 100, 2, 20, 0);
@@ -490,11 +491,7 @@ gtk_scale_button_dispose (GObject *object)
GtkScaleButton *button = GTK_SCALE_BUTTON (object);
GtkScaleButtonPrivate *priv = button->priv;
- if (priv->dock)
- {
- gtk_widget_destroy (priv->dock);
- priv->dock = NULL;
- }
+ g_clear_object (&priv->dock);
if (priv->click_id != 0)
{
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 52fbd20..e0dbc5d 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2590,7 +2590,7 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
child = gtk_bin_get_child (GTK_BIN (widget));
if (child)
- gtk_widget_destroy (child);
+ gtk_container_remove (GTK_CONTAINER (widget), child);
remove_indicator (scrolled_window, &priv->hindicator);
remove_indicator (scrolled_window, &priv->vindicator);
diff --git a/gtk/gtkshortcutlabel.c b/gtk/gtkshortcutlabel.c
index b7003dd..c511b7e 100644
--- a/gtk/gtkshortcutlabel.c
+++ b/gtk/gtkshortcutlabel.c
@@ -371,7 +371,9 @@ gtk_shortcut_label_rebuild (GtkShortcutLabel *self)
gchar **accels;
gint k;
- gtk_container_foreach (GTK_CONTAINER (self), (GtkCallback)gtk_widget_destroy, NULL);
+ gtk_container_foreach (GTK_CONTAINER (self),
+ (GtkCallback)gtk_container_remove_callback,
+ self);
if (self->accelerator == NULL || self->accelerator[0] == '\0')
{
diff --git a/gtk/gtkshortcutsgroup.c b/gtk/gtkshortcutsgroup.c
index d1775d9..d36a68b 100644
--- a/gtk/gtkshortcutsgroup.c
+++ b/gtk/gtkshortcutsgroup.c
@@ -273,7 +273,7 @@ gtk_shortcuts_group_dispose (GObject *object)
*/
if (self->title)
{
- gtk_widget_destroy (GTK_WIDGET (self->title));
+ gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (self->title));
self->title = NULL;
}
diff --git a/gtk/gtkshortcutssection.c b/gtk/gtkshortcutssection.c
index ac1399b..77589c2 100644
--- a/gtk/gtkshortcutssection.c
+++ b/gtk/gtkshortcutssection.c
@@ -208,13 +208,13 @@ gtk_shortcuts_section_destroy (GtkWidget *widget)
if (self->stack)
{
- gtk_widget_destroy (GTK_WIDGET (self->stack));
+ gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (self->stack));
self->stack = NULL;
}
if (self->footer)
{
- gtk_widget_destroy (GTK_WIDGET (self->footer));
+ gtk_container_remove (GTK_CONTAINER (self), GTK_WIDGET (self->footer));
self->footer = NULL;
}
@@ -736,8 +736,7 @@ gtk_shortcuts_section_reflow_groups (GtkShortcutsSection *self)
}
/* replace the current pages with the new pages */
- children = gtk_container_get_children (GTK_CONTAINER (self->stack));
- g_list_free_full (children, (GDestroyNotify)gtk_widget_destroy);
+ gtk_container_foreach (GTK_CONTAINER (self->stack), (GtkCallback)gtk_container_remove_callback,
self->stack);
for (p = pages, n_pages = 0; p; p = p->next, n_pages++)
{
diff --git a/gtk/gtksidebarrow.c b/gtk/gtksidebarrow.c
index 65a69f5..b72fcbe 100644
--- a/gtk/gtksidebarrow.c
+++ b/gtk/gtksidebarrow.c
@@ -294,8 +294,8 @@ gtk_sidebar_row_set_property (GObject *object,
g_clear_object (&self->cloud_provider);
gtk_container_foreach (GTK_CONTAINER (self),
- (GtkCallback) gtk_widget_destroy,
- NULL);
+ (GtkCallback) gtk_container_remove_callback,
+ self);
context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_add_class (context, "sidebar-placeholder-row");
diff --git a/gtk/gtkstackswitcher.c b/gtk/gtkstackswitcher.c
index 19c887f..81eb475 100644
--- a/gtk/gtkstackswitcher.c
+++ b/gtk/gtkstackswitcher.c
@@ -128,7 +128,7 @@ rebuild_child (GtkWidget *self,
button_child = gtk_bin_get_child (GTK_BIN (self));
if (button_child != NULL)
- gtk_widget_destroy (button_child);
+ gtk_container_remove (GTK_CONTAINER (self), button_child);
button_child = NULL;
context = gtk_widget_get_style_context (GTK_WIDGET (self));
diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c
index 2ff7de2..d774dd7 100644
--- a/gtk/gtktextchild.c
+++ b/gtk/gtktextchild.c
@@ -180,7 +180,7 @@ child_segment_delete_func (GtkTextLineSegment *seg,
{
GtkWidget *child = tmp_list->data;
- gtk_widget_destroy (child);
+ g_object_unref (G_OBJECT (child));
tmp_list = tmp_list->next;
}
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 092f0c5..c9c9a9c 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -1866,7 +1866,7 @@ gtk_text_view_set_buffer (GtkTextView *text_view,
if (vc->anchor)
{
- gtk_widget_destroy (vc->widget);
+ gtk_widget_unparent (vc->widget);
/* vc may now be invalid! */
}
@@ -3669,10 +3669,11 @@ gtk_text_view_finalize (GObject *object)
text_window_free (priv->bottom_window);
if (priv->selection_bubble)
- gtk_widget_destroy (priv->selection_bubble);
+ g_object_unref (G_OBJECT (priv->selection_bubble));
if (priv->magnifier_popover)
- gtk_widget_destroy (priv->magnifier_popover);
+ g_object_unref (G_OBJECT (priv->magnifier_popover));
+
if (priv->text_handle)
g_object_unref (priv->text_handle);
g_object_unref (priv->im_context);
@@ -4669,7 +4670,7 @@ gtk_text_view_unrealize (GtkWidget *widget)
if (priv->popup_menu)
{
- gtk_widget_destroy (priv->popup_menu);
+ gtk_menu_detach (GTK_MENU (priv->popup_menu));
priv->popup_menu = NULL;
}
@@ -9262,7 +9263,7 @@ popup_targets_received (GtkClipboard *clipboard,
clipboard_contains_text = gtk_selection_data_targets_include_text (data);
if (priv->popup_menu)
- gtk_widget_destroy (priv->popup_menu);
+ g_object_unref (G_OBJECT (priv->popup_menu));
priv->popup_menu = gtk_menu_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (priv->popup_menu),
@@ -9505,7 +9506,7 @@ bubble_targets_received (GtkClipboard *clipboard,
}
if (priv->selection_bubble)
- gtk_widget_destroy (priv->selection_bubble);
+ g_object_unref (G_OBJECT (priv->selection_bubble));
priv->selection_bubble = gtk_popover_new (GTK_WIDGET (text_view));
gtk_style_context_add_class (gtk_widget_get_style_context (priv->selection_bubble),
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 8d98767..fdec739 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -2739,7 +2739,7 @@ gtk_toolbar_dispose (GObject *object)
{
g_signal_handlers_disconnect_by_func (priv->menu,
menu_deactivated, toolbar);
- gtk_widget_destroy (GTK_WIDGET (priv->menu));
+ g_object_unref (G_OBJECT (priv->menu));
priv->menu = NULL;
}
diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c
index 7d2c20e..787510e 100644
--- a/gtk/gtktoolbutton.c
+++ b/gtk/gtktoolbutton.c
@@ -345,7 +345,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
/* Note: we are not destroying the label_widget or icon_widget
* here because they were removed from their containers above
*/
- gtk_widget_destroy (child);
+ gtk_container_remove (GTK_CONTAINER (button->priv->button), child);
}
style = gtk_tool_item_get_toolbar_style (GTK_TOOL_ITEM (button));
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 7fab3c8..273c30e 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -224,7 +224,8 @@ gtk_tooltip_dispose (GObject *object)
g_signal_handlers_disconnect_by_func (display,
gtk_tooltip_display_closed,
tooltip);
- gtk_widget_destroy (tooltip->window);
+
+ gtk_window_destroy (GTK_WINDOW (tooltip->window));
tooltip->window = NULL;
}
diff --git a/gtk/gtktreemenu.c b/gtk/gtktreemenu.c
index afc90bd..32ff895 100644
--- a/gtk/gtktreemenu.c
+++ b/gtk/gtktreemenu.c
@@ -851,7 +851,7 @@ row_deleted_cb (GtkTreeModel *model,
else
{
/* Get rid of the deleted item */
- gtk_widget_destroy (item);
+ gtk_container_remove (GTK_CONTAINER (menu), item);
/* Resize everything */
gtk_cell_area_context_reset (menu->priv->context);
@@ -863,7 +863,7 @@ row_deleted_cb (GtkTreeModel *model,
* since the topmost menu belongs to the user and is allowed to have no contents */
GtkWidget *submenu = find_empty_submenu (menu);
if (submenu)
- gtk_widget_destroy (submenu);
+ g_object_unref (submenu);
}
}
@@ -937,8 +937,8 @@ row_changed_cb (GtkTreeModel *model,
if (item)
{
/* Destroy the header item and then the following separator */
- gtk_widget_destroy (item);
- gtk_widget_destroy (GTK_MENU_SHELL (menu)->priv->children->data);
+ gtk_container_remove (GTK_CONTAINER (menu), item);
+ gtk_container_remove (GTK_CONTAINER (menu), GTK_MENU_SHELL (menu)->priv->children->data);
priv->menu_with_header = FALSE;
}
@@ -966,7 +966,7 @@ row_changed_cb (GtkTreeModel *model,
{
gint position = menu_item_position (menu, item);
- gtk_widget_destroy (item);
+ gtk_widget_unparent (item);
item = gtk_tree_menu_create_item (menu, iter, FALSE);
gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item, position);
}
@@ -1256,7 +1256,7 @@ rebuild_menu (GtkTreeMenu *menu)
/* Destroy all the menu items */
gtk_container_foreach (GTK_CONTAINER (menu),
- (GtkCallback) gtk_widget_destroy, NULL);
+ (GtkCallback) gtk_container_remove_callback, menu);
/* Populate */
if (priv->model)
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index cc974a1..76d2983 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2019,7 +2019,7 @@ gtk_tree_view_free_rbtree (GtkTreeView *tree_view)
static void
gtk_tree_view_destroy_search_window (GtkTreeView *tree_view)
{
- gtk_widget_destroy (tree_view->priv->search_window);
+ gtk_window_destroy (GTK_WINDOW (tree_view->priv->search_window));
tree_view->priv->search_window = NULL;
tree_view->priv->search_entry = NULL;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 62ae353..c561137 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2946,7 +2946,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
* GTK_BUTTONS_YES_NO,
* "Move the data ?\n");
* response = gtk_dialog_run (GTK_DIALOG (dialog));
- * gtk_widget_destroy (dialog);
+ * gtk_window_destroy (GTK_WINDOW (dialog));
*
* if (response == GTK_RESPONSE_YES)
* action = GDK_ACTION_MOVE;
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index b75b8b8..07d6fb3 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -2474,7 +2474,7 @@ gtk_window_buildable_custom_finished (GtkBuildable *buildable,
* the window internally, gtk_window_new() does not return a reference
* to the caller.
*
- * To delete a #GtkWindow, call gtk_widget_destroy().
+ * To delete a #GtkWindow, call gtk_window_destroy().
*
* Returns: a new #GtkWindow.
**/
@@ -3288,7 +3288,7 @@ gtk_window_dispose (GObject *object)
static void
parent_destroyed_callback (GtkWindow *parent, GtkWindow *child)
{
- gtk_widget_destroy (GTK_WIDGET (child));
+ gtk_window_destroy (child);
}
static void
@@ -6917,7 +6917,7 @@ gtk_window_unrealize (GtkWidget *widget)
if (priv->popup_menu)
{
- gtk_widget_destroy (priv->popup_menu);
+ gtk_window_destroy (GTK_WINDOW (priv->popup_menu));
priv->popup_menu = NULL;
}
@@ -8093,7 +8093,7 @@ gtk_window_do_popup_fallback (GtkWindow *window,
gboolean maximized, iconified;
if (priv->popup_menu)
- gtk_widget_destroy (priv->popup_menu);
+ gtk_window_destroy (GTK_WINDOW (priv->popup_menu));
state = gtk_window_get_state (window);
@@ -10601,7 +10601,7 @@ gtk_window_set_focus_visible (GtkWindow *window,
* @setting: the new value
*
* Tells GTK+ whether to drop its extra reference to the window
- * when gtk_widget_destroy() is called.
+ * when gtk_window_destroy() is called.
*
* This function is only exported for the benefit of language
* bindings which may need to keep the window alive until their
@@ -10844,7 +10844,7 @@ warn_response (GtkDialog *dialog,
check = g_object_get_data (G_OBJECT (dialog), "check");
remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_window_destroy (GTK_WINDOW (dialog));
g_object_set_data (G_OBJECT (inspector_window), "warning_dialog", NULL);
if (response == GTK_RESPONSE_NO)
{
@@ -10857,11 +10857,11 @@ warn_response (GtkDialog *dialog,
}
/* Steal reference into temp variable, so not to mess up with
- * inspector_window during gtk_widget_destroy().
+ * inspector_window during gtk_window_destroy().
*/
window = inspector_window;
inspector_window = NULL;
- gtk_widget_destroy (window);
+ gtk_window_destroy (GTK_WINDOW (window));
}
else
{
@@ -11427,6 +11427,6 @@ gtk_window_destroy (GtkWindow *window)
{
g_return_if_fail (GTK_IS_WINDOW (window));
- /* TODO: Remove this call to gtk_widget_destroy */
- gtk_widget_destroy (GTK_WIDGET (window));
+ if (!gtk_widget_in_destruction (GTK_WIDGET (window)))
+ g_object_run_dispose (G_OBJECT (window));
}
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 9ef5601..382aee3 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -183,17 +183,17 @@ GDK_AVAILABLE_IN_ALL
gboolean gtk_window_activate_default (GtkWindow *window);
GDK_AVAILABLE_IN_ALL
-void gtk_window_set_transient_for (GtkWindow *window,
+void gtk_window_set_transient_for (GtkWindow *window,
GtkWindow *parent);
GDK_AVAILABLE_IN_ALL
GtkWindow *gtk_window_get_transient_for (GtkWindow *window);
GDK_AVAILABLE_IN_3_4
-void gtk_window_set_attached_to (GtkWindow *window,
+void gtk_window_set_attached_to (GtkWindow *window,
GtkWidget *attach_widget);
GDK_AVAILABLE_IN_3_4
GtkWidget *gtk_window_get_attached_to (GtkWindow *window);
GDK_AVAILABLE_IN_ALL
-void gtk_window_set_type_hint (GtkWindow *window,
+void gtk_window_set_type_hint (GtkWindow *window,
GdkWindowTypeHint hint);
GDK_AVAILABLE_IN_ALL
GdkWindowTypeHint gtk_window_get_type_hint (GtkWindow *window);
diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c
index cd6f413..910be69 100644
--- a/gtk/inspector/actions.c
+++ b/gtk/inspector/actions.c
@@ -265,7 +265,7 @@ row_activated (GtkTreeView *tv,
gtk_container_add (GTK_CONTAINER (popover), editor);
gtk_popover_popup (GTK_POPOVER (popover));
- g_signal_connect (popover, "hide", G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (popover, "hide", G_CALLBACK (g_object_unref), NULL);
g_free (name);
g_free (prefix);
diff --git a/gtk/inspector/css-editor.c b/gtk/inspector/css-editor.c
index 52417be..99f4d0d 100644
--- a/gtk/inspector/css-editor.c
+++ b/gtk/inspector/css-editor.c
@@ -162,7 +162,7 @@ save_to_file (GtkInspectorCssEditor *ce,
_("Saving CSS failed"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", error->message);
- g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_error_free (error);
}
@@ -186,7 +186,7 @@ save_response (GtkWidget *dialog,
g_free (filename);
}
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
diff --git a/gtk/inspector/css-node-tree.c b/gtk/inspector/css-node-tree.c
index fa9fcc2..0d9d69c 100644
--- a/gtk/inspector/css-node-tree.c
+++ b/gtk/inspector/css-node-tree.c
@@ -104,7 +104,7 @@ show_node_prop_editor (NodePropEditor *npe)
gtk_popover_popup (GTK_POPOVER (popover));
- g_signal_connect (popover, "unmap", G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (popover, "unmap", G_CALLBACK (g_object_unref), NULL);
}
static void
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index 20000e1..6c489b7 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -394,7 +394,7 @@ populate_display (GdkScreen *screen, GtkInspectorGeneral *gen)
gtk_widget_is_ancestor (gen->priv->display_composited, child))
continue;
- gtk_widget_destroy (child);
+ gtk_container_remove (GTK_CONTAINER (list), child);
}
g_list_free (children);
@@ -622,10 +622,9 @@ populate_seats (GtkInspectorGeneral *gen)
GList *list, *l;
int i;
- list = gtk_container_get_children (GTK_CONTAINER (gen->priv->device_box));
- for (l = list; l; l = l->next)
- gtk_widget_destroy (GTK_WIDGET (l->data));
- g_list_free (list);
+ gtk_container_foreach (GTK_CONTAINER (gen->priv->device_box),
+ (GtkCallback)gtk_container_remove_callback,
+ gen->priv->device_box);
list = gdk_display_list_seats (display);
diff --git a/gtk/inspector/misc-info.c b/gtk/inspector/misc-info.c
index 2c36418..7140e68 100644
--- a/gtk/inspector/misc-info.c
+++ b/gtk/inspector/misc-info.c
@@ -345,7 +345,8 @@ update_info (gpointer data)
AtkRole role;
GList *list, *l;
- gtk_container_forall (GTK_CONTAINER (sl->priv->mnemonic_label), (GtkCallback)gtk_widget_destroy, NULL);
+ gtk_container_forall (GTK_CONTAINER (sl->priv->mnemonic_label),
+ (GtkCallback)gtk_container_remove_callback, sl->priv->mnemonic_label);
list = gtk_widget_list_mnemonic_labels (GTK_WIDGET (sl->priv->object));
for (l = list; l; l = l->next)
{
diff --git a/gtk/inspector/prop-list.c b/gtk/inspector/prop-list.c
index ff108d7..aad909f 100644
--- a/gtk/inspector/prop-list.c
+++ b/gtk/inspector/prop-list.c
@@ -238,7 +238,7 @@ row_activated (GtkTreeView *tv,
gtk_popover_popup (GTK_POPOVER (popover));
- g_signal_connect (popover, "unmap", G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (popover, "unmap", G_CALLBACK (g_object_unref), NULL);
g_free (name);
}
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index 2ffbcdb..7c6315b 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -278,7 +278,7 @@ render_node_save_response (GtkWidget *dialog,
_("Saving RenderNode failed"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
- g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
g_error_free (error);
}
@@ -286,7 +286,7 @@ render_node_save_response (GtkWidget *dialog,
g_bytes_unref (bytes);
}
- gtk_widget_destroy (dialog);
+ gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
diff --git a/gtk/inspector/strv-editor.c b/gtk/inspector/strv-editor.c
index 0ea973b..cddd63b 100644
--- a/gtk/inspector/strv-editor.c
+++ b/gtk/inspector/strv-editor.c
@@ -49,7 +49,8 @@ static void
remove_string (GtkButton *button,
GtkInspectorStrvEditor *editor)
{
- gtk_widget_destroy (gtk_widget_get_parent (GTK_WIDGET (button)));
+ gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (GTK_WIDGET (button))),
+ GTK_WIDGET (button));
emit_changed (editor);
}
@@ -128,15 +129,11 @@ void
gtk_inspector_strv_editor_set_strv (GtkInspectorStrvEditor *editor,
gchar **strv)
{
- GList *children, *l;
gint i;
editor->blocked = TRUE;
- children = gtk_container_get_children (GTK_CONTAINER (editor->box));
- for (l = children; l; l = l->next)
- gtk_widget_destroy (GTK_WIDGET (l->data));
- g_list_free (children);
+ gtk_container_foreach (GTK_CONTAINER (editor->box), (GtkCallback)gtk_container_remove_callback,
editor->box);
if (strv)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]