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

Mike Massonnet mmassonnet at xfce.org
Sat Apr 11 16:42:38 CEST 2009


Author: mmassonnet
Date: 2009-04-11 14:42:38 +0000 (Sat, 11 Apr 2009)
New Revision: 7166

Modified:
   xfce4-clipman-plugin/trunk/ChangeLog
   xfce4-clipman-plugin/trunk/panel-plugin/collector.c
Log:
Set Clipman the owner of a text content only on specific target

Modified: xfce4-clipman-plugin/trunk/ChangeLog
===================================================================
--- xfce4-clipman-plugin/trunk/ChangeLog	2009-04-11 12:46:21 UTC (rev 7165)
+++ xfce4-clipman-plugin/trunk/ChangeLog	2009-04-11 14:42:38 UTC (rev 7166)
@@ -1,4 +1,14 @@
 2009-04-02	Mike Massonnet
+Set Clipman the owner of a text content only on specific target
+
+	- panel-plugin/collector.c(cb_clipboard_owner_change):
+		Check target of text content and make Clipman the owner of the
+		text only if the targets text/plain or text/html is available.
+	- panel-plugin/collector.c(cb_check_primary_clipboard):
+		Useless call to clipman_history_add_text() as the text is going
+		into the default clipboard.
+
+2009-04-02	Mike Massonnet
 New test program to report targets
 
 2009-04-02	Mike Massonnet

Modified: xfce4-clipman-plugin/trunk/panel-plugin/collector.c
===================================================================
--- xfce4-clipman-plugin/trunk/panel-plugin/collector.c	2009-04-11 12:46:21 UTC (rev 7165)
+++ xfce4-clipman-plugin/trunk/panel-plugin/collector.c	2009-04-11 14:42:38 UTC (rev 7166)
@@ -91,6 +91,7 @@
   gboolean has_image;
   gchar *text;
   GdkPixbuf *image;
+  GdkAtom text_plain, text_html;
 
   /* Take only care of new clipboard content */
   if (event->reason != GDK_OWNER_CHANGE_NEW_OWNER)
@@ -114,9 +115,15 @@
           text = gtk_clipboard_wait_for_text (collector->priv->default_clipboard);
           if (text != NULL && text[0] != '\0')
             {
-              /* Make Clipman the owner */
-              collector->priv->internal_change = TRUE;
-              gtk_clipboard_set_text (collector->priv->default_clipboard, text, -1);
+              /* Make Clipman the owner only if it has the target text/plain or text/html */
+              text_plain = gdk_atom_intern_static_string ("text/plain");
+              text_html = gdk_atom_intern_static_string ("text/html");
+              if (gtk_clipboard_wait_is_target_available (collector->priv->default_clipboard, text_plain)
+                  || gtk_clipboard_wait_is_target_available (collector->priv->default_clipboard, text_html))
+                {
+                  collector->priv->internal_change = TRUE;
+                  gtk_clipboard_set_text (collector->priv->default_clipboard, text, -1);
+                }
 
               /* Add to history */
               clipman_history_add_text (collector->priv->history, text);
@@ -170,16 +177,10 @@
       text = gtk_clipboard_wait_for_text (collector->priv->primary_clipboard);
       if (text != NULL && text[0] != '\0')
         {
+          /* Make a copy inside the default clipboard */
           if (collector->priv->add_primary_clipboard)
-            {
-              /* Add to history */
-              clipman_history_add_text (collector->priv->history, text);
+            gtk_clipboard_set_text (collector->priv->default_clipboard, text, -1);
 
-              /* Make a copy inside the default clipboard */
-              collector->priv->internal_change = TRUE;
-              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, text);




More information about the Goodies-commits mailing list