tint2conf: Do not search for icons in all icon themes (issue #563)
o9000 mrovi9000@gmail.com
4 files changed,
7 insertions(+),
5 deletions(-)
M
src/launcher/icon-theme-common.c
→
src/launcher/icon-theme-common.c
@@ -740,7 +740,7 @@ add_to_cache(&wrapper->_cache, key, path);
g_free(key); } -char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size) +char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size, gboolean use_fallbacks) { if (!wrapper) return NULL;@@ -761,6 +761,8 @@ add_icon_path_to_cache(wrapper, icon_name, size, path);
return path; } + if (!use_fallbacks) + goto notfound; fprintf(stderr, YELLOW "Icon not found in default theme: %s" RESET "\n", icon_name); load_fallbacks(wrapper);
M
src/launcher/icon-theme-common.h
→
src/launcher/icon-theme-common.h
@@ -51,7 +51,7 @@ #define DEFAULT_ICON "application-x-executable"
// Returns the full path to an icon file (or NULL) given the list of icon themes to search and the icon name // Note: needs to be released with free(). -char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size); +char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size, gboolean use_fallbacks); // Returns a list of the directories used to store icons. // Do not free the result, it is cached.
M
src/launcher/launcher.c
→
src/launcher/launcher.c
@@ -565,13 +565,13 @@ free_icon(launcherIcon->image_hover);
free_icon(launcherIcon->image_pressed); launcherIcon->image = NULL; - char *new_icon_path = get_icon_path(launcher->icon_theme_wrapper, launcherIcon->icon_name, launcherIcon->icon_size); + char *new_icon_path = get_icon_path(launcher->icon_theme_wrapper, launcherIcon->icon_name, launcherIcon->icon_size, TRUE); if (new_icon_path) launcherIcon->image = load_image(new_icon_path, 1); // On loading error, fallback to default if (!launcherIcon->image) { free(new_icon_path); - new_icon_path = get_icon_path(launcher->icon_theme_wrapper, DEFAULT_ICON, launcherIcon->icon_size); + new_icon_path = get_icon_path(launcher->icon_theme_wrapper, DEFAULT_ICON, launcherIcon->icon_size, TRUE); if (new_icon_path) launcherIcon->image = imlib_load_image_immediately(new_icon_path); }
M
src/tint2conf/properties.c
→
src/tint2conf/properties.c
@@ -1640,7 +1640,7 @@ {
process_events(); int size = 22; - char *path = get_icon_path(icon_theme, name, size); + char *path = get_icon_path(icon_theme, name, size, FALSE); GdkPixbuf *pixbuf = path ? gdk_pixbuf_new_from_file_at_size(path, size, size, NULL) : NULL; free(path); return pixbuf;