[gnome-settings-daemon/randr-set-as-default: 4/4] Apply a default RANDR configuration at startup



commit 5800925a383d6498bd4281a7eebe0fc39be640b7
Author: Federico Mena Quintero <federico novell com>
Date:   Mon Mar 8 18:35:31 2010 -0600

    Apply a default RANDR configuration at startup
    
    This will get applied from the file specified by the GConf key
    mentioned in the previous commit, if the user's own configuration
    file (in ~/.config/monitors.xml) doesn't exist or if it doesn't match
    the current monitor setup.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 plugins/xrandr/gsd-xrandr-manager.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index b07dcdb..6784156 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -2069,6 +2069,23 @@ out:
         return success;
 }
 
+static gboolean
+apply_default_configuration_from_file (GsdXrandrManager *manager, guint32 timestamp)
+{
+        GsdXrandrManagerPrivate *priv = manager->priv;
+        char *default_config_filename;
+        gboolean result;
+
+        default_config_filename = gconf_client_get_string (priv->client, CONF_KEY_DEFAULT_CONFIGURATION_FILE, NULL);
+        if (!default_config_filename)
+                return FALSE;
+
+        result = apply_configuration_from_filename (manager, default_config_filename, TRUE, timestamp, NULL);
+
+        g_free (default_config_filename);
+        return result;
+}
+
 gboolean
 gsd_xrandr_manager_start (GsdXrandrManager *manager,
                           GError          **error)
@@ -2123,7 +2140,8 @@ gsd_xrandr_manager_start (GsdXrandrManager *manager,
 
         show_timestamps_dialog (manager, "Startup");
         if (!apply_stored_configuration_at_startup (manager, GDK_CURRENT_TIME)) /* we don't have a real timestamp at startup anyway */
-                apply_default_boot_configuration (manager, GDK_CURRENT_TIME);
+                if (!apply_default_configuration_from_file (manager, GDK_CURRENT_TIME))
+                        apply_default_boot_configuration (manager, GDK_CURRENT_TIME);
 
         gdk_window_add_filter (gdk_get_default_root_window(),
                                (GdkFilterFunc)event_filter,



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