aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-03-07 19:30:38 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-03-07 19:31:07 +0800
commit20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f (patch)
treea11ffe1caed4326ae221284021396c3af40c112e /libempathy-gtk
parent3c2728fb0e70803085f699538c115b4c41b0b869 (diff)
downloadgsoc2013-empathy-20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f.tar
gsoc2013-empathy-20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f.tar.gz
gsoc2013-empathy-20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f.tar.bz2
gsoc2013-empathy-20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f.tar.lz
gsoc2013-empathy-20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f.tar.xz
gsoc2013-empathy-20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f.tar.zst
gsoc2013-empathy-20ec7b56ec63c56b41ad7c2cff2e4fd1ce3ba47f.zip
Show a profile info button in contact search results
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-contact-search-dialog.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-contact-search-dialog.c b/libempathy-gtk/empathy-contact-search-dialog.c
index 4468e95ab..b08d30915 100644
--- a/libempathy-gtk/empathy-contact-search-dialog.c
+++ b/libempathy-gtk/empathy-contact-search-dialog.c
@@ -32,6 +32,8 @@
#include <libempathy-gtk/empathy-account-chooser.h>
#include <libempathy-gtk/empathy-cell-renderer-text.h>
+#include <libempathy-gtk/empathy-cell-renderer-activatable.h>
+#include <libempathy-gtk/empathy-images.h>
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include <libempathy/empathy-debug.h>
@@ -446,6 +448,52 @@ contact_search_dialog_row_activated_cb (GtkTreeView *tv,
}
static void
+on_profile_button_got_contact_cb (TpConnection *connection,
+ EmpathyContact *contact,
+ const GError *error,
+ gpointer user_data,
+ GObject *object)
+{
+ if (error != NULL)
+ {
+ g_warning ("Error while getting the contact: %s", error->message);
+ return;
+ }
+
+ empathy_contact_information_dialog_show (contact, NULL);
+}
+
+static void
+on_profile_button_clicked_cb (EmpathyCellRendererActivatable *cell,
+ const gchar *path_string,
+ EmpathyContactSearchDialog *self)
+{
+ EmpathyContactSearchDialogPrivate *priv = GET_PRIVATE (self);
+ GtkTreeSelection *selection;
+ TpConnection *conn;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ gboolean valid;
+ gchar *id;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->tree_view));
+
+ conn = empathy_account_chooser_get_connection (
+ EMPATHY_ACCOUNT_CHOOSER (priv->chooser));
+
+ valid = gtk_tree_model_get_iter_from_string (model, &iter, path_string);
+ g_return_if_fail (valid == TRUE);
+
+ gtk_tree_model_get (model, &iter, LOGIN_COLUMN, &id, -1);
+
+ DEBUG ("Requested to show profile for contact: %s", id);
+
+ empathy_tp_contact_factory_get_from_id (conn, id,
+ on_profile_button_got_contact_cb, NULL,
+ NULL, NULL);
+}
+
+static void
empathy_contact_search_dialog_init (EmpathyContactSearchDialog *self)
{
EmpathyContactSearchDialogPrivate *priv = GET_PRIVATE (self);
@@ -522,6 +570,7 @@ empathy_contact_search_dialog_init (EmpathyContactSearchDialog *self)
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE);
col = gtk_tree_view_column_new ();
+
cell = empathy_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (col, cell, TRUE);
/* EmpathyCellRendererText displays "name" above and "status" below.
@@ -532,6 +581,12 @@ empathy_contact_search_dialog_init (EmpathyContactSearchDialog *self)
gtk_tree_view_column_add_attribute (col, cell,
"status", NAME_COLUMN);
+ cell = empathy_cell_renderer_activatable_new ();
+ gtk_tree_view_column_pack_end (col, cell, FALSE);
+ g_object_set (cell, "stock-id", EMPATHY_IMAGE_CONTACT_INFORMATION, NULL);
+ g_signal_connect (cell, "path-activated",
+ G_CALLBACK (on_profile_button_clicked_cb), self);
+
gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), col);
gtk_dialog_add_button (GTK_DIALOG (self),