diff src/gtkthemes.c @ 11557:1e7c0773380f

[gaim-migrate @ 13819] Fix smiley theme selection being lost when gaim is restarted. We now save the smiley theme name instead of path as the pref. Avoid leaking a GtkTreeRowReference. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 20 Sep 2005 21:47:57 +0000
parents b47708f46a38
children fe2cb084ab16
line wrap: on
line diff
--- a/src/gtkthemes.c	Mon Sep 19 16:18:50 2005 +0000
+++ b/src/gtkthemes.c	Tue Sep 20 21:47:57 2005 +0000
@@ -269,11 +269,24 @@
 
 void gaim_gtkthemes_init()
 {
-	if (current_smiley_theme == NULL) {
-		gaim_gtkthemes_smiley_theme_probe();
-		if (smiley_themes != NULL) {
-			struct smiley_theme *smile = smiley_themes->data;
+	GSList *l;
+	const char *current_theme =
+		gaim_prefs_get_string("/gaim/gtk/smileys/theme");
+
+	gaim_gtkthemes_smiley_theme_probe();
+
+	for (l = smiley_themes; l; l = l->next) {
+		struct smiley_theme *smile = l->data;
+		if (smile->name && strcmp(current_theme, smile->name) == 0) {
 			gaim_gtkthemes_load_smiley_theme(smile->path, TRUE);
+			break;
 		}
 	}
+
+	/* If we still don't have a smiley theme, choose the first one */
+	if (!current_smiley_theme && smiley_themes) {
+		struct smiley_theme *smile = smiley_themes->data;
+		gaim_gtkthemes_load_smiley_theme(smile->path, TRUE);
+	}
+
 }