[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 01/20: Use fallback icon if regular icon fails to load.
noreply at xfce.org
noreply at xfce.org
Thu Feb 6 12:03:18 CET 2020
This is an automated email from the git hooks/post-receive script.
g o t t c o d e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit 066cdb3f6f1414ff788fa599ecdb9441ea59d5ce
Author: Graeme Gott <graeme at gottcode.org>
Date: Sun Feb 2 18:06:05 2020 -0500
Use fallback icon if regular icon fails to load.
---
panel-plugin/icon-renderer.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/panel-plugin/icon-renderer.cpp b/panel-plugin/icon-renderer.cpp
index 786b1ec..2293eb2 100644
--- a/panel-plugin/icon-renderer.cpp
+++ b/panel-plugin/icon-renderer.cpp
@@ -113,29 +113,35 @@ static void whiskermenu_icon_renderer_render(GtkCellRenderer* renderer, cairo_t*
const gint scale = gtk_widget_get_scale_factor(widget);
GtkIconTheme* icon_theme = gtk_icon_theme_get_for_screen(gtk_widget_get_screen(widget));
+ GdkWindow* window = gtk_widget_get_window(widget);
+
+ cairo_surface_t* surface = NULL;
GtkIconInfo* icon_info = gtk_icon_theme_lookup_by_gicon_for_scale(icon_theme,
icon_renderer->gicon,
icon_renderer->size,
scale,
GtkIconLookupFlags(GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_FORCE_SIZE));
+ if (icon_info)
+ {
+ surface = gtk_icon_info_load_surface(icon_info, window, NULL);
+ g_object_unref(icon_info);
+ }
- if (!icon_info)
+ if (!surface)
{
icon_info = gtk_icon_theme_lookup_icon_for_scale(icon_theme,
icon_renderer->launcher ? "application-x-executable" : "applications-other",
icon_renderer->size,
scale,
GtkIconLookupFlags(GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_FORCE_SIZE));
-
- if (!icon_info)
+ if (icon_info)
{
- return;
+ surface = gtk_icon_info_load_surface(icon_info, window, NULL);
+ g_object_unref(icon_info);
}
}
- cairo_surface_t* surface = gtk_icon_info_load_surface(icon_info, gtk_widget_get_window(widget), NULL);
- g_object_unref(icon_info);
if (!surface)
{
return;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list