[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 74/473: Also search executable names. Closes #13.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:54:04 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 7fe4f7c047277147b8bbb3d4ba72f4ee9b100057
Author: Graeme Gott <graeme at gottcode.org>
Date: Fri Jul 5 11:25:51 2013 -0400
Also search executable names. Closes #13.
---
src/launcher.cpp | 19 +++++++++++++++++--
src/launcher.hpp | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/launcher.cpp b/src/launcher.cpp
index 5779384..cacd82d 100644
--- a/src/launcher.cpp
+++ b/src/launcher.cpp
@@ -142,7 +142,7 @@ Launcher::Launcher(GarconMenuItem* item) :
}
m_text = g_markup_printf_escaped("%s<b>%s</b>\n%s%s", direction, display_name, direction, details);
- // Create search text
+ // Create search text for comment
gchar* normalized = g_utf8_normalize(details, -1, G_NORMALIZE_DEFAULT);
gchar* utf8 = g_utf8_casefold(normalized, -1);
m_search_comment = utf8;
@@ -154,12 +154,23 @@ Launcher::Launcher(GarconMenuItem* item) :
m_text = g_markup_printf_escaped("%s%s", direction, display_name);
}
- // Create search text
+ // Create search text for display name
gchar* normalized = g_utf8_normalize(display_name, -1, G_NORMALIZE_DEFAULT);
gchar* utf8 = g_utf8_casefold(normalized, -1);
m_search_name = utf8;
g_free(utf8);
g_free(normalized);
+
+ // Create search text for command
+ const gchar* command = garcon_menu_item_get_command(m_item);
+ if (!exo_str_is_empty(command))
+ {
+ normalized = g_utf8_normalize(command, -1, G_NORMALIZE_DEFAULT);
+ utf8 = g_utf8_casefold(normalized, -1);
+ m_search_command = utf8;
+ g_free(utf8);
+ g_free(normalized);
+ }
}
//-----------------------------------------------------------------------------
@@ -274,6 +285,10 @@ void Launcher::search(const Query& query)
}
unsigned int match = query.match(m_search_name);
+ if (match == UINT_MAX)
+ {
+ match = query.match(m_search_command);
+ }
if ((match == UINT_MAX) && f_show_description)
{
match = query.match(m_search_comment);
diff --git a/src/launcher.hpp b/src/launcher.hpp
index e3a3885..e1a2e3c 100644
--- a/src/launcher.hpp
+++ b/src/launcher.hpp
@@ -77,6 +77,7 @@ private:
gchar* m_text;
std::string m_search_name;
std::string m_search_comment;
+ std::string m_search_command;
std::map<std::string, unsigned int> m_searches;
};
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list