aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2010-10-12 03:52:18 +0800
committerTravis Reitter <travis.reitter@collabora.co.uk>2010-10-16 05:14:44 +0800
commit31905d995ddb96e2e25a795fa197cb541bc7724d (patch)
treeb348f300565858ed204935a5b7fd41830588e4a9
parentcddc09f1ca10d13de7d71fa199b1ae4d5a7c8784 (diff)
downloadgsoc2013-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.
-rw-r--r--configure.ac2
-rw-r--r--libempathy-gtk/empathy-individual-store.c14
-rw-r--r--libempathy-gtk/empathy-individual-store.h1
-rw-r--r--libempathy-gtk/empathy-individual-view.c51
-rw-r--r--libempathy-gtk/empathy-individual-view.h3
5 files changed, 27 insertions, 44 deletions
diff --git a/configure.ac b/configure.ac
index 8b498d97d..6b4b9a071 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ AC_COPYRIGHT([
# Minimal version required
# Hardp deps
-FOLKS_REQUIRED=0.3.0
+FOLKS_REQUIRED=0.3.1
GCONF_REQUIRED=1.2.0
GLIB_REQUIRED=2.25.9
GNUTLS_REQUIRED=2.8.5
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 77f3016ec..c9159463c 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -158,8 +158,7 @@ static void
add_individual_to_store (GtkTreeStore *self,
GtkTreeIter *iter,
GtkTreeIter *parent,
- FolksIndividual *individual,
- EmpathyIndividualManagerFlags flags)
+ FolksIndividual *individual)
{
gboolean can_audio_call, can_video_call;
@@ -172,7 +171,6 @@ add_individual_to_store (GtkTreeStore *self,
EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, individual,
EMPATHY_INDIVIDUAL_STORE_COL_IS_GROUP, FALSE,
EMPATHY_INDIVIDUAL_STORE_COL_IS_SEPARATOR, FALSE,
- EMPATHY_INDIVIDUAL_STORE_COL_FLAGS, flags,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL, can_audio_call,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL, can_video_call,
-1);
@@ -376,7 +374,6 @@ individual_store_add_individual (EmpathyIndividualStore *self,
GList *groups = NULL, *l;
EmpathyContact *contact;
TpConnection *connection;
- EmpathyIndividualManagerFlags flags = 0;
gchar *protocol_name;
priv = GET_PRIV (self);
@@ -392,8 +389,6 @@ individual_store_add_individual (EmpathyIndividualStore *self,
contact = empathy_contact_dup_from_folks_individual (individual);
connection = empathy_contact_get_connection (contact);
- flags = empathy_individual_manager_get_flags_for_connection (priv->manager,
- connection);
tp_connection_parse_object_path (connection, &protocol_name, NULL);
@@ -420,7 +415,7 @@ individual_store_add_individual (EmpathyIndividualStore *self,
}
add_individual_to_store (GTK_TREE_STORE (self), &iter, parent,
- individual, flags);
+ individual);
}
g_free (protocol_name);
@@ -434,7 +429,7 @@ individual_store_add_individual (EmpathyIndividualStore *self,
FALSE);
add_individual_to_store (GTK_TREE_STORE (self), &iter, &iter_group,
- individual, flags);
+ individual);
}
g_list_free (groups);
if (group_set != NULL)
@@ -450,7 +445,7 @@ individual_store_add_individual (EmpathyIndividualStore *self,
&iter_group, NULL, NULL, TRUE);
add_individual_to_store (GTK_TREE_STORE (self), &iter, &iter_group,
- individual, flags);
+ individual);
}
individual_store_contact_update (self, individual);
@@ -1493,7 +1488,6 @@ individual_store_setup (EmpathyIndividualStore *self)
G_TYPE_BOOLEAN, /* Is separator */
G_TYPE_BOOLEAN, /* Can make audio calls */
G_TYPE_BOOLEAN, /* Can make video calls */
- EMPATHY_TYPE_INDIVIDUAL_MANAGER_FLAGS, /* Flags */
G_TYPE_BOOLEAN, /* Is a fake group */
};
diff --git a/libempathy-gtk/empathy-individual-store.h b/libempathy-gtk/empathy-individual-store.h
index 4c99610d6..debb218ad 100644
--- a/libempathy-gtk/empathy-individual-store.h
+++ b/libempathy-gtk/empathy-individual-store.h
@@ -63,7 +63,6 @@ typedef enum
EMPATHY_INDIVIDUAL_STORE_COL_IS_SEPARATOR,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL,
- EMPATHY_INDIVIDUAL_STORE_COL_FLAGS,
EMPATHY_INDIVIDUAL_STORE_COL_IS_FAKE_GROUP,
EMPATHY_INDIVIDUAL_STORE_COL_COUNT,
} EmpathyIndividualStoreCol;
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 ();
diff --git a/libempathy-gtk/empathy-individual-view.h b/libempathy-gtk/empathy-individual-view.h
index 51a487d94..94ec8ccfd 100644
--- a/libempathy-gtk/empathy-individual-view.h
+++ b/libempathy-gtk/empathy-individual-view.h
@@ -98,9 +98,6 @@ EmpathyIndividualView *empathy_individual_view_new (
FolksIndividual *empathy_individual_view_dup_selected (
EmpathyIndividualView *view);
-EmpathyIndividualManagerFlags empathy_individual_view_get_flags (
- EmpathyIndividualView *view);
-
gchar *empathy_individual_view_get_selected_group (EmpathyIndividualView *view,
gboolean * is_fake_group);