]> git.0d.be Git - empathy.git/commitdiff
Improve the sort function a bit to have Jabber before GTalk.
authorXavier Claessens <xclaesse@gmail.com>
Sat, 28 Jul 2007 20:50:50 +0000 (20:50 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Sat, 28 Jul 2007 20:50:50 +0000 (20:50 +0000)
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.

svn path=/trunk/; revision=208

ChangeLog
libempathy-gtk/empathy-profile-chooser.c

index ad8fa8dc182962a16db8a56eecc4bedbe1bc9a90..cf3e7968fa97b4bbadee099a5a51cdf403568a92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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:
index a3cc9a32d6b552e41172f741f9b71212c59ba390..a03da1750e71d653000ba3ec876a916500ac6af8 100644 (file)
@@ -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));