[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 99/473: Prevent duplicate entries in list page.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:54:29 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 fe6becbfcfb19434848ba7df0bb8841374d905bc
Author: Graeme Gott <graeme at gottcode.org>
Date:   Sat Jul 13 12:27:50 2013 -0400

    Prevent duplicate entries in list page.
---
 src/list_page.cpp |   24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/list_page.cpp b/src/list_page.cpp
index e2a87cd..6c4f3b6 100644
--- a/src/list_page.cpp
+++ b/src/list_page.cpp
@@ -28,30 +28,26 @@ using namespace WhiskerMenu;
 
 //-----------------------------------------------------------------------------
 
-static std::vector<std::string> read_list(XfceRc* rc, const gchar* key, std::vector<std::string> default_list)
+ListPage::ListPage(XfceRc* rc, const gchar* key, const std::vector<std::string>& default_desktop_ids, Menu* menu) :
+	Page(menu),
+	m_key(key)
 {
 	if (!rc || !xfce_rc_has_entry(rc, key))
 	{
-		return default_list;
+		m_desktop_ids = default_desktop_ids;
+		return;
 	}
 
-	std::vector<std::string> list;
 	gchar** values = xfce_rc_read_list_entry(rc, key, ",");
 	for (size_t i = 0; values[i] != NULL; ++i)
 	{
-		list.push_back(values[i]);
+		std::string desktop_id(values[i]);
+		if (std::find(m_desktop_ids.begin(), m_desktop_ids.end(), desktop_id) == m_desktop_ids.end())
+		{
+			m_desktop_ids.push_back(desktop_id);
+		}
 	}
 	g_strfreev(values);
-	return list;
-}
-
-//-----------------------------------------------------------------------------
-
-ListPage::ListPage(XfceRc* rc, const gchar* key, const std::vector<std::string>& default_desktop_ids, Menu* menu) :
-	Page(menu),
-	m_key(key),
-	m_desktop_ids(read_list(rc, key, default_desktop_ids))
-{
 }
 
 //-----------------------------------------------------------------------------

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


More information about the Xfce4-commits mailing list