eog r4399 - in trunk: . src



Author: friemann
Date: Mon Feb 25 12:00:35 2008
New Revision: 4399
URL: http://svn.gnome.org/viewvc/eog?rev=4399&view=rev

Log:
2008-02-25  Felix Riemann  <friemann svn gnome org>

	* src/eog-application.c: (eog_application_init),
	(eog_application_save_toolbars_model):
	* src/eog-util.c: (eog_util_dot_dir):
	Don't assert if we cannot create the user preferences directory
	because a file with the same name blocking it. Log a warning instead.
	Attempts to save the toolbar layout will be ignored until the
	user moved the file away. Fixes bug #500203.


Modified:
   trunk/ChangeLog
   trunk/src/eog-application.c
   trunk/src/eog-util.c

Modified: trunk/src/eog-application.c
==============================================================================
--- trunk/src/eog-application.c	(original)
+++ trunk/src/eog-application.c	Mon Feb 25 12:00:35 2008
@@ -118,17 +118,20 @@
 static void
 eog_application_init (EogApplication *eog_application)
 {
+	const gchar *dot_dir = eog_util_dot_dir ();
+
 	eog_session_init (eog_application);
 
 	eog_application->toolbars_model = egg_toolbars_model_new ();
 
-	eog_application->toolbars_file = g_build_filename
-		(eog_util_dot_dir (), "eog_toolbar.xml", NULL);
-
 	egg_toolbars_model_load_names (eog_application->toolbars_model,
 				       EOG_DATA_DIR "/eog-toolbar.xml");
+
+	if (G_LIKELY (dot_dir != NULL))
+		eog_application->toolbars_file = g_build_filename
+			(dot_dir, "eog_toolbar.xml", NULL);
 	
-	if (!egg_toolbars_model_load_toolbars (eog_application->toolbars_model,
+	if (!dot_dir || !egg_toolbars_model_load_toolbars (eog_application->toolbars_model,
 					       eog_application->toolbars_file)) {
 
 		egg_toolbars_model_load_toolbars (eog_application->toolbars_model,
@@ -365,9 +368,10 @@
 void
 eog_application_save_toolbars_model (EogApplication *application)
 {
-        egg_toolbars_model_save_toolbars (application->toolbars_model,
-			 	          application->toolbars_file, 
-					  "1.0");
+	if (G_LIKELY(application->toolbars_file != NULL))
+        	egg_toolbars_model_save_toolbars (application->toolbars_model,
+				 	          application->toolbars_file, 
+						  "1.0");
 }
 
 void

Modified: trunk/src/eog-util.c
==============================================================================
--- trunk/src/eog-util.c	(original)
+++ trunk/src/eog-util.c	Mon Feb 25 12:00:35 2008
@@ -296,7 +296,16 @@
 		
 		exists = ensure_dir_exists (dot_dir);
 
-		g_assert (exists);
+		if (G_UNLIKELY (!exists)) {
+			static gboolean printed_warning = FALSE;
+
+			if (!printed_warning) {
+				g_warning ("EOG could not save some of your preferences in its settings directory due to a file with the same name (%s) blocking its creation. Please remove that file, or move it away.", dot_dir);
+				printed_warning = TRUE;
+			}
+			dot_dir = NULL;
+			return NULL;
+		}
 	}
 
 	return dot_dir;



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