[Xfce4-commits] [apps/xfdashboard] 02/04: Show a notification if initial search has no results after delay timeout was reached

noreply at xfce.org noreply at xfce.org
Thu May 21 21:37:38 CEST 2015


This is an automated email from the git hooks/post-receive script.

nomad pushed a commit to branch master
in repository apps/xfdashboard.

commit 7bab9a1eb19d611f95b6b4e8086cd5de37dd2f22
Author: Stephan Haller <nomad at froevel.de>
Date:   Thu May 21 21:14:36 2015 +0200

    Show a notification if initial search has no results after delay timeout was reached
---
 xfdashboard/search-view.c |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/xfdashboard/search-view.c b/xfdashboard/search-view.c
index 2b18066..8d423fe 100644
--- a/xfdashboard/search-view.c
+++ b/xfdashboard/search-view.c
@@ -953,19 +953,21 @@ static gboolean _xfdashboard_search_view_can_do_incremental_search(XfdashboardSe
 }
 
 /* Perform search */
-static void _xfdashboard_search_view_perform_search(XfdashboardSearchView *self, XfdashboardSearchViewSearchTerms *inSearchTerms)
+static guint _xfdashboard_search_view_perform_search(XfdashboardSearchView *self, XfdashboardSearchViewSearchTerms *inSearchTerms)
 {
 	XfdashboardSearchViewPrivate				*priv;
 	GList										*providers;
 	GList										*iter;
+	guint										numberResults;
 #ifdef DEBUG
 	GTimer										*timer=NULL;
 #endif
 
-	g_return_if_fail(XFDASHBOARD_IS_SEARCH_VIEW(self));
-	g_return_if_fail(inSearchTerms);
+	g_return_val_if_fail(XFDASHBOARD_IS_SEARCH_VIEW(self), 0);
+	g_return_val_if_fail(inSearchTerms, 0);
 
 	priv=self->priv;
+	numberResults=0;
 
 #ifdef DEBUG
 	/* Start timer for debug search performance */
@@ -1006,6 +1008,8 @@ static void _xfdashboard_search_view_perform_search(XfdashboardSearchView *self,
 					G_OBJECT_TYPE_NAME(providerData->provider),
 					xfdashboard_search_result_set_get_size(providerNewResultSet));
 
+		/* Count number of results */
+		numberResults+=xfdashboard_search_result_set_get_size(providerNewResultSet);
 
 		/* Update view of search provider for new result set */
 		_xfdashboard_search_view_update_provider_container(self, providerData, providerNewResultSet);
@@ -1064,6 +1068,9 @@ static void _xfdashboard_search_view_perform_search(XfdashboardSearchView *self,
 
 	/* Emit signal that search was updated */
 	g_signal_emit(self, XfdashboardSearchViewSignals[SIGNAL_SEARCH_UPDATED], 0);
+
+	/* Return number of results */
+	return(numberResults);
 }
 
 /* Delay timeout was reached so perform initial search now */
@@ -1071,6 +1078,7 @@ static gboolean _xfdashboard_search_view_on_perform_search_delayed_timeout(gpoin
 {
 	XfdashboardSearchView						*self;
 	XfdashboardSearchViewPrivate				*priv;
+	guint										numberResults;
 
 	g_return_val_if_fail(XFDASHBOARD_IS_SEARCH_VIEW(inUserData), G_SOURCE_REMOVE);
 
@@ -1078,7 +1086,14 @@ static gboolean _xfdashboard_search_view_on_perform_search_delayed_timeout(gpoin
 	priv=self->priv;
 
 	/* Perform search */
-	_xfdashboard_search_view_perform_search(self, priv->delaySearchTerms);
+	numberResults=_xfdashboard_search_view_perform_search(self, priv->delaySearchTerms);
+	if(numberResults==0)
+	{
+		xfdashboard_notify(CLUTTER_ACTOR(self),
+							xfdashboard_view_get_icon(XFDASHBOARD_VIEW(self)),
+							_("No results found for '%s'"),
+							priv->delaySearchTerms->termString);
+	}
 
 	/* Release allocated resources */
 	if(priv->delaySearchTerms)

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


More information about the Xfce4-commits mailing list