[Xfce4-commits] <xfce4-screenshooter:master> Show a preview if the actions dialog was not displayed.

Jérôme Guelfucci noreply at xfce.org
Sat Oct 31 00:14:02 CET 2009


Updating branch refs/heads/master
         to 2a6fafc61071ba2825c989c8ae5373f871e02acf (commit)
       from 276e7b941dadc364236782c13ded86dda8219abc (commit)

commit 2a6fafc61071ba2825c989c8ae5373f871e02acf
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sat Oct 31 00:13:25 2009 +0100

    Show a preview if the actions dialog was not displayed.

 lib/screenshooter-actions.c |    4 +++-
 lib/screenshooter-dialogs.c |   26 +++++++++++++++++++++++++-
 lib/screenshooter-dialogs.h |    3 ++-
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/lib/screenshooter-actions.c b/lib/screenshooter-actions.c
index 9facc08..1be06a5 100644
--- a/lib/screenshooter-actions.c
+++ b/lib/screenshooter-actions.c
@@ -87,7 +87,8 @@ gboolean screenshooter_action_idle (ScreenshotData *sd)
                                                      sd->screenshot_dir,
                                                      sd->title,
                                                      sd->timestamp,
-                                                     TRUE);
+                                                     TRUE,
+                                                     sd->action_specified);
 
       if (save_location)
         {
@@ -112,6 +113,7 @@ gboolean screenshooter_action_idle (ScreenshotData *sd)
                                        temp_dir_uri,
                                        sd->title,
                                        sd->timestamp,
+                                       FALSE,
                                        FALSE);
 
       if (screenshot_path != NULL)
diff --git a/lib/screenshooter-dialogs.c b/lib/screenshooter-dialogs.c
index 5d1bb8a..fbcd8d0 100644
--- a/lib/screenshooter-dialogs.c
+++ b/lib/screenshooter-dialogs.c
@@ -1042,6 +1042,9 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
  * the file name.
  * @save_dialog: whether a save dialog should be displayed to
  * let the user set a custom save location
+ * @show_preview: if @save_dialog is true, @show_preview will
+ * decide whether the save dialog should display a preview of
+ * @screenshot.
  *
  * Returns: a string containing the path to the saved file.
  */
@@ -1050,7 +1053,8 @@ gchar
                                 const gchar *directory,
                                 const gchar *title,
                                 gboolean timestamp,
-                                gboolean save_dialog)
+                                gboolean save_dialog,
+                                gboolean show_preview)
 {
   const gchar *filename = generate_filename_for_uri (directory, title, timestamp);
   gchar *save_uri = g_build_filename (directory, filename, NULL);
@@ -1079,6 +1083,26 @@ gchar
     gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (chooser), directory);
     gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (chooser), filename);
 
+    if(show_preview)
+      {
+        GtkWidget *preview;
+        GdkPixbuf *thumbnail;
+
+        /* Create the preview and the thumbnail */
+        preview = gtk_image_new ();
+        gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (chooser), preview);
+
+        thumbnail =
+          gdk_pixbuf_scale_simple (screenshot,
+                                   gdk_pixbuf_get_width(screenshot)/5,
+                                   gdk_pixbuf_get_height(screenshot)/5,
+                                   GDK_INTERP_BILINEAR);
+
+        gtk_image_set_from_pixbuf (GTK_IMAGE (preview), thumbnail);
+
+        g_object_unref (thumbnail);
+      }
+
     dialog_response = gtk_dialog_run (GTK_DIALOG (chooser));
 
     if (G_LIKELY (dialog_response == GTK_RESPONSE_ACCEPT))
diff --git a/lib/screenshooter-dialogs.h b/lib/screenshooter-dialogs.h
index cbc2703..b97b5fa 100644
--- a/lib/screenshooter-dialogs.h
+++ b/lib/screenshooter-dialogs.h
@@ -43,7 +43,8 @@ gchar     *screenshooter_save_screenshot    (GdkPixbuf      *screenshot,
                                              const gchar    *directory,
                                              const gchar    *title,
                                              gboolean        timestamp,
-                                             gboolean        save_dialog);
+                                             gboolean        save_dialog,
+                                             gboolean        show_preview);
 
 
 



More information about the Xfce4-commits mailing list