[gnome-settings-daemon/mount-plugin: 5/13] Mount unmounted volumes at startup



commit 78a90cb76e962e4f97d3861143ef7b48814fa416
Author: Ross Burton <ross linux intel com>
Date:   Mon Jul 6 20:02:53 2009 +0100

    Mount unmounted volumes at startup

 plugins/mount/gsd-mount-manager.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/plugins/mount/gsd-mount-manager.c b/plugins/mount/gsd-mount-manager.c
index 0184f96..d1e81ac 100644
--- a/plugins/mount/gsd-mount-manager.c
+++ b/plugins/mount/gsd-mount-manager.c
@@ -111,6 +111,35 @@ mount_added_cb (GVolumeMonitor *monitor,
         g_object_unref (file);
 }
 
+static void
+mount_existing_volumes (GsdMountManager *manager)
+{
+        /* TODO: iterate over drives to hook up eject */
+        GList *l;
+
+        l = g_volume_monitor_get_volumes (manager->priv->monitor);
+        while (l) {
+                GVolume *volume = l->data;
+                GMount *mount;
+
+                mount = g_volume_get_mount (volume);
+                if (mount == NULL &&
+                    g_volume_can_mount (volume) &&
+                    g_volume_should_automount (volume)) {
+                        GMountOperation *mount_op;
+                        mount_op = gtk_mount_operation_new (NULL);
+                        g_volume_mount (volume, G_MOUNT_MOUNT_NONE,
+                                        mount_op, NULL,
+                                        volume_mounted_cb, manager);
+                }
+
+                if (mount)
+                        g_object_unref (mount);
+                g_object_unref (volume);
+                l = g_list_delete_link (l, l);
+        }
+}
+
 gboolean
 gsd_mount_manager_start (GsdMountManager *manager,
                                GError               **error)
@@ -129,6 +158,8 @@ gsd_mount_manager_start (GsdMountManager *manager,
 				 G_CALLBACK (mount_added_cb), manager, 0);
 
         /* TODO: handle eject buttons */
+
+        mount_existing_volumes (manager);
         return TRUE;
 }
 



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