[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 53/473: Select first search result.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:53:43 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 65e76ba7d85db44dc9be5f6547a44e0f7dbcb5c7
Author: Graeme Gott <graeme at gottcode.org>
Date:   Mon Jul 1 18:08:48 2013 -0400

    Select first search result.
---
 src/search_page.cpp |   40 +++++++++-------------------------------
 src/search_page.hpp |    1 -
 2 files changed, 9 insertions(+), 32 deletions(-)

diff --git a/src/search_page.cpp b/src/search_page.cpp
index b748032..f03ffd5 100644
--- a/src/search_page.cpp
+++ b/src/search_page.cpp
@@ -31,8 +31,7 @@ using namespace WhiskerMenu;
 //-----------------------------------------------------------------------------
 
 SearchPage::SearchPage(Menu* menu) :
-	FilterPage(menu),
-	m_filter_matching_path(NULL)
+	FilterPage(menu)
 {
 	get_view()->set_selection_mode(GTK_SELECTION_BROWSE);
 
@@ -69,33 +68,18 @@ void SearchPage::set_filter(const gchar* filter)
 	// Apply filter
 	refilter();
 
-	if (m_filter_matching_path)
-	{
-		// Scroll to and select first result that begins with search string
-		GtkTreePath* path = convert_child_path_to_path(m_filter_matching_path);
-		gtk_tree_path_free(m_filter_matching_path);
-		m_filter_matching_path = NULL;
+	// Find first result
+	GtkTreeIter iter;
+	GtkTreePath* path = gtk_tree_path_new_first();
+	bool found = gtk_tree_model_get_iter(get_view()->get_model(), &iter, path);
 
+	// Scroll to and select first result
+	if (found)
+	{
 		get_view()->select_path(path);
 		get_view()->scroll_to_path(path);
-		gtk_tree_path_free(path);
-	}
-	else
-	{
-		// Find first result
-		GtkTreeIter iter;
-		GtkTreePath* path = gtk_tree_path_new_first();
-		bool found = gtk_tree_model_get_iter(get_view()->get_model(), &iter, path);
-
-		// Scroll to and select first result
-		if (found)
-		{
-			get_view()->select_path(path);
-			get_view()->scroll_to_path(path);
-		}
-
-		gtk_tree_path_free(path);
 	}
+	gtk_tree_path_free(path);
 }
 
 //-----------------------------------------------------------------------------
@@ -126,12 +110,6 @@ bool SearchPage::on_filter(GtkTreeModel* model, GtkTreeIter* iter)
 	gtk_tree_model_get(model, iter, LauncherModel::COLUMN_LAUNCHER, &launcher, -1);
 	unsigned int index = launcher->search(m_filter_string);
 
-	// Check if launcher search string starts with text
-	if (!m_filter_matching_path && (index == 0))
-	{
-		m_filter_matching_path = gtk_tree_model_get_path(model, iter);
-	}
-
 	return index != UINT_MAX;
 }
 
diff --git a/src/search_page.hpp b/src/search_page.hpp
index c654977..1beec63 100644
--- a/src/search_page.hpp
+++ b/src/search_page.hpp
@@ -46,7 +46,6 @@ private:
 
 private:
 	std::string m_filter_string;
-	GtkTreePath* m_filter_matching_path;
 };
 
 }

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


More information about the Xfce4-commits mailing list