[gnome-shell/T29763: 47/249] shell-app: Propagate errors when activating an application
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/T29763: 47/249] shell-app: Propagate errors when activating an application
- Date: Thu, 21 May 2020 18:13:05 +0000 (UTC)
commit a9eb245459d180cfdd290658645a669b203b09c7
Author: Cosimo Cecchi <cosimo endlessm com>
Date: Tue Jul 9 12:48:27 2013 -0700
shell-app: Propagate errors when activating an application
This way we can e.g. avoid showing a splash page when launching fails.
[endlessm/eos-shell#528]
src/shell-app.c | 18 +++++++++++-------
src/shell-app.h | 6 ++++--
2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/shell-app.c b/src/shell-app.c
index b182657598..60096717d5 100644
--- a/src/shell-app.c
+++ b/src/shell-app.c
@@ -485,14 +485,16 @@ shell_app_update_window_actions (ShellApp *app, MetaWindow *window)
/**
* shell_app_activate:
* @app: a #ShellApp
+ * @error: a #GError
*
* Like shell_app_activate_full(), but using the default workspace and
* event timestamp.
*/
void
-shell_app_activate (ShellApp *app)
+shell_app_activate (ShellApp *app,
+ GError **error)
{
- return shell_app_activate_full (app, -1, 0);
+ return shell_app_activate_full (app, -1, 0, error);
}
/**
@@ -501,6 +503,7 @@ shell_app_activate (ShellApp *app)
* @workspace: launch on this workspace, or -1 for default. Ignored if
* activating an existing window
* @timestamp: Event timestamp
+ * @error: a #GError
*
* Perform an appropriate default action for operating on this application,
* dependent on its current state. For example, if the application is not
@@ -511,7 +514,8 @@ shell_app_activate (ShellApp *app)
void
shell_app_activate_full (ShellApp *app,
int workspace,
- guint32 timestamp)
+ guint32 timestamp,
+ GError **error)
{
ShellGlobal *global;
@@ -524,16 +528,16 @@ shell_app_activate_full (ShellApp *app,
{
case SHELL_APP_STATE_STOPPED:
{
- GError *error = NULL;
- if (!shell_app_launch (app, timestamp, workspace, FALSE, &error))
+ GError *my_error = NULL;
+ if (!shell_app_launch (app, timestamp, workspace, FALSE, &my_error))
{
char *msg;
msg = g_strdup_printf (_("Failed to launch “%sâ€"), shell_app_get_name (app));
shell_global_notify_error (global,
msg,
- error->message);
+ my_error->message);
g_free (msg);
- g_clear_error (&error);
+ g_propagate_error (error, my_error);
}
}
break;
diff --git a/src/shell-app.h b/src/shell-app.h
index 8a09b642dc..6c3f30f9eb 100644
--- a/src/shell-app.h
+++ b/src/shell-app.h
@@ -29,11 +29,13 @@ gboolean shell_app_is_window_backed (ShellApp *app);
void shell_app_activate_window (ShellApp *app, MetaWindow *window, guint32 timestamp);
-void shell_app_activate (ShellApp *app);
+void shell_app_activate (ShellApp *app,
+ GError **error);
void shell_app_activate_full (ShellApp *app,
int workspace,
- guint32 timestamp);
+ guint32 timestamp,
+ GError **error);
void shell_app_open_new_window (ShellApp *app,
int workspace);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]