diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-01-31 05:25:05 +0200 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-01-31 05:25:05 +0200 |
commit | fdb06ae5150413912295505300b8a7c5dbc226eb (patch) | |
tree | a85fb586643f5e68fd0d26a633fc9876455249ad /src/ui | |
parent | 2a44a0d3b21d8cf7e69c6c02224713e70bac1dba (diff) | |
download | metacity-fdb06ae5150413912295505300b8a7c5dbc226eb.tar.gz |
theme: move style_sets_by_type to MetaThemeImpl
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/theme-parser.c | 18 | ||||
-rw-r--r-- | src/ui/theme-private.h | 2 | ||||
-rw-r--r-- | src/ui/theme.c | 16 |
3 files changed, 10 insertions, 26 deletions
diff --git a/src/ui/theme-parser.c b/src/ui/theme-parser.c index 9f02dac9..dd4b0bd8 100644 --- a/src/ui/theme-parser.c +++ b/src/ui/theme-parser.c @@ -1179,7 +1179,7 @@ parse_toplevel_element (GMarkupParseContext *context, return; } - if (info->theme->style_sets_by_type[type] != NULL) + if (meta_theme_impl_get_style_set (info->theme->impl, type) != NULL) { set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE, _("Window type \"%s\" has already been assigned a style set"), @@ -1188,7 +1188,7 @@ parse_toplevel_element (GMarkupParseContext *context, } meta_frame_style_set_ref (style_set); - info->theme->style_sets_by_type[type] = style_set; + meta_theme_impl_add_style_set (info->theme->impl, type, style_set); push_state (info, STATE_WINDOW); } @@ -3672,7 +3672,8 @@ meta_theme_validate (MetaTheme *theme, } for (i = 0; i < (int)META_FRAME_TYPE_LAST; i++) - if (i != (int)META_FRAME_TYPE_ATTACHED && theme->style_sets_by_type[i] == NULL) + if (i != (int)META_FRAME_TYPE_ATTACHED && + meta_theme_impl_get_style_set (theme->impl, i) == NULL) { g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED, _("No frame style set for window type \"%s\" in theme \"%s\", add a <window type=\"%s\" style_set=\"whatever\"/> element"), @@ -4123,8 +4124,6 @@ theme_error_is_fatal (GError *error) static void clear_theme (MetaTheme *theme) { - gint i; - g_free (theme->name); theme->name = NULL; @@ -4157,15 +4156,6 @@ clear_theme (MetaTheme *theme) g_hash_table_remove_all (theme->images_by_filename); - for (i = 0; i < META_FRAME_TYPE_LAST; i++) - { - if (theme->style_sets_by_type[i] == NULL) - continue; - - meta_frame_style_set_unref (theme->style_sets_by_type[i]); - theme->style_sets_by_type[i] = NULL; - } - g_clear_object (&theme->impl); theme->impl = g_object_new (META_TYPE_THEME_METACITY, NULL); } diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h index f0e6a629..9d547f88 100644 --- a/src/ui/theme-private.h +++ b/src/ui/theme-private.h @@ -66,8 +66,6 @@ struct _MetaTheme GHashTable *images_by_filename; - MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST]; - MetaThemeImpl *impl; }; diff --git a/src/ui/theme.c b/src/ui/theme.c index 112c1496..56ef0148 100644 --- a/src/ui/theme.c +++ b/src/ui/theme.c @@ -1715,7 +1715,8 @@ theme_set_current_gtk (const gchar *name, } meta_frame_style_unref (style); - meta_current_theme->style_sets_by_type[frame_type] = style_set; + meta_theme_impl_add_style_set (meta_current_theme->impl, + frame_type, style_set); } } @@ -1764,8 +1765,6 @@ meta_theme_new (MetaThemeType type) void meta_theme_free (MetaTheme *theme) { - int i; - g_return_if_fail (theme != NULL); g_free (theme->name); @@ -1782,10 +1781,6 @@ meta_theme_free (MetaTheme *theme) g_hash_table_destroy (theme->images_by_filename); - for (i = 0; i < META_FRAME_TYPE_LAST; i++) - if (theme->style_sets_by_type[i]) - meta_frame_style_set_unref (theme->style_sets_by_type[i]); - g_clear_object (&theme->impl); DEBUG_FILL_STRUCT (theme); @@ -1818,16 +1813,17 @@ theme_get_style (MetaTheme *theme, MetaFrameStyle *style; MetaFrameStyleSet *style_set; - style_set = theme->style_sets_by_type[type]; + style_set = meta_theme_impl_get_style_set (theme->impl, type); if (style_set == NULL && type == META_FRAME_TYPE_ATTACHED) - style_set = theme->style_sets_by_type[META_FRAME_TYPE_BORDER]; + style_set = meta_theme_impl_get_style_set (theme->impl, META_FRAME_TYPE_BORDER); /* Right now the parser forces a style set for all other types, * but this fallback code is here in case I take that out. */ if (style_set == NULL) - style_set = theme->style_sets_by_type[META_FRAME_TYPE_NORMAL]; + style_set = meta_theme_impl_get_style_set (theme->impl, META_FRAME_TYPE_NORMAL); + if (style_set == NULL) return NULL; |