[rygel/gnome-2-32] core: Sort by title by default



commit af5755cf8fb5a1a7a0f5345857046cd39df6e59a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Nov 8 00:57:51 2010 +0200

    core: Sort by title by default
    
    Sort Search and Browse results alphabetically (in descending order) by title
    when no sort criteria is specified by the client.

 src/rygel/rygel-media-query-action.vala |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/rygel/rygel-media-query-action.vala b/src/rygel/rygel-media-query-action.vala
index 0ed6182..ba2aa7f 100644
--- a/src/rygel/rygel-media-query-action.vala
+++ b/src/rygel/rygel-media-query-action.vala
@@ -27,6 +27,8 @@ using Gee;
  * Base class of Browse and Search actions.
  */
 internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
+    private const string DEFAULT_SORT_CRITERIA = "-dc:title";
+
     // In arguments
     public string object_id;
     public string browse_flag;
@@ -79,9 +81,7 @@ internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
                 this.update_id = uint32.MAX;
             }
 
-            if (this.sort_criteria != null) {
-                results.sort_by_criteria (this.sort_criteria);
-            }
+            results.sort_by_criteria (this.sort_criteria);
 
             foreach (var result in results) {
                 if (result is MediaItem && this.xbox_hacks != null) {
@@ -121,6 +121,10 @@ internal abstract class Rygel.MediaQueryAction : GLib.Object, StateMachine {
                                         _("No such object"));
         }
 
+        if (this.sort_criteria == null) {
+            this.sort_criteria = DEFAULT_SORT_CRITERIA;
+        }
+
         if (this.xbox_hacks != null) {
             this.xbox_hacks.translate_container_id (this, ref this.object_id);
         }



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