comparison pidgin/gtkrequest.c @ 29820:245f3432a5ab

Avoid trying to build a filename and pixbuf if there's no image filename.
author Richard Laager <rlaager@wiktel.com>
date Sun, 16 Nov 2008 10:06:26 +0000
parents 2d04fb25c6db
children 93cb9f54df45
comparison
equal deleted inserted replaced
29819:5f8fc6e7466a 29820:245f3432a5ab
995 GtkTreeSelection *sel; 995 GtkTreeSelection *sel;
996 GtkTreeViewColumn *column; 996 GtkTreeViewColumn *column;
997 GtkTreeIter iter; 997 GtkTreeIter iter;
998 GList *l; 998 GList *l;
999 GList *icons = NULL; 999 GList *icons = NULL;
1000 GdkPixbuf* pixbuf;
1001 1000
1002 icons = purple_request_field_list_get_icons(field); 1001 icons = purple_request_field_list_get_icons(field);
1003 1002
1004 /* Create the scrolled window */ 1003 /* Create the scrolled window */
1005 sw = gtk_scrolled_window_new(NULL, NULL); 1004 sw = gtk_scrolled_window_new(NULL, NULL);
1049 gtk_list_store_append(store, &iter); 1048 gtk_list_store_append(store, &iter);
1050 1049
1051 if (icons) 1050 if (icons)
1052 { 1051 {
1053 const char *icon_path = (const char *)icons->data; 1052 const char *icon_path = (const char *)icons->data;
1054 char* filename = g_build_filename(DATADIR, icon_path, NULL); 1053 char* filename;
1055 1054 GdkPixbuf* pixbuf = NULL;
1056 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); 1055
1057 1056 if (icon_path)
1058 g_free(filename); 1057 {
1058 filename = g_build_filename(DATADIR, icon_path, NULL);
1059 pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
1060 g_free(filename);
1061 }
1059 1062
1060 gtk_list_store_set(store, &iter, 1063 gtk_list_store_set(store, &iter,
1061 0, purple_request_field_list_get_data(field, text), 1064 0, purple_request_field_list_get_data(field, text),
1062 1, text, 1065 1, text,
1063 2, pixbuf, 1066 2, pixbuf,