[gtk+/open-with-dialog] open-with-widget: don't sort by name recommended apps



commit e32c6a81a6181164892c8256c2395c80867fedf7
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Nov 19 13:07:56 2010 +0100

    open-with-widget: don't sort by name recommended apps

 gtk/gtkopenwithwidget.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkopenwithwidget.c b/gtk/gtkopenwithwidget.c
index e641a47..15ab1b9 100644
--- a/gtk/gtkopenwithwidget.c
+++ b/gtk/gtkopenwithwidget.c
@@ -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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]