[gnome-control-center/wip/background-content] Couple of fixes



commit 784c1bb1f2cbdc06a9e1a5539f6dab163ceb9751
Author: William Jon McCann <jmccann redhat com>
Date:   Tue May 22 15:16:29 2012 -0400

    Couple of fixes

 panels/background/cc-background-panel.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index bc32857..5fa5daf 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -139,6 +139,8 @@ cc_background_panel_dispose (GObject *object)
     }
 
   g_free (priv->screenshot_path);
+  priv->screenshot_path = NULL;
+
   g_clear_object (&priv->connection);
 
   G_OBJECT_CLASS (cc_background_panel_parent_class)->dispose (object);
@@ -309,9 +311,6 @@ on_screenshot_finished (GObject *source,
       goto out;
     }
 
-  /* remove the temporary file created by the shell */
-  g_unlink (panel->priv->screenshot_path);
-
   width = gdk_pixbuf_get_width (pixbuf);
   height = gdk_pixbuf_get_height (pixbuf);
   surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
@@ -336,6 +335,11 @@ on_screenshot_finished (GObject *source,
                                                                  0, 0,
                                                                  width,
                                                                  height);
+  /* remove the temporary file created by the shell */
+  g_unlink (panel->priv->screenshot_path);
+  g_free (priv->screenshot_path);
+  priv->screenshot_path = NULL;
+
   cairo_destroy (cr);
   cairo_surface_destroy (surface);
 
@@ -386,7 +390,9 @@ on_preview_draw (GtkWidget         *widget,
                  cairo_t           *cr,
                  CcBackgroundPanel *panel)
 {
-  if (!panel->priv->display_screenshot)
+  /* we have another shot in flight or an existing cache */
+  if (panel->priv->display_screenshot == NULL
+      && panel->priv->screenshot_path == NULL)
     {
       GdkRectangle rect;
 



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