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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Jun 13 15:49:57 EEST 2007
Author: lucasr
Date: 2007-06-13 15:49:55 +0300 (Wed, 13 Jun 2007)
New Revision: 12272

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
   projects/haf/trunk/hildon-desktop/src/hn-others-button.c
Log:
2007-06-13  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hn-others-button.c, src/hd-applications-menu.c: always copy the
	system-wide menu definition to user directory to make sure restore
	work. Fixes bug NB#42202.


Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-13 12:30:09 UTC (rev 12271)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-06-13 12:49:55 UTC (rev 12272)
@@ -1,5 +1,11 @@
 2007-06-13  Lucas Rocha  <lucas.rocha at nokia.com>
 
+	* src/hn-others-button.c, src/hd-applications-menu.c: always copy the
+	system-wide menu definition to user directory to make sure restore
+	work. Fixes bug NB#42202.
+
+2007-06-13  Lucas Rocha  <lucas.rocha at nokia.com>
+
 	* src/hd-switcher-menu.c: don't add a separator on the top of
 	application menu.
 

Modified: projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-06-13 12:30:09 UTC (rev 12271)
+++ projects/haf/trunk/hildon-desktop/src/hd-applications-menu.c	2007-06-13 12:49:55 UTC (rev 12272)
@@ -1067,8 +1067,7 @@
   if (!g_file_test (conf_file, G_FILE_TEST_EXISTS))
     if (g_file_get_contents (SYSTEMWIDE_MENU_FILE, &file, NULL, NULL))
     {
-      g_debug ("I couldn't get contents");
-      g_file_set_contents (USER_MENU_FILE, file, -1, NULL);
+      g_file_set_contents (conf_file, file, -1, NULL);
     }
   
   g_free (file);
@@ -1089,36 +1088,32 @@
 
   g_free (dir);
   
-  /* Watch user specific menu conf */
-  if (g_get_home_dir ())
-  {    
-    /* Have to get the directory from the path because the USER_MENU_FILE
-       define might contain directory (it does, in fact). */
-    dir = g_path_get_dirname (conf_file);
-    
-    g_mkdir (dir, 0755);
+  /* Have to get the directory from the path because the USER_MENU_FILE
+     define might contain directory (it does, in fact). */
+  dir = g_path_get_dirname (conf_file);
+  
+  g_mkdir (dir, 0755);
 
-    if (dir && *dir)
+  if (dir && *dir)
+  {
+    if (gnome_vfs_monitor_add (&button->priv->home_dir_monitor, 
+                               dir,
+                               GNOME_VFS_MONITOR_DIRECTORY,
+                               (GnomeVFSMonitorCallback) hd_applications_menu_dir_changed,
+                               button) != GNOME_VFS_OK)
     {
-      if (gnome_vfs_monitor_add (&button->priv->home_dir_monitor, 
-                                 dir,
-                                 GNOME_VFS_MONITOR_DIRECTORY,
-                                 (GnomeVFSMonitorCallback) hd_applications_menu_dir_changed,
-                                 button) != GNOME_VFS_OK)
-      {
-        g_warning ("Others_menu_initialize_menu: "
-      	           "failed setting monitor callback "
-      	           "for user specific menu conf." );
-      }
-    }
-    else
-    {
       g_warning ("Others_menu_initialize_menu: "
-    	         "failed to create directory '%s'", dir);
+    	         "failed setting monitor callback "
+    	         "for user specific menu conf." );
     }
-
-    g_free (dir);
   }
+  else
+  {
+    g_warning ("Others_menu_initialize_menu: "
+  	       "failed to create directory '%s'", dir);
+  }
+
+  g_free (dir);
       
   g_free (conf_file);
   

Modified: projects/haf/trunk/hildon-desktop/src/hn-others-button.c
===================================================================
--- projects/haf/trunk/hildon-desktop/src/hn-others-button.c	2007-06-13 12:30:09 UTC (rev 12271)
+++ projects/haf/trunk/hildon-desktop/src/hn-others-button.c	2007-06-13 12:49:55 UTC (rev 12272)
@@ -1024,8 +1024,7 @@
   if (!g_file_test (conf_file, G_FILE_TEST_EXISTS))
     if (g_file_get_contents (SYSTEMWIDE_MENU_FILE, &file, NULL, NULL))
     {
-      g_debug ("I couldn't get contents");
-      g_file_set_contents (USER_MENU_FILE, file, -1, NULL);
+      g_file_set_contents (conf_file, file, -1, NULL);
     }
   
   g_free (file);
@@ -1046,36 +1045,32 @@
 
   g_free (dir);
   
-  /* Watch user specific menu conf */
-  if (g_get_home_dir ())
-  {    
-    /* Have to get the directory from the path because the USER_MENU_FILE
-       define might contain directory (it does, in fact). */
-    dir = g_path_get_dirname (conf_file);
-    
-    g_mkdir (dir, 0755);
+  /* Have to get the directory from the path because the USER_MENU_FILE
+     define might contain directory (it does, in fact). */
+  dir = g_path_get_dirname (conf_file);
+  
+  g_mkdir (dir, 0755);
 
-    if (dir && *dir)
+  if (dir && *dir)
+  {
+    if (gnome_vfs_monitor_add (&button->priv->home_dir_monitor, 
+                               dir,
+                               GNOME_VFS_MONITOR_DIRECTORY,
+                               (GnomeVFSMonitorCallback) hn_others_button_dir_changed,
+                               button) != GNOME_VFS_OK)
     {
-      if (gnome_vfs_monitor_add (&button->priv->home_dir_monitor, 
-                                 dir,
-                                 GNOME_VFS_MONITOR_DIRECTORY,
-                                 (GnomeVFSMonitorCallback) hn_others_button_dir_changed,
-                                 button) != GNOME_VFS_OK)
-      {
-        g_warning ("Others_menu_initialize_menu: "
-      	           "failed setting monitor callback "
-      	           "for user specific menu conf." );
-      }
-    }
-    else
-    {
       g_warning ("Others_menu_initialize_menu: "
-    	         "failed to create directory '%s'", dir);
+    	         "failed setting monitor callback "
+    	         "for user specific menu conf." );
     }
-
-    g_free (dir);
   }
+  else
+  {
+    g_warning ("Others_menu_initialize_menu: "
+  	       "failed to create directory '%s'", dir);
+  }
+
+  g_free (dir);
       
   g_free (conf_file);
   


More information about the maemo-commits mailing list