[eog-plugins] New plugin fullscreenbg
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog-plugins] New plugin fullscreenbg
- Date: Thu, 9 Feb 2012 13:47:38 +0000 (UTC)
commit bdb7a3b75ff6d8dc8654ebff806ce2bd3855ab11
Author: Adrian ZgorzaÅek <a zgorzalek gmail com>
Date: Wed Feb 8 11:22:36 2012 +0100
New plugin fullscreenbg
Plugin enables custom background in fullscreen and slideshow mode.
It can use global settings or plugin's setttings for background of ScrollView.
Fixes Bug#667979:
https://bugzilla.gnome.org/show_bug.cgi?id=667979
configure.ac | 10 ++-
plugins/fullscreenbackground/Makefile.am | 30 ++++++++
.../fullscreenbg.plugin.desktop.in | 9 ++
plugins/fullscreenbackground/fullscreenbg.py | 79 ++++++++++++++++++++
...nome.eog.plugins.fullscreenbg.gschema.xml.in.in | 14 ++++
plugins/fullscreenbackground/preferences_dialog.ui | 50 ++++++++++++
6 files changed, 188 insertions(+), 4 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b5013b6..2118efa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,9 +65,9 @@ ALL_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa"
USEFUL_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa"
DEFAULT_PLUGINS="postr map fit-to-width exif-display send-by-mail postasa"
-PYTHON_ALL_PLUGINS="slideshowshuffle pythonconsole"
-PYTHON_USEFUL_PLUGINS="slideshowshuffle pythonconsole"
-PYTHON_DEFAULT_PLUGINS="slideshowshuffle pythonconsole"
+PYTHON_ALL_PLUGINS="slideshowshuffle pythonconsole fullscreenbackground"
+PYTHON_USEFUL_PLUGINS="slideshowshuffle pythonconsole fullscreenbackground"
+PYTHON_DEFAULT_PLUGINS="slideshowshuffle pythonconsole fullscreenbackground"
DIST_PLUGINS="$ALL_PLUGINS $PYTHON_ALL_PLUGINS"
@@ -82,7 +82,7 @@ fi
AC_ARG_WITH([plugins],
[AS_HELP_STRING([--with-plugins=LIST],
[Comma-separated list specifying the plugins to build.
- Available: map, exif-display, fit-to-width,
+ Available: map, exif-display, fit-to-width, fullscreenbackground,
postr, postasa, pythonconsole, slideshowshuffle,
as well as the aliases default,
all, and really-all])],
@@ -325,6 +325,8 @@ plugins/map/Makefile
plugins/fit-to-width/Makefile
plugins/exif-display/Makefile
plugins/exif-display/org.gnome.eog.plugins.exif-display.gschema.xml.in
+plugins/fullscreenbackground/Makefile
+plugins/fullscreenbackground/org.gnome.eog.plugins.fullscreenbg.gschema.xml.in
plugins/send-by-mail/Makefile
plugins/slideshowshuffle/Makefile
plugins/postr/Makefile
diff --git a/plugins/fullscreenbackground/Makefile.am b/plugins/fullscreenbackground/Makefile.am
new file mode 100644
index 0000000..056739d
--- /dev/null
+++ b/plugins/fullscreenbackground/Makefile.am
@@ -0,0 +1,30 @@
+# Fullscreen Background plugin
+plugindir = $(EOG_PLUGINS_LIBS_DIR)
+plugin_in_files = fullscreenbg.plugin.desktop.in
+
+gsettings_SCHEMAS = org.gnome.eog.plugins.fullscreenbg.gschema.xml
+gsettings_SCHEMAS_in_files = org.gnome.eog.plugins.fullscreenbg.gschema.xml.in.in
+
+
+ui_DATA = preferences_dialog.ui
+uidir = $(plugindir)/fullscreenbg
+
+plugin_PYTHON = \
+ fullscreenbg.py
+
+%.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)
+
+ INTLTOOL_XML_NOMERGE_RULE@
+ GSETTINGS_RULES@
+
+EXTRA_DIST = $(plugin_in_files)\
+ $(ui_DATA)\
+ $(gsettings_SCHEMAS_in_files)
+
+CLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+DISTCLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/fullscreenbackground/fullscreenbg.plugin.desktop.in b/plugins/fullscreenbackground/fullscreenbg.plugin.desktop.in
new file mode 100644
index 0000000..372fe25
--- /dev/null
+++ b/plugins/fullscreenbackground/fullscreenbg.plugin.desktop.in
@@ -0,0 +1,9 @@
+[Plugin]
+Loader=python
+Module=fullscreenbg
+IAge=2
+Name=Fullscreen background
+Description=Enables changing background in fullscreen mode
+Authors=Adrian ZgorzaÅek <a zgorzalek gmail com>
+Copyright=Copyright  2012 Adrian ZgorzaÅek <a zgorzalek gmail com>
+Website=http://projects.gnome.org/eog
diff --git a/plugins/fullscreenbackground/fullscreenbg.py b/plugins/fullscreenbackground/fullscreenbg.py
new file mode 100644
index 0000000..4b6b643
--- /dev/null
+++ b/plugins/fullscreenbackground/fullscreenbg.py
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+
+# Fullscreen Background Plugin for Eye of GNOME
+# Copyright (C) 2012 Adrian ZgorzaÅek <a zgorzalek 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 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.
+
+from gi.repository import GObject, Gdk, Gio, Gtk, Eog, Peas, PeasGtk
+from os.path import join
+
+class BackgroundChanger(GObject.Object, Eog.WindowActivatable,\
+ PeasGtk.Configurable):
+ """Class implementing custom background in fullscreen mode"""
+ BASE_KEY = 'org.gnome.eog.plugins.fullscreenbg'
+ window = GObject.property(type=Eog.Window)
+ preferneces_dialog_created = False
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+ self.settings = Gio.Settings.new(self.BASE_KEY)
+
+ def do_activate(self):
+ self.state_handler_id = \
+ self.window.connect('window-state-event', self.state_changed_cb)
+
+ def do_deactivate(self):
+ self.window.disconnect(self.state_handler_id)
+
+ def state_changed_cb(self, window, event):
+ scroll_view = self.window.get_view()
+ mode = self.window.get_mode()
+ if self.settings.get_boolean('use-custom'):
+ color = Gdk.Color.parse(self.settings.get_string('background-color'))[1]
+ else:
+ color = scroll_view.get_property('background-color')
+
+ if mode == Eog.WindowMode(Eog.WindowMode.FULLSCREEN)\
+ or mode == Eog.WindowMode(Eog.WindowMode.SLIDESHOW):
+ scroll_view.override_bg_color(color)
+
+ def do_create_configure_widget(self):
+ # Create preference dialog
+ if not self.preferneces_dialog_created:
+ signals = {'use_global_settings_cb': self.use_global_settings_cb,
+ 'hide_colorbutton_cb': self.hide_colorbutton_cb}
+ builder = Gtk.Builder()
+ builder.add_from_file(join(self.plugin_info.get_data_dir(), 'preferences_dialog.ui'))
+ builder.connect_signals(signals)
+
+ self.use_global_checkbutton = builder.get_object('use_global_settings_checkbutton')
+ self.choose_color = builder.get_object('background_color_colorbutton')
+ self.preferences_dialog = builder.get_object('preferences_box')
+ # Restore values
+ self.use_global_checkbutton.set_active(\
+ self.settings.get_boolean('use-custom'))
+ self.choose_color.set_color(\
+ Gdk.Color.parse(self.settings.get_string('background-color'))[1])
+ self.preferneces_dialog_created = True
+
+ return self.preferences_dialog
+
+ def use_global_settings_cb(self, data):
+ self.settings.set_boolean('use-custom', self.use_global_checkbutton.get_active())
+
+ def hide_colorbutton_cb(self, data):
+ self.settings.set_string('background-color',\
+ self.choose_color.get_color().to_string())
diff --git a/plugins/fullscreenbackground/org.gnome.eog.plugins.fullscreenbg.gschema.xml.in.in b/plugins/fullscreenbackground/org.gnome.eog.plugins.fullscreenbg.gschema.xml.in.in
new file mode 100644
index 0000000..01c97f1
--- /dev/null
+++ b/plugins/fullscreenbackground/org.gnome.eog.plugins.fullscreenbg.gschema.xml.in.in
@@ -0,0 +1,14 @@
+<schemalist>
+ <schema id="org.gnome.eog.plugins.fullscreenbg" path="/org/gnome/eog/plugins/fullscreenbg/" gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="use-custom" type="b">
+ <default>true</default>
+ <_summary>Use custom background settings</_summary>
+ <_description>Whether the plugin should use global settings or its own.</_description>
+ </key>
+ <key name="background-color" type="s">
+ <default>'#000000'</default>
+ <_summary>Background color in fullscreen mode</_summary>
+ <_description>The color that is used to fill the area behind the image. This option has effect only if use-custom is enabled.</_description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/plugins/fullscreenbackground/preferences_dialog.ui b/plugins/fullscreenbackground/preferences_dialog.ui
new file mode 100644
index 0000000..4063983
--- /dev/null
+++ b/plugins/fullscreenbackground/preferences_dialog.ui
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <object class="GtkBox" id="preferences_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="margin_left">10</property>
+ <property name="margin_right">10</property>
+ <property name="margin_top">10</property>
+ <property name="margin_bottom">10</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkCheckButton" id="use_global_settings_checkbutton">
+ <property name="label" translatable="yes">Use custom color:</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="use_global_settings_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkColorButton" id="background_color_colorbutton">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="use_action_appearance">False</property>
+ <signal name="color-set" handler="hide_colorbutton_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]