gvfs r1153 - in trunk: . common



Author: alexl
Date: Mon Jan 21 10:49:58 2008
New Revision: 1153
URL: http://svn.gnome.org/viewvc/gvfs?rev=1153&view=rev

Log:
2008-01-21  Alexander Larsson  <alexl redhat com>

        * common/gmounttracker.c:
	Do the initial mount tracker call sync so that
	the volume monitor is populated with the current
	status after construction. This is more in-line
	with what apps expect.



Modified:
   trunk/ChangeLog
   trunk/common/gmounttracker.c

Modified: trunk/common/gmounttracker.c
==============================================================================
--- trunk/common/gmounttracker.c	(original)
+++ trunk/common/gmounttracker.c	Mon Jan 21 10:49:58 2008
@@ -373,18 +373,13 @@
 }
 
 static void
-list_mounts_reply (DBusPendingCall *pending,
-		   void            *_data)
+list_mounts_reply (GMountTracker *tracker,
+		   DBusMessage *reply)
 {
-  GMountTracker *tracker = _data;
   DBusMessageIter iter, array_iter;
   GMountInfo *info;
-  DBusMessage *reply;
   gboolean b;
 
-  reply = dbus_pending_call_steal_reply (pending);
-  dbus_pending_call_unref (pending);
-
   b = dbus_message_iter_init (reply, &iter);
   if (b && dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY)
     {
@@ -405,8 +400,6 @@
     {
       /* list_mounts_reply problem - gvfsd not running? */
     }
-  
-  dbus_message_unref (reply);
 }
 
 static DBusHandlerResult
@@ -452,7 +445,7 @@
 static void
 init_connection (GMountTracker *tracker)
 {
-  DBusMessage *message;
+  DBusMessage *message, *reply;
   DBusPendingCall *pending;
 
   if (tracker->connection == NULL)
@@ -468,19 +461,15 @@
   
   dbus_message_set_auto_start (message, TRUE);
   
-  if (!dbus_connection_send_with_reply (tracker->connection, message,
-					&pending,
-					G_VFS_DBUS_TIMEOUT_MSECS))
-    _g_dbus_oom ();
-  
+  reply = dbus_connection_send_with_reply_and_block (tracker->connection, message,
+						     G_VFS_DBUS_TIMEOUT_MSECS,
+						     NULL);
   dbus_message_unref (message);
   
-  if (pending != NULL)
+  if (reply != NULL)
     {
-      if (!dbus_pending_call_set_notify (pending,
-					 list_mounts_reply,
-					 g_object_ref (tracker), g_object_unref))
-	_g_dbus_oom ();
+      list_mounts_reply (tracker, reply);
+      dbus_message_unref (reply);
     }
   
   dbus_connection_add_filter (tracker->connection, g_mount_tracker_filter_func, tracker, NULL);



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