# HG changeset patch # User Mark Doliner # Date 1126764741 0 # Node ID ec2335d98b83961f84f88fedbf09ccba15175ce8 # Parent 8b494b5763c2079b36b49441ccc5a88bd139f273 [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 diff -r 8b494b5763c2 -r ec2335d98b83 ChangeLog --- 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." diff -r 8b494b5763c2 -r ec2335d98b83 src/gtkprefs.c --- 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("%s - %s\n" + "%s", + 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("%s - %s\n" + "%s", + 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(); diff -r 8b494b5763c2 -r ec2335d98b83 src/gtkthemes.h --- 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();