[cheese] sort the effects in the effect preview alphabetically



commit 9d41e9ea58579e6e50667ae3126c5bb8443cdc7c
Author: daniel g. siegel <dgsiegel gnome org>
Date:   Sun Dec 5 02:27:29 2010 +0100

    sort the effects in the effect preview alphabetically

 src/cheese-effects-manager.vala |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/cheese-effects-manager.vala b/src/cheese-effects-manager.vala
index 6c9e102..8cd48e7 100644
--- a/src/cheese-effects-manager.vala
+++ b/src/cheese-effects-manager.vala
@@ -109,6 +109,8 @@ internal class Cheese.EffectsManager : GLib.Object
     string user_effects = GLib.Path.build_filename (Environment.get_user_data_dir (), "gnome-video-effects");
     effects.add_all (load_effects_from_directory (user_effects));
 
+    effects.sort((CompareFunc) sort_value);
+
     /* add identity effect as the first in the effect list */
     if (effects.size > 0)
     {
@@ -133,4 +135,14 @@ internal class Cheese.EffectsManager : GLib.Object
   {
     return a.pipeline_desc == b.pipeline_desc;
   }
+
+  private static int sort_value (Effect a, Effect b)
+  {
+    if (a.name.down () < b.name.down ())
+      return -1;
+    else if (a.name.down () > b.name.down ())
+      return 1;
+    else
+      return 0;
+  }
 }



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