gnome-utils r8058 - trunk/gnome-screenshot
- From: ebassi svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-utils r8058 - trunk/gnome-screenshot
- Date: Mon, 8 Sep 2008 13:25:58 +0000 (UTC)
Author: ebassi
Date: Mon Sep 8 13:25:58 2008
New Revision: 8058
URL: http://svn.gnome.org/viewvc/gnome-utils?rev=8058&view=rev
Log:
2008-09-08 Emmanuele Bassi <ebassi gnome org>
Bug 99897 â Screen Shot to clip board
* gnome-screenshot.c:
(screenshot_dialog_response_cb): Allow copying the screenshot
image to the clipboard. Based on a patch by Vincent Untz.
* gnome-screenshot.ui: Add the 'Copy to Clipboard' button.
* screenshot-dialog.[ch]: Allow retrieving the GdkPixbuf
of the screenshot from the dialog.
Modified:
trunk/gnome-screenshot/ChangeLog
trunk/gnome-screenshot/gnome-screenshot.c
trunk/gnome-screenshot/gnome-screenshot.ui
trunk/gnome-screenshot/screenshot-dialog.c
trunk/gnome-screenshot/screenshot-dialog.h
Modified: trunk/gnome-screenshot/gnome-screenshot.c
==============================================================================
--- trunk/gnome-screenshot/gnome-screenshot.c (original)
+++ trunk/gnome-screenshot/gnome-screenshot.c Mon Sep 8 13:25:58 2008
@@ -676,6 +676,16 @@
}
g_free (uri);
}
+ else if (response_id == SCREENSHOT_RESPONSE_COPY)
+ {
+ GtkClipboard *clipboard;
+ GdkPixbuf *screenshot;
+
+ clipboard = gtk_clipboard_get_for_display (gtk_widget_get_display (GTK_WIDGET (d)),
+ GDK_SELECTION_CLIPBOARD);
+ screenshot = screenshot_dialog_get_screenshot (dialog);
+ gtk_clipboard_set_image (clipboard, screenshot);
+ }
else /* dialog was canceled */
{
gtk_widget_destroy (GTK_WIDGET (d));
Modified: trunk/gnome-screenshot/gnome-screenshot.ui
==============================================================================
--- trunk/gnome-screenshot/gnome-screenshot.ui (original)
+++ trunk/gnome-screenshot/gnome-screenshot.ui Mon Sep 8 13:25:58 2008
@@ -48,6 +48,18 @@
</object>
</child>
<child>
+ <object class="GtkButton" id="copy_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_underline">True</property>
+ <property name="label" translatable="yes">C_opy to Clipboard</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ </object>
+ </child>
+ <child>
<object class="GtkButton" id="ok_button">
<property name="visible">True</property>
<property name="can_default">True</property>
@@ -236,6 +248,7 @@
<action-widget response="-11">help_button</action-widget>
<action-widget response="-6">cancel_button</action-widget>
<action-widget response="-5">ok_button</action-widget>
+ <action-widget response="1">copy_button</action-widget>
</action-widgets>
</object>
</interface>
Modified: trunk/gnome-screenshot/screenshot-dialog.c
==============================================================================
--- trunk/gnome-screenshot/screenshot-dialog.c (original)
+++ trunk/gnome-screenshot/screenshot-dialog.c Mon Sep 8 13:25:58 2008
@@ -371,6 +371,13 @@
{
return gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog->save_widget));
}
+
+GdkPixbuf *
+screenshot_dialog_get_screenshot (ScreenshotDialog *dialog)
+{
+ return dialog->screenshot;
+}
+
void
screenshot_dialog_set_busy (ScreenshotDialog *dialog,
gboolean busy)
Modified: trunk/gnome-screenshot/screenshot-dialog.h
==============================================================================
--- trunk/gnome-screenshot/screenshot-dialog.h (original)
+++ trunk/gnome-screenshot/screenshot-dialog.h Mon Sep 8 13:25:58 2008
@@ -24,6 +24,9 @@
typedef struct ScreenshotDialog ScreenshotDialog;
+/* Keep in sync with the value defined in the UI file */
+#define SCREENSHOT_RESPONSE_COPY 1
+
ScreenshotDialog *screenshot_dialog_new (GdkPixbuf *screenshot,
char *initial_uri,
gboolean take_window_shot);
@@ -31,7 +34,9 @@
GtkWidget *screenshot_dialog_get_toplevel (ScreenshotDialog *dialog);
char *screenshot_dialog_get_uri (ScreenshotDialog *dialog);
char *screenshot_dialog_get_folder (ScreenshotDialog *dialog);
+GdkPixbuf *screenshot_dialog_get_screenshot (ScreenshotDialog *dialog);
void screenshot_dialog_set_busy (ScreenshotDialog *dialog,
gboolean busy);
void screenshot_dialog_focus_entry (ScreenshotDialog *dialog);
+
#endif /* __SCREENSHOT_DIALOG_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]