diff --git a/ChangeLog b/ChangeLog index 9853e3280f..f87bb34209 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-04-25 Matthias Clasen + + Merged from trunk: + + * gtk/gtkicontheme.c (theme_lookup_icon): Set the filename to + NULL for builtin icons, since gtk_icon_info_get_builtin_pixbuf() + depends on it. + + * tests/testicontheme.c: Report builtin icons. + 2007-04-25 Matthias Clasen Merged from trunk: diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index afc594cae9..9014d1f8df 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -2019,13 +2019,23 @@ theme_lookup_icon (IconTheme *theme, suffix = best_suffix (suffix, allow_svg); g_assert (suffix != ICON_SUFFIX_NONE); - file = g_strconcat (icon_name, string_from_suffix (suffix), NULL); - icon_info->filename = g_build_filename (min_dir->dir, file, NULL); - g_free (file); + if (min_dir->dir) + { + file = g_strconcat (icon_name, string_from_suffix (suffix), NULL); + icon_info->filename = g_build_filename (min_dir->dir, file, NULL); + g_free (file); #ifdef G_OS_WIN32 - icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename, + icon_info->cp_filename = g_locale_from_utf8 (icon_info->filename, -1, NULL, NULL, NULL); #endif + } + else + { + icon_info->filename = NULL; +#ifdef G_OS_WIN32 + icon_info->cp_filename = NULL; +#endif + } if (min_dir->icon_data != NULL) icon_info->data = g_hash_table_lookup (min_dir->icon_data, icon_name); diff --git a/tests/testicontheme.c b/tests/testicontheme.c index a5ded578df..f71cdf0d47 100644 --- a/tests/testicontheme.c +++ b/tests/testicontheme.c @@ -116,9 +116,9 @@ main (int argc, char *argv[]) if (argc >= 5) size = atoi (argv[4]); - icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, 0); + icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, GTK_ICON_LOOKUP_USE_BUILTIN); g_print ("icon for %s at %dx%d is %s\n", argv[3], size, size, - icon_info ? gtk_icon_info_get_filename (icon_info) : ""); + icon_info ? (gtk_icon_info_get_builtin_pixbuf (icon_info) ? "" : gtk_icon_info_get_filename (icon_info)) : ""); if (icon_info) {