[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 436/473: Add check to recent page if already in list.

noreply at xfce.org noreply at xfce.org
Tue Feb 17 00:00:06 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 c9747498c98341544b6a99071ae6d238569127f6
Author: Graeme Gott <graeme at gottcode.org>
Date:   Tue Dec 31 09:54:47 2013 -0500

    Add check to recent page if already in list.
---
 panel-plugin/recent-page.cpp |   25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/panel-plugin/recent-page.cpp b/panel-plugin/recent-page.cpp
index fc346c4..add3817 100644
--- a/panel-plugin/recent-page.cpp
+++ b/panel-plugin/recent-page.cpp
@@ -22,6 +22,8 @@
 #include "settings.h"
 #include "slot.h"
 
+#include <algorithm>
+
 #include <glib/gi18n-lib.h>
 
 using namespace WhiskerMenu;
@@ -48,14 +50,25 @@ void RecentPage::add(Launcher* launcher)
 		return;
 	}
 
-	// Skip if already first launcher
-	if (!wm_settings->recent.empty() && (wm_settings->recent.front() == launcher->get_desktop_id()))
+	if (!wm_settings->recent.empty())
 	{
-		return;
-	}
+		std::vector<std::string>::iterator i = std::find(wm_settings->recent.begin(), wm_settings->recent.end(), launcher->get_desktop_id());
 
-	// Remove item if already in list
-	remove(launcher);
+		// Skip if already first launcher
+		if (i == wm_settings->recent.begin())
+		{
+			return;
+		}
+		// Move to front if already in list
+		else if (i != wm_settings->recent.end())
+		{
+			GtkTreeModel* model = get_view()->get_model();
+			GtkTreeIter iter;
+			gtk_tree_model_iter_nth_child(model, &iter, NULL, std::distance(wm_settings->recent.begin(), i));
+			gtk_list_store_move_after(GTK_LIST_STORE(model), &iter, NULL);
+			return;
+		}
+	}
 
 	// Prepend to list of items
 	GtkListStore* store = GTK_LIST_STORE(get_view()->get_model());

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


More information about the Xfce4-commits mailing list