[glide] Begin implementing a glide theme class
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Begin implementing a glide theme class
- Date: Thu, 6 May 2010 08:48:57 +0000 (UTC)
commit dd79ac35bb09419c891f67079a9d8dd8d8e758ff
Author: Robert Carr <racarr Valentine localdomain>
Date: Thu May 6 04:16:14 2010 -0400
Begin implementing a glide theme class
libglide/Makefile.am | 2 +
libglide/glide-theme-priv.h | 35 +++++++++
libglide/glide-theme.c | 163 +++++++++++++++++++++++++++++++++++++++++++
libglide/glide-theme.h | 79 +++++++++++++++++++++
4 files changed, 279 insertions(+), 0 deletions(-)
---
diff --git a/libglide/Makefile.am b/libglide/Makefile.am
index 85c166f..c32e4f4 100644
--- a/libglide/Makefile.am
+++ b/libglide/Makefile.am
@@ -53,6 +53,7 @@ glideheaders_HEADERS = \
glide-window.h \
glide-inspector-window.h \
glide.h \
+ glide-theme.h \
$(glide_VALABUILTHEADERS)
glideheadersdir = $(pkgincludedir)
@@ -85,6 +86,7 @@ libglide_la_SOURCES = \
glide-inspector-text.c \
glide-inspector-window.c \
glide.c \
+ glide-theme.c \
$(glide_VALABUILTSOURCES)
libglide_la_CFLAGS = \
diff --git a/libglide/glide-theme-priv.h b/libglide/glide-theme-priv.h
new file mode 100644
index 0000000..bc93f2e
--- /dev/null
+++ b/libglide/glide-theme-priv.h
@@ -0,0 +1,35 @@
+/*
+ * glide-theme-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_PRIVATE_H__
+#define __GLIDE_THEME_PRIVATE_H__
+
+#include "glide-theme.h"
+
+G_BEGIN_DECLS
+
+struct _GlideThemePrivate
+{
+ gchar *path;
+ gchar *name;
+};
+
+G_END_DECLS
+
+#endif /* __GLIDE_THEME_PRIVATE_H__ */
diff --git a/libglide/glide-theme.c b/libglide/glide-theme.c
new file mode 100644
index 0000000..43da76e
--- /dev/null
+++ b/libglide/glide-theme.c
@@ -0,0 +1,163 @@
+/*
+ * glide-theme.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/>.
+ */
+
+#include <stdlib.h>
+
+#include "glide-theme.h"
+#include "glide-theme-priv.h"
+
+#include <girepository.h>
+#include <glib/gstdio.h>
+
+#include <gio/gio.h>
+
+#include "glide-debug.h"
+
+
+G_DEFINE_TYPE(GlideTheme, glide_theme, G_TYPE_OBJECT)
+
+#define GLIDE_THEME_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GLIDE_TYPE_THEME, GlideThemePrivate))
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ PROP_PATH
+};
+
+/*enum {
+ LAST_SIGNAL
+};
+
+static guint theme_signals[LAST_SIGNAL] = { 0, };*/
+
+
+static void
+glide_theme_set_path (GlideTheme *theme, gchar *path)
+{
+ g_return_if_fail (theme->priv->path == NULL);
+ theme->priv->path = path;
+}
+
+static void
+glide_theme_finalize (GObject *object)
+{
+ GlideTheme *theme = GLIDE_THEME (object);
+
+ g_free (theme->priv->name);
+ g_free (theme->priv->path);
+
+ G_OBJECT_CLASS (glide_theme_parent_class)->finalize (object);
+}
+
+
+static void
+glide_theme_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GlideTheme *theme = GLIDE_THEME (object);
+
+ switch (prop_id)
+ {
+ case PROP_NAME:
+ g_value_set_string (value, theme->priv->name);
+ break;
+ case PROP_PATH:
+ g_value_set_string (value, theme->priv->path);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+glide_theme_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GlideTheme *theme = GLIDE_THEME (object);
+
+ switch (prop_id)
+ {
+ case PROP_PATH:
+ glide_theme_set_path (theme, g_value_dup_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+glide_theme_class_init (GlideThemeClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = glide_theme_finalize;
+ object_class->set_property = glide_theme_set_property;
+ object_class->get_property = glide_theme_get_property;
+
+ g_object_class_install_property (object_class, PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the theme",
+ NULL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class, PROP_PATH,
+ g_param_spec_string ("path",
+ "Path",
+ "Path of the theme",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_CONSTRUCT_ONLY));
+
+ g_type_class_add_private (object_class, sizeof(GlideThemePrivate));
+}
+
+static void
+glide_theme_init (GlideTheme *d)
+{
+ d->priv = GLIDE_THEME_GET_PRIVATE (d);
+}
+
+GlideTheme *
+glide_theme_new (const gchar *name)
+{
+ return g_object_new (GLIDE_TYPE_THEME,
+ "path", name,
+ NULL);
+}
+
+const gchar *
+glide_theme_get_name (GlideTheme *theme)
+{
+ return theme->priv->name;
+}
+
+const gchar *
+glide_theme_get_path (GlideTheme *theme)
+{
+ return theme->priv->path;
+}
+
+
diff --git a/libglide/glide-theme.h b/libglide/glide-theme.h
new file mode 100644
index 0000000..4e8e0f2
--- /dev/null
+++ b/libglide/glide-theme.h
@@ -0,0 +1,79 @@
+/*
+ * glide-theme.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_H__
+#define __GLIDE_THEME_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <json-glib/json-glib.h>
+
+#include "glide-types.h"
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define GLIDE_TYPE_THEME (glide_theme_get_type())
+#define GLIDE_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GLIDE_TYPE_THEME, GlideTheme))
+#define GLIDE_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GLIDE_TYPE_THEME, GlideThemeClass))
+#define GLIDE_IS_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GLIDE_TYPE_THEME))
+#define GLIDE_IS_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLIDE_TYPE_THEME))
+#define GLIDE_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GLIDE_TYPE_THEME, GlideThemeClass))
+
+/* Private structure type */
+typedef struct _GlideThemePrivate GlideThemePrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _GlideTheme GlideTheme;
+
+struct _GlideTheme
+{
+ GObject object;
+
+ GlideThemePrivate *priv;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _GlideThemeClass GlideThemeClass;
+
+struct _GlideThemeClass
+{
+ GObjectClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType glide_theme_get_type (void) G_GNUC_CONST;
+
+GlideTheme *glide_theme_new (const gchar *path);
+
+const gchar *glide_theme_get_path (GlideTheme *theme);
+const gchar *glide_theme_get_name (GlideTheme *theme);
+
+G_END_DECLS
+
+#endif /* __GLIDE_THEME_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]