]> git.0d.be Git - empathy.git/commitdiff
Don't allow moving contacts to fake groups using DnD
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 10 Mar 2010 09:21:32 +0000 (10:21 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 15 Mar 2010 08:28:42 +0000 (09:28 +0100)
Fake groups can't be modified.

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

index 3ebeacb4a31a7fe8d6842d00c32e6aaad4be6198..9feb4461fd5bf0c52e9e62a85be4a97cccdf3aa2 100644 (file)
@@ -728,11 +728,13 @@ empathy_contact_list_store_row_separator_func (GtkTreeModel *model,
 gchar *
 empathy_contact_list_store_get_parent_group (GtkTreeModel *model,
                                            GtkTreePath  *path,
 gchar *
 empathy_contact_list_store_get_parent_group (GtkTreeModel *model,
                                            GtkTreePath  *path,
-                                           gboolean     *path_is_group)
+                                           gboolean     *path_is_group,
+                                           gboolean     *is_fake_group)
 {
        GtkTreeIter  parent_iter, iter;
        gchar       *name = NULL;
        gboolean     is_group;
 {
        GtkTreeIter  parent_iter, iter;
        gchar       *name = NULL;
        gboolean     is_group;
+       gboolean     fake;
 
        g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
 
 
        g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
 
@@ -762,6 +764,7 @@ empathy_contact_list_store_get_parent_group (GtkTreeModel *model,
                gtk_tree_model_get (model, &iter,
                                    EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
                                    EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name,
                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) {
                        g_free (name);
                                    -1);
                if (!is_group) {
                        g_free (name);
@@ -773,6 +776,9 @@ empathy_contact_list_store_get_parent_group (GtkTreeModel *model,
                *path_is_group = TRUE;
        }
 
                *path_is_group = TRUE;
        }
 
+       if (is_fake_group != NULL)
+               *is_fake_group = fake;
+
        return name;
 }
 
        return name;
 }
 
index db8f40cd7b993b391e0b7e40dc3cd6ddb768474f..1b36ea651a79fc4af49d867dee66472b6821ee56 100644 (file)
@@ -105,7 +105,8 @@ gboolean                   empathy_contact_list_store_row_separator_func (GtkTre
                                                                         gpointer                    data);
 gchar *                    empathy_contact_list_store_get_parent_group   (GtkTreeModel               *model,
                                                                         GtkTreePath                *path,
                                                                         gpointer                    data);
 gchar *                    empathy_contact_list_store_get_parent_group   (GtkTreeModel               *model,
                                                                         GtkTreePath                *path,
-                                                                        gboolean                   *path_is_group);
+                                                                        gboolean                   *path_is_group,
+                                                                        gboolean                   *is_fake_group);
 gboolean                   empathy_contact_list_store_search_equal_func  (GtkTreeModel               *model,
                                                                         gint                        column,
                                                                         const gchar                *key,
 gboolean                   empathy_contact_list_store_search_equal_func  (GtkTreeModel               *model,
                                                                         gint                        column,
                                                                         const gchar                *key,
index 2a3fb773e0f3155a4dc21dc5deeeb288c9cb23c2..e5638954f52ff4e048a86645abf42461baf6152a 100644 (file)
@@ -266,19 +266,24 @@ contact_list_view_contact_drag_received (GtkWidget         *view,
        gchar         *new_group = NULL;
        gchar         *old_group = NULL;
        gboolean       success = TRUE;
        gchar         *new_group = NULL;
        gchar         *old_group = NULL;
        gboolean       success = TRUE;
+       gboolean       is_fake_group;
 
        priv = GET_PRIV (view);
 
        sel_data = (const gchar *) gtk_selection_data_get_data (selection);
        new_group = empathy_contact_list_store_get_parent_group (model,
 
        priv = GET_PRIV (view);
 
        sel_data = (const gchar *) gtk_selection_data_get_data (selection);
        new_group = empathy_contact_list_store_get_parent_group (model,
-                                                                path, NULL);
+                                                                path, NULL, &is_fake_group);
+
+       if (is_fake_group)
+               /* Fake groups can't be modified */
+               return FALSE;
 
        /* Get source group information. */
        if (priv->drag_row) {
                source_path = gtk_tree_row_reference_get_path (priv->drag_row);
                if (source_path) {
                        old_group = empathy_contact_list_store_get_parent_group (
 
        /* Get source group information. */
        if (priv->drag_row) {
                source_path = gtk_tree_row_reference_get_path (priv->drag_row);
                if (source_path) {
                        old_group = empathy_contact_list_store_get_parent_group (
-                                                                                model, source_path, NULL);
+                                                                                model, source_path, NULL, NULL);
                        gtk_tree_path_free (source_path);
                }
        }
                        gtk_tree_path_free (source_path);
                }
        }