[gnome-todo] plugins: add a Dark theme selector plugin
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] plugins: add a Dark theme selector plugin
- Date: Thu, 6 Oct 2016 15:30:58 +0000 (UTC)
commit 18772627ea6cd0af520c2cdebe8d7ff7f32e9766
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Oct 6 12:29:37 2016 -0300
plugins: add a Dark theme selector plugin
And I hope people don't complain about it, otherwise I'll
remove immediately.
configure.ac | 1 +
data/todo.gresource.xml | 5 +
plugins/Makefile.am | 2 +-
plugins/dark-theme/Makefile.am | 17 ++++
plugins/dark-theme/dark-theme.plugin.in | 13 +++
plugins/dark-theme/gtd-plugin-dark-theme.c | 142 ++++++++++++++++++++++++++++
plugins/dark-theme/gtd-plugin-dark-theme.h | 35 +++++++
src/Makefile.am | 7 +-
8 files changed, 219 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7bd3ad6..14fe46b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,7 @@ dnl ================================================================
dnl Plugins
dnl ================================================================
GNOME_TODO_ADD_PLUGIN([eds], [Evolution-Data-Server], [yes])
+GNOME_TODO_ADD_PLUGIN([dark-theme], [Dark theme], [yes])
GNOME_TODO_ADD_PLUGIN([score], [Score], [yes])
GNOME_TODO_ADD_PLUGIN([unscheduled-panel], [Unscheduled Tasks Panel], [yes])
diff --git a/data/todo.gresource.xml b/data/todo.gresource.xml
index af49948..03bc7ba 100644
--- a/data/todo.gresource.xml
+++ b/data/todo.gresource.xml
@@ -19,6 +19,11 @@
<file compressed="true">theme/Adwaita.css</file>
</gresource>
+ <!--Dark theme-->
+ <gresource prefix="/org/gnome/todo">
+ <file alias="plugins/dark-theme/dark-theme.plugin">../plugins/dark-theme/dark-theme.plugin</file>
+ </gresource>
+
<!--EDS Plugin-->
<gresource prefix="/org/gnome/todo">
<file compressed="true" alias="ui/eds/edit-pane.ui">../plugins/eds/edit-pane.ui</file>
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index e7f5b89..101ee08 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = eds
+SUBDIRS = eds dark-theme
if BUILD_SCORE_PLUGIN
SUBDIRS += score
diff --git a/plugins/dark-theme/Makefile.am b/plugins/dark-theme/Makefile.am
new file mode 100644
index 0000000..c51292f
--- /dev/null
+++ b/plugins/dark-theme/Makefile.am
@@ -0,0 +1,17 @@
+include $(top_srcdir)/common.am
+
+NULL=
+
+noinst_LTLIBRARIES = libdarktheme.la
+
+libdarktheme_la_SOURCES = \
+ gtd-plugin-dark-theme.c \
+ gtd-plugin-dark-theme.h \
+ $(NULL)
+
+libdarktheme_la_CFLAGS = \
+ $(GNOME_TODO_PLUGIN_CFLAGS) \
+ $(GNOME_TODO_PLUGIN_WARN_CFLAGS)
+
+EXTRA_DIST = \
+ dark-theme.plugin.in
diff --git a/plugins/dark-theme/dark-theme.plugin.in b/plugins/dark-theme/dark-theme.plugin.in
new file mode 100644
index 0000000..b9c0aec
--- /dev/null
+++ b/plugins/dark-theme/dark-theme.plugin.in
@@ -0,0 +1,13 @@
+[Plugin]
+Name = Dark Theme
+Module = dark-theme
+Description = Switch between the dark and light themes
+Version = @VERSION@
+Authors = Georges Basile Stavracas Neto <gbsneto gnome org>
+Copyright = Copyleft © The To Do maintainers
+Website = https://wiki.gnome.org/Apps/Todo
+Builtin = true
+License = GPL
+Loader = C
+Embedded = gtd_plugin_dark_theme_register_types
+Depends =
diff --git a/plugins/dark-theme/gtd-plugin-dark-theme.c b/plugins/dark-theme/gtd-plugin-dark-theme.c
new file mode 100644
index 0000000..1a5798b
--- /dev/null
+++ b/plugins/dark-theme/gtd-plugin-dark-theme.c
@@ -0,0 +1,142 @@
+/* gtd-plugin-dark-theme.c
+ *
+ * Copyright (C) 2016 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * This program 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.
+ *
+ * This program 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 "gtd-plugin-dark-theme.h"
+
+#include <glib/gi18n.h>
+#include <glib-object.h>
+
+struct _GtdPluginDarkTheme
+{
+ PeasExtensionBase parent;
+};
+
+static void gtd_activatable_iface_init (GtdActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (GtdPluginDarkTheme, gtd_plugin_dark_theme, PEAS_TYPE_EXTENSION_BASE,
+ 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (GTD_TYPE_ACTIVATABLE,
gtd_activatable_iface_init))
+
+enum {
+ PROP_0,
+ PROP_PREFERENCES_PANEL,
+ N_PROPS
+};
+
+/*
+ * GtdActivatable interface implementation
+ */
+static void
+gtd_plugin_dark_theme_activate (GtdActivatable *activatable)
+{
+ g_object_set (gtk_settings_get_default (),
+ "gtk-application-prefer-dark-theme", TRUE,
+ NULL);
+}
+
+static void
+gtd_plugin_dark_theme_deactivate (GtdActivatable *activatable)
+{
+ g_object_set (gtk_settings_get_default (),
+ "gtk-application-prefer-dark-theme", FALSE,
+ NULL);
+}
+
+static GList*
+gtd_plugin_dark_theme_get_header_widgets (GtdActivatable *activatable)
+{
+ return NULL;
+}
+
+static GtkWidget*
+gtd_plugin_dark_theme_get_preferences_panel (GtdActivatable *activatable)
+{
+ return NULL;
+}
+
+static GList*
+gtd_plugin_dark_theme_get_panels (GtdActivatable *activatable)
+{
+ return NULL;
+}
+
+static GList*
+gtd_plugin_dark_theme_get_providers (GtdActivatable *activatable)
+{
+ return NULL;
+}
+
+static void
+gtd_activatable_iface_init (GtdActivatableInterface *iface)
+{
+ iface->activate = gtd_plugin_dark_theme_activate;
+ iface->deactivate = gtd_plugin_dark_theme_deactivate;
+ iface->get_header_widgets = gtd_plugin_dark_theme_get_header_widgets;
+ iface->get_preferences_panel = gtd_plugin_dark_theme_get_preferences_panel;
+ iface->get_panels = gtd_plugin_dark_theme_get_panels;
+ iface->get_providers = gtd_plugin_dark_theme_get_providers;
+}
+
+static void
+gtd_plugin_dark_theme_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id)
+ {
+ case PROP_PREFERENCES_PANEL:
+ g_value_set_object (value, NULL);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+gtd_plugin_dark_theme_class_init (GtdPluginDarkThemeClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->get_property = gtd_plugin_dark_theme_get_property;
+
+ g_object_class_override_property (object_class,
+ PROP_PREFERENCES_PANEL,
+ "preferences-panel");
+}
+
+static void
+gtd_plugin_dark_theme_init (GtdPluginDarkTheme *self)
+{
+}
+
+static void
+gtd_plugin_dark_theme_class_finalize (GtdPluginDarkThemeClass *klass)
+{
+}
+
+G_MODULE_EXPORT void
+gtd_plugin_dark_theme_register_types (PeasObjectModule *module)
+{
+ gtd_plugin_dark_theme_register_type (G_TYPE_MODULE (module));
+
+ peas_object_module_register_extension_type (module,
+ GTD_TYPE_ACTIVATABLE,
+ GTD_TYPE_PLUGIN_DARK_THEME);
+}
diff --git a/plugins/dark-theme/gtd-plugin-dark-theme.h b/plugins/dark-theme/gtd-plugin-dark-theme.h
new file mode 100644
index 0000000..bba00ca
--- /dev/null
+++ b/plugins/dark-theme/gtd-plugin-dark-theme.h
@@ -0,0 +1,35 @@
+/* gtd-plugin-dark-theme.h
+ *
+ * Copyright (C) 2016 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * This program 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.
+ *
+ * This program 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 GTD_PLUGIN_DARK_THEME_H
+#define GTD_PLUGIN_DARK_THEME_H
+
+#include <glib.h>
+#include <gnome-todo.h>
+
+G_BEGIN_DECLS
+
+#define GTD_TYPE_PLUGIN_DARK_THEME (gtd_plugin_dark_theme_get_type())
+
+G_DECLARE_FINAL_TYPE (GtdPluginDarkTheme, gtd_plugin_dark_theme, GTD, PLUGIN_DARK_THEME, PeasExtensionBase)
+
+G_MODULE_EXPORT void gtd_plugin_dark_theme_register_types (PeasObjectModule *module);
+
+G_END_DECLS
+
+#endif /* GTD_PLUGIN_DARK_THEME_H */
diff --git a/src/Makefile.am b/src/Makefile.am
index ae7461b..f544f36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -93,14 +93,17 @@ gnome_todo_CFLAGS = \
gnome_todo_LDFLAGS = \
-Wl,--export-dynamic \
-Wl,--undefined=gtd_plugin_eds_register_types \
+ -Wl,--undefined=gtd_plugin_dark_theme_register_types \
$(GNOME_TODO_WARN_LDFLAGS)
gnome_todo_LDADD = \
$(GNOME_TODO_LIBS) \
- $(top_builddir)/plugins/eds/libeds.a
+ $(top_builddir)/plugins/eds/libeds.a \
+ $(top_builddir)/plugins/dark-theme/libdarktheme.la
gnome_todo_DEPENDENCIES = \
- $(top_builddir)/plugins/eds/libeds.a
+ $(top_builddir)/plugins/eds/libeds.a \
+ $(top_builddir)/plugins/dark-theme/libdarktheme.la
#
# Export headers to [PREFIX]/include/gnome-todo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]