[gnome-panel] panel: Make it possible to load a default layout from the user config



commit bc6beed1c7562f92a3993a720061a6e2f584646e
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Oct 11 17:25:26 2011 +0200

    panel: Make it possible to load a default layout from the user config
    
    If ~/.config/gnome-panel/panel-default-layout.layout exists, use it in
    favor of /usr/share/gnome-panel/panel-default-layout.layout.

 gnome-panel/panel-layout.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/gnome-panel/panel-layout.c b/gnome-panel/panel-layout.c
index 596d97f..cd4ca37 100644
--- a/gnome-panel/panel-layout.c
+++ b/gnome-panel/panel-layout.c
@@ -41,12 +41,15 @@
 #include "panel-object-loader.h"
 #include "panel-schemas.h"
 #include "panel-toplevel.h"
+#include "panel-util.h"
 
 #include "panel-layout.h"
 
 static GSettings *layout_settings = NULL;
 
 #define PANEL_LAYOUT_ERROR panel_layout_error_quark ()
+
+#define PANEL_LAYOUT_DEFAULT_LAYOUT_FILE "panel-default-layout.layout"
 #define PANEL_LAYOUT_OBJECT_GCONF_PATH_TEMPLATE "/apps/panel3-applets/%s"
 #define PANEL_LAYOUT_INSTANCE_CONFIG_SUBPATH "@instance-config/"
 
@@ -1114,8 +1117,17 @@ panel_layout_load_object (const char *object_id)
 static char *
 panel_layout_get_default_layout_file (void)
 {
+        char *user_file;
+
+        user_file = panel_util_get_from_personal_path (PANEL_LAYOUT_DEFAULT_LAYOUT_FILE);
+
+        if (g_file_test (user_file, G_FILE_TEST_IS_REGULAR))
+                return user_file;
+
+        g_free (user_file);
+
         return g_build_filename (PANELDATADIR,
-                                 "panel-default-layout.layout",
+                                 PANEL_LAYOUT_DEFAULT_LAYOUT_FILE,
                                  NULL);
 }
 



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