[gnome-software/37-installpackagenames-exits-immediately] D-Bus: InstallPackageNames exits immediately



commit 6b4054d26166f59187a3f7e699a1b6a0097a0805
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 9 09:01:15 2020 +0200

    D-Bus: InstallPackageNames exits immediately
    
    Finish the D-bus call only after the requested package is installed. The caller may
    choose a reasonable timeout on the D-Bus call.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/37
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/506

 src/gs-application.c |  32 +++++++++++--
 src/gs-application.h |   4 ++
 src/gs-dbus-helper.c | 126 ++++++++++++++++++++++++++++++++++++++-------------
 src/gs-extras-page.c |  37 ++++++++++++++-
 src/gs-extras-page.h |   3 +-
 src/gs-page.c        |   4 ++
 src/gs-shell.c       |   4 +-
 src/gs-shell.h       |   3 +-
 8 files changed, 174 insertions(+), 39 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 9c2676ef..a7b57957 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -56,6 +56,13 @@ struct _GsApplication {
 
 G_DEFINE_TYPE (GsApplication, gs_application, GTK_TYPE_APPLICATION);
 
+enum {
+       INSTALL_RESOURCES_DONE,
+       LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL];
+
 typedef struct {
        GsApplication *app;
        GSimpleAction *action;
@@ -798,9 +805,10 @@ install_resources_activated (GSimpleAction *action,
        GdkDisplay *display;
        const gchar *mode;
        const gchar *startup_id;
+       const gchar *ident;
        g_autofree gchar **resources = NULL;
 
-       g_variant_get (parameter, "(&s^a&s&s)", &mode, &resources, &startup_id);
+       g_variant_get (parameter, "(&s^a&s&s&s)", &mode, &resources, &startup_id, &ident);
 
        display = gdk_display_get_default ();
 #ifdef GDK_WINDOWING_X11
@@ -821,7 +829,7 @@ install_resources_activated (GSimpleAction *action,
        gs_application_present_window (app, startup_id);
 
        gs_shell_reset_state (app->shell);
-       gs_shell_show_extras_search (app->shell, mode, resources);
+       gs_shell_show_extras_search (app->shell, mode, resources, ident);
 }
 
 static GActionEntry actions[] = {
@@ -846,7 +854,7 @@ static GActionEntry actions_after_loading[] = {
        { "details-url", details_url_activated, "(s)", NULL, NULL },
        { "install", install_activated, "(su)", NULL, NULL },
        { "filename", filename_activated, "(s)", NULL, NULL },
-       { "install-resources", install_resources_activated, "(sass)", NULL, NULL },
+       { "install-resources", install_resources_activated, "(sasss)", NULL, NULL },
        { "nop", NULL, NULL, NULL }
 };
 
@@ -1137,6 +1145,16 @@ gs_application_class_init (GsApplicationClass *class)
        G_APPLICATION_CLASS (class)->open = gs_application_open;
        G_APPLICATION_CLASS (class)->dbus_register = gs_application_dbus_register;
        G_APPLICATION_CLASS (class)->dbus_unregister = gs_application_dbus_unregister;
+
+       signals[INSTALL_RESOURCES_DONE] = g_signal_new (
+               "install-resources-done",
+               G_TYPE_FROM_CLASS (class),
+               G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE,
+               0,
+               NULL, NULL,
+               NULL,
+               G_TYPE_NONE, 2,
+               G_TYPE_STRING, G_TYPE_ERROR);
 }
 
 GsApplication *
@@ -1148,3 +1166,11 @@ gs_application_new (void)
                             "inactivity-timeout", 12000,
                             NULL);
 }
+
+void
+gs_application_emit_install_resources_done (GsApplication *application,
+                                           const gchar *ident,
+                                           const GError *op_error)
+{
+       g_signal_emit (application, signals[INSTALL_RESOURCES_DONE], 0, ident, op_error, NULL);
+}
diff --git a/src/gs-application.h b/src/gs-application.h
index dd565090..6085fb1f 100644
--- a/src/gs-application.h
+++ b/src/gs-application.h
@@ -19,3 +19,7 @@ G_DECLARE_FINAL_TYPE (GsApplication, gs_application, GS, APPLICATION, GtkApplica
 GsApplication  *gs_application_new             (void);
 GsPluginLoader *gs_application_get_plugin_loader       (GsApplication *application);
 gboolean        gs_application_has_active_window       (GsApplication *application);
+void            gs_application_emit_install_resources_done
+                                                       (GsApplication *application,
+                                                        const gchar *ident,
+                                                        const GError *op_error);
\ No newline at end of file
diff --git a/src/gs-dbus-helper.c b/src/gs-dbus-helper.c
index b90ff980..e3995135 100644
--- a/src/gs-dbus-helper.c
+++ b/src/gs-dbus-helper.c
@@ -262,7 +262,8 @@ is_show_confirm_search_set (const gchar *interaction)
 static void
 notify_search_resources (GsExtrasPageMode   mode,
                          const gchar       *desktop_id,
-                         gchar            **resources)
+                         gchar            **resources,
+                        const gchar       *ident)
 {
        const gchar *app_name = NULL;
        const gchar *mode_string;
@@ -320,24 +321,87 @@ notify_search_resources (GsExtrasPageMode   mode,
        n = g_notification_new (title);
        g_notification_set_body (n, body);
        /* TRANSLATORS: this is a button that launches gnome-software */
-       g_notification_add_button_with_target (n, _("Find in Software"), "app.install-resources", "(s^ass)", 
mode_string, resources, "");
-       g_notification_set_default_action_and_target (n, "app.install-resources", "(s^ass)", mode_string, 
resources, "");
+       g_notification_add_button_with_target (n, _("Find in Software"), "app.install-resources", "(s^asss)", 
mode_string, resources, "", ident);
+       g_notification_set_default_action_and_target (n, "app.install-resources", "(s^asss)", mode_string, 
resources, "", ident);
        g_application_send_notification (g_application_get_default (), "install-resources", n);
 }
 
+typedef struct _InstallResourcesData {
+       void (* done_func) (GsPackageKitModify2 *object, GDBusMethodInvocation *invocation);
+       GsPackageKitModify2 *object;
+       GDBusMethodInvocation *invocation;
+       gchar *ident;
+} InstallResourcesData;
+
+static void
+install_resources_data_free (gpointer data,
+                            GClosure *closure)
+{
+       InstallResourcesData *ird = data;
+
+       if (ird) {
+               g_clear_object (&ird->object);
+               g_clear_object (&ird->invocation);
+               g_free (ird->ident);
+               g_slice_free (InstallResourcesData, ird);
+       }
+}
+
+static void
+install_resources_done_cb (GApplication *app,
+                          const gchar *ident,
+                          const GError *op_error,
+                          gpointer user_data)
+{
+       InstallResourcesData *ird = user_data;
+
+       g_return_if_fail (ird != NULL);
+
+       if (!ident || g_strcmp0 (ird->ident, ident) == 0) {
+               if (op_error)
+                       g_dbus_method_invocation_return_gerror (ird->invocation, op_error);
+               else
+                       ird->done_func (ird->object, ird->invocation);
+
+               g_signal_handlers_disconnect_by_func (app, install_resources_done_cb, ird);
+       }
+}
+
 static void
 install_resources (GsExtrasPageMode   mode,
                    gchar            **resources,
                    const gchar       *interaction,
                    const gchar       *desktop_id,
-                   GVariant          *platform_data)
+                   GVariant          *platform_data,
+                  void               (* done_func) (GsPackageKitModify2 *object, GDBusMethodInvocation 
*invocation),
+                  GsPackageKitModify2 *object,
+                  GDBusMethodInvocation *invocation)
 {
        GApplication *app;
        const gchar *mode_string;
        const gchar *startup_id = NULL;
+       gchar *ident = NULL;
+
+       app = g_application_get_default ();
+
+       if (done_func) {
+               InstallResourcesData *ird;
+
+               ident = g_strdup_printf ("%p", invocation);
+
+               ird = g_slice_new (InstallResourcesData);
+               ird->done_func = done_func;
+               ird->object = g_object_ref (object);
+               ird->invocation = g_object_ref (invocation);
+               ird->ident = ident; /* takes ownership */
+
+               g_signal_connect_data (app, "install-resources-done",
+                       G_CALLBACK (install_resources_done_cb), ird,
+                       install_resources_data_free, 0);
+       }
 
        if (is_show_confirm_search_set (interaction)) {
-               notify_search_resources (mode, desktop_id, resources);
+               notify_search_resources (mode, desktop_id, resources, ident);
                return;
        }
 
@@ -346,10 +410,9 @@ install_resources (GsExtrasPageMode   mode,
                                  "&s", &startup_id);
        }
 
-       app = g_application_get_default ();
        mode_string = gs_extras_page_mode_to_string (mode);
        g_action_group_activate_action (G_ACTION_GROUP (app), "install-resources",
-                                       g_variant_new ("(s^ass)", mode_string, resources, startup_id));
+                                       g_variant_new ("(s^asss)", mode_string, resources, startup_id, ident 
? ident : ""));
 }
 
 static gboolean
@@ -362,7 +425,7 @@ handle_modify_install_package_files (GsPackageKitModify              *object,
 {
        g_debug ("****** Modify.InstallPackageFiles");
 
-       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_FILES, NULL, arg_files);
+       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_FILES, NULL, arg_files, NULL);
        gs_package_kit_modify_complete_install_package_files (object, invocation);
 
        return TRUE;
@@ -378,7 +441,7 @@ handle_modify_install_provide_files (GsPackageKitModify              *object,
 {
        g_debug ("****** Modify.InstallProvideFiles");
 
-       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PROVIDE_FILES, NULL, arg_files);
+       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PROVIDE_FILES, NULL, arg_files, NULL);
        gs_package_kit_modify_complete_install_provide_files (object, invocation);
 
        return TRUE;
@@ -394,7 +457,7 @@ handle_modify_install_package_names (GsPackageKitModify              *object,
 {
        g_debug ("****** Modify.InstallPackageNames");
 
-       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_NAMES, NULL, arg_package_names);
+       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_NAMES, NULL, arg_package_names, NULL);
        gs_package_kit_modify_complete_install_package_names (object, invocation);
 
        return TRUE;
@@ -410,7 +473,7 @@ handle_modify_install_mime_types (GsPackageKitModify    *object,
 {
        g_debug ("****** Modify.InstallMimeTypes");
 
-       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_MIME_TYPES, NULL, arg_mime_types);
+       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_MIME_TYPES, NULL, arg_mime_types, NULL);
        gs_package_kit_modify_complete_install_mime_types (object, invocation);
 
        return TRUE;
@@ -426,7 +489,7 @@ handle_modify_install_fontconfig_resources (GsPackageKitModify               *object,
 {
        g_debug ("****** Modify.InstallFontconfigResources");
 
-       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_FONTCONFIG_RESOURCES, NULL, arg_resources);
+       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_FONTCONFIG_RESOURCES, NULL, arg_resources, NULL);
        gs_package_kit_modify_complete_install_fontconfig_resources (object, invocation);
 
        return TRUE;
@@ -442,7 +505,7 @@ handle_modify_install_gstreamer_resources (GsPackageKitModify        *object,
 {
        g_debug ("****** Modify.InstallGStreamerResources");
 
-       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_GSTREAMER_RESOURCES, NULL, arg_resources);
+       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_GSTREAMER_RESOURCES, NULL, arg_resources, NULL);
        gs_package_kit_modify_complete_install_gstreamer_resources (object, invocation);
 
        return TRUE;
@@ -462,7 +525,7 @@ handle_modify_install_resources (GsPackageKitModify  *object,
        g_debug ("****** Modify.InstallResources");
 
        if (g_strcmp0 (arg_type, "plasma-service") == 0) {
-               notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PLASMA_RESOURCES, NULL, arg_resources);
+               notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PLASMA_RESOURCES, NULL, arg_resources, 
NULL);
                ret = TRUE;
        } else {
                ret = FALSE;
@@ -482,7 +545,7 @@ handle_modify_install_printer_drivers (GsPackageKitModify    *object,
 {
        g_debug ("****** Modify.InstallPrinterDrivers");
 
-       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PRINTER_DRIVERS, NULL, arg_device_ids);
+       notify_search_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PRINTER_DRIVERS, NULL, arg_device_ids, NULL);
        gs_package_kit_modify_complete_install_printer_drivers (object, invocation);
 
        return TRUE;
@@ -499,8 +562,8 @@ handle_modify2_install_package_files (GsPackageKitModify2    *object,
 {
        g_debug ("****** Modify2.InstallPackageFiles");
 
-       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_FILES, arg_files, arg_interaction, 
arg_desktop_id, arg_platform_data);
-       gs_package_kit_modify2_complete_install_package_files (object, invocation);
+       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_FILES, arg_files, arg_interaction, 
arg_desktop_id, arg_platform_data,
+               gs_package_kit_modify2_complete_install_package_files, object, invocation);
 
        return TRUE;
 }
@@ -516,8 +579,8 @@ handle_modify2_install_provide_files (GsPackageKitModify2    *object,
 {
        g_debug ("****** Modify2.InstallProvideFiles");
 
-       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PROVIDE_FILES, arg_files, arg_interaction, 
arg_desktop_id, arg_platform_data);
-       gs_package_kit_modify2_complete_install_provide_files (object, invocation);
+       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PROVIDE_FILES, arg_files, arg_interaction, 
arg_desktop_id, arg_platform_data,
+               gs_package_kit_modify2_complete_install_provide_files, object, invocation);
 
        return TRUE;
 }
@@ -533,8 +596,8 @@ handle_modify2_install_package_names (GsPackageKitModify2    *object,
 {
        g_debug ("****** Modify2.InstallPackageNames");
 
-       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_NAMES, arg_package_names, arg_interaction, 
arg_desktop_id, arg_platform_data);
-       gs_package_kit_modify2_complete_install_package_names (object, invocation);
+       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_NAMES, arg_package_names, arg_interaction, 
arg_desktop_id, arg_platform_data,
+               gs_package_kit_modify2_complete_install_package_names, object, invocation);
 
        return TRUE;
 }
@@ -550,8 +613,8 @@ handle_modify2_install_mime_types (GsPackageKitModify2       *object,
 {
        g_debug ("****** Modify2.InstallMimeTypes");
 
-       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_MIME_TYPES, arg_mime_types, arg_interaction, 
arg_desktop_id, arg_platform_data);
-       gs_package_kit_modify2_complete_install_mime_types (object, invocation);
+       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_MIME_TYPES, arg_mime_types, arg_interaction, 
arg_desktop_id, arg_platform_data,
+               gs_package_kit_modify2_complete_install_mime_types, object, invocation);
 
        return TRUE;
 }
@@ -567,8 +630,8 @@ handle_modify2_install_fontconfig_resources (GsPackageKitModify2     *object,
 {
        g_debug ("****** Modify2.InstallFontconfigResources");
 
-       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_FONTCONFIG_RESOURCES, arg_resources, arg_interaction, 
arg_desktop_id, arg_platform_data);
-       gs_package_kit_modify2_complete_install_fontconfig_resources (object, invocation);
+       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_FONTCONFIG_RESOURCES, arg_resources, arg_interaction, 
arg_desktop_id, arg_platform_data,
+               gs_package_kit_modify2_complete_install_fontconfig_resources, object, invocation);
 
        return TRUE;
 }
@@ -584,8 +647,8 @@ handle_modify2_install_gstreamer_resources (GsPackageKitModify2              *object,
 {
        g_debug ("****** Modify2.InstallGStreamerResources");
 
-       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_GSTREAMER_RESOURCES, arg_resources, arg_interaction, 
arg_desktop_id, arg_platform_data);
-       gs_package_kit_modify2_complete_install_gstreamer_resources (object, invocation);
+       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_GSTREAMER_RESOURCES, arg_resources, arg_interaction, 
arg_desktop_id, arg_platform_data,
+               gs_package_kit_modify2_complete_install_gstreamer_resources, object, invocation);
 
        return TRUE;
 }
@@ -605,12 +668,13 @@ handle_modify2_install_resources (GsPackageKitModify2      *object,
        g_debug ("****** Modify2.InstallResources");
 
        if (g_strcmp0 (arg_type, "plasma-service") == 0) {
-               install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PLASMA_RESOURCES, arg_resources, 
arg_interaction, arg_desktop_id, arg_platform_data);
+               install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PLASMA_RESOURCES, arg_resources, 
arg_interaction, arg_desktop_id, arg_platform_data,
+                       gs_package_kit_modify2_complete_install_resources, object, invocation);
                ret = TRUE;
        } else {
                ret = FALSE;
+               gs_package_kit_modify2_complete_install_resources (object, invocation);
        }
-       gs_package_kit_modify2_complete_install_resources (object, invocation);
 
        return ret;
 }
@@ -626,8 +690,8 @@ handle_modify2_install_printer_drivers (GsPackageKitModify2  *object,
 {
        g_debug ("****** Modify2.InstallPrinterDrivers");
 
-       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PRINTER_DRIVERS, arg_device_ids, arg_interaction, 
arg_desktop_id, arg_platform_data);
-       gs_package_kit_modify2_complete_install_printer_drivers (object, invocation);
+       install_resources (GS_EXTRAS_PAGE_MODE_INSTALL_PRINTER_DRIVERS, arg_device_ids, arg_interaction, 
arg_desktop_id, arg_platform_data,
+               gs_package_kit_modify2_complete_install_printer_drivers, object, invocation);
 
        return TRUE;
 }
diff --git a/src/gs-extras-page.c b/src/gs-extras-page.c
index 9b9aeece..a13eff45 100644
--- a/src/gs-extras-page.c
+++ b/src/gs-extras-page.c
@@ -12,6 +12,7 @@
 #include "gs-extras-page.h"
 
 #include "gs-app-row.h"
+#include "gs-application.h"
 #include "gs-language.h"
 #include "gs-shell.h"
 #include "gs-common.h"
@@ -54,6 +55,7 @@ struct _GsExtrasPage
        GsLanguage               *language;
        GsVendor                 *vendor;
        guint                     pending_search_cnt;
+       gchar                    *install_resources_ident;
 
        GtkWidget                *label_failed;
        GtkWidget                *label_no_results;
@@ -238,12 +240,38 @@ gs_extras_page_update_ui_state (GsExtrasPage *self)
        }
 }
 
+static void
+gs_extras_page_maybe_emit_installed_resources_done (GsExtrasPage *self)
+{
+       if (self->install_resources_ident && (
+           self->state == GS_EXTRAS_PAGE_STATE_LOADING ||
+           self->state == GS_EXTRAS_PAGE_STATE_NO_RESULTS ||
+           self->state == GS_EXTRAS_PAGE_STATE_FAILED)) {
+               GsApplication *application;
+               GError *op_error = NULL;
+
+               /* When called during the LOADING state, it means the package is already installed */
+               if (self->state == GS_EXTRAS_PAGE_STATE_NO_RESULTS) {
+                       g_set_error_literal (&op_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("Requested 
software not found"));
+               } else if (self->state == GS_EXTRAS_PAGE_STATE_FAILED) {
+                       g_set_error_literal (&op_error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Failed to find 
requested software"));
+               }
+
+               application = GS_APPLICATION (g_application_get_default ());
+               gs_application_emit_install_resources_done (application, self->install_resources_ident, 
op_error);
+
+               g_clear_pointer (&self->install_resources_ident, g_free);
+               g_clear_error (&op_error);
+       }
+}
+
 static void
 gs_extras_page_set_state (GsExtrasPage *self,
                           GsExtrasPageState state)
 {
        self->state = state;
        gs_extras_page_update_ui_state (self);
+       gs_extras_page_maybe_emit_installed_resources_done (self);
 }
 
 static void
@@ -497,6 +525,8 @@ show_search_results (GsExtrasPage *self)
                g_assert (list != NULL);
                app = gs_app_row_get_app (GS_APP_ROW (list->data));
                gs_shell_change_mode (self->shell, GS_SHELL_MODE_DETAILS, app, TRUE);
+               if (gs_app_is_installed (app))
+                       gs_extras_page_maybe_emit_installed_resources_done (self);
        } else {
                /* show what we got */
                g_debug ("extras: got %u search results, showing", n_children);
@@ -977,9 +1007,13 @@ gs_extras_page_search_printer_drivers (GsExtrasPage *self, gchar **device_ids)
 void
 gs_extras_page_search (GsExtrasPage  *self,
                        const gchar   *mode_str,
-                       gchar        **resources)
+                       gchar        **resources,
+                      const gchar   *ident)
 {
        self->mode = gs_extras_page_mode_from_string (mode_str);
+       g_clear_pointer (&self->install_resources_ident, g_free);
+       self->install_resources_ident = (ident && *ident) ? g_strdup (ident) : NULL;
+
        switch (self->mode) {
        case GS_EXTRAS_PAGE_MODE_INSTALL_PACKAGE_FILES:
                gs_extras_page_search_package_files (self, resources);
@@ -1164,6 +1198,7 @@ gs_extras_page_dispose (GObject *object)
        g_clear_object (&self->plugin_loader);
 
        g_clear_pointer (&self->array_search_data, g_ptr_array_unref);
+       g_clear_pointer (&self->install_resources_ident, g_free);
 
        G_OBJECT_CLASS (gs_extras_page_parent_class)->dispose (object);
 }
diff --git a/src/gs-extras-page.h b/src/gs-extras-page.h
index e4dc0010..defd12fa 100644
--- a/src/gs-extras-page.h
+++ b/src/gs-extras-page.h
@@ -34,6 +34,7 @@ const gchar           *gs_extras_page_mode_to_string          (GsExtrasPageMode         
mode);
 GsExtrasPage           *gs_extras_page_new                     (void);
 void                    gs_extras_page_search                  (GsExtrasPage            *self,
                                                                 const gchar             *mode,
-                                                                gchar                  **resources);
+                                                                gchar                  **resources,
+                                                                const gchar             *ident);
 
 G_END_DECLS
diff --git a/src/gs-page.c b/src/gs-page.c
index ab5bdc65..e299354d 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <glib/gi18n.h>
 
+#include "gs-application.h"
 #include "gs-page.h"
 #include "gs-common.h"
 #include "gs-screenshot-image.h"
@@ -127,6 +128,9 @@ gs_page_app_installed_cb (GObject *source,
        ret = gs_plugin_loader_job_action_finish (plugin_loader,
                                                   res,
                                                   &error);
+
+       gs_application_emit_install_resources_done (GS_APPLICATION (g_application_get_default ()), NULL, 
error);
+
        if (g_error_matches (error,
                             GS_PLUGIN_ERROR,
                             GS_PLUGIN_ERROR_CANCELLED)) {
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 8f0dc6f1..197713a4 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -2401,7 +2401,7 @@ gs_shell_show_category (GsShell *shell, GsCategory *category)
        gs_shell_change_mode (shell, GS_SHELL_MODE_CATEGORY, category, TRUE);
 }
 
-void gs_shell_show_extras_search (GsShell *shell, const gchar *mode, gchar **resources)
+void gs_shell_show_extras_search (GsShell *shell, const gchar *mode, gchar **resources, const gchar *ident)
 {
        GsShellPrivate *priv = gs_shell_get_instance_private (shell);
        GsPage *page;
@@ -2409,7 +2409,7 @@ void gs_shell_show_extras_search (GsShell *shell, const gchar *mode, gchar **res
        page = GS_PAGE (gtk_builder_get_object (priv->builder, "extras_page"));
 
        save_back_entry (shell);
-       gs_extras_page_search (GS_EXTRAS_PAGE (page), mode, resources);
+       gs_extras_page_search (GS_EXTRAS_PAGE (page), mode, resources, ident);
        gs_shell_change_mode (shell, GS_SHELL_MODE_EXTRAS, NULL, TRUE);
        gs_shell_activate (shell);
 }
diff --git a/src/gs-shell.h b/src/gs-shell.h
index a02d24d7..a13043f0 100644
--- a/src/gs-shell.h
+++ b/src/gs-shell.h
@@ -81,7 +81,8 @@ void           gs_shell_show_search_result    (GsShell        *shell,
                                                 const gchar    *search);
 void            gs_shell_show_extras_search    (GsShell        *shell,
                                                 const gchar    *mode,
-                                                gchar          **resources);
+                                                gchar          **resources,
+                                                const gchar    *ident);
 void            gs_shell_show_uri              (GsShell        *shell,
                                                 const gchar    *url);
 void            gs_shell_setup                 (GsShell        *shell,


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