Blob Blame History Raw
From c2529913c72a00c5228d02a8e18a3991ac8ba00a Mon Sep 17 00:00:00 2001
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
Date: Fri, 8 Jul 2016 10:30:51 -0300
Subject: [PATCH 09/26] Introduce ISO List dialog

The motivation for this dialog started with rhbz #1310624, where it was
reported that foreign menu was causing too many debug messages to be
printed to the console, because remote viewer had a timeout of 5 seconds
to refresh the ISO list automatically.

As a workaround, the timeout was adjusted for 5 minutes, but it could
cause more problems, such as inconsistencies between what was shown by
remote viewer and what the server had configured.

Another issue caused by displaying the ISO files as a menu item was that
if the list was too long, it would take all the available space on the
screen. In the end, a menu item was not the correct choice of UI
component for this use case.

In order to solve both problems, we now present the ISO list as a
dedicated dialog, where the refresh of ISO list is triggered manually by
the user and the list is contained within the dialog, by displaying de
files in a treeview.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
 po/POTFILES.in                             |   2 +
 src/Makefile.am                            |   3 +
 src/remote-viewer-iso-list-dialog.c        | 365 +++++++++++++++++++++++++++++
 src/remote-viewer-iso-list-dialog.h        |  58 +++++
 src/resources/ui/remote-viewer-iso-list.ui | 158 +++++++++++++
 src/resources/virt-viewer.gresource.xml    |   1 +
 6 files changed, 587 insertions(+)
 create mode 100644 src/remote-viewer-iso-list-dialog.c
 create mode 100644 src/remote-viewer-iso-list-dialog.h
 create mode 100644 src/resources/ui/remote-viewer-iso-list.ui

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 69d9fef..371c242 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,9 +1,11 @@
 data/remote-viewer.appdata.xml.in
 data/remote-viewer.desktop.in
 data/virt-viewer-mime.xml.in
+src/remote-viewer-iso-list-dialog.c
 src/remote-viewer-main.c
 src/remote-viewer.c
 [type: gettext/glade] src/resources/ui/remote-viewer-connect.ui
+[type: gettext/glade] src/resources/ui/remote-viewer-iso-list.ui
 [type: gettext/glade] src/resources/ui/virt-viewer-about.ui
 src/virt-viewer-app.c
 src/virt-viewer-auth.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 272c4ff..9748277 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -13,6 +13,7 @@ noinst_DATA = \
 	resources/ui/virt-viewer-vm-connection.ui \
 	resources/ui/virt-viewer-preferences.ui \
 	resources/ui/remote-viewer-connect.ui \
+	resources/ui/remote-viewer-iso-list.ui \
 	resources/ui/virt-viewer-file-transfer-dialog.ui \
 	$(NULL)
 
@@ -97,6 +98,8 @@ if HAVE_OVIRT
 libvirt_viewer_la_SOURCES += \
 	ovirt-foreign-menu.h \
 	ovirt-foreign-menu.c \
+	remote-viewer-iso-list-dialog.c \
+	remote-viewer-iso-list-dialog.h \
 	$(NULL)
 endif
 
diff --git a/src/remote-viewer-iso-list-dialog.c b/src/remote-viewer-iso-list-dialog.c
new file mode 100644
index 0000000..f23ddb2
--- /dev/null
+++ b/src/remote-viewer-iso-list-dialog.c
@@ -0,0 +1,365 @@
+/*
+ * Virt Viewer: A virtual machine console viewer
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <config.h>
+
+#include <glib/gi18n.h>
+
+#include "remote-viewer-iso-list-dialog.h"
+#include "virt-viewer-util.h"
+#include "ovirt-foreign-menu.h"
+
+static void ovirt_foreign_menu_iso_name_changed(OvirtForeignMenu *foreign_menu, GAsyncResult *result, RemoteViewerISOListDialog *self);
+static void remote_viewer_iso_list_dialog_show_error(RemoteViewerISOListDialog *self, const gchar *message);
+
+G_DEFINE_TYPE(RemoteViewerISOListDialog, remote_viewer_iso_list_dialog, GTK_TYPE_DIALOG)
+
+#define DIALOG_PRIVATE(o) \
+        (G_TYPE_INSTANCE_GET_PRIVATE((o), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG, RemoteViewerISOListDialogPrivate))
+
+struct _RemoteViewerISOListDialogPrivate
+{
+    GtkListStore *list_store;
+    GtkWidget *status;
+    GtkWidget *spinner;
+    GtkWidget *stack;
+    GtkWidget *tree_view;
+    OvirtForeignMenu *foreign_menu;
+};
+
+enum RemoteViewerISOListDialogModel
+{
+    ISO_IS_ACTIVE = 0,
+    ISO_NAME,
+    FONT_WEIGHT,
+};
+
+enum RemoteViewerISOListDialogProperties {
+    PROP_0,
+    PROP_FOREIGN_MENU,
+};
+
+
+void remote_viewer_iso_list_dialog_toggled(GtkCellRendererToggle *cell_renderer, gchar *path, gpointer user_data);
+void remote_viewer_iso_list_dialog_row_activated(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *col, gpointer user_data);
+
+static void
+remote_viewer_iso_list_dialog_dispose(GObject *object)
+{
+    RemoteViewerISOListDialog *self = REMOTE_VIEWER_ISO_LIST_DIALOG(object);
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+
+    if (priv->foreign_menu) {
+        g_signal_handlers_disconnect_by_data(priv->foreign_menu, object);
+        g_clear_object(&priv->foreign_menu);
+    }
+    G_OBJECT_CLASS(remote_viewer_iso_list_dialog_parent_class)->dispose(object);
+}
+
+static void
+remote_viewer_iso_list_dialog_set_property(GObject *object, guint property_id,
+                                           const GValue *value, GParamSpec *pspec)
+{
+    RemoteViewerISOListDialog *self = REMOTE_VIEWER_ISO_LIST_DIALOG(object);
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+
+    switch (property_id) {
+    case PROP_FOREIGN_MENU:
+        priv->foreign_menu = g_value_dup_object(value);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+    }
+}
+
+static void
+remote_viewer_iso_list_dialog_class_init(RemoteViewerISOListDialogClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+    g_type_class_add_private(klass, sizeof(RemoteViewerISOListDialogPrivate));
+
+    object_class->dispose = remote_viewer_iso_list_dialog_dispose;
+    object_class->set_property = remote_viewer_iso_list_dialog_set_property;
+
+    g_object_class_install_property(object_class,
+                                    PROP_FOREIGN_MENU,
+                                    g_param_spec_object("foreign-menu",
+                                                        "oVirt Foreign Menu",
+                                                        "Object which is used as interface to oVirt",
+                                                        OVIRT_TYPE_FOREIGN_MENU,
+                                                        G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+}
+
+static void
+remote_viewer_iso_list_dialog_show_files(RemoteViewerISOListDialog *self)
+{
+    self->priv = DIALOG_PRIVATE(self);
+    gtk_stack_set_visible_child_full(GTK_STACK(self->priv->stack), "iso-list",
+                                     GTK_STACK_TRANSITION_TYPE_NONE);
+    gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, TRUE);
+}
+
+static void
+remote_viewer_iso_list_dialog_foreach(char *name, RemoteViewerISOListDialog *self)
+{
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+    gchar *current_iso = ovirt_foreign_menu_get_current_iso_name(self->priv->foreign_menu);
+    gboolean active = (g_strcmp0(current_iso, name) == 0);
+    gint weight = active ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL;
+    GtkTreeIter iter;
+
+    gtk_list_store_append(priv->list_store, &iter);
+    gtk_list_store_set(priv->list_store, &iter,
+                       ISO_IS_ACTIVE, active,
+                       ISO_NAME, name,
+                       FONT_WEIGHT, weight, -1);
+
+    if (active) {
+        GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(priv->list_store), &iter);
+        gtk_tree_view_set_cursor(GTK_TREE_VIEW(priv->tree_view), path, NULL, FALSE);
+        gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(priv->tree_view), path, NULL, TRUE, 0.5, 0.5);
+        gtk_tree_path_free(path);
+    }
+
+    g_free(current_iso);
+}
+
+static void
+fetch_iso_names_cb(OvirtForeignMenu *foreign_menu,
+                   GAsyncResult *result,
+                   RemoteViewerISOListDialog *self)
+{
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+    GError *error = NULL;
+    GList *iso_list;
+
+    iso_list = ovirt_foreign_menu_fetch_iso_names_finish(foreign_menu, result, &error);
+
+    if (!iso_list) {
+        const gchar *msg = error ? error->message : _("Failed to fetch CD names");
+        gchar *markup = g_strdup_printf("<b>%s</b>", msg);
+
+        gtk_label_set_markup(GTK_LABEL(priv->status), markup);
+        gtk_spinner_stop(GTK_SPINNER(priv->spinner));
+        remote_viewer_iso_list_dialog_show_error(self, msg);
+        gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, TRUE);
+        g_free(markup);
+        g_clear_error(&error);
+        return;
+    }
+
+    g_list_foreach(iso_list, (GFunc) remote_viewer_iso_list_dialog_foreach, self);
+    remote_viewer_iso_list_dialog_show_files(self);
+}
+
+
+static void
+remote_viewer_iso_list_dialog_refresh_iso_list(RemoteViewerISOListDialog *self)
+{
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+
+    gtk_list_store_clear(priv->list_store);
+    ovirt_foreign_menu_fetch_iso_names_async(priv->foreign_menu, NULL,
+                                             (GAsyncReadyCallback) fetch_iso_names_cb,
+                                             self);
+}
+
+static void
+remote_viewer_iso_list_dialog_response(GtkDialog *dialog,
+                                       gint response_id,
+                                       gpointer user_data G_GNUC_UNUSED)
+{
+    RemoteViewerISOListDialog *self = REMOTE_VIEWER_ISO_LIST_DIALOG(dialog);
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+
+    if (response_id != GTK_RESPONSE_NONE)
+        return;
+
+    gtk_spinner_start(GTK_SPINNER(priv->spinner));
+    gtk_label_set_markup(GTK_LABEL(priv->status), _("<b>Loading...</b>"));
+    gtk_stack_set_visible_child_full(GTK_STACK(priv->stack), "status",
+                                     GTK_STACK_TRANSITION_TYPE_NONE);
+    gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, FALSE);
+    remote_viewer_iso_list_dialog_refresh_iso_list(self);
+}
+
+void
+remote_viewer_iso_list_dialog_toggled(GtkCellRendererToggle *cell_renderer G_GNUC_UNUSED,
+                                      gchar *path,
+                                      gpointer user_data)
+{
+    RemoteViewerISOListDialog *self = REMOTE_VIEWER_ISO_LIST_DIALOG(user_data);
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+    GtkTreeModel *model = GTK_TREE_MODEL(priv->list_store);
+    GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
+    GtkTreeIter iter;
+    gboolean active;
+    gchar *name;
+
+    gtk_tree_view_set_cursor(GTK_TREE_VIEW(priv->tree_view), tree_path, NULL, FALSE);
+    gtk_tree_model_get_iter(model, &iter, tree_path);
+    gtk_tree_model_get(model, &iter,
+                       ISO_IS_ACTIVE, &active,
+                       ISO_NAME, &name, -1);
+
+    gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, FALSE);
+    gtk_widget_set_sensitive(priv->tree_view, FALSE);
+
+    ovirt_foreign_menu_set_current_iso_name_async(priv->foreign_menu, active ? NULL : name, NULL,
+                                                  (GAsyncReadyCallback)ovirt_foreign_menu_iso_name_changed,
+                                                  self);
+    gtk_tree_path_free(tree_path);
+    g_free(name);
+}
+
+void
+remote_viewer_iso_list_dialog_row_activated(GtkTreeView *view G_GNUC_UNUSED,
+                                            GtkTreePath *path,
+                                            GtkTreeViewColumn *col G_GNUC_UNUSED,
+                                            gpointer user_data)
+{
+    gchar *path_str = gtk_tree_path_to_string(path);
+    remote_viewer_iso_list_dialog_toggled(NULL, path_str, user_data);
+    g_free(path_str);
+}
+
+static void
+remote_viewer_iso_list_dialog_init(RemoteViewerISOListDialog *self)
+{
+    GtkWidget *content = gtk_dialog_get_content_area(GTK_DIALOG(self));
+    RemoteViewerISOListDialogPrivate *priv = self->priv = DIALOG_PRIVATE(self);
+    GtkBuilder *builder = virt_viewer_util_load_ui("remote-viewer-iso-list.ui");
+    GtkCellRendererToggle *cell_renderer;
+
+    gtk_builder_connect_signals(builder, self);
+
+    priv->status = GTK_WIDGET(gtk_builder_get_object(builder, "status"));
+    priv->spinner = GTK_WIDGET(gtk_builder_get_object(builder, "spinner"));
+    priv->stack = GTK_WIDGET(gtk_builder_get_object(builder, "stack"));
+    gtk_box_pack_start(GTK_BOX(content), priv->stack, TRUE, TRUE, 0);
+
+    priv->list_store = GTK_LIST_STORE(gtk_builder_get_object(builder, "liststore"));
+    priv->tree_view = GTK_WIDGET(gtk_builder_get_object(builder, "view"));
+    cell_renderer = GTK_CELL_RENDERER_TOGGLE(gtk_builder_get_object(builder, "cellrenderertoggle"));
+    gtk_cell_renderer_toggle_set_radio(cell_renderer, TRUE);
+    gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(cell_renderer), 6, 6);
+
+    g_object_unref(builder);
+
+    gtk_dialog_add_buttons(GTK_DIALOG(self),
+                           _("Refresh"), GTK_RESPONSE_NONE,
+                           _("Close"), GTK_RESPONSE_CLOSE,
+                           NULL);
+
+    gtk_dialog_set_default_response(GTK_DIALOG(self), GTK_RESPONSE_CLOSE);
+    gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, FALSE);
+    g_signal_connect(self, "response", G_CALLBACK(remote_viewer_iso_list_dialog_response), NULL);
+}
+
+static void
+remote_viewer_iso_list_dialog_show_error(RemoteViewerISOListDialog *self,
+                                         const gchar *message)
+{
+    GtkWidget *dialog;
+
+    g_warn_if_fail(message != NULL);
+
+    dialog = gtk_message_dialog_new(GTK_WINDOW(self),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_ERROR,
+                                    GTK_BUTTONS_CLOSE,
+                                    message ? message : _("Unspecified error"));
+    gtk_dialog_run(GTK_DIALOG(dialog));
+    gtk_widget_destroy(dialog);
+}
+
+static void
+ovirt_foreign_menu_iso_name_changed(OvirtForeignMenu *foreign_menu,
+                                    GAsyncResult *result,
+                                    RemoteViewerISOListDialog *self)
+{
+    RemoteViewerISOListDialogPrivate *priv = self->priv;
+    GtkTreeModel *model = GTK_TREE_MODEL(priv->list_store);
+    gchar *current_iso;
+    GtkTreeIter iter;
+    gchar *name;
+    gboolean active, match = FALSE;
+    GError *error = NULL;
+
+    /* In the case of error, don't return early, because it is necessary to
+     * change the ISO back to the original, avoiding a possible inconsistency.
+     */
+    if (!ovirt_foreign_menu_set_current_iso_name_finish(foreign_menu, result, &error)) {
+        remote_viewer_iso_list_dialog_show_error(self, error ? error->message : _("Failed to change CD"));
+        g_clear_error(&error);
+    }
+
+    if (!gtk_tree_model_get_iter_first(model, &iter))
+        return;
+
+    current_iso = ovirt_foreign_menu_get_current_iso_name(foreign_menu);
+
+    do {
+        gtk_tree_model_get(model, &iter,
+                           ISO_IS_ACTIVE, &active,
+                           ISO_NAME, &name, -1);
+        match = (g_strcmp0(current_iso, name) == 0);
+
+        /* iso is not active anymore */
+        if (active && !match) {
+            gtk_list_store_set(priv->list_store, &iter,
+                               ISO_IS_ACTIVE, FALSE,
+                               FONT_WEIGHT, PANGO_WEIGHT_NORMAL, -1);
+        } else if (match) {
+            gtk_list_store_set(priv->list_store, &iter,
+                               ISO_IS_ACTIVE, TRUE,
+                               FONT_WEIGHT, PANGO_WEIGHT_BOLD, -1);
+        }
+
+        g_free(name);
+    } while (gtk_tree_model_iter_next(model, &iter));
+
+    gtk_dialog_set_response_sensitive(GTK_DIALOG(self), GTK_RESPONSE_NONE, TRUE);
+    gtk_widget_set_sensitive(priv->tree_view, TRUE);
+    g_free(current_iso);
+}
+
+GtkWidget *
+remote_viewer_iso_list_dialog_new(GtkWindow *parent, GObject *foreign_menu)
+{
+    GtkWidget *dialog;
+    RemoteViewerISOListDialog *self;
+
+    g_return_val_if_fail(foreign_menu != NULL, NULL);
+
+    dialog = g_object_new(REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG,
+                          "title", _("Change CD"),
+                          "transient-for", parent,
+                          "border-width", 18,
+                          "default-width", 400,
+                          "default-height", 300,
+                          "foreign-menu", foreign_menu,
+                          NULL);
+
+    self = REMOTE_VIEWER_ISO_LIST_DIALOG(dialog);
+    remote_viewer_iso_list_dialog_refresh_iso_list(self);
+    return dialog;
+}
diff --git a/src/remote-viewer-iso-list-dialog.h b/src/remote-viewer-iso-list-dialog.h
new file mode 100644
index 0000000..480777c
--- /dev/null
+++ b/src/remote-viewer-iso-list-dialog.h
@@ -0,0 +1,58 @@
+/*
+ * Virt Viewer: A virtual machine console viewer
+ *
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __REMOTE_VIEWER_ISO_LIST_DIALOG_H__
+#define __REMOTE_VIEWER_ISO_LIST_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG remote_viewer_iso_list_dialog_get_type()
+
+#define REMOTE_VIEWER_ISO_LIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG, RemoteViewerISOListDialog))
+#define REMOTE_VIEWER_ISO_LIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG, RemoteViewerISOListDialogClass))
+#define REMOTE_VIEWER_IS_ISO_LIST_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG))
+#define REMOTE_VIEWER_IS_ISO_LIST_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG))
+#define REMOTE_VIEWER_ISO_LIST_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), REMOTE_VIEWER_TYPE_ISO_LIST_DIALOG, RemoteViewerISOListDialogClass))
+
+typedef struct _RemoteViewerISOListDialog RemoteViewerISOListDialog;
+typedef struct _RemoteViewerISOListDialogClass RemoteViewerISOListDialogClass;
+typedef struct _RemoteViewerISOListDialogPrivate RemoteViewerISOListDialogPrivate;
+
+struct _RemoteViewerISOListDialog
+{
+    GtkDialog parent;
+
+    RemoteViewerISOListDialogPrivate *priv;
+};
+
+struct _RemoteViewerISOListDialogClass
+{
+    GtkDialogClass parent_class;
+};
+
+GType remote_viewer_iso_list_dialog_get_type(void) G_GNUC_CONST;
+
+GtkWidget *remote_viewer_iso_list_dialog_new(GtkWindow *parent, GObject *foreign_menu);
+
+G_END_DECLS
+
+#endif /* __REMOTE_VIEWER_ISO_LIST_DIALOG_H__ */
diff --git a/src/resources/ui/remote-viewer-iso-list.ui b/src/resources/ui/remote-viewer-iso-list.ui
new file mode 100644
index 0000000..ab1bdc4
--- /dev/null
+++ b/src/resources/ui/remote-viewer-iso-list.ui
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <object class="GtkListStore" id="liststore">
+    <columns>
+      <!-- column-name selected -->
+      <column type="gboolean"/>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name weight -->
+      <column type="gint"/>
+    </columns>
+  </object>
+  <object class="GtkStack" id="stack">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="status">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Loading...</property>
+            <property name="yalign">1</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSpinner" id="spinner">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="active">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="name">status</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Select ISO</property>
+            <property name="xalign">0</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkAlignment" id="alignment">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="bottom_padding">6</property>
+            <child>
+              <object class="GtkScrolledWindow">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="view">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="model">liststore</property>
+                    <property name="headers_visible">False</property>
+                    <property name="rules_hint">True</property>
+                    <property name="search_column">1</property>
+                    <property name="enable_grid_lines">horizontal</property>
+                    <signal name="row-activated" handler="remote_viewer_iso_list_dialog_row_activated" swapped="no"/>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection"/>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="selected_column">
+                        <property name="sizing">autosize</property>
+                        <property name="title" translatable="yes">Selected</property>
+                        <child>
+                          <object class="GtkCellRendererToggle" id="cellrenderertoggle">
+                            <signal name="toggled" handler="remote_viewer_iso_list_dialog_toggled" swapped="no"/>
+                          </object>
+                          <attributes>
+                            <attribute name="active">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="name_column">
+                        <property name="title" translatable="yes">Name</property>
+                        <property name="expand">True</property>
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderertext"/>
+                          <attributes>
+                            <attribute name="text">1</attribute>
+                            <attribute name="weight">2</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="name">iso-list</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/src/resources/virt-viewer.gresource.xml b/src/resources/virt-viewer.gresource.xml
index f9b4a9f..334fa47 100644
--- a/src/resources/virt-viewer.gresource.xml
+++ b/src/resources/virt-viewer.gresource.xml
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/virt-manager/virt-viewer">
     <file>ui/remote-viewer-connect.ui</file>
+    <file>ui/remote-viewer-iso-list.ui</file>
     <file>ui/virt-viewer-about.ui</file>
     <file>ui/virt-viewer-auth.ui</file>
     <file>ui/virt-viewer-guest-details.ui</file>
-- 
2.12.0