[libwnck] core: Rely on finalize() instead of manual shutdown() functions



commit bb27586c2cb81bb650d2a2d8a183ac89fccf5960
Author: Vincent Untz <vuntz gnome org>
Date:   Mon Jan 30 14:22:33 2012 +0100

    core: Rely on finalize() instead of manual shutdown() functions
    
    For WnckScreen and WnckWindow, there was a manual shutdown function
    called for each object. However, when we shut down, we know that the
    object will have no reference left and will get finalized. So we can
    simply rely on the finalize() functions.

 libwnck/private.h |    2 --
 libwnck/screen.c  |   26 +++++++++-----------------
 libwnck/window.c  |   12 +++++-------
 3 files changed, 14 insertions(+), 26 deletions(-)
---
diff --git a/libwnck/private.h b/libwnck/private.h
index 4175f70..d92eda7 100644
--- a/libwnck/private.h
+++ b/libwnck/private.h
@@ -55,7 +55,6 @@ WnckWindow* _wnck_window_create  (Window      xwindow,
                                   WnckScreen *screen,
                                   gint        sort_order);
 void        _wnck_window_destroy (WnckWindow *window);
-void        _wnck_window_shutdown (WnckWindow *window);
 
 char*       _wnck_window_get_name_for_display (WnckWindow *window,
                                                gboolean    use_icon_name,
@@ -106,7 +105,6 @@ void _wnck_screen_change_workspace_name (WnckScreen *screen,
                                          int         number,
                                          const char *name);
 
-void _wnck_screen_shutdown              (WnckScreen *screen);
 void _wnck_screen_shutdown_all          (void);
 
 gboolean _wnck_workspace_set_geometry (WnckWorkspace *space, int w, int h);
diff --git a/libwnck/screen.c b/libwnck/screen.c
index 11f4e30..c47640c 100644
--- a/libwnck/screen.c
+++ b/libwnck/screen.c
@@ -513,6 +513,11 @@ wnck_screen_finalize (GObject *object)
 
   screen = WNCK_SCREEN (object);
 
+  _wnck_select_input (screen->priv->xscreen,
+                      screen->priv->xroot,
+                      0,
+                      FALSE);
+
   unqueue_update (screen);
 
   for (tmp = screen->priv->stacked_windows; tmp; tmp = tmp->next)
@@ -2758,21 +2763,6 @@ _wnck_screen_change_workspace_name (WnckScreen *screen,
 }
 
 void
-_wnck_screen_shutdown (WnckScreen *screen)
-{
-  GList *item;
-  g_return_if_fail (WNCK_IS_SCREEN (screen));
-
-  _wnck_select_input (screen->priv->xscreen,
-                      screen->priv->xroot,
-                      0,
-                      FALSE);
-  for (item = screen->priv->mapped_windows; item != NULL; item = g_list_next (item))
-    _wnck_window_shutdown (WNCK_WINDOW (item->data));
-  wnck_screen_finalize (G_OBJECT (screen));
-}
-
-void
 _wnck_screen_shutdown_all (void)
 {
   int i;
@@ -2785,8 +2775,10 @@ _wnck_screen_shutdown_all (void)
 
   for (i = 0; i < ScreenCount (display); ++i)
     {
-      if (screens[i] != NULL)
-        _wnck_screen_shutdown (screens[i]);
+      if (screens[i] != NULL) {
+        g_object_unref (screens[i]);
+        screens[i] = NULL;
+      }
     }
 
   g_free (screens);
diff --git a/libwnck/window.c b/libwnck/window.c
index 8d77a50..e78af89 100644
--- a/libwnck/window.c
+++ b/libwnck/window.c
@@ -418,6 +418,11 @@ wnck_window_finalize (GObject *object)
 
   window = WNCK_WINDOW (object);
 
+  _wnck_select_input (WNCK_SCREEN_XSCREEN (window->priv->screen),
+                      window->priv->xwindow,
+                      window->priv->orig_event_mask,
+                      FALSE);
+
   unqueue_update (window);
 
   if (window->priv->app)
@@ -590,13 +595,6 @@ _wnck_window_destroy (WnckWindow *window)
   g_return_if_fail (wnck_window_get (xwindow) == NULL);
 }
 
-void
-_wnck_window_shutdown (WnckWindow *window)
-{
-  _wnck_select_input (WNCK_SCREEN_XSCREEN (window->priv->screen),
-          window->priv->xwindow, window->priv->orig_event_mask, FALSE);
-}
-
 static Display *
 _wnck_window_get_display (WnckWindow *window)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]