diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2015-12-11 14:19:40 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2015-12-11 14:19:40 +0100 |
| commit | 2a03b25aaa11d34ad90f6f76e3c7df985fa50cd2 (patch) | |
| tree | 7f6509e2f7cc2d3344cb40719a3fa82757d5628f | |
| parent | e2afdc32bac9f0ea58e9d7d30dd44cd539a9ab40 (diff) | |
Make fallback to "image-missing" more generic
Always provide a "image-missing" fallback if icon loading of any kind failed for any reason. Still log failure from gdk_pixbuf_new_from_file_at_size() failures. (bzr r4036.8.2)
| -rw-r--r-- | panel/PanelIndicatorEntryView.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/panel/PanelIndicatorEntryView.cpp b/panel/PanelIndicatorEntryView.cpp index 5ab01eedd..121c69412 100644 --- a/panel/PanelIndicatorEntryView.cpp +++ b/panel/PanelIndicatorEntryView.cpp @@ -248,15 +248,10 @@ glib::Object<GdkPixbuf> PanelIndicatorEntryView::MakePixbuf(int size) { auto* filename = gtk_icon_info_get_filename(info); pixbuf = gdk_pixbuf_new_from_file_at_size(filename, -1, size, nullptr); - // see LP: #1525186, stuff fails to load and it would be bad to - // not have any fallback + // if that failed, whine and load fallback if (!pixbuf) { - // if that failed, whine and load fallback - LOG_WARN(logger) << "failed to load: " << filename; - const std::string missing = "image-missing"; - pixbuf = gtk_icon_theme_load_icon(theme, missing.c_str(), size, flags, nullptr); - break; + LOG_WARN(logger) << "failed to load: " << filename; } } else if (image_type == GTK_IMAGE_ICON_NAME) @@ -268,6 +263,16 @@ glib::Object<GdkPixbuf> PanelIndicatorEntryView::MakePixbuf(int size) } } + // have a generic fallback pixbuf if for whatever reason icon loading + // failed (see LP: #1525186) + if(!pixbuf) + { + const std::string missing = "image-missing"; + GtkIconTheme* theme = gtk_icon_theme_get_default(); + auto flags = GTK_ICON_LOOKUP_FORCE_SIZE; + pixbuf = gtk_icon_theme_load_icon(theme, missing.c_str(), size, flags, nullptr); + } + return pixbuf; } |
