aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2009-12-22 18:56:31 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2009-12-22 18:56:31 +0800
commit10bb432035ea43ab4ea7af7479fa0bc416cf7a59 (patch)
treee89df29170516fd2647f2cb46c1e480b1c5bcbcf /libempathy-gtk
parentd8a2cee1b7e31dc7d415bdfe6cf73c639e84cf7d (diff)
parentfa658816077d8dfcd59978bcb69b00b789f12636 (diff)
downloadgsoc2013-empathy-10bb432035ea43ab4ea7af7479fa0bc416cf7a59.tar
gsoc2013-empathy-10bb432035ea43ab4ea7af7479fa0bc416cf7a59.tar.gz
gsoc2013-empathy-10bb432035ea43ab4ea7af7479fa0bc416cf7a59.tar.bz2
gsoc2013-empathy-10bb432035ea43ab4ea7af7479fa0bc416cf7a59.tar.lz
gsoc2013-empathy-10bb432035ea43ab4ea7af7479fa0bc416cf7a59.tar.xz
gsoc2013-empathy-10bb432035ea43ab4ea7af7479fa0bc416cf7a59.tar.zst
gsoc2013-empathy-10bb432035ea43ab4ea7af7479fa0bc416cf7a59.zip
Merge branch 'pmuc'
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-contact-menu.c9
-rw-r--r--libempathy-gtk/empathy-contact-selector-dialog.c63
-rw-r--r--libempathy-gtk/empathy-contact-selector-dialog.h2
3 files changed, 57 insertions, 17 deletions
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index 4e1adfa90..3d022a8b0 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -483,10 +483,7 @@ static void
room_sub_menu_activate_cb (GtkWidget *item,
RoomSubMenuData *data)
{
- TpHandle handle;
- GArray handles = {(gchar *) &handle, 1};
EmpathyTpChat *chat;
- TpChannel *channel;
chat = empathy_chatroom_get_tp_chat (data->chatroom);
if (chat == NULL) {
@@ -495,10 +492,8 @@ room_sub_menu_activate_cb (GtkWidget *item,
}
/* send invitation */
- handle = empathy_contact_get_handle (data->contact);
- channel = empathy_tp_chat_get_channel (chat);
- tp_cli_channel_interface_group_call_add_members (channel, -1, &handles,
- _("Inviting to this room"), NULL, NULL, NULL, NULL);
+ empathy_contact_list_add (EMPATHY_CONTACT_LIST (chat), data->contact,
+ _("Inviting you to this room"));
}
static GtkWidget *
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.c b/libempathy-gtk/empathy-contact-selector-dialog.c
index 58e0fff35..3c59061ae 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.c
+++ b/libempathy-gtk/empathy-contact-selector-dialog.c
@@ -50,6 +50,7 @@ typedef struct _EmpathyContactSelectorDialogPriv \
EmpathyContactSelectorDialogPriv;
struct _EmpathyContactSelectorDialogPriv {
+ GtkListStore *store;
GtkWidget *account_chooser_label;
GtkWidget *account_chooser;
GtkWidget *entry_id;
@@ -81,13 +82,9 @@ contact_selector_dialog_account_changed_cb (GtkWidget *widget,
EmpathyAccountChooser *chooser;
TpConnection *connection;
GList *members;
- GtkListStore *store;
- GtkEntryCompletion *completion;
/* Remove completions */
- completion = gtk_entry_get_completion (GTK_ENTRY (priv->entry_id));
- store = GTK_LIST_STORE (gtk_entry_completion_get_model (completion));
- gtk_list_store_clear (store);
+ gtk_list_store_clear (priv->store);
/* Get members of the new account */
chooser = EMPATHY_ACCOUNT_CHOOSER (priv->account_chooser);
@@ -125,7 +122,7 @@ contact_selector_dialog_account_changed_cb (GtkWidget *widget,
empathy_contact_get_name (contact),
empathy_contact_get_id (contact));
- gtk_list_store_insert_with_values (store, &iter, -1,
+ gtk_list_store_insert_with_values (priv->store, &iter, -1,
COMPLETION_COL_TEXT, tmpstr,
COMPLETION_COL_ID, empathy_contact_get_id (contact),
COMPLETION_COL_NAME, empathy_contact_get_name (contact),
@@ -241,6 +238,28 @@ account_chooser_filter (TpAccount *account,
return class->account_filter (self, account);
}
+static gboolean
+contact_selector_dialog_filter_visible (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ EmpathyContactSelectorDialog *self = EMPATHY_CONTACT_SELECTOR_DIALOG (data);
+ gboolean r;
+ char *id;
+
+ gtk_tree_model_get (model, iter,
+ COMPLETION_COL_ID, &id,
+ -1);
+
+ /* this must be non-NULL for this function to get called */
+ r = EMPATHY_CONTACT_SELECTOR_DIALOG_GET_CLASS (self)->contact_filter (
+ self, id);
+
+ g_free (id);
+
+ return r;
+}
+
static void
empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog)
{
@@ -248,7 +267,6 @@ empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog)
GtkBuilder *gui;
gchar *filename;
GtkEntryCompletion *completion;
- GtkListStore *model;
GtkWidget *content_area;
GtkWidget *table_contact;
@@ -289,19 +307,20 @@ empathy_contact_selector_dialog_init (EmpathyContactSelectorDialog *dialog)
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
/* text completion */
+ priv->store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+
completion = gtk_entry_completion_new ();
- model = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
gtk_entry_completion_set_text_column (completion, COMPLETION_COL_TEXT);
gtk_entry_completion_set_match_func (completion,
contact_selector_dialog_match_func,
NULL, NULL);
- gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (model));
+ gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (priv->store));
gtk_entry_set_completion (GTK_ENTRY (priv->entry_id), completion);
g_signal_connect (completion, "match-selected",
G_CALLBACK (contact_selector_dialog_match_selected_cb),
dialog);
g_object_unref (completion);
- g_object_unref (model);
+ g_object_unref (priv->store);
empathy_builder_connect (gui, dialog,
"entry_id", "changed", contact_selector_change_state_button_cb,
@@ -370,6 +389,27 @@ empathy_contact_selector_dialog_set_property (GObject *self,
}
static void
+empathy_contact_selector_dialog_constructed (GObject *dialog)
+{
+ EmpathyContactSelectorDialogPriv *priv = GET_PRIV (dialog);
+
+ if (EMPATHY_CONTACT_SELECTOR_DIALOG_GET_CLASS (dialog)->contact_filter)
+ {
+ GtkEntryCompletion *completion;
+ GtkTreeModel *filter;
+
+ completion = gtk_entry_get_completion (GTK_ENTRY (priv->entry_id));
+ filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (priv->store), NULL);
+
+ gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter),
+ contact_selector_dialog_filter_visible, dialog, NULL);
+
+ gtk_entry_completion_set_model (completion, filter);
+ g_object_unref (filter);
+ }
+}
+
+static void
empathy_contact_selector_dialog_dispose (GObject *object)
{
EmpathyContactSelectorDialogPriv *priv = GET_PRIV (object);
@@ -392,6 +432,9 @@ empathy_contact_selector_dialog_class_init (
g_type_class_add_private (class, sizeof (EmpathyContactSelectorDialogPriv));
+ class->contact_filter = NULL;
+
+ object_class->constructed = empathy_contact_selector_dialog_constructed;
object_class->dispose = empathy_contact_selector_dialog_dispose;
object_class->get_property = empathy_contact_selector_dialog_get_property;
object_class->set_property = empathy_contact_selector_dialog_set_property;
diff --git a/libempathy-gtk/empathy-contact-selector-dialog.h b/libempathy-gtk/empathy-contact-selector-dialog.h
index d8a698ab5..87b2812f4 100644
--- a/libempathy-gtk/empathy-contact-selector-dialog.h
+++ b/libempathy-gtk/empathy-contact-selector-dialog.h
@@ -40,6 +40,8 @@ struct _EmpathyContactSelectorDialogClass {
gboolean (*account_filter) (EmpathyContactSelectorDialog *self,
TpAccount *account);
+ gboolean (*contact_filter) (EmpathyContactSelectorDialog *self,
+ const char *id);
};
struct _EmpathyContactSelectorDialog {