changeset 11550:ec2335d98b83

[gaim-migrate @ 13805] sf patch #1291640, from Levi Bard Changes smiley theme description color on select It seems like there is a bit of code duplication here committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 15 Sep 2005 06:12:21 +0000
parents 8b494b5763c2
children 78aad676fdb2
files ChangeLog src/gtkprefs.c src/gtkthemes.h
diffstat 3 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Sep 15 04:54:26 2005 +0000
+++ b/ChangeLog	Thu Sep 15 06:12:21 2005 +0000
@@ -63,6 +63,8 @@
 	  with the same name (Andrew Hart)
 	* Improved buddy list searching with CTRL+F
 	* ICQ encoding fix for offline buddies (Ilya Konstantinov)
+	* Show smiley theme descriptions correctly for the highlighted
+	  smiley theme (Levi Bard)
 
 	Preference changes:
 	* Removed "Dim idle buddies" buddy list preference, default to "Yes."
--- a/src/gtkprefs.c	Thu Sep 15 04:54:26 2005 +0000
+++ b/src/gtkprefs.c	Thu Sep 15 06:12:21 2005 +0000
@@ -66,6 +66,7 @@
 static GtkWidget *debugbutton = NULL;
 static int notebook_page = 0;
 static GtkTreeIter plugin_iter;
+GtkTreeRowReference *previous_smiley_row;
 
 /*
  * PROTOTYPES
@@ -460,14 +461,44 @@
 static void smiley_sel (GtkTreeSelection *sel, GtkTreeModel *model) {
 	GtkTreeIter  iter;
 	const char *filename;
+	char	*description;
 	GValue val = { 0, };
+	GtkTreePath	*path,
+				*oldpath;
+	struct smiley_theme	*new_theme,
+						*old_theme;
+
 
 	if (! gtk_tree_selection_get_selected (sel, &model, &iter))
 		return;
+
+	old_theme = current_smiley_theme;
 	gtk_tree_model_get_value (model, &iter, 2, &val);
+	path = gtk_tree_model_get_path(model, &iter);
 	filename = g_value_get_string(&val);
 	gaim_prefs_set_string("/gaim/gtk/smileys/theme", filename);
 	g_value_unset (&val);
+
+	new_theme = current_smiley_theme;
+	description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n"
+								"<span size='smaller' foreground='white'>%s</span>",
+								new_theme->name, new_theme->author, new_theme->desc);
+	gtk_list_store_set(smiley_theme_store,&iter,1,description,-1);
+	g_free(description);
+
+	oldpath = gtk_tree_row_reference_get_path(previous_smiley_row);
+	if(gtk_tree_model_get_iter(model, &iter, oldpath)){
+		description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n"
+								"<span size='smaller' foreground='dim grey'>%s</span>",
+								old_theme->name, old_theme->author, old_theme->desc);
+		gtk_list_store_set(smiley_theme_store,&iter,1,description,-1);
+		g_free(description);
+	}
+	gtk_tree_path_free(oldpath);
+
+	gtk_tree_row_reference_free(previous_smiley_row);
+	previous_smiley_row = gtk_tree_row_reference_new(model, path);
+	gtk_tree_path_free(path);
 }
 
 static GtkTreePath *theme_refresh_theme_list()
@@ -478,6 +509,7 @@
 	GtkTreePath *path = NULL;
 	int ind = 0;
 
+	previous_smiley_row = NULL;
 
 	gaim_gtkthemes_smiley_theme_probe();
 
--- a/src/gtkthemes.h	Thu Sep 15 04:54:26 2005 +0000
+++ b/src/gtkthemes.h	Thu Sep 15 06:12:21 2005 +0000
@@ -42,6 +42,7 @@
 
 extern struct smiley_theme *current_smiley_theme;
 extern GSList *smiley_themes;
+extern GtkTreeRowReference *previous_smiley_row;
 
 extern void gaim_gtkthemes_init();
 gboolean gaim_gtkthemes_smileys_disabled();