[gnome-commander/get_rid_of_xml] Store default gsettings value vor connections and advance rename profile



commit b3f2261878271ad9aaf4c51759f41adc7adc0ae0
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Mon Jan 14 21:41:53 2019 +0100

    Store default gsettings value vor connections and advance rename profile

 src/gnome-cmd-data.cc | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index b28bd92d..62ab9138 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1752,12 +1752,12 @@ void GnomeCmdData::add_advrename_profile_to_gvariant_builder(GVariantBuilder *bu
  */
 void GnomeCmdData::save_devices_via_gsettings()
 {
+    GVariant* devicesToStore;
     GList *devices;
 
     devices = gnome_cmd_con_list_get_all_dev (gnome_cmd_data.priv->con_list);
     if (devices)
     {
-        GVariant* devicesToStore;
         GVariantBuilder gVariantBuilder;
         g_variant_builder_init (&gVariantBuilder, G_VARIANT_TYPE_ARRAY);
 
@@ -1781,6 +1781,12 @@ void GnomeCmdData::save_devices_via_gsettings()
         devicesToStore = g_variant_builder_end (&gVariantBuilder);
         g_settings_set_value(options.gcmd_settings->general, GCMD_SETTINGS_DEVICES, devicesToStore);
     }
+    else
+    {
+        devicesToStore = g_settings_get_default_value(options.gcmd_settings->general,
+                                                      GCMD_SETTINGS_DEVICES);
+        g_settings_set_value(options.gcmd_settings->general, GCMD_SETTINGS_DEVICES, devicesToStore);
+    }
 }
 
 
@@ -1921,7 +1927,15 @@ void GnomeCmdData::save_connections()
                                     con->uri);
         }
     }
-    connectionsToStore = g_variant_builder_end (&gVariantBuilder);
+    if (hasConnections)
+    {
+        connectionsToStore = g_variant_builder_end (&gVariantBuilder);
+    }
+    else
+    {
+        g_variant_builder_clear (&gVariantBuilder);
+        connectionsToStore = g_settings_get_default_value (options.gcmd_settings->general, 
GCMD_SETTINGS_CONNECTIONS);
+    }
     g_settings_set_value(options.gcmd_settings->general, GCMD_SETTINGS_CONNECTIONS, connectionsToStore);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]