[Goodies-commits] r6452 - in xfce4-clipman-plugin/branches/xfce-4-6: . panel-plugin

Mike Massonnet mmassonnet at xfce.org
Tue Jan 13 21:11:00 CET 2009


Author: mmassonnet
Date: 2009-01-13 20:10:59 +0000 (Tue, 13 Jan 2009)
New Revision: 6452

Modified:
   xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog
   xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/history.c
   xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c
Log:
New property in ClipmanHistory "save-on-quit".

Modified: xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog
===================================================================
--- xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog	2009-01-13 19:51:00 UTC (rev 6451)
+++ xfce4-clipman-plugin/branches/xfce-4-6/ChangeLog	2009-01-13 20:10:59 UTC (rev 6452)
@@ -1,4 +1,13 @@
 2009-01-13	Mike Massonnet
+New property in ClipmanHistory "save-on-quit".
+
+	- panel-plugin/history.c:
+		Install new property "save-on-quit".
+	- panel-plugin/panel-plugin.c:
+		Bind property "save-on-quit" from ClipmanHistory to Xfconf and
+		use it in plugin_panel_load() and plugin_panel_save().
+
+2009-01-13	Mike Massonnet
 Save the history on disk.
 
 	- panel-plugin/history.c, panel-plugin/history.h:

Modified: xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/history.c
===================================================================
--- xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/history.c	2009-01-13 19:51:00 UTC (rev 6451)
+++ xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/history.c	2009-01-13 20:10:59 UTC (rev 6452)
@@ -40,15 +40,17 @@
 {
   GSList               *texts;
   GSList               *images;
+  const ClipmanHistoryItem *item_to_restore;
   guint                 max_texts_in_history;
   guint                 max_images_in_history;
-  const ClipmanHistoryItem *item_to_restore;
+  gboolean              save_on_quit;
 };
 
 enum
 {
   MAX_TEXTS_IN_HISTORY = 1,
   MAX_IMAGES_IN_HISTORY,
+  SAVE_ON_QUIT,
 };
 
 static void             clipman_history_class_init         (ClipmanHistoryClass *klass);
@@ -401,6 +403,13 @@
                                                       "The number of maximum images in history",
                                                       0, 5, 1,
                                                       G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
+  g_object_class_install_property (object_class,
+                                   SAVE_ON_QUIT,
+                                   g_param_spec_boolean ("save-on-quit",
+                                                         "SaveOnQuit",
+                                                         "True if the history must be saved on quit",
+                                                         TRUE,
+                                                         G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
 }
 
 static void
@@ -434,6 +443,10 @@
       priv->max_images_in_history = g_value_get_uint (value);
       break;
 
+    case SAVE_ON_QUIT:
+      priv->save_on_quit = g_value_get_boolean (value);
+      break;
+
     default:
       break;
     }
@@ -457,6 +470,10 @@
       g_value_set_uint (value, priv->max_images_in_history);
       break;
 
+    case SAVE_ON_QUIT:
+      g_value_set_boolean (value, priv->save_on_quit);
+      break;
+
     default:
       break;
     }

Modified: xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c
===================================================================
--- xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c	2009-01-13 19:51:00 UTC (rev 6451)
+++ xfce4-clipman-plugin/branches/xfce-4-6/panel-plugin/panel-plugin.c	2009-01-13 20:10:59 UTC (rev 6452)
@@ -113,6 +113,8 @@
                           G_TYPE_UINT, plugin->history, "max-texts-in-history");
   xfconf_g_property_bind (plugin->channel, "/settings/max-images-in-history",
                           G_TYPE_UINT, plugin->history, "max-images-in-history");
+  xfconf_g_property_bind (plugin->channel, "/settings/save-on-quit",
+                          G_TYPE_BOOLEAN, plugin->history, "save-on-quit");
 
   /* ClipmanCollector */
   plugin->collector = clipman_collector_get ();
@@ -176,7 +178,13 @@
   gchar *filename;
   GdkPixbuf *image;
   gint i = 0;
+  gboolean save_on_quit;
 
+  /* Return if the history must not be saved */
+  g_object_get (plugin->history, "save-on-quit", &save_on_quit, NULL);
+  if (save_on_quit == FALSE)
+    return;
+
   clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
 
   /* Load images */
@@ -225,7 +233,13 @@
   gchar *data;
   gchar *filename;
   gint n_texts, n_images;
+  gboolean save_on_quit;
 
+  /* Return if the history must not be saved */
+  g_object_get (plugin->history, "save-on-quit", &save_on_quit, NULL);
+  if (save_on_quit == FALSE)
+    return;
+
   /* Create initial directory */
   filename = xfce_resource_save_location (XFCE_RESOURCE_CACHE, "xfce4/clipman/", TRUE);
   g_free (filename);




More information about the Goodies-commits mailing list