[gthumb] Allow to run the application if clutter initialization fails



commit 00b0f0d15915e70e79f46a6a72045a9c001ca03c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Apr 17 13:11:32 2010 +0200

    Allow to run the application if clutter initialization fails
    
    If clutter initialization fails just disable the extentions that
    require clutter instead of quitting the application with an error.

 extensions/slideshow/main.c |    3 +++
 gthumb/main.c               |    6 ++++--
 gthumb/main.h               |    4 ++++
 3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/extensions/slideshow/main.c b/extensions/slideshow/main.c
index 71e9903..d7ef3a3 100644
--- a/extensions/slideshow/main.c
+++ b/extensions/slideshow/main.c
@@ -267,6 +267,9 @@ cube_from_bottom_transition (GthSlideshow *self,
 G_MODULE_EXPORT void
 gthumb_extension_activate (void)
 {
+	if (ClutterInitResult != CLUTTER_INIT_SUCCESS)
+		return;
+
 	gth_main_register_object (GTH_TYPE_TRANSITION,
 				  "none",
 				  GTH_TYPE_TRANSITION,
diff --git a/gthumb/main.c b/gthumb/main.c
index 5321430..6f262d7 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -50,6 +50,9 @@ gboolean NewWindow = FALSE;
 gboolean StartInFullscreen = FALSE;
 gboolean StartSlideshow = FALSE;
 gboolean ImportPhotos = FALSE;
+#ifdef HAVE_CLUTTER
+int      ClutterInitResult = CLUTTER_INIT_ERROR_UNKNOWN;
+#endif
 
 
 static UniqueApp   *gthumb_app;
@@ -413,8 +416,7 @@ main (int argc, char *argv[])
 	}
 
 #ifdef HAVE_CLUTTER
-	if (gtk_clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
-		g_error ("Unable to initialize GtkClutter");
+	ClutterInitResult = gtk_clutter_init (NULL, NULL);
 #endif
 
 	if (version) {
diff --git a/gthumb/main.h b/gthumb/main.h
index 0d03106..4eabfe7 100644
--- a/gthumb/main.h
+++ b/gthumb/main.h
@@ -30,6 +30,10 @@ extern gboolean StartInFullscreen;
 extern gboolean StartSlideshow;
 extern gboolean ImportPhotos;
 
+#ifdef HAVE_CLUTTER
+extern int ClutterInitResult;
+#endif
+
 void gth_restart (void);
 
 G_END_DECLS



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