Remmina - The GTK+ Remote Desktop Client  v1.4.33
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.
plugin.c
Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2010 Vic Lee
4  * Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo
5  * Copyright (C) 2016-2023 Antenore Gatta, Giovanni Panozzo
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  * In addition, as a special exception, the copyright holders give
23  * permission to link the code of portions of this program with the
24  * OpenSSL library under certain conditions as described in each
25  * individual source file, and distribute linked combinations
26  * including the two.
27  * You must obey the GNU General Public License in all respects
28  * for all of the code used other than OpenSSL. * If you modify
29  * file(s) with this exception, you may extend this exception to your
30  * version of the file(s), but you are not obligated to do so. * If you
31  * do not wish to do so, delete this exception statement from your
32  * version. * If you delete this exception statement from all source
33  * files in the program, then also delete it here.
34  *
35  */
36 
37 #include "plugin_config.h"
38 
39 #include "common/remmina_plugin.h"
40 
42 #define REMMINA_PLUGIN_DEBUG(fmt, ...) remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__)
43 
45 {
46  TRACE_CALL(__func__);
47  REMMINA_PLUGIN_DEBUG("[%s] Plugin init", PLUGIN_NAME);
48 }
49 
51 {
52  TRACE_CALL(__func__);
53  REMMINA_PLUGIN_DEBUG("[%s] Plugin open connection", PLUGIN_NAME);
54 
55  GtkDialog *dialog;
56  dialog = GTK_DIALOG(gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL | GTK_DIALOG_USE_HEADER_BAR,
57  GTK_MESSAGE_INFO, GTK_BUTTONS_OK, PLUGIN_DESCRIPTION));
58  gtk_dialog_run(dialog);
59  gtk_widget_destroy(GTK_WIDGET(dialog));
60  return FALSE;
61 }
62 
64 {
65  TRACE_CALL(__func__);
66  REMMINA_PLUGIN_DEBUG("[%s] Plugin close connection", PLUGIN_NAME);
67  remmina_plugin_service->protocol_plugin_emit_signal(gp, "disconnect");
68  return FALSE;
69 }
70 
71 /* Array of RemminaProtocolSetting for basic settings.
72  * Each item is composed by:
73  * a) RemminaProtocolSettingType for setting type
74  * b) Setting name
75  * c) Setting description
76  * d) Compact disposition
77  * e) Values for REMMINA_PROTOCOL_SETTING_TYPE_SELECT or REMMINA_PROTOCOL_SETTING_TYPE_COMBO
78  * f) Setting tooltip
79  * g) Validation data pointer, will be passed to the validation callback method.
80  * h) Validation callback method (Can be NULL. Every entry will be valid then.)
81  * use following prototype:
82  * gboolean mysetting_validator_method(gpointer key, gpointer value,
83  * gpointer validator_data);
84  * gpointer key is a gchar* containing the setting's name,
85  * gpointer value contains the value which should be validated,
86  * gpointer validator_data contains your passed data.
87  */
89 {
90  { REMMINA_PROTOCOL_SETTING_TYPE_END, NULL, NULL, FALSE, NULL, NULL, NULL, NULL }
91 };
92 
93 /* Protocol plugin definition and features */
96  PLUGIN_NAME, // Name
97  PLUGIN_DESCRIPTION, // Description
98  GETTEXT_PACKAGE, // Translation domain
99  PLUGIN_VERSION, // Version number
100  PLUGIN_APPICON, // Icon for normal connection
101  PLUGIN_APPICON, // Icon for SSH connection
102  remmina_plugin_tool_basic_settings, // Array for basic settings
103  NULL, // Array for advanced settings
104  REMMINA_PROTOCOL_SSH_SETTING_NONE, // SSH settings type
105  NULL, // Array for available features
106  remmina_plugin_tool_init, // Plugin initialization
107  remmina_plugin_tool_open_connection, // Plugin open connection
108  remmina_plugin_tool_close_connection, // Plugin close connection
109  NULL, // Query for available features
110  NULL, // Call a feature
111  NULL, // Send a keystroke
112  NULL, // No screenshot support available
113  NULL, // RCW map event
114  NULL // RCW unmap event
115 };
116 
117 G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService *service)
118 {
119  TRACE_CALL(__func__);
120  remmina_plugin_service = service;
121 
122  bindtextdomain(GETTEXT_PACKAGE, REMMINA_RUNTIME_LOCALEDIR);
123  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
124 
125  if (!service->register_plugin((RemminaPlugin*)&remmina_plugin)) {
126  return FALSE;
127  }
128 
129  return TRUE;
130 }
static const RemminaProtocolSetting remmina_plugin_tool_basic_settings[]
Definition: plugin.c:88
static void remmina_plugin_tool_init(RemminaProtocolWidget *gp)
Definition: plugin.c:44
gboolean(* register_plugin)(RemminaPlugin *plugin)
Definition: plugin.h:166
static gboolean remmina_plugin_tool_open_connection(RemminaProtocolWidget *gp)
Definition: plugin.c:50
G_MODULE_EXPORT gboolean remmina_plugin_entry(RemminaPluginService *service)
Definition: plugin.c:117
static RemminaProtocolPlugin remmina_plugin
Definition: plugin.c:94
static gboolean remmina_plugin_tool_close_connection(RemminaProtocolWidget *gp)
Definition: plugin.c:63
void(* protocol_plugin_emit_signal)(RemminaProtocolWidget *gp, const gchar *signal_name)
Definition: plugin.h:179
static RemminaPluginService * remmina_plugin_service
Definition: plugin.c:41