[maemo-commits] [maemo-commits] r9669 - in projects/haf/branches/maemo-af-desktop/hildon-desktop: . libhildondesktop src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Feb 6 13:55:38 EET 2007
Author: lucasr
Date: 2007-02-06 13:55:36 +0200 (Tue, 06 Feb 2007)
New Revision: 9669

Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c
Log:
2007-02-06  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-desktop.c, libhildondesktop/hildon-desktop-window.[ch]: move
	all plugin_dir and config_file handling to HDDesktop to make
	HildonDesktopWindow free from desktop specific code.


Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-02-06 11:41:03 UTC (rev 9668)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-02-06 11:55:36 UTC (rev 9669)
@@ -1,5 +1,11 @@
 2007-02-06  Lucas Rocha  <lucas.rocha at nokia.com>
 
+	* src/hd-desktop.c, libhildondesktop/hildon-desktop-window.[ch]: move
+	all plugin_dir and config_file handling to HDDesktop to make
+	HildonDesktopWindow free from desktop specific code.
+
+2007-02-06  Lucas Rocha  <lucas.rocha at nokia.com>
+
 	* src/hd-desktop.c: define padding for HDPanelDialog.
 	* libhildondesktop/hildon-desktop-panel-window-dialog.c,
 	libhildondesktop/hildon-desktop-panel-window.c: use

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c	2007-02-06 11:41:03 UTC (rev 9668)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.c	2007-02-06 11:55:36 UTC (rev 9669)
@@ -32,8 +32,6 @@
 
 enum {
   PROP_0,
-  PROP_CONFIG_FILE,
-  PROP_PLUGIN_DIR,
   PROP_PADDING_LEFT,
   PROP_PADDING_RIGHT,
   PROP_PADDING_TOP,
@@ -51,8 +49,6 @@
 
 struct _HildonDesktopWindowPrivate 
 {
-  gchar *config_file;
-  gchar *plugin_dir;
   gint   padding_left;
   gint   padding_right;
   gint   padding_top;
@@ -75,18 +71,6 @@
     desktop_window = NULL;
   }
 
-  if (priv->config_file)
-  {
-    g_free (priv->config_file);
-    priv->config_file = NULL;
-  }
-
-  if (priv->plugin_dir)
-  {
-    g_free (priv->plugin_dir);
-    priv->plugin_dir = NULL;
-  }
-
   G_OBJECT_CLASS (hildon_desktop_window_parent_class)->finalize (object);
 }
 
@@ -102,18 +86,6 @@
 
   switch (prop_id)
   {
-    case PROP_CONFIG_FILE:
-      hildon_desktop_window_set_config_file (
-                               HILDON_DESKTOP_WINDOW (object),
-                               (gchar *) g_value_get_string (value));
-      break;
-
-    case PROP_PLUGIN_DIR:
-      hildon_desktop_window_set_plugin_dir (
-                               HILDON_DESKTOP_WINDOW (object),
-                               (gchar *) g_value_get_string (value));
-      break;
-
     case PROP_PADDING_LEFT:
       priv->padding_left = g_value_get_int (value);
       break;
@@ -147,14 +119,6 @@
 
   switch (prop_id)
   {
-    case PROP_CONFIG_FILE:
-      g_value_set_string (value, priv->config_file);
-      break;
-
-    case PROP_PLUGIN_DIR:
-      g_value_set_string (value, priv->plugin_dir);
-      break;
-
     case PROP_PADDING_LEFT:
       g_value_set_int (value, priv->padding_left);
       break;
@@ -183,9 +147,6 @@
 
   desktop_window->container = NULL;
 
-  desktop_window->priv->config_file = NULL;
-  desktop_window->priv->plugin_dir = NULL;
-
   desktop_window->priv->padding_left = 0;
   desktop_window->priv->padding_right = 0;
   desktop_window->priv->padding_top = 0;
@@ -231,26 +192,6 @@
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
 
-  pspec = g_param_spec_string ("plugin-dir",
-                               "Plugin Directory",
-                               "Plugin Directory",
-                               NULL,
-                               G_PARAM_READWRITE);
-
-  g_object_class_install_property (g_object_class,
-                                   PROP_PLUGIN_DIR,
-                                   pspec);
-
-  pspec = g_param_spec_string ("config-file",
-                                "Config File",
-                                "Config File",
-                                NULL,
-                                G_PARAM_READWRITE);
-
-  g_object_class_install_property (g_object_class,
-                                   PROP_CONFIG_FILE,
-                                   pspec);
-
   pspec = g_param_spec_int ("padding-left",
                             "Padding Left",
                             "Padding Left",
@@ -313,63 +254,3 @@
 {
 /* TODO: */
 }
-
-const gchar * 
-hildon_desktop_window_get_config_file (HildonDesktopWindow *window)
-{
-  HildonDesktopWindowPrivate *priv;
-
-  g_return_val_if_fail (window != NULL, NULL);
-  g_return_val_if_fail (HILDON_DESKTOP_IS_WINDOW (window), NULL);
-
-  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
-
-  return priv->config_file;
-}
-
-void
-hildon_desktop_window_set_config_file (HildonDesktopWindow *window, 
-                                       gchar               *config_file)
-{
-  HildonDesktopWindowPrivate *priv;
-
-  g_return_if_fail (window != NULL);
-  g_return_if_fail (HILDON_DESKTOP_IS_WINDOW (window));
-
-  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
-
-  if (priv->config_file)
-    g_free (priv->config_file);
-
-  priv->config_file = g_strdup (config_file);
-}
-
-const gchar * 
-hildon_desktop_window_get_plugin_dir (HildonDesktopWindow *window)
-{
-  HildonDesktopWindowPrivate *priv;
-
-  g_return_val_if_fail (window != NULL, NULL);
-  g_return_val_if_fail (HILDON_DESKTOP_IS_WINDOW (window), NULL);
-
-  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
-
-  return priv->plugin_dir;
-}
-
-void
-hildon_desktop_window_set_plugin_dir (HildonDesktopWindow *window, 
-                                      gchar               *plugin_dir)
-{
-  HildonDesktopWindowPrivate *priv;
-
-  g_return_if_fail (window != NULL);
-  g_return_if_fail (HILDON_DESKTOP_IS_WINDOW (window));
-
-  priv = HILDON_DESKTOP_WINDOW_GET_PRIVATE (window);
-
-  if (priv->plugin_dir)
-    g_free (priv->plugin_dir);
-
-  priv->plugin_dir = g_strdup (plugin_dir);
-}

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h	2007-02-06 11:41:03 UTC (rev 9668)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/libhildondesktop/hildon-desktop-window.h	2007-02-06 11:55:36 UTC (rev 9669)
@@ -74,16 +74,6 @@
 void           hildon_desktop_window_set_focus        (HildonDesktopWindow *window, 
                                                        gboolean             focus);
 
-const gchar*   hildon_desktop_window_get_config_file  (HildonDesktopWindow *window);
-
-void           hildon_desktop_window_set_config_file  (HildonDesktopWindow *window, 
-                                                       gchar               *config_file);
-
-const gchar*   hildon_desktop_window_get_plugin_dir   (HildonDesktopWindow *window);
-
-void           hildon_desktop_window_set_plugin_dir   (HildonDesktopWindow *window, 
-                                                       gchar               *plugin_dir);
-
 G_END_DECLS
 
 #endif

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c	2007-02-06 11:41:03 UTC (rev 9668)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-desktop.c	2007-02-06 11:55:36 UTC (rev 9669)
@@ -55,6 +55,14 @@
 #define HD_DESKTOP_CONFIG_FILE         "desktop.conf"
 #define HD_DESKTOP_CONFIG_USER_PATH    ".osso/hildon-desktop/"
 
+typedef struct
+{
+  gchar      *config_file;
+  gchar      *plugin_dir;
+  GtkWidget  *container;
+  HDDesktop  *desktop;
+} HDDesktopContainerInfo;
+
 struct _HDDesktopPrivate 
 {
   gchar           *config_path;
@@ -208,17 +216,18 @@
 hd_desktop_container_load (HildonDesktopWindow *window, gpointer user_data)
 {
   HDDesktopPrivate *priv;
+  HDDesktopContainerInfo *info;
   GList *plugin_list;
-  const gchar *config_file;
 
   g_return_if_fail (user_data != NULL);
-  g_return_if_fail (HD_IS_DESKTOP (user_data));
 
-  priv = HD_DESKTOP_GET_PRIVATE (user_data);
+  info = (HDDesktopContainerInfo *) user_data;
+  
+  g_return_if_fail (HD_IS_DESKTOP (info->desktop));
 
-  config_file = hildon_desktop_window_get_config_file (window);
+  priv = info->desktop->priv;
 
-  plugin_list = hd_desktop_plugin_list_from_conf (config_file);
+  plugin_list = hd_desktop_plugin_list_from_conf (info->config_file);
 
   hd_plugin_manager_sync (HD_PLUGIN_MANAGER (priv->pm), 
                           plugin_list, 
@@ -232,19 +241,20 @@
 hd_desktop_container_save (HildonDesktopWindow *window, gpointer user_data)
 {
   HDDesktopPrivate *priv;
+  HDDesktopContainerInfo *info;
   GList *plugin_list;
-  const gchar *config_file;
 
   g_return_if_fail (user_data != NULL);
-  g_return_if_fail (HD_IS_DESKTOP (user_data));
 
-  priv = HD_DESKTOP_GET_PRIVATE (user_data);
+  info = (HDDesktopContainerInfo *) user_data;
+  
+  g_return_if_fail (HD_IS_DESKTOP (info->desktop));
 
-  config_file = hildon_desktop_window_get_config_file (window);
+  priv = info->desktop->priv;
 
   plugin_list = hd_desktop_plugin_list_from_container (window->container);
 
-  hd_desktop_plugin_list_to_conf (plugin_list, config_file);
+  hd_desktop_plugin_list_to_conf (plugin_list, info->config_file);
 
   g_list_foreach (plugin_list, (GFunc) g_free , NULL);
   g_list_free (plugin_list); 
@@ -254,28 +264,26 @@
 hd_desktop_select_plugins (HildonDesktopWindow *window, gpointer user_data)
 {
   HDDesktopPrivate *priv;
+  HDDesktopContainerInfo *info;
   GList *loaded_plugins = NULL;
   GList *selected_plugins = NULL;
-  const gchar *plugin_dir;
-  const gchar *config_file;
   gint response;
 
   g_return_if_fail (user_data != NULL);
-  g_return_if_fail (HD_IS_DESKTOP (user_data));
 
-  priv = HD_DESKTOP_GET_PRIVATE (user_data);
+  info = (HDDesktopContainerInfo *) user_data;
+  
+  g_return_if_fail (HD_IS_DESKTOP (info->desktop));
 
+  priv = info->desktop->priv;
+
   loaded_plugins = gtk_container_get_children (window->container);
 
-  config_file = hildon_desktop_window_get_config_file (window);
-
-  plugin_dir = hildon_desktop_window_get_plugin_dir (window);
-
   response = hd_select_plugins_dialog_run (loaded_plugins,
 #ifdef HAVE_LIBOSSOHELP
                                            priv->osso_context,
 #endif 
-                                           plugin_dir,
+                                           info->plugin_dir,
                                            &selected_plugins);
 
   if (response == GTK_RESPONSE_OK)
@@ -290,23 +298,34 @@
   g_list_free (loaded_plugins);
 }
 
-static gboolean
-hd_desktop_destroy_container (gpointer key, gpointer value, gpointer user_data)
+static void 
+hd_desktop_free_container_info (HDDesktopContainerInfo *info)
 {
-  /* Remove file change watcher here. */
+  if (info->config_file)
+    g_free (info->config_file);
 
-  g_free (key);
+  if (info->plugin_dir)
+    g_free (info->plugin_dir);
 
-  gtk_widget_destroy (GTK_WIDGET (value));
+  if (info->container)
+    gtk_widget_destroy (info->container);
 
+  g_free (info);
+}
+
+static gboolean
+hd_desktop_remove_container_info (gpointer key, gpointer value, gpointer data)
+{
   return TRUE;
 }
-
+        
 static void
 hd_desktop_config_changed (gchar *config_file, HDDesktop *desktop)
 {
+  /* FIXME: this is done because g_hash_table_remove_all is not 
+     available in glib <= 2.12 */
   g_hash_table_foreach_remove (desktop->priv->containers, 
-                               hd_desktop_destroy_container, 
+                               hd_desktop_remove_container_info,
                                NULL);
 
   hd_desktop_load_containers (desktop);
@@ -315,33 +334,33 @@
 static void
 hd_desktop_container_config_changed (gchar *config_file, HDDesktop *desktop)
 {
+  HDDesktopContainerInfo *info;
   GList *plugin_list = NULL;
+  
+  info = g_hash_table_lookup (desktop->priv->containers,
+                              config_file);
 
-  GtkContainer *container = g_hash_table_lookup (desktop->priv->containers,
-                                                 config_file);
-
   plugin_list = hd_desktop_plugin_list_from_conf (config_file);
 
   hd_plugin_manager_sync (HD_PLUGIN_MANAGER (desktop->priv->pm), 
                           plugin_list, 
-                          HILDON_DESKTOP_WINDOW (container)->container);
+                          HILDON_DESKTOP_WINDOW (info->container)->container);
 
   g_list_foreach (plugin_list, (GFunc) g_free , NULL);
   g_list_free (plugin_list);
 }
 
 static void
-hd_desktop_plugin_dir_changed (gchar *plugin_dir, HildonDesktopWindow *window)
+hd_desktop_plugin_dir_changed (gchar *plugin_dir, HDDesktopContainerInfo *info)
 {
   GDir *dir;
-  const gchar *filename;
   GError *error = NULL;
   GList *plugin_list = NULL, *remove_list, *iter;
+  const gchar *filename;
 
-  g_debug ("D-notified");
+  remove_list = gtk_container_get_children (
+                  HILDON_DESKTOP_WINDOW (info->container)->container);
 
-  remove_list = gtk_container_get_children (window->container);
-
   dir = g_dir_open (plugin_dir, 0, &error);
 
   if (!dir)
@@ -361,8 +380,6 @@
     
     desktop_path = g_build_filename (plugin_dir, filename, NULL);
 
-/*    g_debug ("found plugin %s", desktop_path);*/
-
     found = g_list_find_custom (remove_list, 
                                 desktop_path,
                                 hd_desktop_find_by_id);
@@ -371,8 +388,6 @@
     {
       plugin_list = g_list_append (plugin_list, desktop_path);
       remove_list = g_list_remove (remove_list, found->data);
-
-      g_debug ("Removing: %s", desktop_path);
     }
   }
  
@@ -385,13 +400,7 @@
   /* Save the current plugin list if needed */
   if (remove_list)
   {
-    const gchar *config_file;
-    
-    g_debug ("Save needed");
-
-    config_file = hildon_desktop_window_get_config_file (window);
-
-    hd_desktop_plugin_list_to_conf (plugin_list, config_file);
+    hd_desktop_plugin_list_to_conf (plugin_list, info->config_file);
   } 
 
   g_list_foreach (plugin_list, (GFunc) g_free , NULL);
@@ -479,10 +488,12 @@
      the container of that type and show it. */
   for (i = 0; groups[i]; i++)
   {
-    GtkWidget *container = NULL;
+    HDDesktopContainerInfo *info = NULL;
     GList *plugin_list = NULL;
     gchar *type, *container_config, *container_config_file, *plugin_dir;
 
+    error = NULL;
+    
     container_config_file = g_key_file_get_string (keyfile, 
                                                    groups[i], 
                                                    HD_DESKTOP_CONFIG_KEY_CONFIG_FILE,
@@ -493,8 +504,10 @@
       g_warning ("Error reading desktop configuration file: %s", 
                  error->message);
 
+      g_free (container_config_file);
+
       g_error_free (error);
-
+      
       continue;
     }
 
@@ -516,8 +529,10 @@
       if (!g_file_test (container_config, G_FILE_TEST_EXISTS))
       {
         g_warning ("Container configuration file doesn't exist, ignoring container");
+
         g_free (container_config);
         g_free (container_config_file);
+
         continue;
       }
     }
@@ -532,6 +547,10 @@
       g_warning ("Error reading desktop configuration file: %s", 
                  error->message);
 
+      g_free (plugin_dir);
+      g_free (container_config);
+      g_free (container_config_file);
+
       g_error_free (error);
 
       continue;
@@ -547,6 +566,11 @@
       g_warning ("Error reading desktop configuration file: %s", 
                  error->message);
 
+      g_free (type);
+      g_free (plugin_dir);
+      g_free (container_config);
+      g_free (container_config_file);
+
       g_error_free (error);
 
       continue;
@@ -554,12 +578,15 @@
 
     if (!g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_HOME))
     {
-      container = g_object_new (HD_TYPE_HOME_WINDOW,
+      info = g_new0 (HDDesktopContainerInfo, 1);
+ 
+      info->container = g_object_new (HD_TYPE_HOME_WINDOW,
 #ifdef HAVE_LIBOSSO
-                                "osso-context", priv->osso_context,
+                                      "osso-context", priv->osso_context,
 #endif
-                                NULL);
-      hildon_home_window_applets_init (HILDON_HOME_WINDOW (container));
+                                      NULL);
+
+      hildon_home_window_applets_init (HILDON_HOME_WINDOW (info->container));
     }
     else if (!g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_PANEL_BOX) ||
  	     !g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_PANEL_EXPANDABLE))
@@ -578,6 +605,11 @@
         g_warning ("Error reading desktop configuration file: %s", 
                    error->message);
 
+        g_free (type);
+        g_free (plugin_dir);
+        g_free (container_config);
+        g_free (container_config_file);
+
         g_error_free (error);
 
         continue;
@@ -593,6 +625,11 @@
         g_warning ("Error reading desktop configuration file: %s", 
                    error->message);
 
+        g_free (type);
+        g_free (plugin_dir);
+        g_free (container_config);
+        g_free (container_config_file);
+
         g_error_free (error);
 
         continue;
@@ -608,6 +645,11 @@
         g_warning ("Error reading desktop configuration file: %s", 
                    error->message);
 
+        g_free (type);
+        g_free (plugin_dir);
+        g_free (container_config);
+        g_free (container_config_file);
+
         g_error_free (error);
 
         continue;
@@ -623,6 +665,11 @@
         g_warning ("Error reading desktop configuration file: %s", 
                    error->message);
 
+        g_free (type);
+        g_free (plugin_dir);
+        g_free (container_config);
+        g_free (container_config_file);
+
         g_error_free (error);
 
         continue;
@@ -638,6 +685,12 @@
         g_warning ("Error reading desktop configuration file: %s", 
                    error->message);
 
+        g_free (orientation_str);
+        g_free (type);
+        g_free (plugin_dir);
+        g_free (container_config);
+        g_free (container_config_file);
+
         g_error_free (error);
 
         continue;
@@ -654,30 +707,31 @@
       else 
         orientation = HILDON_DESKTOP_PANEL_WINDOW_ORIENTATION_LEFT;
 
+      info = g_new0 (HDDesktopContainerInfo, 1);
+ 
       if (!g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_PANEL_BOX))
       {
-        container = g_object_new (HD_TYPE_PANEL_WINDOW,
-                                  "x", x,
-                                  "y", y,
-                                  "width", width,
-                                  "height", height,
-                                  "orientation", orientation,
-                                   NULL);
+        info->container = g_object_new (HD_TYPE_PANEL_WINDOW,
+                                        "x", x,
+                                        "y", y,
+                                        "width", width,
+                                        "height", height,
+                                        "orientation", orientation,
+                                         NULL);
       }
-      else
-      if (!g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_PANEL_EXPANDABLE))
+      else if (!g_ascii_strcasecmp (type, HD_CONTAINER_TYPE_PANEL_EXPANDABLE))
       {
-        container = g_object_new (HD_TYPE_PANEL_WINDOW_DIALOG,
-                                 "x", x,
-                                 "y", y,
-                                 "width", width,
-                                 "height", height,
-                                 "orientation", orientation,
-                                 "padding-left", 10,
-                                 "padding-right", 10,
-                                 "padding-top", 0,
-                                 "padding-bottom", 0,
-                                  NULL);
+        info->container = g_object_new (HD_TYPE_PANEL_WINDOW_DIALOG,
+                                        "x", x,
+                                        "y", y,
+                                        "width", width,
+                                        "height", height,
+                                        "orientation", orientation,
+                                        "padding-left", 10,
+                                        "padding-right", 10,
+                                        "padding-top", 0,
+                                        "padding-bottom", 0,
+                                         NULL);
       }
 
       g_free (orientation_str);
@@ -691,48 +745,46 @@
       continue;
     }
 
-    hildon_desktop_window_set_config_file (HILDON_DESKTOP_WINDOW (container), 
-                                           container_config);
-
-    hildon_desktop_window_set_plugin_dir (HILDON_DESKTOP_WINDOW (container), 
-                                          plugin_dir);
-
-    g_signal_connect (G_OBJECT (container), 
+    info->config_file = g_strdup (container_config);
+    info->plugin_dir = g_strdup (plugin_dir);
+    info->desktop = desktop;
+    
+    g_signal_connect (G_OBJECT (info->container), 
                       "select-plugins",
                       G_CALLBACK (hd_desktop_select_plugins),
-                      desktop);
+                      info);
 
-    g_signal_connect (G_OBJECT (HILDON_DESKTOP_WINDOW (container)), 
+    g_signal_connect (G_OBJECT (HILDON_DESKTOP_WINDOW (info->container)), 
                       "save",
                       G_CALLBACK (hd_desktop_container_save),
-                      desktop);
+                      info);
 
-    g_signal_connect (G_OBJECT (HILDON_DESKTOP_WINDOW (container)), 
+    g_signal_connect (G_OBJECT (HILDON_DESKTOP_WINDOW (info->container)), 
                       "load",
                       G_CALLBACK (hd_desktop_container_load),
-                      desktop);
+                      info);
 
     hd_desktop_watch_file (container_config, 
                            hd_desktop_container_config_changed, 
-                           container);
+                           info->container);
 
     hd_desktop_watch_dir (plugin_dir, 
                           hd_desktop_plugin_dir_changed, 
-                          HILDON_DESKTOP_WINDOW (container));
+                          info);
 
-    g_hash_table_insert (priv->containers, container_config, container);
+    g_hash_table_insert (priv->containers, container_config, info);
 
     plugin_list = hd_desktop_plugin_list_from_conf (container_config);
 
     hd_plugin_manager_load (HD_PLUGIN_MANAGER (priv->pm), 
                             plugin_list, 
-                            HILDON_DESKTOP_WINDOW (container)->container);
+                            HILDON_DESKTOP_WINDOW (info->container)->container);
 
-    gtk_widget_show (container);
+    gtk_widget_show (info->container);
 
     g_free (type);
-    g_free (container_config);
     g_free (container_config_file);
+    g_free (plugin_dir);
     g_list_foreach (plugin_list, (GFunc) g_free , NULL);
     g_list_free (plugin_list);
   }
@@ -800,7 +852,11 @@
                          hd_desktop_config_changed, 
                          desktop);
 
-  desktop->priv->containers = g_hash_table_new (g_str_hash, g_str_equal); 
+  desktop->priv->containers = 
+          g_hash_table_new_full (g_str_hash, 
+	  		         g_str_equal,
+			         (GDestroyNotify) g_free,
+			         (GDestroyNotify) hd_desktop_free_container_info);
 
   desktop->priv->pm = hd_plugin_manager_new (); 
 }
@@ -823,9 +879,6 @@
 
   if (priv->containers)
   {
-    g_hash_table_foreach_remove (priv->containers, 
-                                 hd_desktop_destroy_container, 
-                                 NULL);
     g_hash_table_destroy (priv->containers);
     priv->containers = NULL;
   }


More information about the maemo-commits mailing list