[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 90/473: Hide implementation of finding launchers.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:54:20 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 cb445d3709feff11e67f57f1dbc6b63508ef8f8c
Author: Graeme Gott <graeme at gottcode.org>
Date:   Fri Jul 12 15:15:39 2013 -0400

    Hide implementation of finding launchers.
---
 src/applications_page.cpp |   10 +++++++++-
 src/applications_page.hpp |    2 ++
 src/list_page.cpp         |    9 +++++----
 src/list_page.hpp         |    2 +-
 src/menu.cpp              |    6 +++---
 src/menu.hpp              |    2 +-
 6 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/src/applications_page.cpp b/src/applications_page.cpp
index d5821d6..2f0f8f5 100644
--- a/src/applications_page.cpp
+++ b/src/applications_page.cpp
@@ -81,6 +81,14 @@ ApplicationsPage::~ApplicationsPage()
 
 //-----------------------------------------------------------------------------
 
+Launcher* ApplicationsPage::get_application(const std::string& desktop_id) const
+{
+	std::map<std::string, Launcher*>::const_iterator i = m_items.find(desktop_id);
+	return (i != m_items.end()) ? i->second : NULL;
+}
+
+//-----------------------------------------------------------------------------
+
 void ApplicationsPage::apply_filter(GtkToggleButton* togglebutton)
 {
 	// Find category matching button
@@ -177,7 +185,7 @@ void ApplicationsPage::load_applications()
 	load_categories();
 
 	// Update menu items of other panels
-	get_menu()->set_items(m_items);
+	get_menu()->set_items();
 
 	m_loaded = true;
 }
diff --git a/src/applications_page.hpp b/src/applications_page.hpp
index b57c065..cb9bd01 100644
--- a/src/applications_page.hpp
+++ b/src/applications_page.hpp
@@ -63,6 +63,8 @@ public:
 	explicit ApplicationsPage(Menu* menu);
 	~ApplicationsPage();
 
+	Launcher* get_application(const std::string& desktop_id) const;
+
 	void load_applications();
 
 public:
diff --git a/src/list_page.cpp b/src/list_page.cpp
index e6d3673..0a31ba4 100644
--- a/src/list_page.cpp
+++ b/src/list_page.cpp
@@ -16,6 +16,7 @@
 
 #include "list_page.hpp"
 
+#include "applications_page.hpp"
 #include "launcher.hpp"
 #include "launcher_model.hpp"
 #include "launcher_view.hpp"
@@ -100,7 +101,7 @@ void ListPage::save(XfceRc* settings)
 
 //-----------------------------------------------------------------------------
 
-void ListPage::set_menu_items(const std::map<std::string, Launcher*>& items)
+void ListPage::set_menu_items()
 {
 	// Create new model for treeview
 	LauncherModel model;
@@ -113,10 +114,10 @@ void ListPage::set_menu_items(const std::map<std::string, Launcher*>& items)
 			continue;
 		}
 
-		std::map<std::string, Launcher*>::const_iterator item = items.find(*i);
-		if (item != items.end())
+		Launcher* launcher = get_menu()->get_applications()->get_application(*i);
+		if (launcher)
 		{
-			model.append_item(item->second);
+			model.append_item(launcher);
 		}
 		else
 		{
diff --git a/src/list_page.hpp b/src/list_page.hpp
index cfb25a4..3f721f0 100644
--- a/src/list_page.hpp
+++ b/src/list_page.hpp
@@ -50,7 +50,7 @@ public:
 	virtual void add(Launcher* launcher)=0;
 	void remove(Launcher* launcher);
 	void save(XfceRc* settings);
-	void set_menu_items(const std::map<std::string, Launcher*>& items);
+	void set_menu_items();
 	void unset_menu_items();
 
 private:
diff --git a/src/menu.cpp b/src/menu.cpp
index 0c2bbc1..94fad8b 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -451,11 +451,11 @@ void Menu::set_categories(const std::vector<SectionButton*>& categories)
 
 //-----------------------------------------------------------------------------
 
-void Menu::set_items(const std::map<std::string, Launcher*>& items)
+void Menu::set_items()
 {
 	m_search_results->set_menu_items(m_applications->get_model());
-	m_favorites->set_menu_items(items);
-	m_recent->set_menu_items(items);
+	m_favorites->set_menu_items();
+	m_recent->set_menu_items();
 
 	// Handle switching to favorites are added
 	GtkTreeModel* favorites_model = m_favorites->get_view()->get_model();
diff --git a/src/menu.hpp b/src/menu.hpp
index 03f015b..4959705 100644
--- a/src/menu.hpp
+++ b/src/menu.hpp
@@ -80,7 +80,7 @@ public:
 	void show(GtkWidget* parent, bool horizontal);
 	void save(XfceRc* settings);
 	void set_categories(const std::vector<SectionButton*>& categories);
-	void set_items(const std::map<std::string, Launcher*>& items);
+	void set_items();
 	void set_modified();
 	void unset_items();
 

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


More information about the Xfce4-commits mailing list