[eog] Improve compatibility with plugins using Clutter 1.0



commit 4fab134412dd51cc44037fafe9e7669f8509bc44
Author: Felix Riemann <friemann gnome org>
Date:   Tue Aug 4 20:31:48 2009 +0200

    Improve compatibility with plugins using Clutter 1.0
    
    This enhances commit 5515f5c05186dc221abcbd4d028faefe52b71b5d by moving
    more window intialization code to the mainloop. This should avoid
    crashes when starting eog with plugins using Clutter 1.0 and strict
    gfx drivers (e.g. from Nvidia).

 ChangeLog        |    8 ++++++++
 src/eog-image.c  |   37 +++++++++++++++++++++----------------
 src/eog-window.c |   16 +---------------
 3 files changed, 30 insertions(+), 31 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3286df6..5a67da7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-08-04  Felix Riemann  <friemann gnome org>
+
+	* src/eog-image.c (do_emit_size_prepared_signal),
+	(eog_image_emit_size_prepared), (eog_image_size_prepared),
+	(eog_image_set_exif_data), (eog_image_real_load):
+	* src/eog-window.c (eog_window_obtain_desired_size):
+	Improve compatibility with plugins using Clutter-1.0.
+
 2009-07-29  Felix Riemann  <friemann gnome org>
 
 	* src/eog-properties-dialog.c (eog_properties_dialog_init):
diff --git a/src/eog-image.c b/src/eog-image.c
index ff812d2..19e1b19 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -416,6 +416,22 @@ eog_image_real_transform (EogImage     *img,
 }
 
 static gboolean
+do_emit_size_prepared_signal (EogImage *img)
+{
+	g_signal_emit (img, signals[SIGNAL_SIZE_PREPARED], 0,
+		       img->priv->width, img->priv->height);
+	return FALSE;
+}
+
+static void
+eog_image_emit_size_prepared (EogImage *img)
+{
+	gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
+				   (GSourceFunc) do_emit_size_prepared_signal,
+				   g_object_ref (img), g_object_unref);
+}
+
+static gboolean
 check_loader_threadsafety (GdkPixbufLoader *loader, gboolean *result)
 {
 	GdkPixbufFormat *format;
@@ -475,7 +491,7 @@ eog_image_size_prepared (GdkPixbufLoader *loader,
 #else
 	if (img->priv->threadsafe_format)
 #endif
-		g_signal_emit (img, signals[SIGNAL_SIZE_PREPARED], 0, width, height);
+		eog_image_emit_size_prepared (img);
 }
 
 static EogMetadataReader*
@@ -771,11 +787,7 @@ eog_image_set_exif_data (EogImage *img, EogMetadataReader *md_reader)
 		/* Emit size prepared signal if we have the size */
 		if (priv->width > 0 &&
 		    priv->height > 0) {
-			g_signal_emit (img,
-				       signals[SIGNAL_SIZE_PREPARED],
-				       0,
-				       priv->width,
-				       priv->height);
+			eog_image_emit_size_prepared (img);
 		}
 	}
 #else
@@ -961,11 +973,8 @@ eog_image_real_load (EogImage *img,
 				}
 
 				if (priv->threadsafe_format)
-					g_signal_emit (img,
-						       signals[SIGNAL_SIZE_PREPARED],
-						       0,
-						       priv->width,
-						       priv->height);
+					eog_image_emit_size_prepared (img);
+
                                 priv->metadata_status = EOG_IMAGE_METADATA_NOT_AVAILABLE;
                         }
 
@@ -1051,11 +1060,7 @@ eog_image_real_load (EogImage *img,
 			/* If it's non-threadsafe loader, then trigger window
  			 * showing in the end of the process. */
 			if (!priv->threadsafe_format)
-				g_signal_emit (img,
-					       signals[SIGNAL_SIZE_PREPARED],
-					       0,
-					       priv->width,
-					       priv->height);
+				eog_image_emit_size_prepared (img);
 		} else {
 			/* Some loaders don't report errors correctly.
 			 * Error will be set below. */
diff --git a/src/eog-window.c b/src/eog-window.c
index 045da99..3dd89a9 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -1312,14 +1312,6 @@ eog_job_save_progress_cb (EogJobSave *job, float progress, gpointer user_data)
 		image = NULL;
 }
 
-static gboolean
-emit_window_prepared_signal (EogWindow *window)
-{
-	g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
-
-	return FALSE;
-}
-
 static void
 eog_window_obtain_desired_size (EogImage  *image,
 				gint       width,
@@ -1335,8 +1327,6 @@ eog_window_obtain_desired_size (EogImage  *image,
 	gint view_width, view_height;
 	gint deco_width, deco_height;
 
-	gdk_threads_enter ();
-
 	update_action_groups_state (window);
 
 	img_width = width;
@@ -1393,11 +1383,7 @@ eog_window_obtain_desired_size (EogImage  *image,
 
 	gtk_window_set_default_size (GTK_WINDOW (window), final_width, final_height);
 
-	gdk_threads_leave ();
-
-	gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
-				   (GSourceFunc) emit_window_prepared_signal,
-				   g_object_ref (window), g_object_unref);
+	g_signal_emit (window, signals[SIGNAL_PREPARED], 0);
 }
 
 static void



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