[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 269/473: Add running search actions.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:57: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 6ec86927e03db11fa39d12043596b72c539ecdfa
Author: Graeme Gott <graeme at gottcode.org>
Date: Fri Nov 22 09:46:44 2013 -0500
Add running search actions.
---
panel-plugin/search-page.cpp | 16 ++++++++++++++++
panel-plugin/settings.cpp | 11 +++++++++++
panel-plugin/settings.h | 3 +++
3 files changed, 30 insertions(+)
diff --git a/panel-plugin/search-page.cpp b/panel-plugin/search-page.cpp
index 1c338bc..436ccbc 100644
--- a/panel-plugin/search-page.cpp
+++ b/panel-plugin/search-page.cpp
@@ -19,6 +19,8 @@
#include "launcher.h"
#include "launcher-view.h"
+#include "search-action.h"
+#include "settings.h"
#include "slot.h"
#include "window.h"
@@ -90,6 +92,20 @@ void SearchPage::set_filter(const gchar* filter)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_POINTER);
+ SearchAction* action;
+ for (std::vector<SearchAction*>::size_type i = 0, end = wm_settings->search_actions.size(); i < end; ++i)
+ {
+ action = wm_settings->search_actions[i];
+ if (action->match(filter))
+ {
+ gtk_list_store_insert_with_values(
+ store, NULL, G_MAXINT,
+ LauncherView::COLUMN_ICON, action->get_icon(),
+ LauncherView::COLUMN_TEXT, action->get_text(),
+ LauncherView::COLUMN_LAUNCHER, action,
+ -1);
+ }
+ }
Launcher* launcher;
for (std::vector<Match>::size_type i = 0, end = m_matches.size(); i < end; ++i)
{
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index 314b411..d619fd1 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -18,6 +18,7 @@
#include "settings.h"
#include "command.h"
+#include "search-action.h"
#include <algorithm>
@@ -112,6 +113,11 @@ Settings::Settings() :
command[CommandSwitchUser] = new Command("system-users", _("Switch _Users"), "gdmflexiserver", _("Failed to switch users."));
command[CommandLogOut] = new Command("system-log-out", _("Log _Out"), "xfce4-session-logout", _("Failed to log out."));
command[CommandMenuEditor] = new Command("xfce4-menueditor", _("_Edit Applications"), "menulibre", _("Failed to launch menu editor."));
+
+ search_actions.push_back(new SearchAction(_("Man Pages"), "#", "exo-open --launch TerminalEmulator man %s", false, true));
+ search_actions.push_back(new SearchAction(_("Wikipedia"), "!w", "exo-open --launch WebBrowser http://en.wikipedia.org/wiki/%u", false, true));
+ search_actions.push_back(new SearchAction(_("Run in Terminal"), "!", "exo-open --launch TerminalEmulator %s", false, true));
+ search_actions.push_back(new SearchAction(_("Open URI"), "^(file|http|https):\\/\\/(.*)$", "exo-open \\0", true, true));
}
//-----------------------------------------------------------------------------
@@ -122,6 +128,11 @@ Settings::~Settings()
{
delete command[i];
}
+
+ for (std::vector<SearchAction*>::size_type i = 0, end = search_actions.size(); i < end; ++i)
+ {
+ delete search_actions[i];
+ }
}
//-----------------------------------------------------------------------------
diff --git a/panel-plugin/settings.h b/panel-plugin/settings.h
index 55e22fc..8e7fcf8 100644
--- a/panel-plugin/settings.h
+++ b/panel-plugin/settings.h
@@ -28,6 +28,7 @@ namespace WhiskerMenu
class Command;
class Plugin;
+class SearchAction;
class Settings
{
@@ -86,6 +87,8 @@ public:
};
Command* command[CountCommands];
+ std::vector<SearchAction*> search_actions;
+
int menu_width;
int menu_height;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list