[geany/geany-plugins] b930a5: treebrowser: fallback to "text-x-generic" icon if info lookup fails.

LarsDW223 git-noreply at xxxxx
Wed Jan 24 20:23:20 UTC 2018


Branch:      refs/heads/master
Author:      LarsDW223 <lars_paulsen at web.de>
Committer:   LarsDW223 <lars_paulsen at web.de>
Date:        Wed, 24 Jan 2018 20:23:20 UTC
Commit:      b930a5a54d4d332385e1023e9bb0286c9bd134ac
             https://github.com/geany/geany-plugins/commit/b930a5a54d4d332385e1023e9bb0286c9bd134ac

Log Message:
-----------
treebrowser: fallback to "text-x-generic" icon if info lookup fails.

If 'gtk_icon_theme_lookup_by_gicon()' returns NULL then try again with icon "text-x-generic".
Fixes #657.


Modified Paths:
--------------
    treebrowser/src/treebrowser.c

Modified: treebrowser/src/treebrowser.c
9 lines changed, 9 insertions(+), 0 deletions(-)
===================================================================
@@ -224,6 +224,15 @@ utils_pixbuf_from_path(gchar *path)
 		gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, NULL);
 		info = gtk_icon_theme_lookup_by_gicon(gtk_icon_theme_get_default(), icon, width, GTK_ICON_LOOKUP_USE_BUILTIN);
 		g_object_unref(icon);
+		if (!info)
+		{
+			icon = g_themed_icon_new("text-x-generic");
+			if (icon != NULL)
+			{
+				info = gtk_icon_theme_lookup_by_gicon(gtk_icon_theme_get_default(), icon, width, GTK_ICON_LOOKUP_USE_BUILTIN);
+				g_object_unref(icon);
+			}
+		}
 		if (!info)
 			return NULL;
 		ret = gtk_icon_info_load_icon (info, NULL);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list