mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
window: Refactor the default image lookup
This commit is contained in:
parent
dcc4ce4ff4
commit
f3d30d897f
@ -4890,6 +4890,20 @@ redraw_icon (MetaWindow *window)
|
||||
meta_ui_queue_frame_draw (window->screen->ui, window->frame->xwindow);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
load_default_window_icon (int size)
|
||||
{
|
||||
GtkIconTheme *theme = gtk_icon_theme_get_default ();
|
||||
const char *icon_name;
|
||||
|
||||
if (gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME))
|
||||
icon_name = META_DEFAULT_ICON_NAME;
|
||||
else
|
||||
icon_name = "image-missing";
|
||||
|
||||
return gtk_icon_theme_load_icon (theme, icon_name, size, 0, NULL);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
get_default_window_icon (void)
|
||||
{
|
||||
@ -4897,26 +4911,7 @@ get_default_window_icon (void)
|
||||
|
||||
if (default_icon == NULL)
|
||||
{
|
||||
GtkIconTheme *theme;
|
||||
gboolean icon_exists;
|
||||
|
||||
theme = gtk_icon_theme_get_default ();
|
||||
|
||||
icon_exists = gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME);
|
||||
|
||||
if (icon_exists)
|
||||
default_icon = gtk_icon_theme_load_icon (theme,
|
||||
META_DEFAULT_ICON_NAME,
|
||||
META_ICON_WIDTH,
|
||||
0,
|
||||
NULL);
|
||||
else
|
||||
default_icon = gtk_icon_theme_load_icon (theme,
|
||||
"image-missing",
|
||||
META_ICON_WIDTH,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
default_icon = load_default_window_icon (META_ICON_WIDTH);
|
||||
g_assert (default_icon);
|
||||
}
|
||||
|
||||
@ -4930,26 +4925,7 @@ get_default_mini_icon (void)
|
||||
|
||||
if (default_icon == NULL)
|
||||
{
|
||||
GtkIconTheme *theme;
|
||||
gboolean icon_exists;
|
||||
|
||||
theme = gtk_icon_theme_get_default ();
|
||||
|
||||
icon_exists = gtk_icon_theme_has_icon (theme, META_DEFAULT_ICON_NAME);
|
||||
|
||||
if (icon_exists)
|
||||
default_icon = gtk_icon_theme_load_icon (theme,
|
||||
META_DEFAULT_ICON_NAME,
|
||||
META_MINI_ICON_WIDTH,
|
||||
0,
|
||||
NULL);
|
||||
else
|
||||
default_icon = gtk_icon_theme_load_icon (theme,
|
||||
"image-missing",
|
||||
META_MINI_ICON_WIDTH,
|
||||
0,
|
||||
NULL);
|
||||
|
||||
default_icon = load_default_window_icon (META_MINI_ICON_WIDTH);
|
||||
g_assert (default_icon);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user