[eog-plugins] Add new plugin: Disable dark theme
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog-plugins] Add new plugin: Disable dark theme
- Date: Sun, 12 Aug 2012 14:56:02 +0000 (UTC)
commit 4b5d5e314dfd3b24e65f7b36f109876011e35f6c
Author: Felix Riemann <friemann gnome org>
Date: Sun Aug 12 16:54:19 2012 +0200
Add new plugin: Disable dark theme
This plugin disables the preference for dark theme variants
and displays eog with the standard desktop theme.
https://bugzilla.gnome.org/show_bug.cgi?id=675918
configure.ac | 9 +-
plugins/light-theme/Makefile.am | 34 +++++
plugins/light-theme/eog-light-theme-plugin.c | 147 +++++++++++++++++++++
plugins/light-theme/eog-light-theme-plugin.h | 79 +++++++++++
plugins/light-theme/light-theme.plugin.desktop.in | 9 ++
po/POTFILES.in | 1 +
6 files changed, 275 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 7d33296..57053b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ PKG_CHECK_MODULES([EOG], [
glib-2.0 >= 2.26.0
gtk+-3.0 >= 2.99.3
libpeas-1.0 >= 0.7.4
- eog >= 3.3.6
+ eog >= 3.5.5
])
AC_SUBST(EOG_LIBS)
AC_SUBST(EOG_CFLAGS)
@@ -61,9 +61,9 @@ EOG_HAS_PYTHON=1
AC_MSG_CHECKING([which plugins to build])
-ALL_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa hide-titlebar"
-USEFUL_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa hide-titlebar"
-DEFAULT_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa hide-titlebar"
+ALL_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa hide-titlebar light-theme"
+USEFUL_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa hide-titlebar light-theme"
+DEFAULT_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa hide-titlebar light-theme"
PYTHON_ALL_PLUGINS="slideshowshuffle pythonconsole fullscreenbg"
PYTHON_USEFUL_PLUGINS="slideshowshuffle pythonconsole fullscreenbg"
@@ -341,6 +341,7 @@ plugins/exif-display/org.gnome.eog.plugins.exif-display.gschema.xml.in
plugins/fullscreenbg/Makefile
plugins/fullscreenbg/org.gnome.eog.plugins.fullscreenbg.gschema.xml.in
plugins/hide-titlebar/Makefile
+plugins/light-theme/Makefile
plugins/send-by-mail/Makefile
plugins/slideshowshuffle/Makefile
plugins/postr/Makefile
diff --git a/plugins/light-theme/Makefile.am b/plugins/light-theme/Makefile.am
new file mode 100644
index 0000000..1b9bb1b
--- /dev/null
+++ b/plugins/light-theme/Makefile.am
@@ -0,0 +1,34 @@
+# LightTheme plugin
+plugindir = $(libdir)/eog/plugins
+
+INCLUDES = \
+ -I$(top_srcdir)/src \
+ $(EOG_CFLAGS) \
+ $(WARN_CFLAGS) \
+ -DEOG_LOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\"
+
+plugin_LTLIBRARIES = liblight-theme.la
+
+liblight_theme_la_SOURCES = \
+ eog-light-theme-plugin.h \
+ eog-light-theme-plugin.c
+
+liblight_theme_la_LDFLAGS = \
+ -avoid-version -module
+
+liblight_theme_la_LIBADD = $(EOG_LIBS)
+
+# Plugin Info
+
+plugin_in_files = light-theme.plugin.desktop.in
+
+%.plugin: %.plugin.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(AM_V_GEN)$(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.plugin.desktop.in=.plugin)
+
+EXTRA_DIST = $(plugin_in_files)
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/light-theme/eog-light-theme-plugin.c b/plugins/light-theme/eog-light-theme-plugin.c
new file mode 100644
index 0000000..6e6290d
--- /dev/null
+++ b/plugins/light-theme/eog-light-theme-plugin.c
@@ -0,0 +1,147 @@
+/* LightTheme -- Disable preference of dark theme variants
+ *
+ * Copyright (C) 2012 Felix Riemann
+ *
+ * Author: Felix Riemann <friemann gnome org>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <eog/eog-application.h>
+#include <eog/eog-application-activatable.h>
+
+#include "eog-light-theme-plugin.h"
+
+
+static void
+eog_application_activatable_iface_init (EogApplicationActivatableInterface *iface);
+
+G_DEFINE_DYNAMIC_TYPE_EXTENDED (EogLightThemePlugin, eog_light_theme_plugin,
+ PEAS_TYPE_EXTENSION_BASE, 0,
+ G_IMPLEMENT_INTERFACE_DYNAMIC (EOG_TYPE_APPLICATION_ACTIVATABLE,
+ eog_application_activatable_iface_init))
+
+enum {
+ PROP_0,
+ PROP_APPLICATION
+};
+
+
+static void
+eog_light_theme_plugin_init (EogLightThemePlugin *plugin)
+{
+}
+
+static void
+_set_theme_setting (gboolean state)
+{
+ GtkSettings *settings = gtk_settings_get_default ();
+ g_object_set (G_OBJECT (settings),
+ "gtk-application-prefer-dark-theme", state,
+ NULL);
+
+}
+
+static void
+impl_activate (EogApplicationActivatable *activatable)
+{
+ _set_theme_setting (FALSE);
+}
+
+static void
+impl_deactivate (EogApplicationActivatable *activatable)
+{
+ _set_theme_setting (TRUE);
+}
+
+
+static void
+eog_light_theme_plugin_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ EogLightThemePlugin *plugin = EOG_LIGHT_THEME_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_APPLICATION:
+ g_value_set_object (value, plugin->app);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+eog_light_theme_plugin_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ EogLightThemePlugin *plugin = EOG_LIGHT_THEME_PLUGIN (object);
+
+ switch (prop_id)
+ {
+ case PROP_APPLICATION:
+ plugin->app = EOG_APPLICATION (g_value_dup_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+eog_light_theme_plugin_class_init (EogLightThemePluginClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->set_property = eog_light_theme_plugin_set_property;
+ object_class->get_property = eog_light_theme_plugin_get_property;
+
+ g_object_class_override_property (object_class, PROP_APPLICATION,
+ "app");
+}
+
+static void
+eog_light_theme_plugin_class_finalize (EogLightThemePluginClass *klass)
+{
+ /* Dummy needed for G_DEFINE_DYNAMIC_TYPE_EXTENDED */
+}
+
+static void
+eog_application_activatable_iface_init (EogApplicationActivatableInterface *iface)
+{
+ iface->activate = impl_activate;
+ iface->deactivate = impl_deactivate;
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+ eog_light_theme_plugin_register_type (G_TYPE_MODULE (module));
+ peas_object_module_register_extension_type (module,
+ EOG_TYPE_APPLICATION_ACTIVATABLE,
+ EOG_TYPE_LIGHT_THEME_PLUGIN);
+}
diff --git a/plugins/light-theme/eog-light-theme-plugin.h b/plugins/light-theme/eog-light-theme-plugin.h
new file mode 100644
index 0000000..d4e2163
--- /dev/null
+++ b/plugins/light-theme/eog-light-theme-plugin.h
@@ -0,0 +1,79 @@
+/* LightTheme -- Disable preference of dark theme variants
+ *
+ * Copyright (C) 2012 Felix Riemann
+ *
+ * Author: Felix Riemann <friemann gnome org>
+ *
+ * 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 2 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __EOG_LIGHT_THEME_PLUGIN_H__
+#define __EOG_LIGHT_THEME_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include <eog/eog-application.h>
+#include <libpeas/peas-extension-base.h>
+#include <libpeas/peas-object-module.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define EOG_TYPE_LIGHT_THEME_PLUGIN (eog_light_theme_plugin_get_type ())
+#define EOG_LIGHT_THEME_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOG_TYPE_LIGHT_THEME_PLUGIN, EogLightThemePlugin))
+#define EOG_LIGHT_THEME_PLUGIN_CLASS(k) G_TYPE_CHECK_CLASS_CAST((k), EOG_TYPE_LIGHT_THEME_PLUGIN, EogLightThemePluginClass))
+#define EOG_IS_LIGHT_THEME_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOG_TYPE_LIGHT_THEME_PLUGIN))
+#define EOG_IS_LIGHT_THEME_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EOG_TYPE_LIGHT_THEME_PLUGIN))
+#define EOG_LIGHT_THEME_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EOG_TYPE_LIGHT_THEME_PLUGIN, EogLightThemePluginClass))
+
+/* Private structure type */
+typedef struct _EogLightThemePluginPrivate EogLightThemePluginPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _EogLightThemePlugin EogLightThemePlugin;
+
+struct _EogLightThemePlugin
+{
+ PeasExtensionBase parent_instance;
+
+ EogApplication *app;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _EogLightThemePluginClass EogLightThemePluginClass;
+
+struct _EogLightThemePluginClass
+{
+ PeasExtensionBaseClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType eog_light_theme_plugin_get_type (void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
+
+G_END_DECLS
+
+#endif /* __EOG_LIGHT_THEME_PLUGIN_H__ */
diff --git a/plugins/light-theme/light-theme.plugin.desktop.in b/plugins/light-theme/light-theme.plugin.desktop.in
new file mode 100644
index 0000000..23581f1
--- /dev/null
+++ b/plugins/light-theme/light-theme.plugin.desktop.in
@@ -0,0 +1,9 @@
+[Plugin]
+Module=light-theme
+IAge=2
+_Name=Disable dark theme
+Icon=eog-plugin
+_Description=Disables Eye of GNOME's preference of dark theme variants
+Authors=Felix Riemann <friemann gnome org>
+Copyright=Copyright  2012 Felix Riemann
+Website=http://www.gnome.org/projects/eog
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a2f83ef..f9db1fe 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -8,6 +8,7 @@ plugins/fullscreenbg/fullscreenbg.plugin.desktop.in
plugins/fullscreenbg/org.gnome.eog.plugins.fullscreenbg.gschema.xml.in.in
[type: gettext/glade]plugins/fullscreenbg/preferences_dialog.ui
plugins/hide-titlebar/hide-titlebar.plugin.desktop.in
+plugins/light-theme/light-theme.plugin.desktop.in
plugins/map/eog-map-plugin.c
plugins/map/map.plugin.desktop.in
plugins/postasa/eog-postasa-plugin.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]