]> git.0d.be Git - empathy.git/commitdiff
Don't display context menu when right clicking on a fake group
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 9 Mar 2010 16:25:14 +0000 (17:25 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 15 Mar 2010 08:28:42 +0000 (09:28 +0100)
Those can't be renamed.

libempathy-gtk/empathy-contact-list-view.c
libempathy-gtk/empathy-contact-list-view.h

index 5b6686896b5d46b618b95bc11e47ba8658b7078a..71658370a93078cbd6d4c680f15cb051a40f4827 100644 (file)
@@ -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;
        }
 
index 17de5239b750143bd0d8a30e7dbbc0b729c58b48..41b968dbf5600b23e253eee6ccc5caa5a6a86862 100644 (file)
@@ -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);