[Goodies-commits] r7272 - in xfce4-clipman-plugin/trunk: . panel-plugin

Mike Massonnet mmassonnet at xfce.org
Wed Apr 22 22:14:29 CEST 2009


Author: mmassonnet
Date: 2009-04-22 20:14:29 +0000 (Wed, 22 Apr 2009)
New Revision: 7272

Modified:
   xfce4-clipman-plugin/trunk/ChangeLog
   xfce4-clipman-plugin/trunk/panel-plugin/collector.c
   xfce4-clipman-plugin/trunk/panel-plugin/common.h
   xfce4-clipman-plugin/trunk/panel-plugin/main.c
   xfce4-clipman-plugin/trunk/panel-plugin/settings-dialog.glade
Log:
New option to exclude selections from the history

Modified: xfce4-clipman-plugin/trunk/ChangeLog
===================================================================
--- xfce4-clipman-plugin/trunk/ChangeLog	2009-04-22 13:45:30 UTC (rev 7271)
+++ xfce4-clipman-plugin/trunk/ChangeLog	2009-04-22 20:14:29 UTC (rev 7272)
@@ -1,4 +1,20 @@
 2009-04-21	Mike Massonnet
+New option to exclude selections from the history
+
+	- panel-plugin/settings-dialog.glade:
+		Move option "Add selections" to new frame "Behavior" and add a
+		new option that allows to exclude the selections from the
+		history.
+	- panel-plugin/collector.c:
+		Install a new property history-ignore-primary-clipboard use it
+		inside cb_check_primary_clipboard() to prevent a selection
+		from going into the history.
+	- panel-plugin/main.c:
+		Bind new property to xfconf and the settings dialog.
+	- panel-plugin/common.h:
+		New default setting for history-ignore-primary-clipboard.
+
+2009-04-21	Mike Massonnet
 Refixing the last two commits with the right function calls
 
 	- panel-plugin/main.c:

Modified: xfce4-clipman-plugin/trunk/panel-plugin/collector.c
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/collector.c	2009-04-22 13:45:30 UTC (rev 7271)
+++ xfce4-clipman-plugin/trunk/panel-plugin/collector.c	2009-04-22 20:14:29 UTC (rev 7272)
@@ -47,6 +47,7 @@
   guint                 primary_clipboard_timeout;
   gboolean              internal_change;
   gboolean              add_primary_clipboard;
+  gboolean              history_ignore_primary_clipboard;
   gboolean              enable_actions;
   gboolean              inhibit;
 };
@@ -54,6 +55,7 @@
 enum
 {
   ADD_PRIMARY_CLIPBOARD = 1,
+  HISTORY_IGNORE_PRIMARY_CLIPBOARD,
   ENABLE_ACTIONS,
   INHIBIT,
 };
@@ -183,6 +185,11 @@
       text = gtk_clipboard_wait_for_text (collector->priv->primary_clipboard);
       if (text != NULL && text[0] != '\0')
         {
+          /* Avoid history */
+          if (collector->priv->add_primary_clipboard
+              && collector->priv->history_ignore_primary_clipboard)
+            collector->priv->internal_change = TRUE;
+
           /* Make a copy inside the default clipboard */
           if (collector->priv->add_primary_clipboard)
             gtk_clipboard_set_text (collector->priv->default_clipboard, text, -1);
@@ -272,10 +279,17 @@
   g_object_class_install_property (object_class, ADD_PRIMARY_CLIPBOARD,
                                    g_param_spec_boolean ("add-primary-clipboard",
                                                          "AddPrimaryClipboard",
-                                                         "Add the primary clipboard to the history",
+                                                         "Sync the primary clipboard with the default clipboard",
                                                          DEFAULT_ADD_PRIMARY_CLIPBOARD,
                                                          G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
 
+  g_object_class_install_property (object_class, HISTORY_IGNORE_PRIMARY_CLIPBOARD,
+                                   g_param_spec_boolean ("history-ignore-primary-clipboard",
+                                                         "HistoryIgnorePrimaryClipboard",
+                                                         "Exclude the primary clipboard contents from the history",
+                                                         DEFAULT_HISTORY_IGNORE_PRIMARY_CLIPBOARD,
+                                                         G_PARAM_CONSTRUCT|G_PARAM_READWRITE));
+
   g_object_class_install_property (object_class, ENABLE_ACTIONS,
                                    g_param_spec_boolean ("enable-actions",
                                                          "EnableActions",
@@ -343,6 +357,10 @@
       priv->add_primary_clipboard = g_value_get_boolean (value);
       break;
 
+    case HISTORY_IGNORE_PRIMARY_CLIPBOARD:
+      priv->history_ignore_primary_clipboard = g_value_get_boolean (value);
+      break;
+
     case ENABLE_ACTIONS:
       priv->enable_actions = g_value_get_boolean (value);
       break;
@@ -370,6 +388,10 @@
       g_value_set_boolean (value, priv->add_primary_clipboard);
       break;
 
+    case HISTORY_IGNORE_PRIMARY_CLIPBOARD:
+      g_value_set_boolean (value, priv->history_ignore_primary_clipboard);
+      break;
+
     case ENABLE_ACTIONS:
       g_value_set_boolean (value, priv->enable_actions);
       break;

Modified: xfce4-clipman-plugin/trunk/panel-plugin/common.h
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/common.h	2009-04-22 13:45:30 UTC (rev 7271)
+++ xfce4-clipman-plugin/trunk/panel-plugin/common.h	2009-04-22 20:14:29 UTC (rev 7272)
@@ -23,13 +23,14 @@
  */
 
 /* History */
-#define DEFAULT_MAX_TEXTS_IN_HISTORY            10
-#define DEFAULT_MAX_IMAGES_IN_HISTORY           1
-#define DEFAULT_SAVE_ON_QUIT                    TRUE
+#define DEFAULT_MAX_TEXTS_IN_HISTORY                    10
+#define DEFAULT_MAX_IMAGES_IN_HISTORY                   1
+#define DEFAULT_SAVE_ON_QUIT                            TRUE
 
 /* Collector */
-#define DEFAULT_ADD_PRIMARY_CLIPBOARD           FALSE
-#define DEFAULT_ENABLE_ACTIONS                  FALSE
+#define DEFAULT_ADD_PRIMARY_CLIPBOARD                   FALSE
+#define DEFAULT_HISTORY_IGNORE_PRIMARY_CLIPBOARD        FALSE
+#define DEFAULT_ENABLE_ACTIONS                          FALSE
 
 /*
  * Selection for the popup command

Modified: xfce4-clipman-plugin/trunk/panel-plugin/main.c
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/main.c	2009-04-22 13:45:30 UTC (rev 7271)
+++ xfce4-clipman-plugin/trunk/panel-plugin/main.c	2009-04-22 20:14:29 UTC (rev 7272)
@@ -251,6 +251,8 @@
   plugin->collector = clipman_collector_get ();
   xfconf_g_property_bind (plugin->channel, "/settings/add-primary-clipboard",
                           G_TYPE_BOOLEAN, plugin->collector, "add-primary-clipboard");
+  xfconf_g_property_bind (plugin->channel, "/settings/history-ignore-primary-clipboard",
+                          G_TYPE_BOOLEAN, plugin->collector, "history-ignore-primary-clipboard");
   xfconf_g_property_bind (plugin->channel, "/settings/enable-actions",
                           G_TYPE_BOOLEAN, plugin->collector, "enable-actions");
   xfconf_g_property_bind (plugin->channel, "/inhibit",
@@ -707,18 +709,24 @@
   gtk_window_group_add_window (group, GTK_WINDOW (action_dialog));
 
   /* General settings */
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (plugin->gxml, "add-selections")),
+                                DEFAULT_ADD_PRIMARY_CLIPBOARD);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (plugin->gxml, "history-ignore-selections")),
+                                DEFAULT_HISTORY_IGNORE_PRIMARY_CLIPBOARD);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (plugin->gxml, "save-on-quit")),
                                 DEFAULT_SAVE_ON_QUIT);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (plugin->gxml, "add-selections")),
-                                DEFAULT_ADD_PRIMARY_CLIPBOARD);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_xml_get_widget (plugin->gxml, "store-an-image")),
                                 (gboolean)DEFAULT_MAX_IMAGES_IN_HISTORY);
   gtk_spin_button_set_value (GTK_SPIN_BUTTON (glade_xml_get_widget (plugin->gxml, "max-texts-in-history")),
                              (gdouble)DEFAULT_MAX_TEXTS_IN_HISTORY);
+  xfconf_g_property_bind (plugin->channel, "/settings/add-primary-clipboard", G_TYPE_BOOLEAN,
+                          G_OBJECT (glade_xml_get_widget (plugin->gxml, "add-selections")), "active");
+  xfconf_g_property_bind (plugin->channel, "/settings/add-primary-clipboard", G_TYPE_BOOLEAN,
+                          G_OBJECT (glade_xml_get_widget (plugin->gxml, "history-ignore-selections")), "sensitive");
+  xfconf_g_property_bind (plugin->channel, "/settings/history-ignore-primary-clipboard", G_TYPE_BOOLEAN,
+                          G_OBJECT (glade_xml_get_widget (plugin->gxml, "history-ignore-selections")), "active");
   xfconf_g_property_bind (plugin->channel, "/settings/save-on-quit", G_TYPE_BOOLEAN,
                           G_OBJECT (glade_xml_get_widget (plugin->gxml, "save-on-quit")), "active");
-  xfconf_g_property_bind (plugin->channel, "/settings/add-primary-clipboard", G_TYPE_BOOLEAN,
-                          G_OBJECT (glade_xml_get_widget (plugin->gxml, "add-selections")), "active");
   xfconf_g_property_bind (plugin->channel, "/settings/max-images-in-history", G_TYPE_UINT,
                           G_OBJECT (glade_xml_get_widget (plugin->gxml, "store-an-image")), "active");
   xfconf_g_property_bind (plugin->channel, "/settings/max-texts-in-history", G_TYPE_UINT,

Modified: xfce4-clipman-plugin/trunk/panel-plugin/settings-dialog.glade
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/settings-dialog.glade	2009-04-22 13:45:30 UTC (rev 7271)
+++ xfce4-clipman-plugin/trunk/panel-plugin/settings-dialog.glade	2009-04-22 20:14:29 UTC (rev 7272)
@@ -29,26 +29,29 @@
                 <property name="border_width">6</property>
                 <property name="spacing">2</property>
                 <child>
-                  <widget class="GtkFrame" id="frame1">
+                  <widget class="GtkFrame" id="frame2">
                     <property name="visible">True</property>
                     <property name="label_xalign">0</property>
                     <property name="shadow_type">none</property>
                     <child>
-                      <widget class="GtkAlignment" id="alignment1">
+                      <widget class="GtkAlignment" id="alignment3">
                         <property name="visible">True</property>
                         <property name="top_padding">6</property>
+                        <property name="bottom_padding">6</property>
                         <property name="left_padding">12</property>
                         <child>
-                          <widget class="GtkVBox" id="vbox2">
+                          <widget class="GtkVBox" id="vbox5">
                             <property name="visible">True</property>
+                            <property name="orientation">vertical</property>
                             <property name="spacing">6</property>
                             <child>
-                              <widget class="GtkCheckButton" id="save-on-quit">
-                                <property name="label" translatable="yes">Save on _quit</property>
+                              <widget class="GtkCheckButton" id="add-selections">
+                                <property name="label" translatable="yes">Add _selections</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
-                                <property name="tooltip" translatable="yes">If checked, this option will restore the history on every new Xfce session</property>
+                                <property name="has_tooltip">True</property>
+                                <property name="tooltip" translatable="yes">If checked, the selections will be synced with the default clipboard in a way that you can paste what you select</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
                               </widget>
@@ -57,17 +60,73 @@
                               </packing>
                             </child>
                             <child>
-                              <widget class="GtkCheckButton" id="add-selections">
-                                <property name="label" translatable="yes">Add _selections</property>
+                              <widget class="GtkAlignment" id="alignment4">
                                 <property name="visible">True</property>
+                                <property name="left_padding">12</property>
+                                <child>
+                                  <widget class="GtkCheckButton" id="history-ignore-selections">
+                                    <property name="label" translatable="yes">E_xclude from history</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">False</property>
+                                    <property name="tooltip" translatable="yes">If checked, the selections won't affect the history except the manual copies</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="draw_indicator">True</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes"><b>Behavior</b></property>
+                        <property name="use_markup">True</property>
+                      </widget>
+                      <packing>
+                        <property name="type">label_item</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkFrame" id="frame1">
+                    <property name="visible">True</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment1">
+                        <property name="visible">True</property>
+                        <property name="top_padding">6</property>
+                        <property name="bottom_padding">6</property>
+                        <property name="left_padding">12</property>
+                        <child>
+                          <widget class="GtkVBox" id="vbox2">
+                            <property name="visible">True</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <widget class="GtkCheckButton" id="save-on-quit">
+                                <property name="label" translatable="yes">Save on _quit</property>
+                                <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="receives_default">False</property>
-                                <property name="tooltip" translatable="yes">If checked, the selections will go into the history. This behavior can bring the history to be unreadable, however it can be interesting in case you always want to paste what you select.</property>
+                                <property name="tooltip" translatable="yes">If checked, this option will restore the history on every new Xfce session</property>
                                 <property name="use_underline">True</property>
                                 <property name="draw_indicator">True</property>
                               </widget>
                               <packing>
-                                <property name="position">1</property>
+                                <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
@@ -81,7 +140,7 @@
                                 <property name="draw_indicator">True</property>
                               </widget>
                               <packing>
-                                <property name="position">2</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
@@ -116,7 +175,7 @@
                                 </child>
                               </widget>
                               <packing>
-                                <property name="position">3</property>
+                                <property name="position">2</property>
                               </packing>
                             </child>
                           </widget>
@@ -137,7 +196,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">0</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </widget>




More information about the Goodies-commits mailing list