summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmetacity/Makefile.am3
-rw-r--r--libmetacity/meta-style-info-private.h (renamed from libmetacity/meta-style-info.h)22
-rw-r--r--libmetacity/meta-style-info.c2
-rw-r--r--libmetacity/meta-theme-impl-private.h2
-rw-r--r--libmetacity/meta-theme.c51
-rw-r--r--libmetacity/meta-theme.h6
-rw-r--r--src/ui/frames.c4
-rw-r--r--src/ui/ui.c4
-rw-r--r--theme-viewer/theme-viewer-window.c5
9 files changed, 48 insertions, 51 deletions
diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am
index 4db4a2f3..9f353311 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
index 53560874..7f4a7b08 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 d6194222..e415b8ca 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 5278f55c..f36f45f5 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 4173e6c0..0778ac89 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 e966c0b0..e3587c47 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 d3c74d5f..e202804d 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 feb91d60..b2924bc3 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 16a0fbe0..c38d56a9 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;