tint2conf: Do not search for icons in all icon themes (issue #563)
This commit is contained in:
parent
b6a4fe03df
commit
acd1ed5768
4 changed files with 7 additions and 5 deletions
|
@ -740,7 +740,7 @@ void add_icon_path_to_cache(IconThemeWrapper *wrapper, const char *icon_name, in
|
|||
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 @@ char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size)
|
|||
return path;
|
||||
}
|
||||
|
||||
if (!use_fallbacks)
|
||||
goto notfound;
|
||||
fprintf(stderr, YELLOW "Icon not found in default theme: %s" RESET "\n", icon_name);
|
||||
load_fallbacks(wrapper);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void free_icon_theme(IconTheme *theme);
|
|||
|
||||
// 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.
|
||||
|
|
|
@ -565,13 +565,13 @@ void launcher_reload_icon_image(Launcher *launcher, LauncherIcon *launcherIcon)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -1640,7 +1640,7 @@ GdkPixbuf *load_icon(const gchar *name)
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue