[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 183/473: Only create subcategories when loading hierarchy.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:55:53 CET 2015


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 3fa101f5f6d4cb7c28a227b915d70163fdf43514
Author: Graeme Gott <graeme at gottcode.org>
Date:   Tue Oct 15 18:50:30 2013 -0400

    Only create subcategories when loading hierarchy.
---
 src/applications_page.cpp |    4 ++++
 src/category.cpp          |    8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/applications_page.cpp b/src/applications_page.cpp
index 5430791..21368b9 100644
--- a/src/applications_page.cpp
+++ b/src/applications_page.cpp
@@ -229,6 +229,10 @@ void ApplicationsPage::load_menu(GarconMenu* menu, Category* parent_category)
 			category = new Category(directory);
 			m_categories.push_back(category);
 		}
+		else if (!f_load_hierarchy)
+		{
+			category = parent_category;
+		}
 		else if (parent_category)
 		{
 			category = parent_category->append_menu(directory);
diff --git a/src/category.cpp b/src/category.cpp
index 62517d1..0e0c52c 100644
--- a/src/category.cpp
+++ b/src/category.cpp
@@ -164,6 +164,10 @@ void Category::sort()
 {
 	unset_model();
 	merge();
+	if (m_has_separators)
+	{
+		m_items.erase(std::remove_if(m_items.begin(), m_items.end(), is_null), m_items.end());
+	}
 	std::sort(m_items.begin(), m_items.end(), &Element::less_than);
 }
 
@@ -293,7 +297,7 @@ void Category::merge()
 		m_items.insert(m_items.end(), (*i)->m_items.begin(), (*i)->m_items.end());
 	}
 
-	// Remove subcategories and separators
+	// Remove subcategories
 	for (std::vector<Element*>::iterator i = m_items.begin(), end = m_items.end(); i != end; ++i)
 	{
 		if (is_category(*i))
@@ -301,7 +305,6 @@ void Category::merge()
 			*i = NULL;
 		}
 	}
-	m_items.erase(std::remove_if(m_items.begin(), m_items.end(), is_null), m_items.end());
 
 	// Delete direct subcategories; they will recursively delete their subcategories
 	for (std::vector<Category*>::size_type i = 0; i < last_direct; ++i)
@@ -310,6 +313,7 @@ void Category::merge()
 	}
 
 	m_has_subcategories = false;
+	m_has_separators = true;
 }
 
 //-----------------------------------------------------------------------------

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list