gnome-docker r5 - trunk/src



Author: hmacht
Date: Fri May  9 08:57:35 2008
New Revision: 5
URL: http://svn.gnome.org/viewvc/gnome-docker?rev=5&view=rev

Log:
update error messages


Modified:
   trunk/src/gd-dbus.c
   trunk/src/gd-xrandr.c

Modified: trunk/src/gd-dbus.c
==============================================================================
--- trunk/src/gd-dbus.c	(original)
+++ trunk/src/gd-dbus.c	Fri May  9 08:57:35 2008
@@ -149,14 +149,15 @@
 
 			if (!strcmp(key, "info.docked")) {
 				int docked;
+
 				liblazy_hal_get_property_bool(path, "info.docked", &docked);
 				if (docked) {
 					gd_notify_info(_("Docked"),
-							    _("Your computer has been docked"));
+						       _("Your computer has been docked"));
 					gd_tray_icon_set_visible(TRUE);
 				} else {
 					gd_notify_info(_("Undocked"),
-							    _("Your computer has been undocked"));
+						       _("Your computer has been undocked"));
 					gd_tray_icon_set_visible(FALSE);
 				}
 				gd_xrandr_adjust_displays();

Modified: trunk/src/gd-xrandr.c
==============================================================================
--- trunk/src/gd-xrandr.c	(original)
+++ trunk/src/gd-xrandr.c	Fri May  9 08:57:35 2008
@@ -7,15 +7,16 @@
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
-
 #include <glib.h>
 
+#include "gnome-docker.h"
+
 int gd_xrandr_adjust_displays(void)
 {
 	pid_t pid = fork();
 
 	if (pid == -1) {
-		perror("forking");
+		gd_error("forking");
 		return -1;
 	} else if (pid == 0) {
 		/* child */
@@ -26,27 +27,24 @@
 		argv[2] = NULL;
 
 		execvp(argv[0], argv);
-		fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
+		gd_error("%s: %s\n", argv[0], strerror(errno));
 		exit(EXIT_FAILURE);
-	} else {
-		/* parent: wait for child */
-		int status;
-		int ret_code = -1;
-
-		pid = wait(&status);
-
-		if (WIFSIGNALED(status)) {
-			ret_code = WTERMSIG(status);
-			printf("recode: %d\n", ret_code);
-		} else if (WIFEXITED(status)) {
-			ret_code = WEXITSTATUS(status);
-			printf("recode: %d\n", ret_code);
-		} else {
-			fprintf(stderr, "Unknown termination\n");
-			return -1;
-		}
 	}
 
-	return 0;
+	/* parent: wait for child */
+	int status;
+	int ret_code = -1;
+
+	while (wait(&status) != pid)
+		; // empty
+
+	if (WIFSIGNALED(status)) {
+		ret_code = WTERMSIG(status);
+	} else if (WIFEXITED(status)) {
+		ret_code = WEXITSTATUS(status);
+	}
+
+	gd_info("xrandr returned with code: %d\n", ret_code);
 
+	return 0;
 }



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