diff options
author | Travis Reitter <travis.reitter@collabora.co.uk> | 2010-10-12 03:52:18 +0800 |
---|---|---|
committer | Travis Reitter <travis.reitter@collabora.co.uk> | 2010-10-16 05:14:44 +0800 |
commit | 31905d995ddb96e2e25a795fa197cb541bc7724d (patch) | |
tree | b348f300565858ed204935a5b7fd41830588e4a9 /libempathy-gtk/empathy-individual-view.c | |
parent | cddc09f1ca10d13de7d71fa199b1ae4d5a7c8784 (diff) | |
download | gsoc2013-empathy-31905d995ddb96e2e25a795fa197cb541bc7724d.tar gsoc2013-empathy-31905d995ddb96e2e25a795fa197cb541bc7724d.tar.gz gsoc2013-empathy-31905d995ddb96e2e25a795fa197cb541bc7724d.tar.bz2 gsoc2013-empathy-31905d995ddb96e2e25a795fa197cb541bc7724d.tar.lz gsoc2013-empathy-31905d995ddb96e2e25a795fa197cb541bc7724d.tar.xz gsoc2013-empathy-31905d995ddb96e2e25a795fa197cb541bc7724d.tar.zst gsoc2013-empathy-31905d995ddb96e2e25a795fa197cb541bc7724d.zip |
Use Folks to check the ability to remove Individuals in the store & view.
Helps bgo#625969.
Diffstat (limited to 'libempathy-gtk/empathy-individual-view.c')
-rw-r--r-- | libempathy-gtk/empathy-individual-view.c | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index ebc71a10a..2f2aae90a 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -2132,29 +2132,6 @@ empathy_individual_view_dup_selected (EmpathyIndividualView *view) return individual; } -EmpathyIndividualManagerFlags -empathy_individual_view_get_flags (EmpathyIndividualView *view) -{ - EmpathyIndividualViewPriv *priv; - GtkTreeSelection *selection; - GtkTreeIter iter; - GtkTreeModel *model; - EmpathyIndividualFeatureFlags flags; - - g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_VIEW (view), 0); - - priv = GET_PRIV (view); - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); - if (!gtk_tree_selection_get_selected (selection, &model, &iter)) - return 0; - - gtk_tree_model_get (model, &iter, - EMPATHY_INDIVIDUAL_STORE_COL_FLAGS, &flags, -1); - - return flags; -} - gchar * empathy_individual_view_get_selected_group (EmpathyIndividualView *view, gboolean *is_fake_group) @@ -2355,7 +2332,8 @@ empathy_individual_view_get_individual_menu (EmpathyIndividualView *view) GtkWidget *menu = NULL; GtkWidget *item; GtkWidget *image; - EmpathyIndividualManagerFlags flags; + gboolean can_remove = FALSE; + GList *l; g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_VIEW (view), NULL); @@ -2363,16 +2341,31 @@ empathy_individual_view_get_individual_menu (EmpathyIndividualView *view) if (individual == NULL) return NULL; - flags = empathy_individual_view_get_flags (view); + /* If any of the Individual's personas can be removed, add an option to + * remove. This will act as a best-effort option. If any Personas cannot be + * removed from the server, then this option will just be inactive upon + * subsequent menu openings */ + for (l = folks_individual_get_personas (individual); l != NULL; l = l->next) + { + FolksPersona *persona = FOLKS_PERSONA (l->data); + FolksPersonaStore *store = folks_persona_get_store (persona); + FolksMaybeBool maybe_can_remove = + folks_persona_store_get_can_remove_personas (store); + + if (maybe_can_remove == FOLKS_MAYBE_BOOL_TRUE) + { + can_remove = TRUE; + break; + } + } menu = empathy_individual_menu_new (individual, priv->individual_features); /* Remove contact */ - if (priv->view_features & - EMPATHY_INDIVIDUAL_VIEW_FEATURE_INDIVIDUAL_REMOVE && - flags & EMPATHY_INDIVIDUAL_MANAGER_CAN_REMOVE) + if ((priv->view_features & + EMPATHY_INDIVIDUAL_VIEW_FEATURE_INDIVIDUAL_REMOVE) && + can_remove) { - /* create the menu if required, or just add a separator */ if (menu == NULL) menu = gtk_menu_new (); |