[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 89/473: Add menu action to clear recently used.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:54:19 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 f5bf0dbc25ed259ccb991d2ce6add5b424b96f69
Author: Graeme Gott <graeme at gottcode.org>
Date: Fri Jul 12 12:20:57 2013 -0400
Add menu action to clear recently used.
---
src/recent_page.cpp | 25 +++++++++++++++++++++++++
src/recent_page.hpp | 8 ++++++++
2 files changed, 33 insertions(+)
diff --git a/src/recent_page.cpp b/src/recent_page.cpp
index 9ba43c4..3cebac2 100644
--- a/src/recent_page.cpp
+++ b/src/recent_page.cpp
@@ -19,6 +19,7 @@
#include "launcher.hpp"
#include "launcher_model.hpp"
#include "launcher_view.hpp"
+#include "menu.hpp"
using namespace WhiskerMenu;
@@ -60,3 +61,27 @@ void RecentPage::add(Launcher* launcher)
}
//-----------------------------------------------------------------------------
+
+void RecentPage::extend_context_menu(GtkWidget* menu)
+{
+ GtkWidget* menuitem = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+
+ menuitem = gtk_menu_item_new_with_label(_("Clear Recently Used"));
+ g_signal_connect(menuitem, "activate", SLOT_CALLBACK(RecentPage::clear_menu), this);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
+}
+
+//-----------------------------------------------------------------------------
+
+void RecentPage::clear_menu(GtkMenuItem*)
+{
+ LauncherModel model(GTK_LIST_STORE(get_view()->get_model()));
+ for (size_t i = 0, count = size(); i < count; ++i)
+ {
+ model.remove_first_item();
+ }
+ get_menu()->set_modified();
+}
+
+//-----------------------------------------------------------------------------
diff --git a/src/recent_page.hpp b/src/recent_page.hpp
index ac97f4c..32b75d6 100644
--- a/src/recent_page.hpp
+++ b/src/recent_page.hpp
@@ -19,6 +19,8 @@
#include "list_page.hpp"
+#include "slot.hpp"
+
namespace WhiskerMenu
{
@@ -33,6 +35,12 @@ public:
void add(Launcher* launcher);
private:
+ void extend_context_menu(GtkWidget* menu);
+
+private:
+ SLOT_1(void, RecentPage, clear_menu, GtkMenuItem*);
+
+private:
size_t m_max_items;
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list