[virt-tools-list] [remote-viewer PATCH 6/7 v2] remote-viewer-connect: Fixed reselecting in recent chooser

Lukas Venhoda lvenhoda at redhat.com
Thu Jun 11 14:28:41 UTC 2015


Recent chooser didn't unselect on loosing focus.
Selecting recent connection, then modifying address in entry and
doubleclicking on the same recent connection caused remote-viewer to
connect to address in the entry,

Recent chooser now unselects on loosing focus, forcing to re-select when
doubleclicking the recent connection, which will now properly set the
address to connect to.
---
Changes since v1
 - New patch
 - Split from the v1 patch as requested
---
 src/remote-viewer-connect.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/remote-viewer-connect.c b/src/remote-viewer-connect.c
index 85bd8cc..194104e 100644
--- a/src/remote-viewer-connect.c
+++ b/src/remote-viewer-connect.c
@@ -97,6 +97,14 @@ entry_changed_cb(GtkEditable* entry, gpointer data G_GNUC_UNUSED)
                  NULL);
 }

+static gboolean
+entry_focus_in_cb(GtkWidget *widget G_GNUC_UNUSED, GdkEvent *event G_GNUC_UNUSED, gpointer data)
+{
+    GtkRecentChooser *recent = data;
+    gtk_recent_chooser_unselect_all(recent);
+    return FALSE;
+}
+
 static void
 entry_activated_cb(GtkEntry *entry G_GNUC_UNUSED, gpointer data)
 {
@@ -209,6 +217,8 @@ remote_viewer_connect_dialog(gchar **uri)
                      G_CALLBACK(recent_selection_changed_dialog_cb), entry);
     g_signal_connect(recent, "item-activated",
                      G_CALLBACK(recent_item_activated_dialog_cb), &ci);
+    g_signal_connect(entry, "focus-in-event",
+                     G_CALLBACK(entry_focus_in_cb), recent);

     /* show and wait for response */
     gtk_widget_show_all(window);
--
2.4.2




More information about the virt-tools-list mailing list