[glide] Themes have default colors
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Themes have default colors
- Date: Thu, 6 May 2010 11:54:42 +0000 (UTC)
commit 8506a58c5366d4c20d3d43ec0f6fc5e642349693
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu May 6 05:32:25 2010 -0400
Themes have default colors
data/themes/default/theme.json | 7 +++++--
libglide/glide-theme-priv.h | 1 +
libglide/glide-theme.c | 23 +++++++++++++++++++++--
libglide/glide-theme.h | 4 ++--
libglide/glide-window.c | 2 +-
5 files changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/data/themes/default/theme.json b/data/themes/default/theme.json
index 18c585e..140a89e 100644
--- a/data/themes/default/theme.json
+++ b/data/themes/default/theme.json
@@ -1,2 +1,5 @@
-{"name":"Default Glide Theme",
-"default_background":"background.png"}
\ No newline at end of file
+{
+ "name":"Default Glide Theme",
+ "default-background":"background.png",
+ "default-color":"#ffffffff"
+}
diff --git a/libglide/glide-theme-priv.h b/libglide/glide-theme-priv.h
index fbaad38..0c8cc6d 100644
--- a/libglide/glide-theme-priv.h
+++ b/libglide/glide-theme-priv.h
@@ -32,6 +32,7 @@ struct _GlideThemePrivate
gchar *working_path;
gchar *default_background;
+ ClutterColor default_color;
};
G_END_DECLS
diff --git a/libglide/glide-theme.c b/libglide/glide-theme.c
index b4de9e4..58eb38d 100644
--- a/libglide/glide-theme.c
+++ b/libglide/glide-theme.c
@@ -36,7 +36,8 @@ enum {
PROP_0,
PROP_NAME,
PROP_PATH,
- PROP_BACKGROUND
+ PROP_BACKGROUND,
+ PROP_DEFAULT_COLOR
};
/*enum {
@@ -97,7 +98,8 @@ glide_theme_load_file (GlideTheme *theme)
root_object = json_node_get_object (root);
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_background = g_strconcat (theme->priv->working_path, "/", glide_json_object_get_string (root_object, "default-background"), NULL);
+ clutter_color_from_string(&theme->priv->default_color, glide_json_object_get_string (root_object, "default-color"));
g_object_unref (G_OBJECT (p));
}
@@ -141,6 +143,11 @@ glide_theme_get_property (GObject *object,
case PROP_PATH:
g_value_set_string (value, theme->priv->path);
break;
+ case PROP_BACKGROUND:
+ g_value_set_string (value, theme->priv->default_background);
+ case PROP_DEFAULT_COLOR:
+ clutter_value_set_color (value, &theme->priv->default_color);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -197,6 +204,12 @@ glide_theme_class_init (GlideThemeClass *klass)
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",
+ "The default fill color for the theme",
+ NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_type_class_add_private (object_class, sizeof(GlideThemePrivate));
@@ -249,4 +262,10 @@ glide_theme_get_path (GlideTheme *theme)
return theme->priv->path;
}
+void
+glide_theme_get_default_color (GlideTheme *theme, ClutterColor *c)
+{
+ *c = theme->priv->default_color;
+}
+
diff --git a/libglide/glide-theme.h b/libglide/glide-theme.h
index c339913..867daeb 100644
--- a/libglide/glide-theme.h
+++ b/libglide/glide-theme.h
@@ -20,8 +20,7 @@
#ifndef __GLIDE_THEME_H__
#define __GLIDE_THEME_H__
-#include <glib.h>
-#include <glib-object.h>
+#include <clutter/clutter.h>
#include <json-glib/json-glib.h>
@@ -74,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);
+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 abae6fa..556b797 100644
--- a/libglide/glide-window.c
+++ b/libglide/glide-window.c
@@ -932,7 +932,7 @@ glide_window_new_text_action_activate (GtkAction *a,
ClutterActor *text = glide_text_new ();
ClutterColor cc;
- glide_inspector_notebook_get_text_color (GLIDE_INSPECTOR_NOTEBOOK (w->priv->inspector_notebook), &cc);
+ glide_theme_get_default_color (glide_document_get_theme (w->priv->document), &cc);
glide_text_set_color (GLIDE_TEXT (text), &cc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]