diff pidgin/gtkthemes.c @ 22514:019052a807a3

Introduce API for GtkIMHtmlSmiley. Use this to prevent leaking remote custom emoticons.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 18 Mar 2008 00:47:52 +0000
parents 02eda4bd2b22
children 9ea84135db24
line wrap: on
line diff
--- a/pidgin/gtkthemes.c	Fri Mar 14 23:41:03 2008 +0000
+++ b/pidgin/gtkthemes.c	Tue Mar 18 00:47:52 2008 +0000
@@ -135,7 +135,7 @@
 			gtk_imhtml_associate_smiley(GTK_IMHTML(imhtml), sml, icons->data);
 			icons = icons->next;
 		}
-		
+
 		if (custom == TRUE) {
 			icons = pidgin_smileys_get_all();
 
@@ -295,7 +295,6 @@
 		} else if (load && list) {
 			gboolean hidden = FALSE;
 			char *sfile = NULL;
-			gboolean have_used_sfile = FALSE;
 
 			if (*i == '!' && *(i + 1) == ' ') {
 				hidden = TRUE;
@@ -309,17 +308,12 @@
 						i++;
 					l[li++] = *(i++);
 				}
+				l[li] = 0;
 				if (!sfile) {
-					l[li] = 0;
 					sfile = g_build_filename(dirname, l, NULL);
 				} else {
-					GtkIMHtmlSmiley *smiley = g_new0(GtkIMHtmlSmiley, 1);
-					l[li] = 0;
-					smiley->file = sfile;
-					smiley->smile = g_strdup(l);
-					smiley->hidden = hidden;
+					GtkIMHtmlSmiley *smiley = gtk_imhtml_smiley_create(sfile, l, hidden, 0);
 					list->smileys = g_slist_prepend(list->smileys, smiley);
-					have_used_sfile = TRUE;
 				}
 				while (isspace(*i))
 					i++;
@@ -327,8 +321,7 @@
 			}
 
 
-			if (!have_used_sfile)
-				g_free(sfile);
+			g_free(sfile);
 		}
 	}