[virt-tools-list] [PATCH v2 virt-viewer] Don't disable "send key" menu when display isn't ready

Jonathon Jongsma jjongsma at redhat.com
Thu Oct 16 14:07:58 UTC 2014


The ability to send a keystroke should not depend on whether a display
is ready or not, it only depends on whether the display exists or not.

See https://bugzilla.redhat.com/show_bug.cgi?id=1152574
---

Changes since v1:
- rebased on git master

 src/virt-viewer-window.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index df4a200..c5f7c75 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -206,7 +206,7 @@ rebuild_combo_menu(GObject    *gobject G_GNUC_UNUSED,
     menu = GTK_WIDGET(gtk_builder_get_object(self->priv->builder, "menu-send"));
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu),
                               GTK_WIDGET(virt_viewer_window_get_keycombo_menu(self)));
-    gtk_widget_set_sensitive(menu, FALSE);
+    gtk_widget_set_sensitive(menu, (self->priv->display != NULL));
 }
 
 static void
@@ -1268,9 +1268,7 @@ display_show_hint(VirtViewerDisplay *display,
 
     hint = (hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_READY);
 
-    gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(self->priv->builder, "menu-send")), hint);
     gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(self->priv->builder, "menu-file-screenshot")), hint);
-    gtk_widget_set_sensitive(self->priv->toolbar_send_key, hint);
 }
 static gboolean
 window_key_pressed (GtkWidget *widget G_GNUC_UNUSED,
@@ -1332,6 +1330,9 @@ virt_viewer_window_set_display(VirtViewerWindow *self, VirtViewerDisplay *displa
 
         if (virt_viewer_display_get_enabled(display))
             virt_viewer_window_desktop_resize(display, self);
+
+        gtk_widget_set_sensitive(GTK_WIDGET(gtk_builder_get_object(self->priv->builder, "menu-send")), TRUE);
+        gtk_widget_set_sensitive(self->priv->toolbar_send_key, TRUE);
     }
 }
 
-- 
1.9.3




More information about the virt-tools-list mailing list