aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-31 21:36:30 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-31 21:38:43 +0800
commitecfcc6cb011230531ef4fe527f4ff045217f714a (patch)
tree594763d77dce3918884dcf836fb34b865623f835 /src
parent81c5f8b415c5835f200ea9d7d3d917481b6fd506 (diff)
downloadgsoc2013-empathy-ecfcc6cb011230531ef4fe527f4ff045217f714a.tar
gsoc2013-empathy-ecfcc6cb011230531ef4fe527f4ff045217f714a.tar.gz
gsoc2013-empathy-ecfcc6cb011230531ef4fe527f4ff045217f714a.tar.bz2
gsoc2013-empathy-ecfcc6cb011230531ef4fe527f4ff045217f714a.tar.lz
gsoc2013-empathy-ecfcc6cb011230531ef4fe527f4ff045217f714a.tar.xz
gsoc2013-empathy-ecfcc6cb011230531ef4fe527f4ff045217f714a.tar.zst
gsoc2013-empathy-ecfcc6cb011230531ef4fe527f4ff045217f714a.zip
invite-participant-dialog: add an entry searching the contact list
Diffstat (limited to 'src')
-rw-r--r--src/empathy-invite-participant-dialog.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/empathy-invite-participant-dialog.c b/src/empathy-invite-participant-dialog.c
index 18a016c1d..7dfb338d0 100644
--- a/src/empathy-invite-participant-dialog.c
+++ b/src/empathy-invite-participant-dialog.c
@@ -15,6 +15,7 @@
#include "empathy-invite-participant-dialog.h"
#include <libempathy-gtk/empathy-individual-view.h>
+#include <libempathy-gtk/empathy-ui-utils.h>
G_DEFINE_TYPE (EmpathyInviteParticipantDialog,
empathy_invite_participant_dialog, GTK_TYPE_DIALOG);
@@ -32,6 +33,8 @@ struct _EmpathyInviteParticipantDialogPrivate
EmpathyIndividualView *view;
GtkWidget *invite_button;
+
+ GPtrArray *search_words;
};
static void
@@ -83,6 +86,7 @@ invite_participant_dialog_dispose (GObject *object)
tp_clear_object (&self->priv->tp_chat);
tp_clear_object (&self->priv->store);
+ tp_clear_pointer (&self->priv->search_words, g_ptr_array_unref);
G_OBJECT_CLASS (empathy_invite_participant_dialog_parent_class)->dispose (
object);
@@ -174,9 +178,22 @@ filter_func (GtkTreeModel *model,
EMPATHY_INDIVIDUAL_STORE_COL_IS_ONLINE, &is_online,
-1);
- if (individual == NULL || !is_online)
+ if (individual == NULL)
goto out;
+ if (self->priv->search_words == NULL)
+ {
+ /* Not searching, display online contacts */
+ if (!is_online)
+ goto out;
+ }
+ else
+ {
+ if (!empathy_individual_match_words (individual,
+ self->priv->search_words))
+ goto out;
+ }
+
/* Filter out individuals not having a persona on the same connection as the
* EmpathyTpChat. */
contact = get_tp_contact_for_chat (self, individual);
@@ -217,6 +234,18 @@ out:
}
static void
+search_text_changed (GtkEntry *entry,
+ EmpathyInviteParticipantDialog *self)
+{
+ tp_clear_pointer (&self->priv->search_words, g_ptr_array_unref);
+
+ self->priv->search_words = empathy_live_search_strip_utf8_string (
+ gtk_entry_get_text (entry));
+
+ empathy_individual_view_refilter (self->priv->view);
+}
+
+static void
empathy_invite_participant_dialog_init (EmpathyInviteParticipantDialog *self)
{
GtkDialog *dialog = GTK_DIALOG (self);
@@ -226,6 +255,7 @@ empathy_invite_participant_dialog_init (EmpathyInviteParticipantDialog *self)
EmpathyIndividualManager *mgr;
GtkTreeSelection *selection;
GtkWidget *scroll;
+ GtkWidget *search_entry;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (
self, EMPATHY_TYPE_INVITE_PARTICIPANT_DIALOG,
@@ -246,6 +276,14 @@ empathy_invite_participant_dialog_init (EmpathyInviteParticipantDialog *self)
gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ /* Search entry */
+ search_entry = gtk_entry_new ();
+ gtk_box_pack_start (GTK_BOX (content), search_entry, FALSE, TRUE, 6);
+ gtk_widget_show (search_entry);
+
+ g_signal_connect (search_entry, "changed",
+ G_CALLBACK (search_text_changed), self);
+
/* Add the treeview */
mgr = empathy_individual_manager_dup_singleton ();
self->priv->store = empathy_individual_store_new (mgr);