[geany/geany-plugins] 323e6d: geniuspaste: Restore configuration compatibility with previous version

Colomban Wendling git-noreply at xxxxx
Sun Feb 21 08:49:42 UTC 2016


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 16 Jan 2016 21:46:54 UTC
Commit:      323e6dbcb81889ee0a000c5a866ee2546ca77e76
             https://github.com/geany/geany-plugins/commit/323e6dbcb81889ee0a000c5a866ee2546ca77e76

Log Message:
-----------
geniuspaste: Restore configuration compatibility with previous version


Modified Paths:
--------------
    geniuspaste/src/geniuspaste.c

Modified: geniuspaste/src/geniuspaste.c
21 lines changed, 19 insertions(+), 2 deletions(-)
===================================================================
@@ -257,7 +257,24 @@ static void load_settings(void)
                               "geniuspaste", G_DIR_SEPARATOR_S, "geniuspaste.conf", NULL);
     g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
 
-    pastebin_selected = utils_get_setting_string(config, "geniuspaste", "website", "pastebin.geany.org");
+    if (g_key_file_has_key(config, "geniuspaste", "pastebin", NULL) ||
+        ! g_key_file_has_key(config, "geniuspaste", "website", NULL))
+    {
+        pastebin_selected = utils_get_setting_string(config, "geniuspaste", "pastebin", "pastebin.geany.org");
+    }
+    else
+    {
+        /* compatibility for old setting "website" */
+        switch (utils_get_setting_integer(config, "geniuspaste", "website", 2))
+        {
+            case 0: pastebin_selected = g_strdup("codepad.org"); break;
+            case 1: pastebin_selected = g_strdup("tinypaste.com"); break;
+            default:
+            case 2: pastebin_selected = g_strdup("pastebin.geany.org"); break;
+            case 3: pastebin_selected = g_strdup("dpaste.de"); break;
+            case 4: pastebin_selected = g_strdup("sprunge.us"); break;
+        }
+    }
     check_button_is_checked = utils_get_setting_boolean(config, "geniuspaste", "open_browser", FALSE);
     author_name = utils_get_setting_string(config, "geniuspaste", "author_name", USERNAME);
 
@@ -272,7 +289,7 @@ static void save_settings(void)
 
     g_key_file_load_from_file(config, config_file, G_KEY_FILE_NONE, NULL);
 
-    g_key_file_set_string(config, "geniuspaste", "website", pastebin_selected);
+    g_key_file_set_string(config, "geniuspaste", "pastebin", pastebin_selected);
     g_key_file_set_boolean(config, "geniuspaste", "open_browser", check_button_is_checked);
     g_key_file_set_string(config, "geniuspaste", "author_name", author_name);
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list