[Spice-devel] [spicy PATCH 4/5 v3] spicy: Fixed reselecting in recent chooser

Lukas Venhoda lvenhoda at redhat.com
Mon Jun 15 05:31:38 PDT 2015


Recent chooser didn't unselect on loosing focus.
Selecting recent connection, then modifying the
entries and doubleclicking on the same recent
connection caused spicy to connect to address
in the entry, instead of the one in recent chooser.

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 v2
 - New patch
 - Split from the v2 patch as requested
---
 src/spicy-connect.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/spicy-connect.c b/src/spicy-connect.c
index 3d3a31f..b803bf1 100644
--- a/src/spicy-connect.c
+++ b/src/spicy-connect.c
@@ -65,6 +65,13 @@ static gboolean close_cb(gpointer data)
     return TRUE;
 }

+static gboolean entry_focus_in_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+    GtkRecentChooser *recent = data;
+    gtk_recent_chooser_unselect_all(recent);
+    return TRUE;
+}
+
 static gboolean key_pressed_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
     gboolean tst;
@@ -219,6 +226,10 @@ gboolean spicy_connect_dialog(SpiceSession *session)
     for (i = 0; i < SPICE_N_ELEMENTS(connect_entries); i++) {
         g_signal_connect_swapped(connect_entries[i].entry, "activate",
                                  G_CALLBACK(connect_cb), &ci);
+#ifndef G_OS_WIN32
+        g_signal_connect(connect_entries[i].entry, "focus-in-event",
+                         G_CALLBACK(entry_focus_in_cb), recent);
+#endif
     }

     /* show and wait for response */
--
2.4.2



More information about the Spice-devel mailing list