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.
spice_plugin_usb.c
Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2016-2018 Denis Ollier
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  */
34 
35 #include "spice_plugin.h"
36 
37 static void remmina_plugin_spice_usb_connect_failed_cb(GObject *, SpiceUsbDevice *, GError *, RemminaProtocolWidget *);
38 
40 {
41  TRACE_CALL(__func__);
42 
43  GtkWidget *dialog, *usb_device_widget;
44  RemminaPluginSpiceData *gpdata = GET_PLUGIN_DATA(gp);
45 
46  /*
47  * FIXME: Use the RemminaConnectionWindow as transient parent widget
48  * (and add the GTK_DIALOG_DESTROY_WITH_PARENT flag) if it becomes
49  * accessible from the Remmina plugin API.
50  */
51  dialog = gtk_dialog_new_with_buttons(_("Select USB devices for redirection"),
52  NULL,
53  GTK_DIALOG_MODAL,
54  _("_Close"),
55  GTK_RESPONSE_ACCEPT,
56  NULL);
57  gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
58 
59  usb_device_widget = spice_usb_device_widget_new(gpdata->session, NULL);
60  g_signal_connect(usb_device_widget,
61  "connect-failed",
63  gp);
64 
65  gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
66  usb_device_widget,
67  TRUE,
68  TRUE,
69  0);
70  gtk_widget_show_all(dialog);
71  gtk_dialog_run(GTK_DIALOG(dialog));
72  gtk_widget_destroy(dialog);
73 }
74 
75 static void remmina_plugin_spice_usb_connect_failed_cb(GObject *object, SpiceUsbDevice *usb_device, GError *error, RemminaProtocolWidget *gp)
76 {
77  TRACE_CALL(__func__);
78 
79  GtkWidget *dialog;
80 
81  if (error->domain == G_IO_ERROR && error->code == G_IO_ERROR_CANCELLED) {
82  return;
83  }
84 
85  /*
86  * FIXME: Use the RemminaConnectionWindow as transient parent widget
87  * (and add the GTK_DIALOG_DESTROY_WITH_PARENT flag) if it becomes
88  * accessible from the Remmina plugin API.
89  */
90  dialog = gtk_message_dialog_new(NULL,
91  GTK_DIALOG_MODAL,
92  GTK_MESSAGE_ERROR,
93  GTK_BUTTONS_CLOSE,
94  _("USB redirection error"));
95  gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
96  "%s",
97  error->message);
98  gtk_dialog_run(GTK_DIALOG(dialog));
99  gtk_widget_destroy(dialog);
100 }
static void remmina_plugin_spice_usb_connect_failed_cb(GObject *, SpiceUsbDevice *, GError *, RemminaProtocolWidget *)
SpiceSession * session
Definition: spice_plugin.h:82
void remmina_plugin_spice_select_usb_devices(RemminaProtocolWidget *gp)