[glide] Themes now support background image



commit 9138bde64d9557fa5929432ae5f9acbdc562c4a5
Author: Robert Carr <racarr Valentine localdomain>
Date:   Thu May 6 04:48:54 2010 -0400

    Themes now support background image

 data/themes/default.glide-theme |    3 ++-
 libglide/glide-theme-priv.h     |    2 ++
 libglide/glide-theme.c          |   19 ++++++++++++++++++-
 libglide/glide-theme.h          |    1 +
 libglide/glide-window.c         |    7 +++++--
 5 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/data/themes/default.glide-theme b/data/themes/default.glide-theme
index 1796c20..01960bc 100644
--- a/data/themes/default.glide-theme
+++ b/data/themes/default.glide-theme
@@ -1 +1,2 @@
-{"name":"Default Glide Theme"}
\ No newline at end of file
+{"name":"Default Glide Theme",
+"default_background":"/home/racarr/Downloads/Cover.png"}		 
\ No newline at end of file
diff --git a/libglide/glide-theme-priv.h b/libglide/glide-theme-priv.h
index bc93f2e..bb21a01 100644
--- a/libglide/glide-theme-priv.h
+++ b/libglide/glide-theme-priv.h
@@ -28,6 +28,8 @@ struct _GlideThemePrivate
 {
   gchar *path;
   gchar *name;
+  
+  gchar *default_background;
 };
 
 G_END_DECLS
diff --git a/libglide/glide-theme.c b/libglide/glide-theme.c
index 1d10ef6..a881e8b 100644
--- a/libglide/glide-theme.c
+++ b/libglide/glide-theme.c
@@ -35,7 +35,8 @@ G_DEFINE_TYPE(GlideTheme, glide_theme, G_TYPE_OBJECT)
 enum {
   PROP_0,
   PROP_NAME,
-  PROP_PATH
+  PROP_PATH,
+  PROP_BACKGROUND
 };
 
 /*enum {
@@ -77,6 +78,7 @@ 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_strdup (glide_json_object_get_string (root_object, "default_background"));
   
   g_object_unref (G_OBJECT (p));
 }
@@ -97,6 +99,7 @@ glide_theme_finalize (GObject *object)
 
   g_free (theme->priv->name);
   g_free (theme->priv->path);
+  g_free (theme->priv->default_background);
   
   G_OBJECT_CLASS (glide_theme_parent_class)->finalize (object);
 }
@@ -167,6 +170,14 @@ glide_theme_class_init (GlideThemeClass *klass)
 							G_PARAM_READWRITE |
 							G_PARAM_STATIC_STRINGS |
 							G_PARAM_CONSTRUCT_ONLY));
+  g_object_class_install_property (object_class, PROP_BACKGROUND,
+				   g_param_spec_string ("default-background",
+							"Default background",
+							"The default background image for the theme",
+							NULL,
+							G_PARAM_READABLE |
+							G_PARAM_STATIC_STRINGS));
+
 
   g_type_class_add_private (object_class, sizeof(GlideThemePrivate));
 }
@@ -186,6 +197,12 @@ glide_theme_new (const gchar *name)
 }
 
 const gchar *
+glide_theme_get_default_background (GlideTheme *theme)
+{
+  return theme->priv->default_background;
+}
+
+const gchar *
 glide_theme_get_name (GlideTheme *theme)
 {
   return theme->priv->name;
diff --git a/libglide/glide-theme.h b/libglide/glide-theme.h
index 4e8e0f2..c339913 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);
 
 G_END_DECLS
 
diff --git a/libglide/glide-window.c b/libglide/glide-window.c
index 466d665..abae6fa 100644
--- a/libglide/glide-window.c
+++ b/libglide/glide-window.c
@@ -34,6 +34,7 @@
 
 #include "glide-slide.h"
 
+#include "glide-theme.h"
 #include "glide-debug.h"
 
 #include "glide-dirs.h"
@@ -404,9 +405,11 @@ static void
 glide_window_new_document_real (GlideWindow *w)
 {
   GlideDocument *d = glide_document_new ("New Document...");
+  GlideSlide *s;
 
   glide_window_set_document (w, d);
-  glide_document_append_slide (d);
+  s = glide_document_append_slide (d);
+  glide_slide_set_background (s, glide_theme_get_default_background (glide_document_get_theme (w->priv->document)));
   
   gtk_window_set_title (GTK_WINDOW (w), "Glide - (New Document)");
 }
@@ -956,7 +959,7 @@ glide_window_add_slide_action_activate (GtkAction *a,
   slide = glide_document_insert_slide (window->priv->document, 
 				       glide_stage_manager_get_current_slide (window->priv->manager));
   
-  glide_slide_set_background (slide, glide_slide_get_background (oslide));
+  glide_slide_set_background (slide, glide_theme_get_default_background (glide_document_get_theme (window->priv->document)));
    
   glide_slide_get_color (oslide, &oc);
   glide_slide_set_color (slide, &oc);



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