diff options
-rw-r--r-- | src/command/cmd_defs.c | 10 | ||||
-rw-r--r-- | src/command/cmd_funcs.c | 4 | ||||
-rw-r--r-- | src/config/preferences.c | 32 |
3 files changed, 36 insertions, 10 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index e876b647..94633f03 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2510,9 +2510,9 @@ static struct cmd_t command_defs[] = { "Configure executable that should be called upon a certain command.") CMD_ARGS( { "avatar", "Set executable that is run by /avatar open. Use your favorite image viewer." }, - { "urlopen set", "Set executable that is run by /url open. It may be your favorite browser or a specific viewer." }, + { "urlopen set", "Set executable that is run by /url open. Takes a command template that replaces %u and %p with the URL and path respectively." }, { "urlopen default", "Restore to default settings." }, - { "urlsave set", "Set executable that is run by /url save. It may be your favorite downloader.'" }, + { "urlsave set", "Set executable that is run by /url save. Takes a command template that replaces %u and %p with the URL and path respectively." }, { "urlsave default", "Use the built-in download method for saving." }) CMD_EXAMPLES( "/executable avatar xdg-open", @@ -2853,9 +2853,9 @@ command_mangen(void) mkdir_recursive("docs"); char* header = NULL; - GDateTime *now = g_date_time_new_now_local(); - gchar *date = g_date_time_format(now, "%F"); - if (asprintf(&header, ".TH man 1 \"%s\" \""PACKAGE_VERSION"\" \"Profanity XMPP client\"\n", date) == -1) { + GDateTime* now = g_date_time_new_now_local(); + gchar* date = g_date_time_format(now, "%F"); + if (asprintf(&header, ".TH man 1 \"%s\" \"" PACKAGE_VERSION "\" \"Profanity XMPP client\"\n", date) == -1) { // TODO: error return; } diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 9784f388..38b45a57 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -9263,8 +9263,8 @@ cmd_executable_urlopen(ProfWin* window, const char* const command, gchar** args) g_free(str); } else if (g_strcmp0(args[1], "default") == 0) { - prefs_set_string(PREF_URL_SAVE_CMD, NULL); - gchar* def = prefs_get_string(PREF_URL_SAVE_CMD); + prefs_set_string(PREF_URL_OPEN_CMD, NULL); + gchar* def = prefs_get_string(PREF_URL_OPEN_CMD); cons_show("`url open` command set to invoke %s (default)", def); g_free(def); } else { diff --git a/src/config/preferences.c b/src/config/preferences.c index b47d3667..d350eccb 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -170,7 +170,7 @@ _prefs_load(void) value = g_string_append(value, val); value = g_string_append(value, " %u;"); - g_key_file_set_locale_string(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", "*", value->str); + g_key_file_set_locale_string(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", "DEF", value->str); g_key_file_remove_key(prefs, PREF_GROUP_LOGGING, "urlopen.cmd", NULL); g_string_free(value, TRUE); @@ -182,12 +182,38 @@ _prefs_load(void) g_key_file_set_string(prefs, PREF_GROUP_EXECUTABLES, "avatar.cmd", value); g_key_file_remove_key(prefs, PREF_GROUP_LOGGING, "avatar.cmd", NULL); } - - // 0.10 will have omemo media sharing. so disabling of sendfile introduced in 0.9 is not needed (#1270) + + // 0.10 will have omemo media sharing. So disabling of sendfile introduced in 0.9 is not needed (#1270) if (g_key_file_has_key(prefs, PREF_GROUP_OMEMO, "sendfile", NULL)) { g_key_file_remove_key(prefs, PREF_GROUP_OMEMO, "sendfile", NULL); } + // 0.10 have changed the behavior of /url open and /url save to not use any + // file type or scheme matching. Move value saved under 'DEF' locale to a + // simple key-value string not under any locale. + { + char** values = g_key_file_get_locale_string_list(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", "DEF", NULL, NULL); + if (values && !g_key_file_has_key(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", NULL)) { + // First value in array is `require_save` option -- we ignore that + // one as there is no such option anymore. + char* executable = values[1]; + + g_key_file_set_string(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", executable); + g_key_file_set_comment(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd", " Migrated from url.open.cmd[DEF]. `require_save` option has been removed in v0.10 and was discarded.", NULL); + g_key_file_remove_key(prefs, PREF_GROUP_EXECUTABLES, "url.open.cmd[DEF]", NULL); + + g_strfreev(values); + } + + char* value = g_key_file_get_locale_string(prefs, PREF_GROUP_EXECUTABLES, "url.save.cmd", "DEF", NULL); + if (value && !g_key_file_has_key(prefs, PREF_GROUP_EXECUTABLES, "url.save.cmd", NULL)) { + g_key_file_set_string(prefs, PREF_GROUP_EXECUTABLES, "url.save.cmd", value); + g_key_file_set_comment(prefs, PREF_GROUP_EXECUTABLES, "url.save.cmd", " Migrated from url.save.cmd[DEF].", NULL); + g_key_file_remove_key(prefs, PREF_GROUP_EXECUTABLES, "url.save.cmd[DEF]", NULL); + g_free(value); + } + } + _save_prefs(); boolean_choice_ac = autocomplete_new(); |