aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-26 02:39:19 +0800
committerPhilip Withnall <philip.withnall@collabora.co.uk>2010-08-27 18:55:27 +0800
commit70159532bf83cb1e8210155b2e968f833fa4dd7e (patch)
tree6719c6b6fea4afe221ff3fcd251d4bb32028b2c1 /libempathy-gtk
parent2c7fdebf7a7cea6efbc0a305e681b7e7d158d821 (diff)
downloadgsoc2013-empathy-70159532bf83cb1e8210155b2e968f833fa4dd7e.tar
gsoc2013-empathy-70159532bf83cb1e8210155b2e968f833fa4dd7e.tar.gz
gsoc2013-empathy-70159532bf83cb1e8210155b2e968f833fa4dd7e.tar.bz2
gsoc2013-empathy-70159532bf83cb1e8210155b2e968f833fa4dd7e.tar.lz
gsoc2013-empathy-70159532bf83cb1e8210155b2e968f833fa4dd7e.tar.xz
gsoc2013-empathy-70159532bf83cb1e8210155b2e968f833fa4dd7e.tar.zst
gsoc2013-empathy-70159532bf83cb1e8210155b2e968f833fa4dd7e.zip
Add an EmpathyIndividualView::show-untrusted property
This allows the view to filter out untrusted Individuals (such as link-local XMPP contacts). This is used in the linking dialogue to disallow selection of link-local XMPP contacts for linking. Closes: bgo#627930
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-linker.c1
-rw-r--r--libempathy-gtk/empathy-individual-view.c49
-rw-r--r--libempathy-gtk/empathy-individual-view.h6
3 files changed, 56 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-individual-linker.c b/libempathy-gtk/empathy-individual-linker.c
index b4226a71c..0fc67c00c 100644
--- a/libempathy-gtk/empathy-individual-linker.c
+++ b/libempathy-gtk/empathy-individual-linker.c
@@ -335,6 +335,7 @@ set_up (EmpathyIndividualLinker *self)
EMPATHY_INDIVIDUAL_VIEW_FEATURE_PERSONA_DROP,
EMPATHY_INDIVIDUAL_FEATURE_NONE);
empathy_individual_view_set_show_offline (priv->individual_view, TRUE);
+ empathy_individual_view_set_show_untrusted (priv->individual_view, FALSE);
g_signal_connect (priv->individual_view, "row-activated",
(GCallback) row_activated_cb, self);
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 25de9510f..cffb5c99a 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -72,6 +72,7 @@ typedef struct
GtkWidget *tooltip_widget;
gboolean show_offline;
+ gboolean show_untrusted;
GtkTreeModelFilter *filter;
GtkWidget *search_widget;
@@ -102,6 +103,7 @@ enum
PROP_VIEW_FEATURES,
PROP_INDIVIDUAL_FEATURES,
PROP_SHOW_OFFLINE,
+ PROP_SHOW_UNTRUSTED,
};
/* TODO: re-add DRAG_TYPE_CONTACT_ID, for the case that we're dragging around
@@ -1588,6 +1590,12 @@ individual_view_is_visible_individual (EmpathyIndividualView *self,
/* We're only giving the visibility wrt filtering here, not things like
* presence. */
+ if (priv->show_untrusted == FALSE &&
+ folks_individual_get_trust_level (individual) == FOLKS_TRUST_LEVEL_NONE)
+ {
+ return FALSE;
+ }
+
if (is_searching == FALSE)
return (priv->show_offline || is_online);
@@ -1913,6 +1921,9 @@ individual_view_get_property (GObject *object,
case PROP_SHOW_OFFLINE:
g_value_set_boolean (value, priv->show_offline);
break;
+ case PROP_SHOW_UNTRUSTED:
+ g_value_set_boolean (value, priv->show_untrusted);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -1943,6 +1954,10 @@ individual_view_set_property (GObject *object,
empathy_individual_view_set_show_offline (view,
g_value_get_boolean (value));
break;
+ case PROP_SHOW_UNTRUSTED:
+ empathy_individual_view_set_show_untrusted (view,
+ g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -2022,6 +2037,13 @@ empathy_individual_view_class_init (EmpathyIndividualViewClass *klass)
"Show Offline",
"Whether contact list should display "
"offline contacts", FALSE, G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_SHOW_UNTRUSTED,
+ g_param_spec_boolean ("show-untrusted",
+ "Show Untrusted Individuals",
+ "Whether the view should display untrusted individuals; "
+ "those who could not be who they say they are.",
+ TRUE, G_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (EmpathyIndividualViewPriv));
}
@@ -2033,6 +2055,9 @@ empathy_individual_view_init (EmpathyIndividualView *view)
EMPATHY_TYPE_INDIVIDUAL_VIEW, EmpathyIndividualViewPriv);
view->priv = priv;
+
+ priv->show_untrusted = TRUE;
+
/* Get saved group states. */
empathy_contact_groups_get_all ();
@@ -2435,6 +2460,30 @@ empathy_individual_view_set_show_offline (EmpathyIndividualView *self,
gtk_tree_model_filter_refilter (priv->filter);
}
+gboolean
+empathy_individual_view_get_show_untrusted (EmpathyIndividualView *self)
+{
+ g_return_val_if_fail (EMPATHY_IS_INDIVIDUAL_VIEW (self), FALSE);
+
+ return GET_PRIV (self)->show_untrusted;
+}
+
+void
+empathy_individual_view_set_show_untrusted (EmpathyIndividualView *self,
+ gboolean show_untrusted)
+{
+ EmpathyIndividualViewPriv *priv;
+
+ g_return_if_fail (EMPATHY_IS_INDIVIDUAL_VIEW (self));
+
+ priv = GET_PRIV (self);
+
+ priv->show_untrusted = show_untrusted;
+
+ g_object_notify (G_OBJECT (self), "show-untrusted");
+ gtk_tree_model_filter_refilter (priv->filter);
+}
+
EmpathyIndividualStore *
empathy_individual_view_get_store (EmpathyIndividualView *self)
{
diff --git a/libempathy-gtk/empathy-individual-view.h b/libempathy-gtk/empathy-individual-view.h
index 8a250bf20..3c141021a 100644
--- a/libempathy-gtk/empathy-individual-view.h
+++ b/libempathy-gtk/empathy-individual-view.h
@@ -118,6 +118,12 @@ void empathy_individual_view_set_show_offline (
EmpathyIndividualView *view,
gboolean show_offline);
+gboolean empathy_individual_view_get_show_untrusted (
+ EmpathyIndividualView *self);
+
+void empathy_individual_view_set_show_untrusted (EmpathyIndividualView *self,
+ gboolean show_untrusted);
+
gboolean empathy_individual_view_is_searching (
EmpathyIndividualView *view);