From 37e796d3cb46f8292d85c9c68439a80d3e394960 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 1 Mar 2012 20:00:14 -0600 Subject: extract method on common code --- src/datetime-service.c | 19 +++++++++++-------- 1 file 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; } -- cgit v1.2.3