aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-02-01 19:33:47 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-02-01 19:33:47 -0600
commitda453ec039c78d60ebad64226367780037621197 (patch)
tree094b91d823497c03a02583ec546b792407a348c1 /src
parent98a2abe1e732fb0110dbf7785569f3a5c0455dca (diff)
downloadayatana-indicator-power-da453ec039c78d60ebad64226367780037621197.tar.gz
ayatana-indicator-power-da453ec039c78d60ebad64226367780037621197.tar.bz2
ayatana-indicator-power-da453ec039c78d60ebad64226367780037621197.zip
better error reporting if g_spawn_command_line_async() fails
Diffstat (limited to 'src')
-rw-r--r--src/indicator-power.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 4bf9a6f..dc1007d 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -161,14 +161,20 @@ indicator_power_finalize (GObject *object)
***/
static void
+spawn_command_line_async (const char * command)
+{
+ GError * err = NULL;
+ if (!g_spawn_command_line_async (command, &err))
+ g_warning ("Couldn't execute command \"%s\": %s", command, err->message);
+ g_clear_error (&err);
+}
+
+static void
show_info_cb (GtkMenuItem *item,
gpointer data)
{
/*TODO: show the statistics of the specific device*/
- const gchar *command = "gnome-power-statistics";
-
- if (g_spawn_command_line_async (command, NULL) == FALSE)
- g_warning ("Couldn't execute command: %s", command);
+ spawn_command_line_async ("gnome-power-statistics");
}
static void
@@ -191,10 +197,7 @@ static void
show_preferences_cb (GtkMenuItem *item,
gpointer data)
{
- const gchar *command = "gnome-control-center power";
-
- if (g_spawn_command_line_async (command, NULL) == FALSE)
- g_warning ("Couldn't execute command: %s", command);
+ spawn_command_line_async ("gnome-control-center power");
}
static void