gnome-system-tools r4100 - in trunk/src/shares: . nautilus



Author: carlosg
Date: Sun Jan 13 16:18:05 2008
New Revision: 4100
URL: http://svn.gnome.org/viewvc/gnome-system-tools?rev=4100&view=rev

Log:
2008-01-13  Carlos Garnacho  <carlosg gnome org>

        * nautilus/nautilus-shares.c (nautilus_shares_init)
        (on_shares_changed) (share_object_updated): Update configuration
        objects asynchronously, Fixes #498407.
        (update_shares_path): use g_hash_table_remove_all() to remove paths.


Modified:
   trunk/src/shares/ChangeLog
   trunk/src/shares/nautilus/nautilus-shares.c

Modified: trunk/src/shares/nautilus/nautilus-shares.c
==============================================================================
--- trunk/src/shares/nautilus/nautilus-shares.c	(original)
+++ trunk/src/shares/nautilus/nautilus-shares.c	Sun Jan 13 16:18:05 2008
@@ -212,28 +212,34 @@
     }
 }
 
-static gboolean
-return_true (gpointer key, gpointer value, gpointer data)
-{
-  return TRUE;
-}
-
 static void
 update_shared_paths (NautilusShares *shares)
 {
   /* clean up the paths */
-  g_hash_table_foreach_remove (shares->paths, return_true, NULL);
+  g_hash_table_remove_all (shares->paths);
 
   add_paths (shares->paths, oobs_smb_config_get_shares (OOBS_SMB_CONFIG (shares->smb_config)));
   add_paths (shares->paths, oobs_nfs_config_get_shares (OOBS_NFS_CONFIG (shares->nfs_config)));
 }
 
 static void
+share_object_updated (OobsObject *object,
+		      OobsResult  result,
+		      gpointer    user_data)
+{
+  NautilusShares *shares;
+
+  shares = NAUTILUS_SHARES (user_data);
+  update_shared_paths (shares);
+}
+
+static void
 on_shares_changed (OobsObject     *object,
 		   NautilusShares *shares)
 {
-  oobs_object_update (object);
-  update_shared_paths (shares);
+  oobs_object_update_async (object,
+			    share_object_updated,
+			    shares);
 }
 
 static void
@@ -244,17 +250,19 @@
 
   if (oobs_session_get_connected (shares->session))
     {
-      /* FIXME: should monitor connected state */
       shares->smb_config = oobs_smb_config_get ();
       g_signal_connect (G_OBJECT (shares->smb_config), "changed",
 			G_CALLBACK (on_shares_changed), shares);
+      oobs_object_update_async (shares->smb_config,
+				share_object_updated,
+				shares);
 
       shares->nfs_config = oobs_nfs_config_get ();
       g_signal_connect (G_OBJECT (shares->nfs_config), "changed",
 			G_CALLBACK (on_shares_changed), shares);
-
-      /* fill the hash table */
-      update_shared_paths (shares);
+      oobs_object_update_async (shares->nfs_config,
+				share_object_updated,
+				shares);
     }
 }
 



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