[Xfce4-commits] <xfce4-clipman-plugin:master> actions: show the actions menu only once for the same text (bug 6633)

Mike Massonnet noreply at xfce.org
Thu Oct 20 11:42:10 CEST 2011


Updating branch refs/heads/master
         to 9a64642cb20b220a21f033cac551c81793175a7a (commit)
       from 5b38c4ee7b44682949b11f5ba3dcb4da6c98624a (commit)

commit 9a64642cb20b220a21f033cac551c81793175a7a
Author: Mike Massonnet <mmassonnet at xfce.org>
Date:   Thu Oct 20 11:24:08 2011 +0200

    actions: show the actions menu only once for the same text (bug 6633)

 panel-plugin/collector.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/collector.c b/panel-plugin/collector.c
index 10aa7b5..256f274 100644
--- a/panel-plugin/collector.c
+++ b/panel-plugin/collector.c
@@ -152,6 +152,7 @@ cb_check_primary_clipboard (ClipmanCollector *collector)
 {
   GdkModifierType state;
   gchar *text;
+  static gchar *prev_text = NULL;
 
   g_return_if_fail (GTK_IS_CLIPBOARD (collector->priv->default_clipboard) && GTK_IS_CLIPBOARD (collector->priv->primary_clipboard));
 
@@ -177,8 +178,12 @@ cb_check_primary_clipboard (ClipmanCollector *collector)
             gtk_clipboard_set_text (collector->priv->default_clipboard, text, -1);
 
           /* Match for actions */
-          if (collector->priv->enable_actions)
-            clipman_actions_match_with_menu (collector->priv->actions, ACTION_GROUP_SELECTION, text);
+          if (collector->priv->enable_actions && g_strcmp0 (text, prev_text))
+            {
+              clipman_actions_match_with_menu (collector->priv->actions, ACTION_GROUP_SELECTION, text);
+              g_free (prev_text);
+              prev_text = g_strdup (text);
+            }
         }
       g_free (text);
     }


More information about the Xfce4-commits mailing list