[virt-tools-list] [PATCH virt-viewer 09/11] Run iso-dialog when 'Change CD' menu is activated
Eduardo Lima (Etrunko)
etrunko at redhat.com
Mon Jul 18 02:13:09 UTC 2016
Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---
src/resources/ui/virt-viewer.ui | 1 +
src/virt-viewer-window.c | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/src/resources/ui/virt-viewer.ui b/src/resources/ui/virt-viewer.ui
index ee23ba5..e27ee77 100644
--- a/src/resources/ui/virt-viewer.ui
+++ b/src/resources/ui/virt-viewer.ui
@@ -73,6 +73,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Change CD</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="virt_viewer_window_menu_change_cd_activate" swapped="no"/>
</object>
</child>
<child>
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 7e6b93f..867fb86 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -43,6 +43,8 @@
#include "virt-viewer-util.h"
#include "virt-viewer-timed-revealer.h"
+#include "remote-viewer-iso-list-dialog.h"
+
#define ZOOM_STEP 10
/* Signal handlers for main window (move in a VirtViewerMainWindow?) */
@@ -62,6 +64,7 @@ void virt_viewer_window_menu_file_smartcard_insert(GtkWidget *menu, VirtViewerWi
void virt_viewer_window_menu_file_smartcard_remove(GtkWidget *menu, VirtViewerWindow *self);
void virt_viewer_window_menu_view_release_cursor(GtkWidget *menu, VirtViewerWindow *self);
void virt_viewer_window_menu_preferences_cb(GtkWidget *menu, VirtViewerWindow *self);
+void virt_viewer_window_menu_change_cd_activate(GtkWidget *menu, VirtViewerWindow *self);
/* Internal methods */
@@ -1052,6 +1055,32 @@ virt_viewer_window_menu_help_about(GtkWidget *menu G_GNUC_UNUSED,
g_object_unref(G_OBJECT(about));
}
+static void
+iso_dialog_response(GtkDialog *dialog,
+ gint response_id,
+ GtkWidget **dialog_ptr) {
+ if (response_id == GTK_RESPONSE_NONE)
+ return;
+
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+ *dialog_ptr = NULL;
+}
+
+void
+virt_viewer_window_menu_change_cd_activate(GtkWidget *menu G_GNUC_UNUSED,
+ VirtViewerWindow *self)
+{
+ VirtViewerWindowPrivate *priv = self->priv;
+ static GtkWidget *dialog = NULL;
+
+ if (dialog)
+ return;
+
+ dialog = remote_viewer_iso_list_dialog_new(GTK_WINDOW(priv->window));
+ g_signal_connect(dialog, "response", G_CALLBACK(iso_dialog_response), &dialog);
+ gtk_widget_show_all(dialog);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+}
static void
virt_viewer_window_toolbar_setup(VirtViewerWindow *self)
--
2.7.4
More information about the virt-tools-list
mailing list