[gnome-software] rpm-ostree: Implement launch() and adopt_app()



commit 854fab7bcda0860b87d37f05f3bb9a5749852a03
Author: Kalev Lember <klember redhat com>
Date:   Tue Jan 23 18:47:06 2018 +0100

    rpm-ostree: Implement launch() and adopt_app()
    
    This makes clicking the Launch button on the details page work.

 plugins/rpm-ostree/gs-plugin-rpm-ostree.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
index e391e49..0733ea2 100644
--- a/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
+++ b/plugins/rpm-ostree/gs-plugin-rpm-ostree.c
@@ -118,6 +118,15 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        return TRUE;
 }
 
+void
+gs_plugin_adopt_app (GsPlugin *plugin, GsApp *app)
+{
+       if (gs_app_get_bundle_kind (app) == AS_BUNDLE_KIND_PACKAGE &&
+           gs_app_get_scope (app) == AS_APP_SCOPE_SYSTEM) {
+               gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
+       }
+}
+
 typedef struct {
        GsPlugin *plugin;
        GError *error;
@@ -453,3 +462,17 @@ gs_plugin_add_updates (GsPlugin *plugin,
 
        return TRUE;
 }
+
+gboolean
+gs_plugin_launch (GsPlugin *plugin,
+                  GsApp *app,
+                  GCancellable *cancellable,
+                  GError **error)
+{
+       /* only process this app if was created by this plugin */
+       if (g_strcmp0 (gs_app_get_management_plugin (app),
+                      gs_plugin_get_name (plugin)) != 0)
+               return TRUE;
+
+       return gs_plugin_app_launch (plugin, app, error);
+}


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