[gnome-software] Move the app launch code from gs-shell-details to gs-page
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Move the app launch code from gs-shell-details to gs-page
- Date: Tue, 23 Feb 2016 09:48:33 +0000 (UTC)
commit 691d02cb3086ac8cc535158cfa2575015acf3f71
Author: Rafal Luzynski <digitalfreak lingonborough com>
Date: Sat Feb 20 11:18:26 2016 +0100
Move the app launch code from gs-shell-details to gs-page
This will be needed by the next patch
Signed-off-by: Richard Hughes <richard hughsie com>
src/gs-page.c | 25 +++++++++++++++++++++++++
src/gs-page.h | 2 ++
src/gs-shell-details.c | 23 +----------------------
3 files changed, 28 insertions(+), 22 deletions(-)
---
diff --git a/src/gs-page.c b/src/gs-page.c
index d414c06..96d0196 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -249,6 +249,31 @@ gs_page_remove_app (GsPage *page, GsApp *app)
gtk_widget_destroy (dialog);
}
+static void
+gs_page_app_launched_cb (GObject *source,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
+ g_autoptr(GError) error = NULL;
+ if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error)) {
+ g_warning ("failed to launch GsApp: %s", error->message);
+ return;
+ }
+}
+
+void
+gs_page_launch_app (GsPage *page, GsApp *app)
+{
+ GsPagePrivate *priv = gs_page_get_instance_private (page);
+ gs_plugin_loader_app_action_async (priv->plugin_loader,
+ app,
+ GS_PLUGIN_LOADER_ACTION_LAUNCH,
+ priv->cancellable,
+ gs_page_app_launched_cb,
+ NULL);
+}
+
void
gs_page_setup (GsPage *page,
GsShell *shell,
diff --git a/src/gs-page.h b/src/gs-page.h
index 0f34a88..76550ab 100644
--- a/src/gs-page.h
+++ b/src/gs-page.h
@@ -51,6 +51,8 @@ void gs_page_remove_app (GsPage *page,
GsApp *app);
void gs_page_update_app (GsPage *page,
GsApp *app);
+void gs_page_launch_app (GsPage *page,
+ GsApp *app);
void gs_page_setup (GsPage *page,
GsShell *shell,
GsPluginLoader *plugin_loader,
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 22b6140..97262e1 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1353,33 +1353,12 @@ gs_shell_details_addon_selected_cb (GsAppAddonRow *row,
}
/**
- * gs_shell_details_filename_to_app_cb:
- **/
-static void
-gs_shell_details_app_launch_cb (GObject *source,
- GAsyncResult *res,
- gpointer user_data)
-{
- GsShellDetails *self = GS_SHELL_DETAILS (user_data);
- g_autoptr(GError) error = NULL;
- if (!gs_plugin_loader_app_action_finish (self->plugin_loader, res, &error)) {
- g_warning ("failed to launch GsApp: %s", error->message);
- return;
- }
-}
-
-/**
* gs_shell_details_app_launch_button_cb:
**/
static void
gs_shell_details_app_launch_button_cb (GtkWidget *widget, GsShellDetails *self)
{
- gs_plugin_loader_app_action_async (self->plugin_loader,
- self->app,
- GS_PLUGIN_LOADER_ACTION_LAUNCH,
- self->cancellable,
- gs_shell_details_app_launch_cb,
- self);
+ gs_page_launch_app (GS_PAGE (self), self->app);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]