aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--libempathy-gtk/empathy-profile-chooser.c28
2 files changed, 23 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index ad8fa8dc1..cf3e7968f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2007-07-28 Xavier Claessens <xclaesse@gmail.com>
+ * libempathy-gtk/empathy-profile-chooser.c: Improve the sort function
+ a bit to have Jabber before GTalk.
+
+2007-07-28 Xavier Claessens <xclaesse@gmail.com>
+
* libempathy-gtk/empathy-accounts-dialog.glade:
* libempathy-gtk/empathy-accounts-dialog.c: Update the Enable/Disable
button even if there is no account selected. Set it insensitive if no
diff --git a/libempathy-gtk/empathy-profile-chooser.c b/libempathy-gtk/empathy-profile-chooser.c
index a3cc9a32d..a03da1750 100644
--- a/libempathy-gtk/empathy-profile-chooser.c
+++ b/libempathy-gtk/empathy-profile-chooser.c
@@ -53,16 +53,28 @@ empathy_profile_chooser_get_selected (GtkWidget *widget)
}
static gint
-profile_chooser_sort_protocol_value (const gchar *protocol_name)
+profile_chooser_sort_profile_value (McProfile *profile)
{
- if (strcmp (protocol_name, "jabber") == 0) {
+ const gchar *name;
+
+ name = mc_profile_get_unique_name (profile);
+
+ /* Jabber is the prefered protocol, salut is a free protocol so it
+ * should be at the begining of the list, and google talk uses the
+ * free jabber protocol so it gets the 3rd place.
+ * FIXME: Add other free protocols in this list.
+ */
+ if (strcmp (name, "jabber") == 0) {
return 0;
}
- else if (strcmp (protocol_name, "salut") == 0) {
+ else if (strcmp (name, "salut") == 0) {
return 1;
}
+ else if (strcmp (name, "gtalk") == 0) {
+ return 2;
+ }
- return 2;
+ return 3;
}
static gint
@@ -73,8 +85,6 @@ profile_chooser_sort_func (GtkTreeModel *model,
{
McProfile *profile_a;
McProfile *profile_b;
- const gchar *proto_a;
- const gchar *proto_b;
gint cmp;
gtk_tree_model_get (model, iter_a,
@@ -84,10 +94,8 @@ profile_chooser_sort_func (GtkTreeModel *model,
COL_PROFILE, &profile_b,
-1);
- proto_a = mc_profile_get_protocol_name (profile_a);
- proto_b = mc_profile_get_protocol_name (profile_b);
- cmp = profile_chooser_sort_protocol_value (proto_a);
- cmp -= profile_chooser_sort_protocol_value (proto_b);
+ cmp = profile_chooser_sort_profile_value (profile_a);
+ cmp -= profile_chooser_sort_profile_value (profile_b);
if (cmp == 0) {
cmp = strcmp (mc_profile_get_display_name (profile_a),
mc_profile_get_display_name (profile_b));