diff options
author | Hiroyuki Tanaka <myheroyuki@outlook.com> | 2024-01-04 17:00:18 +0300 |
---|---|---|
committer | Hiroyuki Tanaka <myheroyuki@outlook.com> | 2024-01-04 17:00:18 +0300 |
commit | e811ce031c49a7a531e951bbbad9b8c78ebbd49d (patch) | |
tree | ed701ccfc647e916a9c90bc03c8c102e4857c152 | |
parent | 16f756060e2f045ca3aa6c9714a136fe5ef4c86a (diff) | |
parent | 3b5fe74069fad29d53eb25be74d8ea807cce0c0e (diff) |
Merge branch 'unlock_plugin' into 'master'
Add unlocking code to let plugins use passwords
See merge request Remmina/Remmina!2556
-rw-r--r-- | plugins/python_wrapper/python_wrapper_remmina.c | 21 | ||||
-rw-r--r-- | src/include/remmina/plugin.h | 1 | ||||
-rw-r--r-- | src/remmina_plugin_manager.c | 2 |
3 files changed, 24 insertions, 0 deletions
diff --git a/plugins/python_wrapper/python_wrapper_remmina.c b/plugins/python_wrapper/python_wrapper_remmina.c index 955be8ef0..7a4a7711d 100644 --- a/plugins/python_wrapper/python_wrapper_remmina.c +++ b/plugins/python_wrapper/python_wrapper_remmina.c @@ -67,6 +67,7 @@ static PyObject* python_wrapper_debug_wrapper(PyObject* self, PyObject* msg); static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin); static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin); static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs); +static PyObject* remmina_unlock_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs); static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs); static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs); static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin); @@ -133,6 +134,11 @@ static PyMethodDef remmina_python_module_type_methods[] = { { "file_new", (PyCFunction)remmina_file_new_wrapper, METH_VARARGS | METH_KEYWORDS, NULL }, /** + * Calls remmina_unlock_new and returns its result. + */ + { "unlock_new", (PyCFunction)remmina_unlock_new_wrapper, METH_VARARGS | METH_KEYWORDS, NULL }, + + /** * Calls remmina_pref_set_value and returns its result. */ { "pref_set_value", (PyCFunction)remmina_pref_set_value_wrapper, METH_VARARGS | METH_KEYWORDS, NULL }, @@ -854,6 +860,21 @@ static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObje return Py_None; } +static PyObject* remmina_unlock_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs) +{ + TRACE_CALL(__func__); + + static char* kwlist[] = { "window", NULL}; + GtkWindow* window = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|0", kwlist, &window)) + { + return Py_None; + } + + return PyBool_FromLong(python_wrapper_get_service()->plugin_unlock_new(window)); +} + static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs) { TRACE_CALL(__func__); diff --git a/src/include/remmina/plugin.h b/src/include/remmina/plugin.h index a69b54359..cef051be5 100644 --- a/src/include/remmina/plugin.h +++ b/src/include/remmina/plugin.h @@ -301,6 +301,7 @@ typedef struct _RemminaPluginService { GtkWidget *(*rcw_open_from_file_full)(RemminaFile *remminafile, GCallback disconnect_cb, gpointer data, guint *handler); void (*show_dialog)(GtkMessageType msg, GtkButtonsType buttons, const gchar* message); GtkWindow *(*get_window)(void); + gint (*plugin_unlock_new)(GtkWindow* parent); } RemminaPluginService; /* "Prototype" of the plugin entry function */ diff --git a/src/remmina_plugin_manager.c b/src/remmina_plugin_manager.c index 27c248644..aaa617ab2 100644 --- a/src/remmina_plugin_manager.c +++ b/src/remmina_plugin_manager.c @@ -60,6 +60,7 @@ #include "remmina_public.h" #include "remmina_masterthread_exec.h" #include "remmina/remmina_trace_calls.h" +#include "remmina_unlock.h" static GPtrArray* remmina_plugin_table = NULL; @@ -308,6 +309,7 @@ RemminaPluginService remmina_plugin_manager_service = rcw_open_from_file_full, remmina_main_show_dialog, remmina_main_get_window, + remmina_unlock_new, }; const char *get_filename_ext(const char *filename) { |