Refactor for threaded external executable for built-in download methods
This commit is contained in:
@@ -48,15 +48,16 @@
|
||||
#define FILE_PROFANITY_IDENTIFIER "profident"
|
||||
#define FILE_BOOKMARK_AUTOJOIN_IGNORE "bookmark_ignore"
|
||||
|
||||
#define DIR_THEMES "themes"
|
||||
#define DIR_ICONS "icons"
|
||||
#define DIR_SCRIPTS "scripts"
|
||||
#define DIR_CHATLOGS "chatlogs"
|
||||
#define DIR_OTR "otr"
|
||||
#define DIR_PGP "pgp"
|
||||
#define DIR_OMEMO "omemo"
|
||||
#define DIR_PLUGINS "plugins"
|
||||
#define DIR_DATABASE "database"
|
||||
#define DIR_THEMES "themes"
|
||||
#define DIR_ICONS "icons"
|
||||
#define DIR_SCRIPTS "scripts"
|
||||
#define DIR_CHATLOGS "chatlogs"
|
||||
#define DIR_OTR "otr"
|
||||
#define DIR_PGP "pgp"
|
||||
#define DIR_OMEMO "omemo"
|
||||
#define DIR_PLUGINS "plugins"
|
||||
#define DIR_DATABASE "database"
|
||||
#define DIR_DOWNLOADS "downloads"
|
||||
|
||||
void files_create_directories(void);
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ static const char* _get_group(preference_t pref);
|
||||
static const char* _get_key(preference_t pref);
|
||||
static gboolean _get_default_boolean(preference_t pref);
|
||||
static char* _get_default_string(preference_t pref);
|
||||
static char** _get_default_string_list(preference_t pref);
|
||||
|
||||
static void
|
||||
_prefs_load(void)
|
||||
@@ -544,33 +543,6 @@ prefs_get_string_with_option(preference_t pref, gchar* option)
|
||||
return result;
|
||||
}
|
||||
|
||||
gchar**
|
||||
prefs_get_string_list_with_option(preference_t pref, gchar* option)
|
||||
{
|
||||
const char* group = _get_group(pref);
|
||||
const char* key = _get_key(pref);
|
||||
char** def = _get_default_string_list(pref);
|
||||
|
||||
gchar** result = g_key_file_get_locale_string_list(prefs, group, key, option, NULL, NULL);
|
||||
if (result) {
|
||||
g_strfreev(def);
|
||||
return result;
|
||||
}
|
||||
|
||||
result = g_key_file_get_string_list(prefs, group, key, NULL, NULL);
|
||||
if (result) {
|
||||
g_strfreev(def);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (def) {
|
||||
return def;
|
||||
} else {
|
||||
g_strfreev(def);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_string(preference_t pref, char* value)
|
||||
{
|
||||
@@ -1893,6 +1865,7 @@ _get_group(preference_t pref)
|
||||
return PREF_GROUP_LOGGING;
|
||||
case PREF_AVATAR_CMD:
|
||||
case PREF_URL_OPEN_CMD:
|
||||
return PREF_GROUP_EXECUTABLES;
|
||||
case PREF_URL_SAVE_CMD:
|
||||
return PREF_GROUP_EXECUTABLES;
|
||||
case PREF_AUTOAWAY_CHECK:
|
||||
@@ -2318,24 +2291,10 @@ _get_default_string(preference_t pref)
|
||||
return "false";
|
||||
case PREF_AVATAR_CMD:
|
||||
return "xdg-open";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// the default setting for a string list type preference
|
||||
// if it is not specified in .profrc
|
||||
static char**
|
||||
_get_default_string_list(preference_t pref)
|
||||
{
|
||||
char** str_array = NULL;
|
||||
|
||||
switch (pref) {
|
||||
case PREF_URL_OPEN_CMD:
|
||||
str_array = g_malloc0(3);
|
||||
str_array[0] = g_strdup("false");
|
||||
str_array[1] = g_strdup("xdg-open %u");
|
||||
return str_array;
|
||||
return "xdg-open %u";
|
||||
case PREF_URL_SAVE_CMD:
|
||||
return NULL; // Default to built-in method.
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,6 @@ gboolean prefs_get_boolean(preference_t pref);
|
||||
void prefs_set_boolean(preference_t pref, gboolean value);
|
||||
char* prefs_get_string(preference_t pref);
|
||||
char* prefs_get_string_with_option(preference_t pref, gchar* option);
|
||||
gchar** prefs_get_string_list_with_option(preference_t pref, gchar* option);
|
||||
void prefs_set_string(preference_t pref, char* value);
|
||||
void prefs_set_string_with_option(preference_t pref, char* option, char* value);
|
||||
void prefs_set_string_list_with_option(preference_t pref, char* option, const gchar* const* values);
|
||||
|
||||
Reference in New Issue
Block a user