[glide] Begin implementing a theme manager
- From: Robert Carr <racarr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glide] Begin implementing a theme manager
- Date: Sat, 5 Jun 2010 19:49:09 +0000 (UTC)
commit 0819a2e23f445f2559cebfbbaf975797de4fb653
Author: Robert Carr <racarr Valentine localdomain>
Date: Tue May 25 13:37:16 2010 -0400
Begin implementing a theme manager
libglide/Makefile.am | 2 +
libglide/glide-debug.h | 3 +-
libglide/glide-theme-manager.c | 73 ++++++++++++++++++++++++++++++++++++++++
libglide/glide-theme-manager.h | 31 +++++++++++++++++
libglide/glide.c | 5 ++-
5 files changed, 112 insertions(+), 2 deletions(-)
---
diff --git a/libglide/Makefile.am b/libglide/Makefile.am
index b83d55d..41ac5cf 100644
--- a/libglide/Makefile.am
+++ b/libglide/Makefile.am
@@ -61,6 +61,7 @@ glideheaders_HEADERS = \
glide-theme.h \
glide-binding.h \
glide-print-util.h \
+ glide-theme-manager.h \
$(glide_VALABUILTHEADERS)
glideheadersdir = $(pkgincludedir)
@@ -98,6 +99,7 @@ libglide_la_SOURCES = \
glide-theme.c \
glide-binding.c \
glide-print-util.c \
+ glide-theme-manager.c \
$(glide_VALABUILTSOURCES)
libglide_la_CFLAGS = \
diff --git a/libglide/glide-debug.h b/libglide/glide-debug.h
index ec4bf8d..0968cd6 100644
--- a/libglide/glide-debug.h
+++ b/libglide/glide-debug.h
@@ -38,7 +38,8 @@ typedef enum
GLIDE_DEBUG_WINDOW = 1 << 5,
GLIDE_DEBUG_PAINT = 1 << 6,
GLIDE_DEBUG_TEXT = 1 << 7,
- GLIDE_DEBUG_DOCUMENT = 1 << 8
+ GLIDE_DEBUG_DOCUMENT = 1 << 8,
+ GLIDE_DEBUG_THEME_MANAGER = 1 << 9
} GlideDebugFlag;
#ifdef GLIDE_ENABLE_DEBUG
diff --git a/libglide/glide-theme-manager.c b/libglide/glide-theme-manager.c
new file mode 100644
index 0000000..ecae77d
--- /dev/null
+++ b/libglide/glide-theme-manager.c
@@ -0,0 +1,73 @@
+/*
+ * glide-animation-manager.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-animation-manager
+ * @short_description: Manages and performs animations.
+ *
+ */
+
+#include "glide-theme-manager.h"
+#include "glide-dirs.h"
+#include "glide-debug.h"
+
+static GList *themes = NULL;
+
+void
+glide_theme_manager_refresh_theme_list ()
+{
+ GDir *dir;
+ GError *e = NULL;
+ gchar *theme_dir;
+ const gchar *theme_file;
+ GLIDE_NOTE(THEME_MANAGER, "Loading themes");
+
+ if (themes)
+ {
+ g_list_foreach (themes, (GFunc) (g_free), NULL);
+ g_list_free (themes);
+
+ themes = NULL;
+ }
+
+ theme_dir = glide_dirs_get_glide_theme_dir ();
+
+ dir = g_dir_open (theme_dir, 0, &e);
+ if (e)
+ {
+ g_warning ("Error loading themes: %s", e->message);
+
+ g_error_free (e);
+ g_free (theme_dir);
+ return;
+ }
+
+ while ((theme_file = g_dir_read_name (dir)))
+ {
+
+ if (g_str_has_suffix (theme_file, "glide-theme"))
+ {
+ GLIDE_NOTE (THEME_MANAGER, "Found theme: %s", theme_file);
+ themes = g_list_append (themes, g_strdup(theme_file));
+ }
+ }
+
+ g_dir_close (dir);
+
+ g_free (theme_dir);
+}
diff --git a/libglide/glide-theme-manager.h b/libglide/glide-theme-manager.h
new file mode 100644
index 0000000..56453ed
--- /dev/null
+++ b/libglide/glide-theme-manager.h
@@ -0,0 +1,31 @@
+/*
+ * glide-theme-manager.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_MANAGER_H__
+#define __GLIDE_THEME_MANAGER_H__
+
+#include "glide-theme.h"
+
+G_BEGIN_DECLS
+
+void glide_theme_manager_refresh_theme_list ();
+
+G_END_DECLS
+
+#endif
diff --git a/libglide/glide.c b/libglide/glide.c
index 80bf7c1..b6df91c 100644
--- a/libglide/glide.c
+++ b/libglide/glide.c
@@ -18,6 +18,7 @@
#include "glide.h"
#include "glide-animation-manager.h"
+#include "glide-theme-manager.h"
#include "glide-debug.h"
#include "glide-dirs.h"
@@ -33,7 +34,8 @@ static const GDebugKey glide_debug_keys[] = {
{"window", GLIDE_DEBUG_WINDOW},
{"paint", GLIDE_DEBUG_PAINT},
{"text", GLIDE_DEBUG_TEXT},
- {"document", GLIDE_DEBUG_DOCUMENT}
+ {"document", GLIDE_DEBUG_DOCUMENT},
+ {"theme-manager", GLIDE_DEBUG_THEME_MANAGER}
};
static gboolean
@@ -141,6 +143,7 @@ glide_init (int *argc, char ***argv)
gboolean res = glide_parse_args (argc, argv);
glide_animation_manager_register_animations ();
+ glide_theme_manager_refresh_theme_list ();
glide_load_default_theme ();
return res;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]