aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-17 21:13:19 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-29 18:54:37 +0800
commit3a6aca03ec70cb11d23cfd68e72a51a4a49220a2 (patch)
treef184179dd1d71d4d51e482dde329954295ecd10c /libempathy-gtk
parent6341b2e61078bf64602c6de2115599690d680596 (diff)
downloadgsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar
gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.gz
gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.bz2
gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.lz
gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.xz
gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.tar.zst
gsoc2013-empathy-3a6aca03ec70cb11d23cfd68e72a51a4a49220a2.zip
protocol-chooser: expose a 'service' string instead of boolean for facebook and gtalk
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-protocol-chooser.c46
-rw-r--r--libempathy-gtk/empathy-protocol-chooser.h6
2 files changed, 19 insertions, 33 deletions
diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c
index 852f38174..2017b3363 100644
--- a/libempathy-gtk/empathy-protocol-chooser.c
+++ b/libempathy-gtk/empathy-protocol-chooser.c
@@ -77,8 +77,7 @@ enum
COL_LABEL,
COL_CM,
COL_PROTOCOL_NAME,
- COL_IS_GTALK,
- COL_IS_FACEBOOK,
+ COL_SERVICE,
COL_COUNT
};
@@ -131,16 +130,18 @@ protocol_chooser_sort_func (GtkTreeModel *model,
* non-gtalk */
if (cmp == 0)
{
- gboolean is_gtalk, is_facebook;
+ gchar *service;
+
gtk_tree_model_get (model, iter_a,
- COL_IS_GTALK, &is_gtalk,
- COL_IS_FACEBOOK, &is_facebook,
+ COL_SERVICE, &service,
-1);
- if (is_gtalk || is_facebook)
+ if (service != NULL)
cmp = 1;
else
cmp = -1;
+
+ g_free (service);
}
}
@@ -235,8 +236,6 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
COL_LABEL, display_name,
COL_CM, cm,
COL_PROTOCOL_NAME, proto->name,
- COL_IS_GTALK, FALSE,
- COL_IS_FACEBOOK, FALSE,
-1);
if (!tp_strdiff (proto->name, "jabber") &&
@@ -249,8 +248,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
COL_LABEL, display_name,
COL_CM, cm,
COL_PROTOCOL_NAME, proto->name,
- COL_IS_GTALK, TRUE,
- COL_IS_FACEBOOK, FALSE,
+ COL_SERVICE, "google-talk",
-1);
display_name = empathy_protocol_name_to_display_name ("facebook");
@@ -260,8 +258,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
COL_LABEL, display_name,
COL_CM, cm,
COL_PROTOCOL_NAME, proto->name,
- COL_IS_GTALK, FALSE,
- COL_IS_FACEBOOK, TRUE,
+ COL_SERVICE, "facebook",
-1);
}
@@ -312,8 +309,7 @@ protocol_chooser_constructed (GObject *object)
G_TYPE_STRING, /* Label */
G_TYPE_OBJECT, /* CM */
G_TYPE_STRING, /* protocol name */
- G_TYPE_BOOLEAN, /* is gtalk */
- G_TYPE_BOOLEAN); /* is facebook */
+ G_TYPE_STRING); /* service */
/* Set the protocol sort function */
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
@@ -426,13 +422,12 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
TpConnectionManager *cm = NULL;
gchar *protocol_name = NULL;
gboolean visible = FALSE;
- gboolean is_gtalk, is_facebook;
+ gchar *service;
gtk_tree_model_get (model, iter,
COL_CM, &cm,
COL_PROTOCOL_NAME, &protocol_name,
- COL_IS_GTALK, &is_gtalk,
- COL_IS_FACEBOOK, &is_facebook,
+ COL_SERVICE, &service,
-1);
if (cm != NULL && protocol_name != NULL)
@@ -444,7 +439,7 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
if (protocol != NULL)
{
- visible = priv->filter_func (cm, protocol, is_gtalk, is_facebook,
+ visible = priv->filter_func (cm, protocol, service,
priv->filter_user_data);
}
}
@@ -452,6 +447,7 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
if (cm != NULL)
g_object_unref (cm);
+ g_free (service);
return visible;
}
@@ -470,8 +466,7 @@ TpConnectionManager *
empathy_protocol_chooser_dup_selected (
EmpathyProtocolChooser *protocol_chooser,
TpConnectionManagerProtocol **protocol,
- gboolean *is_gtalk,
- gboolean *is_facebook)
+ gchar **service)
{
GtkTreeIter iter;
TpConnectionManager *cm = NULL;
@@ -512,17 +507,10 @@ empathy_protocol_chooser_dup_selected (
}
}
- if (is_gtalk != NULL)
- {
- gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
- COL_IS_GTALK, is_gtalk,
- -1);
- }
-
- if (is_facebook != NULL)
+ if (service != NULL)
{
gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
- COL_IS_FACEBOOK, is_facebook,
+ COL_SERVICE, service,
-1);
}
}
diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h
index 88b23cba2..d5c59c26f 100644
--- a/libempathy-gtk/empathy-protocol-chooser.h
+++ b/libempathy-gtk/empathy-protocol-chooser.h
@@ -60,8 +60,7 @@ struct _EmpathyProtocolChooserClass
typedef gboolean (*EmpathyProtocolChooserFilterFunc) (TpConnectionManager *cm,
TpConnectionManagerProtocol *protocol,
- gboolean is_gtalk,
- gboolean is_facebook,
+ const gchar *service,
gpointer user_data);
GType empathy_protocol_chooser_get_type (void) G_GNUC_CONST;
@@ -69,8 +68,7 @@ GtkWidget * empathy_protocol_chooser_new (void);
TpConnectionManager *empathy_protocol_chooser_dup_selected (
EmpathyProtocolChooser *protocol_chooser,
TpConnectionManagerProtocol **protocol,
- gboolean *is_gtalk,
- gboolean *is_facebook);
+ gchar **service);
void empathy_protocol_chooser_set_visible (
EmpathyProtocolChooser *protocol_chooser,