[gnome-screenshot] screenshot: only fire flash in the fallback case



commit ef5429a4dbc55d5b0f58c5cbc41f6e3c99eee116
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Jan 25 14:05:33 2012 -0500

    screenshot: only fire flash in the fallback case
    
    Since the shell can do it for us now.

 src/gnome-screenshot.c |   13 -------------
 src/screenshot-utils.c |   34 ++++++++++++++++++++++++----------
 src/screenshot-utils.h |    2 --
 3 files changed, 24 insertions(+), 25 deletions(-)
---
diff --git a/src/gnome-screenshot.c b/src/gnome-screenshot.c
index 4d69d19..fd032fe 100644
--- a/src/gnome-screenshot.c
+++ b/src/gnome-screenshot.c
@@ -49,7 +49,6 @@
 #include "screenshot-shadow.h"
 #include "screenshot-utils.h"
 #include "screenshot-dialog.h"
-#include "cheese-flash.h"
 
 #define SCREENSHOOTER_ICON "applets-screenshooter"
 
@@ -58,7 +57,6 @@
 static GdkPixbuf *screenshot = NULL;
 
 /* Global variables*/
-static CheeseFlash *flash = NULL;
 static gchar *icc_profile_base64 = NULL;
 
 static void
@@ -464,7 +462,6 @@ find_current_window (void)
 static void
 finish_prepare_screenshot (GdkRectangle *rectangle)
 {
-  GdkRectangle rect;
   GdkWindow *window;
 
   window = find_current_window ();
@@ -497,18 +494,8 @@ finish_prepare_screenshot (GdkRectangle *rectangle)
       exit (1);
     }
 
-  flash = cheese_flash_new ();
-
-  if (rectangle != NULL)
-    rect = *rectangle;
-  else
-    screenshot_get_window_rect (window, &rect);
-
-  cheese_flash_fire (flash, &rect);
   play_sound_effect (window);
 
-  g_object_unref (flash);
-
   if (screenshot_config->copy_to_clipboard)
     {
       screenshot_save_to_clipboard ();
diff --git a/src/screenshot-utils.c b/src/screenshot-utils.c
index 771f841..625a088 100644
--- a/src/screenshot-utils.c
+++ b/src/screenshot-utils.c
@@ -29,6 +29,7 @@
 #include <X11/extensions/shape.h>
 #endif
 
+#include "cheese-flash.h"
 #include "gnome-screenshot.h"
 #include "screenshot-config.h"
 #include "screenshot-utils.h"
@@ -354,6 +355,27 @@ screenshot_get_window_rect_coords (GdkWindow *window,
     }
 }
 
+static void
+screenshot_fallback_fire_flash (GdkWindow *window,
+                                GdkRectangle *rectangle)
+{
+  GdkRectangle rect;
+  CheeseFlash *flash = NULL;
+
+  if (rectangle != NULL)
+    rect = *rectangle;
+  else
+    screenshot_get_window_rect_coords (window,
+                                       screenshot_config->include_border,
+                                       NULL,
+                                       &rect);
+
+  flash = cheese_flash_new ();
+  cheese_flash_fire (flash, &rect);
+
+  g_object_unref (flash);
+}
+
 static GdkPixbuf *
 screenshot_get_pixbuf_fallback (GdkWindow *window,
                                 GdkRectangle *rectangle)
@@ -556,17 +578,9 @@ screenshot_get_pixbuf_fallback (GdkWindow *window,
         }
     }
 
-  return screenshot;
-}
+  screenshot_fallback_fire_flash (window, rectangle);
 
-void
-screenshot_get_window_rect (GdkWindow *window,
-                            GdkRectangle *rect)
-{
-  screenshot_get_window_rect_coords (window,
-                                     screenshot_config->include_border,
-                                     NULL,
-                                     rect);
+  return screenshot;
 }
 
 GdkPixbuf *
diff --git a/src/screenshot-utils.h b/src/screenshot-utils.h
index c6697eb..674c1b6 100644
--- a/src/screenshot-utils.h
+++ b/src/screenshot-utils.h
@@ -27,8 +27,6 @@ G_BEGIN_DECLS
 
 gboolean   screenshot_grab_lock           (void);
 void       screenshot_release_lock        (void);
-void       screenshot_get_window_rect     (GdkWindow *win,
-                                           GdkRectangle *rect);
 GdkWindow *screenshot_find_current_window (void);
 GdkPixbuf *screenshot_get_pixbuf          (GdkWindow *win,
                                            GdkRectangle *rectangle);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]