aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-06-01 17:06:28 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-06-01 17:48:49 +0800
commitdb6773ebf31853608353b1bb156156879b303569 (patch)
treef5f14546828f7ffdf42a11fc40a34f1e05ac437c /libempathy-gtk
parentcc6c2b5423c3a1906b5f484c157bc67dd9ee9d86 (diff)
downloadgsoc2013-empathy-db6773ebf31853608353b1bb156156879b303569.tar
gsoc2013-empathy-db6773ebf31853608353b1bb156156879b303569.tar.gz
gsoc2013-empathy-db6773ebf31853608353b1bb156156879b303569.tar.bz2
gsoc2013-empathy-db6773ebf31853608353b1bb156156879b303569.tar.lz
gsoc2013-empathy-db6773ebf31853608353b1bb156156879b303569.tar.xz
gsoc2013-empathy-db6773ebf31853608353b1bb156156879b303569.tar.zst
gsoc2013-empathy-db6773ebf31853608353b1bb156156879b303569.zip
allow user to search for contacts using their full identifier
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-view.c3
-rw-r--r--libempathy-gtk/empathy-ui-utils.c13
-rw-r--r--libempathy-gtk/empathy-ui-utils.h3
3 files changed, 16 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 72e64cf7d..c467e9091 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -1728,7 +1728,8 @@ individual_view_is_visible_individual (EmpathyIndividualView *self,
return (priv->show_offline || is_online);
}
- return empathy_individual_match_words (individual,
+ return empathy_individual_match_string (individual,
+ empathy_live_search_get_text (live),
empathy_live_search_get_words (live));
}
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index ee73c14c8..cf3228da5 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1949,8 +1949,13 @@ empathy_get_current_action_time (void)
return (tp_user_action_time_from_x11 (gtk_get_current_event_time ()));
}
+/* @words = empathy_live_search_strip_utf8_string (@text);
+ *
+ * User has to pass both so we don't have to compute @words ourself each time
+ * this function is called. */
gboolean
-empathy_individual_match_words (FolksIndividual *individual,
+empathy_individual_match_string (FolksIndividual *individual,
+ const char *text,
GPtrArray *words)
{
const gchar *str;
@@ -1975,6 +1980,12 @@ empathy_individual_match_words (FolksIndividual *individual,
continue;
str = folks_persona_get_display_id (l->data);
+
+ /* Accept the persona if @text is a full prefix of his ID; that allows
+ * user to find, say, a jabber contact by typing his JID. */
+ if (g_str_has_prefix (str, text))
+ return TRUE;
+
p = strstr (str, "@");
if (p != NULL)
str = dup_str = g_strndup (str, p - str);
diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h
index aa46e8e43..f61e9e348 100644
--- a/libempathy-gtk/empathy-ui-utils.h
+++ b/libempathy-gtk/empathy-ui-utils.h
@@ -149,8 +149,9 @@ GtkWidget * empathy_context_menu_new (GtkWidget *attach_to);
gint64 empathy_get_current_action_time (void);
-gboolean empathy_individual_match_words (
+gboolean empathy_individual_match_string (
FolksIndividual *individual,
+ const gchar *text,
GPtrArray *words);
G_END_DECLS