diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-26 18:20:18 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-26 18:20:20 +0800 |
commit | c48ad853488aed4cd28eeb20d6c4614f01b4b2f0 (patch) | |
tree | 2c99f1fa481bb150208a848cd921048e07f95e25 | |
parent | acc900cd828e7883436fe41ca68d5de3b27cf1df (diff) | |
download | gsoc2013-empathy-c48ad853488aed4cd28eeb20d6c4614f01b4b2f0.tar gsoc2013-empathy-c48ad853488aed4cd28eeb20d6c4614f01b4b2f0.tar.gz gsoc2013-empathy-c48ad853488aed4cd28eeb20d6c4614f01b4b2f0.tar.bz2 gsoc2013-empathy-c48ad853488aed4cd28eeb20d6c4614f01b4b2f0.tar.lz gsoc2013-empathy-c48ad853488aed4cd28eeb20d6c4614f01b4b2f0.tar.xz gsoc2013-empathy-c48ad853488aed4cd28eeb20d6c4614f01b4b2f0.tar.zst gsoc2013-empathy-c48ad853488aed4cd28eeb20d6c4614f01b4b2f0.zip |
search_text_notify_cb: select first matching only if we are still searching
Also scroll to the selected network when cancelling the search.
-rw-r--r-- | libempathy-gtk/empathy-irc-network-chooser-dialog.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-irc-network-chooser-dialog.c b/libempathy-gtk/empathy-irc-network-chooser-dialog.c index 8dce07389..b4483df1e 100644 --- a/libempathy-gtk/empathy-irc-network-chooser-dialog.c +++ b/libempathy-gtk/empathy-irc-network-chooser-dialog.c @@ -411,11 +411,30 @@ search_text_notify_cb (EmpathyLiveSearch *search, gtk_tree_model_filter_refilter (priv->filter); - /* Select first matching network */ + /* Is there at least one network in the view ? */ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->filter), &filter_iter)) { - select_iter (self, &filter_iter, TRUE); + const gchar *text; + + text = empathy_live_search_get_text (EMPATHY_LIVE_SEARCH (priv->search)); + if (!EMP_STR_EMPTY (text)) + { + /* We are doing a search, select the first matching network */ + select_iter (self, &filter_iter, TRUE); + } + else + { + /* Search has been cancelled. Scroll to the selected network */ + GtkTreeSelection *selection; + + selection = gtk_tree_view_get_selection ( + GTK_TREE_VIEW (priv->treeview)); + + if (gtk_tree_selection_get_selected (selection, NULL, &filter_iter)) + scroll_to_iter (self, &filter_iter); + } + sensitive = TRUE; } |