[maemo-commits] [maemo-commits] r13435 - in projects/haf/trunk/hildon-desktop: . src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Aug 28 16:17:40 EEST 2007
Author: jobi
Date: 2007-08-28 16:17:38 +0300 (Tue, 28 Aug 2007)
New Revision: 13435

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-desktop.c
   projects/haf/trunk/hildon-desktop/src/hd-home-window.c
Log:

2007-08-28  Johan Bilien  <johan.bilien at nokia.com>

	* src/hd-desktop.c:
	- if no user-wide configuration file for a container, copy
	it locally
	* src/hd-home-window.c:
	- same thing for home area layout and background.
	Fixes: NB#61978



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-28 13:15:53 UTC (rev 13434)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-08-28 13:17:38 UTC (rev 13435)
@@ -1,5 +1,14 @@
 2007-08-28  Johan Bilien  <johan.bilien at nokia.com>
 
+	* src/hd-desktop.c:
+	- if no user-wide configuration file for a container, copy
+	it locally
+	* src/hd-home-window.c:
+	- same thing for home area layout and background.
+	Fixes: NB#61978
+
+2007-08-28  Johan Bilien  <johan.bilien at nokia.com>
+
 	* libhildondesktop/hildon-desktop-home-item.c:
 	- removed handling of the tap-and-hold
 	- when the user taps for more than 400ms without move, propagate

Modified: projects/haf/trunk/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-08-28 13:15:53 UTC (rev 13434)
+++ projects/haf/trunk/hildon-desktop/src/hd-desktop.c	2007-08-28 13:17:38 UTC (rev 13435)
@@ -322,6 +322,7 @@
 hd_desktop_get_conf_file_path (const gchar *config_file)
 {
   gchar *config_file_path;
+  gchar *user_config_file_path;
         
   config_file_path = g_build_filename (g_get_home_dir (),
                                        HD_DESKTOP_CONFIG_USER_PATH, 
@@ -332,7 +333,7 @@
      configuration file at sysconfdir. */
   if (!g_file_test (config_file_path, G_FILE_TEST_EXISTS))
   {
-    g_free (config_file_path);
+    user_config_file_path = config_file_path;
 
     config_file_path = g_build_filename (HD_DESKTOP_CONFIG_PATH, 
                                          config_file,
@@ -343,6 +344,26 @@
       g_free (config_file_path);
       config_file_path = NULL;
     }
+    else
+    {
+      /* If system-wide configuration file is present, but not
+       * user-wide, copy it the system-wide */
+      gchar *content;
+      gsize length;
+
+      if (g_file_get_contents (config_file_path,
+                               &content,
+                               &length,
+                               NULL))
+      {
+        g_file_set_contents (user_config_file_path,
+                             content,
+                             length,
+                             NULL);
+      }
+
+    }
+    g_free (user_config_file_path);
   }
 
   return config_file_path; 

Modified: projects/haf/trunk/hildon-desktop/src/hd-home-window.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-home-window.c	2007-08-28 13:15:53 UTC (rev 13434)
+++ projects/haf/trunk/hildon-desktop/src/hd-home-window.c	2007-08-28 13:17:38 UTC (rev 13435)
@@ -411,7 +411,6 @@
                                   conffile,
                                   &error);
 
-  g_free (conffile);
 
   if (error)
     {
@@ -446,6 +445,10 @@
                                  "color", &default_color,
                                  NULL);
 
+      hildon_desktop_background_save (background,
+                                      conffile,
+                                      NULL);
+
 error:
       if (error)
         {
@@ -462,7 +465,9 @@
 
     }
 
+  g_free (conffile);
 
+
   if (background)
     hd_home_window_set_background (window, background);
 
@@ -1166,8 +1171,26 @@
       if (g_file_test (user_filename, G_FILE_TEST_EXISTS))
         filename = user_filename;
       else
+      {
+        /* If there is no local file, we use the system-wide one
+         * and copy it locally */
+        gchar *content;
+        gsize length;
+
         filename = HH_AREA_GLOBAL_CONFIGURATION_FILE;
 
+        if (g_file_get_contents (filename,
+                                 &content,
+                                 &length,
+                                 NULL))
+        {
+          g_file_set_contents (user_filename,
+                               content,
+                               length,
+                               NULL);
+        }
+      }
+
       hildon_home_area_load_configuration (HILDON_HOME_AREA (area),
                                            filename,
                                            &error);


More information about the maemo-commits mailing list