[Spice-devel] [spicy PATCH 3/6 v5] spicy: Fixed reselecting in recent chooser

Lukas Venhoda lvenhoda at redhat.com
Tue Jun 16 07:23:31 PDT 2015


Selecting an entry in the recent connections list, and then modifying
the host/port/TLS port, and double-clicking on that same entry in the
list would cause spicy to connect to the edited address rather than
the one which was picked in the recent chooser.

After this commit, the selection will be cleared from the recent
chooser, and double-clicking on an entry after editing it will always
trigger a 'selection-changed' signal, which will properly set the
address to connect to.
---
Changes since v4
 - Reworded commit message
 - Added runtime type checking for GtkRecentChooser

No changes since v3

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 f02976f..c168c4d 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 = GTK_RECENT_CHOOSER(data);
+    gtk_recent_chooser_unselect_all(recent);
+    return TRUE;
+}
+
 static gboolean key_pressed_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
 {
     gboolean tst;
@@ -218,6 +225,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), &info);
+#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.3



More information about the Spice-devel mailing list