gnome-desktop r5301 - in trunk/libgnome-desktop: . libgnomeui



Author: federico
Date: Thu Dec  4 00:26:39 2008
New Revision: 5301
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=5301&view=rev

Log:
Basic error reporting for the initialization functions

Signed-off-by: Federico Mena Quintero <federico novell com>

Modified:
   trunk/libgnome-desktop/gnome-rr.c
   trunk/libgnome-desktop/libgnomeui/gnome-rr.h

Modified: trunk/libgnome-desktop/gnome-rr.c
==============================================================================
--- trunk/libgnome-desktop/gnome-rr.c	(original)
+++ trunk/libgnome-desktop/gnome-rr.c	Thu Dec  4 00:26:39 2008
@@ -323,7 +323,8 @@
 static gboolean
 fill_out_screen_info (Display *xdisplay,
 		      Window xroot,
-		      ScreenInfo *info)
+		      ScreenInfo *info,
+		      GError **error)
 {
     XRRScreenResources *resources;
     
@@ -338,14 +339,18 @@
                                 &(info->max_width),
                                 &(info->max_height))) {
         /* XRR caught an error */
-        return False;
+	g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_RANDR_ERROR,
+		     _("could not get the range of screen sizes"));
+        return FALSE;
     }
     
     gdk_flush ();
     if (gdk_error_trap_pop ())
     {
         /* Unhandled X Error was generated */
-        return False;
+	g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_UNKNOWN,
+		     _("unhandled X error while getting the range of screen sizes"));
+        return FALSE;
     }
     
 #if 0
@@ -405,10 +410,10 @@
 	
 	/* Initialize */
 	for (crtc = info->crtcs; *crtc; ++crtc)
-	    crtc_initialize (*crtc, resources);
+	    crtc_initialize (*crtc, resources); /* FMQ: return error */
 	
 	for (output = info->outputs; *output; ++output)
-	    output_initialize (*output, resources);
+	    output_initialize (*output, resources); /* FMQ: return error */
 	
 	for (i = 0; i < resources->nmode; ++i)
 	{
@@ -426,7 +431,8 @@
 #if 0
 	g_print ("Couldn't get screen resources\n");
 #endif
-	
+	g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_RANDR_ERROR,
+		     _("could not get the screen resources (CRTCs, outputs, modes)"));
 	return FALSE;
     }
 }
@@ -776,6 +782,7 @@
     if (!info || !output->info)
     {
 	/* FIXME */
+	/* FMQ: return error */
 	return;
     }
     
@@ -1183,6 +1190,7 @@
     if (!info)
     {
 	/* FIXME: We need to reaquire the screen resources */
+	/* FMQ: return error.  See BadRRCrtc - can we actually catch that? */
 	return;
     }
     

Modified: trunk/libgnome-desktop/libgnomeui/gnome-rr.h
==============================================================================
--- trunk/libgnome-desktop/libgnomeui/gnome-rr.h	(original)
+++ trunk/libgnome-desktop/libgnomeui/gnome-rr.h	Thu Dec  4 00:26:39 2008
@@ -57,6 +57,7 @@
 typedef enum {
     GNOME_RR_ERROR_UNKNOWN,		/* generic "fail" */
     GNOME_RR_ERROR_NO_RANDR_EXTENSION,	/* RANDR extension is not present */
+    GNOME_RR_ERROR_RANDR_ERROR,		/* generic/undescribed error from the underlying XRR API */
 } GnomeRRError;
 
 /* GnomeRRScreen */



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