pidgin: aa270436: Update the smiley in the smiley dialog i...

sadrul at pidgin.im sadrul at pidgin.im
Wed May 28 18:40:44 EDT 2008


-----------------------------------------------------------------
Revision: aa270436dec7891fb45f800be06766eeed98671b
Ancestor: 7dc77dba4b47a788d706e867dbed7e7d3c404b52
Author: sadrul at pidgin.im
Date: 2008-05-28T22:39:51
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/aa270436dec7891fb45f800be06766eeed98671b

Modified files:
        pidgin/gtksmiley.c

ChangeLog: 

Update the smiley in the smiley dialog if the imagefile is changed.

-------------- next part --------------
============================================================
--- pidgin/gtksmiley.c	e7e5a9231c48f62ed45460716ed6c4127cfb37e5
+++ pidgin/gtksmiley.c	7507e39acdf11d00e737b2237df98cd2cf4b3a27
@@ -96,6 +96,18 @@ shortcut_changed_cb(PurpleSmiley *smiley
 	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 @@ static GtkIMHtmlSmiley *smiley_purple_to
 	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;
 }
 


More information about the Commits mailing list