changeset 23233:bfbd2b038135

Update the smiley in the smiley dialog if the imagefile is changed.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 28 May 2008 22:39:51 +0000
parents cb241bc04f9b
children 4561cb0c6e94
files pidgin/gtksmiley.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtksmiley.c	Wed May 28 05:30:02 2008 +0000
+++ b/pidgin/gtksmiley.c	Wed May 28 22:39:51 2008 +0000
@@ -96,6 +96,18 @@
 	gtksmiley->smile = g_strdup(purple_smiley_get_shortcut(smiley));
 }
 
+static void
+image_changed_cb(PurpleSmiley *smiley, gpointer dontcare, GtkIMHtmlSmiley *gtksmiley)
+{
+	const char *file;
+
+	g_free(gtksmiley->file);
+
+	file = purple_imgstore_get_filename(purple_smiley_get_stored_image(smiley));
+	gtksmiley->file = g_build_filename(purple_smileys_get_storing_dir(), file, NULL);
+	gtk_imhtml_smiley_reload(gtksmiley);
+}
+
 static GtkIMHtmlSmiley *smiley_purple_to_gtkimhtml(PurpleSmiley *smiley)
 {
 	GtkIMHtmlSmiley *gtksmiley;
@@ -114,6 +126,10 @@
 	g_signal_connect(G_OBJECT(smiley), "notify::shortcut",
 			G_CALLBACK(shortcut_changed_cb), gtksmiley);
 
+	/* And update the pixbuf too when the image is changed */
+	g_signal_connect(G_OBJECT(smiley), "notify::image",
+			G_CALLBACK(image_changed_cb), gtksmiley);
+
 	return gtksmiley;
 }