[eog-plugins] export-to-folder: Save export folder with GSettings
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog-plugins] export-to-folder: Save export folder with GSettings
- Date: Mon, 20 Aug 2012 20:28:19 +0000 (UTC)
commit c25fbf54b4a33204bd6e6cf0959831d03b3cf719
Author: Felix Riemann <friemann gnome org>
Date: Mon Aug 20 22:13:49 2012 +0200
export-to-folder: Save export folder with GSettings
configure.ac | 1 +
plugins/export-to-folder/Makefile.am | 14 +++++++++--
plugins/export-to-folder/export-to-folder.py | 23 ++++++++++++++-----
....eog.plugins.export-to-folder.gschema.xml.in.in | 9 +++++++
4 files changed, 38 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2754ff0..664cc60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -339,6 +339,7 @@ plugins/fit-to-width/Makefile
plugins/exif-display/Makefile
plugins/exif-display/org.gnome.eog.plugins.exif-display.gschema.xml.in
plugins/export-to-folder/Makefile
+plugins/export-to-folder/org.gnome.eog.plugins.export-to-folder.gschema.xml.in
plugins/fullscreenbg/Makefile
plugins/fullscreenbg/org.gnome.eog.plugins.fullscreenbg.gschema.xml.in
plugins/hide-titlebar/Makefile
diff --git a/plugins/export-to-folder/Makefile.am b/plugins/export-to-folder/Makefile.am
index db72e55..140a9e6 100644
--- a/plugins/export-to-folder/Makefile.am
+++ b/plugins/export-to-folder/Makefile.am
@@ -9,13 +9,21 @@ ui_DATA = $(UI_FILES)
plugin_PYTHON = \
export-to-folder.py
+gsettings_SCHEMAS = org.gnome.eog.plugins.export-to-folder.gschema.xml
+gsettings_SCHEMAS_in_files = org.gnome.eog.plugins.export-to-folder.gschema.xml.in.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)
+ INTLTOOL_XML_NOMERGE_RULE@
+ GSETTINGS_RULES@
+
+EXTRA_DIST = $(plugin_in_files) $(ui_DATA) $(gsettings_SCHEMAS_in_files)
-CLEANFILES = $(plugin_DATA)
-DISTCLEANFILES = $(plugin_DATA)
+CLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+DISTCLEANFILES = $(plugin_DATA) $(gsettings_SCHEMAS)
+MAINTAINERCLEANFILES = $(gsettings_SCHEMAS:.xml=.valid)
-include $(top_srcdir)/git.mk
diff --git a/plugins/export-to-folder/export-to-folder.py b/plugins/export-to-folder/export-to-folder.py
index 1d63148..b04f33e 100644
--- a/plugins/export-to-folder/export-to-folder.py
+++ b/plugins/export-to-folder/export-to-folder.py
@@ -37,17 +37,22 @@ ui_str = """
"""
EXPORT_DIR = os.path.join(os.path.expanduser('~'), 'exported-images')
-
+BASE_KEY = 'org.gnome.eog.plugins.export-to-folder'
class ExportPlugin(GObject.Object, Eog.WindowActivatable):
window = GObject.property(type=Eog.Window)
def __init__(self):
GObject.Object.__init__(self)
+ self.settings = Gio.Settings.new(BASE_KEY)
@property
def export_dir(self):
- return EXPORT_DIR
+ target_dir = self.settings.get_string('target-folder')
+ if target_dir == "":
+ return EXPORT_DIR
+
+ return target_dir
def do_activate(self):
print 'Activating export plugin'
@@ -81,6 +86,11 @@ class ExportPlugin(GObject.Object, Eog.WindowActivatable):
class ExportConfigurable(GObject.Object, PeasGtk.Configurable):
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+ self.settings = Gio.Settings.new(BASE_KEY)
+
def do_create_configure_widget(self):
# Create preference dialog
signals = {'current_folder_changed_cb': self.current_folder_changed_cb}
@@ -92,11 +102,12 @@ class ExportConfigurable(GObject.Object, PeasGtk.Configurable):
self.export_dir_button = builder.get_object('export_dir_button')
self.preferences_dialog = builder.get_object('preferences_box')
- self.export_dir_button.set_current_folder(EXPORT_DIR)
+ target_dir = self.settings.get_string('target-folder')
+ if target_dir == "":
+ target_dir = EXPORT_DIR;
+ self.export_dir_button.set_current_folder(target_dir)
return self.preferences_dialog
def current_folder_changed_cb(self, button):
- global EXPORT_DIR
- EXPORT_DIR = button.get_current_folder()
- print 'Exporting to %s' % EXPORT_DIR
+ self.settings.set_string('target-folder', button.get_current_folder())
diff --git a/plugins/export-to-folder/org.gnome.eog.plugins.export-to-folder.gschema.xml.in.in b/plugins/export-to-folder/org.gnome.eog.plugins.export-to-folder.gschema.xml.in.in
new file mode 100644
index 0000000..46998eb
--- /dev/null
+++ b/plugins/export-to-folder/org.gnome.eog.plugins.export-to-folder.gschema.xml.in.in
@@ -0,0 +1,9 @@
+<schemalist>
+ <schema id="org.gnome.eog.plugins.export-to-folder" path="/org/gnome/eog/plugins/export-to-folder/" gettext-domain="@GETTEXT_PACKAGE@">
+ <key name="target-folder" type="s">
+ <default>""</default>
+ <_summary>The folder to export to</_summary>
+ <_description>This is the folder the plugin will place the exported files in. Plugin will export to $HOME/exported-images if not set.</_description>
+ </key>
+ </schema>
+</schemalist>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]