[glide] Default fontnames
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Default fontnames
- Date: Thu, 6 May 2010 11:54:48 +0000 (UTC)
commit b02f733e984d46993d9ca675c2de04519c1e670a
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu May 6 05:38:27 2010 -0400
Default fontnames
data/themes/default/theme.json | 3 ++-
libglide/glide-theme-priv.h | 2 ++
libglide/glide-theme.c | 21 +++++++++++++++++++++
libglide/glide-theme.h | 1 +
libglide/glide-window.c | 2 +-
5 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/data/themes/default/theme.json b/data/themes/default/theme.json
index 140a89e..3e0d124 100644
--- a/data/themes/default/theme.json
+++ b/data/themes/default/theme.json
@@ -1,5 +1,6 @@
{
"name":"Default Glide Theme",
"default-background":"background.png",
- "default-color":"#ffffffff"
+ "default-color":"#ffffffff",
+ "default-fontname":"Sans 35"
}
diff --git a/libglide/glide-theme-priv.h b/libglide/glide-theme-priv.h
index 0c8cc6d..a63aaf1 100644
--- a/libglide/glide-theme-priv.h
+++ b/libglide/glide-theme-priv.h
@@ -32,6 +32,8 @@ struct _GlideThemePrivate
gchar *working_path;
gchar *default_background;
+ gchar *default_fontname;
+
ClutterColor default_color;
};
diff --git a/libglide/glide-theme.c b/libglide/glide-theme.c
index 58eb38d..f168b52 100644
--- a/libglide/glide-theme.c
+++ b/libglide/glide-theme.c
@@ -37,6 +37,7 @@ enum {
PROP_NAME,
PROP_PATH,
PROP_BACKGROUND,
+ PROP_DEFAULT_FONTNAME,
PROP_DEFAULT_COLOR
};
@@ -99,6 +100,7 @@ glide_theme_load_file (GlideTheme *theme)
theme->priv->name = g_strdup (glide_json_object_get_string (root_object, "name"));
theme->priv->default_background = g_strconcat (theme->priv->working_path, "/", glide_json_object_get_string (root_object, "default-background"), NULL);
+ theme->priv->default_fontname = g_strdup (glide_json_object_get_string (root_object, "default-fontname"));
clutter_color_from_string(&theme->priv->default_color, glide_json_object_get_string (root_object, "default-color"));
g_object_unref (G_OBJECT (p));
@@ -122,6 +124,7 @@ glide_theme_finalize (GObject *object)
g_free (theme->priv->path);
g_free (theme->priv->default_background);
g_free (theme->priv->working_path);
+ g_free (theme->priv->default_fontname);
G_OBJECT_CLASS (glide_theme_parent_class)->finalize (object);
}
@@ -145,6 +148,10 @@ glide_theme_get_property (GObject *object,
break;
case PROP_BACKGROUND:
g_value_set_string (value, theme->priv->default_background);
+ break;
+ case PROP_DEFAULT_FONTNAME:
+ g_value_set_string (value, theme->priv->default_fontname);
+ break;
case PROP_DEFAULT_COLOR:
clutter_value_set_color (value, &theme->priv->default_color);
break;
@@ -204,6 +211,14 @@ glide_theme_class_init (GlideThemeClass *klass)
NULL,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (object_class, PROP_DEFAULT_FONTNAME,
+ g_param_spec_string ("default-fontname",
+ "Default fontname",
+ "The default fontname for the theme",
+ NULL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class, PROP_DEFAULT_COLOR,
clutter_param_spec_color ("default-color",
"Default Color",
@@ -262,6 +277,12 @@ glide_theme_get_path (GlideTheme *theme)
return theme->priv->path;
}
+const gchar *
+glide_theme_get_default_fontname (GlideTheme *theme)
+{
+ return theme->priv->default_fontname;
+}
+
void
glide_theme_get_default_color (GlideTheme *theme, ClutterColor *c)
{
diff --git a/libglide/glide-theme.h b/libglide/glide-theme.h
index 867daeb..72bdae6 100644
--- a/libglide/glide-theme.h
+++ b/libglide/glide-theme.h
@@ -73,6 +73,7 @@ GlideTheme *glide_theme_new (const gchar *path);
const gchar *glide_theme_get_path (GlideTheme *theme);
const gchar *glide_theme_get_name (GlideTheme *theme);
const gchar *glide_theme_get_default_background (GlideTheme *theme);
+const gchar *glide_theme_get_default_fontname (GlideTheme *theme);
void glide_theme_get_default_color (GlideTheme *theme, ClutterColor *c);
G_END_DECLS
diff --git a/libglide/glide-window.c b/libglide/glide-window.c
index 556b797..9533a90 100644
--- a/libglide/glide-window.c
+++ b/libglide/glide-window.c
@@ -937,7 +937,7 @@ glide_window_new_text_action_activate (GtkAction *a,
glide_text_set_color (GLIDE_TEXT (text), &cc);
glide_text_set_font_name (GLIDE_TEXT (text),
- glide_inspector_notebook_get_font_name (GLIDE_INSPECTOR_NOTEBOOK (w->priv->inspector_notebook)));
+ glide_theme_get_default_fontname (glide_document_get_theme (w->priv->document)));
glide_stage_manager_add_actor (w->priv->manager, GLIDE_ACTOR (text));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]