diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-10 17:21:32 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-03-15 16:28:42 +0800 |
commit | 8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a (patch) | |
tree | 62399e4142c43c7d44418c4ab7fbe149ea71a991 | |
parent | 10de86b4bf55d1b624adbb867854bb61df04fb19 (diff) | |
download | gsoc2013-empathy-8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a.tar gsoc2013-empathy-8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a.tar.gz gsoc2013-empathy-8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a.tar.bz2 gsoc2013-empathy-8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a.tar.lz gsoc2013-empathy-8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a.tar.xz gsoc2013-empathy-8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a.tar.zst gsoc2013-empathy-8ae91c9509dde4dea0bc735dd24c7e3a690b4c9a.zip |
Don't allow moving contacts to fake groups using DnD
Fake groups can't be modified.
-rw-r--r-- | libempathy-gtk/empathy-contact-list-store.c | 8 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-list-store.h | 3 | ||||
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 9 |
3 files changed, 16 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index 3ebeacb4a..9feb4461f 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -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, - gboolean *path_is_group) + gboolean *path_is_group, + gboolean *is_fake_group) { GtkTreeIter parent_iter, iter; gchar *name = NULL; gboolean is_group; + gboolean fake; 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, + EMPATHY_CONTACT_LIST_STORE_COL_IS_FAKE_GROUP, &fake, -1); if (!is_group) { g_free (name); @@ -773,6 +776,9 @@ empathy_contact_list_store_get_parent_group (GtkTreeModel *model, *path_is_group = TRUE; } + if (is_fake_group != NULL) + *is_fake_group = fake; + return name; } diff --git a/libempathy-gtk/empathy-contact-list-store.h b/libempathy-gtk/empathy-contact-list-store.h index db8f40cd7..1b36ea651 100644 --- a/libempathy-gtk/empathy-contact-list-store.h +++ b/libempathy-gtk/empathy-contact-list-store.h @@ -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, - 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, diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 2a3fb773e..e5638954f 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -266,19 +266,24 @@ contact_list_view_contact_drag_received (GtkWidget *view, 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, - 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 ( - model, source_path, NULL); + model, source_path, NULL, NULL); gtk_tree_path_free (source_path); } } |