[evolution] Bug 571496 – Migrate from deprecated gnome_execute to g_spawn/xdg-terminal



commit 8cf036faffe5985d34c310ee89b133200380b757
Author: Adam Petaccia <adam tpetaccia com>
Date:   Wed May 6 11:01:32 2009 -0400

    Bug 571496 â?? Migrate from deprecated gnome_execute to g_spawn/xdg-terminal
---
 calendar/gui/alarm-notify/alarm-queue.c |   10 ++------
 calendar/gui/e-cal-list-view.c          |    1 -
 calendar/gui/e-day-view.c               |    1 -
 calendar/gui/e-week-view.c              |    1 -
 mail/mail-ops.c                         |    3 +-
 shell/e-shell-window-commands.c         |   33 ++++++++++++++----------------
 6 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index f3167d8..859b775 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -34,7 +34,6 @@
 #include <bonobo/bonobo-main.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-exec.h>
 #include <libgnome/gnome-sound.h>
 
 #include <libecal/e-cal-time-util.h>
@@ -1759,7 +1758,7 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
 	icalattach *attach;
 	const char *url;
 	char *cmd;
-	int result;
+	gboolean result = TRUE;
 
 	d(printf("%s:%d (procedure_notification)\n",__FILE__, __LINE__));
 
@@ -1793,9 +1792,8 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
 	else
 		cmd = (char *) url;
 
-	result = 0;
 	if (procedure_notification_dialog (cmd, url))
-		result = gnome_execute_shell (NULL, cmd);
+		result = g_spawn_command_line_async (cmd, NULL);
 
 	if (cmd != (char *) url)
 		g_free (cmd);
@@ -1803,7 +1801,7 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
 	icalattach_unref (attach);
 
 	/* Fall back to display notification if we got an error */
-	if (result < 0)
+	if (result == FALSE)
 		goto fallback;
 
 	return;
@@ -1813,8 +1811,6 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
 	display_notification (trigger, cqa, alarm_id, FALSE);
 }
 
-
-
 static gboolean
 check_midnight_refresh (gpointer user_data)
 {
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index cc9ae35..0702d3a 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -42,7 +42,6 @@
 #include <table/e-cell-combo.h>
 #include <misc/e-popup-menu.h>
 #include <misc/e-cell-date-edit.h>
-#include <libgnome/gnome-exec.h>
 #include <e-util/e-categories-config.h>
 #include <e-util/e-dialog-utils.h>
 #include <e-util/e-util-private.h>
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index af812ed..96bc63d 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -38,7 +38,6 @@
 #include <misc/e-unicode.h>
 #include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-exec.h>
 #include <e-util/e-categories-config.h>
 #include <e-util/e-dialog-utils.h>
 
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 3e5c427..264e302 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -35,7 +35,6 @@
 #include <math.h>
 #include <gdk/gdkkeysyms.h>
 #include <glib/gi18n.h>
-#include <libgnome/gnome-exec.h>
 #include <libgnomecanvas/gnome-canvas-pixbuf.h>
 #include <text/e-text.h>
 #include <misc/e-canvas-utils.h>
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index a8aa14d..896ec73 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -36,7 +36,6 @@
 #include <glib.h>
 #include <glib/gstdio.h>
 
-#include <libgnome/gnome-exec.h>
 #include <glib/gi18n.h>
 
 #include <camel/camel-mime-filter-from.h>
@@ -2514,7 +2513,7 @@ mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, vo
 	if (argc <= 0)
 		return;
 
-	gnome_execute_async_fds (NULL, argc, argv, TRUE);
+	g_spawn_async (NULL, argv, NULL, 0, NULL, data, NULL, NULL);
 }
 
 /* Async service-checking/authtype-lookup code. */
diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c
index 224dd67..289c5cb 100644
--- a/shell/e-shell-window-commands.c
+++ b/shell/e-shell-window-commands.c
@@ -27,7 +27,6 @@
 #include <gtk/gtk.h>
 #include <glib/gprintf.h>
 
-#include <libgnome/gnome-exec.h>
 #include <glib/gi18n.h>
 
 #include <gio/gio.h>
@@ -60,27 +59,25 @@
 /* Utility functions.  */
 
 static void
-launch_pilot_settings (const char *extra_arg)
+launch_pilot_settings (void)
 {
-        char *args[] = {
-                "gpilotd-control-applet",
-		(char *) extra_arg,
-		NULL
-        };
-        int pid;
-
-        args[0] = g_find_program_in_path ("gpilotd-control-applet");
-        if (!args[0]) {
+	GError* error = NULL;
+
+	gchar* args = g_find_program_in_path ("gpilotd-control-applet");
+	if (args == NULL) {
 		e_notice (NULL, GTK_MESSAGE_ERROR,
-			  _("The GNOME Pilot tools do not appear to be installed on this system."));
+			_("The GNOME Pilot tools do not appear to be installed on this system."));
 		return;
-        }
+	}
 
-        pid = gnome_execute_async (NULL, extra_arg ? 2 : 1, args);
-        g_free (args[0]);
+	g_spawn_command_line_async (args, &error);
+	g_free (args);
 
-        if (pid == -1)
-                e_notice (NULL, GTK_MESSAGE_ERROR, _("Error executing %s."), args[0]);
+	if (error != NULL) {
+		e_notice (NULL, GTK_MESSAGE_ERROR,
+			_("Error executing %s. (%s)"), args, error->message);
+		g_error_free (error);
+	}
 }
 
 
@@ -1082,7 +1079,7 @@ command_pilot_settings (BonoboUIComponent *uih,
 			EShellWindow *window,
 			const char *path)
 {
-	launch_pilot_settings (NULL);
+	launch_pilot_settings ();
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]