[gnome-desktop] Revert "Turn GnomeRRConfig and GnomeOutputInfo into GObjects"



commit 6629e06b48019f2500b69f334c20d1d1850f2b55
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Tue Nov 9 22:53:40 2010 +0100

    Revert "Turn GnomeRRConfig and GnomeOutputInfo into GObjects"
    
    This reverts commit 139ac9d3510767444e425366594f7e7e6bb5c1f8.
    I messed with git push.
    Really, I promise I will not commit a patch without reviewing it!

 libgnome-desktop/Makefile.am            |    1 -
 libgnome-desktop/gnome-rr-config.c      |  800 +++++++++++++++---------------
 libgnome-desktop/gnome-rr-config.h      |  182 ++++----
 libgnome-desktop/gnome-rr-labeler.c     |  169 +++----
 libgnome-desktop/gnome-rr-labeler.h     |   14 +-
 libgnome-desktop/gnome-rr-output-info.c |  246 ----------
 libgnome-desktop/gnome-rr-private.h     |   31 --
 libgnome-desktop/gnome-rr.c             |   25 +-
 libgnome-desktop/gnome-rr.h             |   20 +-
 9 files changed, 574 insertions(+), 914 deletions(-)
---
diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am
index 9689cdb..3e51f06 100644
--- a/libgnome-desktop/Makefile.am
+++ b/libgnome-desktop/Makefile.am
@@ -22,7 +22,6 @@ introspection_sources = 		\
 	display-name.c			\
 	gnome-rr.c			\
 	gnome-rr-config.c		\
-	gnome-rr-output-info.c		\
 	gnome-rr-labeler.c		\
 	edid-parse.c
 
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index 25b0545..2a8a84f 100644
--- a/libgnome-desktop/gnome-rr-config.c
+++ b/libgnome-desktop/gnome-rr-config.c
@@ -1,8 +1,6 @@
 /* gnome-rr-config.c
- * -*- c-basic-offset: 4 -*-
  *
  * Copyright 2007, 2008, Red Hat, Inc.
- * Copyright 2010 Giovanni Campagna
  * 
  * This file is part of the Gnome Library.
  * 
@@ -36,6 +34,7 @@
 #include <X11/Xlib.h>
 #include <gdk/gdkx.h>
 
+#undef GNOME_DISABLE_DEPRECATED
 #include "gnome-rr-config.h"
 
 #include "edid.h"
@@ -80,21 +79,16 @@ typedef struct CrtcAssignment CrtcAssignment;
 static gboolean         crtc_assignment_apply (CrtcAssignment   *assign,
 					       guint32           timestamp,
 					       GError          **error);
-static CrtcAssignment  *crtc_assignment_new   (GnomeRRScreen      *screen,
-					       GnomeRROutputInfo **outputs,
-					       GError            **error);
+static CrtcAssignment  *crtc_assignment_new   (GnomeRRScreen    *screen,
+					       GnomeOutputInfo **outputs,
+					       GError          **error);
 static void             crtc_assignment_free  (CrtcAssignment   *assign);
+static void             output_free           (GnomeOutputInfo  *output);
+static GnomeOutputInfo *output_copy           (const GnomeOutputInfo  *output);
+static GnomeRRConfig *  gnome_rr_config_copy (const GnomeRRConfig *config);
 
-enum {
-  PROP_0,
-  PROP_CURRENT,
-  PROP_SCREEN,
-  PROP_LAST
-};
-
-static void gnome_rr_config_initable_iface_init (GInitableIface *iface);
-G_DEFINE_TYPE_WITH_CODE (GnomeRRConfig, gnome_rr_config, G_TYPE_OBJECT,
-			 G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gnome_rr_config_initable_iface_init))
+G_DEFINE_BOXED_TYPE (GnomeOutputInfo, gnome_rr_output_info, output_copy, output_free)
+G_DEFINE_BOXED_TYPE (GnomeRRConfig, gnome_rr_config, gnome_rr_config_copy, gnome_rr_config_free)
 
 typedef struct Parser Parser;
 
@@ -102,7 +96,7 @@ typedef struct Parser Parser;
 struct Parser
 {
     int			config_file_version;
-    GnomeRROutputInfo *	output;
+    GnomeOutputInfo *	output;
     GnomeRRConfig *	configuration;
     GPtrArray *		outputs;
     GPtrArray *		configurations;
@@ -177,38 +171,38 @@ handle_start_element (GMarkupParseContext *context,
 	int i;
 	g_assert (parser->output == NULL);
 
-	parser->output = g_object_new (GNOME_TYPE_RR_OUTPUT_INFO, NULL);
-	parser->output->priv->rotation = 0;
+	parser->output = g_new0 (GnomeOutputInfo, 1);
+	parser->output->rotation = 0;
 	
 	for (i = 0; attr_names[i] != NULL; ++i)
 	{
 	    if (strcmp (attr_names[i], "name") == 0)
 	    {
-		parser->output->priv->name = g_strdup (attr_values[i]);
+		parser->output->name = g_strdup (attr_values[i]);
 		break;
 	    }
 	}
 
-	if (!parser->output->priv->name)
+	if (!parser->output->name)
 	{
 	    /* This really shouldn't happen, but it's better to make
 	     * something up than to crash later.
 	     */
 	    g_warning ("Malformed monitor configuration file");
 	    
-	    parser->output->priv->name = g_strdup ("default");
+	    parser->output->name = g_strdup ("default");
 	}	
-	parser->output->priv->connected = FALSE;
-	parser->output->priv->on = FALSE;
-	parser->output->priv->primary = FALSE;
+	parser->output->connected = FALSE;
+	parser->output->on = FALSE;
+	parser->output->primary = FALSE;
     }
     else if (strcmp (name, "configuration") == 0)
     {
 	g_assert (parser->configuration == NULL);
 	
-	parser->configuration = g_object_new (GNOME_TYPE_RR_CONFIG, NULL);
-	parser->configuration->priv->clone = FALSE;
-	parser->configuration->priv->outputs = NULL;
+	parser->configuration = g_new0 (GnomeRRConfig, 1);
+	parser->configuration->clone = FALSE;
+	parser->configuration->outputs = NULL;
     }
     else if (strcmp (name, "monitors") == 0)
     {
@@ -238,8 +232,8 @@ handle_end_element (GMarkupParseContext *context,
     if (strcmp (name, "output") == 0)
     {
 	/* If no rotation properties were set, just use GNOME_RR_ROTATION_0 */
-	if (parser->output->priv->rotation == 0)
-	    parser->output->priv->rotation = GNOME_RR_ROTATION_0;
+	if (parser->output->rotation == 0)
+	    parser->output->rotation = GNOME_RR_ROTATION_0;
 	
 	g_ptr_array_add (parser->outputs, parser->output);
 
@@ -248,8 +242,8 @@ handle_end_element (GMarkupParseContext *context,
     else if (strcmp (name, "configuration") == 0)
     {
 	g_ptr_array_add (parser->outputs, NULL);
-	parser->configuration->priv->outputs =
-	    (GnomeRROutputInfo **)g_ptr_array_free (parser->outputs, FALSE);
+	parser->configuration->outputs =
+	    (GnomeOutputInfo **)g_ptr_array_free (parser->outputs, FALSE);
 	parser->outputs = g_ptr_array_new ();
 	g_ptr_array_add (parser->configurations, parser->configuration);
 	parser->configuration = NULL;
@@ -271,96 +265,96 @@ handle_text (GMarkupParseContext *context,
     
     if (stack_is (parser, "vendor", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->connected = TRUE;
+	parser->output->connected = TRUE;
 	
-	strncpy ((gchar*) parser->output->priv->vendor, text, 3);
-	parser->output->priv->vendor[3] = 0;
+	strncpy (parser->output->vendor, text, 3);
+	parser->output->vendor[3] = 0;
     }
     else if (stack_is (parser, "clone", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
 	if (strcmp (text, "yes") == 0)
-	    parser->configuration->priv->clone = TRUE;
+	    parser->configuration->clone = TRUE;
     }
     else if (stack_is (parser, "product", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->connected = TRUE;
+	parser->output->connected = TRUE;
 
-	parser->output->priv->product = parse_int (text);
+	parser->output->product = parse_int (text);
     }
     else if (stack_is (parser, "serial", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->connected = TRUE;
+	parser->output->connected = TRUE;
 
-	parser->output->priv->serial = parse_uint (text);
+	parser->output->serial = parse_uint (text);
     }
     else if (stack_is (parser, "width", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->on = TRUE;
+	parser->output->on = TRUE;
 
-	parser->output->priv->width = parse_int (text);
+	parser->output->width = parse_int (text);
     }
     else if (stack_is (parser, "x", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->on = TRUE;
+	parser->output->on = TRUE;
 
-	parser->output->priv->x = parse_int (text);
+	parser->output->x = parse_int (text);
     }
     else if (stack_is (parser, "y", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->on = TRUE;
+	parser->output->on = TRUE;
 
-	parser->output->priv->y = parse_int (text);
+	parser->output->y = parse_int (text);
     }
     else if (stack_is (parser, "height", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->on = TRUE;
+	parser->output->on = TRUE;
 
-	parser->output->priv->height = parse_int (text);
+	parser->output->height = parse_int (text);
     }
     else if (stack_is (parser, "rate", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
-	parser->output->priv->on = TRUE;
+	parser->output->on = TRUE;
 
-	parser->output->priv->rate = parse_int (text);
+	parser->output->rate = parse_int (text);
     }
     else if (stack_is (parser, "rotation", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
 	if (strcmp (text, "normal") == 0)
 	{
-	    parser->output->priv->rotation |= GNOME_RR_ROTATION_0;
+	    parser->output->rotation |= GNOME_RR_ROTATION_0;
 	}
 	else if (strcmp (text, "left") == 0)
 	{
-	    parser->output->priv->rotation |= GNOME_RR_ROTATION_90;
+	    parser->output->rotation |= GNOME_RR_ROTATION_90;
 	}
 	else if (strcmp (text, "upside_down") == 0)
 	{
-	    parser->output->priv->rotation |= GNOME_RR_ROTATION_180;
+	    parser->output->rotation |= GNOME_RR_ROTATION_180;
 	}
 	else if (strcmp (text, "right") == 0)
 	{
-	    parser->output->priv->rotation |= GNOME_RR_ROTATION_270;
+	    parser->output->rotation |= GNOME_RR_ROTATION_270;
 	}
     }
     else if (stack_is (parser, "reflect_x", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
 	if (strcmp (text, "yes") == 0)
 	{
-	    parser->output->priv->rotation |= GNOME_RR_REFLECT_X;
+	    parser->output->rotation |= GNOME_RR_REFLECT_X;
 	}
     }
     else if (stack_is (parser, "reflect_y", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
 	if (strcmp (text, "yes") == 0)
 	{
-	    parser->output->priv->rotation |= GNOME_RR_REFLECT_Y;
+	    parser->output->rotation |= GNOME_RR_REFLECT_Y;
 	}
     }
     else if (stack_is (parser, "primary", "output", "configuration", TOPLEVEL_ELEMENT, NULL))
     {
 	if (strcmp (text, "yes") == 0)
 	{
-	    parser->output->priv->primary = TRUE;
+	    parser->output->primary = TRUE;
 	}
     }
     else
@@ -378,16 +372,16 @@ parser_free (Parser *parser)
     g_assert (parser != NULL);
 
     if (parser->output)
-	g_object_unref (parser->output);
+	output_free (parser->output);
 
     if (parser->configuration)
-	g_object_unref (parser->configuration);
+	gnome_rr_config_free (parser->configuration);
 
     for (i = 0; i < parser->outputs->len; ++i)
     {
-	GnomeRROutputInfo *output = parser->outputs->pdata[i];
+	GnomeOutputInfo *output = parser->outputs->pdata[i];
 
-	g_object_unref (output);
+	output_free (output);
     }
 
     g_ptr_array_free (parser->outputs, TRUE);
@@ -396,7 +390,7 @@ parser_free (Parser *parser)
     {
 	GnomeRRConfig *config = parser->configurations->pdata[i];
 
-	g_object_unref (config);
+	gnome_rr_config_free (config);
     }
 
     g_ptr_array_free (parser->configurations, TRUE);
@@ -447,58 +441,10 @@ out:
     return result;
 }
 
-static void
-gnome_rr_config_init (GnomeRRConfig *self)
-{
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GNOME_TYPE_RR_CONFIG, GnomeRRConfigPrivate);
-
-    self->priv->current = FALSE;
-    self->priv->clone = FALSE;
-    self->priv->screen = NULL;
-    self->priv->outputs = NULL;
-}
-
-static void
-gnome_rr_config_set_property (GObject *gobject, guint property_id, const GValue *value, GParamSpec *property)
-{
-    GnomeRRConfig *self = GNOME_RR_CONFIG (gobject);
-
-    switch (property_id) {
-	case PROP_CURRENT:
-	    self->priv->current = g_value_get_boolean (value);
-	    return;
-	case PROP_SCREEN:
-	    self->priv->screen = g_value_dup_object (value);
-	    return;
-	default:
-	    G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, property);
-    }
-}
-
-static void
-gnome_rr_config_finalize (GObject *gobject)
-{
-    GnomeRRConfig *self = GNOME_RR_CONFIG (gobject);
-
-    if (self->priv->screen)
-	g_object_unref (self->priv->screen);
-
-    if (self->priv->outputs) {
-	int i;
-
-        for (i = 0; self->priv->outputs[i] != NULL; i++) {
-	    GnomeRROutputInfo *output = self->priv->outputs[i];
-	    g_object_unref (output);
-	}
-	g_free (self->priv->outputs);
-    }
-
-    G_OBJECT_CLASS (gnome_rr_config_parent_class)->finalize (gobject);
-}
-
-static gboolean
-config_init_current (GnomeRRConfig *config)
+GnomeRRConfig *
+gnome_rr_config_new_current (GnomeRRScreen *screen)
 {
+    GnomeRRConfig *config = g_new0 (GnomeRRConfig, 1);
     GPtrArray *a = g_ptr_array_new ();
     GnomeRROutput **rr_outputs;
     int i;
@@ -506,29 +452,31 @@ config_init_current (GnomeRRConfig *config)
     int clone_height = -1;
     int last_x;
 
-    rr_outputs = gnome_rr_screen_list_outputs (config->priv->screen);
+    g_return_val_if_fail (screen != NULL, NULL);
 
-    config->priv->clone = FALSE;
+    rr_outputs = gnome_rr_screen_list_outputs (screen);
+
+    config->clone = FALSE;
     
     for (i = 0; rr_outputs[i] != NULL; ++i)
     {
 	GnomeRROutput *rr_output = rr_outputs[i];
-	GnomeRROutputInfo *output = g_object_new (GNOME_TYPE_RR_OUTPUT_INFO, NULL);
+	GnomeOutputInfo *output = g_new0 (GnomeOutputInfo, 1);
 	GnomeRRMode *mode = NULL;
 	const guint8 *edid_data = gnome_rr_output_get_edid_data (rr_output);
 	GnomeRRCrtc *crtc;
 
-	output->priv->name = g_strdup (gnome_rr_output_get_name (rr_output));
-	output->priv->connected = gnome_rr_output_is_connected (rr_output);
+	output->name = g_strdup (gnome_rr_output_get_name (rr_output));
+	output->connected = gnome_rr_output_is_connected (rr_output);
 
-	if (!output->priv->connected)
+	if (!output->connected)
 	{
-	    output->priv->x = -1;
-	    output->priv->y = -1;
-	    output->priv->width = -1;
-	    output->priv->height = -1;
-	    output->priv->rate = -1;
-	    output->priv->rotation = GNOME_RR_ROTATION_0;
+	    output->x = -1;
+	    output->y = -1;
+	    output->width = -1;
+	    output->height = -1;
+	    output->rate = -1;
+	    output->rotation = GNOME_RR_ROTATION_0;
 	}
 	else
 	{
@@ -539,24 +487,24 @@ config_init_current (GnomeRRConfig *config)
 
 	    if (info)
 	    {
-		memcpy (output->priv->vendor, info->manufacturer_code,
-			sizeof (output->priv->vendor));
+		memcpy (output->vendor, info->manufacturer_code,
+			sizeof (output->vendor));
 		
-		output->priv->product = info->product_code;
-		output->priv->serial = info->serial_number;
-		output->priv->aspect = info->aspect_ratio;
+		output->product = info->product_code;
+		output->serial = info->serial_number;
+		output->aspect = info->aspect_ratio;
 	    }
 	    else
 	    {
-		strcpy (output->priv->vendor, "???");
-		output->priv->product = 0;
-		output->priv->serial = 0;
+		strcpy (output->vendor, "???");
+		output->product = 0;
+		output->serial = 0;
 	    }
 
 	    if (gnome_rr_output_is_laptop (rr_output))
-		output->priv->display_name = g_strdup (_("Laptop"));
+		output->display_name = g_strdup (_("Laptop"));
 	    else
-		output->priv->display_name = make_display_name (info);
+		output->display_name = make_display_name (info);
 		
 	    g_free (info);
 		
@@ -565,28 +513,28 @@ config_init_current (GnomeRRConfig *config)
 	    
 	    if (crtc && mode)
 	    {
-		output->priv->on = TRUE;
+		output->on = TRUE;
 		
-		gnome_rr_crtc_get_position (crtc, &output->priv->x, &output->priv->y);
-		output->priv->width = gnome_rr_mode_get_width (mode);
-		output->priv->height = gnome_rr_mode_get_height (mode);
-		output->priv->rate = gnome_rr_mode_get_freq (mode);
-		output->priv->rotation = gnome_rr_crtc_get_current_rotation (crtc);
+		gnome_rr_crtc_get_position (crtc, &output->x, &output->y);
+		output->width = gnome_rr_mode_get_width (mode);
+		output->height = gnome_rr_mode_get_height (mode);
+		output->rate = gnome_rr_mode_get_freq (mode);
+		output->rotation = gnome_rr_crtc_get_current_rotation (crtc);
 
-		if (output->priv->x == 0 && output->priv->y == 0) {
+		if (output->x == 0 && output->y == 0) {
 			if (clone_width == -1) {
-				clone_width = output->priv->width;
-				clone_height = output->priv->height;
-			} else if (clone_width == output->priv->width &&
-				   clone_height == output->priv->height) {
-				config->priv->clone = TRUE;
+				clone_width = output->width;
+				clone_height = output->height;
+			} else if (clone_width == output->width &&
+				   clone_height == output->height) {
+				config->clone = TRUE;
 			}
 		}
 	    }
 	    else
 	    {
-		output->priv->on = FALSE;
-		config->priv->clone = FALSE;
+		output->on = FALSE;
+		config->clone = FALSE;
 	    }
 
 	    /* Get preferred size for the monitor */
@@ -612,160 +560,117 @@ config_init_current (GnomeRRConfig *config)
 	    
 	    if (mode)
 	    {
-		output->priv->pref_width = gnome_rr_mode_get_width (mode);
-		output->priv->pref_height = gnome_rr_mode_get_height (mode);
+		output->pref_width = gnome_rr_mode_get_width (mode);
+		output->pref_height = gnome_rr_mode_get_height (mode);
 	    }
 	    else
 	    {
 		/* Pick some random numbers. This should basically never happen */
-		output->priv->pref_width = 1024;
-		output->priv->pref_height = 768;
+		output->pref_width = 1024;
+		output->pref_height = 768;
 	    }
 	}
 
-        output->priv->primary = gnome_rr_output_get_is_primary (rr_output);
+        output->primary = gnome_rr_output_get_is_primary (rr_output);
  
 	g_ptr_array_add (a, output);
     }
 
     g_ptr_array_add (a, NULL);
     
-    config->priv->outputs = (GnomeRROutputInfo **)g_ptr_array_free (a, FALSE);
+    config->outputs = (GnomeOutputInfo **)g_ptr_array_free (a, FALSE);
 
     /* Walk the outputs computing the right-most edge of all
      * lit-up displays
      */
     last_x = 0;
-    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    for (i = 0; config->outputs[i] != NULL; ++i)
     {
-	GnomeRROutputInfo *output = config->priv->outputs[i];
+	GnomeOutputInfo *output = config->outputs[i];
 
-	if (output->priv->on)
+	if (output->on)
 	{
-	    last_x = MAX (last_x, output->priv->x + output->priv->width);
+	    last_x = MAX (last_x, output->x + output->width);
 	}
     }
 
     /* Now position all off displays to the right of the
      * on displays
      */
-    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    for (i = 0; config->outputs[i] != NULL; ++i)
     {
-	GnomeRROutputInfo *output = config->priv->outputs[i];
+	GnomeOutputInfo *output = config->outputs[i];
 
-	if (output->priv->connected && !output->priv->on)
+	if (output->connected && !output->on)
 	{
-	    output->priv->x = last_x;
-	    last_x = output->priv->x + output->priv->width;
+	    output->x = last_x;
+	    last_x = output->x + output->width;
 	}
     }
     
     g_assert (gnome_rr_config_match (config, config));
-
-    return TRUE;
+    
+    return config;
 }
 
-static gboolean
-config_init_stored (GnomeRRConfig *result, const char *filename, GError **error)
+static void
+output_free (GnomeOutputInfo *output)
 {
-    GnomeRRConfig *current;
-    GnomeRRConfig **configs;
-    gboolean found = FALSE;
-
-    g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
-    current = gnome_rr_config_new_current (result->priv->screen, error);
-
-    configs = configurations_read_from_file (filename, error);
+    if (output->display_name)
+	g_free (output->display_name);
 
-    if (configs)
-    {
-	int i;
-
-	for (i = 0; configs[i] != NULL; ++i)
-	{
-	    if (gnome_rr_config_match (configs[i], current))
-	    {
-		int j;
-		GPtrArray *array;
-		result->priv->clone = configs[i]->priv->clone;
+    if (output->name)
+	g_free (output->name);
+    
+    g_free (output);
+}
 
-		array = g_ptr_array_new ();
-		for (j = 0; configs[i]->priv->outputs[j] != NULL; j++) {
-		    g_ptr_array_add (array, configs[i]->priv->outputs[i]);
-		}
-		g_ptr_array_add (array, NULL);
-		result->priv->outputs = (GnomeRROutputInfo **) g_ptr_array_free (array, FALSE);
+static GnomeOutputInfo *
+output_copy (const GnomeOutputInfo *output)
+{
+    GnomeOutputInfo *copy = g_new0 (GnomeOutputInfo, 1);
 
-		found = TRUE;
-		break;
-	    }
-	    g_object_unref (configs[i]);
-	}
-	g_free (configs);
+    *copy = *output;
 
-	if (!found)
-	    g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_NO_MATCHING_CONFIG,
-			 _("none of the saved display configurations matched the active configuration"));
-    }
+    copy->name = g_strdup (output->name);
+    copy->display_name = g_strdup (output->display_name);
 
-    g_object_unref (current);
-    return found;
+    return copy;
 }
 
-static gboolean
-gnome_rr_config_initable_init (GInitable* initable, GCancellable* cancellable, GError** error)
+static void
+outputs_free (GnomeOutputInfo **outputs)
 {
-    GnomeRRConfig *self = GNOME_RR_CONFIG (initable);
+    int i;
 
-    if (self->priv->current) {
-	return config_init_current (self);
-    } else {
-	gchar *filename;
-	gboolean retval;
+    g_assert (outputs != NULL);
 
-	filename = gnome_rr_config_get_intended_filename ();
-	retval = config_init_stored (self, filename, error);
+    for (i = 0; outputs[i] != NULL; ++i)
+	output_free (outputs[i]);
 
-	g_free (filename);
-	return retval;
-    }
+    g_free (outputs);
 }
 
-static void
-gnome_rr_config_initable_iface_init (GInitableIface *iface)
+void
+gnome_rr_config_free (GnomeRRConfig *config)
 {
-    iface->init = gnome_rr_config_initable_init;
+    g_return_if_fail (config != NULL);
+    outputs_free (config->outputs);
+    
+    g_free (config);
 }
 
 static void
-gnome_rr_config_class_init (GnomeRRConfigClass *klass)
+configurations_free (GnomeRRConfig **configurations)
 {
-    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+    int i;
 
-    g_type_class_add_private (klass, sizeof (GnomeRROutputInfoPrivate));
+    g_assert (configurations != NULL);
 
-    gobject_class->set_property = gnome_rr_config_set_property;
-    gobject_class->finalize = gnome_rr_config_finalize;
+    for (i = 0; configurations[i] != NULL; ++i)
+	gnome_rr_config_free (configurations[i]);
 
-    g_object_class_install_property (gobject_class, PROP_CURRENT,
-				     g_param_spec_boolean ("current", "Current", "If this is current screen configuration", FALSE,
-							   G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-    g_object_class_install_property (gobject_class, PROP_SCREEN,
-				     g_param_spec_object ("screen", "Screen", "The GnomeRRScreen this config applies to", GNOME_TYPE_RR_SCREEN,
-							  G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
-}
-
-GnomeRRConfig *
-gnome_rr_config_new_current (GnomeRRScreen *screen, GError **error)
-{
-    return g_initable_new (GNOME_TYPE_RR_CONFIG, NULL, error, "screen", screen, "current", TRUE, NULL);
-}
-
-GnomeRRConfig *
-gnome_rr_config_new_stored (GnomeRRScreen *screen, GError **error)
-{
-    return g_initable_new (GNOME_TYPE_RR_CONFIG, NULL, error, "screen", screen, "current", FALSE, NULL);
+    g_free (configurations);
 }
 
 static gboolean
@@ -810,75 +715,75 @@ out:
 }
 
 static gboolean
-output_match (GnomeRROutputInfo *output1, GnomeRROutputInfo *output2)
+output_match (GnomeOutputInfo *output1, GnomeOutputInfo *output2)
 {
-    g_assert (GNOME_IS_RR_OUTPUT_INFO (output1));
-    g_assert (GNOME_IS_RR_OUTPUT_INFO (output2));
+    g_assert (output1 != NULL);
+    g_assert (output2 != NULL);
 
-    if (strcmp (output1->priv->name, output2->priv->name) != 0)
+    if (strcmp (output1->name, output2->name) != 0)
 	return FALSE;
 
-    if (strcmp (output1->priv->vendor, output2->priv->vendor) != 0)
+    if (strcmp (output1->vendor, output2->vendor) != 0)
 	return FALSE;
 
-    if (output1->priv->product != output2->priv->product)
+    if (output1->product != output2->product)
 	return FALSE;
 
-    if (output1->priv->serial != output2->priv->serial)
+    if (output1->serial != output2->serial)
 	return FALSE;
 
-    if (output1->priv->connected != output2->priv->connected)
+    if (output1->connected != output2->connected)
 	return FALSE;
     
     return TRUE;
 }
 
 static gboolean
-output_equal (GnomeRROutputInfo *output1, GnomeRROutputInfo *output2)
+output_equal (GnomeOutputInfo *output1, GnomeOutputInfo *output2)
 {
-    g_assert (GNOME_IS_RR_OUTPUT_INFO (output1));
-    g_assert (GNOME_IS_RR_OUTPUT_INFO (output2));
+    g_assert (output1 != NULL);
+    g_assert (output2 != NULL);
 
     if (!output_match (output1, output2))
 	return FALSE;
 
-    if (output1->priv->on != output2->priv->on)
+    if (output1->on != output2->on)
 	return FALSE;
 
-    if (output1->priv->on)
+    if (output1->on)
     {
-	if (output1->priv->width != output2->priv->width)
+	if (output1->width != output2->width)
 	    return FALSE;
 	
-	if (output1->priv->height != output2->priv->height)
+	if (output1->height != output2->height)
 	    return FALSE;
 	
-	if (output1->priv->rate != output2->priv->rate)
+	if (output1->rate != output2->rate)
 	    return FALSE;
 	
-	if (output1->priv->x != output2->priv->x)
+	if (output1->x != output2->x)
 	    return FALSE;
 	
-	if (output1->priv->y != output2->priv->y)
+	if (output1->y != output2->y)
 	    return FALSE;
 	
-	if (output1->priv->rotation != output2->priv->rotation)
+	if (output1->rotation != output2->rotation)
 	    return FALSE;
     }
 
     return TRUE;
 }
 
-static GnomeRROutputInfo *
+static GnomeOutputInfo *
 find_output (GnomeRRConfig *config, const char *name)
 {
     int i;
 
-    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    for (i = 0; config->outputs[i] != NULL; ++i)
     {
-	GnomeRROutputInfo *output = config->priv->outputs[i];
+	GnomeOutputInfo *output = config->outputs[i];
 	
-	if (strcmp (name, output->priv->name) == 0)
+	if (strcmp (name, output->name) == 0)
 	    return output;
     }
 
@@ -892,15 +797,13 @@ gboolean
 gnome_rr_config_match (GnomeRRConfig *c1, GnomeRRConfig *c2)
 {
     int i;
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (c1), FALSE);
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (c2), FALSE);
 
-    for (i = 0; c1->priv->outputs[i] != NULL; ++i)
+    for (i = 0; c1->outputs[i] != NULL; ++i)
     {
-	GnomeRROutputInfo *output1 = c1->priv->outputs[i];
-	GnomeRROutputInfo *output2;
+	GnomeOutputInfo *output1 = c1->outputs[i];
+	GnomeOutputInfo *output2;
 
-	output2 = find_output (c2, output1->priv->name);
+	output2 = find_output (c2, output1->name);
 	if (!output2 || !output_match (output1, output2))
 	    return FALSE;
     }
@@ -916,15 +819,13 @@ gnome_rr_config_equal (GnomeRRConfig  *c1,
 		       GnomeRRConfig  *c2)
 {
     int i;
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (c1), FALSE);
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (c2), FALSE);
 
-    for (i = 0; c1->priv->outputs[i] != NULL; ++i)
+    for (i = 0; c1->outputs[i] != NULL; ++i)
     {
-	GnomeRROutputInfo *output1 = c1->priv->outputs[i];
-	GnomeRROutputInfo *output2;
+	GnomeOutputInfo *output1 = c1->outputs[i];
+	GnomeOutputInfo *output2;
 
-	output2 = find_output (c2, output1->priv->name);
+	output2 = find_output (c2, output1->name);
 	if (!output2 || !output_equal (output1, output2))
 	    return FALSE;
     }
@@ -932,39 +833,34 @@ gnome_rr_config_equal (GnomeRRConfig  *c1,
     return TRUE;
 }
 
-static GnomeRROutputInfo **
+static GnomeOutputInfo **
 make_outputs (GnomeRRConfig *config)
 {
     GPtrArray *outputs;
-    GnomeRROutputInfo *first_on;
+    GnomeOutputInfo *first_on;
     int i;
 
     outputs = g_ptr_array_new ();
 
     first_on = NULL;
     
-    for (i = 0; config->priv->outputs[i] != NULL; ++i)
+    for (i = 0; config->outputs[i] != NULL; ++i)
     {
-	GnomeRROutputInfo *old = config->priv->outputs[i];
-	GnomeRROutputInfo *new = g_object_new (GNOME_TYPE_RR_OUTPUT_INFO, NULL);
-	*(new->priv) = *(old->priv);
-	if (old->priv->name)
-	    new->priv->name = g_strdup (old->priv->name);
-	if (old->priv->display_name)
-	    new->priv->display_name = g_strdup (old->priv->display_name);
-
-	if (old->priv->on && !first_on)
+	GnomeOutputInfo *old = config->outputs[i];
+	GnomeOutputInfo *new = output_copy (old);
+
+	if (old->on && !first_on)
 	    first_on = old;
 	
-	if (config->priv->clone && new->priv->on)
+	if (config->clone && new->on)
 	{
 	    g_assert (first_on);
 
-	    new->priv->width = first_on->priv->width;
-	    new->priv->height = first_on->priv->height;
-	    new->priv->rotation = first_on->priv->rotation;
-	    new->priv->x = 0;
-	    new->priv->y = 0;
+	    new->width = first_on->width;
+	    new->height = first_on->height;
+	    new->rotation = first_on->rotation;
+	    new->x = 0;
+	    new->y = 0;
 	}
 
 	g_ptr_array_add (outputs, new);
@@ -972,7 +868,7 @@ make_outputs (GnomeRRConfig *config)
 
     g_ptr_array_add (outputs, NULL);
 
-    return (GnomeRROutputInfo **)g_ptr_array_free (outputs, FALSE);
+    return (GnomeOutputInfo **)g_ptr_array_free (outputs, FALSE);
 }
 
 gboolean
@@ -980,13 +876,11 @@ gnome_rr_config_applicable (GnomeRRConfig  *configuration,
 			    GnomeRRScreen  *screen,
 			    GError        **error)
 {
-    GnomeRROutputInfo **outputs;
+    GnomeOutputInfo **outputs;
     CrtcAssignment *assign;
     gboolean result;
-    int i;
 
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (configuration), FALSE);
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), FALSE);
+    g_return_val_if_fail (configuration != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
     outputs = make_outputs (configuration);
@@ -1002,9 +896,7 @@ gnome_rr_config_applicable (GnomeRRConfig  *configuration,
 	result = FALSE;
     }
 
-    for (i = 0; outputs[i] != NULL; i++) {
-	 g_object_unref (outputs[i]);
-    }
+    outputs_free (outputs);
 
     return result;
 }
@@ -1072,46 +964,46 @@ emit_configuration (GnomeRRConfig *config,
 
     g_string_append_printf (string, "  <configuration>\n");
 
-    g_string_append_printf (string, "      <clone>%s</clone>\n", yes_no (config->priv->clone));
+    g_string_append_printf (string, "      <clone>%s</clone>\n", yes_no (config->clone));
     
-    for (j = 0; config->priv->outputs[j] != NULL; ++j)
+    for (j = 0; config->outputs[j] != NULL; ++j)
     {
-	GnomeRROutputInfo *output = config->priv->outputs[j];
+	GnomeOutputInfo *output = config->outputs[j];
 	
 	g_string_append_printf (
-	    string, "      <output name=\"%s\">\n", output->priv->name);
+	    string, "      <output name=\"%s\">\n", output->name);
 	
-	if (output->priv->connected && *output->priv->vendor != '\0')
+	if (output->connected && *output->vendor != '\0')
 	{
 	    g_string_append_printf (
-		string, "          <vendor>%s</vendor>\n", output->priv->vendor);
+		string, "          <vendor>%s</vendor>\n", output->vendor);
 	    g_string_append_printf (
-		string, "          <product>0x%04x</product>\n", output->priv->product);
+		string, "          <product>0x%04x</product>\n", output->product);
 	    g_string_append_printf (
-		string, "          <serial>0x%08x</serial>\n", output->priv->serial);
+		string, "          <serial>0x%08x</serial>\n", output->serial);
 	}
 	
 	/* An unconnected output which is on does not make sense */
-	if (output->priv->connected && output->priv->on)
+	if (output->connected && output->on)
 	{
 	    g_string_append_printf (
-		string, "          <width>%d</width>\n", output->priv->width);
+		string, "          <width>%d</width>\n", output->width);
 	    g_string_append_printf (
-		string, "          <height>%d</height>\n", output->priv->height);
+		string, "          <height>%d</height>\n", output->height);
 	    g_string_append_printf (
-		string, "          <rate>%d</rate>\n", output->priv->rate);
+		string, "          <rate>%d</rate>\n", output->rate);
 	    g_string_append_printf (
-		string, "          <x>%d</x>\n", output->priv->x);
+		string, "          <x>%d</x>\n", output->x);
 	    g_string_append_printf (
-		string, "          <y>%d</y>\n", output->priv->y);
+		string, "          <y>%d</y>\n", output->y);
 	    g_string_append_printf (
-		string, "          <rotation>%s</rotation>\n", get_rotation_name (output->priv->rotation));
+		string, "          <rotation>%s</rotation>\n", get_rotation_name (output->rotation));
 	    g_string_append_printf (
-		string, "          <reflect_x>%s</reflect_x>\n", get_reflect_x (output->priv->rotation));
+		string, "          <reflect_x>%s</reflect_x>\n", get_reflect_x (output->rotation));
 	    g_string_append_printf (
-		string, "          <reflect_y>%s</reflect_y>\n", get_reflect_y (output->priv->rotation));
+		string, "          <reflect_y>%s</reflect_y>\n", get_reflect_y (output->rotation));
             g_string_append_printf (
-                string, "          <primary>%s</primary>\n", yes_no (output->priv->primary));
+                string, "          <primary>%s</primary>\n", yes_no (output->primary));
 	}
 	
 	g_string_append_printf (string, "      </output>\n");
@@ -1131,37 +1023,37 @@ gnome_rr_config_sanitize (GnomeRRConfig *config)
      * make sure the configuration starts at (0, 0)
      */
     x_offset = y_offset = G_MAXINT;
-    for (i = 0; config->priv->outputs[i]; ++i)
+    for (i = 0; config->outputs[i]; ++i)
     {
-	GnomeRROutputInfo *output = config->priv->outputs[i];
+	GnomeOutputInfo *output = config->outputs[i];
 
-	if (output->priv->on)
+	if (output->on)
 	{
-	    x_offset = MIN (x_offset, output->priv->x);
-	    y_offset = MIN (y_offset, output->priv->y);
+	    x_offset = MIN (x_offset, output->x);
+	    y_offset = MIN (y_offset, output->y);
 	}
     }
 
-    for (i = 0; config->priv->outputs[i]; ++i)
+    for (i = 0; config->outputs[i]; ++i)
     {
-	GnomeRROutputInfo *output = config->priv->outputs[i];
+	GnomeOutputInfo *output = config->outputs[i];
 	
-	if (output->priv->on)
+	if (output->on)
 	{
-	    output->priv->x -= x_offset;
-	    output->priv->y -= y_offset;
+	    output->x -= x_offset;
+	    output->y -= y_offset;
 	}
     }
 
     /* Only one primary, please */
     found = FALSE;
-    for (i = 0; config->priv->outputs[i]; ++i)
+    for (i = 0; config->outputs[i]; ++i)
     {
-        if (config->priv->outputs[i]->priv->primary)
+        if (config->outputs[i]->primary)
         {
             if (found)
             {
-                config->priv->outputs[i]->priv->primary = FALSE;
+                config->outputs[i]->primary = FALSE;
             }
             else
             {
@@ -1182,7 +1074,7 @@ gnome_rr_config_save (GnomeRRConfig *configuration, GError **error)
     gchar *backup_filename;
     gboolean result;
 
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (configuration), FALSE);
+    g_return_val_if_fail (configuration != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
     output = g_string_new ("");
@@ -1200,10 +1092,9 @@ gnome_rr_config_save (GnomeRRConfig *configuration, GError **error)
 	{
 	    if (!gnome_rr_config_match (configurations[i], configuration))
 		emit_configuration (configurations[i], output);
-	    g_object_unref (configurations[i]);
 	}
 
-	g_free (configurations);
+	configurations_free (configurations);
     }
 
     emit_configuration (configuration, output);
@@ -1224,6 +1115,89 @@ gnome_rr_config_save (GnomeRRConfig *configuration, GError **error)
     return result;
 }
 
+static GnomeRRConfig *
+gnome_rr_config_copy (const GnomeRRConfig *config)
+{
+    GnomeRRConfig *copy = g_new0 (GnomeRRConfig, 1);
+    int i;
+    GPtrArray *array = g_ptr_array_new ();
+
+    copy->clone = config->clone;
+    
+    for (i = 0; config->outputs[i] != NULL; ++i)
+	g_ptr_array_add (array, output_copy (config->outputs[i]));
+
+    g_ptr_array_add (array, NULL);
+    copy->outputs = (GnomeOutputInfo **)g_ptr_array_free (array, FALSE);
+
+    return copy;
+}
+
+static GnomeRRConfig *
+config_new_stored (GnomeRRScreen *screen, const char *filename, GError **error)
+{
+    GnomeRRConfig *current;
+    GnomeRRConfig **configs;
+    GnomeRRConfig *result;
+
+    g_return_val_if_fail (screen != NULL, NULL);
+    g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+    
+    current = gnome_rr_config_new_current (screen);
+    
+    configs = configurations_read_from_file (filename, error);
+
+    result = NULL;
+    if (configs)
+    {
+	int i;
+	
+	for (i = 0; configs[i] != NULL; ++i)
+	{
+	    if (gnome_rr_config_match (configs[i], current))
+	    {
+		result = gnome_rr_config_copy (configs[i]);
+		break;
+	    }
+	}
+
+	if (result == NULL)
+	    g_set_error (error, GNOME_RR_ERROR, GNOME_RR_ERROR_NO_MATCHING_CONFIG,
+			 _("none of the saved display configurations matched the active configuration"));
+
+	configurations_free (configs);
+    }
+
+    gnome_rr_config_free (current);
+    
+    return result;
+}
+
+GnomeRRConfig *
+gnome_rr_config_new_stored (GnomeRRScreen *screen, GError **error)
+{
+    char *intended_filename;
+    GnomeRRConfig *config;
+
+    intended_filename = gnome_rr_config_get_intended_filename ();
+
+    config = config_new_stored (screen, intended_filename, error);
+
+    g_free (intended_filename);
+
+    return config;
+}
+
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
+gboolean
+gnome_rr_config_apply (GnomeRRConfig *config,
+		       GnomeRRScreen *screen,
+		       GError       **error)
+{
+    return gnome_rr_config_apply_with_time (config, screen, GDK_CURRENT_TIME, error);
+}
+#endif
+
 gboolean
 gnome_rr_config_apply_with_time (GnomeRRConfig *config,
 				 GnomeRRScreen *screen,
@@ -1231,20 +1205,14 @@ gnome_rr_config_apply_with_time (GnomeRRConfig *config,
 				 GError       **error)
 {
     CrtcAssignment *assignment;
-    GnomeRROutputInfo **outputs;
+    GnomeOutputInfo **outputs;
     gboolean result = FALSE;
-    int i;
-
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (config), FALSE);
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), FALSE);
 
     outputs = make_outputs (config);
 
     assignment = crtc_assignment_new (screen, outputs, error);
 
-    for (i = 0; outputs[i] != NULL; i++)
-	g_object_unref (outputs[i]);
-    g_free (outputs);
+    outputs_free (outputs);
     
     if (assignment)
     {
@@ -1259,6 +1227,74 @@ gnome_rr_config_apply_with_time (GnomeRRConfig *config,
     return result;
 }
 
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
+/**
+ * gnome_rr_config_apply_stored:
+ * @screen: A #GnomeRRScreen
+ * @error: Location to store error, or %NULL
+ *
+ * See the documentation for gnome_rr_config_apply_from_filename().  This
+ * function simply calls that other function with a filename of
+ * gnome_rr_config_get_intended_filename().
+ *
+ * Deprecated: 2.26: Use gnome_rr_config_apply_from_filename() instead and pass it
+ * the filename from gnome_rr_config_get_intended_filename().
+ */
+gboolean
+gnome_rr_config_apply_stored (GnomeRRScreen *screen, GError **error)
+{
+    char *filename;
+    gboolean result;
+
+    filename = gnome_rr_config_get_intended_filename ();
+    result = gnome_rr_config_apply_from_filename_with_time (screen, filename, GDK_CURRENT_TIME, error);
+    g_free (filename);
+
+    return result;
+}
+#endif
+
+#ifndef GNOME_DISABLE_DEPRECATED_SOURCE
+/* gnome_rr_config_apply_from_filename:
+ * @screen: A #GnomeRRScreen
+ * @filename: Path of the file to look in for stored RANDR configurations.
+ * @error: Location to store error, or %NULL
+ *
+ * First, this function refreshes the @screen to match the current RANDR
+ * configuration from the X server.  Then, it tries to load the file in
+ * @filename and looks for suitable matching RANDR configurations in the file;
+ * if one is found, that configuration will be applied to the current set of
+ * RANDR outputs.
+ *
+ * Typically, @filename is the result of gnome_rr_config_get_intended_filename() or
+ * gnome_rr_config_get_backup_filename().
+ *
+ * Returns: TRUE if the RANDR configuration was loaded and applied from
+ * $(XDG_CONFIG_HOME)/monitors.xml, or FALSE otherwise:
+ *
+ * If the current RANDR configuration could not be refreshed, the @error will
+ * have a domain of #GNOME_RR_ERROR and a corresponding error code.
+ *
+ * If the file in question is loaded successfully but the configuration cannot
+ * be applied, the @error will have a domain of #GNOME_RR_ERROR.  Note that an
+ * error code of #GNOME_RR_ERROR_NO_MATCHING_CONFIG is not a real error; it
+ * simply means that there were no stored configurations that match the current
+ * set of RANDR outputs.
+ *
+ * If the file in question cannot be loaded, the @error will have a domain of
+ * #G_FILE_ERROR.  Note that an error code of G_FILE_ERROR_NOENT is not really
+ * an error, either; it means that there was no stored configuration file and so
+ * nothing is changed.
+ *
+ * @Deprecated: 2.28: use gnome_rr_config_apply_from_filename_with_time() instead.
+ */
+gboolean
+gnome_rr_config_apply_from_filename (GnomeRRScreen *screen, const char *filename, GError **error)
+{
+    return gnome_rr_config_apply_from_filename_with_time (screen, filename, GDK_CURRENT_TIME, error);
+}
+#endif
+
 /* gnome_rr_config_apply_from_filename_with_time:
  * @screen: A #GnomeRRScreen
  * @filename: Path of the file to look in for stored RANDR configurations.
@@ -1297,7 +1333,7 @@ gnome_rr_config_apply_from_filename_with_time (GnomeRRScreen *screen, const char
     GnomeRRConfig *stored;
     GError *my_error;
 
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), FALSE);
+    g_return_val_if_fail (screen != NULL, FALSE);
     g_return_val_if_fail (filename != NULL, FALSE);
     g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
@@ -1311,60 +1347,24 @@ gnome_rr_config_apply_from_filename_with_time (GnomeRRScreen *screen, const char
 	    /* This means the screen didn't change, so just proceed */
     }
 
-    stored = g_object_new (GNOME_TYPE_RR_CONFIG, "screen", screen, "current", FALSE, NULL);
+    stored = config_new_stored (screen, filename, error);
 
-    if (config_init_stored (stored, filename, error))
+    if (stored)
     {
 	gboolean result;
 
 	result = gnome_rr_config_apply_with_time (stored, screen, timestamp, error);
 
-	g_object_unref (stored);
+	gnome_rr_config_free (stored);
+	
 	return result;
     }
     else
     {
-	g_object_unref (stored);
 	return FALSE;
     }
 }
 
-/**
- * gnome_rr_config_get_outputs:
- *
- * Returns: (array zero-terminated=1) (element-type GnomeDesktop.RROutputInfo) (transfer none): the output configuration for this #GnomeRRConfig
- */
-GnomeRROutputInfo **
-gnome_rr_config_get_outputs (GnomeRRConfig *self)
-{
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (self), NULL);
-
-    return self->priv->outputs;
-}
-
-/**
- * gnome_rr_config_get_clone:
- *
- * Returns: whether at least two outputs are at (0, 0) offset and they
- * have the same width/height.  Those outputs are of course connected and on
- * (i.e. they have a CRTC assigned).
- */
-gboolean
-gnome_rr_config_get_clone (GnomeRRConfig *self)
-{
-    g_return_val_if_fail (GNOME_IS_RR_CONFIG (self), FALSE);
-
-    return self->priv->clone;
-}
-
-void
-gnome_rr_config_set_clone (GnomeRRConfig *self, gboolean clone)
-{
-    g_return_if_fail (GNOME_IS_RR_CONFIG (self));
-
-    self->priv->clone = clone;
-}
-
 /*
  * CRTC assignment
  */
@@ -1607,12 +1607,12 @@ accumulate_error (GString *accumulated_error, GError *error)
  */
 static gboolean
 real_assign_crtcs (GnomeRRScreen *screen,
-		   GnomeRROutputInfo **outputs,
+		   GnomeOutputInfo **outputs,
 		   CrtcAssignment *assignment,
 		   GError **error)
 {
     GnomeRRCrtc **crtcs = gnome_rr_screen_list_crtcs (screen);
-    GnomeRROutputInfo *output;
+    GnomeOutputInfo *output;
     int i;
     gboolean tried_mode;
     GError *my_error;
@@ -1624,7 +1624,7 @@ real_assign_crtcs (GnomeRRScreen *screen,
 	return TRUE;
 
     /* It is always allowed for an output to be turned off */
-    if (!output->priv->on)
+    if (!output->on)
     {
 	return real_assign_crtcs (screen, outputs + 1, assignment, error);
     }
@@ -1648,7 +1648,7 @@ real_assign_crtcs (GnomeRRScreen *screen,
 	 */
 	for (pass = 0; pass < 2; ++pass)
 	{
-	    GnomeRROutput *gnome_rr_output = gnome_rr_screen_get_output_by_name (screen, output->priv->name);
+	    GnomeRROutput *gnome_rr_output = gnome_rr_screen_get_output_by_name (screen, output->name);
 	    GnomeRRMode **modes = gnome_rr_output_list_modes (gnome_rr_output);
 	    int j;
 
@@ -1667,21 +1667,21 @@ real_assign_crtcs (GnomeRRScreen *screen,
 					_("CRTC %d: trying mode %dx%d %dHz with output at %dx%d %dHz (pass %d)\n"),
 					crtc_id,
 					mode_width, mode_height, mode_freq,
-					output->priv->width, output->priv->height, output->priv->rate,
+					output->width, output->height, output->rate,
 					pass);
 
-		if (mode_width == output->priv->width	&&
-		    mode_height == output->priv->height &&
-		    (pass == 1 || mode_freq == output->priv->rate))
+		if (mode_width == output->width	&&
+		    mode_height == output->height &&
+		    (pass == 1 || mode_freq == output->rate))
 		{
 		    tried_mode = TRUE;
 
 		    my_error = NULL;
 		    if (crtc_assignment_assign (
 			    assignment, crtc, modes[j],
-			    output->priv->x, output->priv->y,
-			    output->priv->rotation,
-                            output->priv->primary,
+			    output->x, output->y,
+			    output->rotation,
+                            output->primary,
 			    gnome_rr_output,
 			    &my_error))
 		    {
@@ -1769,7 +1769,7 @@ get_required_virtual_size (CrtcAssignment *assign, int *width, int *height)
 }
 
 static CrtcAssignment *
-crtc_assignment_new (GnomeRRScreen *screen, GnomeRROutputInfo **outputs, GError **error)
+crtc_assignment_new (GnomeRRScreen *screen, GnomeOutputInfo **outputs, GError **error)
 {
     CrtcAssignment *assignment = g_new0 (CrtcAssignment, 1);
 
diff --git a/libgnome-desktop/gnome-rr-config.h b/libgnome-desktop/gnome-rr-config.h
index de060ed..cdd537e 100644
--- a/libgnome-desktop/gnome-rr-config.h
+++ b/libgnome-desktop/gnome-rr-config.h
@@ -1,8 +1,6 @@
 /* gnome-rr-config.h
- * -*- c-basic-offset: 4 -*-
  *
  * Copyright 2007, 2008, Red Hat, Inc.
- * Copyright 2010 Giovanni Campagna
  * 
  * This file is part of the Gnome Library.
  * 
@@ -31,114 +29,108 @@
 #endif
 
 #include <glib.h>
-#include <glib-object.h>
 #include <libgnome-desktop/gnome-rr.h>
 
-typedef struct GnomeRROutputInfoPrivate GnomeRROutputInfoPrivate;
-typedef struct GnomeRRConfigPrivate GnomeRRConfigPrivate;
+typedef struct GnomeOutputInfo GnomeOutputInfo;
+typedef struct GnomeRRConfig GnomeRRConfig;
 
-typedef struct
-{
-    GObject parent;
-
-    /*< private >*/
-    GnomeRROutputInfoPrivate *priv;
-} GnomeRROutputInfo;
+/* FIXME:
+ *
+ * This structure is a Frankenstein monster where all of the fields
+ * are generated by the system, but some of them can be changed by
+ * the client.
+ */
 
-typedef struct
+struct GnomeOutputInfo
 {
-    GObjectClass parent_class;
-} GnomeRROutputInfoClass;
-
-#define GNOME_TYPE_RR_OUTPUT_INFO                  (gnome_rr_output_info_get_type())
-#define GNOME_RR_OUTPUT_INFO(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RR_OUTPUT_INFO, GnomeRROutputInfo))
-#define GNOME_IS_RR_OUTPUT_INFO(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_RR_OUTPUT_INFO))
-#define GNOME_RR_OUTPUT_INFO_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_RR_OUTPUT_INFO, GnomeRROutputInfoClass))
-#define GNOME_IS_RR_OUTPUT_INFO_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_RR_OUTPUT_INFO))
-#define GNOME_RR_OUTPUT_INFO_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_RR_OUTPUT_INFO, GnomeRROutputInfoClass))
-
+    char *		name;
+
+    gboolean		on; /* whether there is a CRTC assigned to this output (i.e. a signal is being sent to it) */
+    int			width;
+    int			height;
+    int			rate;
+    int			x;
+    int			y;
+    GnomeRRRotation	rotation;
+
+    gboolean		connected; /* whether the output is physically connected to a monitor */
+    char		vendor[4];
+    guint		product;
+    guint		serial;
+    double		aspect;
+    int			pref_width;
+    int			pref_height;
+    char *		display_name;
+    gboolean            primary;
+
+    gpointer		user_data;
+};
+
+#define GNOME_RR_TYPE_OUTPUT_INFO    (gnome_rr_output_info_get_type())
+#define GNOME_RR_TYPE_CONFIG         (gnome_rr_config_get_type())
 GType gnome_rr_output_info_get_type (void);
+GType gnome_rr_config_get_type (void);
 
-char *gnome_rr_output_info_get_name (GnomeRROutputInfo *self);
-
-gboolean gnome_rr_output_info_get_active (GnomeRROutputInfo *self);
-void     gnome_rr_output_info_set_active (GnomeRROutputInfo *self, gboolean active);
-
-void gnome_rr_output_info_get_geometry (GnomeRROutputInfo *self, int *x, int *y, int *width, int *height);
-void gnome_rr_output_info_set_geometry (GnomeRROutputInfo *self, int  x, int  y, int  width, int  height);
-
-int  gnome_rr_output_info_get_refresh_rate (GnomeRROutputInfo *self);
-void gnome_rr_output_info_set_refresh_rate (GnomeRROutputInfo *self, int rate);
-
-GnomeRRRotation gnome_rr_output_info_get_rotation (GnomeRROutputInfo *self);
-void            gnome_rr_output_info_set_rotation (GnomeRROutputInfo *self, GnomeRRRotation rotation);
-
-gboolean gnome_rr_output_info_get_connected    (GnomeRROutputInfo *self);
-void     gnome_rr_output_info_get_vendor       (GnomeRROutputInfo *self, gchar* vendor);
-guint    gnome_rr_output_info_get_product      (GnomeRROutputInfo *self);
-guint    gnome_rr_output_info_get_serial       (GnomeRROutputInfo *self);
-double   gnome_rr_output_info_get_aspect_ratio (GnomeRROutputInfo *self);
-char    *gnome_rr_output_info_get_display_name (GnomeRROutputInfo *self);
-
-gboolean gnome_rr_output_info_get_primary (GnomeRROutputInfo *self);
-void     gnome_rr_output_info_set_primary (GnomeRROutputInfo *self, gboolean primary);
-
-int gnome_rr_output_info_get_preferred_width  (GnomeRROutputInfo *self);
-int gnome_rr_output_info_get_preferred_height (GnomeRROutputInfo *self);
-
-typedef struct
+struct GnomeRRConfig
 {
-    GObject parent;
+    /* "clone" means that at least two outputs are at (0, 0) offset and they
+     * have the same width/height.  Those outputs are of course connected and on
+     * (i.e. they have a CRTC assigned).
+     */
+    gboolean		clone;
+    
+    GnomeOutputInfo **	outputs;
+};
+
+GnomeRRConfig  *gnome_rr_config_new_current  (GnomeRRScreen  *screen);
+GnomeRRConfig  *gnome_rr_config_new_stored   (GnomeRRScreen  *screen,
+					      GError        **error);
+void            gnome_rr_config_free         (GnomeRRConfig  *configuration);
+gboolean        gnome_rr_config_match        (GnomeRRConfig  *config1,
+					      GnomeRRConfig  *config2);
+gboolean        gnome_rr_config_equal	     (GnomeRRConfig  *config1,
+					      GnomeRRConfig  *config2);
+gboolean        gnome_rr_config_save         (GnomeRRConfig  *configuration,
+					      GError        **error);
+void            gnome_rr_config_sanitize     (GnomeRRConfig  *configuration);
+
+#ifndef GNOME_DISABLE_DEPRECATED
+gboolean	gnome_rr_config_apply        (GnomeRRConfig  *configuration,
+					      GnomeRRScreen  *screen,
+					      GError        **error);
+#endif
 
-    /*< private >*/
-    GnomeRRConfigPrivate *priv;
-} GnomeRRConfig;
+gboolean	gnome_rr_config_apply_with_time (GnomeRRConfig  *configuration,
+						 GnomeRRScreen  *screen,
+						 guint32         timestamp,
+						 GError        **error);
 
-typedef struct
-{
-    GObjectClass parent_class;
-} GnomeRRConfigClass;
-
-#define GNOME_TYPE_RR_CONFIG                  (gnome_rr_config_get_type())
-#define GNOME_RR_CONFIG(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RR_CONFIG, GnomeRRConfig))
-#define GNOME_IS_RR_CONFIG(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_RR_CONFIG))
-#define GNOME_RR_CONFIG_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_RR_CONFIG, GnomeRRConfigClass))
-#define GNOME_IS_RR_CONFIG_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_RR_CONFIG))
-#define GNOME_RR_CONFIG_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_RR_CONFIG, GnomeRRConfigClass))
-
-GType               gnome_rr_config_get_type     (void);
-
-GnomeRRConfig      *gnome_rr_config_new_current  (GnomeRRScreen  *screen,
-						  GError        **error);
-GnomeRRConfig      *gnome_rr_config_new_stored   (GnomeRRScreen  *screen,
-						  GError        **error);
-gboolean            gnome_rr_config_match        (GnomeRRConfig  *config1,
-						  GnomeRRConfig  *config2);
-gboolean            gnome_rr_config_equal	 (GnomeRRConfig  *config1,
-						  GnomeRRConfig  *config2);
-gboolean            gnome_rr_config_save         (GnomeRRConfig  *configuration,
-						  GError        **error);
-void                gnome_rr_config_sanitize     (GnomeRRConfig  *configuration);
-
-gboolean	    gnome_rr_config_apply_with_time (GnomeRRConfig  *configuration,
-						     GnomeRRScreen  *screen,
-						     guint32         timestamp,
-						     GError        **error);
+#ifndef GNOME_DISABLE_DEPRECATED
+gboolean        gnome_rr_config_apply_stored (GnomeRRScreen  *screen,
+					      GError        **error);
+#endif
 
-gboolean            gnome_rr_config_apply_from_filename_with_time (GnomeRRScreen  *screen,
-								   const char     *filename,
-								   guint32         timestamp,
-								   GError        **error);
+#ifndef GNOME_DISABLE_DEPRECATED
+gboolean        gnome_rr_config_apply_from_filename (GnomeRRScreen  *screen,
+						     const char     *filename,
+						     GError        **error);
+#endif
 
-gboolean            gnome_rr_config_applicable   (GnomeRRConfig  *configuration,
-						  GnomeRRScreen  *screen,
-						  GError        **error);
+gboolean        gnome_rr_config_apply_from_filename_with_time (GnomeRRScreen  *screen,
+							       const char     *filename,
+							       guint32         timestamp,
+							       GError        **error);
 
-gboolean            gnome_rr_config_get_clone    (GnomeRRConfig  *configuration);
-void                gnome_rr_config_set_clone    (GnomeRRConfig  *configuration, gboolean clone);
-GnomeRROutputInfo **gnome_rr_config_get_outputs  (GnomeRRConfig  *configuration);
+gboolean        gnome_rr_config_applicable   (GnomeRRConfig  *configuration,
+					      GnomeRRScreen  *screen,
+					      GError        **error);
 
 char *gnome_rr_config_get_backup_filename (void);
 char *gnome_rr_config_get_intended_filename (void);
 
+/* A utility function that isn't really in the spirit of this file, but I don't
+ * don't know a better place for it.
+ */
+GnomeRRMode **gnome_rr_create_clone_modes (GnomeRRScreen *screen);
+
 #endif
diff --git a/libgnome-desktop/gnome-rr-labeler.c b/libgnome-desktop/gnome-rr-labeler.c
index 87dc43b..1de4569 100644
--- a/libgnome-desktop/gnome-rr-labeler.c
+++ b/libgnome-desktop/gnome-rr-labeler.c
@@ -29,6 +29,7 @@
 
 #include <config.h>
 #include <glib/gi18n-lib.h>
+#include "gnome-rr-labeler.h"
 #include <gtk/gtk.h>
 
 #include <X11/Xproto.h>
@@ -37,9 +38,9 @@
 #include <X11/Xatom.h>
 #include <gdk/gdkx.h>
 
-#include "gnome-rr-labeler.h"
+struct _GnomeRRLabeler {
+	GObject parent;
 
-struct _GnomeRRLabelerPrivate {
 	GnomeRRConfig *config;
 
 	int num_outputs;
@@ -51,17 +52,14 @@ struct _GnomeRRLabelerPrivate {
 	Atom        workarea_atom;
 };
 
-enum {
-	PROP_0,
-	PROP_CONFIG,
-	PROP_LAST
+struct _GnomeRRLabelerClass {
+	GObjectClass parent_class;
 };
 
 G_DEFINE_TYPE (GnomeRRLabeler, gnome_rr_labeler, G_TYPE_OBJECT);
 
 static void gnome_rr_labeler_finalize (GObject *object);
 static void create_label_windows (GnomeRRLabeler *labeler);
-static void setup_from_config (GnomeRRLabeler *labeler);
 
 static gboolean
 get_work_area (GnomeRRLabeler *labeler,
@@ -80,16 +78,16 @@ get_work_area (GnomeRRLabeler *labeler,
 	int             disp_screen;
 	Display        *display;
 
-	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (labeler->priv->screen));
+	display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (labeler->screen));
 	workarea = XInternAtom (display, "_NET_WORKAREA", True);
 
-	disp_screen = GDK_SCREEN_XNUMBER (labeler->priv->screen);
+	disp_screen = GDK_SCREEN_XNUMBER (labeler->screen);
 
 	/* Defaults in case of error */
 	rect->x = 0;
 	rect->y = 0;
-	rect->width = gdk_screen_get_width (labeler->priv->screen);
-	rect->height = gdk_screen_get_height (labeler->priv->screen);
+	rect->width = gdk_screen_get_width (labeler->screen);
+	rect->height = gdk_screen_get_height (labeler->screen);
 
 	if (workarea == None)
 		return FALSE;
@@ -137,7 +135,7 @@ screen_xevent_filter (GdkXEvent      *xevent,
 	xev = (XEvent *) xevent;
 
 	if (xev->type == PropertyNotify &&
-	    xev->xproperty.atom == labeler->priv->workarea_atom) {
+	    xev->xproperty.atom == labeler->workarea_atom) {
 		/* update label positions */
 		gnome_rr_labeler_hide (labeler);
 		create_label_windows (labeler);
@@ -151,62 +149,25 @@ gnome_rr_labeler_init (GnomeRRLabeler *labeler)
 {
 	GdkWindow *gdkwindow;
 
-	labeler->priv = G_TYPE_INSTANCE_GET_PRIVATE (labeler, GNOME_TYPE_RR_LABELER, GnomeRRLabelerPrivate);
-
-	labeler->priv->workarea_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
-						    "_NET_WORKAREA",
-						    True);
+	labeler->workarea_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+					      "_NET_WORKAREA",
+					      True);
 
-	labeler->priv->screen = gdk_screen_get_default ();
+	labeler->screen = gdk_screen_get_default ();
 	/* code is not really designed to handle multiple screens so *shrug* */
-	gdkwindow = gdk_screen_get_root_window (labeler->priv->screen);
+	gdkwindow = gdk_screen_get_root_window (labeler->screen);
 	gdk_window_add_filter (gdkwindow, (GdkFilterFunc) screen_xevent_filter, labeler);
 	gdk_window_set_events (gdkwindow, gdk_window_get_events (gdkwindow) | GDK_PROPERTY_CHANGE_MASK);
 }
 
 static void
-gnome_rr_labeler_set_property (GObject *gobject, guint property_id, const GValue *value, GParamSpec *param_spec)
-{
-	GnomeRRLabeler *self = GNOME_RR_LABELER (gobject);
-
-	switch (property_id) {
-	case PROP_CONFIG:
-		self->priv->config = GNOME_RR_CONFIG (g_value_get_object (value));
-		return;
-	default:
-		G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, param_spec);
-	}
-}
-
-static GObject *
-gnome_rr_labeler_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties)
-{
-	GnomeRRLabeler *self = (GnomeRRLabeler*) G_OBJECT_CLASS (gnome_rr_labeler_parent_class)->constructor (type, n_construct_properties, construct_properties);
-
-	setup_from_config (self);
-
-	return (GObject*) self;
-}
-
-static void
-gnome_rr_labeler_class_init (GnomeRRLabelerClass *klass)
+gnome_rr_labeler_class_init (GnomeRRLabelerClass *class)
 {
 	GObjectClass *object_class;
 
-	g_type_class_add_private (klass, sizeof (GnomeRRLabelerPrivate));
-
-	object_class = (GObjectClass *) klass;
+	object_class = (GObjectClass *) class;
 
-	object_class->set_property = gnome_rr_labeler_set_property;
 	object_class->finalize = gnome_rr_labeler_finalize;
-	object_class->constructor = gnome_rr_labeler_constructor;
-
-	g_object_class_install_property (object_class, PROP_CONFIG, g_param_spec_object ("config",
-											 "Configuration",
-											 "RandR configuration to label",
-											 GNOME_TYPE_RR_CONFIG,
-											 G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
-											 G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
 }
 
 static void
@@ -217,19 +178,21 @@ gnome_rr_labeler_finalize (GObject *object)
 
 	labeler = GNOME_RR_LABELER (object);
 
-	gdkwindow = gdk_screen_get_root_window (labeler->priv->screen);
+	gdkwindow = gdk_screen_get_root_window (labeler->screen);
 	gdk_window_remove_filter (gdkwindow, (GdkFilterFunc) screen_xevent_filter, labeler);
 
-	if (labeler->priv->config != NULL) {
-		g_object_unref (labeler->priv->config);
-	}
+	/* We don't destroy the labeler->config (a GnomeRRConfig*) here; let our
+	 * caller do that instead.
+	 */
 
-	if (labeler->priv->windows != NULL) {
+	if (labeler->windows != NULL) {
 		gnome_rr_labeler_hide (labeler);
-		g_free (labeler->priv->windows);
+		g_free (labeler->windows);
+		labeler->windows = NULL;
 	}
 
-	g_free (labeler->priv->palette);
+	g_free (labeler->palette);
+	labeler->palette = NULL;
 
 	G_OBJECT_CLASS (gnome_rr_labeler_parent_class)->finalize (object);
 }
@@ -238,9 +201,8 @@ static int
 count_outputs (GnomeRRConfig *config)
 {
 	int i;
-	GnomeRROutputInfo **outputs = gnome_rr_config_get_outputs (config);
 
-	for (i = 0; outputs[i] != NULL; i++)
+	for (i = 0; config->outputs[i] != NULL; i++)
 		;
 
 	return i;
@@ -261,26 +223,26 @@ make_palette (GnomeRRLabeler *labeler)
 	double end_hue;
 	int i;
 
-	g_assert (labeler->priv->num_outputs > 0);
+	g_assert (labeler->num_outputs > 0);
 
-	labeler->priv->palette = g_new (GdkColor, labeler->priv->num_outputs);
+	labeler->palette = g_new (GdkColor, labeler->num_outputs);
 
 	start_hue = 0.0; /* red */
 	end_hue   = 2.0/3; /* blue */
 
-	for (i = 0; i < labeler->priv->num_outputs; i++) {
+	for (i = 0; i < labeler->num_outputs; i++) {
 		double h, s, v;
 		double r, g, b;
 
-		h = start_hue + (end_hue - start_hue) / labeler->priv->num_outputs * i;
+		h = start_hue + (end_hue - start_hue) / labeler->num_outputs * i;
 		s = 1.0 / 3;
 		v = 1.0;
 
 		gtk_hsv_to_rgb (h, s, v, &r, &g, &b);
 
-		labeler->priv->palette[i].red   = (int) (65535 * r + 0.5);
-		labeler->priv->palette[i].green = (int) (65535 * g + 0.5);
-		labeler->priv->palette[i].blue  = (int) (65535 * b + 0.5);
+		labeler->palette[i].red   = (int) (65535 * r + 0.5);
+		labeler->palette[i].green = (int) (65535 * g + 0.5);
+		labeler->palette[i].blue  = (int) (65535 * b + 0.5);
 	}
 }
 
@@ -331,8 +293,8 @@ position_window (GnomeRRLabeler  *labeler,
 	int             monitor_num;
 
 	get_work_area (labeler, &workarea);
-	monitor_num = gdk_screen_get_monitor_at_point (labeler->priv->screen, x, y);
-	gdk_screen_get_monitor_geometry (labeler->priv->screen,
+	monitor_num = gdk_screen_get_monitor_at_point (labeler->screen, x, y);
+	gdk_screen_get_monitor_geometry (labeler->screen,
                                          monitor_num,
                                          &monitor);
 	gdk_rectangle_intersect (&monitor, &workarea, &workarea);
@@ -341,14 +303,13 @@ position_window (GnomeRRLabeler  *labeler,
 }
 
 static GtkWidget *
-create_label_window (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColor *color)
+create_label_window (GnomeRRLabeler *labeler, GnomeOutputInfo *output, GdkColor *color)
 {
 	GtkWidget *window;
 	GtkWidget *widget;
 	char *str;
 	const char *display_name;
 	GdkColor black = { 0, 0, 0, 0 };
-	int x,y;
 
 	window = gtk_window_new (GTK_WINDOW_POPUP);
 	gtk_widget_set_app_paintable (window, TRUE);
@@ -364,7 +325,7 @@ create_label_window (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColo
 	g_signal_connect (window, "draw",
 			  G_CALLBACK (label_window_draw_event_cb), labeler);
 
-	if (gnome_rr_config_get_clone (labeler->priv->config)) {
+	if (labeler->config->clone) {
 		/* Keep this string in sync with gnome-control-center/capplets/display/xrandr-capplet.c:get_display_name() */
 
 		/* Translators:  this is the feature where what you see on your laptop's
@@ -374,7 +335,7 @@ create_label_window (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColo
 		 */
 		display_name = _("Mirror Screens");
 	} else
-		display_name = gnome_rr_output_info_get_display_name (output);
+		display_name = output->display_name;
 
 	str = g_strdup_printf ("<b>%s</b>", display_name);
 	widget = gtk_label_new (NULL);
@@ -390,8 +351,7 @@ create_label_window (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColo
 	gtk_container_add (GTK_CONTAINER (window), widget);
 
 	/* Should we center this at the top edge of the monitor, instead of using the upper-left corner? */
-	gnome_rr_output_info_get_geometry (output, &x, &y, NULL, NULL);
-	position_window (labeler, window, x, y);
+	position_window (labeler, window, output->x, output->y);
 
 	gtk_widget_show_all (window);
 
@@ -403,29 +363,26 @@ create_label_windows (GnomeRRLabeler *labeler)
 {
 	int i;
 	gboolean created_window_for_clone;
-	GnomeRROutputInfo **outputs;
 
-	labeler->priv->windows = g_new (GtkWidget *, labeler->priv->num_outputs);
+	labeler->windows = g_new (GtkWidget *, labeler->num_outputs);
 
 	created_window_for_clone = FALSE;
 
-	outputs = gnome_rr_config_get_outputs (labeler->priv->config);
-
-	for (i = 0; i < labeler->priv->num_outputs; i++) {
-		if (!created_window_for_clone && gnome_rr_output_info_get_active (outputs[i])) {
-			labeler->priv->windows[i] = create_label_window (labeler, outputs[i], labeler->priv->palette + i);
+	for (i = 0; i < labeler->num_outputs; i++) {
+		if (!created_window_for_clone && labeler->config->outputs[i]->on) {
+			labeler->windows[i] = create_label_window (labeler, labeler->config->outputs[i], labeler->palette + i);
 
-			if (gnome_rr_config_get_clone (labeler->priv->config))
+			if (labeler->config->clone)
 				created_window_for_clone = TRUE;
 		} else
-			labeler->priv->windows[i] = NULL;
+			labeler->windows[i] = NULL;
 	}
 }
 
 static void
 setup_from_config (GnomeRRLabeler *labeler)
 {
-	labeler->priv->num_outputs = count_outputs (labeler->priv->config);
+	labeler->num_outputs = count_outputs (labeler->config);
 
 	make_palette (labeler);
 
@@ -435,9 +392,16 @@ setup_from_config (GnomeRRLabeler *labeler)
 GnomeRRLabeler *
 gnome_rr_labeler_new (GnomeRRConfig *config)
 {
-	g_return_val_if_fail (GNOME_IS_RR_CONFIG (config), NULL);
+	GnomeRRLabeler *labeler;
+
+	g_return_val_if_fail (config != NULL, NULL);
+
+	labeler = g_object_new (GNOME_TYPE_RR_LABELER, NULL);
+	labeler->config = config;
 
-	return g_object_new (GNOME_TYPE_RR_LABELER, "config", config, NULL);
+	setup_from_config (labeler);
+
+	return labeler;
 }
 
 void
@@ -447,28 +411,25 @@ gnome_rr_labeler_hide (GnomeRRLabeler *labeler)
 
 	g_return_if_fail (GNOME_IS_RR_LABELER (labeler));
 
-	for (i = 0; i < labeler->priv->num_outputs; i++)
-		if (labeler->priv->windows[i] != NULL) {
-			gtk_widget_destroy (labeler->priv->windows[i]);
-			labeler->priv->windows[i] = NULL;
+	for (i = 0; i < labeler->num_outputs; i++)
+		if (labeler->windows[i] != NULL) {
+			gtk_widget_destroy (labeler->windows[i]);
+			labeler->windows[i] = NULL;
 		}
 }
 
 void
-gnome_rr_labeler_get_color_for_output (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColor *color_out)
+gnome_rr_labeler_get_color_for_output (GnomeRRLabeler *labeler, GnomeOutputInfo *output, GdkColor *color_out)
 {
 	int i;
-	GnomeRROutputInfo **outputs;
 
 	g_return_if_fail (GNOME_IS_RR_LABELER (labeler));
-	g_return_if_fail (GNOME_IS_RR_OUTPUT_INFO (output));
+	g_return_if_fail (output != NULL);
 	g_return_if_fail (color_out != NULL);
 
-	outputs = gnome_rr_config_get_outputs (labeler->priv->config);
-
-	for (i = 0; i < labeler->priv->num_outputs; i++)
-		if (outputs[i] == output) {
-			*color_out = labeler->priv->palette[i];
+	for (i = 0; i < labeler->num_outputs; i++)
+		if (labeler->config->outputs[i] == output) {
+			*color_out = labeler->palette[i];
 			return;
 		}
 
diff --git a/libgnome-desktop/gnome-rr-labeler.h b/libgnome-desktop/gnome-rr-labeler.h
index 155731c..b62e38b 100644
--- a/libgnome-desktop/gnome-rr-labeler.h
+++ b/libgnome-desktop/gnome-rr-labeler.h
@@ -41,18 +41,6 @@
 
 typedef struct _GnomeRRLabeler GnomeRRLabeler;
 typedef struct _GnomeRRLabelerClass GnomeRRLabelerClass;
-typedef struct _GnomeRRLabelerPrivate GnomeRRLabelerPrivate;
-
-struct _GnomeRRLabeler {
-	GObject parent;
-
-	/*< private >*/
-	GnomeRRLabelerPrivate *priv;
-};
-
-struct _GnomeRRLabelerClass {
-	GObjectClass parent_class;
-};
 
 GType gnome_rr_labeler_get_type (void);
 
@@ -60,6 +48,6 @@ GnomeRRLabeler *gnome_rr_labeler_new (GnomeRRConfig *config);
 
 void gnome_rr_labeler_hide (GnomeRRLabeler *labeler);
 
-void gnome_rr_labeler_get_color_for_output (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColor *color_out);
+void gnome_rr_labeler_get_color_for_output (GnomeRRLabeler *labeler, GnomeOutputInfo *output, GdkColor *color_out);
 
 #endif
diff --git a/libgnome-desktop/gnome-rr-private.h b/libgnome-desktop/gnome-rr-private.h
index 5113a12..cfa84e3 100644
--- a/libgnome-desktop/gnome-rr-private.h
+++ b/libgnome-desktop/gnome-rr-private.h
@@ -47,35 +47,4 @@ struct GnomeRRScreenPrivate
     Atom                        connector_type_atom;
 };
 
-struct GnomeRROutputInfoPrivate
-{
-    char *		name;
-
-    gboolean		on;
-    int			width;
-    int			height;
-    int			rate;
-    int			x;
-    int			y;
-    GnomeRRRotation	rotation;
-
-    gboolean		connected;
-    gchar		vendor[4];
-    guint		product;
-    guint		serial;
-    double		aspect;
-    int			pref_width;
-    int			pref_height;
-    char *		display_name;
-    gboolean            primary;
-};
-
-struct GnomeRRConfigPrivate
-{
-  gboolean clone;
-  gboolean current;
-  GnomeRRScreen *screen;
-  GnomeRROutputInfo **outputs;
-};
-
 #endif
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 7d03565..568acd3 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -39,7 +39,6 @@
 
 #undef GNOME_DISABLE_DEPRECATED
 #include "gnome-rr.h"
-#include "gnome-rr-config.h"
 
 #include "private.h"
 #include "gnome-rr-private.h"
@@ -793,7 +792,7 @@ gnome_rr_screen_class_init (GnomeRRScreenClass *klass)
 void
 gnome_rr_screen_init (GnomeRRScreen *self)
 {
-    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GNOME_TYPE_RR_SCREEN, GnomeRRScreenPrivate);
+    self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GNOME_RR_TYPE_SCREEN, GnomeRRScreenPrivate);
 
     self->priv->gdk_screen = NULL;
     self->priv->gdk_root = NULL;
@@ -824,7 +823,7 @@ gnome_rr_screen_new (GdkScreen *screen,
 		     GError **error)
 {
     _gnome_desktop_init_i18n ();
-    GnomeRRScreen *self = g_initable_new (GNOME_TYPE_RR_SCREEN, NULL, error, "gdk-screen", screen, NULL);
+    GnomeRRScreen *self = g_initable_new (GNOME_RR_TYPE_SCREEN, NULL, error, "gdk-screen", screen, NULL);
     if (self && callback) {
         g_signal_connect (self, "screen-changed", G_CALLBACK (callback), data);
     }
@@ -850,7 +849,7 @@ gnome_rr_screen_set_size (GnomeRRScreen *screen,
 			  int       mm_width,
 			  int       mm_height)
 {
-    g_return_if_fail (GNOME_IS_RR_SCREEN (screen));
+    g_return_if_fail (GNOME_RR_IS_SCREEN (screen));
 
 #ifdef HAVE_RANDR
     gdk_error_trap_push ();
@@ -877,7 +876,7 @@ gnome_rr_screen_get_ranges (GnomeRRScreen *screen,
 			    int           *min_height,
 			    int	          *max_height)
 {
-    g_return_if_fail (GNOME_IS_RR_SCREEN (screen));
+    g_return_if_fail (GNOME_RR_IS_SCREEN (screen));
     
     if (min_width)
 	*min_width = screen->priv->info->min_width;
@@ -909,7 +908,7 @@ gnome_rr_screen_get_timestamps (GnomeRRScreen *screen,
 				guint32       *change_timestamp_ret,
 				guint32       *config_timestamp_ret)
 {
-    g_return_if_fail (GNOME_IS_RR_SCREEN (screen));
+    g_return_if_fail (GNOME_RR_IS_SCREEN (screen));
 
 #ifdef HAVE_RANDR
     if (change_timestamp_ret)
@@ -1007,7 +1006,7 @@ gnome_rr_screen_refresh (GnomeRRScreen *screen,
 GnomeRRMode **
 gnome_rr_screen_list_modes (GnomeRRScreen *screen)
 {
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (GNOME_RR_IS_SCREEN (screen), NULL);
     g_return_val_if_fail (screen->priv->info != NULL, NULL);
     
     return screen->priv->info->modes;
@@ -1023,7 +1022,7 @@ gnome_rr_screen_list_modes (GnomeRRScreen *screen)
 GnomeRRMode **
 gnome_rr_screen_list_clone_modes   (GnomeRRScreen *screen)
 {
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (GNOME_RR_IS_SCREEN (screen), NULL);
     g_return_val_if_fail (screen->priv->info != NULL, NULL);
 
     return screen->priv->info->clone_modes;
@@ -1039,7 +1038,7 @@ gnome_rr_screen_list_clone_modes   (GnomeRRScreen *screen)
 GnomeRRCrtc **
 gnome_rr_screen_list_crtcs (GnomeRRScreen *screen)
 {
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (GNOME_RR_IS_SCREEN (screen), NULL);
     g_return_val_if_fail (screen->priv->info != NULL, NULL);
     
     return screen->priv->info->crtcs;
@@ -1055,7 +1054,7 @@ gnome_rr_screen_list_crtcs (GnomeRRScreen *screen)
 GnomeRROutput **
 gnome_rr_screen_list_outputs (GnomeRRScreen *screen)
 {
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (GNOME_RR_IS_SCREEN (screen), NULL);
     g_return_val_if_fail (screen->priv->info != NULL, NULL);
     
     return screen->priv->info->outputs;
@@ -1072,7 +1071,7 @@ gnome_rr_screen_get_crtc_by_id (GnomeRRScreen *screen,
 {
     int i;
     
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (GNOME_RR_IS_SCREEN (screen), NULL);
     g_return_val_if_fail (screen->priv->info != NULL, NULL);
     
     for (i = 0; screen->priv->info->crtcs[i] != NULL; ++i)
@@ -1095,7 +1094,7 @@ gnome_rr_screen_get_output_by_id (GnomeRRScreen *screen,
 {
     int i;
     
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (GNOME_RR_IS_SCREEN (screen), NULL);
     g_return_val_if_fail (screen->priv->info != NULL, NULL);
     
     for (i = 0; screen->priv->info->outputs[i] != NULL; ++i)
@@ -1390,7 +1389,7 @@ gnome_rr_screen_get_output_by_name (GnomeRRScreen *screen,
 {
     int i;
     
-    g_return_val_if_fail (GNOME_IS_RR_SCREEN (screen), NULL);
+    g_return_val_if_fail (GNOME_RR_IS_SCREEN (screen), NULL);
     g_return_val_if_fail (screen->priv->info != NULL, NULL);
     
     for (i = 0; screen->priv->info->outputs[i] != NULL; ++i)
diff --git a/libgnome-desktop/gnome-rr.h b/libgnome-desktop/gnome-rr.h
index 4880add..e305921 100644
--- a/libgnome-desktop/gnome-rr.h
+++ b/libgnome-desktop/gnome-rr.h
@@ -76,16 +76,16 @@ typedef enum {
 
 #define GNOME_RR_CONNECTOR_TYPE_PANEL "Panel"  /* This is a laptop's built-in LCD */
 
-#define GNOME_TYPE_RR_SCREEN                  (gnome_rr_screen_get_type())
-#define GNOME_RR_SCREEN(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_TYPE_RR_SCREEN, GnomeRRScreen))
-#define GNOME_IS_RR_SCREEN(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_TYPE_RR_SCREEN))
-#define GNOME_RR_SCREEN_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_TYPE_RR_SCREEN, GnomeRRScreenClass))
-#define GNOME_IS_RR_SCREEN_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_RR_SCREEN))
-#define GNOME_RR_SCREEN_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_RR_SCREEN, GnomeRRScreenClass))
+#define GNOME_RR_TYPE_SCREEN                  (gnome_rr_screen_get_type())
+#define GNOME_RR_SCREEN(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNOME_RR_TYPE_SCREEN, GnomeRRScreen))
+#define GNOME_RR_IS_SCREEN(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNOME_RR_TYPE_SCREEN))
+#define GNOME_RR_SCREEN_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GNOME_RR_TYPE_SCREEN, GnomeRRScreenClass))
+#define GNOME_RR_IS_SCREEN_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GNOME_RR_TYPE_SCREEN))
+#define GNOME_RR_SCREEN_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_RR_TYPE_SCREEN, GnomeRRScreenClass))
 
-#define GNOME_TYPE_RR_OUTPUT (gnome_rr_output_get_type())
-#define GNOME_TYPE_RR_CRTC   (gnome_rr_crtc_get_type())
-#define GNOME_TYPE_RR_MODE   (gnome_rr_mode_get_type())
+#define GNOME_RR_TYPE_OUTPUT (gnome_rr_output_get_type())
+#define GNOME_RR_TYPE_CRTC   (gnome_rr_crtc_get_type())
+#define GNOME_RR_TYPE_MODE   (gnome_rr_mode_get_type())
 
 GType gnome_rr_screen_get_type (void);
 GType gnome_rr_output_get_type (void);
@@ -127,8 +127,6 @@ void            gnome_rr_screen_get_timestamps     (GnomeRRScreen         *scree
 void            gnome_rr_screen_set_primary_output (GnomeRRScreen         *screen,
                                                     GnomeRROutput         *output);
 
-GnomeRRMode   **gnome_rr_screen_create_clone_modes (GnomeRRScreen *screen);
-
 /* GnomeRROutput */
 guint32         gnome_rr_output_get_id             (GnomeRROutput         *output);
 const char *    gnome_rr_output_get_name           (GnomeRROutput         *output);



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