diff src/prefs.c @ 8705:543b19a96ac5

[gaim-migrate @ 9458] " All preferences in gaim, except for "No sounds when you log in", are "positive" preferences. For consistency and to make it a bit easier to understand the preference I think they should all be "positive" preferences (there's probably something about this in some HIG somewhere too) This patch: 1. changes "No sounds when you log in" to "Sounds when you log in" 2. adds a helper function for renaming old boolean prefs and inverting their meaning (gaim_prefs_rename_boolean_toggle) 3. Moves existing renames from prefs.c to gtkprefs.c because they all reference gtk preferences. Default behaviour for new users remains the same (no sounds during log in), and existing user's preferences are migrated correctly." --Stu Tomlinson at one point possitive preferences were policy, i think we should maintain that policy. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 18 Apr 2004 19:30:19 +0000
parents 68d8280c5e13
children 7a67c459ab8f
line wrap: on
line diff
--- a/src/prefs.c	Sun Apr 18 19:26:33 2004 +0000
+++ b/src/prefs.c	Sun Apr 18 19:30:19 2004 +0000
@@ -626,11 +626,27 @@
 	remove_pref(oldpref);
 }
 
-void gaim_prefs_rename_old() {
-	gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims");
-	gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats");
-	gaim_prefs_rename("/core/conversations/placement",
-					  "/gaim/gtk/conversations/placement");
+void gaim_prefs_rename_boolean_toggle(const char *oldname, const char *newname) {
+		struct gaim_pref *oldpref, *newpref;
+		
+		gaim_debug_info("prefs", "Attempting to rename and toggle %s to %s\n", oldname, newname);
+
+		oldpref = find_pref(oldname);
+		newpref = find_pref(newname);
+
+		/* it's already been renamed, call off the cats */
+		if(!oldpref)
+			return;
+
+		g_return_if_fail(newpref != NULL); /* the new one needs to be created */
+		g_return_if_fail(oldpref->type == newpref->type);
+		g_return_if_fail(oldpref->type == GAIM_PREF_BOOLEAN);
+		g_return_if_fail(oldpref->first_child == NULL); /* can't rename parents */
+		
+		gaim_prefs_set_bool(newname, !(oldpref->value.boolean));
+
+		remove_pref(oldpref);
+
 }
 
 guint gaim_prefs_connect_callback(const char *name, GaimPrefCallback func, gpointer data)