Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToolsDevler <info@toolsdevler.net>2020-11-17 21:59:52 +0300
committerToolsDevler <info@toolsdevler.net>2020-12-31 03:03:24 +0300
commitbed2869b221ad256e60e8014717543ef9e5b9b1e (patch)
tree35c07579ae1bfc76b7ed9d1c282b7521a1a300ee
parent0ccbadde7984ded9a371a2abd38801b7e61d72f8 (diff)
WIP: Cleanup remmina module code
-rw-r--r--src/remmina_plugin_manager.c1
-rw-r--r--src/remmina_plugin_python_module.c514
-rw-r--r--src/remmina_plugin_python_remmina.c916
-rw-r--r--src/remmina_plugin_python_remmina.h751
4 files changed, 940 insertions, 1242 deletions
diff --git a/src/remmina_plugin_manager.c b/src/remmina_plugin_manager.c
index 54658aeb0..81377c562 100644
--- a/src/remmina_plugin_manager.c
+++ b/src/remmina_plugin_manager.c
@@ -170,7 +170,6 @@ gboolean remmina_gtksocket_available()
RemminaPluginService remmina_plugin_manager_service =
{
- remmina_plugin_manager_register_plugin,
remmina_protocol_widget_get_width,
remmina_protocol_widget_set_width,
remmina_protocol_widget_get_height,
diff --git a/src/remmina_plugin_python_module.c b/src/remmina_plugin_python_module.c
index 917bbb815..f33ff2991 100644
--- a/src/remmina_plugin_python_module.c
+++ b/src/remmina_plugin_python_module.c
@@ -94,196 +94,20 @@
#include "config.h"
#include "pygobject.h"
#include "remmina_plugin_manager.h"
+#include "remmina_plugin_python_remmina.h"
#include "remmina/plugin.h"
#include "remmina_protocol_widget.h"
/**
- * @brief Holds pairs of Python and Remmina plugin instances (PyPlugin).
- */
-GPtrArray *remmina_plugin_registry = NULL;
-
-typedef struct {
- PyObject_HEAD
- RemminaProtocolWidget* gp;
-} PyRemminaProtocolWidget;
-
-/**
- * @brief Maps an instance of a Python plugin to a Remmina one.
- */
-typedef struct {
- PyObject *pythonInstance;
-
- RemminaProtocolPlugin *protocolPlugin;
- //@TODO: Add more plugin types
- PyRemminaProtocolWidget *gp;
-} PyPlugin;
-
-
-
-/**
- * @brief Initializes the 'remmina' module
- * @details This function is only called by the Python engine!
- */
-PyMODINIT_FUNC remmina_plugin_python_module_initialize(void);
-
-
-/**
- * @brief The functions of the remmina module.
- *
- * @details If any function has to be added this is the place to do it. This list is referenced
- * by the PyModuleDef (describing the module) instance below.
- */
-static PyMethodDef remmina_python_module_type_methods[] = {
- // @TODO: Add all functions from RemminaPluginService
- {"register_plugin", (PyCFunction)remmina_plugin_python_register_plugin, METH_O, NULL },
- {"log_print", (PyCFunction)remmina_plugin_python_log_printf_wrapper, METH_VARARGS, NULL },
- {"get_viewport", (PyCFunction)remmina_plugin_python_get_viewport, METH_O, NULL },
- {"get_viewport", (PyCFunction)remmina_plugin_manager_register_plugin_wrapper},
- {"protocol_widget_get_width", (PyCFunction)remmina_protocol_widget_get_width_wrapper},
- {"protocol_widget_set_width", (PyCFunction)remmina_protocol_widget_set_width_wrapper},
- {"protocol_widget_get_height", (PyCFunction)remmina_protocol_widget_get_height_wrapper},
- {"protocol_widget_set_height", (PyCFunction)remmina_protocol_widget_set_height_wrapper},
- {"protocol_widget_get_current_scale_mode", (PyCFunction)remmina_protocol_widget_get_current_scale_mode_wrapper},
- {"protocol_widget_get_expand", (PyCFunction)remmina_protocol_widget_get_expand_wrapper},
- {"protocol_widget_set_expand", (PyCFunction)remmina_protocol_widget_set_expand_wrapper},
- {"protocol_widget_has_error", (PyCFunction)remmina_protocol_widget_has_error_wrapper},
- {"protocol_widget_set_error", (PyCFunction)remmina_protocol_widget_set_error_wrapper},
- {"protocol_widget_is_closed", (PyCFunction)remmina_protocol_widget_is_closed_wrapper},
- {"protocol_widget_get_file", (PyCFunction)remmina_protocol_widget_get_file_wrapper},
- {"protocol_widget_emit_signal", (PyCFunction)remmina_protocol_widget_emit_signal_wrapper},
- {"protocol_widget_register_hostkey", (PyCFunction)remmina_protocol_widget_register_hostkey_wrapper},
- {"protocol_widget_start_direct_tunnel", (PyCFunction)remmina_protocol_widget_start_direct_tunnel_wrapper},
- {"protocol_widget_start_reverse_tunnel", (PyCFunction)remmina_protocol_widget_start_reverse_tunnel_wrapper},
- {"protocol_widget_start_xport_tunnel", (PyCFunction)remmina_protocol_widget_start_xport_tunnel_wrapper},
- {"protocol_widget_set_display", (PyCFunction)remmina_protocol_widget_set_display_wrapper},
- {"protocol_widget_signal_connection_closed", (PyCFunction)remmina_protocol_widget_signal_connection_closed_wrapper},
- {"protocol_widget_signal_connection_opened", (PyCFunction)remmina_protocol_widget_signal_connection_opened_wrapper},
- {"protocol_widget_update_align", (PyCFunction)remmina_protocol_widget_update_align_wrapper},
- {"protocol_widget_unlock_dynres", (PyCFunction)remmina_protocol_widget_unlock_dynres_wrapper},
- {"protocol_widget_desktop_resize", (PyCFunction)remmina_protocol_widget_desktop_resize_wrapper},
- {"protocol_widget_panel_auth", (PyCFunction)remmina_protocol_widget_panel_auth_wrapper},
- {"protocol_widget_panel_new_certificate", (PyCFunction)remmina_protocol_widget_panel_new_certificate_wrapper},
- {"protocol_widget_panel_changed_certificate", (PyCFunction)remmina_protocol_widget_panel_changed_certificate_wrapper},
- {"protocol_widget_get_username", (PyCFunction)remmina_protocol_widget_get_username_wrapper},
- {"protocol_widget_get_password", (PyCFunction)remmina_protocol_widget_get_password_wrapper},
- {"protocol_widget_get_domain", (PyCFunction)remmina_protocol_widget_get_domain_wrapper},
- {"protocol_widget_get_savepassword", (PyCFunction)remmina_protocol_widget_get_savepassword_wrapper},
- {"protocol_widget_panel_authx509", (PyCFunction)remmina_protocol_widget_panel_authx509_wrapper},
- {"protocol_widget_get_cacert", (PyCFunction)remmina_protocol_widget_get_cacert_wrapper},
- {"protocol_widget_get_cacrl", (PyCFunction)remmina_protocol_widget_get_cacrl_wrapper},
- {"protocol_widget_get_clientcert", (PyCFunction)remmina_protocol_widget_get_clientcert_wrapper},
- {"protocol_widget_get_clientkey", (PyCFunction)remmina_protocol_widget_get_clientkey_wrapper},
- {"protocol_widget_save_cred", (PyCFunction)remmina_protocol_widget_save_cred_wrapper},
- {"protocol_widget_panel_show_listen", (PyCFunction)remmina_protocol_widget_panel_show_listen_wrapper},
- {"protocol_widget_panel_show_retry", (PyCFunction)remmina_protocol_widget_panel_show_retry_wrapper},
- {"protocol_widget_panel_show", (PyCFunction)remmina_protocol_widget_panel_show_wrapper},
- {"protocol_widget_panel_hide", (PyCFunction)remmina_protocol_widget_panel_hide_wrapper},
- {"protocol_widget_ssh_exec", (PyCFunction)remmina_protocol_widget_ssh_exec_wrapper},
- {"protocol_widget_chat_open", (PyCFunction)remmina_protocol_widget_chat_open_wrapper},
- {"protocol_widget_chat_close", (PyCFunction)remmina_protocol_widget_chat_close_wrapper},
- {"protocol_widget_chat_receive", (PyCFunction)remmina_protocol_widget_chat_receive_wrapper},
- {"protocol_widget_send_keys_signals", (PyCFunction)remmina_protocol_widget_send_keys_signals_wrapper},
-
- {"get_datadir", (PyCFunction)remmina_file_get_datadir_wrapper},
-
- {"file_new", (PyCFunction)remmina_file_new_wrapper},
- {"file_get_filename", (PyCFunction)remmina_file_get_filename_wrapper},
- {"file_set_string", (PyCFunction)remmina_file_set_string_wrapper},
- {"file_get_string", (PyCFunction)remmina_file_get_string_wrapper},
- {"file_get_secret", (PyCFunction)remmina_file_get_secret_wrapper},
- {"file_set_int", (PyCFunction)remmina_file_set_int_wrapper},
- {"file_get_int", (PyCFunction)remmina_file_get_int_wrapper},
- {"file_unsave_passwords", (PyCFunction)remmina_file_unsave_passwords_wrapper},
-
- {"pref_set_value", (PyCFunction)remmina_pref_set_value_wrapper},
- {"pref_get_value", (PyCFunction)remmina_pref_get_value_wrapper},
- {"pref_get_scale_quality", (PyCFunction)remmina_pref_get_scale_quality_wrapper},
- {"pref_get_sshtunnel_port", (PyCFunction)remmina_pref_get_sshtunnel_port_wrapper},
- {"pref_get_ssh_loglevel", (PyCFunction)remmina_pref_get_ssh_loglevel_wrapper},
- {"pref_get_ssh_parseconfig", (PyCFunction)remmina_pref_get_ssh_parseconfig_wrapper},
- {"pref_keymap_get_keyval", (PyCFunction)remmina_pref_keymap_get_keyval_wrapper},
-
- {"log_print", (PyCFunction)remmina_log_print_wrapper},
- {"log_printf", (PyCFunction)remmina_log_printf_wrapper},
-
- {"widget_pool_register", (PyCFunction)remmina_widget_pool_register_wrapper},
-
- {"rcw_open_from_file_full", (PyCFunction)rcw_open_from_file_full_wrapper },
- {"public_get_server_port", (PyCFunction)remmina_public_get_server_port_wrapper},
- {"masterthread_exec_is_main_thread", (PyCFunction)remmina_masterthread_exec_is_main_thread_wrapper},
- {"gtksocket_available", (PyCFunction)remmina_gtksocket_available_wrapper},
- {"protocol_widget_get_profile_remote_width", (PyCFunction)remmina_protocol_widget_get_profile_remote_width_wrapper},
- {"protocol_widget_get_profile_remote_heigh", (PyCFunction)remmina_protocol_widget_get_profile_remote_heigh_wrapper}t
- {NULL} /* Sentinel */
-};
-
-/**
- * @brief The definition of the Python module 'remmina'.
- */
-static PyModuleDef remmina_python_module_type = {
- PyModuleDef_HEAD_INIT,
- .m_name = "remmina",
- .m_doc = "Remmina API.",
- .m_size = -1,
- .m_methods = remmina_python_module_type_methods
-};
-
-static PyObject* remmina_plugin_python_log_printf_wrapper(PyObject* self, PyObject* n)
-{
- TRACE_CALL(__func__);
- char* fmt = NULL;
- if (!PyArg_ParseTuple(n, "s", &fmt)) {
- g_print("Failed to load.\n");
- PyErr_Print();
- return NULL;
- }
-
- remmina_log_printf(fmt);
-
- return Py_None;
-}
-
-static PyObject* remmina_plugin_python_get_viewport(PyObject* self, PyObject* handle) {
- PyRemminaProtocolWidget *gp = (PyRemminaProtocolWidget*)handle;
- return pygobject_new(G_OBJECT(remmina_protocol_widget_gtkviewport(gp->gp)));
-}
-
-/**
- * @brief Initializes the remmina module and maps it to the Python engine.
- */
-void remmina_plugin_python_module_init(void)
-{
- TRACE_CALL(__func__);
- remmina_plugin_registry = g_ptr_array_new();
- if (PyImport_AppendInittab("remmina", remmina_plugin_python_module_initialize)) {
- g_print("Error initializing remmina module for python!\n");
- PyErr_Print();
- return;
- }
-}
-
-PyMODINIT_FUNC remmina_plugin_python_module_initialize(void)
-{
- TRACE_CALL(__func__);
- return PyModule_Create(&remmina_python_module_type);
-}
-
-/**
*
*/
-static void remmina_protocol_init_executor(PyPlugin* plugin, RemminaProtocolWidget *gp)
-{
- TRACE_CALL(__func__);
- if (g_str_equal(plugin->protocolPlugin->name, gp->plugin->name)) {
- plugin->gp->gp = gp;
- PyObject_CallMethod(plugin->pythonInstance, "init", "O", plugin);
- }
-}
-
static void remmina_protocol_init_wrapper(RemminaProtocolWidget *gp)
{
TRACE_CALL(__func__);
- g_ptr_array_foreach(remmina_plugin_registry, (GFunc)remmina_protocol_init_executor, gp);
+ PyPlugin* plugin = remmina_plugin_python_module_get_plugin(gp);
+ plugin->gp->gp = gp;
+ plugin->gp->viewport = pygobject_new(G_OBJECT(remmina_protocol_widget_gtkviewport(gp->gp)));
+ PyObject_CallMethod(plugin->pythonInstance, "init", "O", plugin);
}
static PyObject* remmina_protocol_open_connection_executor_result = NULL;
@@ -437,331 +261,3 @@ static gboolean remmina_plugin_python_check_mandatory_member(PyObject* instance,
g_printerr("Missing mandatory member in Python plugin instance: %s\n", member);
return FALSE;
}
-
-static PyObject* remmina_plugin_python_register_plugin(PyObject* self, PyObject* pluginInstance)
-{
- TRACE_CALL(__func__);
- if (pluginInstance) {
-
- if (!remmina_plugin_python_check_mandatory_member(pluginInstance, "name")
- || !remmina_plugin_python_check_mandatory_member(pluginInstance, "version")) {
- return NULL;
- }
-
- /* Protocol plugin definition and features */
- RemminaPlugin* remmina_plugin = NULL;
-
- const gchar* pluginType = PyUnicode_AsUTF8(PyObject_GetAttrString(pluginInstance, "type"));
-
- if (g_str_equal(pluginType, "protocol")) {
- remmina_plugin_python_create_protocol_plugin(pluginInstance);
- } else if (g_str_equal(pluginType, "entry")) {
- remmina_plugin_python_create_entry_plugin(pluginInstance);
- } else if (g_str_equal(pluginType, "file")) {
- remmina_plugin_python_create_file_plugin(pluginInstance);
- } else if (g_str_equal(pluginType, "tool")) {
- remmina_plugin_python_create_tool_plugin(pluginInstance);
- } else if (g_str_equal(pluginType, "pref")) {
- remmina_plugin_python_create_pref_plugin(pluginInstance);
- } else if (g_str_equal(pluginType, "secret")) {
- remmina_plugin_python_create_secret_plugin(pluginInstance);
- } else {
- g_printerr("Unknown plugin type: %s\n", pluginType);
- }
-
- if (remmina_plugin) {
- g_ptr_array_add(remmina_plugin_registry, pluginInstance);
- remmina_plugin_manager_service.register_plugin((RemminaPlugin *)remmina_plugin);
-
- PyPlugin* plugin = (PyPlugin*)malloc(sizeof(PyPlugin));
- plugin->protocolPlugin = remmina_plugin;
- plugin->pythonInstance = pluginInstance;
- plugin->gp = malloc(sizeof(PyRemminaProtocolWidget));
- plugin->gp->gp = NULL;
- g_ptr_array_add(remmina_plugin_registry, plugin);
- }
- }
-
- return Py_None;
-}
-
-static PyObject* remmina_plugin_manager_register_plugin_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_width_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_set_width_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_height_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_set_height_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_current_scale_mode_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_expand_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_set_expand_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_has_error_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_set_error_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_is_closed_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_file_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_emit_signal_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_register_hostkey_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_start_direct_tunnel_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_start_reverse_tunnel_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_start_xport_tunnel_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_set_display_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_signal_connection_closed_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_signal_connection_opened_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_update_align_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_unlock_dynres_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_desktop_resize_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_auth_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_new_certificate_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_changed_certificate_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_username_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_password_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_domain_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_savepassword_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_authx509_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_cacert_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_cacrl_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_clientcert_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_clientkey_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_save_cred_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_show_listen_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_show_retry_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_show_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_panel_hide_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_ssh_exec_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_chat_open_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_chat_close_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_chat_receive_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_send_keys_signals_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_get_filename_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_set_string_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_get_string_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_get_secret_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_set_int_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_get_int_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_file_unsave_passwords_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_log_print_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_log_printf_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_profile_remote_heigh_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-}
-static PyObject* remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* arg)
-{
- return Py_None;
-} \ No newline at end of file
diff --git a/src/remmina_plugin_python_remmina.c b/src/remmina_plugin_python_remmina.c
index 26f4d1c1c..b56c72b6f 100644
--- a/src/remmina_plugin_python_remmina.c
+++ b/src/remmina_plugin_python_remmina.c
@@ -1,5 +1,21 @@
-#include "remmina_plugin_python_remmina.h"
+#include <glib.h>
+#include <gtk/gtk.h>
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
+#include <structmember.h>
+
+#include "config.h"
+#include "pygobject.h"
+#include "remmina_plugin_manager.h"
+#include "remmina/plugin.h"
+#include "remmina_protocol_widget.h"
+
+#include "remmina_plugin_python_remmina.h"
+
+/**
+ * @brief Holds pairs of Python and Remmina plugin instances (PyPlugin).
+ */
+GPtrArray *remmina_plugin_registry = NULL;
/**
* @brief Wraps the log_printf function of RemminaPluginService.
@@ -11,10 +27,7 @@
* @param self Is always NULL since it is a static function of the 'remmina' module
* @param msg The message to print.
*/
-static PyObject* remmina_plugin_python_log_printf_wrapper(PyObject* self, PyObject* msg)
-{
- return Py_None;
-}
+static PyObject* remmina_plugin_python_log_printf_wrapper(PyObject* self, PyObject* msg);
/**
* @brief Accepts an instance of a Python class representing a Remmina plugin.
@@ -24,10 +37,7 @@ static PyObject* remmina_plugin_python_log_printf_wrapper(PyObject* self, PyObje
* @param self Is always NULL since it is a static function of the 'remmina' module
* @param plugin An instance of a Python plugin class.
*/
-static PyObject* remmina_plugin_python_register_plugin(PyObject* self, PyObject* plugin)
-{
- return Py_None;
-}
+static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin);
/**
* @brief Retrieves the viewport of the current connection window if available.
@@ -37,10 +47,7 @@ static PyObject* remmina_plugin_python_register_plugin(PyObject* self, PyObject*
* @param self Is always NULL since it is a static function of the 'remmina' module
* @param plugin The handle to retrieve the RemminaConnectionWidget
*/
-static PyObject* remmina_plugin_python_get_viewport(PyObject* self, PyObject* handle)
-{
- return Py_None;
-}
+static PyObject* remmina_plugin_python_get_viewport(PyObject* self, PyObject* handle);
/**
* @brief
@@ -50,8 +57,889 @@ static PyObject* remmina_plugin_python_get_viewport(PyObject* self, PyObject* ha
* @param self Is always NULL since it is a static function of the 'remmina' module
* @param plugin The handle to retrieve the RemminaConnectionWidget
*/
-static PyObject* remmina_plugin_manager_register_plugin_wrapper(PyObject* self, PyObject* plugin)
+static PyObject* remmina_protocol_widget_get_width_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_set_width_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_height_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_set_height_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_current_scale_mode_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_expand_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_set_expand_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_has_error_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_set_error_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_is_closed_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_file_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_emit_signal_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_register_hostkey_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_start_direct_tunnel_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_start_reverse_tunnel_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_start_xport_tunnel_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_set_display_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_signal_connection_closed_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_signal_connection_opened_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_update_align_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_unlock_dynres_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_desktop_resize_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_auth_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_new_certificate_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_changed_certificate_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_username_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_password_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_domain_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_savepassword_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_authx509_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_cacert_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_cacrl_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_clientcert_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_clientkey_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_save_cred_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_show_listen_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_show_retry_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_show_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_panel_hide_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_ssh_exec_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_chat_open_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_chat_close_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_chat_receive_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_send_keys_signals_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_get_filename_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_set_string_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_get_string_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_get_secret_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_set_int_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_get_int_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_file_unsave_passwords_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_log_print_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_log_printf_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_profile_remote_heigh_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief
+ *
+ * @details
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin The handle to retrieve the RemminaConnectionWidget
+ */
+static PyObject* remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* plugin);
+
+/**
+ * @brief The functions of the remmina module.
+ *
+ * @details If any function has to be added this is the place to do it. This list is referenced
+ * by the PyModuleDef (describing the module) instance below.
+ */
+static PyMethodDef remmina_python_module_type_methods[] = {
+ // @TODO: Add all functions from RemminaPluginService
+ {"register_plugin", (PyCFunction)remmina_register_plugin_wrapper, METH_O, NULL },
+ {"log_print", (PyCFunction)remmina_plugin_python_log_printf_wrapper, METH_VARARGS, NULL },
+ {"protocol_widget_get_width", (PyCFunction)remmina_protocol_widget_get_width_wrapper},
+ {"protocol_widget_set_width", (PyCFunction)remmina_protocol_widget_set_width_wrapper},
+ {"protocol_widget_get_height", (PyCFunction)remmina_protocol_widget_get_height_wrapper},
+ {"protocol_widget_set_height", (PyCFunction)remmina_protocol_widget_set_height_wrapper},
+ {"protocol_widget_get_current_scale_mode", (PyCFunction)remmina_protocol_widget_get_current_scale_mode_wrapper},
+ {"protocol_widget_get_expand", (PyCFunction)remmina_protocol_widget_get_expand_wrapper},
+ {"protocol_widget_set_expand", (PyCFunction)remmina_protocol_widget_set_expand_wrapper},
+ {"protocol_widget_has_error", (PyCFunction)remmina_protocol_widget_has_error_wrapper},
+ {"protocol_widget_set_error", (PyCFunction)remmina_protocol_widget_set_error_wrapper},
+ {"protocol_widget_is_closed", (PyCFunction)remmina_protocol_widget_is_closed_wrapper},
+ {"protocol_widget_get_file", (PyCFunction)remmina_protocol_widget_get_file_wrapper},
+ {"protocol_widget_emit_signal", (PyCFunction)remmina_protocol_widget_emit_signal_wrapper},
+ {"protocol_widget_register_hostkey", (PyCFunction)remmina_protocol_widget_register_hostkey_wrapper},
+ {"protocol_widget_start_direct_tunnel", (PyCFunction)remmina_protocol_widget_start_direct_tunnel_wrapper},
+ {"protocol_widget_start_reverse_tunnel", (PyCFunction)remmina_protocol_widget_start_reverse_tunnel_wrapper},
+ {"protocol_widget_start_xport_tunnel", (PyCFunction)remmina_protocol_widget_start_xport_tunnel_wrapper},
+ {"protocol_widget_set_display", (PyCFunction)remmina_protocol_widget_set_display_wrapper},
+ {"protocol_widget_signal_connection_closed", (PyCFunction)remmina_protocol_widget_signal_connection_closed_wrapper},
+ {"protocol_widget_signal_connection_opened", (PyCFunction)remmina_protocol_widget_signal_connection_opened_wrapper},
+ {"protocol_widget_update_align", (PyCFunction)remmina_protocol_widget_update_align_wrapper},
+ {"protocol_widget_unlock_dynres", (PyCFunction)remmina_protocol_widget_unlock_dynres_wrapper},
+ {"protocol_widget_desktop_resize", (PyCFunction)remmina_protocol_widget_desktop_resize_wrapper},
+ {"protocol_widget_panel_auth", (PyCFunction)remmina_protocol_widget_panel_auth_wrapper},
+ {"protocol_widget_panel_new_certificate", (PyCFunction)remmina_protocol_widget_panel_new_certificate_wrapper},
+ {"protocol_widget_panel_changed_certificate", (PyCFunction)remmina_protocol_widget_panel_changed_certificate_wrapper},
+ {"protocol_widget_get_username", (PyCFunction)remmina_protocol_widget_get_username_wrapper},
+ {"protocol_widget_get_password", (PyCFunction)remmina_protocol_widget_get_password_wrapper},
+ {"protocol_widget_get_domain", (PyCFunction)remmina_protocol_widget_get_domain_wrapper},
+ {"protocol_widget_get_savepassword", (PyCFunction)remmina_protocol_widget_get_savepassword_wrapper},
+ {"protocol_widget_panel_authx509", (PyCFunction)remmina_protocol_widget_panel_authx509_wrapper},
+ {"protocol_widget_get_cacert", (PyCFunction)remmina_protocol_widget_get_cacert_wrapper},
+ {"protocol_widget_get_cacrl", (PyCFunction)remmina_protocol_widget_get_cacrl_wrapper},
+ {"protocol_widget_get_clientcert", (PyCFunction)remmina_protocol_widget_get_clientcert_wrapper},
+ {"protocol_widget_get_clientkey", (PyCFunction)remmina_protocol_widget_get_clientkey_wrapper},
+ {"protocol_widget_save_cred", (PyCFunction)remmina_protocol_widget_save_cred_wrapper},
+ {"protocol_widget_panel_show_listen", (PyCFunction)remmina_protocol_widget_panel_show_listen_wrapper},
+ {"protocol_widget_panel_show_retry", (PyCFunction)remmina_protocol_widget_panel_show_retry_wrapper},
+ {"protocol_widget_panel_show", (PyCFunction)remmina_protocol_widget_panel_show_wrapper},
+ {"protocol_widget_panel_hide", (PyCFunction)remmina_protocol_widget_panel_hide_wrapper},
+ {"protocol_widget_ssh_exec", (PyCFunction)remmina_protocol_widget_ssh_exec_wrapper},
+ {"protocol_widget_chat_open", (PyCFunction)remmina_protocol_widget_chat_open_wrapper},
+ {"protocol_widget_chat_close", (PyCFunction)remmina_protocol_widget_chat_close_wrapper},
+ {"protocol_widget_chat_receive", (PyCFunction)remmina_protocol_widget_chat_receive_wrapper},
+ {"protocol_widget_send_keys_signals", (PyCFunction)remmina_protocol_widget_send_keys_signals_wrapper},
+
+ {"get_datadir", (PyCFunction)remmina_file_get_datadir_wrapper},
+
+ {"file_new", (PyCFunction)remmina_file_new_wrapper},
+ {"file_get_filename", (PyCFunction)remmina_file_get_filename_wrapper},
+ {"file_set_string", (PyCFunction)remmina_file_set_string_wrapper},
+ {"file_get_string", (PyCFunction)remmina_file_get_string_wrapper},
+ {"file_get_secret", (PyCFunction)remmina_file_get_secret_wrapper},
+ {"file_set_int", (PyCFunction)remmina_file_set_int_wrapper},
+ {"file_get_int", (PyCFunction)remmina_file_get_int_wrapper},
+ {"file_unsave_passwords", (PyCFunction)remmina_file_unsave_passwords_wrapper},
+
+ {"pref_set_value", (PyCFunction)remmina_pref_set_value_wrapper},
+ {"pref_get_value", (PyCFunction)remmina_pref_get_value_wrapper},
+ {"pref_get_scale_quality", (PyCFunction)remmina_pref_get_scale_quality_wrapper},
+ {"pref_get_sshtunnel_port", (PyCFunction)remmina_pref_get_sshtunnel_port_wrapper},
+ {"pref_get_ssh_loglevel", (PyCFunction)remmina_pref_get_ssh_loglevel_wrapper},
+ {"pref_get_ssh_parseconfig", (PyCFunction)remmina_pref_get_ssh_parseconfig_wrapper},
+ {"pref_keymap_get_keyval", (PyCFunction)remmina_pref_keymap_get_keyval_wrapper},
+
+ {"log_print", (PyCFunction)remmina_log_print_wrapper},
+ {"log_printf", (PyCFunction)remmina_log_printf_wrapper},
+
+ {"widget_pool_register", (PyCFunction)remmina_widget_pool_register_wrapper},
+
+ {"rcw_open_from_file_full", (PyCFunction)rcw_open_from_file_full_wrapper },
+ {"public_get_server_port", (PyCFunction)remmina_public_get_server_port_wrapper},
+ {"masterthread_exec_is_main_thread", (PyCFunction)remmina_masterthread_exec_is_main_thread_wrapper},
+ {"gtksocket_available", (PyCFunction)remmina_gtksocket_available_wrapper},
+ {"protocol_widget_get_profile_remote_width", (PyCFunction)remmina_protocol_widget_get_profile_remote_width_wrapper},
+ {"protocol_widget_get_profile_remote_heigh", (PyCFunction)remmina_protocol_widget_get_profile_remote_heigh_wrapper},
+ {NULL} /* Sentinel */
+};
+
+/**
+ * @brief The definition of the Python module 'remmina'.
+ */
+static PyModuleDef remmina_python_module_type = {
+ PyModuleDef_HEAD_INIT,
+ .m_name = "remmina",
+ .m_doc = "Remmina API.",
+ .m_size = -1,
+ .m_methods = remmina_python_module_type_methods
+};
+
+/**
+ * @brief Is called from the Python engine when it initializes the 'remmina' module.
+ * @details This function is only called by the Python engine!
+ */
+static PyMODINIT_FUNC remmina_plugin_python_module_initialize(void)
+{
+ TRACE_CALL(__func__);
+ return PyModule_Create(&remmina_python_module_type);
+}
+
+/**
+ * @brief Initializes all globals and registers the 'remmina' module in the Python engine.
+ * @details This
+ */
+void remmina_plugin_python_module_init(void)
+{
+ TRACE_CALL(__func__);
+ remmina_plugin_registry = g_ptr_array_new();
+ if (PyImport_AppendInittab("remmina", remmina_plugin_python_module_initialize)) {
+ g_print("Error initializing remmina module for python!\n");
+ PyErr_Print();
+ }
+}
+
+/**
+ * @brief Wraps the log_printf function of RemminaPluginService.
+ *
+ * @details This function is only called by the Python engine! There is only one argument
+ * since Python offers an inline string formatting which renders any formatting capabilities
+ * redundant.
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param msg The message to print.
+ */
+static PyObject* remmina_plugin_python_log_printf_wrapper(PyObject* self, PyObject* msg)
{
+ TRACE_CALL(__func__);
+ char* fmt = NULL;
+
+ if (PyArg_ParseTuple(msg, "s", &fmt)) {
+ remmina_log_printf(fmt);
+ } else {
+ g_print("Failed to load.\n");
+ PyErr_Print();
+ return Py_None;
+ }
+
+ return Py_None;
+}
+
+/**
+ * @brief Accepts an instance of a Python class representing a Remmina plugin.
+ *
+ * @details This function is only called by the Python engine!
+ *
+ * @param self Is always NULL since it is a static function of the 'remmina' module
+ * @param plugin An instance of a Python plugin class.
+ */
+static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* pluginInstance)
+{
+ TRACE_CALL(__func__);
+ if (pluginInstance) {
+ if (!remmina_plugin_python_check_mandatory_member(pluginInstance, "name")
+ || !remmina_plugin_python_check_mandatory_member(pluginInstance, "version")) {
+ return NULL;
+ }
+
+ /* Protocol plugin definition and features */
+ RemminaPlugin* remmina_plugin = NULL;
+
+ const gchar* pluginType = PyUnicode_AsUTF8(PyObject_GetAttrString(pluginInstance, "type"));
+
+ if (g_str_equal(pluginType, "protocol")) {
+ remmina_plugin_python_create_protocol_plugin(pluginInstance);
+ } else if (g_str_equal(pluginType, "entry")) {
+ remmina_plugin_python_create_entry_plugin(pluginInstance);
+ } else if (g_str_equal(pluginType, "file")) {
+ remmina_plugin_python_create_file_plugin(pluginInstance);
+ } else if (g_str_equal(pluginType, "tool")) {
+ remmina_plugin_python_create_tool_plugin(pluginInstance);
+ } else if (g_str_equal(pluginType, "pref")) {
+ remmina_plugin_python_create_pref_plugin(pluginInstance);
+ } else if (g_str_equal(pluginType, "secret")) {
+ remmina_plugin_python_create_secret_plugin(pluginInstance);
+ } else {
+ g_printerr("Unknown plugin type: %s\n", pluginType);
+ }
+
+ if (remmina_plugin) {
+ g_ptr_array_add(remmina_plugin_registry, pluginInstance);
+ remmina_plugin_manager_service.register_plugin((RemminaPlugin *)remmina_plugin);
+
+ PyPlugin* plugin = (PyPlugin*)malloc(sizeof(PyPlugin));
+ plugin->protocolPlugin = remmina_plugin;
+ plugin->pythonInstance = pluginInstance;
+ plugin->gp = malloc(sizeof(PyRemminaProtocolWidget));
+ plugin->gp->gp = NULL;
+ plugin->gp->viewport = NULL;
+ g_ptr_array_add(remmina_plugin_registry, plugin);
+ }
+ }
+
return Py_None;
}
diff --git a/src/remmina_plugin_python_remmina.h b/src/remmina_plugin_python_remmina.h
index ed5e1010a..d73917ccf 100644
--- a/src/remmina_plugin_python_remmina.h
+++ b/src/remmina_plugin_python_remmina.h
@@ -36,736 +36,51 @@
#pragma once
-#include <Python.h>
+typedef struct {
+ PyObject_HEAD
+ GtkWidget* viewport;
+} PyViewport;
/**
- * @brief Wraps the log_printf function of RemminaPluginService.
+ * @brief The Python abstraction of the protocol widget struct.
*
- * @details This function is only called by the Python engine! There is only one argument
- * since Python offers an inline string formatting which renders any formatting capabilities
- * redundant.
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param msg The message to print.
- */
-static PyObject* remmina_plugin_python_log_printf_wrapper(PyObject* self, PyObject* msg);
-
-/**
- * @brief Accepts an instance of a Python class representing a Remmina plugin.
- *
- * @details This function is only called by the Python engine!
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin An instance of a Python plugin class.
- */
-static PyObject* remmina_plugin_python_register_plugin(PyObject* self, PyObject* plugin);
-
-/**
- * @brief Retrieves the viewport of the current connection window if available.
- *
- * @details This function is only called by the Python engine!
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_plugin_python_get_viewport(PyObject* self, PyObject* handle);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_plugin_manager_register_plugin_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_width_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_set_width_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_height_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_set_height_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_current_scale_mode_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_expand_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_set_expand_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_has_error_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_set_error_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_is_closed_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_file_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_emit_signal_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_register_hostkey_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_start_direct_tunnel_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_start_reverse_tunnel_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_start_xport_tunnel_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_set_display_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_signal_connection_closed_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_signal_connection_opened_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_update_align_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_unlock_dynres_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_desktop_resize_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_auth_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_new_certificate_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_changed_certificate_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_username_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_password_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_domain_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_savepassword_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_authx509_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_cacert_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_cacrl_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_clientcert_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_clientkey_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_save_cred_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_show_listen_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_show_retry_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_show_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_panel_hide_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_ssh_exec_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_chat_open_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_chat_close_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_chat_receive_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_send_keys_signals_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
+ * @details This struct is responsible to provide the same accessibility to the protocol widget for Python as for
+ * native plugins.
*/
-static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin);
+typedef struct {
+ PyObject_HEAD
+ RemminaProtocolWidget* gp;
+ PyViewport* viewport;
+} PyRemminaProtocolWidget;
/**
- * @brief
+ * @brief Maps an instance of a Python plugin to a Remmina one.
*
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_file_get_filename_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
+ * @details This is used to map a Python plugin instance to the Remmina plugin one. Also instance specific data as the
+ * protocol widget are stored in this struct.
*/
-static PyObject* remmina_file_set_string_wrapper(PyObject* self, PyObject* plugin);
+typedef struct {
+ PyObject *pythonInstance;
+
+ RemminaProtocolPlugin *protocolPlugin;
+ RemminaFilePlugin* filePlugin;
+ RemminaSecretPlugin* secretPlugin;
+ RemminaToolPlugin* toolPlugin;
+ RemminaEntryPlugin* entryPlugin;
+ RemminaPrefPlugin* prefPlugin;
+
+ PyRemminaProtocolWidget *gp;
+} PyPlugin;
/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
+ * @brief Initializes the 'remmina' module in the Python engine.
*/
-static PyObject* remmina_file_get_string_wrapper(PyObject* self, PyObject* plugin);
+void remmina_plugin_python_module_init(void);
/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_file_get_secret_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_file_set_int_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_file_get_int_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_file_unsave_passwords_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_log_print_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_log_printf_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
- *
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
- */
-static PyObject* remmina_protocol_widget_get_profile_remote_heigh_wrapper(PyObject* self, PyObject* plugin);
-
-/**
- * @brief
- *
- * @details
+ * @brief Returns a pointer to the Python instance, mapped to the RemminaProtocolWidget or null if not found.
*
- * @param self Is always NULL since it is a static function of the 'remmina' module
- * @param plugin The handle to retrieve the RemminaConnectionWidget
+ * @details Remmina expects this callback function to be part of one plugin, which is the reason no instance information is explicitly passed. To bridge
+ * that, this function can be used to retrieve the very plugin instance owning the given RemminaProtocolWidget.
*/
-static PyObject* remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* plugin);
+PyPlugin* remmina_plugin_python_module_get_plugin(RemminaProtocolWidget* gp);