mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Return boolean on prof_settings_string_list_remove_all()
This commit is contained in:
parent
b72bb3a157
commit
b2508be8f4
@ -440,10 +440,10 @@ api_settings_string_list_remove(const char *const group, const char *const key,
|
||||
return plugin_settings_string_list_remove(group, key, value);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
api_settings_string_list_remove_all(const char *const group, const char *const key)
|
||||
{
|
||||
plugin_settings_string_list_remove_all(group, key);
|
||||
return plugin_settings_string_list_remove_all(group, key);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -87,7 +87,7 @@ void api_settings_set_int(const char *const group, const char *const key, int va
|
||||
char** api_settings_get_string_list(const char *const group, const char *const key);
|
||||
void api_settings_string_list_add(const char *const group, const char *const key, const char *const value);
|
||||
int api_settings_string_list_remove(const char *const group, const char *const key, const char *const value);
|
||||
void api_settings_string_list_remove_all(const char *const group, const char *const key);
|
||||
int api_settings_string_list_remove_all(const char *const group, const char *const key);
|
||||
|
||||
void api_incoming_message(const char *const barejid, const char *const resource, const char *const message);
|
||||
|
||||
|
@ -850,10 +850,13 @@ python_api_settings_get_string_list(PyObject *self, PyObject *args)
|
||||
PyObject *py_curr = Py_BuildValue("s", c_list[i]);
|
||||
int res = PyList_Append(py_list, py_curr);
|
||||
if (res != 0) {
|
||||
g_strfreev(c_list);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
g_strfreev(c_list);
|
||||
|
||||
return Py_BuildValue("O", py_list);
|
||||
}
|
||||
|
||||
@ -918,19 +921,23 @@ python_api_settings_string_list_remove_all(PyObject *self, PyObject *args)
|
||||
PyObject *key = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO", &group, &key)) {
|
||||
Py_RETURN_NONE;
|
||||
return Py_BuildValue("O", Py_False);
|
||||
}
|
||||
|
||||
char *group_str = python_str_or_unicode_to_string(group);
|
||||
char *key_str = python_str_or_unicode_to_string(key);
|
||||
|
||||
allow_python_threads();
|
||||
api_settings_string_list_remove_all(group_str, key_str);
|
||||
int res = api_settings_string_list_remove_all(group_str, key_str);
|
||||
free(group_str);
|
||||
free(key_str);
|
||||
disable_python_threads();
|
||||
|
||||
Py_RETURN_NONE;
|
||||
if (res) {
|
||||
return Py_BuildValue("O", Py_True);
|
||||
} else {
|
||||
return Py_BuildValue("O", Py_False);
|
||||
}
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
|
@ -155,15 +155,17 @@ plugin_settings_string_list_remove(const char *const group, const char *const ke
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
plugin_settings_string_list_remove_all(const char *const group, const char *const key)
|
||||
{
|
||||
if (!g_key_file_has_key(settings, group, key, NULL)) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_key_file_remove_key(settings, group, key, NULL);
|
||||
_save_settings();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -47,6 +47,6 @@ void plugin_settings_set_int(const char *const group, const char *const key, int
|
||||
char** plugin_settings_get_string_list(const char *const group, const char *const key);
|
||||
void plugin_settings_string_list_add(const char *const group, const char *const key, const char *const value);
|
||||
int plugin_settings_string_list_remove(const char *const group, const char *const key, const char *const value);
|
||||
void plugin_settings_string_list_remove_all(const char *const group, const char *const key);
|
||||
int plugin_settings_string_list_remove_all(const char *const group, const char *const key);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user