summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-02-18 18:07:19 +0100
committerHans de Goede <hdegoede@redhat.com>2012-03-06 12:55:30 +0100
commitc8f3a9e843c6ef3038a57b8cfb3efa2f8c7c2901 (patch)
tree9fcf7ea3364cc4e429a6f1f6dc6bbcfcf61d9c28
parentf3ba4036804d2d2d8addcebc5b0b5da51a7c85c1 (diff)
usbredir: Shrink the usb device selection dialog when devices are unplugged
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/virt-viewer-session-spice.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 51ecebf..1d6c592 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -347,6 +347,13 @@ virt_viewer_session_spice_has_usb(VirtViewerSession *session)
SPICE_CHANNEL_USBREDIR);
}
+static void remove_cb(GtkContainer *container G_GNUC_UNUSED,
+ GtkWidget *widget G_GNUC_UNUSED,
+ void *user_data)
+{
+ gtk_window_resize(GTK_WINDOW(user_data), 1, 1);
+}
+
static void
virt_viewer_session_spice_usb_device_selection(VirtViewerSession *session,
GtkWindow *parent)
@@ -369,6 +376,10 @@ virt_viewer_session_spice_usb_device_selection(VirtViewerSession *session,
G_CALLBACK(usb_connect_failed), self);
gtk_box_pack_start(GTK_BOX(area), usb_device_widget, TRUE, TRUE, 5);
+ /* This shrinks the dialog when USB devices are unplugged */
+ g_signal_connect(usb_device_widget, "remove",
+ G_CALLBACK(remove_cb), dialog);
+
/* show and run */
gtk_widget_show_all(dialog);
gtk_dialog_run(GTK_DIALOG(dialog));