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_common.h File Reference

Contains functions and constants that are commonly used throughout the Python plugin implementation. More...

Go to the source code of this file.

Data Structures

struct  PyRemminaProtocolWidget
 The Python abstraction of the protocol widget struct. More...
 
struct  PyPlugin
 Maps an instance of a Python plugin to a Remmina one. More...
 
struct  PyGeneric
 A struct used to communicate data between Python and C without strict data type. More...
 

Functions

PyGenericremmina_plugin_python_generic_new (void)
 Creates a new instance of PyGeneric. More...
 
void remmina_plugin_python_add_plugin (PyPlugin *plugin)
 Registers the given plugin if no other plugin with the same name has been already registered. More...
 
void remmina_plugin_python_set_service (RemminaPluginService *service)
 Sets the pointer to the plugin service of Remmina. More...
 
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 determined. More...
 
PyObject * remmina_plugin_python_last_result (void)
 Gets the result of the last python method call. More...
 
PyObject * remmina_plugin_python_last_result_set (PyObject *result)
 Sets the result of the last python method call. More...
 
void remmina_plugin_python_log_method_call (PyObject *instance, const char *method)
 Prints a log message to inform the user a python message has been called. More...
 
gboolean remmina_plugin_python_check_error (void)
 Checks if an error has occurred and prints it. More...
 
long remmina_plugin_python_get_attribute_long (PyObject *instance, const char *attr_name, long def)
 Gets the attribute as long value. More...
 
gboolean remmina_plugin_python_check_attribute (PyObject *instance, const char *attr_name)
 Checks if a given attribute exists. More...
 
void * remmina_plugin_python_malloc (int bytes)
 Allocates memory and checks for errors before returning. More...
 
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. More...
 
PyPluginremmina_plugin_python_get_plugin (const char *name)
 Tries to find the Python plugin matching to the given instance of RemminaPlugin. More...
 
GtkWidget * new_pywidget (GObject *obj)
 Creates a new GtkWidget. More...
 
GtkWidget * get_pywidget (PyObject *obj)
 Extracts a GtkWidget from a PyObject instance. More...
 
void init_pygobject (void)
 Initializes the pygobject library. More...
 

Variables

G_BEGIN_DECLS const char * ATTR_NAME
 
const char * ATTR_ICON_NAME
 
const char * ATTR_DESCRIPTION
 
const char * ATTR_VERSION
 
const char * ATTR_ICON_NAME_SSH
 
const char * ATTR_FEATURES
 
const char * ATTR_BASIC_SETTINGS
 
const char * ATTR_ADVANCED_SETTINGS
 
const char * ATTR_SSH_SETTING
 
const char * ATTR_EXPORT_HINTS
 
const char * ATTR_PREF_LABEL
 
const char * ATTR_INIT_ORDER
 

Detailed Description

Contains functions and constants that are commonly used throughout the Python plugin implementation.

These functions should not be used outside of the Python plugin implementation, since everything is intended to be used with the Python engine.

Definition in file remmina_plugin_python_common.h.

Function Documentation

◆ get_pywidget()

GtkWidget* get_pywidget ( PyObject *  obj)

Extracts a GtkWidget from a PyObject instance.

Parameters
obj
Returns

Definition at line 309 of file remmina_plugin_python_common.c.

◆ init_pygobject()

void init_pygobject ( void  )

Initializes the pygobject library.

This needs to be called before any Python plugin is being initialized.

Definition at line 299 of file remmina_plugin_python_common.c.

◆ new_pywidget()

GtkWidget* new_pywidget ( GObject *  obj)

Creates a new GtkWidget.

Parameters
obj
Returns

Definition at line 304 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_add_plugin()

void remmina_plugin_python_add_plugin ( PyPlugin plugin)

Registers the given plugin if no other plugin with the same name has been already registered.

Definition at line 204 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_check_attribute()

gboolean remmina_plugin_python_check_attribute ( PyObject *  instance,
const char *  attr_name 
)

Checks if a given attribute exists.

Parameters
instanceThe object to check for the attribute.
attr_nameThe name of the attribute to check.
Returns
Returns TRUE if the attribute exists.

Definition at line 139 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_check_error()

gboolean remmina_plugin_python_check_error ( void  )

Checks if an error has occurred and prints it.

Returns
Returns TRUE if an error has occurred.

Definition at line 98 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_copy_string_from_python()

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.

Parameters
stringThe python object, containing the string to copy.
lenThe length of the string to copy.
Returns
A char pointer to the new copy of the string.

Definition at line 172 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_generic_new()

PyGeneric* remmina_plugin_python_generic_new ( void  )

Creates a new instance of PyGeneric.

Definition at line 559 of file remmina_plugin_python_remmina.c.

◆ remmina_plugin_python_get_attribute_long()

long remmina_plugin_python_get_attribute_long ( PyObject *  instance,
const char *  attr_name,
long  def 
)

Gets the attribute as long value.

Parameters
instanceThe instance of the object to get the attribute.
constant_nameThe name of the attribute to get.
defThe value to return if the attribute doesn't exist or is not set.
Returns
The value attribute as long.

Definition at line 124 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_get_plugin()

PyPlugin* remmina_plugin_python_get_plugin ( const char *  name)

Tries to find the Python plugin matching to the given instance of RemminaPlugin.

Parameters
plugin_mapAn array of PyPlugin pointers to search.
instanceThe RemminaPlugin instance to find the correct PyPlugin instance for.
Returns
A pointer to a PyPlugin instance if successful. Otherwise NULL is returned.

Definition at line 280 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_last_result()

PyObject* remmina_plugin_python_last_result ( void  )

Gets the result of the last python method call.

Definition at line 84 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_last_result_set()

PyObject* remmina_plugin_python_last_result_set ( PyObject *  result)

Sets the result of the last python method call.

Returns
Returns the passed result (it's done to be compatible with the CallPythonMethod macro).

Definition at line 91 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_log_method_call()

void remmina_plugin_python_log_method_call ( PyObject *  instance,
const char *  method 
)

Prints a log message to inform the user a python message has been called.

This method is called from the CALL_PYTHON macro if WITH_PYTHON_TRACE_CALLS is defined.

Parameters
instanceThe instance that contains the called method.
methodThe name of the method called.

Definition at line 111 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_malloc()

void* remmina_plugin_python_malloc ( int  bytes)

Allocates memory and checks for errors before returning.

Parameters
bytesAmount of bytes to allocate.
Returns
Address to the allocated memory.

Definition at line 154 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_set_service()

void remmina_plugin_python_set_service ( RemminaPluginService service)

Sets the pointer to the plugin service of Remmina.

Definition at line 194 of file remmina_plugin_python_common.c.

◆ remmina_plugin_python_to_generic()

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 determined.

Definition at line 224 of file remmina_plugin_python_common.c.

Variable Documentation

◆ ATTR_ADVANCED_SETTINGS

const char* ATTR_ADVANCED_SETTINGS

Definition at line 68 of file remmina_plugin_python_common.c.

◆ ATTR_BASIC_SETTINGS

const char* ATTR_BASIC_SETTINGS

Definition at line 67 of file remmina_plugin_python_common.c.

◆ ATTR_DESCRIPTION

const char* ATTR_DESCRIPTION

Definition at line 63 of file remmina_plugin_python_common.c.

◆ ATTR_EXPORT_HINTS

const char* ATTR_EXPORT_HINTS

Definition at line 70 of file remmina_plugin_python_common.c.

◆ ATTR_FEATURES

const char* ATTR_FEATURES

Definition at line 66 of file remmina_plugin_python_common.c.

◆ ATTR_ICON_NAME

const char* ATTR_ICON_NAME

Definition at line 62 of file remmina_plugin_python_common.c.

◆ ATTR_ICON_NAME_SSH

const char* ATTR_ICON_NAME_SSH

Definition at line 65 of file remmina_plugin_python_common.c.

◆ ATTR_INIT_ORDER

const char* ATTR_INIT_ORDER

Definition at line 72 of file remmina_plugin_python_common.c.

◆ ATTR_NAME

G_BEGIN_DECLS const char* ATTR_NAME

Definition at line 61 of file remmina_plugin_python_common.c.

◆ ATTR_PREF_LABEL

const char* ATTR_PREF_LABEL

Definition at line 71 of file remmina_plugin_python_common.c.

◆ ATTR_SSH_SETTING

const char* ATTR_SSH_SETTING

Definition at line 69 of file remmina_plugin_python_common.c.

◆ ATTR_VERSION

const char* ATTR_VERSION

Definition at line 64 of file remmina_plugin_python_common.c.