[metacity] libmetacity: add a vfunc to load theme



commit 9c6467a56298e4adcfdb1b89e66dbcc340362dc6
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Jan 31 05:57:28 2016 +0200

    libmetacity: add a vfunc to load theme

 libmetacity/meta-theme-impl.c |   27 +++++++++++++++++++++++++++
 libmetacity/meta-theme-impl.h |   18 +++++++++++++-----
 po/POTFILES.in                |    1 +
 3 files changed, 41 insertions(+), 5 deletions(-)
---
diff --git a/libmetacity/meta-theme-impl.c b/libmetacity/meta-theme-impl.c
index 66a5552..19d0354 100644
--- a/libmetacity/meta-theme-impl.c
+++ b/libmetacity/meta-theme-impl.c
@@ -17,8 +17,11 @@
 
 #include "config.h"
 
+#include <glib/gi18n.h>
+
 #include "meta-frame-style.h"
 #include "meta-theme-impl.h"
+#include "meta-theme.h"
 
 typedef struct
 {
@@ -49,6 +52,20 @@ meta_theme_impl_dispose (GObject *object)
   G_OBJECT_CLASS (meta_theme_impl_parent_class)->dispose (object);
 }
 
+static gboolean
+meta_theme_real_impl_load (MetaThemeImpl  *impl,
+                           const gchar    *name,
+                           GError        **error)
+{
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
+               _("MetaThemeImplClass::load not implemented for '%s'"),
+               g_type_name (G_TYPE_FROM_INSTANCE (impl)));
+
+  return FALSE;
+}
+
 static void
 meta_theme_impl_class_init (MetaThemeImplClass *impl_class)
 {
@@ -57,6 +74,8 @@ meta_theme_impl_class_init (MetaThemeImplClass *impl_class)
   object_class = G_OBJECT_CLASS (impl_class);
 
   object_class->dispose = meta_theme_impl_dispose;
+
+  impl_class->load = meta_theme_real_impl_load;
 }
 
 static void
@@ -64,6 +83,14 @@ meta_theme_impl_init (MetaThemeImpl *impl)
 {
 }
 
+gboolean
+meta_theme_impl_load (MetaThemeImpl  *impl,
+                      const gchar    *name,
+                      GError        **error)
+{
+  return META_THEME_IMPL_GET_CLASS (impl)->load (impl, name, error);
+}
+
 void
 meta_theme_impl_add_style_set (MetaThemeImpl     *impl,
                                MetaFrameType      type,
diff --git a/libmetacity/meta-theme-impl.h b/libmetacity/meta-theme-impl.h
index 9e03fe0..2096de8 100644
--- a/libmetacity/meta-theme-impl.h
+++ b/libmetacity/meta-theme-impl.h
@@ -32,14 +32,22 @@ G_DECLARE_DERIVABLE_TYPE (MetaThemeImpl, meta_theme_impl,
 struct _MetaThemeImplClass
 {
   GObjectClass parent_class;
+
+  gboolean (* load) (MetaThemeImpl  *impl,
+                     const gchar    *name,
+                     GError        **error);
 };
 
-void               meta_theme_impl_add_style_set (MetaThemeImpl     *impl,
-                                                  MetaFrameType      type,
-                                                  MetaFrameStyleSet *style_set);
+gboolean           meta_theme_impl_load          (MetaThemeImpl      *impl,
+                                                  const gchar        *name,
+                                                  GError            **error);
+
+void               meta_theme_impl_add_style_set (MetaThemeImpl      *impl,
+                                                  MetaFrameType       type,
+                                                  MetaFrameStyleSet  *style_set);
 
-MetaFrameStyleSet *meta_theme_impl_get_style_set (MetaThemeImpl     *impl,
-                                                  MetaFrameType      type);
+MetaFrameStyleSet *meta_theme_impl_get_style_set (MetaThemeImpl      *impl,
+                                                  MetaFrameType       type);
 
 G_END_DECLS
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5143346..f74a972 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@ libmetacity/meta-draw-spec.c
 libmetacity/meta-frame-layout.c
 libmetacity/meta-frame-style.c
 libmetacity/meta-gradient-spec.c
+libmetacity/meta-theme-impl.c
 libmetacity/meta-theme-metacity.c
 src/50-metacity-navigation.xml.in
 src/50-metacity-system.xml.in


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]