summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Venhoda <lvenhoda@redhat.com>2015-06-15 12:47:33 +0200
committerPavel Grunt <pgrunt@redhat.com>2015-06-16 14:11:00 +0200
commit78b1fa977a449177f59391739b87ef6a1869d7fd (patch)
treec400d97a87661c6c739ca16ab77d4e9990200cdd
parent0571843d7f357c7c21efcab0a40b13230d60cada (diff)
downloadvirt-viewer-78b1fa977a449177f59391739b87ef6a1869d7fd.tar.gz
virt-viewer-78b1fa977a449177f59391739b87ef6a1869d7fd.tar.xz
virt-viewer-78b1fa977a449177f59391739b87ef6a1869d7fd.zip
remote-viewer-connect: Fixed reselecting in recent chooser
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.
-rw-r--r--src/remote-viewer-connect.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/remote-viewer-connect.c b/src/remote-viewer-connect.c
index 35a8ac5..c5d4ed4 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)
{
@@ -208,6 +216,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);