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

Jérôme Guelfucci noreply at xfce.org
Thu Nov 26 23:36:01 CET 2009


Updating branch refs/heads/jeromeg/clipboard-daemon
         to 8eec502d2a75de6cdcc82da64545b54e05697716 (commit)
       from 88edd8db7346f72b5aca8605c73d6d0cd7a7ccc7 (commit)

commit 8eec502d2a75de6cdcc82da64545b54e05697716
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