Remmina - The GTK+ Remote Desktop Client  v1.4.25
Remmina is a remote desktop client written in GTK+, aiming to be useful for system administrators and travellers, who need to work with lots of remote computers in front of either large monitors or tiny netbooks. Remmina supports multiple network protocols in an integrated and consistent user interface. Currently RDP, VNC, NX, XDMCP and SSH are supported.
remmina_plugin_python_remmina.c
Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2016-2022 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 
39 #include "remmina_main.h"
40 #include "remmina_plugin_manager.h"
41 #include "remmina/plugin.h"
42 #include "remmina/types.h"
44 #include "remmina_log.h"
45 
48 
55 
56 #include "remmina_pref.h"
57 #include "remmina_ssh.h"
58 #include "remmina_file_manager.h"
59 #include "remmina_widget_pool.h"
60 #include "remmina_public.h"
62 
63 #include "rcw.h"
65 
66 #include <string.h>
67 
69 // D E C L A R A T I O N S
71 
72 
76 gboolean remmina_plugin_python_check_mandatory_member(PyObject* instance, const gchar* member);
77 
78 static PyObject* remmina_plugin_python_debug_wrapper(PyObject* self, PyObject* msg);
79 static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin);
80 static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin);
81 static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
82 static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
83 static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
84 static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin);
85 static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin);
86 static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin);
87 static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin);
88 static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
89 static PyObject* remmina_plugin_python_log_print_wrapper(PyObject* self, PyObject* arg);
90 static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
91 static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
92 static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
93 static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin);
94 static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin);
95 static PyObject*
96 remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
97 static PyObject*
98 remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
99 static PyObject* remmina_plugin_python_show_dialog_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
100 static PyObject* remmina_plugin_python_get_mainwindow_wrapper(PyObject* self, PyObject* args);
101 static PyObject* remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject* self, PyObject* args);
102 static PyObject* remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject* self, PyObject* args);
103 static PyObject* remmina_protocol_plugin_init_auth_wrapper(PyObject* self, PyObject* args, PyObject* kwargs);
104 
109 static PyMethodDef remmina_python_module_type_methods[] = {
114  { "register_plugin", remmina_register_plugin_wrapper, METH_O, NULL },
115 
119  { "log_print", remmina_plugin_python_log_print_wrapper, METH_VARARGS, NULL },
120 
124  { "debug", remmina_plugin_python_debug_wrapper, METH_VARARGS, NULL },
125 
129  { "show_dialog", (PyCFunction)remmina_plugin_python_show_dialog_wrapper, METH_VARARGS | METH_KEYWORDS,
130  NULL },
131 
135  { "get_main_window", remmina_plugin_python_get_mainwindow_wrapper, METH_NOARGS, NULL },
136 
140  { "get_datadir", remmina_file_get_datadir_wrapper, METH_VARARGS, NULL },
141 
145  { "file_new", (PyCFunction)remmina_file_new_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
146 
150  { "pref_set_value", (PyCFunction)remmina_pref_set_value_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
151 
155  { "pref_get_value", (PyCFunction)remmina_pref_get_value_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
156 
160  { "pref_get_scale_quality", remmina_pref_get_scale_quality_wrapper, METH_VARARGS, NULL },
161 
165  { "pref_get_sshtunnel_port", remmina_pref_get_sshtunnel_port_wrapper, METH_VARARGS, NULL },
166 
170  { "pref_get_ssh_loglevel", remmina_pref_get_ssh_loglevel_wrapper, METH_VARARGS, NULL },
171 
175  { "pref_get_ssh_parseconfig", remmina_pref_get_ssh_parseconfig_wrapper, METH_VARARGS, NULL },
176 
180  { "pref_keymap_get_keyval", (PyCFunction)remmina_pref_keymap_get_keyval_wrapper, METH_VARARGS | METH_KEYWORDS,
181  NULL },
182 
186  { "widget_pool_register", (PyCFunction)remmina_widget_pool_register_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
187 
191  { "rcw_open_from_file_full", (PyCFunction)rcw_open_from_file_full_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
192 
196  { "public_get_server_port", (PyCFunction)remmina_public_get_server_port_wrapper, METH_VARARGS | METH_KEYWORDS,
197  NULL },
198 
202  { "masterthread_exec_is_main_thread", remmina_masterthread_exec_is_main_thread_wrapper, METH_VARARGS, NULL },
203 
207  { "gtksocket_available", remmina_gtksocket_available_wrapper, METH_VARARGS, NULL },
208 
212  { "protocol_widget_get_profile_remote_width",
213  (PyCFunction)remmina_protocol_widget_get_profile_remote_width_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
214 
218  { "protocol_widget_get_profile_remote_height",
219  (PyCFunction)remmina_protocol_widget_get_profile_remote_height_wrapper, METH_VARARGS | METH_KEYWORDS, NULL },
220  { "protocol_plugin_signal_connection_opened", (PyCFunction)remmina_protocol_plugin_signal_connection_opened_wrapper,
221  METH_VARARGS, NULL },
222 
223  { "protocol_plugin_signal_connection_closed", (PyCFunction)remmina_protocol_plugin_signal_connection_closed_wrapper,
224  METH_VARARGS, NULL },
225 
226  { "protocol_plugin_init_auth", (PyCFunction)remmina_protocol_plugin_init_auth_wrapper, METH_VARARGS | METH_KEYWORDS,
227  NULL },
228 
229  /* Sentinel */
230  { NULL }
231 };
232 
236 typedef struct
237 {
238  PyObject_HEAD
240  gchar* name;
241  gchar* label;
242  gboolean compact;
243  PyObject* opt1;
244  PyObject* opt2;
246 
250 static PyModuleDef remmina_python_module_type = {
251  PyModuleDef_HEAD_INIT,
252  .m_name = "remmina",
253  .m_doc = "Remmina API.",
254  .m_size = -1,
256 };
257 
258 // -- Python Object -> Setting
259 
264 static PyObject* python_protocol_setting_new(PyTypeObject* type, PyObject* args, PyObject* kwargs)
265 {
266  TRACE_CALL(__func__);
267 
268  PyRemminaProtocolSetting* self = (PyRemminaProtocolSetting*)type->tp_alloc(type, 0);
269 
270  if (!self)
271  {
272  return NULL;
273  }
274 
275  self->name = "";
276  self->label = "";
277  self->compact = FALSE;
278  self->opt1 = NULL;
279  self->opt2 = NULL;
280  self->settingType = 0;
281 
282  return (PyObject*)self;
283 }
284 
289 static int python_protocol_setting_init(PyRemminaProtocolSetting* self, PyObject* args, PyObject* kwargs)
290 {
291  TRACE_CALL(__func__);
292 
293  static gchar* kwlist[] = { "type", "name", "label", "compact", "opt1", "opt2", NULL };
294  PyObject* name;
295  PyObject* label;
296 
297  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|lOOpOO", kwlist,
298  &self->settingType, &name, &label, &self->compact, &self->opt1, &self->opt2))
299  {
300  return -1;
301  }
302 
303  Py_ssize_t len = PyUnicode_GetLength(label);
304  if (len == 0)
305  {
306  self->label = "";
307  }
308  else
309  {
310  self->label = remmina_plugin_python_copy_string_from_python(label, len);
311  if (!self->label)
312  {
313  g_printerr("Unable to extract label during initialization of Python settings module!\n");
315  }
316  }
317 
318  len = PyUnicode_GetLength(name);
319  if (len == 0)
320  {
321  self->name = "";
322  }
323  else
324  {
325  self->name = remmina_plugin_python_copy_string_from_python(label, len);
326  if (!self->name)
327  {
328  g_printerr("Unable to extract name during initialization of Python settings module!\n");
330  }
331  }
332 
333  return 0;
334 }
335 
336 static PyMemberDef python_protocol_setting_type_members[] = {
337  { "settingType", offsetof(PyRemminaProtocolSetting, settingType), T_INT, 0, NULL },
338  { "name", offsetof(PyRemminaProtocolSetting, name), T_STRING, 0, NULL },
339  { "label", offsetof(PyRemminaProtocolSetting, label), T_STRING, 0, NULL },
340  { "compact", offsetof(PyRemminaProtocolSetting, compact), T_BOOL, 0, NULL },
341  { "opt1", offsetof(PyRemminaProtocolSetting, opt1), T_OBJECT, 0, NULL },
342  { "opt2", offsetof(PyRemminaProtocolSetting, opt2), T_OBJECT, 0, NULL },
343  { NULL }
344 };
345 
346 static PyTypeObject python_protocol_setting_type = {
347  PyVarObject_HEAD_INIT(NULL, 0)
348  .tp_name = "remmina.Setting",
349  .tp_doc = "Remmina Setting information",
350  .tp_basicsize = sizeof(PyRemminaProtocolSetting),
351  .tp_itemsize = 0,
352  .tp_flags = Py_TPFLAGS_DEFAULT,
353  .tp_new = python_protocol_setting_new,
354  .tp_init = (initproc)python_protocol_setting_init,
356 };
357 
358 // -- Python Type -> Feature
359 
360 
361 static PyMemberDef python_protocol_feature_members[] = {
362  { "type", T_INT, offsetof(PyRemminaProtocolFeature, type), 0, NULL },
363  { "id", T_INT, offsetof(PyRemminaProtocolFeature, id), 0, NULL },
364  { "opt1", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt1), 0, NULL },
365  { "opt2", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt2), 0, NULL },
366  { "opt3", T_OBJECT, offsetof(PyRemminaProtocolFeature, opt3), 0, NULL },
367  { NULL }
368 };
369 
370 PyObject* python_protocol_feature_new(PyTypeObject* type, PyObject* kws, PyObject* args)
371 {
372  TRACE_CALL(__func__);
373 
375  self = (PyRemminaProtocolFeature*)type->tp_alloc(type, 0);
376  if (!self)
377  return NULL;
378 
379  self->id = 0;
380  self->type = 0;
381  self->opt1 = (PyGeneric*)Py_None;
382  self->opt1->raw = NULL;
383  self->opt1->type_hint = REMMINA_TYPEHINT_UNDEFINED;
384  self->opt2 = (PyGeneric*)Py_None;
385  self->opt2->raw = NULL;
386  self->opt2->type_hint = REMMINA_TYPEHINT_UNDEFINED;
387  self->opt3 = (PyGeneric*)Py_None;
388  self->opt3->raw = NULL;
389  self->opt3->type_hint = REMMINA_TYPEHINT_UNDEFINED;
390 
391  return (PyObject*)self;
392 }
393 
394 static int python_protocol_feature_init(PyRemminaProtocolFeature* self, PyObject* args, PyObject* kwargs)
395 {
396  TRACE_CALL(__func__);
397 
398  static char* kwlist[] = { "type", "id", "opt1", "opt2", "opt3", NULL };
399 
400  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|llOOO", kwlist, &self->type, &self->id, &self->opt1, &self
401  ->opt2, &self->opt3))
402  return -1;
403 
404  return 0;
405 }
406 
407 static PyTypeObject python_protocol_feature_type = {
408  PyVarObject_HEAD_INIT(NULL, 0)
409  .tp_name = "remmina.ProtocolFeature",
410  .tp_doc = "Remmina Setting information",
411  .tp_basicsize = sizeof(PyRemminaProtocolFeature),
412  .tp_itemsize = 0,
413  .tp_flags = Py_TPFLAGS_DEFAULT,
414  .tp_new = python_protocol_feature_new,
415  .tp_init = (initproc)python_protocol_feature_init,
416  .tp_members = python_protocol_feature_members
417 };
418 
420 {
422  feature->id = 0;
424  feature->opt1->raw = NULL;
427  feature->opt2->raw = NULL;
430  feature->opt3->raw = NULL;
432  feature->type = 0;
433  Py_IncRef((PyObject*)feature);
434  return feature;
435 }
436 
437 
438 // -- Python Type -> Screenshot Data
439 
440 static PyMemberDef python_screenshot_data_members[] = {
441  { "buffer", T_OBJECT, offsetof(PyRemminaPluginScreenshotData, buffer), 0, NULL },
442  { "width", T_INT, offsetof(PyRemminaPluginScreenshotData, width), 0, NULL },
443  { "height", T_INT, offsetof(PyRemminaPluginScreenshotData, height), 0, NULL },
444  { "bitsPerPixel", T_INT, offsetof(PyRemminaPluginScreenshotData, bitsPerPixel), 0, NULL },
445  { "bytesPerPixel", T_INT, offsetof(PyRemminaPluginScreenshotData, bytesPerPixel), 0, NULL },
446  { NULL }
447 };
448 
449 PyObject* python_screenshot_data_new(PyTypeObject* type, PyObject* kws, PyObject* args)
450 {
451  TRACE_CALL(__func__);
452 
454  self = (PyRemminaPluginScreenshotData*)type->tp_alloc(type, 0);
455  if (!self)
456  return NULL;
457 
458  self->buffer = (PyByteArrayObject*)PyObject_New(PyByteArrayObject, &PyByteArray_Type);
459  self->height = 0;
460  self->width = 0;
461  self->bitsPerPixel = 0;
462  self->bytesPerPixel = 0;
463 
464  return (PyObject*)self;
465 }
466 
467 static int python_screenshot_data_init(PyRemminaPluginScreenshotData* self, PyObject* args, PyObject* kwargs)
468 {
469  TRACE_CALL(__func__);
470 
471  g_printerr("Not to be initialized within Python!");
472  return -1;
473 }
474 
475 static PyTypeObject python_screenshot_data_type = {
476  PyVarObject_HEAD_INIT(NULL, 0)
477  .tp_name = "remmina.RemminaScreenshotData",
478  .tp_doc = "Remmina Screenshot Data",
479  .tp_basicsize = sizeof(PyRemminaPluginScreenshotData),
480  .tp_itemsize = 0,
481  .tp_flags = Py_TPFLAGS_DEFAULT,
482  .tp_new = python_screenshot_data_new,
483  .tp_init = (initproc)python_screenshot_data_init,
484  .tp_members = python_screenshot_data_members
485 };
487 {
489  data->buffer = PyObject_New(PyByteArrayObject, &PyByteArray_Type);
490  Py_IncRef((PyObject*)data->buffer);
491  data->height = 0;
492  data->width = 0;
493  data->bitsPerPixel = 0;
494  data->bytesPerPixel = 0;
495  return data;
496 }
497 
498 static PyObject* remmina_plugin_python_generic_to_int(PyGeneric* self, PyObject* args);
499 static PyObject* remmina_plugin_python_generic_to_bool(PyGeneric* self, PyObject* args);
500 static PyObject* remmina_plugin_python_generic_to_string(PyGeneric* self, PyObject* args);
501 
502 static void remmina_plugin_python_generic_dealloc(PyObject* self)
503 {
504  PyObject_Del(self);
505 }
506 
508  { "to_int", (PyCFunction)remmina_plugin_python_generic_to_int, METH_NOARGS, "" },
509  { "to_bool", (PyCFunction)remmina_plugin_python_generic_to_bool, METH_NOARGS, "" },
510  { "to_string", (PyCFunction)remmina_plugin_python_generic_to_string, METH_NOARGS, "" },
511  { NULL }
512 };
513 
515  { "raw", T_OBJECT, offsetof(PyGeneric, raw), 0, "" },
516  { NULL }
517 };
518 
519 PyObject* remmina_plugin_python_generic_type_new(PyTypeObject* type, PyObject* kws, PyObject* args)
520 {
521  TRACE_CALL(__func__);
522 
523  PyGeneric* self;
524  self = (PyGeneric*)type->tp_alloc(type, 0);
525  if (!self)
526  return NULL;
527 
528  self->raw = Py_None;
529 
530  return (PyObject*)self;
531 }
532 
533 static int remmina_plugin_python_generic_init(PyGeneric* self, PyObject* args, PyObject* kwargs)
534 {
535  TRACE_CALL(__func__);
536 
537  static char* kwlist[] = { "raw", NULL };
538 
539  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O", kwlist, &self->raw))
540  return -1;
541 
542  return 0;
543 }
544 
545 static PyTypeObject python_generic_type = {
546  PyVarObject_HEAD_INIT(NULL, 0)
547  .tp_name = "remmina.Generic",
548  .tp_doc = "",
549  .tp_basicsize = sizeof(PyGeneric),
550  .tp_itemsize = 0,
552  .tp_flags = Py_TPFLAGS_DEFAULT,
554  .tp_init = (initproc)remmina_plugin_python_generic_init,
557 };
558 
560 {
561  PyGeneric* generic = (PyGeneric*)PyObject_New(PyGeneric, &python_generic_type);
562  generic->raw = PyLong_FromLongLong(0LL);
563  Py_IncRef((PyObject*)generic);
564  return generic;
565 }
566 
567 static PyObject* remmina_plugin_python_generic_to_int(PyGeneric* self, PyObject* args)
568 {
569  SELF_CHECK();
570 
571  if (self->raw == NULL)
572  {
573  return Py_None;
574  }
575  else if (self->type_hint == REMMINA_TYPEHINT_SIGNED)
576  {
577  return PyLong_FromLongLong((long long)self->raw);
578  }
579  else if (self->type_hint == REMMINA_TYPEHINT_UNSIGNED)
580  {
581  return PyLong_FromUnsignedLongLong((unsigned long long)self->raw);
582  }
583 
584  return Py_None;
585 }
586 static PyObject* remmina_plugin_python_generic_to_bool(PyGeneric* self, PyObject* args)
587 {
588  SELF_CHECK();
589 
590  if (self->raw == NULL)
591  {
592  return Py_None;
593  }
594  else if (self->type_hint == REMMINA_TYPEHINT_BOOLEAN)
595  {
596  return PyBool_FromLong((long)self->raw);
597  }
598 
599  return Py_None;
600 }
601 static PyObject* remmina_plugin_python_generic_to_string(PyGeneric* self, PyObject* args)
602 {
603  SELF_CHECK();
604 
605  if (self->raw == NULL)
606  {
607  return Py_None;
608  }
609  else if (self->type_hint == REMMINA_TYPEHINT_STRING)
610  {
611  return PyUnicode_FromString((const char*)self->raw);
612  }
613 
614  return Py_None;
615 }
616 
622 {
623  TRACE_CALL(__func__);
624 
625  if (PyType_Ready(&python_screenshot_data_type) < 0)
626  {
627  PyErr_Print();
628  return NULL;
629  }
630 
631  if (PyType_Ready(&python_generic_type) < 0)
632  {
633  PyErr_Print();
634  return NULL;
635  }
636 
637  if (PyType_Ready(&python_protocol_setting_type) < 0)
638  {
639  PyErr_Print();
640  return NULL;
641  }
642 
643  if (PyType_Ready(&python_protocol_feature_type) < 0)
644  {
645  PyErr_Print();
646  return NULL;
647  }
648 
651 
652  PyObject* module = PyModule_Create(&remmina_python_module_type);
653  if (!module)
654  {
655  PyErr_Print();
656  return NULL;
657  }
658 
659  PyModule_AddIntConstant(module, "BUTTONS_CLOSE", (long)GTK_BUTTONS_CLOSE);
660  PyModule_AddIntConstant(module, "BUTTONS_NONE", (long)GTK_BUTTONS_NONE);
661  PyModule_AddIntConstant(module, "BUTTONS_OK", (long)GTK_BUTTONS_OK);
662  PyModule_AddIntConstant(module, "BUTTONS_CLOSE", (long)GTK_BUTTONS_CLOSE);
663  PyModule_AddIntConstant(module, "BUTTONS_CANCEL", (long)GTK_BUTTONS_CANCEL);
664  PyModule_AddIntConstant(module, "BUTTONS_YES_NO", (long)GTK_BUTTONS_YES_NO);
665  PyModule_AddIntConstant(module, "BUTTONS_OK_CANCEL", (long)GTK_BUTTONS_OK_CANCEL);
666 
667  PyModule_AddIntConstant(module, "MESSAGE_INFO", (long)GTK_MESSAGE_INFO);
668  PyModule_AddIntConstant(module, "MESSAGE_WARNING", (long)GTK_MESSAGE_WARNING);
669  PyModule_AddIntConstant(module, "MESSAGE_QUESTION", (long)GTK_MESSAGE_QUESTION);
670  PyModule_AddIntConstant(module, "MESSAGE_ERROR", (long)GTK_MESSAGE_ERROR);
671  PyModule_AddIntConstant(module, "MESSAGE_OTHER", (long)GTK_MESSAGE_OTHER);
672 
673  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_SERVER", (long)REMMINA_PROTOCOL_SETTING_TYPE_SERVER);
674  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_PASSWORD", (long)REMMINA_PROTOCOL_SETTING_TYPE_PASSWORD);
675  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_RESOLUTION", (long)REMMINA_PROTOCOL_SETTING_TYPE_RESOLUTION);
676  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_KEYMAP", (long)REMMINA_PROTOCOL_SETTING_TYPE_KEYMAP);
677  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_TEXT", (long)REMMINA_PROTOCOL_SETTING_TYPE_TEXT);
678  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_SELECT", (long)REMMINA_PROTOCOL_SETTING_TYPE_SELECT);
679  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_COMBO", (long)REMMINA_PROTOCOL_SETTING_TYPE_COMBO);
680  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_CHECK", (long)REMMINA_PROTOCOL_SETTING_TYPE_CHECK);
681  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_FILE", (long)REMMINA_PROTOCOL_SETTING_TYPE_FILE);
682  PyModule_AddIntConstant(module, "PROTOCOL_SETTING_TYPE_FOLDER", (long)REMMINA_PROTOCOL_SETTING_TYPE_FOLDER);
683  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_MULTIMON", (long)REMMINA_PROTOCOL_FEATURE_TYPE_MULTIMON);
684 
685  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_PREF", (long)REMMINA_PROTOCOL_FEATURE_TYPE_PREF);
686  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_TOOL", (long)REMMINA_PROTOCOL_FEATURE_TYPE_TOOL);
687  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_UNFOCUS", (long)REMMINA_PROTOCOL_FEATURE_TYPE_UNFOCUS);
688  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_SCALE", (long)REMMINA_PROTOCOL_FEATURE_TYPE_SCALE);
689  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_DYNRESUPDATE", (long)REMMINA_PROTOCOL_FEATURE_TYPE_DYNRESUPDATE);
690  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_TYPE_GTKSOCKET", (long)REMMINA_PROTOCOL_FEATURE_TYPE_GTKSOCKET);
691 
692  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_NONE", (long)REMMINA_PROTOCOL_SSH_SETTING_NONE);
693  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_TUNNEL", (long)REMMINA_PROTOCOL_SSH_SETTING_TUNNEL);
694  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_SSH", (long)REMMINA_PROTOCOL_SSH_SETTING_SSH);
695  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_REVERSE_TUNNEL", (long)REMMINA_PROTOCOL_SSH_SETTING_REVERSE_TUNNEL);
696  PyModule_AddIntConstant(module, "PROTOCOL_SSH_SETTING_SFTP", (long)REMMINA_PROTOCOL_SSH_SETTING_SFTP);
697 
698  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_PREF_RADIO", (long)REMMINA_PROTOCOL_FEATURE_PREF_RADIO);
699  PyModule_AddIntConstant(module, "PROTOCOL_FEATURE_PREF_CHECK", (long)REMMINA_PROTOCOL_FEATURE_PREF_CHECK);
700 
701  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_USERNAME", REMMINA_MESSAGE_PANEL_FLAG_USERNAME);
702  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_USERNAME_READONLY", REMMINA_MESSAGE_PANEL_FLAG_USERNAME_READONLY);
703  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_DOMAIN", REMMINA_MESSAGE_PANEL_FLAG_DOMAIN);
704  PyModule_AddIntConstant(module, "MESSAGE_PANEL_FLAG_SAVEPASSWORD", REMMINA_MESSAGE_PANEL_FLAG_SAVEPASSWORD);
705 
706  if (PyModule_AddObject(module, "Setting", (PyObject*)&python_protocol_setting_type) < 0)
707  {
708  Py_DECREF(&python_protocol_setting_type);
709  Py_DECREF(module);
710  PyErr_Print();
711  return NULL;
712  }
713 
714  Py_INCREF(&python_protocol_feature_type);
715  if (PyModule_AddObject(module, "Feature", (PyObject*)&python_protocol_feature_type) < 0)
716  {
717  Py_DECREF(&python_protocol_setting_type);
718  Py_DECREF(&python_protocol_feature_type);
719  Py_DECREF(module);
720  PyErr_Print();
721  return NULL;
722  }
723 
724  return module;
725 }
726 
732 {
733  TRACE_CALL(__func__);
734 
735  if (PyImport_AppendInittab("remmina", remmina_plugin_python_module_initialize))
736  {
737  PyErr_Print();
738  exit(1);
739  }
740 
747 }
748 
749 gboolean remmina_plugin_python_check_mandatory_member(PyObject* instance, const gchar* member)
750 {
751  TRACE_CALL(__func__);
752 
753  if (PyObject_HasAttrString(instance, member))
754  {
755  return TRUE;
756  }
757 
758  g_printerr("Missing mandatory member '%s' in Python plugin instance!\n", member);
759  return FALSE;
760 }
761 
762 static PyObject* remmina_register_plugin_wrapper(PyObject* self, PyObject* plugin_instance)
763 {
764  TRACE_CALL(__func__);
765 
766  if (plugin_instance)
767  {
768  if (!remmina_plugin_python_check_mandatory_member(plugin_instance, "name")
769  || !remmina_plugin_python_check_mandatory_member(plugin_instance, "version"))
770  {
771  return NULL;
772  }
773 
774  /* Protocol plugin definition and features */
775  const gchar* pluginType = PyUnicode_AsUTF8(PyObject_GetAttrString(plugin_instance, "type"));
776 
778 
780  plugin->instance = plugin_instance;
781  Py_INCREF(plugin_instance);
782  plugin->protocol_plugin = NULL;
783  plugin->entry_plugin = NULL;
784  plugin->file_plugin = NULL;
785  plugin->pref_plugin = NULL;
786  plugin->secret_plugin = NULL;
787  plugin->tool_plugin = NULL;
788  g_print("New Python plugin registered: %ld\n", PyObject_Hash(plugin_instance));
789 
790  if (g_str_equal(pluginType, "protocol"))
791  {
792  remmina_plugin = remmina_plugin_python_create_protocol_plugin(plugin);
793  }
794  else if (g_str_equal(pluginType, "entry"))
795  {
796  remmina_plugin = remmina_plugin_python_create_entry_plugin(plugin);
797  }
798  else if (g_str_equal(pluginType, "file"))
799  {
800  remmina_plugin = remmina_plugin_python_create_file_plugin(plugin);
801  }
802  else if (g_str_equal(pluginType, "tool"))
803  {
804  remmina_plugin = remmina_plugin_python_create_tool_plugin(plugin);
805  }
806  else if (g_str_equal(pluginType, "pref"))
807  {
808  remmina_plugin = remmina_plugin_python_create_pref_plugin(plugin);
809  }
810  else if (g_str_equal(pluginType, "secret"))
811  {
812  remmina_plugin = remmina_plugin_python_create_secret_plugin(plugin);
813  }
814  else
815  {
816  g_printerr("Unknown plugin type: %s\n", pluginType);
817  }
818 
819  if (remmina_plugin)
820  {
821  if (remmina_plugin->type == REMMINA_PLUGIN_TYPE_PROTOCOL)
822  {
824  }
825 
827  }
828  }
829 
830  return Py_None;
831 }
832 
833 static PyObject* remmina_file_get_datadir_wrapper(PyObject* self, PyObject* plugin)
834 {
835  TRACE_CALL(__func__);
836 
837  PyObject* result = Py_None;
838  const gchar* datadir = remmina_file_get_datadir();
839 
840  if (datadir)
841  {
842  result = PyUnicode_FromFormat("%s", datadir);
843  }
844 
846  return result;
847 }
848 
849 static PyObject* remmina_file_new_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
850 {
851  TRACE_CALL(__func__);
852 
853  RemminaFile* file = remmina_file_new();
854  if (file)
855  {
856  return (PyObject*)remmina_plugin_python_remmina_file_to_python(file);
857  }
858 
860  return Py_None;
861 }
862 
863 static PyObject* remmina_pref_set_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
864 {
865  TRACE_CALL(__func__);
866 
867  static char* kwlist[] = { "key", "value", NULL };
868  gchar* key, * value;
869 
870  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ss", kwlist, &key, &value))
871  {
872  return Py_None;
873  }
874 
875  if (key)
876  {
877  remmina_pref_set_value(key, value);
878  }
879 
881  return Py_None;
882 }
883 
884 static PyObject* remmina_pref_get_value_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
885 {
886  TRACE_CALL(__func__);
887 
888  static char* kwlist[] = { "key", NULL };
889  gchar* key;
890  PyObject* result = Py_None;
891 
892  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s", kwlist, &key))
893  {
894  return Py_None;
895  }
896 
897  if (key)
898  {
899  const gchar* value = remmina_pref_get_value(key);
900  if (value)
901  {
902  result = PyUnicode_FromFormat("%s", result);
903  }
904  }
905 
907  return result;
908 }
909 
910 static PyObject* remmina_pref_get_scale_quality_wrapper(PyObject* self, PyObject* plugin)
911 {
912  TRACE_CALL(__func__);
913 
914  PyObject* result = PyLong_FromLong(remmina_pref_get_scale_quality());
916  return result;
917 }
918 
919 static PyObject* remmina_pref_get_sshtunnel_port_wrapper(PyObject* self, PyObject* plugin)
920 {
921  TRACE_CALL(__func__);
922 
923  PyObject* result = PyLong_FromLong(remmina_pref_get_sshtunnel_port());
925  return result;
926 }
927 
928 static PyObject* remmina_pref_get_ssh_loglevel_wrapper(PyObject* self, PyObject* plugin)
929 {
930  TRACE_CALL(__func__);
931 
932  PyObject* result = PyLong_FromLong(remmina_pref_get_ssh_loglevel());
934  return result;
935 }
936 
937 static PyObject* remmina_pref_get_ssh_parseconfig_wrapper(PyObject* self, PyObject* plugin)
938 {
939  TRACE_CALL(__func__);
940 
941  PyObject* result = PyLong_FromLong(remmina_pref_get_ssh_parseconfig());
943  return result;
944 }
945 
946 static PyObject* remmina_pref_keymap_get_keyval_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
947 {
948  TRACE_CALL(__func__);
949 
950  static char* kwlist[] = { "keymap", "keyval", NULL };
951  gchar* keymap;
952  guint keyval;
953  PyObject* result = Py_None;
954 
955  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "sl", kwlist, &keymap, &keyval))
956  {
957  return PyLong_FromLong(-1);
958  }
959 
960  if (keymap)
961  {
962  const guint value = remmina_pref_keymap_get_keyval(keymap, keyval);
963  result = PyLong_FromUnsignedLong(value);
964  }
965 
967  return result;
968 }
969 
970 static PyObject* remmina_plugin_python_log_print_wrapper(PyObject* self, PyObject* args)
971 {
972  TRACE_CALL(__func__);
973 
974  gchar* text;
975  if (!PyArg_ParseTuple(args, "s", &text) || !text)
976  {
977  return Py_None;
978  }
979 
980  remmina_log_print(text);
981  return Py_None;
982 }
983 
984 static PyObject* remmina_plugin_python_debug_wrapper(PyObject* self, PyObject* args)
985 {
986  TRACE_CALL(__func__);
987 
988  gchar* text;
989  if (!PyArg_ParseTuple(args, "s", &text) || !text)
990  {
991  return Py_None;
992  }
993 
994  remmina_plugin_manager_service._remmina_debug("python", "%s", text);
995  return Py_None;
996 }
997 
998 static PyObject* remmina_widget_pool_register_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
999 {
1000  TRACE_CALL(__func__);
1001 
1002  static char* kwlist[] = { "widget", NULL };
1003  PyObject* widget;
1004 
1005  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &widget) && widget)
1006  {
1008  }
1009 
1010  return Py_None;
1011 }
1012 
1013 static PyObject* rcw_open_from_file_full_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1014 {
1015  TRACE_CALL(__func__);
1016 
1017  static char* kwlist[] = { "remminafile", "data", "handler", NULL };
1018  PyObject* pyremminafile;
1019  PyObject* data;
1020 
1021  if (PyArg_ParseTupleAndKeywords(args, kwargs, "OOO", kwlist, &pyremminafile, &data) && pyremminafile && data)
1022  {
1023  rcw_open_from_file_full((RemminaFile*)pyremminafile, NULL, (void*)data, NULL);
1024  }
1025 
1026  return Py_None;
1027 }
1028 
1029 static PyObject* remmina_public_get_server_port_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1030 {
1031  TRACE_CALL(__func__);
1032 
1033  static char* kwlist[] = { "server", "defaultport", "host", "port", NULL };
1034  gchar* server;
1035  gint defaultport;
1036 
1037  if (PyArg_ParseTupleAndKeywords(args, kwargs, "slsl", kwlist, &server, &defaultport) && server)
1038  {
1039  gchar* host;
1040  gint port;
1041  remmina_public_get_server_port(server, defaultport, &host, &port);
1042 
1043  PyObject* result = PyList_New(2);
1044  PyList_Append(result, PyUnicode_FromString(host));
1045  PyList_Append(result, PyLong_FromLong(port));
1046  return PyList_AsTuple(result);
1047  }
1048 
1049  return Py_None;
1050 }
1051 
1052 static PyObject* remmina_masterthread_exec_is_main_thread_wrapper(PyObject* self, PyObject* plugin)
1053 {
1054  TRACE_CALL(__func__);
1055 
1056  return PyBool_FromLong(remmina_masterthread_exec_is_main_thread());
1057 }
1058 
1059 static PyObject* remmina_gtksocket_available_wrapper(PyObject* self, PyObject* plugin)
1060 {
1061  TRACE_CALL(__func__);
1062 
1063  return PyBool_FromLong(remmina_gtksocket_available());
1064 }
1065 
1066 static PyObject*
1067 remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1068 {
1069  TRACE_CALL(__func__);
1070 
1071  static char* kwlist[] = { "widget", NULL };
1072  PyPlugin* plugin;
1073 
1074  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &plugin) && plugin && plugin->gp)
1075  {
1077  }
1078 
1079  return Py_None;
1080 }
1081 
1082 static PyObject*
1083 remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1084 {
1085  TRACE_CALL(__func__);
1086 
1087  static char* kwlist[] = { "widget", NULL };
1088  PyPlugin* plugin;
1089 
1090  if (PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &plugin) && plugin && plugin->gp)
1091  {
1093  }
1094 
1095  return Py_None;
1096 }
1097 
1099 {
1100  TRACE_CALL(__func__);
1101 
1103  Py_INCREF(setting);
1104  dest->name = src->name;
1105  dest->label = src->label;
1106  dest->compact = src->compact;
1107  dest->type = src->settingType;
1108  dest->validator = NULL;
1109  dest->validator_data = NULL;
1112 }
1113 
1115 {
1116  TRACE_CALL(__func__);
1117 
1119  Py_INCREF(feature);
1120  dest->id = src->id;
1121  dest->type = src->type;
1122  dest->opt1 = src->opt1->raw;
1123  dest->opt1_type_hint = src->opt1->type_hint;
1124  dest->opt2 = src->opt2->raw;
1125  dest->opt2_type_hint = src->opt2->type_hint;
1126  dest->opt3 = src->opt3->raw;
1127  dest->opt3_type_hint = src->opt3->type_hint;
1128 }
1129 
1130 PyObject* remmina_plugin_python_show_dialog_wrapper(PyObject* self, PyObject* args, PyObject* kwargs)
1131 {
1132  TRACE_CALL(__func__);
1133 
1134  static char* kwlist[] = { "type", "buttons", "message", NULL };
1135  GtkMessageType msgType;
1136  GtkButtonsType btnType;
1137  gchar* message;
1138 
1139  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "lls", kwlist, &msgType, &btnType, &message))
1140  {
1141  return PyLong_FromLong(-1);
1142  }
1143 
1144  remmina_main_show_dialog(msgType, btnType, message);
1145 
1146  return Py_None;
1147 }
1148 
1149 PyObject* remmina_plugin_python_get_mainwindow_wrapper(PyObject* self, PyObject* args)
1150 {
1151  TRACE_CALL(__func__);
1152 
1153  GtkWindow* result = remmina_main_get_window();
1154 
1155  if (!result)
1156  {
1157  return Py_None;
1158  }
1159 
1160  return (PyObject*)new_pywidget((GObject*)result);
1161 }
1162 
1163 static PyObject* remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject* self, PyObject* args)
1164 {
1165  TRACE_CALL(__func__);
1166 
1167  PyObject* pygp = NULL;
1168  if (!PyArg_ParseTuple(args, "O", &pygp) || !pygp)
1169  {
1170  g_printerr("Please provide the Remmina protocol widget instance!");
1171  return Py_None;
1172  }
1173 
1175  return Py_None;
1176 }
1177 
1178 static PyObject* remmina_protocol_plugin_init_auth_wrapper(PyObject* module, PyObject* args, PyObject* kwds)
1179 {
1180  TRACE_CALL(__func__);
1181 
1182  static gchar* keyword_list[] = { "widget", "flags", "title", "default_username", "default_password",
1183  "default_domain", "password_prompt" };
1184 
1186  gint pflags = 0;
1187  gchar* title, * default_username, * default_password, * default_domain, * password_prompt;
1188 
1189  if (PyArg_ParseTupleAndKeywords(args, kwds, "Oisssss", keyword_list, &self, &pflags, &title, &default_username,
1190  &default_password, &default_domain, &password_prompt))
1191  {
1192  if (pflags != 0 && !(pflags & REMMINA_MESSAGE_PANEL_FLAG_USERNAME)
1194  && !(pflags & REMMINA_MESSAGE_PANEL_FLAG_DOMAIN)
1196  {
1197  g_printerr("panel_auth(pflags, title, default_username, default_password, default_domain, password_prompt): "
1198  "%d is not a known value for RemminaMessagePanelFlags!\n", pflags);
1199  }
1200  else
1201  {
1202  return Py_BuildValue("i", remmina_protocol_widget_panel_auth(self
1203  ->gp, pflags, title, default_username, default_password, default_domain, password_prompt));
1204  }
1205  }
1206  else
1207  {
1208  g_printerr("panel_auth(pflags, title, default_username, default_password, default_domain, password_prompt): Error parsing arguments!\n");
1209  PyErr_Print();
1210  }
1211  return Py_None;
1212 }
1213 
1214 static PyObject* remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject* self, PyObject* args)
1215 {
1216  PyObject* pygp = NULL;
1217  if (!PyArg_ParseTuple(args, "O", &pygp) || !pygp)
1218  {
1219  g_printerr("Please provide the Remmina protocol widget instance!");
1220  return Py_None;
1221  }
1222 
1224  return Py_None;
1225 }
void remmina_plugin_python_pref_init(void)
Initializes the Python plugin specialisation for preferences plugins.
gint remmina_pref_get_scale_quality(void)
static PyObject * remmina_pref_get_value_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
PyObject * python_screenshot_data_new(PyTypeObject *type, PyObject *kws, PyObject *args)
PyObject_HEAD RemminaProtocolFeatureType type
PyRemminaFile * remmina_plugin_python_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_pref_keymap_get_keyval_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
Wrapper for a Python object that contains a pointer to an instance of RemminaProtocolFeature.
GtkWindow * remmina_main_get_window()
void remmina_plugin_python_module_init(void)
Initializes all globals and registers the &#39;remmina&#39; module in the Python engine.
gint remmina_protocol_widget_get_profile_remote_width(RemminaProtocolWidget *gp)
static PyObject * remmina_gtksocket_available_wrapper(PyObject *self, PyObject *plugin)
gint remmina_pref_get_sshtunnel_port(void)
gint remmina_protocol_widget_panel_auth(RemminaProtocolWidget *gp, RemminaMessagePanelFlags pflags, const gchar *title, const gchar *default_username, const gchar *default_password, const gchar *default_domain, const gchar *password_prompt)
RemminaTypeHint remmina_plugin_python_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 int python_protocol_setting_init(PyRemminaProtocolSetting *self, PyObject *args, PyObject *kwargs)
Constructor of the remmina.Setting Python type.
Maps an instance of a Python plugin to a Remmina one.
typedefG_BEGIN_DECLS struct _RemminaFile RemminaFile
Definition: types.h:44
static PyObject * remmina_protocol_plugin_init_auth_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
RemminaPluginType type
Definition: plugin.h:55
PyMODINIT_FUNC remmina_plugin_python_module_initialize(void)
Is called from the Python engine when it initializes the &#39;remmina&#39; module.
RemminaSecretPlugin * secret_plugin
PyObject * remmina_plugin_python_generic_type_new(PyTypeObject *type, PyObject *kws, PyObject *args)
GtkWidget * rcw_open_from_file_full(RemminaFile *remminafile, GCallback disconnect_cb, gpointer data, guint *handler)
Definition: rcw.c:4404
void remmina_widget_pool_register(GtkWidget *widget)
static PyObject * remmina_plugin_python_show_dialog_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
void remmina_plugin_python_to_protocol_feature(RemminaProtocolFeature *dest, PyObject *feature)
Converts the PyObject to RemminaProtocolFeature.
static PyObject * remmina_file_get_datadir_wrapper(PyObject *self, PyObject *plugin)
void remmina_plugin_python_secret_init(void)
Initializes the Python plugin specialisation for secret plugins.
gint remmina_pref_get_ssh_loglevel(void)
static RemminaProtocolPlugin remmina_plugin
Definition: exec_plugin.c:280
PyObject_HEAD RemminaProtocolWidget * gp
RemminaPlugin * remmina_plugin_python_create_tool_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginTool, initializes its members and references the wrapper f...
void remmina_plugin_python_remmina_init_types(void)
static PyObject * remmina_protocol_plugin_signal_connection_opened_wrapper(PyObject *self, PyObject *args)
char * remmina_plugin_python_copy_string_from_python(PyObject *string, Py_ssize_t len)
Copies a string from a Python object to a new point in memory.
A struct used to communicate data between Python and C without strict data type.
static PyObject * remmina_protocol_widget_get_profile_remote_height_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
static PyObject * remmina_pref_get_scale_quality_wrapper(PyObject *self, PyObject *plugin)
RemminaFilePlugin * file_plugin
static PyTypeObject python_generic_type
Contains the implementation of the Python module &#39;remmina&#39;, provided to interface with the applicatio...
RemminaProtocolSettingType
Definition: types.h:97
void remmina_pref_set_value(const gchar *key, const gchar *value)
gboolean remmina_plugin_python_check_mandatory_member(PyObject *instance, const gchar *member)
Util function to check if a specific member is define in a Python object.
GtkWidget * get_pywidget(PyObject *obj)
Extracts a GtkWidget from a PyObject instance.
RemminaProtocolPlugin * protocol_plugin
void(* protocol_plugin_signal_connection_closed)(RemminaProtocolWidget *gp)
Definition: plugin.h:171
gboolean remmina_plugin_python_check_error(void)
Checks if an error has occurred and prints it.
PyRemminaProtocolWidget * remmina_plugin_python_protocol_widget_create(void)
Creates a new instance of PyRemminaProtocolWidget and initializes its fields.
static PyObject * remmina_protocol_widget_get_profile_remote_width_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
Contains the specialisation of RemminaPluginFile plugins in Python.
static int python_screenshot_data_init(PyRemminaPluginScreenshotData *self, PyObject *args, PyObject *kwargs)
static PyObject * remmina_plugin_python_get_mainwindow_wrapper(PyObject *self, PyObject *args)
static void remmina_plugin_python_generic_dealloc(PyObject *self)
static PyObject * remmina_pref_get_sshtunnel_port_wrapper(PyObject *self, PyObject *plugin)
static PyObject * remmina_widget_pool_register_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
RemminaToolPlugin * tool_plugin
void(* protocol_plugin_signal_connection_opened)(RemminaProtocolWidget *gp)
Definition: plugin.h:172
static PyObject * remmina_plugin_python_generic_to_bool(PyGeneric *self, PyObject *args)
gchar * remmina_pref_get_value(const gchar *key)
void remmina_plugin_python_file_init(void)
Initializes the Python plugin specialisation for file plugins.
static PyMemberDef python_protocol_feature_members[]
RemminaPlugin * remmina_plugin_python_create_file_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginFile, initializes its members and references the wrapper f...
gboolean remmina_pref_get_ssh_parseconfig(void)
PyRemminaProtocolWidget * gp
static PyObject * python_protocol_setting_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
Initializes the memory and the fields of the remmina.Setting Python type.
gboolean(* register_plugin)(RemminaPlugin *plugin)
Definition: plugin.h:152
gboolean remmina_masterthread_exec_is_main_thread()
static PyObject * rcw_open_from_file_full_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
static PyMethodDef remmina_plugin_python_generic_methods[]
RemminaPluginService remmina_plugin_manager_service
void remmina_main_show_dialog(GtkMessageType msg, GtkButtonsType buttons, const gchar *message)
static PyObject * remmina_plugin_python_debug_wrapper(PyObject *self, PyObject *msg)
static PyObject * remmina_pref_set_value_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
RemminaProtocolFeatureType type
Definition: types.h:73
static int remmina_plugin_python_generic_init(PyGeneric *self, PyObject *args, PyObject *kwargs)
static PyObject * remmina_protocol_plugin_signal_connection_closed_wrapper(PyObject *self, PyObject *args)
static PyTypeObject python_protocol_setting_type
void remmina_plugin_python_entry_init(void)
Initializes the Python plugin specialisation for entry plugins.
void remmina_plugin_python_protocol_widget_type_ready(void)
Initializes Python types used for protocol widgets.
gboolean remmina_gtksocket_available()
RemminaPlugin * remmina_plugin_python_create_pref_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginPref, initializes its members and references the wrapper f...
PyObject_HEAD RemminaProtocolSettingType settingType
static PyObject * remmina_plugin_python_log_print_wrapper(PyObject *self, PyObject *arg)
RemminaTypeHint opt1_type_hint
Definition: types.h:78
PyRemminaPluginScreenshotData * remmina_plugin_python_screenshot_data_new(void)
static PyObject * remmina_pref_get_ssh_loglevel_wrapper(PyObject *self, PyObject *plugin)
static PyMethodDef remmina_python_module_type_methods[]
Declares functions for the Remmina module.
gpointer validator_data
Definition: types.h:123
gchar * remmina_file_get_datadir(void)
Return datadir_path from pref or first found data dir as per XDG specs.
static PyMemberDef remmina_plugin_python_generic_members[]
static PyTypeObject python_protocol_feature_type
static PyObject * remmina_register_plugin_wrapper(PyObject *self, PyObject *plugin)
PyObject * python_protocol_feature_new(PyTypeObject *type, PyObject *kws, PyObject *args)
void remmina_plugin_python_to_protocol_setting(RemminaProtocolSetting *dest, PyObject *setting)
Converts the PyObject to RemminaProtocolSetting.
static PyMemberDef python_screenshot_data_members[]
static PyObject * remmina_pref_get_ssh_parseconfig_wrapper(PyObject *self, PyObject *plugin)
RemminaProtocolSettingType type
Definition: types.h:117
void remmina_plugin_python_tool_init(void)
Initializes the Python plugin specialisation for tool plugins.
RemminaFile * remmina_file_new(void)
Definition: remmina_file.c:93
static PyObject * remmina_plugin_python_generic_to_int(PyGeneric *self, PyObject *args)
guint remmina_pref_keymap_get_keyval(const gchar *keymap, guint keyval)
PyObject_HEAD PyByteArrayObject * buffer
GCallback validator
Definition: types.h:124
RemminaTypeHint type_hint
RemminaTypeHint opt2_type_hint
Definition: types.h:79
static PyObject * remmina_public_get_server_port_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
The Python abstraction of the protocol widget struct.
gint remmina_protocol_widget_get_profile_remote_height(RemminaProtocolWidget *gp)
Contains functions and constants that are commonly used throughout the Python plugin implementation...
static int python_protocol_feature_init(PyRemminaProtocolFeature *self, PyObject *args, PyObject *kwargs)
void * remmina_plugin_python_malloc(int bytes)
Allocates memory and checks for errors before returning.
RemminaPrefPlugin * pref_plugin
Contains the specialisation of RemminaPluginEntry plugins in Python.
RemminaPlugin * remmina_plugin_python_create_protocol_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginProtocol, initializes its members and references the wrapp...
static PyModuleDef remmina_python_module_type
The definition of the Python module &#39;remmina&#39;.
Contains the specialisation of RemminaPluginFile plugins in Python.
void remmina_log_print(const gchar *text)
Definition: remmina_log.c:196
GtkWidget * new_pywidget(GObject *obj)
Creates a new GtkWidget.
static PyObject * remmina_file_new_wrapper(PyObject *self, PyObject *args, PyObject *kwargs)
void remmina_public_get_server_port(const gchar *server, gint defaultport, gchar **host, gint *port)
RemminaPlugin * remmina_plugin_python_create_secret_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginSecret, initializes its members and references the wrapper...
PyGeneric * remmina_plugin_python_generic_new(void)
Creates a new instance of PyGeneric.
static PyTypeObject python_screenshot_data_type
void remmina_plugin_python_protocol_init(void)
Initializes the Python plugin specialisation for protocol plugins.
Adapter struct to handle Remmina protocol settings.
void(* _remmina_debug)(const gchar *func, const gchar *fmt,...)
Definition: plugin.h:222
const gchar * label
Definition: types.h:119
static PyMemberDef python_protocol_setting_type_members[]
Contains the implementation of the widget handling used from the protocol plugin. ...
RemminaTypeHint opt3_type_hint
Definition: types.h:80
static PyObject * remmina_plugin_python_generic_to_string(PyGeneric *self, PyObject *args)
RemminaEntryPlugin * entry_plugin
Contains the specialisation of RemminaPluginFile plugins in Python.
static PyObject * remmina_masterthread_exec_is_main_thread_wrapper(PyObject *self, PyObject *plugin)
const gchar * name
Definition: types.h:118
RemminaPlugin * remmina_plugin_python_create_entry_plugin(PyPlugin *plugin)
Creates a new instance of the RemminaPluginEntry, initializes its members and references the wrapper ...
PyRemminaProtocolFeature * remmina_plugin_python_protocol_feature_new(void)