diff options
author | Jasper St. Pierre <[email protected]> | 2015-07-20 23:56:10 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2015-09-14 18:48:15 +0200 |
commit | 58eedd315c3935741500115c34fe81c86ce9b88b (patch) | |
tree | 10878986df07b0522dd1ed89f1854a43e087e502 /src | |
parent | b4b73de038caffbca46e3f94e4ec056c16734f5c (diff) | |
download | marco-58eedd315c3935741500115c34fe81c86ce9b88b.tar.bz2 marco-58eedd315c3935741500115c34fe81c86ce9b88b.tar.xz |
ui: Refactor the default image lookup
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/ui.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/src/ui/ui.c b/src/ui/ui.c index 582ac43c..11a42e30 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -841,6 +841,20 @@ meta_ui_pop_delay_exposes (MetaUI *ui) meta_frames_pop_delay_exposes (ui->frames); } +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); +} + GdkPixbuf* meta_ui_get_default_window_icon (MetaUI *ui) { @@ -848,26 +862,7 @@ meta_ui_get_default_window_icon (MetaUI *ui) 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); } |