]> Pileus Git - ~andy/gtk/commitdiff
open-with-widget: don't sort by name recommended apps
authorCosimo Cecchi <cosimoc@gnome.org>
Fri, 19 Nov 2010 12:07:56 +0000 (13:07 +0100)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 23 Nov 2010 15:51:40 +0000 (16:51 +0100)
gtk/gtkopenwithwidget.c

index e641a47a22c22a104b04ba52de19b5b13d100e03..15ab1b90dd598f443ad17d15c893cda2a053c839 100644 (file)
@@ -350,7 +350,7 @@ gtk_open_with_sort_func (GtkTreeModel *model,
   gboolean a_fallback, b_fallback;
   gboolean a_heading, b_heading;
   gchar *a_name, *b_name, *a_casefold, *b_casefold;
-  gint retval;
+  gint retval = 0;
 
   /* this returns:
    * - <0 if a should show before b
@@ -411,15 +411,19 @@ gtk_open_with_sort_func (GtkTreeModel *model,
       goto out;
     }
 
-  a_casefold = a_name != NULL ?
-    g_utf8_casefold (a_name, -1) : NULL;
-  b_casefold = b_name != NULL ?
-    g_utf8_casefold (b_name, -1) : NULL;
+  /* don't order by name recommended applications, but use GLib's ordering */
+  if (!a_recommended)
+    {
+      a_casefold = a_name != NULL ?
+       g_utf8_casefold (a_name, -1) : NULL;
+      b_casefold = b_name != NULL ?
+       g_utf8_casefold (b_name, -1) : NULL;
 
-  retval = g_strcmp0 (a_casefold, b_casefold);
+      retval = g_strcmp0 (a_casefold, b_casefold);
 
-  g_free (a_casefold);
-  g_free (b_casefold);
+      g_free (a_casefold);
+      g_free (b_casefold);
+    }
 
  out:
   g_free (a_name);