[Xfce4-commits] <xfce4-settings:master> Don't use a singleton for the gobject.

Jérôme Guelfucci noreply at xfce.org
Sat Jan 2 13:00:08 CET 2010


Updating branch refs/heads/master
         to 03089bb3d1385e2b5aea047ec2267283d73519c4 (commit)
       from 60bb3e5b9eb9446f5848ab7d2900d6455efe2369 (commit)

commit 03089bb3d1385e2b5aea047ec2267283d73519c4
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Thu Nov 26 23:35:09 2009 +0100

    Don't use a singleton for the gobject.

 xfce4-settings-helper/xfce-clipboard-manager.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/xfce4-settings-helper/xfce-clipboard-manager.c b/xfce4-settings-helper/xfce-clipboard-manager.c
index 5fdbac3..c7622d6 100644
--- a/xfce4-settings-helper/xfce-clipboard-manager.c
+++ b/xfce4-settings-helper/xfce-clipboard-manager.c
@@ -51,9 +51,6 @@ static void xfce_clipboard_manager_init       (XfceClipboardManager      *clipbo
 
 G_DEFINE_TYPE (XfceClipboardManager, xfce_clipboard_manager, G_TYPE_OBJECT)
 
-static gpointer manager_object = NULL;
-
-
 Atom XA_CLIPBOARD_MANAGER;
 Atom XA_MANAGER;
 
@@ -349,8 +346,10 @@ xfce_clipboard_manager_init (XfceClipboardManager *manager)
 {
   manager->priv = XFCE_CLIPBOARD_MANAGER_GET_PRIVATE (manager);
 
-  manager->priv->default_clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
-  manager->priv->primary_clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
+  manager->priv->default_clipboard =
+    gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  manager->priv->primary_clipboard =
+    gtk_clipboard_get (GDK_SELECTION_PRIMARY);
 
   manager->priv->default_cache = NULL;
   manager->priv->primary_cache = NULL;
@@ -359,14 +358,6 @@ xfce_clipboard_manager_init (XfceClipboardManager *manager)
 XfceClipboardManager *
 xfce_clipboard_manager_new (void)
 {
-  if (manager_object != NULL)
-    g_object_ref (manager_object);
-  else
-    {
-      manager_object = g_object_new (XFCE_TYPE_CLIPBOARD_MANAGER, NULL);
-      g_object_add_weak_pointer (manager_object,
-                                 (gpointer *) &manager_object);
-    }
-
-  return XFCE_CLIPBOARD_MANAGER (manager_object);
+ return XFCE_CLIPBOARD_MANAGER (g_object_new (XFCE_TYPE_CLIPBOARD_MANAGER,
+                                              NULL));
 }



More information about the Xfce4-commits mailing list