[virt-tools-list] [PATCH 15/22] app: append VTE consoles to display submenu

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Tue Jul 31 13:41:18 UTC 2018


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Get the name of the console, and set the subtitle with it.

Rename "set_title" to "set_subtitle" while at it, since it is more
appropriate.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/virt-viewer-app.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index a14c92d..50d1e6c 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -2334,6 +2334,26 @@ window_update_menu_displays_cb(gpointer value,
         tmp = tmp->next;
     }
 
+    for (GList *l = self->priv->windows; l; l = l->next) {
+        VirtViewerWindow *win = VIRT_VIEWER_WINDOW(l->data);
+        VirtViewerDisplay *display = virt_viewer_window_get_display(win);
+
+        if (VIRT_VIEWER_IS_DISPLAY_VTE(display)) {
+            gchar *name = NULL;
+            GtkWidget *item;
+
+            g_object_get(display, "name", &name, NULL);
+            item = gtk_check_menu_item_new_with_label(name);
+            g_free(name);
+
+            virt_viewer_signal_connect_object(G_OBJECT(item), "toggled",
+                G_CALLBACK(menu_display_visible_toggled_cb), display, 0);
+            gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item),
+                gtk_widget_get_visible(GTK_WIDGET(virt_viewer_window_get_window(win))));
+            gtk_menu_shell_append(submenu, item);
+        }
+    }
+
     gtk_widget_show_all(GTK_WIDGET(submenu));
     g_list_free(keys);
 }
-- 
2.18.0.321.gffc6fa0e39




More information about the virt-tools-list mailing list