aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/libempathy-gtk/tmpl/empathy-contact-list-view.sgml5
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c73
-rw-r--r--libempathy-gtk/empathy-contact-list-view.h3
-rw-r--r--libempathy-gtk/empathy-group-chat.c1
-rw-r--r--libempathy-gtk/empathy-main-window.c1
5 files changed, 71 insertions, 12 deletions
diff --git a/doc/libempathy-gtk/tmpl/empathy-contact-list-view.sgml b/doc/libempathy-gtk/tmpl/empathy-contact-list-view.sgml
index 188033ebf..9c3aefc75 100644
--- a/doc/libempathy-gtk/tmpl/empathy-contact-list-view.sgml
+++ b/doc/libempathy-gtk/tmpl/empathy-contact-list-view.sgml
@@ -39,6 +39,11 @@ EmpathyContactListView
@arg2:
@arg3:
+<!-- ##### ARG EmpathyContactListView:interactive ##### -->
+<para>
+
+</para>
+
<!-- ##### FUNCTION empathy_contact_list_view_new ##### -->
<para>
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 8e6b2cf09..d4b222e4d 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -69,6 +69,7 @@ struct _EmpathyContactListViewPriv {
EmpathyContactListStore *store;
GtkUIManager *ui;
GtkTreeRowReference *drag_row;
+ gboolean interactive;
};
typedef struct {
@@ -182,6 +183,7 @@ static void contact_list_view_voip_activated (EmpathyContactLi
enum {
PROP_0,
+ PROP_INTERACTIVE
};
static const GtkActionEntry entries[] = {
@@ -313,6 +315,14 @@ empathy_contact_list_view_class_init (EmpathyContactListViewClass *klass)
G_TYPE_NONE,
3, EMPATHY_TYPE_CONTACT, G_TYPE_STRING, G_TYPE_STRING);
+ g_object_class_install_property (object_class,
+ PROP_INTERACTIVE,
+ g_param_spec_boolean ("interactive",
+ "View is interactive",
+ "Is the view interactive",
+ FALSE,
+ G_PARAM_READWRITE));
+
g_type_class_add_private (object_class, sizeof (EmpathyContactListViewPriv));
}
@@ -394,6 +404,9 @@ contact_list_view_get_property (GObject *object,
priv = GET_PRIV (object);
switch (param_id) {
+ case PROP_INTERACTIVE:
+ g_value_set_boolean (value, priv->interactive);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -406,11 +419,15 @@ contact_list_view_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
+ EmpathyContactListView *view = EMPATHY_CONTACT_LIST_VIEW (object);
EmpathyContactListViewPriv *priv;
priv = GET_PRIV (object);
switch (param_id) {
+ case PROP_INTERACTIVE:
+ empathy_contact_list_view_set_interactive (view, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -432,6 +449,28 @@ empathy_contact_list_view_new (EmpathyContactListStore *store)
return view;
}
+void
+empathy_contact_list_view_set_interactive (EmpathyContactListView *view,
+ gboolean interactive)
+{
+ EmpathyContactListViewPriv *priv = GET_PRIV (view);
+
+ g_return_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view));
+
+ priv->interactive = interactive;
+ g_object_notify (G_OBJECT (view), "interactive");
+}
+
+gboolean
+empathy_contact_list_view_get_interactive (EmpathyContactListView *view)
+{
+ EmpathyContactListViewPriv *priv = GET_PRIV (view);
+
+ g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view), FALSE);
+
+ return priv->interactive;
+}
+
EmpathyContact *
empathy_contact_list_view_get_selected (EmpathyContactListView *view)
{
@@ -1192,12 +1231,12 @@ contact_list_view_button_press_event_cb (EmpathyContactListView *view,
gboolean row_exists;
GtkWidget *menu;
- if (event->button != 3) {
+ priv = GET_PRIV (view);
+
+ if (!priv->interactive || event->button != 3) {
return FALSE;
}
- priv = GET_PRIV (view);
-
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
@@ -1241,13 +1280,18 @@ contact_list_view_button_press_event_cb (EmpathyContactListView *view,
static void
contact_list_view_row_activated_cb (EmpathyContactListView *view,
- GtkTreePath *path,
- GtkTreeViewColumn *col,
- gpointer user_data)
+ GtkTreePath *path,
+ GtkTreeViewColumn *col,
+ gpointer user_data)
{
- EmpathyContact *contact;
- GtkTreeModel *model;
- GtkTreeIter iter;
+ EmpathyContactListViewPriv *priv = GET_PRIV (view);
+ EmpathyContact *contact;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ if (!priv->interactive) {
+ return;
+ }
model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
@@ -1265,9 +1309,14 @@ contact_list_view_voip_activated_cb (EmpathyCellRendererActivatable *cell,
const gchar *path_string,
EmpathyContactListView *view)
{
- GtkTreeModel *model;
- GtkTreeIter iter;
- EmpathyContact *contact;
+ EmpathyContactListViewPriv *priv = GET_PRIV (view);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ EmpathyContact *contact;
+
+ if (!priv->interactive) {
+ return;
+ }
model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
if (!gtk_tree_model_get_iter_from_string (model, &iter, path_string)) {
diff --git a/libempathy-gtk/empathy-contact-list-view.h b/libempathy-gtk/empathy-contact-list-view.h
index b9de24357..c37e5c716 100644
--- a/libempathy-gtk/empathy-contact-list-view.h
+++ b/libempathy-gtk/empathy-contact-list-view.h
@@ -55,6 +55,9 @@ struct _EmpathyContactListViewClass {
GType empathy_contact_list_view_get_type (void) G_GNUC_CONST;
EmpathyContactListView *empathy_contact_list_view_new (EmpathyContactListStore *store);
+void empathy_contact_list_view_set_interactive (EmpathyContactListView *view,
+ gboolean interactive);
+gboolean empathy_contact_list_view_get_interactive (EmpathyContactListView *view);
EmpathyContact * empathy_contact_list_view_get_selected (EmpathyContactListView *view);
gchar * empathy_contact_list_view_get_selected_group (EmpathyContactListView *view);
GtkWidget * empathy_contact_list_view_get_contact_menu (EmpathyContactListView *view,
diff --git a/libempathy-gtk/empathy-group-chat.c b/libempathy-gtk/empathy-group-chat.c
index 48439302d..f3c8e8a20 100644
--- a/libempathy-gtk/empathy-group-chat.c
+++ b/libempathy-gtk/empathy-group-chat.c
@@ -529,6 +529,7 @@ group_chat_set_tp_chat (EmpathyChat *chat,
/* Create contact list */
priv->store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (priv->tp_chat));
priv->view = empathy_contact_list_view_new (priv->store);
+ empathy_contact_list_view_set_interactive (priv->view, TRUE);
gtk_container_add (GTK_CONTAINER (priv->scrolled_window_contacts),
GTK_WIDGET (priv->view));
gtk_widget_show (GTK_WIDGET (priv->view));
diff --git a/libempathy-gtk/empathy-main-window.c b/libempathy-gtk/empathy-main-window.c
index 4b89c4e67..c021df7dd 100644
--- a/libempathy-gtk/empathy-main-window.c
+++ b/libempathy-gtk/empathy-main-window.c
@@ -290,6 +290,7 @@ empathy_main_window_show (void)
list_iface = EMPATHY_CONTACT_LIST (empathy_contact_manager_new ());
window->list_store = empathy_contact_list_store_new (list_iface);
window->list_view = empathy_contact_list_view_new (window->list_store);
+ empathy_contact_list_view_set_interactive (window->list_view, TRUE);
g_object_unref (list_iface);
gtk_widget_show (GTK_WIDGET (window->list_view));