[Xfce4-commits] <xfce4-screenshooter:master> Only copy to clipboard with a clipboard manager.
Jérôme Guelfucci
noreply at xfce.org
Sun Nov 8 00:22:01 CET 2009
Updating branch refs/heads/master
to 0675269bc40d3592410b9083fcd39aa9d848a363 (commit)
from 5854a53d8168fe1e2fedcf4c3e2be1261e027e2e (commit)
commit 0675269bc40d3592410b9083fcd39aa9d848a363
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Sun Nov 8 00:20:41 2009 +0100
Only copy to clipboard with a clipboard manager.
lib/screenshooter-dialogs.c | 27 +++++++++++++++------------
lib/screenshooter-utils.c | 11 +++++++++++
lib/screenshooter-utils.h | 2 ++
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index fbcd8d0..aa3dbe2 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -941,18 +941,21 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
gtk_widget_set_tooltip_text (save_radio_button, _("Save the screenshot to a PNG file"));
gtk_box_pack_start (GTK_BOX (actions_box), save_radio_button, FALSE, FALSE, 0);
- /* Copy to clipboard radio button */
- clipboard_radio_button =
- gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (save_radio_button),
- _("Copy to the clipboard"));
- gtk_widget_set_tooltip_text (clipboard_radio_button,
- _("Copy the screenshot to the clipboard so that it can be "
- "pasted later"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (clipboard_radio_button),
- (sd->action == CLIPBOARD));
- g_signal_connect (G_OBJECT (clipboard_radio_button), "toggled",
- G_CALLBACK (cb_clipboard_toggled), sd);
- gtk_box_pack_start (GTK_BOX (actions_box), clipboard_radio_button, FALSE, FALSE, 0);
+ if (sd->plugin || screenshooter_clipboard_manager ())
+ {
+ /* Copy to clipboard radio button */
+ clipboard_radio_button =
+ gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (save_radio_button),
+ _("Copy to the clipboard"));
+ gtk_widget_set_tooltip_text (clipboard_radio_button,
+ _("Copy the screenshot to the clipboard so that it can be "
+ "pasted later"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (clipboard_radio_button),
+ (sd->action == CLIPBOARD));
+ g_signal_connect (G_OBJECT (clipboard_radio_button), "toggled",
+ G_CALLBACK (cb_clipboard_toggled), sd);
+ gtk_box_pack_start (GTK_BOX (actions_box), clipboard_radio_button, FALSE, FALSE, 0);
+ }
/* Horizontal box for the open with stuff */
open_box = gtk_hbox_new (FALSE, 6);
diff --git a/lib/screenshooter-utils.c b/lib/screenshooter-utils.c
index 826d6e1..c61a724 100644
--- a/lib/screenshooter-utils.c
+++ b/lib/screenshooter-utils.c
@@ -372,3 +372,14 @@ screenshooter_f1_key (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
return FALSE;
}
+gboolean
+screenshooter_clipboard_manager (void)
+{
+ Display *display;
+ Atom atom;
+
+ display = GDK_DISPLAY ();
+ atom = XInternAtom (display, "CLIPBOARD_MANAGER", FALSE);
+ return XGetSelectionOwner (display, atom);
+}
+
diff --git a/lib/screenshooter-utils.h b/lib/screenshooter-utils.h
index 8524010..e1bff5f 100644
--- a/lib/screenshooter-utils.h
+++ b/lib/screenshooter-utils.h
@@ -55,6 +55,8 @@ void screenshooter_open_help (void);
gboolean screenshooter_f1_key (GtkWidget *widget,
GdkEventKey *event,
gpointer user_data);
+gboolean screenshooter_clipboard_manager (void);
+
More information about the Xfce4-commits
mailing list