paperbox r126 - in trunk: . src



Author: markoa
Date: Tue Apr 15 22:19:46 2008
New Revision: 126
URL: http://svn.gnome.org/viewvc/paperbox?rev=126&view=rev

Log:
Sort categories by name

Modified:
   trunk/ChangeLog
   trunk/src/category-factory.cc

Modified: trunk/src/category-factory.cc
==============================================================================
--- trunk/src/category-factory.cc	(original)
+++ trunk/src/category-factory.cc	Tue Apr 15 22:19:46 2008
@@ -37,6 +37,19 @@
     using std::string;
     using boost::shared_ptr;
 
+    struct category_name_compare
+        : public std::binary_function<shared_ptr<Category>,
+                                      shared_ptr<Category>,
+                                      bool>
+    {
+        bool
+        operator()(const shared_ptr<Category>& lhs,
+                   const shared_ptr<Category>& rhs) const
+            {
+                return (lhs->get_name() < rhs->get_name());
+            }
+    };
+
     shared_ptr<Category>
     CategoryFactory::create_category(const Glib::ustring& name)
     {
@@ -127,6 +140,8 @@
             categories.push_back(cat);
         }
 
+        categories.sort(category_name_compare());
+
         return categories;
     }
 



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