[gnome-commander/GSettings] Adds viewer to GSettings (now known as external-viewer-cmd)
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds viewer to GSettings (now known as external-viewer-cmd)
- Date: Sun, 3 Jul 2016 20:57:45 +0000 (UTC)
commit f2e170d4eb587c2fdb082ba03609551bf05ab25b
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sun Jul 3 22:57:32 2016 +0200
Adds viewer to GSettings (now known as external-viewer-cmd)
data/org.gnome.gnome-commander.gschema.xml | 10 ++++++----
src/gnome-cmd-data.cc | 20 ++++++++++++++++++--
src/gnome-cmd-data.h | 1 +
3 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index b83a684..2952680 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -509,10 +509,12 @@
This option defines if the internal viewer should be used by default.
</description>
</key>
- <key name="viewer" type="s">
- <default l10n="messages">'scite %s'</default>
- <summary></summary>
- <description></description>
+ <key name="external-viewer-cmd" type="s">
+ <default l10n="messages">'gedit %s'</default>
+ <summary>External viewer command</summary>
+ <description>
+ This string defines the command for starting the external viewer.
+ </description>
</key>
<key name="editor" type="s">
<default l10n="messages">'geany -i %s'</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 97849a9..02d714b 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -765,6 +765,14 @@ void on_skip_mounting_changed()
gnome_cmd_data.options.skip_mounting = skip_mounting;
}
+void on_external_viewer_cmd_changed()
+{
+ gchar *external_viewer_cmd;
+
+ external_viewer_cmd = g_settings_get_string (gnome_cmd_data.options.gcmd_settings->programs,
GCMD_SETTINGS_EXTERNAL_VIEWER_CMD);
+ gnome_cmd_data.options.viewer = external_viewer_cmd;
+}
+
static void gcmd_settings_class_init (GcmdSettingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1121,6 +1129,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
G_CALLBACK (on_skip_mounting_changed),
NULL);
+ g_signal_connect (gs->programs,
+ "changed::external-viewer-cmd",
+ G_CALLBACK (on_external_viewer_cmd_changed),
+ NULL);
+
}
@@ -2760,6 +2773,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
//skip_mounting
migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/programs/skip_mounting", FALSE) ? 1
: 0,
options.gcmd_settings->devices, GCMD_SETTINGS_SKIP_MOUNTING);
+ //viewer
+ migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/programs/viewer", "gedit %s"),
+ options.gcmd_settings->programs,
GCMD_SETTINGS_EXTERNAL_VIEWER_CMD);
g_free(color);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
@@ -3138,7 +3154,7 @@ void GnomeCmdData::load()
options.symlink_prefix = NULL;
}
- options.viewer = gnome_cmd_data_get_string ("/programs/viewer", "gedit %s");
+ options.viewer = g_settings_get_string(options.gcmd_settings->programs,
GCMD_SETTINGS_EXTERNAL_VIEWER_CMD);
options.editor = gnome_cmd_data_get_string ("/programs/editor", "gedit %s");
options.differ = gnome_cmd_data_get_string ("/programs/differ", "meld %s");
options.sendto = gnome_cmd_data_get_string ("/programs/sendto", "nautilus-sendto %s");
@@ -3669,7 +3685,7 @@ void GnomeCmdData::save()
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_POS_X,
&(options.main_win_pos[0]));
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_POS_Y,
&(options.main_win_pos[1]));
- gnome_cmd_data_set_string ("/programs/viewer", options.viewer);
+ set_gsettings_when_changed (options.gcmd_settings->programs, GCMD_SETTINGS_EXTERNAL_VIEWER_CMD,
options.viewer);
gnome_cmd_data_set_string ("/programs/editor", options.editor);
gnome_cmd_data_set_string ("/programs/differ", options.differ);
gnome_cmd_data_set_string ("/programs/sendto", options.sendto);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 2fb57cc..2297332 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -146,6 +146,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_PREF_PROGRAMS "org.gnome.gnome-commander.preferences.programs"
#define GCMD_SETTINGS_DONT_DOWNLOAD "dont-download"
#define GCMD_SETTINGS_USE_INTERNAL_VIEWER "use-internal-viewer"
+#define GCMD_SETTINGS_EXTERNAL_VIEWER_CMD "external-viewer-cmd"
#define GCMD_PREF_KEYBINDINGS "org.gnome.gnome-commander.preferences.keybindings"
#define GCMD_SETTINGS_QUICK_SEARCH_SHORTCUT "quick-search"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]