aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-10 00:25:14 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-15 16:28:42 +0800
commitb92ad3740762d958364d4f9421095b088f0d845b (patch)
tree07f1ab2677aa89737baa79574092efc152757514
parent39aeb13d19382b86d3b322a7cca13a72c5fac1b5 (diff)
downloadgsoc2013-empathy-b92ad3740762d958364d4f9421095b088f0d845b.tar
gsoc2013-empathy-b92ad3740762d958364d4f9421095b088f0d845b.tar.gz
gsoc2013-empathy-b92ad3740762d958364d4f9421095b088f0d845b.tar.bz2
gsoc2013-empathy-b92ad3740762d958364d4f9421095b088f0d845b.tar.lz
gsoc2013-empathy-b92ad3740762d958364d4f9421095b088f0d845b.tar.xz
gsoc2013-empathy-b92ad3740762d958364d4f9421095b088f0d845b.tar.zst
gsoc2013-empathy-b92ad3740762d958364d4f9421095b088f0d845b.zip
Don't display context menu when right clicking on a fake group
Those can't be renamed.
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c16
-rw-r--r--libempathy-gtk/empathy-contact-list-view.h3
2 files changed, 14 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 5b6686896..71658370a 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -1510,7 +1510,8 @@ empathy_contact_list_view_get_flags (EmpathyContactListView *view)
}
gchar *
-empathy_contact_list_view_get_selected_group (EmpathyContactListView *view)
+empathy_contact_list_view_get_selected_group (EmpathyContactListView *view,
+ gboolean *is_fake_group)
{
EmpathyContactListViewPriv *priv;
GtkTreeSelection *selection;
@@ -1518,6 +1519,7 @@ empathy_contact_list_view_get_selected_group (EmpathyContactListView *view)
GtkTreeModel *model;
gboolean is_group;
gchar *name;
+ gboolean fake;
g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view), NULL);
@@ -1531,6 +1533,7 @@ empathy_contact_list_view_get_selected_group (EmpathyContactListView *view)
gtk_tree_model_get (model, &iter,
EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name,
+ EMPATHY_CONTACT_LIST_STORE_COL_IS_FAKE_GROUP, &fake,
-1);
if (!is_group) {
@@ -1538,6 +1541,9 @@ empathy_contact_list_view_get_selected_group (EmpathyContactListView *view)
return NULL;
}
+ if (is_fake_group != NULL)
+ *is_fake_group = fake;
+
return name;
}
@@ -1574,7 +1580,7 @@ contact_list_view_group_remove_activate_cb (GtkMenuItem *menuitem,
EmpathyContactListViewPriv *priv = GET_PRIV (view);
gchar *group;
- group = empathy_contact_list_view_get_selected_group (view);
+ group = empathy_contact_list_view_get_selected_group (view, NULL);
if (group) {
gchar *text;
GtkWindow *parent;
@@ -1602,6 +1608,7 @@ empathy_contact_list_view_get_group_menu (EmpathyContactListView *view)
GtkWidget *menu;
GtkWidget *item;
GtkWidget *image;
+ gboolean is_fake_group;
g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST_VIEW (view), NULL);
@@ -1610,8 +1617,9 @@ empathy_contact_list_view_get_group_menu (EmpathyContactListView *view)
return NULL;
}
- group = empathy_contact_list_view_get_selected_group (view);
- if (!group) {
+ group = empathy_contact_list_view_get_selected_group (view, &is_fake_group);
+ if (!group || is_fake_group) {
+ /* We can't alter fake groups */
return NULL;
}
diff --git a/libempathy-gtk/empathy-contact-list-view.h b/libempathy-gtk/empathy-contact-list-view.h
index 17de5239b..41b968dbf 100644
--- a/libempathy-gtk/empathy-contact-list-view.h
+++ b/libempathy-gtk/empathy-contact-list-view.h
@@ -73,7 +73,8 @@ EmpathyContactListView * empathy_contact_list_view_new (Empathy
EmpathyContactFeatureFlags contact_features);
EmpathyContact * empathy_contact_list_view_dup_selected (EmpathyContactListView *view);
EmpathyContactListFlags empathy_contact_list_view_get_flags (EmpathyContactListView *view);
-gchar * empathy_contact_list_view_get_selected_group (EmpathyContactListView *view);
+gchar * empathy_contact_list_view_get_selected_group (EmpathyContactListView *view,
+ gboolean *is_fake_group);
GtkWidget * empathy_contact_list_view_get_contact_menu (EmpathyContactListView *view);
GtkWidget * empathy_contact_list_view_get_group_menu (EmpathyContactListView *view);