diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2011-01-30 00:16:29 +0800 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2011-02-18 07:47:31 +0800 |
commit | 753a1862257d4c14fb2475a73ec08aeabdb7d907 (patch) | |
tree | bcf78312b1b7954818b929dfac44786e59b247a2 | |
parent | d008f215bc41f4e69ff01879047ec946a4370148 (diff) | |
download | gsoc2013-empathy-753a1862257d4c14fb2475a73ec08aeabdb7d907.tar gsoc2013-empathy-753a1862257d4c14fb2475a73ec08aeabdb7d907.tar.gz gsoc2013-empathy-753a1862257d4c14fb2475a73ec08aeabdb7d907.tar.bz2 gsoc2013-empathy-753a1862257d4c14fb2475a73ec08aeabdb7d907.tar.lz gsoc2013-empathy-753a1862257d4c14fb2475a73ec08aeabdb7d907.tar.xz gsoc2013-empathy-753a1862257d4c14fb2475a73ec08aeabdb7d907.tar.zst gsoc2013-empathy-753a1862257d4c14fb2475a73ec08aeabdb7d907.zip |
Bug 637151 — Hide the user Individual from the contact list
Generalise the mechanism used to determine whether a persona is to be
displayed by Empathy to also take into account whether the persona is the
user and, if so, whether they're in the contact list.
This bumps the libfolks dependency to 0.3.5.
Closes: bgo#637151
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-information-dialog.c | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-menu.c | 8 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-store.c | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-view.c | 21 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-widget.c | 20 | ||||
-rw-r--r-- | libempathy-gtk/empathy-linking-dialog.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-contact.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-utils.c | 22 | ||||
-rw-r--r-- | libempathy/empathy-utils.h | 1 |
10 files changed, 59 insertions, 27 deletions
diff --git a/configure.ac b/configure.ac index d15e72fb7..30a1104a1 100644 --- a/configure.ac +++ b/configure.ac @@ -31,7 +31,7 @@ AC_COPYRIGHT([ # Minimal version required # Hardp deps -FOLKS_REQUIRED=0.3.4 +FOLKS_REQUIRED=0.3.5 GLIB_REQUIRED=2.27.2 GNUTLS_REQUIRED=2.8.5 GTK_REQUIRED=2.99.0 diff --git a/libempathy-gtk/empathy-individual-information-dialog.c b/libempathy-gtk/empathy-individual-information-dialog.c index 7659c8ba6..fcbec1228 100644 --- a/libempathy-gtk/empathy-individual-information-dialog.c +++ b/libempathy-gtk/empathy-individual-information-dialog.c @@ -139,7 +139,7 @@ set_label_visibility (EmpathyIndividualInformationDialog *dialog) personas = folks_individual_get_personas (priv->individual); for (l = personas; l != NULL; l = l->next) { - if (TPF_IS_PERSONA (l->data)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) num_personas++; } } diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index 1dc463330..8b9f98486 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -87,7 +87,7 @@ individual_menu_add_personas (GtkMenuShell *menu, * functionality */ for (l = personas; l != NULL; l = l->next) { - if (!TPF_IS_PERSONA (l->data)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; persona_count++; @@ -116,7 +116,7 @@ individual_menu_add_personas (GtkMenuShell *menu, const gchar *account; GtkWidget *action; - if (!TPF_IS_PERSONA (persona)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; tp_contact = tpf_persona_get_contact (persona); @@ -937,7 +937,7 @@ room_sub_menu_activate_cb (GtkWidget *item, TpContact *tp_contact; GList *rooms; - if (!TPF_IS_PERSONA (persona)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; tp_contact = tpf_persona_get_contact (persona); @@ -1037,7 +1037,7 @@ empathy_individual_invite_menu_item_new (FolksIndividual *individual, TpContact *tp_contact; EmpathyContact *contact_cur; - if (!TPF_IS_PERSONA (persona)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; tp_contact = tpf_persona_get_contact (persona); diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index feec91a57..cf7d6865e 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -132,7 +132,7 @@ individual_can_audio_video_call (FolksIndividual *individual, TpContact *tp_contact; EmpathyContact *contact; - if (!TPF_IS_PERSONA (l->data)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data)); @@ -1954,7 +1954,7 @@ individual_store_get_individual_status_icon_with_icon_name ( personas = folks_individual_get_personas (individual); for (l = personas, contact_count = 0; l; l = l->next) { - if (TPF_IS_PERSONA (l->data)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) contact_count++; if (contact_count > 1) diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index fe236b3fd..9be022139 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -1681,7 +1681,7 @@ individual_view_is_visible_individual (EmpathyIndividualView *self, EmpathyLiveSearch *live = EMPATHY_LIVE_SEARCH (priv->search_widget); const gchar *str; GList *personas, *l; - gboolean is_favorite; + gboolean is_favorite, contains_interesting_persona = FALSE; /* We're only giving the visibility wrt filtering here, not things like * presence. */ @@ -1691,6 +1691,20 @@ individual_view_is_visible_individual (EmpathyIndividualView *self, return FALSE; } + /* Hide all individuals which consist entirely of uninteresting personas */ + personas = folks_individual_get_personas (individual); + for (l = personas; l; l = l->next) + { + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) + { + contains_interesting_persona = TRUE; + break; + } + } + + if (contains_interesting_persona == FALSE) + return FALSE; + is_favorite = folks_favouritable_get_is_favourite ( FOLKS_FAVOURITABLE (individual)); if (is_searching == FALSE) @@ -1703,14 +1717,13 @@ individual_view_is_visible_individual (EmpathyIndividualView *self, return TRUE; /* check contact id, remove the @server.com part */ - personas = folks_individual_get_personas (individual); for (l = personas; l; l = l->next) { const gchar *p; gchar *dup_str = NULL; gboolean visible; - if (!TPF_IS_PERSONA (l->data)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; str = folks_persona_get_display_id (l->data); @@ -2388,7 +2401,7 @@ individual_view_remove_activate_cb (GtkMenuItem *menuitem, * be removed. */ for (l = personas; l != NULL; l = l->next) { - if (!TPF_IS_PERSONA (l->data)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; persona_count++; diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c index 808c33fbc..35e12dbe2 100644 --- a/libempathy-gtk/empathy-individual-widget.c +++ b/libempathy-gtk/empathy-individual-widget.c @@ -238,8 +238,8 @@ update_weak_contact (EmpathyIndividualWidget *self) if (folks_presence_owner_typecmp ( folks_presence_owner_get_presence_type (presence), - presence_type) > 0 - && TPF_IS_PERSONA (presence)) + presence_type) > 0 && + empathy_folks_persona_is_interesting (FOLKS_PERSONA (presence))) { presence_type = folks_presence_owner_get_presence_type (presence); tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data)); @@ -581,7 +581,7 @@ location_update (EmpathyIndividualWidget *self) { FolksPersona *persona = FOLKS_PERSONA (l->data); - if (TPF_IS_PERSONA (persona)) + if (empathy_folks_persona_is_interesting (persona)) { TpContact *tp_contact; @@ -754,7 +754,7 @@ location_update (EmpathyIndividualWidget *self) { FolksPersona *persona = FOLKS_PERSONA (l->data); - if (TPF_IS_PERSONA (persona)) + if (empathy_folks_persona_is_interesting (persona)) { gdouble lat = 0.0, lon = 0.0; ClutterActor *marker; @@ -877,7 +877,7 @@ persona_dup_avatar (FolksPersona *persona) EmpathyContact *contact; EmpathyAvatar *avatar; - if (!TPF_IS_PERSONA (persona)) + if (!empathy_folks_persona_is_interesting (persona)) return NULL; tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona)); @@ -1472,7 +1472,7 @@ add_persona (EmpathyIndividualWidget *self, GtkWidget *label, *account_label, *account_image, *separator; guint current_row = 0; - if (!TPF_IS_PERSONA (persona)) + if (!empathy_folks_persona_is_interesting (persona)) return; if (priv->flags & EMPATHY_INDIVIDUAL_WIDGET_EDIT_FAVOURITE) @@ -1575,7 +1575,7 @@ remove_persona (EmpathyIndividualWidget *self, GtkWidget *separator; GtkTable *table; - if (!TPF_IS_PERSONA (persona)) + if (!empathy_folks_persona_is_interesting (persona)) return; table = g_hash_table_lookup (priv->persona_tables, persona); @@ -1647,7 +1647,7 @@ individual_table_set_up (EmpathyIndividualWidget *self) personas = folks_individual_get_personas (priv->individual); for (l = personas; l != NULL; l = l->next) { - if (TPF_IS_PERSONA (l->data)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) num_personas++; } @@ -1714,7 +1714,7 @@ personas_changed_cb (FolksIndividual *individual, for (l = personas; l != NULL; l = l->next) { - if (TPF_IS_PERSONA (l->data)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) new_num_personas++; } @@ -1890,7 +1890,7 @@ individual_update (EmpathyIndividualWidget *self) personas = folks_individual_get_personas (priv->individual); for (l = personas; l != NULL; l = l->next) { - if (!TPF_IS_PERSONA (l->data)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; update_persona (self, FOLKS_PERSONA (l->data)); diff --git a/libempathy-gtk/empathy-linking-dialog.c b/libempathy-gtk/empathy-linking-dialog.c index e6d408fb4..35328a3d7 100644 --- a/libempathy-gtk/empathy-linking-dialog.c +++ b/libempathy-gtk/empathy-linking-dialog.c @@ -248,7 +248,7 @@ empathy_linking_dialog_show (FolksIndividual *individual, personas = folks_individual_get_personas (individual); for (l = personas; l != NULL; l = l->next) { - if (TPF_IS_PERSONA (l->data)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) num_personas++; } diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 9ae26142a..0547ef82d 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -885,7 +885,7 @@ empathy_contact_get_persona (EmpathyContact *contact) { TpfPersona *persona = j->data; - if (TPF_IS_PERSONA (persona)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (persona))) { TpContact *tp_contact = tpf_persona_get_contact (persona); @@ -1958,7 +1958,7 @@ empathy_contact_dup_best_for_action (FolksIndividual *individual, TpContact *tp_contact; EmpathyContact *contact; - if (!TPF_IS_PERSONA (l->data)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data)); diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 7ab59814f..da7dc3b9f 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -782,7 +782,7 @@ empathy_folks_individual_contains_contact (FolksIndividual *individual) personas = folks_individual_get_personas (individual); for (l = personas; l != NULL; l = l->next) { - if (TPF_IS_PERSONA (l->data)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) return (tpf_persona_get_contact (TPF_PERSONA (l->data)) != NULL); } @@ -809,7 +809,7 @@ empathy_contact_dup_from_folks_individual (FolksIndividual *individual) { TpfPersona *persona = l->data; - if (TPF_IS_PERSONA (persona)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (persona))) { TpContact *tp_contact; @@ -909,6 +909,24 @@ empathy_connection_can_group_personas (TpConnection *connection) FOLKS_MAYBE_BOOL_TRUE); } +gboolean +empathy_folks_persona_is_interesting (FolksPersona *persona) +{ + /* We're not interested in non-Telepathy personas */ + if (!TPF_IS_PERSONA (persona)) + return FALSE; + + /* We're not interested in user personas which haven't been added to the + * contact list (see bgo#637151). */ + if (folks_persona_get_is_user (persona) && + !tpf_persona_get_is_in_contact_list (TPF_PERSONA (persona))) + { + return FALSE; + } + + return TRUE; +} + gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert) { diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 0f5f968a5..6e16f0a77 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -113,6 +113,7 @@ TpfPersonaStore * empathy_get_persona_store_for_connection (TpConnection *connec gboolean empathy_connection_can_add_personas (TpConnection *connection); gboolean empathy_connection_can_alias_personas (TpConnection *connection); gboolean empathy_connection_can_group_personas (TpConnection *connection); +gboolean empathy_folks_persona_is_interesting (FolksPersona *persona); gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert); |