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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Feb 5 14:38:32 EET 2007
Author: lucasr
Date: 2007-02-05 14:38:31 +0200 (Mon, 05 Feb 2007)
New Revision: 9634

Modified:
   projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-default.c
   projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c
Log:
2007-02-05  Lucas Rocha  <lucas.rocha at nokia.com>

	* src/hd-plugin-loader-factory.c, src/hd-plugin-loader-default.c:
	small code improvements on internal registries.


Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-02-05 12:20:33 UTC (rev 9633)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/ChangeLog	2007-02-05 12:38:31 UTC (rev 9634)
@@ -1,3 +1,8 @@
+2007-02-05  Lucas Rocha  <lucas.rocha at nokia.com>
+
+	* src/hd-plugin-loader-factory.c, src/hd-plugin-loader-default.c:
+	small code improvements on internal registries.
+
 2007-02-05  Moises Martinez  <moises.martinez at nokia.com>
 
 	* src/hd-plugin-loader-legacy.c:

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-default.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-default.c	2007-02-05 12:20:33 UTC (rev 9633)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-default.c	2007-02-05 12:38:31 UTC (rev 9634)
@@ -153,14 +153,6 @@
   return objects;
 }
 
-static gboolean
-hd_plugin_loader_factory_free_module (gchar *key, GObject *object)
-{
-  g_free (key);
-
-  return TRUE;
-}
-
 static void
 hd_plugin_loader_default_finalize (GObject *loader)
 {
@@ -173,11 +165,8 @@
  
   if (priv->registry != NULL) 
   {
-    g_hash_table_foreach_remove (priv->registry, 
-                                 (GHRFunc) hd_plugin_loader_factory_free_module, 
-                                 NULL);
-
     g_hash_table_destroy (priv->registry);
+    priv->registry = NULL;
   }
 
   G_OBJECT_CLASS (hd_plugin_loader_default_parent_class)->finalize (loader);
@@ -188,7 +177,10 @@
 {
   loader->priv = HD_PLUGIN_LOADER_DEFAULT_GET_PRIVATE (loader);
 
-  loader->priv->registry = g_hash_table_new (g_str_hash, g_str_equal);
+  loader->priv->registry = g_hash_table_new_full (g_str_hash, 
+	  		                          g_str_equal,
+			                          (GDestroyNotify) g_free,
+			                          NULL);
 }
 
 static void

Modified: projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c
===================================================================
--- projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c	2007-02-05 12:20:33 UTC (rev 9633)
+++ projects/haf/branches/maemo-af-desktop/hildon-desktop/src/hd-plugin-loader-factory.c	2007-02-05 12:38:31 UTC (rev 9634)
@@ -114,7 +114,11 @@
 {
   factory->priv = HD_PLUGIN_LOADER_FACTORY_GET_PRIVATE (factory);
 
-  factory->priv->registry = g_hash_table_new (g_str_hash, g_str_equal);
+  factory->priv->registry =
+    g_hash_table_new_full (g_str_hash, 
+	  		   g_str_equal,
+			   (GDestroyNotify) g_free,
+			   (GDestroyNotify) g_object_unref);
   
   factory->priv->modules  = 
     g_hash_table_new_full (g_str_hash, 
@@ -125,24 +129,6 @@
   hd_plugin_loader_factory_load_modules (factory);
 }
 
-static gboolean
-hd_plugin_loader_factory_free_loader (gchar *key, GObject *object)
-{
-  g_free (key);
-  g_object_unref (object);
-
-  return TRUE;
-}
-
-static gboolean 
-hd_plugin_loader_factory_free_modules (gchar *key, GModule *module)
-{
-  g_free (key);
-  g_module_close (module);
-
-  return TRUE;
-}
-
 static void
 hd_plugin_loader_factory_finalize (GObject *object)
 {
@@ -155,16 +141,11 @@
  
   if (priv->registry != NULL) 
   {
-    g_hash_table_foreach_remove (priv->registry, 
-                                 (GHRFunc) hd_plugin_loader_factory_free_loader, 
-                                 NULL);
-
-    g_hash_table_foreach_remove (priv->registry, 
-                                 (GHRFunc) hd_plugin_loader_factory_free_modules, 
-                                 NULL);
- 
-
     g_hash_table_destroy (priv->registry);
+  }
+
+  if (priv->modules != NULL) 
+  {
     g_hash_table_destroy (priv->modules);
   }
 


More information about the maemo-commits mailing list