From 0b0972ffe5d8aae1c273510add8d83c9d0879ecb Mon Sep 17 00:00:00 2001 From: Antenore Gatta Date: Wed, 26 Apr 2023 11:37:24 +0000 Subject: Automatic doc build by remmina-ci --- public/python__wrapper__protocol_8c_source.html | 4 ++-- public/python__wrapper__remmina_8c.html | 22 +++++++++++----------- public/python__wrapper__remmina_8c_source.html | 24 ++++++++++++------------ public/python__wrapper__remmina_8h.html | 4 ++-- public/python__wrapper__remmina_8h_source.html | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/public/python__wrapper__protocol_8c_source.html b/public/python__wrapper__protocol_8c_source.html index 9d434292a..25e01e887 100644 --- a/public/python__wrapper__protocol_8c_source.html +++ b/public/python__wrapper__protocol_8c_source.html @@ -95,7 +95,7 @@ $(document).ready(function(){initNavTree('python__wrapper__protocol_8c_source.ht
void remmina_protocol_init_wrapper(RemminaProtocolWidget *gp)
Wrapper for a Python object that contains a pointer to an instance of RemminaProtocolFeature.
-
void python_wrapper_to_protocol_setting(RemminaProtocolSetting *dest, PyObject *setting)
Converts the PyObject to RemminaProtocolSetting.
+
void python_wrapper_to_protocol_setting(RemminaProtocolSetting *dest, PyObject *setting)
Converts the PyObject to RemminaProtocolSetting.
Maps an instance of a Python plugin to a Remmina one.
gboolean python_wrapper_check_attribute(PyObject *instance, const char *attr_name)
Checks if a given attribute exists.
RemminaProtocolSSHSetting ssh_setting
Definition: plugin.h:76
@@ -158,7 +158,7 @@ $(document).ready(function(){initNavTree('python__wrapper__protocol_8c_source.ht
RemminaTypeHint type_hint
RemminaTypeHint opt2_type_hint
Definition: types.h:79
gpointer opt1
Definition: types.h:75
-
void python_wrapper_to_protocol_feature(RemminaProtocolFeature *dest, PyObject *feature)
Converts the PyObject to RemminaProtocolFeature.
+
void python_wrapper_to_protocol_feature(RemminaProtocolFeature *dest, PyObject *feature)
Converts the PyObject to RemminaProtocolFeature.
gboolean remmina_protocol_unmap_event_wrapper(RemminaProtocolWidget *gp)
gboolean(* map_event)(RemminaProtocolWidget *gp)
Definition: plugin.h:86
gboolean(* query_feature)(RemminaProtocolWidget *gp, const RemminaProtocolFeature *feature)
Definition: plugin.h:82
diff --git a/public/python__wrapper__remmina_8c.html b/public/python__wrapper__remmina_8c.html index 4a630266a..0a9179b5e 100644 --- a/public/python__wrapper__remmina_8c.html +++ b/public/python__wrapper__remmina_8c.html @@ -828,7 +828,7 @@ Variables
-

Definition at line 1142 of file python_wrapper_remmina.c.

+

Definition at line 1143 of file python_wrapper_remmina.c.

@@ -999,7 +999,7 @@ Variables
-

Definition at line 1123 of file python_wrapper_remmina.c.

+

Definition at line 1124 of file python_wrapper_remmina.c.

@@ -1038,7 +1038,7 @@ Variables -

Definition at line 1107 of file python_wrapper_remmina.c.

+

Definition at line 1108 of file python_wrapper_remmina.c.

@@ -1077,7 +1077,7 @@ Variables -

Definition at line 1091 of file python_wrapper_remmina.c.

+

Definition at line 1092 of file python_wrapper_remmina.c.

@@ -1241,7 +1241,7 @@ Variables
-

Definition at line 1052 of file python_wrapper_remmina.c.

+

Definition at line 1053 of file python_wrapper_remmina.c.

@@ -1279,7 +1279,7 @@ Variables
-

Definition at line 1045 of file python_wrapper_remmina.c.

+

Definition at line 1046 of file python_wrapper_remmina.c.

@@ -1607,7 +1607,7 @@ Variables
-

Definition at line 1171 of file python_wrapper_remmina.c.

+

Definition at line 1172 of file python_wrapper_remmina.c.

@@ -1645,7 +1645,7 @@ Variables
-

Definition at line 1156 of file python_wrapper_remmina.c.

+

Definition at line 1157 of file python_wrapper_remmina.c.

@@ -1683,7 +1683,7 @@ Variables
-

Definition at line 1207 of file python_wrapper_remmina.c.

+

Definition at line 1208 of file python_wrapper_remmina.c.

@@ -1727,7 +1727,7 @@ Variables
-

Definition at line 1060 of file python_wrapper_remmina.c.

+

Definition at line 1061 of file python_wrapper_remmina.c.

@@ -1771,7 +1771,7 @@ Variables
-

Definition at line 1076 of file python_wrapper_remmina.c.

+

Definition at line 1077 of file python_wrapper_remmina.c.

diff --git a/public/python__wrapper__remmina_8c_source.html b/public/python__wrapper__remmina_8c_source.html index f67c8d9a9..49c17050b 100644 --- a/public/python__wrapper__remmina_8c_source.html +++ b/public/python__wrapper__remmina_8c_source.html @@ -86,7 +86,7 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
python_wrapper_remmina.c
-Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2016-2023 Antenore Gatta, Giovanni Panozzo
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * In addition, as a special exception, the copyright holders give
21  * permission to link the code of portions of this program with the
22  * OpenSSL library under certain conditions as described in each
23  * individual source file, and distribute linked combinations
24  * including the two.
25  * You must obey the GNU General Public License in all respects
26  * for all of the code used other than OpenSSL. * If you modify
27  * file(s) with this exception, you may extend this exception to your
28  * version of the file(s), but you are not obligated to do so. * If you
29  * do not wish to do so, delete this exception statement from your
30  * version. * If you delete this exception statement from all source
31  * files in the program, then also delete it here.
32  */
33 
35 // I N C L U D E S
37 
38 #include "python_wrapper_common.h"
39 #include "remmina/plugin.h"
40 #include "remmina/types.h"
41 
42 #include "python_wrapper_remmina.h"
44 
45 #include "python_wrapper_entry.h"
46 #include "python_wrapper_file.h"
48 #include "python_wrapper_tool.h"
49 #include "python_wrapper_secret.h"
50 #include "python_wrapper_pref.h"
51 
53 
54 #include <string.h>
55 
57 // D E C L A R A T I O N S
59 
60 
64 gboolean python_wrapper_check_mandatory_member(PyObject* instance, const gchar* member);
65 
66 static PyObject* python_wrapper_debug_wrapper(PyObject* self, PyObject* msg);
67 static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin);
68 static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin);
69 static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
70 static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
71 static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
72 static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin);
73 static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin);
74 static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin);
75 static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin);
76 static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
77 static PyObject* python_wrapper_log_print_wrapper(PyObject* self, PyObject* arg);
78 static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
79 static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
80 static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
81 static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin);
82 static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin);
83 static PyObject*
84 remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
85 static PyObject*
86 remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
87 static PyObject* python_wrapper_show_dialog_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
88 static PyObject* python_wrapper_get_mainwindow_wrapper(PyObject* self, PyObject* args);
89 static PyObject* remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject* self, PyObject* args);
90 static PyObject* remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject* self, PyObject* args);
91 static PyObject* remmina_protocol_plugin_init_auth_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
92 
97 static PyMethodDef remmina_python_module_type_methods[] = {
102  { "register_plugin", remmina_register_plugin_wrapper, METH_O, NULL },
103 
107  { "log_print", python_wrapper_log_print_wrapper, METH_VARARGS, NULL },
108 
112  { "debug", python_wrapper_debug_wrapper, METH_VARARGS, NULL },
113 
117  { "show_dialog", (PyCFunction)python_wrapper_show_dialog_wrapper, METH_VARARGS | METH_KEYWORDS,
118  NULL },
119 
123  { "get_main_window", python_wrapper_get_mainwindow_wrapper, METH_NOARGS, NULL },
124 
128  { "get_datadir", remmina_file_get_datadir_wrapper, METH_VARARGS, NULL },
129 
133  { "file_new", (PyCFunction)remmina_file_new_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
134 
138  { "pref_set_value", (PyCFunction)remmina_pref_set_value_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
139 
143  { "pref_get_value", (PyCFunction)remmina_pref_get_value_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
144 
148  { "pref_get_scale_quality", remmina_pref_get_scale_quality_wrapper, METH_VARARGS, NULL },
149 
153  { "pref_get_sshtunnel_port", remmina_pref_get_sshtunnel_port_wrapper, METH_VARARGS, NULL },
154 
158  { "pref_get_ssh_loglevel", remmina_pref_get_ssh_loglevel_wrapper, METH_VARARGS, NULL },
159 
163  { "pref_get_ssh_parseconfig", remmina_pref_get_ssh_parseconfig_wrapper, METH_VARARGS, NULL },
164 
168  { "pref_keymap_get_keyval", (PyCFunction)remmina_pref_keymap_get_keyval_wrapper, METH_VARARGS | METH_KEYWORDS,
169  NULL },
170 
174  { "widget_pool_register", (PyCFunction)remmina_widget_pool_register_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
175 
179  { "rcw_open_from_file_full", (PyCFunction)rcw_open_from_file_full_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
180 
184  { "public_get_server_port", (PyCFunction)remmina_public_get_server_port_wrapper, METH_VARARGS | METH_KEYWORDS,
185  NULL },
186 
190  { "masterthread_exec_is_main_thread", remmina_masterthread_exec_is_main_thread_wrapper, METH_VARARGS, NULL },
191 
195  { "gtksocket_available", remmina_gtksocket_available_wrapper, METH_VARARGS, NULL },
196 
200  { "protocol_widget_get_profile_remote_width",
201  (PyCFunction)remmina_protocol_widget_get_profile_remote_width_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
202 
206  { "protocol_widget_get_profile_remote_height",
207  (PyCFunction)remmina_protocol_widget_get_profile_remote_height_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
208  { "protocol_plugin_signal_connection_opened", (PyCFunction)remmina_protocol_plugin_signal_connection_opened_wrapper,
209  METH_VARARGS, NULL },
210 
211  { "protocol_plugin_signal_connection_closed", (PyCFunction)remmina_protocol_plugin_signal_connection_closed_wrapper,
212  METH_VARARGS, NULL },
213 
214  { "protocol_plugin_init_auth", (PyCFunction)remmina_protocol_plugin_init_auth_wrapper, METH_VARARGS | METH_KEYWORDS,
215  NULL },
216 
217  /* Sentinel */
218  { NULL }
219 };
220 
224 typedef struct
225 {
226  PyObject_HEAD
228  gchar* name;
229  gchar* label;
230  gboolean compact;
231  PyObject* opt1;
232  PyObject* opt2;
234 
238 static PyModuleDef remmina_python_module_type = {
239  PyModuleDef_HEAD_INIT,
240  .m_name = "remmina",
241  .m_doc = "Remmina API.",
242  .m_size = -1,
244 };
245 
246 // -- Python Object -> Setting
247 
252 static PyObject* python_protocol_setting_new(PyTypeObject* type, PyObject* args, PyObject* kwargs)
253 {
254  TRACE_CALL(__func__);
255 
256  PyRemminaProtocolSetting* self = (PyRemminaProtocolSetting*)type->tp_alloc(type, 0);
257 
258  if (!self)
259  {
260  return NULL;
261  }
262 
263  self->name = "";
264  self->label = "";
265  self->compact = FALSE;
266  self->opt1 = NULL;
267  self->opt2 = NULL;
268  self->settingType = 0;
269 
270  return (PyObject*)self;
271 }
272 
277 static int python_protocol_setting_init(PyRemminaProtocolSetting* self, PyObject* args, PyObject* kwargs)
278 {
279  TRACE_CALL(__func__);
280 
281  static gchar* kwlist[] = { "type", "name", "label", "compact", "opt1", "opt2", NULL };
282  PyObject* name;
283  PyObject* label;
284 
285  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|lOOpOO", kwlist,
286  &self->settingType, &name, &label, &self->compact, &self->opt1, &self->opt2))
287  {
288  return -1;
289  }
290 
291  Py_ssize_t len = PyUnicode_GetLength(label);
292  if (len == 0)
293  {
294  self->label = "";
295  }
296  else
297  {
298  self->label = python_wrapper_copy_string_from_python(label, len);
299  if (!self->label)
300  {
301  g_printerr("Unable to extract label during initialization of Python settings module!\n");
303  }
304  }
305 
306  len = PyUnicode_GetLength(name);
307  if (len == 0)
308  {
309  self->name = "";
310  }
311  else
312  {
313  self->name = python_wrapper_copy_string_from_python(label, len);
314  if (!self->name)
315  {
316  g_printerr("Unable to extract name during initialization of Python settings module!\n");
318  }
319  }
320 
321  return 0;
322 }
323 
324 static PyMemberDef python_protocol_setting_type_members[] = {
325  { "settingType", offsetof(PyRemminaProtocolSetting, settingType), T_INT, 0, NULL },
326  { "name", offsetof(PyRemminaProtocolSetting, name), T_STRING, 0, NULL },
327  { "label", offsetof(PyRemminaProtocolSetting, label), T_STRING, 0, NULL },
328  { "compact", offsetof(PyRemminaProtocolSetting, compact), T_BOOL, 0, NULL },
329  { "opt1", offsetof(PyRemminaProtocolSetting, opt1), T_OBJECT, 0, NULL },
330  { "opt2", offsetof(PyRemminaProtocolSetting, opt2), T_OBJECT, 0, NULL },
331  { NULL }
332 };
333 
334 static PyTypeObject python_protocol_setting_type = {
335  PyVarObject_HEAD_INIT(NULL, 0)
336  .tp_name = "remmina.Setting",
337  .tp_doc = "Remmina Setting information",
338  .tp_basicsize = sizeof(PyRemminaProtocolSetting),
339  .tp_itemsize = 0,
340  .tp_flags = Py_TPFLAGS_DEFAULT,
341  .tp_new = python_protocol_setting_new,
342  .tp_init = (initproc)python_protocol_setting_init,
344 };
345 
346 // -- Python Type -> Feature
347 
348 
349 static PyMemberDef python_protocol_feature_members[] = {
350  { "type", T_INT, offsetof(PyRemminaProtocolFeature, type), 0, NULL },
351  { "id", T_INT, offsetof(PyRemminaProtocolFeature, id), 0, NULL },
352  { "opt1", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt1), 0, NULL },
353  { "opt2", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt2), 0, NULL },
354  { "opt3", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt3), 0, NULL },
355  { NULL }
356 };
357 
358 PyObject* python_protocol_feature_new(PyTypeObject* type, PyObject* kws, PyObject* args)
359 {
360  TRACE_CALL(__func__);
361 
363  self = (PyRemminaProtocolFeature*)type->tp_alloc(type, 0);
364  if (!self)
365  return NULL;
366 
367  self->id = 0;
368  self->type = 0;
369  self->opt1 = (PyGeneric*)Py_None;
370  self->opt1->raw = NULL;
371  self->opt1->type_hint = REMMINA_TYPEHINT_UNDEFINED;
372  self->opt2 = (PyGeneric*)Py_None;
373  self->opt2->raw = NULL;
374  self->opt2->type_hint = REMMINA_TYPEHINT_UNDEFINED;
375  self->opt3 = (PyGeneric*)Py_None;
376  self->opt3->raw = NULL;
377  self->opt3->type_hint = REMMINA_TYPEHINT_UNDEFINED;
378 
379  return (PyObject*)self;
380 }
381 
382 static int python_protocol_feature_init(PyRemminaProtocolFeature* self, PyObject* args, PyObject* kwargs)
383 {
384  TRACE_CALL(__func__);
385 
386  static char* kwlist[] = { "type", "id", "opt1", "opt2", "opt3", NULL };
387 
388  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|llOOO", kwlist, &self->type, &self->id, &self->opt1, &self
389  ->opt2, &self->opt3))
390  return -1;
391 
392  return 0;
393 }
394 
395 static PyTypeObject python_protocol_feature_type = {
396  PyVarObject_HEAD_INIT(NULL, 0)
397  .tp_name = "remmina.ProtocolFeature",
398  .tp_doc = "Remmina Setting information",
399  .tp_basicsize = sizeof(PyRemminaProtocolFeature),
400  .tp_itemsize = 0,
401  .tp_flags = Py_TPFLAGS_DEFAULT,
402  .tp_new = python_protocol_feature_new,
403  .tp_init = (initproc)python_protocol_feature_init,
404  .tp_members = python_protocol_feature_members
405 };
406 
408 {
410  feature->id = 0;
411  feature->opt1 = python_wrapper_generic_new();
412  feature->opt1->raw = NULL;
414  feature->opt2 = python_wrapper_generic_new();
415  feature->opt2->raw = NULL;
417  feature->opt3 = python_wrapper_generic_new();
418  feature->opt3->raw = NULL;
420  feature->type = 0;
421  Py_IncRef((PyObject*)feature);
422  return feature;
423 }
424 
425 
426 // -- Python Type -> Screenshot Data
427 
428 static PyMemberDef python_screenshot_data_members[] = {
429  { "buffer", T_OBJECT, offsetof(PyRemminaPluginScreenshotData, buffer), 0, NULL },
430  { "width", T_INT, offsetof(PyRemminaPluginScreenshotData, width), 0, NULL },
431  { "height", T_INT, offsetof(PyRemminaPluginScreenshotData, height), 0, NULL },
432  { "bitsPerPixel", T_INT, offsetof(PyRemminaPluginScreenshotData, bitsPerPixel), 0, NULL },
433  { "bytesPerPixel", T_INT, offsetof(PyRemminaPluginScreenshotData, bytesPerPixel), 0, NULL },
434  { NULL }
435 };
436 
437 PyObject* python_screenshot_data_new(PyTypeObject* type, PyObject* kws, PyObject* args)
438 {
439  TRACE_CALL(__func__);
440 
442  self = (PyRemminaPluginScreenshotData*)type->tp_alloc(type, 0);
443  if (!self)
444  return NULL;
445 
446  self->buffer = (PyByteArrayObject*)PyObject_New(PyByteArrayObject, &PyByteArray_Type);
447  self->height = 0;
448  self->width = 0;
449  self->bitsPerPixel = 0;
450  self->bytesPerPixel = 0;
451 
452  return (PyObject*)self;
453 }
454 
455 static int python_screenshot_data_init(PyRemminaPluginScreenshotData* self, PyObject* args, PyObject* kwargs)
456 {
457  TRACE_CALL(__func__);
458 
459  g_printerr("Not to be initialized within Python!");
460  return -1;
461 }
462 
463 static PyTypeObject python_screenshot_data_type = {
464  PyVarObject_HEAD_INIT(NULL, 0)
465  .tp_name = "remmina.RemminaScreenshotData",
466  .tp_doc = "Remmina Screenshot Data",
467  .tp_basicsize = sizeof(PyRemminaPluginScreenshotData),
468  .tp_itemsize = 0,
469  .tp_flags = Py_TPFLAGS_DEFAULT,
470  .tp_new = python_screenshot_data_new,
471  .tp_init = (initproc)python_screenshot_data_init,
472  .tp_members = python_screenshot_data_members
473 };
475 {
477  data->buffer = PyObject_New(PyByteArrayObject, &PyByteArray_Type);
478  Py_IncRef((PyObject*)data->buffer);
479  data->height = 0;
480  data->width = 0;
481  data->bitsPerPixel = 0;
482  data->bytesPerPixel = 0;
483  return data;
484 }
485 
486 static PyObject* python_wrapper_generic_to_int(PyGeneric* self, PyObject* args);
487 static PyObject* python_wrapper_generic_to_bool(PyGeneric* self, PyObject* args);
488 static PyObject* python_wrapper_generic_to_string(PyGeneric* self, PyObject* args);
489 
490 static void python_wrapper_generic_dealloc(PyObject* self)
491 {
492  PyObject_Del(self);
493 }
494 
495 static PyMethodDef python_wrapper_generic_methods[] = {
496  { "to_int", (PyCFunction)python_wrapper_generic_to_int, METH_NOARGS, "" },
497  { "to_bool", (PyCFunction)python_wrapper_generic_to_bool, METH_NOARGS, "" },
498  { "to_string", (PyCFunction)python_wrapper_generic_to_string, METH_NOARGS, "" },
499  { NULL }
500 };
501 
502 static PyMemberDef python_wrapper_generic_members[] = {
503  { "raw", T_OBJECT, offsetof(PyGeneric, raw), 0, "" },
504  { NULL }
505 };
506 
507 PyObject* python_wrapper_generic_type_new(PyTypeObject* type, PyObject* kws, PyObject* args)
508 {
509  TRACE_CALL(__func__);
510 
511  PyGeneric* self;
512  self = (PyGeneric*)type->tp_alloc(type, 0);
513  if (!self)
514  return NULL;
515 
516  self->raw = Py_None;
517 
518  return (PyObject*)self;
519 }
520 
521 static int python_wrapper_generic_init(PyGeneric* self, PyObject* args, PyObject* kwargs)
522 {
523  TRACE_CALL(__func__);
524 
525  static char* kwlist[] = { "raw", NULL };
526 
527  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", kwlist, &self->raw))
528  return -1;
529 
530  return 0;
531 }
532 
533 static PyTypeObject python_generic_type = {
534  PyVarObject_HEAD_INIT(NULL, 0)
535  .tp_name = "remmina.Generic",
536  .tp_doc = "",
537  .tp_basicsize = sizeof(PyGeneric),
538  .tp_itemsize = 0,
539  .tp_dealloc = python_wrapper_generic_dealloc,
540  .tp_flags = Py_TPFLAGS_DEFAULT,
542  .tp_init = (initproc)python_wrapper_generic_init,
543  .tp_members = python_wrapper_generic_members,
544  .tp_methods = python_wrapper_generic_methods,
545 };
546 
548 {
549  PyGeneric* generic = (PyGeneric*)PyObject_New(PyGeneric, &python_generic_type);
550  generic->raw = PyLong_FromLongLong(0LL);
551  Py_IncRef((PyObject*)generic);
552  return generic;
553 }
554 
555 static PyObject* python_wrapper_generic_to_int(PyGeneric* self, PyObject* args)
556 {
557  SELF_CHECK();
558 
559  if (self->raw == NULL)
560  {
561  return Py_None;
562  }
563  else if (self->type_hint == REMMINA_TYPEHINT_SIGNED)
564  {
565  return PyLong_FromLongLong((long long)self->raw);
566  }
567  else if (self->type_hint == REMMINA_TYPEHINT_UNSIGNED)
568  {
569  return PyLong_FromUnsignedLongLong((unsigned long long)self->raw);
570  }
571 
572  return Py_None;
573 }
574 static PyObject* python_wrapper_generic_to_bool(PyGeneric* self, PyObject* args)
575 {
576  SELF_CHECK();
577 
578  if (self->raw == NULL)
579  {
580  return Py_None;
581  }
582  else if (self->type_hint == REMMINA_TYPEHINT_BOOLEAN)
583  {
584  return PyBool_FromLong((long)self->raw);
585  }
586 
587  return Py_None;
588 }
589 static PyObject* python_wrapper_generic_to_string(PyGeneric* self, PyObject* args)
590 {
591  SELF_CHECK();
592 
593  if (self->raw == NULL)
594  {
595  return Py_None;
596  }
597  else if (self->type_hint == REMMINA_TYPEHINT_STRING)
598  {
599  return PyUnicode_FromString((const char*)self->raw);
600  }
601 
602  return Py_None;
603 }
604 
610 {
611  TRACE_CALL(__func__);
612 
613  if (PyType_Ready(&python_screenshot_data_type) < 0)
614  {
615  PyErr_Print();
616  return NULL;
617  }
618 
619  if (PyType_Ready(&python_generic_type) < 0)
620  {
621  PyErr_Print();
622  return NULL;
623  }
624 
625  if (PyType_Ready(&python_protocol_setting_type) < 0)
626  {
627  PyErr_Print();
628  return NULL;
629  }
630 
631  if (PyType_Ready(&python_protocol_feature_type) < 0)
632  {
633  PyErr_Print();
634  return NULL;
635  }
636 
639 
640  PyObject* module = PyModule_Create(&remmina_python_module_type);
641  if (!module)
642  {
643  PyErr_Print();
644  return NULL;
645  }
646 
647  PyModule_AddIntConstant(module, "BUTTONS_CLOSE", (long)GTK_BUTTONS_CLOSE);
648  PyModule_AddIntConstant(module, "BUTTONS_NONE", (long)GTK_BUTTONS_NONE);
649  PyModule_AddIntConstant(module, "BUTTONS_OK", (long)GTK_BUTTONS_OK);
650  PyModule_AddIntConstant(module, "BUTTONS_CLOSE", (long)GTK_BUTTONS_CLOSE);
651  PyModule_AddIntConstant(module, "BUTTONS_CANCEL", (long)GTK_BUTTONS_CANCEL);
652  PyModule_AddIntConstant(module, "BUTTONS_YES_NO", (long)GTK_BUTTONS_YES_NO);
653  PyModule_AddIntConstant(module, "BUTTONS_OK_CANCEL", (long)GTK_BUTTONS_OK_CANCEL);
654 
655  PyModule_AddIntConstant(module, "MESSAGE_INFO", (long)GTK_MESSAGE_INFO);
656  PyModule_AddIntConstant(module, "MESSAGE_WARNING", (long)GTK_MESSAGE_WARNING);
657  PyModule_AddIntConstant(module, "MESSAGE_QUESTION", (long)GTK_MESSAGE_QUESTION);
658  PyModule_AddIntConstant(module, "MESSAGE_ERROR", (long)GTK_MESSAGE_ERROR);
659  PyModule_AddIntConstant(module, "MESSAGE_OTHER", (long)GTK_MESSAGE_OTHER);
660 
661  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_SERVER", (long)REMMINA_PROTOCOL_SETTING_TYPE_SERVER);
662  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_PASSWORD", (long)REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD);
663  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_RESOLUTION", (long)REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION);
664  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_KEYMAP", (long)REMMINA_PROTOCOL_SETTING_TYPE_KEYMAP);
665  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_TEXT", (long)REMMINA_PROTOCOL_SETTING_TYPE_TEXT);
666  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_SELECT", (long)REMMINA_PROTOCOL_SETTING_TYPE_SELECT);
667  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_COMBO", (long)REMMINA_PROTOCOL_SETTING_TYPE_COMBO);
668  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_CHECK", (long)REMMINA_PROTOCOL_SETTING_TYPE_CHECK);
669  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_FILE", (long)REMMINA_PROTOCOL_SETTING_TYPE_FILE);
670  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_FOLDER", (long)REMMINA_PROTOCOL_SETTING_TYPE_FOLDER);
671  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_MULTIMON", (long)REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON);
672 
673  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_PREF", (long)REMMINA_PROTOCOL_FEATURE_TYPE_PREF);
674  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_TOOL", (long)REMMINA_PROTOCOL_FEATURE_TYPE_TOOL);
675  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_UNFOCUS", (long)REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS);
676  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_SCALE", (long)REMMINA_PROTOCOL_FEATURE_TYPE_SCALE);
677  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_DYNRESUPDATE", (long)REMMINA_PROTOCOL_FEATURE_TYPE_DYNRESUPDATE);
678  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_GTKSOCKET", (long)REMMINA_PROTOCOL_FEATURE_TYPE_GTKSOCKET);
679 
680  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_NONE", (long)REMMINA_PROTOCOL_SSH_SETTING_NONE);
681  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_TUNNEL", (long)REMMINA_PROTOCOL_SSH_SETTING_TUNNEL);
682  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_SSH", (long)REMMINA_PROTOCOL_SSH_SETTING_SSH);
683  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_REVERSE_TUNNEL", (long)REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL);
684  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_SFTP", (long)REMMINA_PROTOCOL_SSH_SETTING_SFTP);
685 
686  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_PREF_RADIO", (long)REMMINA_PROTOCOL_FEATURE_PREF_RADIO);
687  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_PREF_CHECK", (long)REMMINA_PROTOCOL_FEATURE_PREF_CHECK);
688 
689  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_USERNAME", REMMINA_MESSAGE_PANEL_FLAG_USERNAME);
690  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_USERNAME_READONLY", REMMINA_MESSAGE_PANEL_FLAG_USERNAME_READONLY);
691  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_DOMAIN", REMMINA_MESSAGE_PANEL_FLAG_DOMAIN);
692  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_SAVEPASSWORD", REMMINA_MESSAGE_PANEL_FLAG_SAVEPASSWORD);
693 
694  if (PyModule_AddObject(module, "Setting", (PyObject*)&python_protocol_setting_type) < 0)
695  {
696  Py_DECREF(&python_protocol_setting_type);
697  Py_DECREF(module);
698  PyErr_Print();
699  return NULL;
700  }
701 
702  Py_INCREF(&python_protocol_feature_type);
703  if (PyModule_AddObject(module, "Feature", (PyObject*)&python_protocol_feature_type) < 0)
704  {
705  Py_DECREF(&python_protocol_setting_type);
706  Py_DECREF(&python_protocol_feature_type);
707  Py_DECREF(module);
708  PyErr_Print();
709  return NULL;
710  }
711 
712  return module;
713 }
714 
720 {
721  TRACE_CALL(__func__);
722 
723  if (PyImport_AppendInittab("remmina", python_wrapper_module_initialize))
724  {
725  PyErr_Print();
726  exit(1);
727  }
728 
735 }
736 
737 gboolean python_wrapper_check_mandatory_member(PyObject* instance, const gchar* member)
738 {
739  TRACE_CALL(__func__);
740 
741  if (PyObject_HasAttrString(instance, member))
742  {
743  return TRUE;
744  }
745 
746  g_printerr("Missing mandatory member '%s' in Python plugin instance!\n", member);
747  return FALSE;
748 }
749 
750 static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin_instance)
751 {
752  TRACE_CALL(__func__);
753 
754  if (plugin_instance)
755  {
756  if (!python_wrapper_check_mandatory_member(plugin_instance, "name")
757  || !python_wrapper_check_mandatory_member(plugin_instance, "version"))
758  {
759  return NULL;
760  }
761 
762  /* Protocol plugin definition and features */
763  const gchar* pluginType = PyUnicode_AsUTF8(PyObject_GetAttrString(plugin_instance, "type"));
764 
766 
767  PyPlugin* plugin = (PyPlugin*)python_wrapper_malloc(sizeof(PyPlugin));
768  plugin->instance = plugin_instance;
769  Py_INCREF(plugin_instance);
770  plugin->protocol_plugin = NULL;
771  plugin->entry_plugin = NULL;
772  plugin->file_plugin = NULL;
773  plugin->pref_plugin = NULL;
774  plugin->secret_plugin = NULL;
775  plugin->tool_plugin = NULL;
776  g_print("New Python plugin registered: %ld\n", PyObject_Hash(plugin_instance));
777 
778  if (g_str_equal(pluginType, "protocol"))
779  {
780  remmina_plugin = python_wrapper_create_protocol_plugin(plugin);
781  }
782  else if (g_str_equal(pluginType, "entry"))
783  {
784  remmina_plugin = python_wrapper_create_entry_plugin(plugin);
785  }
786  else if (g_str_equal(pluginType, "file"))
787  {
788  remmina_plugin = python_wrapper_create_file_plugin(plugin);
789  }
790  else if (g_str_equal(pluginType, "tool"))
791  {
792  remmina_plugin = python_wrapper_create_tool_plugin(plugin);
793  }
794  else if (g_str_equal(pluginType, "pref"))
795  {
796  remmina_plugin = python_wrapper_create_pref_plugin(plugin);
797  }
798  else if (g_str_equal(pluginType, "secret"))
799  {
800  remmina_plugin = python_wrapper_create_secret_plugin(plugin);
801  }
802  else
803  {
804  g_printerr("Unknown plugin type: %s\n", pluginType);
805  }
806 
807  if (remmina_plugin)
808  {
809  if (remmina_plugin->type == REMMINA_PLUGIN_TYPE_PROTOCOL)
810  {
812  }
813 
814  if (python_wrapper_get_service()->register_plugin((RemminaPlugin*)remmina_plugin)) {
815  g_print("%s: Successfully reigstered!\n", remmina_plugin->name);
816  } else {
817  g_print("%s: Failed to reigster!\n", remmina_plugin->name);
818  }
819  }
820  }
821 
822  PyErr_Clear();
823  return Py_None;
824 }
825 
826 static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin)
827 {
828  TRACE_CALL(__func__);
829 
830  PyObject* result = Py_None;
831  const gchar* datadir = python_wrapper_get_service()->file_get_user_datadir();
832 
833  if (datadir)
834  {
835  result = PyUnicode_FromFormat("%s", datadir);
836  }
837 
839  return result;
840 }
841 
842 static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
843 {
844  TRACE_CALL(__func__);
845 
847  if (file)
848  {
849  return (PyObject*)python_wrapper_remmina_file_to_python(file);
850  }
851 
853  return Py_None;
854 }
855 
856 static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
857 {
858  TRACE_CALL(__func__);
859 
860  static char* kwlist[] = { "key", "value", NULL };
861  gchar* key, * value;
862 
863  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss", kwlist, &key, &value))
864  {
865  return Py_None;
866  }
867 
868  if (key)
869  {
871  }
872 
874  return Py_None;
875 }
876 
877 static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
878 {
879  TRACE_CALL(__func__);
880 
881  static char* kwlist[] = { "key", NULL };
882  gchar* key;
883  PyObject* result = Py_None;
884 
885  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &key))
886  {
887  return Py_None;
888  }
889 
890  if (key)
891  {
892  const gchar* value = python_wrapper_get_service()->pref_get_value(key);
893  if (value)
894  {
895  result = PyUnicode_FromFormat("%s", result);
896  }
897  }
898 
900  return result;
901 }
902 
903 static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin)
904 {
905  TRACE_CALL(__func__);
906 
907  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_scale_quality());
909  return result;
910 }
911 
912 static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin)
913 {
914  TRACE_CALL(__func__);
915 
916  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_sshtunnel_port());
918  return result;
919 }
920 
921 static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin)
922 {
923  TRACE_CALL(__func__);
924 
925  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_ssh_loglevel());
927  return result;
928 }
929 
930 static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin)
931 {
932  TRACE_CALL(__func__);
933 
934  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_ssh_parseconfig());
936  return result;
937 }
938 
939 static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
940 {
941  TRACE_CALL(__func__);
942 
943  static char* kwlist[] = { "keymap", "keyval", NULL };
944  gchar* keymap;
945  guint keyval;
946  PyObject* result = Py_None;
947 
948  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sl", kwlist, &keymap, &keyval))
949  {
950  return PyLong_FromLong(-1);
951  }
952 
953  if (keymap)
954  {
955  const guint value = python_wrapper_get_service()->pref_keymap_get_keyval(keymap, keyval);
956  result = PyLong_FromUnsignedLong(value);
957  }
958 
960  return result;
961 }
962 
963 static PyObject* python_wrapper_log_print_wrapper(PyObject* self, PyObject* args)
964 {
965  TRACE_CALL(__func__);
966 
967  gchar* text;
968  if (!PyArg_ParseTuple(args, "s", &text) || !text)
969  {
970  return Py_None;
971  }
972 
974  return Py_None;
975 }
976 
977 static PyObject* python_wrapper_debug_wrapper(PyObject* self, PyObject* args)
978 {
979  TRACE_CALL(__func__);
980 
981  gchar* text;
982  if (!PyArg_ParseTuple(args, "s", &text) || !text)
983  {
984  return Py_None;
985  }
986 
987  python_wrapper_get_service()->_remmina_debug("python", "%s", text);
988  return Py_None;
989 }
990 
991 static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
992 {
993  TRACE_CALL(__func__);
994 
995  static char* kwlist[] = { "widget", NULL };
996  PyObject* widget;
997 
998  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &widget) && widget)
999  {
1001  }
1002 
1003  return Py_None;
1004 }
1005 
1006 static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1007 {
1008  TRACE_CALL(__func__);
1009 
1010  static char* kwlist[] = { "remminafile", "data", "handler", NULL };
1011  PyObject* pyremminafile;
1012  PyObject* data;
1013 
1014  if (PyArg_ParseTupleAndKeywords(args, kwargs, "OOO", kwlist, &pyremminafile, &data) && pyremminafile && data)
1015  {
1016  python_wrapper_get_service()->rcw_open_from_file_full((RemminaFile*)pyremminafile, NULL, (void*)data, NULL);
1017  }
1018 
1019  return Py_None;
1020 }
1021 
1022 static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1023 {
1024  TRACE_CALL(__func__);
1025 
1026  static char* kwlist[] = { "server", "defaultport", "host", "port", NULL };
1027  gchar* server;
1028  gint defaultport;
1029 
1030  if (PyArg_ParseTupleAndKeywords(args, kwargs, "slsl", kwlist, &server, &defaultport) && server)
1031  {
1032  gchar* host;
1033  gint port;
1034  python_wrapper_get_service()->get_server_port(server, defaultport, &host, &port);
1035 
1036  PyObject* result = PyList_New(2);
1037  PyList_Append(result, PyUnicode_FromString(host));
1038  PyList_Append(result, PyLong_FromLong(port));
1039  return PyList_AsTuple(result);
1040  }
1041 
1042  return Py_None;
1043 }
1044 
1045 static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin)
1046 {
1047  TRACE_CALL(__func__);
1048 
1049  return PyBool_FromLong(python_wrapper_get_service()->is_main_thread());
1050 }
1051 
1052 static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin)
1053 {
1054  TRACE_CALL(__func__);
1055 
1056  return PyBool_FromLong(python_wrapper_get_service()->gtksocket_available());
1057 }
1058 
1059 static PyObject*
1060 remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1061 {
1062  TRACE_CALL(__func__);
1063 
1064  static char* kwlist[] = { "widget", NULL };
1065  PyPlugin* plugin;
1066 
1067  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &plugin) && plugin && plugin->gp)
1068  {
1070  }
1071 
1072  return Py_None;
1073 }
1074 
1075 static PyObject*
1076 remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1077 {
1078  TRACE_CALL(__func__);
1079 
1080  static char* kwlist[] = { "widget", NULL };
1081  PyPlugin* plugin;
1082 
1083  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &plugin) && plugin && plugin->gp)
1084  {
1086  }
1087 
1088  return Py_None;
1089 }
1090 
1092 {
1093  TRACE_CALL(__func__);
1094 
1096  Py_INCREF(setting);
1097  dest->name = src->name;
1098  dest->label = src->label;
1099  dest->compact = src->compact;
1100  dest->type = src->settingType;
1101  dest->validator = NULL;
1102  dest->validator_data = NULL;
1103  python_wrapper_to_generic(src->opt1, &dest->opt1);
1104  python_wrapper_to_generic(src->opt2, &dest->opt2);
1105 }
1106 
1108 {
1109  TRACE_CALL(__func__);
1110 
1112  Py_INCREF(feature);
1113  dest->id = src->id;
1114  dest->type = src->type;
1115  dest->opt1 = src->opt1->raw;
1116  dest->opt1_type_hint = src->opt1->type_hint;
1117  dest->opt2 = src->opt2->raw;
1118  dest->opt2_type_hint = src->opt2->type_hint;
1119  dest->opt3 = src->opt3->raw;
1120  dest->opt3_type_hint = src->opt3->type_hint;
1121 }
1122 
1123 PyObject* python_wrapper_show_dialog_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1124 {
1125  TRACE_CALL(__func__);
1126 
1127  static char* kwlist[] = { "type", "buttons", "message", NULL };
1128  GtkMessageType msgType;
1129  GtkButtonsType btnType;
1130  gchar* message;
1131 
1132  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "lls", kwlist, &msgType, &btnType, &message))
1133  {
1134  return PyLong_FromLong(-1);
1135  }
1136 
1137  python_wrapper_get_service()->show_dialog(msgType, btnType, message);
1138 
1139  return Py_None;
1140 }
1141 
1142 PyObject* python_wrapper_get_mainwindow_wrapper(PyObject* self, PyObject* args)
1143 {
1144  TRACE_CALL(__func__);
1145 
1146  GtkWindow* result = python_wrapper_get_service()->get_window();
1147 
1148  if (!result)
1149  {
1150  return Py_None;
1151  }
1152 
1153  return (PyObject*)new_pywidget((GObject*)result);
1154 }
1155 
1156 static PyObject* remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject* self, PyObject* args)
1157 {
1158  TRACE_CALL(__func__);
1159 
1160  PyObject* pygp = NULL;
1161  if (!PyArg_ParseTuple(args, "O", &pygp) || !pygp)
1162  {
1163  g_printerr("Please provide the Remmina protocol widget instance!");
1164  return Py_None;
1165  }
1166 
1168  return Py_None;
1169 }
1170 
1171 static PyObject* remmina_protocol_plugin_init_auth_wrapper(PyObject* module, PyObject* args, PyObject* kwds)
1172 {
1173  TRACE_CALL(__func__);
1174 
1175  static gchar* keyword_list[] = { "widget", "flags", "title", "default_username", "default_password",
1176  "default_domain", "password_prompt" };
1177 
1179  gint pflags = 0;
1180  gchar* title, * default_username, * default_password, * default_domain, * password_prompt;
1181 
1182  if (PyArg_ParseTupleAndKeywords(args, kwds, "Oisssss", keyword_list, &self, &pflags, &title, &default_username,
1183  &default_password, &default_domain, &password_prompt))
1184  {
1185  if (pflags != 0 && !(pflags & REMMINA_MESSAGE_PANEL_FLAG_USERNAME)
1187  && !(pflags & REMMINA_MESSAGE_PANEL_FLAG_DOMAIN)
1189  {
1190  g_printerr("panel_auth(pflags, title, default_username, default_password, default_domain, password_prompt): "
1191  "%d is not a known value for RemminaMessagePanelFlags!\n", pflags);
1192  }
1193  else
1194  {
1195  return Py_BuildValue("i", python_wrapper_get_service()->protocol_widget_panel_auth(self
1196  ->gp, pflags, title, default_username, default_password, default_domain, password_prompt));
1197  }
1198  }
1199  else
1200  {
1201  g_printerr("panel_auth(pflags, title, default_username, default_password, default_domain, password_prompt): Error parsing arguments!\n");
1202  PyErr_Print();
1203  }
1204  return Py_None;
1205 }
1206 
1207 static PyObject* remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject* self, PyObject* args)
1208 {
1209  PyObject* pygp = NULL;
1210  if (!PyArg_ParseTuple(args, "O", &pygp) || !pygp)
1211  {
1212  g_printerr("Please provide the Remmina protocol widget instance!");
1213  return Py_None;
1214  }
1215 
1217  return Py_None;
1218 }
static PyObject * remmina_register_plugin_wrapper(PyObject *self, PyObject *plugin)
+Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2016-2023 Antenore Gatta, Giovanni Panozzo
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * In addition, as a special exception, the copyright holders give
21  * permission to link the code of portions of this program with the
22  * OpenSSL library under certain conditions as described in each
23  * individual source file, and distribute linked combinations
24  * including the two.
25  * You must obey the GNU General Public License in all respects
26  * for all of the code used other than OpenSSL. * If you modify
27  * file(s) with this exception, you may extend this exception to your
28  * version of the file(s), but you are not obligated to do so. * If you
29  * do not wish to do so, delete this exception statement from your
30  * version. * If you delete this exception statement from all source
31  * files in the program, then also delete it here.
32  */
33 
35 // I N C L U D E S
37 
38 #include "python_wrapper_common.h"
39 #include "remmina/plugin.h"
40 #include "remmina/types.h"
41 
42 #include "python_wrapper_remmina.h"
44 
45 #include "python_wrapper_entry.h"
46 #include "python_wrapper_file.h"
48 #include "python_wrapper_tool.h"
49 #include "python_wrapper_secret.h"
50 #include "python_wrapper_pref.h"
51 
53 
54 #include <string.h>
55 
57 // D E C L A R A T I O N S
59 
60 
64 gboolean python_wrapper_check_mandatory_member(PyObject* instance, const gchar* member);
65 
66 static PyObject* python_wrapper_debug_wrapper(PyObject* self, PyObject* msg);
67 static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin);
68 static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin);
69 static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
70 static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
71 static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
72 static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin);
73 static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin);
74 static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin);
75 static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin);
76 static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
77 static PyObject* python_wrapper_log_print_wrapper(PyObject* self, PyObject* arg);
78 static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
79 static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
80 static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
81 static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin);
82 static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin);
83 static PyObject*
84 remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
85 static PyObject*
86 remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
87 static PyObject* python_wrapper_show_dialog_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
88 static PyObject* python_wrapper_get_mainwindow_wrapper(PyObject* self, PyObject* args);
89 static PyObject* remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject* self, PyObject* args);
90 static PyObject* remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject* self, PyObject* args);
91 static PyObject* remmina_protocol_plugin_init_auth_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
92 
97 static PyMethodDef remmina_python_module_type_methods[] = {
102  { "register_plugin", remmina_register_plugin_wrapper, METH_O, NULL },
103 
107  { "log_print", python_wrapper_log_print_wrapper, METH_VARARGS, NULL },
108 
112  { "debug", python_wrapper_debug_wrapper, METH_VARARGS, NULL },
113 
117  { "show_dialog", (PyCFunction)python_wrapper_show_dialog_wrapper, METH_VARARGS | METH_KEYWORDS,
118  NULL },
119 
123  { "get_main_window", python_wrapper_get_mainwindow_wrapper, METH_NOARGS, NULL },
124 
128  { "get_datadir", remmina_file_get_datadir_wrapper, METH_VARARGS, NULL },
129 
133  { "file_new", (PyCFunction)remmina_file_new_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
134 
138  { "pref_set_value", (PyCFunction)remmina_pref_set_value_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
139 
143  { "pref_get_value", (PyCFunction)remmina_pref_get_value_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
144 
148  { "pref_get_scale_quality", remmina_pref_get_scale_quality_wrapper, METH_VARARGS, NULL },
149 
153  { "pref_get_sshtunnel_port", remmina_pref_get_sshtunnel_port_wrapper, METH_VARARGS, NULL },
154 
158  { "pref_get_ssh_loglevel", remmina_pref_get_ssh_loglevel_wrapper, METH_VARARGS, NULL },
159 
163  { "pref_get_ssh_parseconfig", remmina_pref_get_ssh_parseconfig_wrapper, METH_VARARGS, NULL },
164 
168  { "pref_keymap_get_keyval", (PyCFunction)remmina_pref_keymap_get_keyval_wrapper, METH_VARARGS | METH_KEYWORDS,
169  NULL },
170 
174  { "widget_pool_register", (PyCFunction)remmina_widget_pool_register_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
175 
179  { "rcw_open_from_file_full", (PyCFunction)rcw_open_from_file_full_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
180 
184  { "public_get_server_port", (PyCFunction)remmina_public_get_server_port_wrapper, METH_VARARGS | METH_KEYWORDS,
185  NULL },
186 
190  { "masterthread_exec_is_main_thread", remmina_masterthread_exec_is_main_thread_wrapper, METH_VARARGS, NULL },
191 
195  { "gtksocket_available", remmina_gtksocket_available_wrapper, METH_VARARGS, NULL },
196 
200  { "protocol_widget_get_profile_remote_width",
201  (PyCFunction)remmina_protocol_widget_get_profile_remote_width_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
202 
206  { "protocol_widget_get_profile_remote_height",
207  (PyCFunction)remmina_protocol_widget_get_profile_remote_height_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
208  { "protocol_plugin_signal_connection_opened", (PyCFunction)remmina_protocol_plugin_signal_connection_opened_wrapper,
209  METH_VARARGS, NULL },
210 
211  { "protocol_plugin_signal_connection_closed", (PyCFunction)remmina_protocol_plugin_signal_connection_closed_wrapper,
212  METH_VARARGS, NULL },
213 
214  { "protocol_plugin_init_auth", (PyCFunction)remmina_protocol_plugin_init_auth_wrapper, METH_VARARGS | METH_KEYWORDS,
215  NULL },
216 
217  /* Sentinel */
218  { NULL }
219 };
220 
224 typedef struct
225 {
226  PyObject_HEAD
228  gchar* name;
229  gchar* label;
230  gboolean compact;
231  PyObject* opt1;
232  PyObject* opt2;
234 
238 static PyModuleDef remmina_python_module_type = {
239  PyModuleDef_HEAD_INIT,
240  .m_name = "remmina",
241  .m_doc = "Remmina API.",
242  .m_size = -1,
244 };
245 
246 // -- Python Object -> Setting
247 
252 static PyObject* python_protocol_setting_new(PyTypeObject* type, PyObject* args, PyObject* kwargs)
253 {
254  TRACE_CALL(__func__);
255 
256  PyRemminaProtocolSetting* self = (PyRemminaProtocolSetting*)type->tp_alloc(type, 0);
257 
258  if (!self)
259  {
260  return NULL;
261  }
262 
263  self->name = "";
264  self->label = "";
265  self->compact = FALSE;
266  self->opt1 = NULL;
267  self->opt2 = NULL;
268  self->settingType = 0;
269 
270  return (PyObject*)self;
271 }
272 
277 static int python_protocol_setting_init(PyRemminaProtocolSetting* self, PyObject* args, PyObject* kwargs)
278 {
279  TRACE_CALL(__func__);
280 
281  static gchar* kwlist[] = { "type", "name", "label", "compact", "opt1", "opt2", NULL };
282  PyObject* name;
283  PyObject* label;
284 
285  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|lOOpOO", kwlist,
286  &self->settingType, &name, &label, &self->compact, &self->opt1, &self->opt2))
287  {
288  return -1;
289  }
290 
291  Py_ssize_t len = PyUnicode_GetLength(label);
292  if (len == 0)
293  {
294  self->label = "";
295  }
296  else
297  {
298  self->label = python_wrapper_copy_string_from_python(label, len);
299  if (!self->label)
300  {
301  g_printerr("Unable to extract label during initialization of Python settings module!\n");
303  }
304  }
305 
306  len = PyUnicode_GetLength(name);
307  if (len == 0)
308  {
309  self->name = "";
310  }
311  else
312  {
313  self->name = python_wrapper_copy_string_from_python(label, len);
314  if (!self->name)
315  {
316  g_printerr("Unable to extract name during initialization of Python settings module!\n");
318  }
319  }
320 
321  return 0;
322 }
323 
324 static PyMemberDef python_protocol_setting_type_members[] = {
325  { "settingType", offsetof(PyRemminaProtocolSetting, settingType), T_INT, 0, NULL },
326  { "name", offsetof(PyRemminaProtocolSetting, name), T_STRING, 0, NULL },
327  { "label", offsetof(PyRemminaProtocolSetting, label), T_STRING, 0, NULL },
328  { "compact", offsetof(PyRemminaProtocolSetting, compact), T_BOOL, 0, NULL },
329  { "opt1", offsetof(PyRemminaProtocolSetting, opt1), T_OBJECT, 0, NULL },
330  { "opt2", offsetof(PyRemminaProtocolSetting, opt2), T_OBJECT, 0, NULL },
331  { NULL }
332 };
333 
334 static PyTypeObject python_protocol_setting_type = {
335  PyVarObject_HEAD_INIT(NULL, 0)
336  .tp_name = "remmina.Setting",
337  .tp_doc = "Remmina Setting information",
338  .tp_basicsize = sizeof(PyRemminaProtocolSetting),
339  .tp_itemsize = 0,
340  .tp_flags = Py_TPFLAGS_DEFAULT,
341  .tp_new = python_protocol_setting_new,
342  .tp_init = (initproc)python_protocol_setting_init,
344 };
345 
346 // -- Python Type -> Feature
347 
348 
349 static PyMemberDef python_protocol_feature_members[] = {
350  { "type", T_INT, offsetof(PyRemminaProtocolFeature, type), 0, NULL },
351  { "id", T_INT, offsetof(PyRemminaProtocolFeature, id), 0, NULL },
352  { "opt1", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt1), 0, NULL },
353  { "opt2", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt2), 0, NULL },
354  { "opt3", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt3), 0, NULL },
355  { NULL }
356 };
357 
358 PyObject* python_protocol_feature_new(PyTypeObject* type, PyObject* kws, PyObject* args)
359 {
360  TRACE_CALL(__func__);
361 
363  self = (PyRemminaProtocolFeature*)type->tp_alloc(type, 0);
364  if (!self)
365  return NULL;
366 
367  self->id = 0;
368  self->type = 0;
369  self->opt1 = (PyGeneric*)Py_None;
370  self->opt1->raw = NULL;
371  self->opt1->type_hint = REMMINA_TYPEHINT_UNDEFINED;
372  self->opt2 = (PyGeneric*)Py_None;
373  self->opt2->raw = NULL;
374  self->opt2->type_hint = REMMINA_TYPEHINT_UNDEFINED;
375  self->opt3 = (PyGeneric*)Py_None;
376  self->opt3->raw = NULL;
377  self->opt3->type_hint = REMMINA_TYPEHINT_UNDEFINED;
378 
379  return (PyObject*)self;
380 }
381 
382 static int python_protocol_feature_init(PyRemminaProtocolFeature* self, PyObject* args, PyObject* kwargs)
383 {
384  TRACE_CALL(__func__);
385 
386  static char* kwlist[] = { "type", "id", "opt1", "opt2", "opt3", NULL };
387 
388  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|llOOO", kwlist, &self->type, &self->id, &self->opt1, &self
389  ->opt2, &self->opt3))
390  return -1;
391 
392  return 0;
393 }
394 
395 static PyTypeObject python_protocol_feature_type = {
396  PyVarObject_HEAD_INIT(NULL, 0)
397  .tp_name = "remmina.ProtocolFeature",
398  .tp_doc = "Remmina Setting information",
399  .tp_basicsize = sizeof(PyRemminaProtocolFeature),
400  .tp_itemsize = 0,
401  .tp_flags = Py_TPFLAGS_DEFAULT,
402  .tp_new = python_protocol_feature_new,
403  .tp_init = (initproc)python_protocol_feature_init,
404  .tp_members = python_protocol_feature_members
405 };
406 
408 {
410  feature->id = 0;
411  feature->opt1 = python_wrapper_generic_new();
412  feature->opt1->raw = NULL;
414  feature->opt2 = python_wrapper_generic_new();
415  feature->opt2->raw = NULL;
417  feature->opt3 = python_wrapper_generic_new();
418  feature->opt3->raw = NULL;
420  feature->type = 0;
421  Py_IncRef((PyObject*)feature);
422  return feature;
423 }
424 
425 
426 // -- Python Type -> Screenshot Data
427 
428 static PyMemberDef python_screenshot_data_members[] = {
429  { "buffer", T_OBJECT, offsetof(PyRemminaPluginScreenshotData, buffer), 0, NULL },
430  { "width", T_INT, offsetof(PyRemminaPluginScreenshotData, width), 0, NULL },
431  { "height", T_INT, offsetof(PyRemminaPluginScreenshotData, height), 0, NULL },
432  { "bitsPerPixel", T_INT, offsetof(PyRemminaPluginScreenshotData, bitsPerPixel), 0, NULL },
433  { "bytesPerPixel", T_INT, offsetof(PyRemminaPluginScreenshotData, bytesPerPixel), 0, NULL },
434  { NULL }
435 };
436 
437 PyObject* python_screenshot_data_new(PyTypeObject* type, PyObject* kws, PyObject* args)
438 {
439  TRACE_CALL(__func__);
440 
442  self = (PyRemminaPluginScreenshotData*)type->tp_alloc(type, 0);
443  if (!self)
444  return NULL;
445 
446  self->buffer = (PyByteArrayObject*)PyObject_New(PyByteArrayObject, &PyByteArray_Type);
447  self->height = 0;
448  self->width = 0;
449  self->bitsPerPixel = 0;
450  self->bytesPerPixel = 0;
451 
452  return (PyObject*)self;
453 }
454 
455 static int python_screenshot_data_init(PyRemminaPluginScreenshotData* self, PyObject* args, PyObject* kwargs)
456 {
457  TRACE_CALL(__func__);
458 
459  g_printerr("Not to be initialized within Python!");
460  return -1;
461 }
462 
463 static PyTypeObject python_screenshot_data_type = {
464  PyVarObject_HEAD_INIT(NULL, 0)
465  .tp_name = "remmina.RemminaScreenshotData",
466  .tp_doc = "Remmina Screenshot Data",
467  .tp_basicsize = sizeof(PyRemminaPluginScreenshotData),
468  .tp_itemsize = 0,
469  .tp_flags = Py_TPFLAGS_DEFAULT,
470  .tp_new = python_screenshot_data_new,
471  .tp_init = (initproc)python_screenshot_data_init,
472  .tp_members = python_screenshot_data_members
473 };
475 {
477  data->buffer = PyObject_New(PyByteArrayObject, &PyByteArray_Type);
478  Py_IncRef((PyObject*)data->buffer);
479  data->height = 0;
480  data->width = 0;
481  data->bitsPerPixel = 0;
482  data->bytesPerPixel = 0;
483  return data;
484 }
485 
486 static PyObject* python_wrapper_generic_to_int(PyGeneric* self, PyObject* args);
487 static PyObject* python_wrapper_generic_to_bool(PyGeneric* self, PyObject* args);
488 static PyObject* python_wrapper_generic_to_string(PyGeneric* self, PyObject* args);
489 
490 static void python_wrapper_generic_dealloc(PyObject* self)
491 {
492  PyObject_Del(self);
493 }
494 
495 static PyMethodDef python_wrapper_generic_methods[] = {
496  { "to_int", (PyCFunction)python_wrapper_generic_to_int, METH_NOARGS, "" },
497  { "to_bool", (PyCFunction)python_wrapper_generic_to_bool, METH_NOARGS, "" },
498  { "to_string", (PyCFunction)python_wrapper_generic_to_string, METH_NOARGS, "" },
499  { NULL }
500 };
501 
502 static PyMemberDef python_wrapper_generic_members[] = {
503  { "raw", T_OBJECT, offsetof(PyGeneric, raw), 0, "" },
504  { NULL }
505 };
506 
507 PyObject* python_wrapper_generic_type_new(PyTypeObject* type, PyObject* kws, PyObject* args)
508 {
509  TRACE_CALL(__func__);
510 
511  PyGeneric* self;
512  self = (PyGeneric*)type->tp_alloc(type, 0);
513  if (!self)
514  return NULL;
515 
516  self->raw = Py_None;
517 
518  return (PyObject*)self;
519 }
520 
521 static int python_wrapper_generic_init(PyGeneric* self, PyObject* args, PyObject* kwargs)
522 {
523  TRACE_CALL(__func__);
524 
525  static char* kwlist[] = { "raw", NULL };
526 
527  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", kwlist, &self->raw))
528  return -1;
529 
530  return 0;
531 }
532 
533 static PyTypeObject python_generic_type = {
534  PyVarObject_HEAD_INIT(NULL, 0)
535  .tp_name = "remmina.Generic",
536  .tp_doc = "",
537  .tp_basicsize = sizeof(PyGeneric),
538  .tp_itemsize = 0,
539  .tp_dealloc = python_wrapper_generic_dealloc,
540  .tp_flags = Py_TPFLAGS_DEFAULT,
542  .tp_init = (initproc)python_wrapper_generic_init,
543  .tp_members = python_wrapper_generic_members,
544  .tp_methods = python_wrapper_generic_methods,
545 };
546 
548 {
549  PyGeneric* generic = (PyGeneric*)PyObject_New(PyGeneric, &python_generic_type);
550  generic->raw = PyLong_FromLongLong(0LL);
551  Py_IncRef((PyObject*)generic);
552  return generic;
553 }
554 
555 static PyObject* python_wrapper_generic_to_int(PyGeneric* self, PyObject* args)
556 {
557  SELF_CHECK();
558 
559  if (self->raw == NULL)
560  {
561  return Py_None;
562  }
563  else if (self->type_hint == REMMINA_TYPEHINT_SIGNED)
564  {
565  return PyLong_FromLongLong((long long)self->raw);
566  }
567  else if (self->type_hint == REMMINA_TYPEHINT_UNSIGNED)
568  {
569  return PyLong_FromUnsignedLongLong((unsigned long long)self->raw);
570  }
571 
572  return Py_None;
573 }
574 static PyObject* python_wrapper_generic_to_bool(PyGeneric* self, PyObject* args)
575 {
576  SELF_CHECK();
577 
578  if (self->raw == NULL)
579  {
580  return Py_None;
581  }
582  else if (self->type_hint == REMMINA_TYPEHINT_BOOLEAN)
583  {
584  return PyBool_FromLong((long)self->raw);
585  }
586 
587  return Py_None;
588 }
589 static PyObject* python_wrapper_generic_to_string(PyGeneric* self, PyObject* args)
590 {
591  SELF_CHECK();
592 
593  if (self->raw == NULL)
594  {
595  return Py_None;
596  }
597  else if (self->type_hint == REMMINA_TYPEHINT_STRING)
598  {
599  return PyUnicode_FromString((const char*)self->raw);
600  }
601 
602  return Py_None;
603 }
604 
610 {
611  TRACE_CALL(__func__);
612 
613  if (PyType_Ready(&python_screenshot_data_type) < 0)
614  {
615  PyErr_Print();
616  return NULL;
617  }
618 
619  if (PyType_Ready(&python_generic_type) < 0)
620  {
621  PyErr_Print();
622  return NULL;
623  }
624 
625  if (PyType_Ready(&python_protocol_setting_type) < 0)
626  {
627  PyErr_Print();
628  return NULL;
629  }
630 
631  if (PyType_Ready(&python_protocol_feature_type) < 0)
632  {
633  PyErr_Print();
634  return NULL;
635  }
636 
639 
640  PyObject* module = PyModule_Create(&remmina_python_module_type);
641  if (!module)
642  {
643  PyErr_Print();
644  return NULL;
645  }
646 
647  PyModule_AddIntConstant(module, "BUTTONS_CLOSE", (long)GTK_BUTTONS_CLOSE);
648  PyModule_AddIntConstant(module, "BUTTONS_NONE", (long)GTK_BUTTONS_NONE);
649  PyModule_AddIntConstant(module, "BUTTONS_OK", (long)GTK_BUTTONS_OK);
650  PyModule_AddIntConstant(module, "BUTTONS_CLOSE", (long)GTK_BUTTONS_CLOSE);
651  PyModule_AddIntConstant(module, "BUTTONS_CANCEL", (long)GTK_BUTTONS_CANCEL);
652  PyModule_AddIntConstant(module, "BUTTONS_YES_NO", (long)GTK_BUTTONS_YES_NO);
653  PyModule_AddIntConstant(module, "BUTTONS_OK_CANCEL", (long)GTK_BUTTONS_OK_CANCEL);
654 
655  PyModule_AddIntConstant(module, "MESSAGE_INFO", (long)GTK_MESSAGE_INFO);
656  PyModule_AddIntConstant(module, "MESSAGE_WARNING", (long)GTK_MESSAGE_WARNING);
657  PyModule_AddIntConstant(module, "MESSAGE_QUESTION", (long)GTK_MESSAGE_QUESTION);
658  PyModule_AddIntConstant(module, "MESSAGE_ERROR", (long)GTK_MESSAGE_ERROR);
659  PyModule_AddIntConstant(module, "MESSAGE_OTHER", (long)GTK_MESSAGE_OTHER);
660 
661  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_SERVER", (long)REMMINA_PROTOCOL_SETTING_TYPE_SERVER);
662  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_PASSWORD", (long)REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD);
663  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_RESOLUTION", (long)REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION);
664  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_KEYMAP", (long)REMMINA_PROTOCOL_SETTING_TYPE_KEYMAP);
665  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_TEXT", (long)REMMINA_PROTOCOL_SETTING_TYPE_TEXT);
666  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_SELECT", (long)REMMINA_PROTOCOL_SETTING_TYPE_SELECT);
667  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_COMBO", (long)REMMINA_PROTOCOL_SETTING_TYPE_COMBO);
668  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_CHECK", (long)REMMINA_PROTOCOL_SETTING_TYPE_CHECK);
669  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_FILE", (long)REMMINA_PROTOCOL_SETTING_TYPE_FILE);
670  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_FOLDER", (long)REMMINA_PROTOCOL_SETTING_TYPE_FOLDER);
671  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_MULTIMON", (long)REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON);
672 
673  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_PREF", (long)REMMINA_PROTOCOL_FEATURE_TYPE_PREF);
674  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_TOOL", (long)REMMINA_PROTOCOL_FEATURE_TYPE_TOOL);
675  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_UNFOCUS", (long)REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS);
676  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_SCALE", (long)REMMINA_PROTOCOL_FEATURE_TYPE_SCALE);
677  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_DYNRESUPDATE", (long)REMMINA_PROTOCOL_FEATURE_TYPE_DYNRESUPDATE);
678  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_GTKSOCKET", (long)REMMINA_PROTOCOL_FEATURE_TYPE_GTKSOCKET);
679 
680  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_NONE", (long)REMMINA_PROTOCOL_SSH_SETTING_NONE);
681  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_TUNNEL", (long)REMMINA_PROTOCOL_SSH_SETTING_TUNNEL);
682  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_SSH", (long)REMMINA_PROTOCOL_SSH_SETTING_SSH);
683  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_REVERSE_TUNNEL", (long)REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL);
684  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_SFTP", (long)REMMINA_PROTOCOL_SSH_SETTING_SFTP);
685 
686  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_PREF_RADIO", (long)REMMINA_PROTOCOL_FEATURE_PREF_RADIO);
687  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_PREF_CHECK", (long)REMMINA_PROTOCOL_FEATURE_PREF_CHECK);
688 
689  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_USERNAME", REMMINA_MESSAGE_PANEL_FLAG_USERNAME);
690  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_USERNAME_READONLY", REMMINA_MESSAGE_PANEL_FLAG_USERNAME_READONLY);
691  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_DOMAIN", REMMINA_MESSAGE_PANEL_FLAG_DOMAIN);
692  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_SAVEPASSWORD", REMMINA_MESSAGE_PANEL_FLAG_SAVEPASSWORD);
693 
694  if (PyModule_AddObject(module, "Setting", (PyObject*)&python_protocol_setting_type) < 0)
695  {
696  Py_DECREF(&python_protocol_setting_type);
697  Py_DECREF(module);
698  PyErr_Print();
699  return NULL;
700  }
701 
702  Py_INCREF(&python_protocol_feature_type);
703  if (PyModule_AddObject(module, "Feature", (PyObject*)&python_protocol_feature_type) < 0)
704  {
705  Py_DECREF(&python_protocol_setting_type);
706  Py_DECREF(&python_protocol_feature_type);
707  Py_DECREF(module);
708  PyErr_Print();
709  return NULL;
710  }
711 
712  return module;
713 }
714 
720 {
721  TRACE_CALL(__func__);
722 
723  if (PyImport_AppendInittab("remmina", python_wrapper_module_initialize))
724  {
725  PyErr_Print();
726  exit(1);
727  }
728 
735 }
736 
737 gboolean python_wrapper_check_mandatory_member(PyObject* instance, const gchar* member)
738 {
739  TRACE_CALL(__func__);
740 
741  if (PyObject_HasAttrString(instance, member))
742  {
743  return TRUE;
744  }
745 
746  g_printerr("Missing mandatory member '%s' in Python plugin instance!\n", member);
747  return FALSE;
748 }
749 
750 static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin_instance)
751 {
752  TRACE_CALL(__func__);
753 
754  if (plugin_instance)
755  {
756  if (!python_wrapper_check_mandatory_member(plugin_instance, "name")
757  || !python_wrapper_check_mandatory_member(plugin_instance, "version"))
758  {
759  return NULL;
760  }
761 
762  /* Protocol plugin definition and features */
763  const gchar* pluginType = PyUnicode_AsUTF8(PyObject_GetAttrString(plugin_instance, "type"));
764 
766 
767  PyPlugin* plugin = (PyPlugin*)python_wrapper_malloc(sizeof(PyPlugin));
768  plugin->instance = plugin_instance;
769  Py_INCREF(plugin_instance);
770  plugin->protocol_plugin = NULL;
771  plugin->entry_plugin = NULL;
772  plugin->file_plugin = NULL;
773  plugin->pref_plugin = NULL;
774  plugin->secret_plugin = NULL;
775  plugin->tool_plugin = NULL;
776  g_print("New Python plugin registered: %ld\n", PyObject_Hash(plugin_instance));
777 
778  if (g_str_equal(pluginType, "protocol"))
779  {
780  remmina_plugin = python_wrapper_create_protocol_plugin(plugin);
781  }
782  else if (g_str_equal(pluginType, "entry"))
783  {
784  remmina_plugin = python_wrapper_create_entry_plugin(plugin);
785  }
786  else if (g_str_equal(pluginType, "file"))
787  {
788  remmina_plugin = python_wrapper_create_file_plugin(plugin);
789  }
790  else if (g_str_equal(pluginType, "tool"))
791  {
792  remmina_plugin = python_wrapper_create_tool_plugin(plugin);
793  }
794  else if (g_str_equal(pluginType, "pref"))
795  {
796  remmina_plugin = python_wrapper_create_pref_plugin(plugin);
797  }
798  else if (g_str_equal(pluginType, "secret"))
799  {
800  remmina_plugin = python_wrapper_create_secret_plugin(plugin);
801  }
802  else
803  {
804  g_printerr("Unknown plugin type: %s\n", pluginType);
805  }
806 
807  if (remmina_plugin)
808  {
809  if (remmina_plugin->type == REMMINA_PLUGIN_TYPE_PROTOCOL)
810  {
812  }
813 
814  if (python_wrapper_get_service()->register_plugin((RemminaPlugin*)remmina_plugin)) {
815  g_print("%s: Successfully reigstered!\n", remmina_plugin->name);
816  } else {
817  g_print("%s: Failed to reigster!\n", remmina_plugin->name);
818  }
819  }
820  }
821 
822  PyErr_Clear();
823  return Py_None;
824 }
825 
826 static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin)
827 {
828  TRACE_CALL(__func__);
829 
830  PyObject* result = Py_None;
831  const gchar* datadir = python_wrapper_get_service()->file_get_user_datadir();
832 
833  if (datadir)
834  {
835  result = PyUnicode_FromFormat("%s", datadir);
836  }
837 
839  return result;
840 }
841 
842 static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
843 {
844  TRACE_CALL(__func__);
845 
847  if (file)
848  {
849  return (PyObject*)python_wrapper_remmina_file_to_python(file);
850  }
851 
853  return Py_None;
854 }
855 
856 static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
857 {
858  TRACE_CALL(__func__);
859 
860  static char* kwlist[] = { "key", "value", NULL };
861  gchar* key, * value;
862 
863  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss", kwlist, &key, &value))
864  {
865  return Py_None;
866  }
867 
868  if (key)
869  {
871  }
872 
874  return Py_None;
875 }
876 
877 static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
878 {
879  TRACE_CALL(__func__);
880 
881  static char* kwlist[] = { "key", NULL };
882  gchar* key;
883  PyObject* result = Py_None;
884 
885  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &key))
886  {
887  return Py_None;
888  }
889 
890  if (key)
891  {
892  const gchar* value = python_wrapper_get_service()->pref_get_value(key);
893  if (value)
894  {
895  result = PyUnicode_FromFormat("%s", result);
896  }
897  }
898 
900  return result;
901 }
902 
903 static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin)
904 {
905  TRACE_CALL(__func__);
906 
907  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_scale_quality());
909  return result;
910 }
911 
912 static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin)
913 {
914  TRACE_CALL(__func__);
915 
916  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_sshtunnel_port());
918  return result;
919 }
920 
921 static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin)
922 {
923  TRACE_CALL(__func__);
924 
925  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_ssh_loglevel());
927  return result;
928 }
929 
930 static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin)
931 {
932  TRACE_CALL(__func__);
933 
934  PyObject* result = PyLong_FromLong(python_wrapper_get_service()->pref_get_ssh_parseconfig());
936  return result;
937 }
938 
939 static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
940 {
941  TRACE_CALL(__func__);
942 
943  static char* kwlist[] = { "keymap", "keyval", NULL };
944  gchar* keymap;
945  guint keyval;
946  PyObject* result = Py_None;
947 
948  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sl", kwlist, &keymap, &keyval))
949  {
950  return PyLong_FromLong(-1);
951  }
952 
953  if (keymap)
954  {
955  const guint value = python_wrapper_get_service()->pref_keymap_get_keyval(keymap, keyval);
956  result = PyLong_FromUnsignedLong(value);
957  }
958 
960  return result;
961 }
962 
963 static PyObject* python_wrapper_log_print_wrapper(PyObject* self, PyObject* args)
964 {
965  TRACE_CALL(__func__);
966 
967  gchar* text;
968  if (!PyArg_ParseTuple(args, "s", &text) || !text)
969  {
970  return Py_None;
971  }
972 
974  return Py_None;
975 }
976 
977 static PyObject* python_wrapper_debug_wrapper(PyObject* self, PyObject* args)
978 {
979  TRACE_CALL(__func__);
980 
981  gchar* text;
982  if (!PyArg_ParseTuple(args, "s", &text) || !text)
983  {
984  return Py_None;
985  }
986 
987  python_wrapper_get_service()->_remmina_debug("python", "%s", text);
988  return Py_None;
989 }
990 
991 static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
992 {
993  TRACE_CALL(__func__);
994 
995  static char* kwlist[] = { "widget", NULL };
996  PyObject* widget;
997 
998  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &widget) && widget)
999  {
1001  }
1002 
1003  return Py_None;
1004 }
1005 
1006 static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1007 {
1008  TRACE_CALL(__func__);
1009 
1010  static char* kwlist[] = { "remminafile", "data", "handler", NULL };
1011  PyObject* pyremminafile;
1012  PyObject* data;
1013 
1014  if (PyArg_ParseTupleAndKeywords(args, kwargs, "OOO", kwlist, &pyremminafile, &data) && pyremminafile && data)
1015  {
1016  python_wrapper_get_service()->rcw_open_from_file_full((RemminaFile*)pyremminafile, NULL, (void*)data, NULL);
1017  }
1018 
1019  return Py_None;
1020 }
1021 
1022 static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1023 {
1024  TRACE_CALL(__func__);
1025 
1026  static char* kwlist[] = { "server", "defaultport", "host", "port", NULL };
1027  gchar* server;
1028  gint defaultport;
1029 
1030  if (PyArg_ParseTupleAndKeywords(args, kwargs, "slsl", kwlist, &server, &defaultport) && server)
1031  {
1032  gchar* host;
1033  gint port;
1034  python_wrapper_get_service()->get_server_port(server, defaultport, &host, &port);
1035 
1036  PyObject* result = PyList_New(2);
1037  PyList_SetItem(result, 0, PyUnicode_FromString(host));
1038  PyList_SetItem(result, 1, PyLong_FromLong(port));
1039 
1040  return PyList_AsTuple(result);
1041  }
1042 
1043  return Py_None;
1044 }
1045 
1046 static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin)
1047 {
1048  TRACE_CALL(__func__);
1049 
1050  return PyBool_FromLong(python_wrapper_get_service()->is_main_thread());
1051 }
1052 
1053 static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin)
1054 {
1055  TRACE_CALL(__func__);
1056 
1057  return PyBool_FromLong(python_wrapper_get_service()->gtksocket_available());
1058 }
1059 
1060 static PyObject*
1061 remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1062 {
1063  TRACE_CALL(__func__);
1064 
1065  static char* kwlist[] = { "widget", NULL };
1066  PyPlugin* plugin;
1067 
1068  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &plugin) && plugin && plugin->gp)
1069  {
1071  }
1072 
1073  return Py_None;
1074 }
1075 
1076 static PyObject*
1077 remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1078 {
1079  TRACE_CALL(__func__);
1080 
1081  static char* kwlist[] = { "widget", NULL };
1082  PyPlugin* plugin;
1083 
1084  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &plugin) && plugin && plugin->gp)
1085  {
1087  }
1088 
1089  return Py_None;
1090 }
1091 
1093 {
1094  TRACE_CALL(__func__);
1095 
1097  Py_INCREF(setting);
1098  dest->name = src->name;
1099  dest->label = src->label;
1100  dest->compact = src->compact;
1101  dest->type = src->settingType;
1102  dest->validator = NULL;
1103  dest->validator_data = NULL;
1104  python_wrapper_to_generic(src->opt1, &dest->opt1);
1105  python_wrapper_to_generic(src->opt2, &dest->opt2);
1106 }
1107 
1109 {
1110  TRACE_CALL(__func__);
1111 
1113  Py_INCREF(feature);
1114  dest->id = src->id;
1115  dest->type = src->type;
1116  dest->opt1 = src->opt1->raw;
1117  dest->opt1_type_hint = src->opt1->type_hint;
1118  dest->opt2 = src->opt2->raw;
1119  dest->opt2_type_hint = src->opt2->type_hint;
1120  dest->opt3 = src->opt3->raw;
1121  dest->opt3_type_hint = src->opt3->type_hint;
1122 }
1123 
1124 PyObject* python_wrapper_show_dialog_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1125 {
1126  TRACE_CALL(__func__);
1127 
1128  static char* kwlist[] = { "type", "buttons", "message", NULL };
1129  GtkMessageType msgType;
1130  GtkButtonsType btnType;
1131  gchar* message;
1132 
1133  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "lls", kwlist, &msgType, &btnType, &message))
1134  {
1135  return PyLong_FromLong(-1);
1136  }
1137 
1138  python_wrapper_get_service()->show_dialog(msgType, btnType, message);
1139 
1140  return Py_None;
1141 }
1142 
1143 PyObject* python_wrapper_get_mainwindow_wrapper(PyObject* self, PyObject* args)
1144 {
1145  TRACE_CALL(__func__);
1146 
1147  GtkWindow* result = python_wrapper_get_service()->get_window();
1148 
1149  if (!result)
1150  {
1151  return Py_None;
1152  }
1153 
1154  return (PyObject*)new_pywidget((GObject*)result);
1155 }
1156 
1157 static PyObject* remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject* self, PyObject* args)
1158 {
1159  TRACE_CALL(__func__);
1160 
1161  PyObject* pygp = NULL;
1162  if (!PyArg_ParseTuple(args, "O", &pygp) || !pygp)
1163  {
1164  g_printerr("Please provide the Remmina protocol widget instance!");
1165  return Py_None;
1166  }
1167 
1169  return Py_None;
1170 }
1171 
1172 static PyObject* remmina_protocol_plugin_init_auth_wrapper(PyObject* module, PyObject* args, PyObject* kwds)
1173 {
1174  TRACE_CALL(__func__);
1175 
1176  static gchar* keyword_list[] = { "widget", "flags", "title", "default_username", "default_password",
1177  "default_domain", "password_prompt" };
1178 
1180  gint pflags = 0;
1181  gchar* title, * default_username, * default_password, * default_domain, * password_prompt;
1182 
1183  if (PyArg_ParseTupleAndKeywords(args, kwds, "Oisssss", keyword_list, &self, &pflags, &title, &default_username,
1184  &default_password, &default_domain, &password_prompt))
1185  {
1186  if (pflags != 0 && !(pflags & REMMINA_MESSAGE_PANEL_FLAG_USERNAME)
1188  && !(pflags & REMMINA_MESSAGE_PANEL_FLAG_DOMAIN)
1190  {
1191  g_printerr("panel_auth(pflags, title, default_username, default_password, default_domain, password_prompt): "
1192  "%d is not a known value for RemminaMessagePanelFlags!\n", pflags);
1193  }
1194  else
1195  {
1196  return Py_BuildValue("i", python_wrapper_get_service()->protocol_widget_panel_auth(self
1197  ->gp, pflags, title, default_username, default_password, default_domain, password_prompt));
1198  }
1199  }
1200  else
1201  {
1202  g_printerr("panel_auth(pflags, title, default_username, default_password, default_domain, password_prompt): Error parsing arguments!\n");
1203  PyErr_Print();
1204  }
1205  return Py_None;
1206 }
1207 
1208 static PyObject* remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject* self, PyObject* args)
1209 {
1210  PyObject* pygp = NULL;
1211  if (!PyArg_ParseTuple(args, "O", &pygp) || !pygp)
1212  {
1213  g_printerr("Please provide the Remmina protocol widget instance!");
1214  return Py_None;
1215  }
1216 
1218  return Py_None;
1219 }
static PyObject * remmina_register_plugin_wrapper(PyObject *self, PyObject *plugin)
static PyObject * remmina_file_new_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
@@ -109,7 +109,7 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
GtkWidget *(* rcw_open_from_file_full)(RemminaFile *remminafile, GCallback disconnect_cb, gpointer data, guint *handler)
Definition: plugin.h:300
-
void python_wrapper_to_protocol_setting(RemminaProtocolSetting *dest, PyObject *setting)
Converts the PyObject to RemminaProtocolSetting.
+
void python_wrapper_to_protocol_setting(RemminaProtocolSetting *dest, PyObject *setting)
Converts the PyObject to RemminaProtocolSetting.
gchar *(* file_get_user_datadir)(void)
Definition: plugin.h:214
Maps an instance of a Python plugin to a Remmina one.
@@ -182,7 +182,7 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
PyRemminaFile * python_wrapper_remmina_file_to_python(RemminaFile *file)
Converts the instance of RemminaFile to a Python object that can be passed to the Python engine...
-
static PyObject * remmina_gtksocket_available_wrapper(PyObject *self, PyObject *plugin)
+
static PyObject * remmina_gtksocket_available_wrapper(PyObject *self, PyObject *plugin)
PyObject * python_protocol_feature_new(PyTypeObject *type, PyObject *kws, PyObject *args)
RemminaPlugin * python_wrapper_create_file_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginFile, initializes its members and references the wrapper f...
@@ -198,14 +198,14 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
GtkWindow *(* get_window)(void)
Definition: plugin.h:302
char * python_wrapper_copy_string_from_python(PyObject *string, Py_ssize_t len)
Copies a string from a Python object to a new point in memory.
-
static PyObject * python_wrapper_show_dialog_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
+
static PyObject * python_wrapper_show_dialog_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
gchar *(* pref_get_value)(const gchar *key)
Definition: plugin.h:226
PyObject * python_wrapper_generic_type_new(PyTypeObject *type, PyObject *kws, PyObject *args)
-
static PyObject * remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
+
static PyObject * remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
void(* show_dialog)(GtkMessageType msg, GtkButtonsType buttons, const gchar *message)
Definition: plugin.h:301
-
static PyObject * remmina_protocol_plugin_init_auth_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
+
static PyObject * remmina_protocol_plugin_init_auth_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
RemminaPluginService * python_wrapper_get_service(void)
Gets the pointer to the plugin service of Remmina.
PyObject_HEAD RemminaProtocolSettingType settingType
static PyMethodDef python_wrapper_generic_methods[]
@@ -220,7 +220,7 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
Contains the specialisation of RemminaPluginFile plugins in Python.
-
static PyObject * remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject *self, PyObject *args)
+
static PyObject * remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject *self, PyObject *args)
PyObject_HEAD PyByteArrayObject * buffer
GCallback validator
Definition: types.h:124
@@ -232,12 +232,12 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
static PyTypeObject python_generic_type
-
void python_wrapper_to_protocol_feature(RemminaProtocolFeature *dest, PyObject *feature)
Converts the PyObject to RemminaProtocolFeature.
+
void python_wrapper_to_protocol_feature(RemminaProtocolFeature *dest, PyObject *feature)
Converts the PyObject to RemminaProtocolFeature.
RemminaPlugin * python_wrapper_create_entry_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginEntry, initializes its members and references the wrapper ...
RemminaTypeHint python_wrapper_to_generic(PyObject *field, gpointer *target)
Extracts data from a PyObject instance to a generic pointer and returns a type hint if it could be de...
static PyObject * remmina_public_get_server_port_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
-
static PyObject * remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
+
static PyObject * remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
The Python abstraction of the protocol widget struct.
PyRemminaPluginScreenshotData * python_wrapper_screenshot_data_new(void)
void(* widget_pool_register)(GtkWidget *widget)
Definition: plugin.h:299
@@ -250,7 +250,7 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm -
static PyObject * python_wrapper_get_mainwindow_wrapper(PyObject *self, PyObject *args)
+
static PyObject * python_wrapper_get_mainwindow_wrapper(PyObject *self, PyObject *args)
void python_wrapper_entry_init(void)
Initializes the Python plugin specialisation for entry plugins.
PyObject * python_screenshot_data_new(PyTypeObject *type, PyObject *kws, PyObject *args)
@@ -267,7 +267,7 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
static PyObject * python_wrapper_log_print_wrapper(PyObject *self, PyObject *arg)
Contains the specialisation of RemminaPluginFile plugins in Python.
static PyObject * python_wrapper_debug_wrapper(PyObject *self, PyObject *msg)
-
static PyObject * remmina_masterthread_exec_is_main_thread_wrapper(PyObject *self, PyObject *plugin)
+
static PyObject * remmina_masterthread_exec_is_main_thread_wrapper(PyObject *self, PyObject *plugin)
Adapter struct to handle Remmina protocol settings.
RemminaFile *(* file_new)(void)
Definition: plugin.h:216
void(* _remmina_debug)(const gchar *func, const gchar *fmt,...)
Definition: plugin.h:236
@@ -277,7 +277,7 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8c_source.htm
const gchar * name
Definition: plugin.h:58
static int python_protocol_setting_init(PyRemminaProtocolSetting *self, PyObject *args, PyObject *kwargs)
Constructor of the remmina.Setting Python type.
RemminaEntryPlugin * entry_plugin
-
static PyObject * remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject *self, PyObject *args)
+
static PyObject * remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject *self, PyObject *args)
const gchar * name
Definition: types.h:118
RemminaPlugin * python_wrapper_create_protocol_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginProtocol, initializes its members and references the wrapp...
PyObject * instance
diff --git a/public/python__wrapper__remmina_8h.html b/public/python__wrapper__remmina_8h.html index c9a94f2b5..a4f2792b3 100644 --- a/public/python__wrapper__remmina_8h.html +++ b/public/python__wrapper__remmina_8h.html @@ -201,7 +201,7 @@ Functions -

Definition at line 1107 of file python_wrapper_remmina.c.

+

Definition at line 1108 of file python_wrapper_remmina.c.

@@ -240,7 +240,7 @@ Functions -

Definition at line 1091 of file python_wrapper_remmina.c.

+

Definition at line 1092 of file python_wrapper_remmina.c.

diff --git a/public/python__wrapper__remmina_8h_source.html b/public/python__wrapper__remmina_8h_source.html index 75785d04f..ad1149603 100644 --- a/public/python__wrapper__remmina_8h_source.html +++ b/public/python__wrapper__remmina_8h_source.html @@ -87,13 +87,13 @@ $(document).ready(function(){initNavTree('python__wrapper__remmina_8h_source.htm
Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2014-2023 Antenore Gatta, Giovanni Panozzo
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  *
20  * In addition, as a special exception, the copyright holders give
21  * permission to link the code of portions of this program with the
22  * OpenSSL library under certain conditions as described in each
23  * individual source file, and distribute linked combinations
24  * including the two.
25  * You must obey the GNU General Public License in all respects
26  * for all of the code used other than OpenSSL. * If you modify
27  * file(s) with this exception, you may extend this exception to your
28  * version of the file(s), but you are not obligated to do so. * If you
29  * do not wish to do so, delete this exception statement from your
30  * version. * If you delete this exception statement from all source
31  * files in the program, then also delete it here.
32  */
33 
46 #pragma once
47 
49 // I N C L U D E S
51 
52 #include "python_wrapper_common.h"
54 
56 // A P I
58 
59 G_BEGIN_DECLS
60 
65 
76 
83 void python_wrapper_to_protocol_setting(RemminaProtocolSetting* dest, PyObject* setting);
84 
91 void python_wrapper_to_protocol_feature(RemminaProtocolFeature* dest, PyObject* feature);
92 
93 G_END_DECLS
Maps an instance of a Python plugin to a Remmina one.
-
void python_wrapper_to_protocol_feature(RemminaProtocolFeature *dest, PyObject *feature)
Converts the PyObject to RemminaProtocolFeature.
+
void python_wrapper_to_protocol_feature(RemminaProtocolFeature *dest, PyObject *feature)
Converts the PyObject to RemminaProtocolFeature.
Contains the implementation of the widget handling used from the protocol plugin. ...
Contains functions and constants that are commonly used throughout the Python plugin implementation...
-
void python_wrapper_to_protocol_setting(RemminaProtocolSetting *dest, PyObject *setting)
Converts the PyObject to RemminaProtocolSetting.
+
void python_wrapper_to_protocol_setting(RemminaProtocolSetting *dest, PyObject *setting)
Converts the PyObject to RemminaProtocolSetting.
G_BEGIN_DECLS void python_wrapper_module_init(void)
Initializes the &#39;remmina&#39; module in the Python engine.
PyPlugin * python_wrapper_module_get_plugin(RemminaProtocolWidget *gp)
Returns a pointer to the Python instance, mapped to the RemminaProtocolWidget or null if not found...
-- cgit v1.2.3