[metacity] libmetacity: don't expose MetaStyleInfo



commit 7c2c303d082faa1c010de83deb967992c008985e
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Feb 7 22:32:14 2016 +0200

    libmetacity: don't expose MetaStyleInfo

 libmetacity/Makefile.am                            |    3 +-
 ...meta-style-info.h => meta-style-info-private.h} |   22 +++++----
 libmetacity/meta-style-info.c                      |    2 +-
 libmetacity/meta-theme-impl-private.h              |    2 +-
 libmetacity/meta-theme.c                           |   51 ++++++++++---------
 libmetacity/meta-theme.h                           |    6 +--
 src/ui/frames.c                                    |    4 +-
 src/ui/ui.c                                        |    4 +-
 theme-viewer/theme-viewer-window.c                 |    5 +-
 9 files changed, 48 insertions(+), 51 deletions(-)
---
diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am
index 4db4a2f..9f35331 100644
--- a/libmetacity/Makefile.am
+++ b/libmetacity/Makefile.am
@@ -32,7 +32,7 @@ libmetacity_la_SOURCES = \
        meta-hsla.c \
        meta-hsla-private.h \
        meta-style-info.c \
-       meta-style-info.h \
+       meta-style-info-private.h \
        meta-theme.c \
        meta-theme.h \
        meta-theme-gtk.c \
@@ -81,7 +81,6 @@ libmetacity_include_HEADERS = \
        meta-frame-style.h \
        meta-gradient.h \
        meta-gradient-spec.h \
-       meta-style-info.h \
        meta-theme.h \
        $(NULL)
 
diff --git a/libmetacity/meta-style-info.h b/libmetacity/meta-style-info-private.h
similarity index 64%
rename from libmetacity/meta-style-info.h
rename to libmetacity/meta-style-info-private.h
index 5356087..7f4a7b0 100644
--- a/libmetacity/meta-style-info.h
+++ b/libmetacity/meta-style-info-private.h
@@ -16,8 +16,8 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef META_STYLE_INFO_H
-#define META_STYLE_INFO_H
+#ifndef META_STYLE_INFO_PRIVATE_H
+#define META_STYLE_INFO_PRIVATE_H
 
 #include <gtk/gtk.h>
 
@@ -41,16 +41,20 @@ typedef struct
   GtkStyleContext *styles[META_STYLE_ELEMENT_LAST];
 } MetaStyleInfo;
 
-MetaStyleInfo *meta_style_info_new          (const gchar    *theme_name,
-                                             const gchar    *variant,
-                                             gboolean        composited);
+G_GNUC_INTERNAL
+MetaStyleInfo *meta_style_info_new       (const gchar    *theme_name,
+                                          const gchar    *variant,
+                                          gboolean        composited);
 
-MetaStyleInfo *meta_style_info_ref          (MetaStyleInfo  *style_info);
+G_GNUC_INTERNAL
+MetaStyleInfo *meta_style_info_ref       (MetaStyleInfo  *style_info);
 
-void           meta_style_info_unref        (MetaStyleInfo  *style_info);
+G_GNUC_INTERNAL
+void           meta_style_info_unref     (MetaStyleInfo  *style_info);
 
-void           meta_style_info_set_flags    (MetaStyleInfo  *style_info,
-                                             MetaFrameFlags  flags);
+G_GNUC_INTERNAL
+void           meta_style_info_set_flags (MetaStyleInfo  *style_info,
+                                          MetaFrameFlags  flags);
 
 G_END_DECLS
 
diff --git a/libmetacity/meta-style-info.c b/libmetacity/meta-style-info.c
index d619422..e415b8c 100644
--- a/libmetacity/meta-style-info.c
+++ b/libmetacity/meta-style-info.c
@@ -19,7 +19,7 @@
 #include "config.h"
 
 #include "meta-frame-enums.h"
-#include "meta-style-info.h"
+#include "meta-style-info-private.h"
 
 static void
 add_toplevel_class (GtkStyleContext *style,
diff --git a/libmetacity/meta-theme-impl-private.h b/libmetacity/meta-theme-impl-private.h
index 5278f55..f36f45f 100644
--- a/libmetacity/meta-theme-impl-private.h
+++ b/libmetacity/meta-theme-impl-private.h
@@ -21,7 +21,7 @@
 #include "meta-button-layout.h"
 #include "meta-frame-enums.h"
 #include "meta-frame-style.h"
-#include "meta-style-info.h"
+#include "meta-style-info-private.h"
 
 G_BEGIN_DECLS
 
diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c
index 4173e6c..0778ac8 100644
--- a/libmetacity/meta-theme.c
+++ b/libmetacity/meta-theme.c
@@ -25,6 +25,7 @@
 #include "meta-theme-gtk-private.h"
 #include "meta-theme-impl-private.h"
 #include "meta-theme-metacity-private.h"
+#include "meta-style-info-private.h"
 
 struct _MetaTheme
 {
@@ -54,6 +55,28 @@ static GParamSpec *theme_properties[LAST_PROP] = { NULL };
 
 G_DEFINE_TYPE (MetaTheme, meta_theme, G_TYPE_OBJECT)
 
+static MetaStyleInfo *
+meta_theme_get_style_info (MetaTheme   *theme,
+                           const gchar *variant)
+{
+  MetaStyleInfo *style_info;
+
+  if (variant == NULL)
+    variant = "default";
+
+  style_info = g_hash_table_lookup (theme->variants, variant);
+
+  if (style_info == NULL)
+    {
+      style_info = meta_style_info_new (theme->theme_name, variant,
+                                        theme->composited);
+
+      g_hash_table_insert (theme->variants, g_strdup (variant), style_info);
+    }
+
+  return style_info;
+}
+
 static void
 meta_theme_constructed (GObject *object)
 {
@@ -238,28 +261,6 @@ meta_theme_invalidate (MetaTheme *theme)
   g_hash_table_remove_all (theme->variants);
 }
 
-MetaStyleInfo *
-meta_theme_get_style_info (MetaTheme   *theme,
-                           const gchar *variant)
-{
-  MetaStyleInfo *style_info;
-
-  if (variant == NULL)
-    variant = "default";
-
-  style_info = g_hash_table_lookup (theme->variants, variant);
-
-  if (style_info == NULL)
-    {
-      style_info = meta_style_info_new (theme->theme_name, variant,
-                                        theme->composited);
-
-      g_hash_table_insert (theme->variants, g_strdup (variant), style_info);
-    }
-
-  return style_info;
-}
-
 void
 meta_theme_set_composited (MetaTheme *theme,
                            gboolean   composited)
@@ -384,12 +385,14 @@ meta_theme_get_frame_style (MetaTheme      *theme,
 }
 
 PangoFontDescription*
-meta_style_info_create_font_desc (MetaTheme     *theme,
-                                  MetaStyleInfo *style_info)
+meta_style_info_create_font_desc (MetaTheme   *theme,
+                                  const gchar *variant)
 {
+  MetaStyleInfo *style_info;
   GtkStyleContext *context;
   PangoFontDescription *font_desc;
 
+  style_info = meta_theme_get_style_info (theme, variant);
   context = style_info->styles[META_STYLE_ELEMENT_TITLE];
 
   gtk_style_context_save (context);
diff --git a/libmetacity/meta-theme.h b/libmetacity/meta-theme.h
index e966c0b..e3587c4 100644
--- a/libmetacity/meta-theme.h
+++ b/libmetacity/meta-theme.h
@@ -25,7 +25,6 @@
 #include <libmetacity/meta-frame-borders.h>
 #include <libmetacity/meta-frame-enums.h>
 #include <libmetacity/meta-frame-style.h>
-#include <libmetacity/meta-style-info.h>
 
 G_BEGIN_DECLS
 
@@ -158,9 +157,6 @@ gboolean              meta_theme_load                      (MetaTheme
 
 void                  meta_theme_invalidate                (MetaTheme                   *theme);
 
-MetaStyleInfo        *meta_theme_get_style_info            (MetaTheme                   *theme,
-                                                            const gchar                 *variant);
-
 void                  meta_theme_set_composited            (MetaTheme                   *theme,
                                                             gboolean                     composited);
 
@@ -176,7 +172,7 @@ MetaFrameStyle       *meta_theme_get_frame_style           (MetaTheme
                                                             MetaFrameFlags               flags);
 
 PangoFontDescription *meta_style_info_create_font_desc     (MetaTheme                   *theme,
-                                                            MetaStyleInfo               *style_info);
+                                                            const gchar                 *variant);
 
 gint                  meta_pango_font_desc_get_text_height (const PangoFontDescription  *font_desc,
                                                             PangoContext                *context);
diff --git a/src/ui/frames.c b/src/ui/frames.c
index d3c74d5..e202804 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -465,7 +465,6 @@ meta_frames_ensure_layout (MetaFrames  *frames,
     {
       gpointer key, value;
       MetaTheme *current;
-      MetaStyleInfo *style_info;
       PangoFontDescription *font_desc;
       int size;
 
@@ -476,9 +475,8 @@ meta_frames_ensure_layout (MetaFrames  *frames,
       pango_layout_set_single_paragraph_mode (frame->text_layout, TRUE);
 
       current = meta_theme_get_current ();
-      style_info = meta_theme_get_style_info (current, frame->theme_variant);
 
-      font_desc = meta_style_info_create_font_desc (current, style_info);
+      font_desc = meta_style_info_create_font_desc (current, frame->theme_variant);
       meta_frame_style_apply_scale (style, font_desc);
 
       size = pango_font_description_get_size (font_desc);
diff --git a/src/ui/ui.c b/src/ui/ui.c
index feb91d6..b2924bc 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -671,13 +671,11 @@ meta_ui_theme_get_frame_borders (MetaUI           *ui,
 
   if (meta_ui_have_a_theme ())
     {
-      MetaStyleInfo *style_info;
       MetaTheme *current;
 
       current = meta_theme_get_current ();
-      style_info = meta_theme_get_style_info (current, NULL);
 
-      font_desc = meta_style_info_create_font_desc (current, style_info);
+      font_desc = meta_style_info_create_font_desc (current, NULL);
       context = gtk_widget_get_pango_context (GTK_WIDGET (ui->frames));
 
       text_height = meta_pango_font_desc_get_text_height (font_desc, context);
diff --git a/theme-viewer/theme-viewer-window.c b/theme-viewer/theme-viewer-window.c
index 16a0fbe..c38d56a 100644
--- a/theme-viewer/theme-viewer-window.c
+++ b/theme-viewer/theme-viewer-window.c
@@ -204,7 +204,6 @@ update_title_layout (ThemeViewerWindow *window)
 {
   GtkWidget *widget;
   PangoLayout *layout;
-  MetaStyleInfo *style_info;
   PangoFontDescription *font_desc;
   MetaFrameType type;
   MetaFrameFlags flags;
@@ -216,8 +215,8 @@ update_title_layout (ThemeViewerWindow *window)
 
   layout = gtk_widget_create_pango_layout (widget, "Metacity Theme Viewer");
 
-  style_info = meta_theme_get_style_info (window->theme, window->theme_variant);
-  font_desc = meta_style_info_create_font_desc (window->theme, style_info);
+  font_desc = meta_style_info_create_font_desc (window->theme,
+                                                window->theme_variant);
 
   type = window->frame_type;
   flags = window->frame_flags;


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