mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Add /executable (urlsave|urlopen)
migrations
This commit is contained in:
parent
8c94b9f230
commit
01e8f01ed3
@ -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",
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
@ -183,11 +183,37 @@ _prefs_load(void)
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user