[glide] Add a theme property to theme preview



commit a899c66d99cb3ae0d1f35263c9953aa405dc3032
Author: Robert Carr <racarr Valentine localdomain>
Date:   Tue May 25 15:04:35 2010 -0400

    Add a theme property to theme preview

 libglide/glide-theme-preview-priv.h |    2 +-
 libglide/glide-theme-preview.c      |   32 ++++++++++++++++++++++++++++++++
 libglide/glide-theme-preview.h      |    3 +++
 3 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/libglide/glide-theme-preview-priv.h b/libglide/glide-theme-preview-priv.h
index b215706..1200eed 100644
--- a/libglide/glide-theme-preview-priv.h
+++ b/libglide/glide-theme-preview-priv.h
@@ -26,7 +26,7 @@ G_BEGIN_DECLS
 
 struct _GlideThemePreviewPrivate
 {
-  gpointer filler;
+  GlideTheme *theme;
 };
 
 G_END_DECLS
diff --git a/libglide/glide-theme-preview.c b/libglide/glide-theme-preview.c
index 0b87f89..8c78745 100644
--- a/libglide/glide-theme-preview.c
+++ b/libglide/glide-theme-preview.c
@@ -35,6 +35,7 @@ G_DEFINE_TYPE(GlideThemePreview, glide_theme_preview, GTK_TYPE_DRAWING_AREA);
 
 enum {
   PROP_0,
+  PROP_THEME
 };
 
 static gboolean
@@ -62,8 +63,12 @@ glide_theme_preview_get_property (GObject *object,
 			      GValue *value,
 			      GParamSpec *pspec)
 {
+  GlideThemePreview *preview = (GlideThemePreview *)object;
   switch (prop_id)
     {
+    case PROP_THEME:
+      g_value_set_object (value, preview->priv->theme);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -76,8 +81,12 @@ glide_theme_preview_set_property (GObject *object,
 			      const GValue *value,
 			      GParamSpec *pspec)
 {
+  GlideThemePreview *preview = (GlideThemePreview *)object;
   switch (prop_id)
     {
+    case PROP_THEME:
+      glide_theme_preview_set_theme (preview, (GlideTheme *)g_value_get_object (value));
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -101,6 +110,15 @@ glide_theme_preview_class_init (GlideThemePreviewClass *klass)
   object_class->set_property = glide_theme_preview_set_property;
   
   widget_class->expose_event = glide_theme_preview_expose_event;
+
+  g_object_class_install_property (object_class,
+				   PROP_THEME,
+				   g_param_spec_object ("theme",
+							"Theme",
+							"The theme we are previewing",
+							GLIDE_TYPE_THEME,
+							G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   
   g_type_class_add_private (object_class, sizeof(GlideThemePreviewPrivate));
 }
@@ -111,4 +129,18 @@ glide_theme_preview_new ()
   return (GtkWidget *)g_object_new (GLIDE_TYPE_THEME_PREVIEW, NULL);
 }
 
+void
+glide_theme_preview_set_theme (GlideThemePreview *preview,
+			       GlideTheme *theme)
+{
+  preview->priv->theme = theme;
+  g_object_notify (G_OBJECT (preview), "theme");
+  
+  gtk_widget_queue_draw (GTK_WIDGET (preview));
+}
 
+GlideTheme *
+glide_theme_preview_get_theme (GlideThemePreview *preview)
+{
+  return preview->priv->theme;
+}
diff --git a/libglide/glide-theme-preview.h b/libglide/glide-theme-preview.h
index 51935d7..ae02478 100644
--- a/libglide/glide-theme-preview.h
+++ b/libglide/glide-theme-preview.h
@@ -53,6 +53,9 @@ struct _GlideThemePreviewClass
 GType glide_theme_preview_get_type (void) G_GNUC_CONST;
 GtkWidget *glide_theme_preview_new (void);
 
+void glide_theme_preview_set_theme (GlideThemePreview *preview, GlideTheme *theme);
+GlideTheme *glide_theme_preview_get_theme (GlideThemePreview *preview);
+
 G_END_DECLS
 
 #endif



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