gnome-desktop r5302 - trunk/libgnome-desktop



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

Log:
Report errors from crtc_initialize()

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

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

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:53 2008
@@ -121,8 +121,9 @@
 static GnomeRRCrtc *  crtc_new          (ScreenInfo         *info,
 					 RRCrtc              id);
 static void           crtc_free         (GnomeRRCrtc        *crtc);
-static void           crtc_initialize   (GnomeRRCrtc        *crtc,
-					 XRRScreenResources *res);
+static gboolean       crtc_initialize   (GnomeRRCrtc        *crtc,
+					 XRRScreenResources *res,
+					 GError            **error);
 
 /* GnomeRROutput */
 static GnomeRROutput *output_new        (ScreenInfo         *info,
@@ -410,7 +411,13 @@
 	
 	/* Initialize */
 	for (crtc = info->crtcs; *crtc; ++crtc)
-	    crtc_initialize (*crtc, resources); /* FMQ: return error */
+	{
+	    if (!crtc_initialize (*crtc, resources, error))
+	    {
+		screen_info_free (info);
+		return FALSE;
+	    }
+	}
 	
 	for (output = info->outputs; *output; ++output)
 	    output_initialize (*output, resources); /* FMQ: return error */
@@ -1175,9 +1182,10 @@
     return crtc;
 }
 
-static void
+static gboolean
 crtc_initialize (GnomeRRCrtc        *crtc,
-		 XRRScreenResources *res)
+		 XRRScreenResources *res,
+		 GError            **error)
 {
     XRRCrtcInfo *info = XRRGetCrtcInfo (DISPLAY (crtc), res, crtc->id);
     GPtrArray *a;
@@ -1190,8 +1198,12 @@
     if (!info)
     {
 	/* FIXME: We need to reaquire the screen resources */
-	/* FMQ: return error.  See BadRRCrtc - can we actually catch that? */
-	return;
+	/* FIXME: can we actually catch BadRRCrtc, and does it make sense to emit that? */
+
+	g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_RANDR_ERROR,
+		     _("could not get information about CRTC %d"),
+		     (int) crtc->id);
+	return FALSE;
     }
     
     /* GnomeRRMode */



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