[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 37/37: Only "sync selections" if setting is enabled

noreply at xfce.org noreply at xfce.org
Mon Mar 23 23:30:32 CET 2020


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-clipman-plugin.

commit e448e1e0d3c0da602f6251fe11787aeb572325b8
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Mon Mar 23 22:57:58 2020 +0100

    Only "sync selections" if setting is enabled
---
 panel-plugin/menu.c                  | 12 ++++++++++--
 panel-plugin/xfce4-clipman-history.c | 14 ++++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/panel-plugin/menu.c b/panel-plugin/menu.c
index a804a52..1a6068a 100644
--- a/panel-plugin/menu.c
+++ b/panel-plugin/menu.c
@@ -133,6 +133,7 @@ cb_set_clipboard (GtkMenuItem *mi, const ClipmanHistoryItem *item)
   GtkClipboard *clipboard;
   ClipmanCollector *collector;
   ClipmanHistory *history;
+  gboolean add_primary_clipboard;
 
   switch (item->type)
     {
@@ -140,8 +141,15 @@ cb_set_clipboard (GtkMenuItem *mi, const ClipmanHistoryItem *item)
       clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
       gtk_clipboard_set_text (clipboard, item->content.text, -1);
 
-      clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
-      gtk_clipboard_set_text (clipboard, item->content.text, -1);
+      collector = clipman_collector_get ();
+      g_object_get (G_OBJECT (collector), "add-primary-clipboard", &add_primary_clipboard, NULL);
+      if (add_primary_clipboard)
+        {
+          g_warning ("sync primary clipboard");
+          clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
+          gtk_clipboard_set_text (clipboard, item->content.text, -1);
+        }
+      g_object_unref (collector);
       break;
 
     case CLIPMAN_HISTORY_TYPE_IMAGE:
diff --git a/panel-plugin/xfce4-clipman-history.c b/panel-plugin/xfce4-clipman-history.c
index ba06985..b860877 100644
--- a/panel-plugin/xfce4-clipman-history.c
+++ b/panel-plugin/xfce4-clipman-history.c
@@ -29,6 +29,7 @@
 #include <libxfce4util/libxfce4util.h>
 #include <x11-clipboard-manager/daemon.h>
 
+#include <collector.h>
 #include <menu.h>
 #include <plugin.h>
 #include <history.h>
@@ -52,6 +53,7 @@ clipman_history_row_activated (GtkTreeView       *treeview,
                                GtkTreeViewColumn *column,
                                MyPlugin          *plugin)
 {
+  gboolean add_primary_clipboard;
   GtkWidget *window;
   GtkClipboard *clipboard;
   GtkTreeSelection *selection;
@@ -75,8 +77,12 @@ clipman_history_row_activated (GtkTreeView       *treeview,
   clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
   gtk_clipboard_set_text (clipboard, text, -1);
 
-  clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
-  gtk_clipboard_set_text (clipboard, text, -1);
+  g_object_get (G_OBJECT (plugin->collector), "add-primary-clipboard", &add_primary_clipboard, NULL);
+  if (add_primary_clipboard)
+    {
+      clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
+      gtk_clipboard_set_text (clipboard, text, -1);
+    }
 
   window = gtk_widget_get_toplevel (GTK_WIDGET (treeview));
 
@@ -443,6 +449,10 @@ clipman_history_activate (GtkApplication *app,
   xfconf_g_property_bind (plugin->channel, "/tweaks/reorder-items",
                           G_TYPE_BOOLEAN, plugin->history, "reorder-items");
 
+  plugin->collector = clipman_collector_get ();
+  xfconf_g_property_bind (plugin->channel, "/settings/add-primary-clipboard",
+                          G_TYPE_BOOLEAN, plugin->collector, "add-primary-clipboard");
+
   plugin->menu = clipman_menu_new ();
   xfconf_g_property_bind (plugin->channel, "/tweaks/paste-on-activate",
                           G_TYPE_UINT, plugin->menu, "paste-on-activate");

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list