[glide] Begin adding theme preview widget



commit a76df285648e62a134efdf860e8880124d851fa6
Author: Robert Carr <racarr Valentine localdomain>
Date:   Tue May 25 14:56:59 2010 -0400

    Begin adding theme preview widget

 libglide/Makefile.am                |    2 +
 libglide/glide-theme-chooser.c      |   22 +++++++-
 libglide/glide-theme-preview-priv.h |   34 ++++++++++++
 libglide/glide-theme-preview.c      |   97 +++++++++++++++++++++++++++++++++++
 libglide/glide-theme-preview.h      |   58 +++++++++++++++++++++
 5 files changed, 211 insertions(+), 2 deletions(-)
---
diff --git a/libglide/Makefile.am b/libglide/Makefile.am
index 0dc16dd..5863a9f 100644
--- a/libglide/Makefile.am
+++ b/libglide/Makefile.am
@@ -63,6 +63,7 @@ glideheaders_HEADERS = \
 	glide-print-util.h \
 	glide-theme-manager.h \
 	glide-theme-chooser.h \
+	glide-theme-preview.h \
 	$(glide_VALABUILTHEADERS)
 
 glideheadersdir = $(pkgincludedir)
@@ -102,6 +103,7 @@ libglide_la_SOURCES = \
 	glide-print-util.c \
 	glide-theme-manager.c \
 	glide-theme-chooser.c \
+	glide-theme-preview.c \
 	$(glide_VALABUILTSOURCES)
 
 libglide_la_CFLAGS = \
diff --git a/libglide/glide-theme-chooser.c b/libglide/glide-theme-chooser.c
index b887c09..91179a4 100644
--- a/libglide/glide-theme-chooser.c
+++ b/libglide/glide-theme-chooser.c
@@ -27,6 +27,7 @@
 #include "glide-theme-chooser-priv.h"
 
 #include "glide-theme-manager.h"
+#include "glide-theme-preview.h"
 
 #include "glide-debug.h"
 
@@ -112,12 +113,29 @@ glide_theme_chooser_make_treeview (GlideThemeChooser *chooser)
   return ret;
 }
 
+static GtkWidget *
+glide_theme_chooser_make_main_hbox (GlideThemeChooser *chooser)
+{
+  GtkWidget *ret = gtk_hbox_new (FALSE, 0);
+  GtkWidget *tree_view, *preview;
+  
+  tree_view = glide_theme_chooser_make_treeview (chooser);
+  preview = glide_theme_preview_new ();
+  
+  gtk_widget_set_size_request (preview, 200, 200);
+  
+  gtk_box_pack_start (GTK_BOX (ret), tree_view, FALSE, 0, 0);
+  gtk_box_pack_start (GTK_BOX (ret), preview, FALSE, 0, 0);
+  
+  return ret;  
+}
+
 static void
 glide_theme_chooser_setup_ui (GlideThemeChooser *chooser)
 {
-  GtkWidget *tree_view = glide_theme_chooser_make_treeview (chooser);
+  GtkWidget *hbox = glide_theme_chooser_make_main_hbox (chooser);
   
-  gtk_container_add (GTK_CONTAINER (chooser), tree_view);
+  gtk_container_add (GTK_CONTAINER (chooser), hbox);
 }
 
 static void
diff --git a/libglide/glide-theme-preview-priv.h b/libglide/glide-theme-preview-priv.h
new file mode 100644
index 0000000..b215706
--- /dev/null
+++ b/libglide/glide-theme-preview-priv.h
@@ -0,0 +1,34 @@
+/*
+ * glide-theme-preview-priv.h
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Glide is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __GLIDE_THEME_PREVIEW_PRIVATE_H__
+#define __GLIDE_THEME_PREVIEW_PRIVATE_H__
+
+#include "glide-theme-preview.h"
+
+G_BEGIN_DECLS
+
+struct _GlideThemePreviewPrivate
+{
+  gpointer filler;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/libglide/glide-theme-preview.c b/libglide/glide-theme-preview.c
new file mode 100644
index 0000000..4b89307
--- /dev/null
+++ b/libglide/glide-theme-preview.c
@@ -0,0 +1,97 @@
+/*
+ * glide-theme-preview.c
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Glide is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * SECTION:glide-theme-preview
+ * @short_description: A widget for rendering theme previews.
+ *
+ */
+
+#include "glide-theme-preview.h"
+#include "glide-theme-preview-priv.h"
+
+#include "glide-theme-manager.h"
+
+#include "glide-debug.h"
+
+#define GLIDE_THEME_PREVIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GLIDE_TYPE_THEME_PREVIEW, GlideThemePreviewPrivate))
+
+G_DEFINE_TYPE(GlideThemePreview, glide_theme_preview, GTK_TYPE_DRAWING_AREA);
+
+enum {
+  PROP_0,
+};
+
+static void
+glide_theme_preview_finalize (GObject *object)
+{
+}
+
+static void
+glide_theme_preview_get_property (GObject *object,
+			      guint prop_id,
+			      GValue *value,
+			      GParamSpec *pspec)
+{
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+glide_theme_preview_set_property (GObject *object,
+			      guint prop_id,
+			      const GValue *value,
+			      GParamSpec *pspec)
+{
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+glide_theme_preview_init (GlideThemePreview *preview)
+{
+  preview->priv = GLIDE_THEME_PREVIEW_GET_PRIVATE (preview);
+}
+
+static void
+glide_theme_preview_class_init (GlideThemePreviewClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = glide_theme_preview_finalize;
+  object_class->get_property = glide_theme_preview_get_property;
+  object_class->set_property = glide_theme_preview_set_property;
+  
+  g_type_class_add_private (object_class, sizeof(GlideThemePreviewPrivate));
+}
+
+GtkWidget *
+glide_theme_preview_new ()
+{
+  return (GtkWidget *)g_object_new (GLIDE_TYPE_THEME_PREVIEW, NULL);
+}
+
+
diff --git a/libglide/glide-theme-preview.h b/libglide/glide-theme-preview.h
new file mode 100644
index 0000000..51935d7
--- /dev/null
+++ b/libglide/glide-theme-preview.h
@@ -0,0 +1,58 @@
+/*
+ * glide-theme-preview.h
+ * Copyright (C) Robert Carr 2010 <racarr gnome org>
+ * 
+ * Glide is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * Glide is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GLIDE_THEME_PREVIEW_H__
+#define __GLIDE_THEME_PREVIEW_H__
+
+#include <gtk/gtk.h>
+#include "glide-theme.h"
+
+G_BEGIN_DECLS
+
+#define GLIDE_TYPE_THEME_PREVIEW              (glide_theme_preview_get_type())
+#define GLIDE_THEME_PREVIEW(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GLIDE_TYPE_THEME_PREVIEW, GlideThemePreview))
+#define GLIDE_THEME_PREVIEW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), GLIDE_TYPE_THEME_PREVIEW, GlideThemePreviewClass))
+#define GLIDE_IS_THEME_PREVIEW(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GLIDE_TYPE_THEME_PREVIEW))
+#define GLIDE_IS_THEME_PREVIEW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIDE_TYPE_THEME_PREVIEW))
+#define GLIDE_THEME_PREVIEW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GLIDE_TYPE_THEME_PREVIEW, GlideThemePreviewClass))
+
+typedef struct _GlideThemePreviewPrivate GlideThemePreviewPrivate;
+
+
+typedef struct _GlideThemePreview GlideThemePreview;
+
+struct _GlideThemePreview
+{
+  GtkDrawingArea drawing_area;
+  
+  GlideThemePreviewPrivate *priv;
+};
+
+typedef struct _GlideThemePreviewClass GlideThemePreviewClass;
+
+struct _GlideThemePreviewClass
+{
+  GtkDrawingAreaClass parent_class;
+};
+
+GType glide_theme_preview_get_type (void) G_GNUC_CONST;
+GtkWidget *glide_theme_preview_new (void);
+
+G_END_DECLS
+
+#endif



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