[gtk/window-destroy: 10/16] window: Implement gtk_window_destroy
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/window-destroy: 10/16] window: Implement gtk_window_destroy
- Date: Sat, 9 May 2020 23:52:50 +0000 (UTC)
commit e70cc7a806cb2093fb3d5e2ce6fefa336cee6ee7
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 9 15:20:59 2020 -0400
window: Implement gtk_window_destroy
Don't call gtk_widget_destroy; instead implement
gtk_window_destroy outselves by removing the window
from the toplevel lista and dropping the reference that
GTK holds.
gtk/gtkwindow.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 024c2edacc..a9e8c5d922 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -2626,31 +2626,12 @@ gtk_window_dispose (GObject *object)
{
GtkWindow *window = GTK_WINDOW (object);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
- guint i;
gtk_window_release_application (window);
- for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (toplevel_list)); i++)
- {
- gpointer item = g_list_model_get_item (G_LIST_MODEL (toplevel_list), i);
- if (item == window)
- {
- g_list_store_remove (toplevel_list, i);
- break;
- }
- else
- g_object_unref (item);
- }
-
if (priv->transient_parent)
gtk_window_set_transient_for (window, NULL);
- if (priv->has_user_ref_count)
- {
- priv->has_user_ref_count = FALSE;
- g_object_unref (window);
- }
-
if (priv->group)
gtk_window_group_remove_window (priv->group, window);
@@ -8026,7 +8007,22 @@ gtk_window_get_child (GtkWindow *window)
void
gtk_window_destroy (GtkWindow *window)
{
+ int i;
+
g_return_if_fail (GTK_IS_WINDOW (window));
- gtk_widget_destroy (GTK_WIDGET (window));
+ for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (toplevel_list)); i++)
+ {
+ gpointer item = g_list_model_get_item (G_LIST_MODEL (toplevel_list), i);
+ if (item == window)
+ {
+ g_list_store_remove (toplevel_list, i);
+ break;
+ }
+ else
+ g_object_unref (item);
+ }
+
+ gtk_widget_hide (GTK_WIDGET (window));
+ g_object_unref (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]