hmmm... duuno why this are still not mailed in. forwarding directly to list now. sorry if you get this more than once.

[EMAIL PROTECTED] wrote:
<snip>
<snip>

Looks good. See the commit logs for a small note (not your fault).
Good stuff :)

the attached patch. corrects that situation. It turns out it was my fault afterall :) ecore_config_file_save() fails with an ecore err code when a file can not be written to. I now properly check for that and when we can't write to the config file. we fail noisily.

Incidentally making this work properly closes up one memory leak due to improper shutdown due to if logic in entrance_edit_main.c

--
rephorm


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel








diff -Naur entrance/src/daemon/Entrance_Edit.h entrance.new/src/daemon/Entrance_Edit.h
--- entrance/src/daemon/Entrance_Edit.h	2006-07-26 00:58:39.000000000 +0100
+++ entrance.new/src/daemon/Entrance_Edit.h	2006-07-26 01:08:28.000000000 +0100
@@ -34,6 +34,7 @@
 
 int entrance_edit_init(const char*);
 int entrance_edit_shutdown();
+int entrance_edit_save();
 
 void entrance_edit_list();
 
diff -Naur entrance/src/daemon/entrance_edit.c entrance.new/src/daemon/entrance_edit.c
--- entrance/src/daemon/entrance_edit.c	2006-07-26 00:58:44.000000000 +0100
+++ entrance.new/src/daemon/entrance_edit.c	2006-07-26 01:08:34.000000000 +0100
@@ -20,7 +20,6 @@
 
 static int _entrance_edit_new();
 static void _entrance_edit_free();
-static void _entrance_edit_save();
 static void _entrance_edit_defaults_set();
 
 int entrance_edit_init(const char *filename)
@@ -59,7 +58,6 @@
 
 int entrance_edit_shutdown()
 {
-	_entrance_edit_save();
 	_entrance_edit_free();
 	ecore_config_shutdown();
 	ecore_shutdown();
@@ -68,6 +66,16 @@
 	return 1;
 }
 
+int entrance_edit_save()
+{
+	if(_entrance_edit) {
+		if(ecore_config_file_save(_entrance_edit->config_file) != ECORE_CONFIG_ERR_SUCC) {
+		   return 0;
+		} else {
+		   return 1;
+		}
+	}
+}
 
 void entrance_edit_list()
 {
@@ -157,12 +165,6 @@
 	}
 }
 
-static void _entrance_edit_save()
-{
-	if(_entrance_edit) {
-		ecore_config_file_save(_entrance_edit->config_file);
-	}
-}
 
 static void _entrance_edit_defaults_set()
 {
diff -Naur entrance/src/daemon/entrance_edit_main.c entrance.new/src/daemon/entrance_edit_main.c
--- entrance/src/daemon/entrance_edit_main.c	2006-07-26 00:58:48.000000000 +0100
+++ entrance.new/src/daemon/entrance_edit_main.c	2006-07-26 01:09:03.000000000 +0100
@@ -89,7 +89,6 @@
 
 	int c;
 	while((c = getopt_long_only(argc, argv, ":a:A:b:d:e:g:hH:i:I:m:M:n:N:o:p:r:R:s:S:t:T:u:U:x:X:", d_opt, NULL)) != -1) {
-    printf("got c: %c\n", c);
 		switch(c) {
 			case 'a':
 				config_attempts = atoi(optarg);
@@ -183,113 +182,117 @@
 
 	if(flag_list) {
 		entrance_edit_list();
-		exit(EXIT_SUCCESS);
-	}
-
-	/*TODO: for int config_*'s consider using a flag
-	 * to check if it has been modified or not.
-	 * checking for >= 0 may break if entrance begins
-	 * to use negative values as valid values.
-	 * */
-
-	if(config_attempts >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_DAEMON_ATTEMPTS_INT, config_attempts);
-	}
-
-	if(config_xserver >= 0) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_DAEMON_XSERVER_STR, config_xserver);
-	}
-
-	if(config_auth >= 0) { 
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_AUTH_INT, config_auth);
-	}
-
-	if(config_engine >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_ENGINE_INT, config_engine);
-	}
-	
-	if(config_reboot >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_SYSTEM_REBOOT_INT, config_reboot);
-	}
-	
-	if(config_halt >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_SYSTEM_HALT_INT, config_halt);
-	}
-	
-	if(config_autologin_mode >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_AUTOLOGIN_MODE_INT, config_autologin_mode);
-	}
-	
-	if(config_presel_mode >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_PRESEL_MODE_INT, config_presel_mode);
-	}
-	
-	if(config_user_remember >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_USER_REMEMBER_INT, config_user_remember);
-	}
-	
-	if(config_user_remember_count >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_USER_REMEMBER_N_INT, config_user_remember_count);
-	}
-
-	if(config_user_count >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_USER_COUNT_INT, config_user_count);
-	}
-	
-	if(config_session_count >= 0) {
-		entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_COUNT_INT, config_session_count);
-	}
-
-	if(config_xsession) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_XSESSION_STR, config_xsession);
-	}
-	
-	if(config_background) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_BACKGROUND_STR, config_background);
-	}
-
-	if(config_pointer) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_POINTER_STR, config_pointer);
-	}
-
-	if(config_greeting_before) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_GREETING_BEFORE_STR, config_greeting_before);
-	}
-
-	if(config_greeting_after) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_GREETING_AFTER_STR, config_greeting_after);
-	}
-
-	if(config_date_format) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_DATE_FORMAT_STR, config_date_format);
-	}
-
-	if(config_time_format) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_TIME_FORMAT_STR, config_time_format);
-	}
-
-	if(config_autologin_user) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_AUTOLOGIN_USER_STR, config_autologin_user);
-	}
-
-	if(config_presel_prevuser) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_PRESEL_PREVUSER_STR, config_presel_prevuser);
-	}
-
-	if(config_default_session) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_0_SESSION_STR, config_default_session);
-	}
-
-	if(config_default_session_title) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_0_TITLE_STR, config_default_session_title);
-	}
-
-	if(config_default_session_icon) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_0_ICON_STR, config_default_session_icon);
-	}
+	} else {
 
-	if(config_theme) {
-		entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_THEME_STR, config_theme);
+	   /*TODO: for int config_*'s consider using a flag
+	    * to check if it has been modified or not.
+	    * checking for >= 0 may break if entrance begins
+	    * to use negative values as valid values.
+	    * */
+
+	   if(config_attempts >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_DAEMON_ATTEMPTS_INT, config_attempts);
+	   }
+
+	   if(config_xserver >= 0) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_DAEMON_XSERVER_STR, config_xserver);
+	   }
+
+	   if(config_auth >= 0) { 
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_AUTH_INT, config_auth);
+	   }
+
+	   if(config_engine >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_ENGINE_INT, config_engine);
+	   }
+	   
+	   if(config_reboot >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_SYSTEM_REBOOT_INT, config_reboot);
+	   }
+	   
+	   if(config_halt >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_SYSTEM_HALT_INT, config_halt);
+	   }
+	   
+	   if(config_autologin_mode >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_AUTOLOGIN_MODE_INT, config_autologin_mode);
+	   }
+	   
+	   if(config_presel_mode >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_PRESEL_MODE_INT, config_presel_mode);
+	   }
+	   
+	   if(config_user_remember >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_USER_REMEMBER_INT, config_user_remember);
+	   }
+	   
+	   if(config_user_remember_count >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_USER_REMEMBER_N_INT, config_user_remember_count);
+	   }
+
+	   if(config_user_count >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_USER_COUNT_INT, config_user_count);
+	   }
+	   
+	   if(config_session_count >= 0) {
+		   entrance_edit_int_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_COUNT_INT, config_session_count);
+	   }
+
+	   if(config_xsession) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_XSESSION_STR, config_xsession);
+	   }
+	   
+	   if(config_background) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_BACKGROUND_STR, config_background);
+	   }
+
+	   if(config_pointer) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_POINTER_STR, config_pointer);
+	   }
+
+	   if(config_greeting_before) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_GREETING_BEFORE_STR, config_greeting_before);
+	   }
+
+	   if(config_greeting_after) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_GREETING_AFTER_STR, config_greeting_after);
+	   }
+
+	   if(config_date_format) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_DATE_FORMAT_STR, config_date_format);
+	   }
+
+	   if(config_time_format) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_TIME_FORMAT_STR, config_time_format);
+	   }
+
+	   if(config_autologin_user) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_AUTOLOGIN_USER_STR, config_autologin_user);
+	   }
+
+	   if(config_presel_prevuser) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_PRESEL_PREVUSER_STR, config_presel_prevuser);
+	   }
+
+	   if(config_default_session) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_0_SESSION_STR, config_default_session);
+	   }
+
+	   if(config_default_session_title) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_0_TITLE_STR, config_default_session_title);
+	   }
+
+	   if(config_default_session_icon) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_SESSION_0_ICON_STR, config_default_session_icon);
+	   }
+
+	   if(config_theme) {
+		   entrance_edit_string_set(ENTRANCE_EDIT_KEY_CLIENT_THEME_STR, config_theme);
+	   }
+
+	   if(!entrance_edit_save()) {
+	      fprintf(stderr, "entrance_edit: Error writing to config file!\n");
+	   }
 	}
 
 	entrance_edit_shutdown(config_file);



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to