gnome-desktop r5310 - trunk/libgnome-desktop



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

Log:
Basic error reporting from gnome_rr_config_apply_stored()

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

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

Modified: trunk/libgnome-desktop/gnome-rr-config.c
==============================================================================
--- trunk/libgnome-desktop/gnome-rr-config.c	(original)
+++ trunk/libgnome-desktop/gnome-rr-config.c	Thu Dec  4 00:28:39 2008
@@ -1110,6 +1110,8 @@
     GnomeRRConfig **configs;
     GnomeRRConfig *result;
 
+    /* FMQ: return error */
+
     if (!screen)
 	return NULL;
     
@@ -1167,14 +1169,23 @@
 }
 
 gboolean
-gnome_rr_config_apply_stored (GnomeRRScreen *screen)
+gnome_rr_config_apply_stored (GnomeRRScreen *screen, GError **error)
 {
     GnomeRRConfig *stored;
+    GError *my_error;
 
-    if (!screen)
-	return FALSE;
+    g_return_val_if_fail (screen != NULL, FALSE);
+    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-    gnome_rr_screen_refresh (screen);
+    my_error = NULL;
+    if (!gnome_rr_screen_refresh (screen, &my_error)) {
+	    if (my_error) {
+		    g_propagate_error (error, my_error);
+		    return FALSE; /* This is a genuine error */
+	    }
+
+	    /* This means the screen didn't change, so just proceed */
+    }
 
     stored = gnome_rr_config_new_stored (screen);
 

Modified: trunk/libgnome-desktop/gnome-rr.c
==============================================================================
--- trunk/libgnome-desktop/gnome-rr.c	(original)
+++ trunk/libgnome-desktop/gnome-rr.c	Thu Dec  4 00:28:39 2008
@@ -478,16 +478,16 @@
     g_assert (screen != NULL);
 
     info = screen_info_new (screen, error);
-    if (info)
-    {
-	if (info->resources->configTimestamp != screen->info->resources->configTimestamp)
+    if (!info)
+	    return FALSE;
+
+    if (info->resources->configTimestamp != screen->info->resources->configTimestamp)
 	    changed = TRUE;
 	
-	screen_info_free (screen->info);
+    screen_info_free (screen->info);
 	
-	screen->info = info;
-    }
-    
+    screen->info = info;
+
     if ((changed || force_callback) && screen->callback)
 	screen->callback (screen, screen->data);
     
@@ -630,6 +630,19 @@
 	*max_height = screen->info->max_height;
 }
 
+/**
+ * gnome_rr_screen_refresh
+ * @screen: a #GnomeRRScreen
+ * @error: location to store error, or %NULL
+ *
+ * Refreshes the screen configuration, and calls the screen's callback if it
+ * exists and if the screen's configuration changed.
+ *
+ * Return value: TRUE if the screen's configuration changed; otherwise, the
+ * function returns FALSE and a NULL error if the configuration didn't change,
+ * or FALSE and a non-NULL error if there was an error while refreshing the
+ * configuration.
+ */
 gboolean
 gnome_rr_screen_refresh (GnomeRRScreen *screen,
 			 GError       **error)



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