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

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

commit 9e9107083fa8284c4c4e7ff10da51fd125ca6124
Author: Stephan Haller <no...@froevel.de>
Date:   Wed Jan 6 16:16:12 2016 +0100

    Allow search providers to return success state for result item activation 
or search launches
    
    The search view will now by default quit (standalone) or toggle (daemon 
mode) when activating result item or launching search provider's application 
was successful.
---
 xfdashboard/applications-search-provider.c |   19 +++++++------------
 xfdashboard/search-provider.c              |   20 ++++++++++----------
 xfdashboard/search-provider.h              |   18 +++++++++---------
 xfdashboard/search-view.c                  |   22 +++++++++++++++++-----
 4 files changed, 43 insertions(+), 36 deletions(-)

diff --git a/xfdashboard/applications-search-provider.c 
b/xfdashboard/applications-search-provider.c
index 2ca3a58..e37e9d1 100644
--- a/xfdashboard/applications-search-provider.c
+++ b/xfdashboard/applications-search-provider.c
@@ -476,25 +476,20 @@ static ClutterActor* 
_xfdashboard_applications_search_provider_create_result_act
 }
 
 /* Activate result item */
-static void 
_xfdashboard_applications_search_provider_activate_result(XfdashboardSearchProvider*
 inProvider,
-                                                                               
                                                                GVariant 
*inResultItem,
-                                                                               
                                                                ClutterActor 
*inActor,
-                                                                               
                                                                const gchar 
**inSearchTerms)
+static gboolean 
_xfdashboard_applications_search_provider_activate_result(XfdashboardSearchProvider*
 inProvider,
+                                                                               
                                                                        
GVariant *inResultItem,
+                                                                               
                                                                        
ClutterActor *inActor,
+                                                                               
                                                                        const 
gchar **inSearchTerms)
 {
        XfdashboardApplicationButton            *button;
 
-       
g_return_if_fail(XFDASHBOARD_IS_APPLICATIONS_SEARCH_PROVIDER(inProvider));
-       g_return_if_fail(XFDASHBOARD_IS_APPLICATION_BUTTON(inActor));
+       
g_return_val_if_fail(XFDASHBOARD_IS_APPLICATIONS_SEARCH_PROVIDER(inProvider), 
FALSE);
+       g_return_val_if_fail(XFDASHBOARD_IS_APPLICATION_BUTTON(inActor), FALSE);
 
        button=XFDASHBOARD_APPLICATION_BUTTON(inActor);
 
        /* Launch application */
-       if(xfdashboard_application_button_execute(button, NULL))
-       {
-               /* Launching application seems to be successfuly so quit 
application */
-               xfdashboard_application_quit();
-               return;
-       }
+       return(xfdashboard_application_button_execute(button, NULL));
 }
 
 /* IMPLEMENTATION: GObject */
diff --git a/xfdashboard/search-provider.c b/xfdashboard/search-provider.c
index 5423638..50bf1d7 100644
--- a/xfdashboard/search-provider.c
+++ b/xfdashboard/search-provider.c
@@ -309,8 +309,8 @@ ClutterActor* 
xfdashboard_search_provider_create_result_actor(XfdashboardSearchP
 /* Launch search in external service or application the search provider relies 
on
  * with provided list of search terms.
  */
-void xfdashboard_search_provider_launch_search(XfdashboardSearchProvider *self,
-                                                                               
                const gchar **inSearchTerms)
+gboolean xfdashboard_search_provider_launch_search(XfdashboardSearchProvider 
*self,
+                                                                               
                        const gchar **inSearchTerms)
 {
        XfdashboardSearchProviderClass  *klass;
 
@@ -322,19 +322,19 @@ void 
xfdashboard_search_provider_launch_search(XfdashboardSearchProvider *self,
        /* Launch search by search provider */
        if(klass->launch_search)
        {
-               klass->launch_search(self, inSearchTerms);
-               return;
+               return(klass->launch_search(self, inSearchTerms));
        }
 
        /* If we get here the virtual function was not overridden */
        XFDASHBOARD_SEARCH_PROVIDER_NOTE_NOT_IMPLEMENTED(self, "launch_search");
+       return(FALSE);
 }
 
 /* A result item actor was clicked so ask search provider to handle it */
-void xfdashboard_search_provider_activate_result(XfdashboardSearchProvider* 
self,
-                                                                               
                        GVariant *inResultItem,
-                                                                               
                        ClutterActor *inActor,
-                                                                               
                        const gchar **inSearchTerms)
+gboolean 
xfdashboard_search_provider_activate_result(XfdashboardSearchProvider* self,
+                                                                               
                                GVariant *inResultItem,
+                                                                               
                                ClutterActor *inActor,
+                                                                               
                                const gchar **inSearchTerms)
 {
        XfdashboardSearchProviderClass  *klass;
 
@@ -348,10 +348,10 @@ void 
xfdashboard_search_provider_activate_result(XfdashboardSearchProvider* self
        /* Handle click action at result item actor by search provider */
        if(klass->activate_result)
        {
-               klass->activate_result(self, inResultItem, inActor, 
inSearchTerms);
-               return;
+               return(klass->activate_result(self, inResultItem, inActor, 
inSearchTerms));
        }
 
        /* If we get here the virtual function was not overridden */
        XFDASHBOARD_SEARCH_PROVIDER_NOTE_NOT_IMPLEMENTED(self, 
"activate_result");
+       return(FALSE);
 }
diff --git a/xfdashboard/search-provider.h b/xfdashboard/search-provider.h
index 8725096..e7aae15 100644
--- a/xfdashboard/search-provider.h
+++ b/xfdashboard/search-provider.h
@@ -70,10 +70,10 @@ struct _XfdashboardSearchProviderClass
        ClutterActor* (*create_result_actor)(XfdashboardSearchProvider *self,
                                                                                
        GVariant *inResultItem);
 
-       void (*launch_search)(XfdashboardSearchProvider *self,
-                                                       const gchar 
**inSearchTerms);
+       gboolean (*launch_search)(XfdashboardSearchProvider *self,
+                                                               const gchar 
**inSearchTerms);
 
-       void (*activate_result)(XfdashboardSearchProvider* self,
+       gboolean (*activate_result)(XfdashboardSearchProvider* self,
                                                                GVariant 
*inResultItem,
                                                                ClutterActor 
*inActor,
                                                                const gchar 
**inSearchTerms);
@@ -95,14 +95,14 @@ XfdashboardSearchResultSet* 
xfdashboard_search_provider_get_result_set(Xfdashboa
 ClutterActor* 
xfdashboard_search_provider_create_result_actor(XfdashboardSearchProvider *self,
                                                                                
                                                GVariant *inResultItem);
 
-void xfdashboard_search_provider_launch_search(XfdashboardSearchProvider *self,
-                                                                               
                const gchar **inSearchTerms);
-
-void xfdashboard_search_provider_activate_result(XfdashboardSearchProvider* 
self,
-                                                                               
                        GVariant *inResultItem,
-                                                                               
                        ClutterActor *inActor,
+gboolean xfdashboard_search_provider_launch_search(XfdashboardSearchProvider 
*self,
                                                                                
                        const gchar **inSearchTerms);
 
+gboolean 
xfdashboard_search_provider_activate_result(XfdashboardSearchProvider* self,
+                                                                               
                                GVariant *inResultItem,
+                                                                               
                                ClutterActor *inActor,
+                                                                               
                                const gchar **inSearchTerms);
+
 G_END_DECLS
 
 #endif /* __XFDASHBOARD_SEARCH_PROVIDER__ */
diff --git a/xfdashboard/search-view.c b/xfdashboard/search-view.c
index e56eeaf..0ff030a 100644
--- a/xfdashboard/search-view.c
+++ b/xfdashboard/search-view.c
@@ -467,6 +467,7 @@ static void 
_xfdashboard_search_view_on_provider_item_actor_clicked(XfdashboardC
        GVariant                                                        *key;
        ClutterActor                                            *value;
        const gchar                                                     
**searchTerms;
+       gboolean                                                        success;
 
        g_return_if_fail(CLUTTER_IS_ACTOR(inActor));
        g_return_if_fail(inUserData);
@@ -491,10 +492,15 @@ static void 
_xfdashboard_search_view_on_provider_item_actor_clicked(XfdashboardC
                        if(priv->lastTerms) searchTerms=(const 
gchar**)priv->lastTerms->termList;
 
                        /* Tell provider that a result item was clicked */
-                       
xfdashboard_search_provider_activate_result(providerData->provider,
-                                                                               
                                        key,
-                                                                               
                                        inActor,
-                                                                               
                                        searchTerms);
+                       
success=xfdashboard_search_provider_activate_result(providerData->provider,
+                                                                               
                                                key,
+                                                                               
                                                inActor,
+                                                                               
                                                searchTerms);
+                       if(success)
+                       {
+                               /* Activating result item seems to be 
successfuly so quit application */
+                               xfdashboard_application_quit();
+                       }
 
                        /* All done so return here */
                        return;
@@ -510,6 +516,7 @@ static void 
_xfdashboard_search_view_on_provider_icon_clicked(XfdashboardSearchR
        XfdashboardSearchViewPrivate            *priv;
        XfdashboardSearchViewProviderData       *providerData;
        const gchar                                                     
**searchTerms;
+       gboolean                                                        success;
 
        g_return_if_fail(XFDASHBOARD_IS_SEARCH_RESULT_CONTAINER(inContainer));
        g_return_if_fail(inUserData);
@@ -525,7 +532,12 @@ static void 
_xfdashboard_search_view_on_provider_icon_clicked(XfdashboardSearchR
        if(priv->lastTerms) searchTerms=(const 
gchar**)priv->lastTerms->termList;
 
        /* Tell provider to launch search */
-       xfdashboard_search_provider_launch_search(providerData->provider, 
searchTerms);
+       
success=xfdashboard_search_provider_launch_search(providerData->provider, 
searchTerms);
+       if(success)
+       {
+               /* Activating result item seems to be successfuly so quit 
application */
+               xfdashboard_application_quit();
+       }
 }
 
 /* A container of a provider is going to be destroyed */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to