[rygel] core: Sort by title by default



commit cac45560bbdb504c8027fabbcca5744c17c45ec6
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 be1eb77..076350f 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);
 
             results.serialize (this.didl_writer,
                                this.http_server,
@@ -117,6 +117,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]