[Xfce4-commits] <xfce4-clipman-plugin:master> actions: allow skipping actions by pressing or not CTRL (bug 10506)

Mike Massonnet noreply at xfce.org
Sun Feb 2 11:48:01 CET 2014


Updating branch refs/heads/master
         to 547218e1f5710465d6fdb761c8d7cb96a81c9558 (commit)
       from ce9057f5df0a9ea2ff731486a20e66632f0b2b35 (commit)

commit 547218e1f5710465d6fdb761c8d7cb96a81c9558
Author: Mike Massonnet <m8t at gandi.net>
Date:   Sat Feb 1 16:55:16 2014 +0100

    actions: allow skipping actions by pressing or not CTRL (bug 10506)

 panel-plugin/actions.c                |   10 ++++++++--
 panel-plugin/settings-dialog.ui       |   21 +++++++++++++++++++--
 panel-plugin/xfce4-clipman-settings.c |   14 ++++++++++----
 3 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/panel-plugin/actions.c b/panel-plugin/actions.c
index fc8254d..579a020 100644
--- a/panel-plugin/actions.c
+++ b/panel-plugin/actions.c
@@ -688,10 +688,16 @@ clipman_actions_match_with_menu (ClipmanActions *actions,
   GSList *l, *entries;
   GdkModifierType state;
 
-  if (actions->priv->skip_action_on_key_down && group == ACTION_GROUP_SELECTION)
+  if (group == ACTION_GROUP_SELECTION)
     {
+      gint ctrl_mask = 0;
       gdk_window_get_pointer (NULL, NULL, NULL, &state);
-      if (state & GDK_CONTROL_MASK)
+      ctrl_mask = state & GDK_CONTROL_MASK;
+      if (ctrl_mask && actions->priv->skip_action_on_key_down)
+        {
+          return;
+        }
+      else if (!ctrl_mask && !actions->priv->skip_action_on_key_down)
         {
           return;
         }
diff --git a/panel-plugin/settings-dialog.ui b/panel-plugin/settings-dialog.ui
index 946193c..7e4c6f1 100644
--- a/panel-plugin/settings-dialog.ui
+++ b/panel-plugin/settings-dialog.ui
@@ -460,8 +460,25 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="skip-action">
+                  <object class="GtkRadioButton" id="skip-action-1">
+                    <property name="label" translatable="yes">_Show actions by holding Control</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes">When the selection is done (mouse or keyboard) and the Control key is still pressed down, the popup menu for matched actions will be shown</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="skip-action-2">
                     <property name="label" translatable="yes">_Skip actions by holding Control</property>
+                    <property name="group">skip-action-1</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
@@ -472,7 +489,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">4</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
               </object>
diff --git a/panel-plugin/xfce4-clipman-settings.c b/panel-plugin/xfce4-clipman-settings.c
index 38e38be..6e87798 100644
--- a/panel-plugin/xfce4-clipman-settings.c
+++ b/panel-plugin/xfce4-clipman-settings.c
@@ -155,10 +155,14 @@ prop_dialog_run (void)
                                 DEFAULT_REORDER_ITEMS);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "reverse-order")),
                                 DEFAULT_REVERSE_ORDER);
-  gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "skip-action")),
+  gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "skip-action-1")),
                             DEFAULT_ENABLE_ACTIONS);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "skip-action")),
+  gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "skip-action-2")),
+                            DEFAULT_ENABLE_ACTIONS);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "skip-action-1")),
                                 DEFAULT_SKIP_ACTION_ON_KEY_DOWN);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "skip-action-2")),
+                                !DEFAULT_SKIP_ACTION_ON_KEY_DOWN);
 
   xfconf_g_property_bind (xfconf_channel, "/tweaks/popup-at-pointer", G_TYPE_BOOLEAN,
                           gtk_builder_get_object (builder, "popup-at-pointer"), "active");
@@ -167,9 +171,11 @@ prop_dialog_run (void)
   xfconf_g_property_bind (xfconf_channel, "/tweaks/reverse-menu-order", G_TYPE_BOOLEAN,
                           gtk_builder_get_object (builder, "reverse-order"), "active");
   xfconf_g_property_bind (xfconf_channel, "/settings/enable-actions", G_TYPE_BOOLEAN,
-                          gtk_builder_get_object (builder, "skip-action"), "sensitive");
+                          gtk_builder_get_object (builder, "skip-action-1"), "sensitive");
+  xfconf_g_property_bind (xfconf_channel, "/settings/enable-actions", G_TYPE_BOOLEAN,
+                          gtk_builder_get_object (builder, "skip-action-2"), "sensitive");
   xfconf_g_property_bind (xfconf_channel, "/tweaks/skip-action-on-key-down", G_TYPE_BOOLEAN,
-                          gtk_builder_get_object (builder, "skip-action"), "active");
+                          gtk_builder_get_object (builder, "skip-action-1"), "active");
 
   /* Tweaks tab: paste-on-activate combobox */
   combobox = GTK_WIDGET (gtk_builder_get_object (builder, "combobox-paste-on-activate"));


More information about the Xfce4-commits mailing list