diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-03-01 20:00:14 -0600 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-03-01 20:00:14 -0600 |
commit | 37e796d3cb46f8292d85c9c68439a80d3e394960 (patch) | |
tree | 762bdbe28cd0bd3947b6212f397671a874120723 | |
parent | 59ade0a5dad1cb85f3576fc89c323a8baceb3a5e (diff) | |
download | ayatana-indicator-datetime-37e796d3cb46f8292d85c9c68439a80d3e394960.tar.gz ayatana-indicator-datetime-37e796d3cb46f8292d85c9c68439a80d3e394960.tar.bz2 ayatana-indicator-datetime-37e796d3cb46f8292d85c9c68439a80d3e394960.zip |
extract method on common code
-rw-r--r-- | src/datetime-service.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index ef43594..17608b9 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -331,7 +331,7 @@ update_datetime (gpointer user_data) /* Run a particular program based on an activation */ static void -activate_cb (DbusmenuMenuitem * menuitem, guint timestamp, const gchar *command) +execute_command (const gchar * command) { GError * error = NULL; @@ -342,6 +342,15 @@ activate_cb (DbusmenuMenuitem * menuitem, guint timestamp, const gchar *command) } } +/* Run a particular program based on an activation */ +static void +activate_cb (DbusmenuMenuitem * menuitem G_GNUC_UNUSED, + guint timestamp G_GNUC_UNUSED, + const gchar * command) +{ + execute_command (command); +} + static gboolean update_appointment_menu_items_idle (gpointer user_data) { @@ -420,13 +429,7 @@ day_selected_double_click_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant gchar *ad = isodate_from_time_t(evotime); gchar *cmd = g_strconcat("evolution calendar:///?startdate=", ad, NULL); - GError * error = NULL; - - g_debug("Issuing command '%s'", cmd); - if (!g_spawn_command_line_async(cmd, &error)) { - g_warning("Unable to start %s: %s", (char *)cmd, error->message); - g_error_free(error); - } + execute_command (cmd); return TRUE; } |