diff --git a/src/gs-application.c b/src/gs-application.c index a4b455006107006fbfcb6e29a42ddfee83ba894b..7655edb0a5889c70c44ff1066142cff23e2ce244 100644 --- a/src/gs-application.c +++ b/src/gs-application.c @@ -1290,6 +1290,13 @@ gs_application_handle_local_options (GApplication *app, GVariantDict *options) NULL); } if (g_variant_dict_contains (options, "quit")) { + GsApplication *self = GS_APPLICATION (app); + if (!g_application_get_is_remote (app) && (self->shell == NULL || !gs_shell_is_running (self->shell))) { + g_application_quit (app); + g_debug ("Early exit due to --quit option"); + /* early exit, to not continue with setup, plugin initialization and so on */ + return 0; + } /* The 'quit' command-line option shuts down everything, * including the backend service */ g_action_group_activate_action (G_ACTION_GROUP (app), diff --git a/src/gs-details-page.c b/src/gs-details-page.c index eabffb0470e881464b0e432c50aede3d4569fa65..63a21c8a0b2024026a677fb2e78afd42857bad91 100644 --- a/src/gs-details-page.c +++ b/src/gs-details-page.c @@ -1857,11 +1857,13 @@ gs_details_page_app_refine_cb (GObject *source, static void _set_app (GsDetailsPage *self, GsApp *app) { - GsJobManager *job_manager = gs_plugin_loader_get_job_manager (self->plugin_loader); + GsJobManager *job_manager; if (self->app == app) return; + job_manager = gs_plugin_loader_get_job_manager (self->plugin_loader); + /* do not show all the reviews by default */ self->show_all_reviews = FALSE; diff --git a/src/gs-shell.c b/src/gs-shell.c index 7a6fa362e361a022ddb3dd1f4862a793262f6538..2d9dea1922e085027b76de6f967291a1629f910b 100644 --- a/src/gs-shell.c +++ b/src/gs-shell.c @@ -2196,6 +2196,23 @@ details_page_app_clicked_cb (GsDetailsPage *page, gs_shell_show_app (shell, app); } +/** + * gs_shell_is_running: + * @self: a #GsShell + * + * Check whether the @self has been already set up, which roughly means + * the gs_shell_setup() has been called. + * + * Returns: whether the @self has been already set up + * + * Since: 48 + **/ +gboolean +gs_shell_is_running (GsShell *self) +{ + return self->plugin_loader != NULL; +} + void gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *cancellable) { diff --git a/src/gs-shell.h b/src/gs-shell.h index 896910a45bed8ed4bd98b30699655d1739895f94..0b0c41ec083a8e79c50901f4f1cef46b42d0f69d 100644 --- a/src/gs-shell.h +++ b/src/gs-shell.h @@ -79,6 +79,7 @@ void gs_shell_show_extras_search (GsShell *shell, const gchar *ident); void gs_shell_show_uri (GsShell *shell, const gchar *url); +gboolean gs_shell_is_running (GsShell *self); void gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *cancellable);