[gnome-commander/GSettings: 27/27] Adds uri to GSettings (now known as quick-connect-uri)
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings: 27/27] Adds uri to GSettings (now known as quick-connect-uri)
- Date: Sun, 17 Jul 2016 11:59:38 +0000 (UTC)
commit ebe9c7f716ce9ab325cfaadad183a61f77f860a2
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sun Jul 17 13:58:52 2016 +0200
Adds uri to GSettings (now known as quick-connect-uri)
data/org.gnome.gnome-commander.gschema.xml | 15 +++++++--------
src/gnome-cmd-data.cc | 10 ++++++++--
src/gnome-cmd-data.h | 3 +++
3 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 5828cba..c09cc1d 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -5,7 +5,6 @@
</schema>
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences"
path="/org/gnome/gnome-commander/preferences/">
<child name="general" schema="org.gnome.gnome-commander.preferences.general"/>
- <child name="quick-connect" schema="org.gnome.gnome-commander.preferences.quick-connect"/>
<child name="network" schema="org.gnome.gnome-commander.preferences.network"/>
<child name="confirmation" schema="org.gnome.gnome-commander.preferences.confirmation"/>
<child name="filter" schema="org.gnome.gnome-commander.preferences.filter"/>
@@ -399,14 +398,14 @@
</description>
</key>
</schema>
- <schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.quick-connect"
path="/org/gnome/gnome-commander/preferences/quick-connect/">
- <key name="uri" type="s">
- <default l10n="messages">'sftp://192.168.1.33'</default>
- <summary></summary>
- <description></description>
- </key>
- </schema>
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.network"
path="/org/gnome/gnome-commander/preferences/network/">
+ <key name="quick-connect-uri" type="s">
+ <default l10n="messages">'ftp://anonymous ftp gnome org/pub/GNOME/'</default>
+ <summary>Quick connect URI</summary>
+ <description>
+ Unified resource identifier for quick connects.
+ </description>
+ </key>
<key name="use-gnome-auth-manager" type="b">
<default l10n="messages">false</default>
<summary></summary>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 97d634c..8124962 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -59,6 +59,7 @@ struct _GcmdSettings
GSettings *colors;
GSettings *programs;
GSettings *keybindings;
+ GSettings *network;
};
G_DEFINE_TYPE (GcmdSettings, gcmd_settings, G_TYPE_OBJECT)
@@ -82,6 +83,7 @@ static void gcmd_settings_dispose (GObject *object)
g_clear_object (&gs->colors);
g_clear_object (&gs->programs);
g_clear_object (&gs->keybindings);
+ g_clear_object (&gs->network);
G_OBJECT_CLASS (gcmd_settings_parent_class)->dispose (object);
}
@@ -1230,6 +1232,7 @@ static void gcmd_settings_init (GcmdSettings *gs)
gs->colors = g_settings_new (GCMD_PREF_COLORS);
gs->programs = g_settings_new (GCMD_PREF_PROGRAMS);
gs->keybindings = g_settings_new (GCMD_PREF_KEYBINDINGS);
+ gs->network = g_settings_new (GCMD_PREF_NETWORK);
//TODO: Activate the following function in GCMD > 1.6
//gcmd_connect_gsettings_signals(gs);
}
@@ -2882,6 +2885,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
//only_icon
migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/devices/only_icon", FALSE) ? 1 : 0,
options.gcmd_settings->general, GCMD_SETTINGS_DEV_ONLY_ICON);
+ //uri
+ migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/quick-connect/uri",
"ftp://anonymous ftp gnome org/pub/GNOME/"),
+ options.gcmd_settings->network,
GCMD_SETTINGS_QUICK_CONNECT_URI);
g_free(color);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
@@ -3562,7 +3568,7 @@ void GnomeCmdData::load()
// "/quick-connect/uri" must be read AFTER retrieving anonymous password
- gchar *quick_connect_uri = gnome_cmd_data_get_string ("/quick-connect/uri", "ftp://anonymous ftp gnome
org/pub/GNOME/");
+ gchar *quick_connect_uri = g_settings_get_string(options.gcmd_settings->network,
GCMD_SETTINGS_QUICK_CONNECT_URI);
quick_connect = gnome_cmd_con_remote_new (NULL, quick_connect_uri);
g_free (quick_connect_uri);
@@ -3813,7 +3819,7 @@ void GnomeCmdData::save()
const gchar *quick_connect_uri = gnome_cmd_con_get_uri (GNOME_CMD_CON (quick_connect));
if (quick_connect_uri)
- gnome_cmd_data_set_string ("/quick-connect/uri", quick_connect_uri);
+ set_gsettings_when_changed (options.gcmd_settings->network, GCMD_SETTINGS_QUICK_CONNECT_URI,
(gpointer) quick_connect_uri);
gnome_config_clean_key (G_DIR_SEPARATOR_S PACKAGE "/quick-connect/host");
gnome_config_clean_key (G_DIR_SEPARATOR_S PACKAGE "/quick-connect/port");
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index f7394f3..910e859 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -159,6 +159,9 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_PREF_KEYBINDINGS "org.gnome.gnome-commander.preferences.keybindings"
#define GCMD_SETTINGS_QUICK_SEARCH_SHORTCUT "quick-search"
+#define GCMD_PREF_NETWORK "org.gnome.gnome-commander.preferences.network"
+#define GCMD_SETTINGS_QUICK_CONNECT_URI "quick-connect-uri"
+
struct GnomeCmdConRemote;
struct GnomeCmdData
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]