[gnome-calculator] search-provider: renew inactivity timeout at each calculator run



commit 90156448955c03b1c970a9981768d35edcbed9f8
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Aug 24 07:10:17 2018 +0200

    search-provider: renew inactivity timeout at each calculator run
    
    As per the async rewrite, now the daemon inactivity timeout might happen
    when another call has just been done, while we don't want this to be the case.
    
    So, everytime we do a subprocess call, let's renew the application timeout.

 search-provider/search-provider.vala | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/search-provider/search-provider.vala b/search-provider/search-provider.vala
index 659f73d4..7e54fa6f 100644
--- a/search-provider/search-provider.vala
+++ b/search-provider/search-provider.vala
@@ -13,7 +13,12 @@
 [DBus (name = "org.gnome.Shell.SearchProvider2")]
 public class SearchProvider : Object
 {
+    private unowned SearchProviderApp application;
     private Cancellable cancellable = new Cancellable ();
+    public SearchProvider (SearchProviderApp app)
+    {
+        application = app;
+    }
 
     ~SearchProvider ()
     {
@@ -71,6 +76,8 @@ public class SearchProvider : Object
                 cancellable = null;
             });
 
+            application.renew_inactivity_timeout ();
+
             yield subprocess.communicate_utf8_async (null, cancellable, out solution_buf, out stderr_buf);
         }
         catch (Error e)
@@ -197,11 +204,16 @@ public class SearchProviderApp : Application
         Object (application_id: "org.gnome.Calculator.SearchProvider",
                 flags: ApplicationFlags.IS_SERVICE,
                 inactivity_timeout: 60000);
+
+    public void renew_inactivity_timeout ()
+    {
+        this.hold ();
+        this.release ();
     }
 
     public override bool dbus_register (DBusConnection connection, string object_path)
     {
-        SearchProvider search_provider = new SearchProvider ();
+        SearchProvider search_provider = new SearchProvider (this);
 
         try
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]