[Goodies-commits] r5188 - xfburn/trunk/xfburn

David Mohr squisher at xfce.org
Sun Aug 3 04:56:16 CEST 2008


Author: squisher
Date: 2008-08-03 02:56:16 +0000 (Sun, 03 Aug 2008)
New Revision: 5188

Modified:
   xfburn/trunk/xfburn/xfburn-device-box.c
   xfburn/trunk/xfburn/xfburn-main.c
Log:
Adding (disabled) code to umount mounted drives

Modified: xfburn/trunk/xfburn/xfburn-device-box.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-device-box.c	2008-08-02 17:41:57 UTC (rev 5187)
+++ xfburn/trunk/xfburn/xfburn-device-box.c	2008-08-03 02:56:16 UTC (rev 5188)
@@ -320,15 +320,15 @@
   priv->volume_changed_handlerid = g_signal_connect (G_OBJECT (xfburn_hal_manager_get_instance ()), "volume-changed", G_CALLBACK (cb_volumes_changed), box);
 #endif
 #ifdef HAVE_THUNAR_VFS
+  /*
   priv->thunar_volman = thunar_vfs_volume_manager_get_default ();
   if (priv->thunar_volman != NULL) {
-    /*
-    g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-added", G_CALLBACK (cb_volumes_changed), box);
-    g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-removed", G_CALLBACK (cb_volumes_changed), box);
-    */
+    //g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-added", G_CALLBACK (cb_volumes_changed), box);
+    //g_signal_connect (G_OBJECT (priv->thunar_volman), "volumes-removed", G_CALLBACK (cb_volumes_changed), box);
   } else {
     g_warning ("Error trying to access the thunar-vfs-volume-manager!");
   }
+  */
 #endif
 
   priv->have_asked_for_blanking = FALSE;
@@ -340,7 +340,7 @@
   XfburnDeviceBoxPrivate *priv = XFBURN_DEVICE_BOX_GET_PRIVATE (object);
 
 #ifdef HAVE_THUNAR_VFS
-  g_object_unref (priv->thunar_volman);
+  //g_object_unref (priv->thunar_volman);
 #endif
 #ifdef HAVE_HAL
   //g_object_unref (priv->hal_manager);

Modified: xfburn/trunk/xfburn/xfburn-main.c
===================================================================
--- xfburn/trunk/xfburn/xfburn-main.c	2008-08-02 17:41:57 UTC (rev 5187)
+++ xfburn/trunk/xfburn/xfburn-main.c	2008-08-03 02:56:16 UTC (rev 5188)
@@ -176,6 +176,61 @@
 
   xfburn_stock_init ();
   n_drives = xfburn_device_list_init ();
+#if 0
+#ifdef HAVE_THUNAR_VFS
+  if (n_drives < 3) {
+    //XfburnHalManager *halman = xfburn_hal_manager_get_instance();
+    ThunarVfsVolumeManager *volman;
+    GList *volume_list;
+    gboolean unmounted = FALSE;
+    gchar *mp_name;
+
+    volman = thunar_vfs_volume_manager_get_default();
+    volume_list = thunar_vfs_volume_manager_get_volumes (volman);
+
+    while (volume_list) {
+      ThunarVfsVolume *vol = THUNAR_VFS_VOLUME (volume_list->data);
+      ThunarVfsPath *mp;
+
+      switch (thunar_vfs_volume_get_kind (vol)) {
+        case THUNAR_VFS_VOLUME_KIND_CDROM:
+        case THUNAR_VFS_VOLUME_KIND_CDR:
+        case THUNAR_VFS_VOLUME_KIND_DVDROM:
+        case THUNAR_VFS_VOLUME_KIND_DVDRAM:
+        case THUNAR_VFS_VOLUME_KIND_DVDR:
+        case THUNAR_VFS_VOLUME_KIND_DVDRW:
+        case THUNAR_VFS_VOLUME_KIND_DVDPLUSR:
+        case THUNAR_VFS_VOLUME_KIND_DVDPLUSRW:
+        case THUNAR_VFS_VOLUME_KIND_AUDIO_CD:
+          if (thunar_vfs_volume_is_mounted (vol)) {
+            mp = thunar_vfs_volume_get_mount_point (vol);
+            mp_name = thunar_vfs_path_dup_string (mp);
+            if (thunar_vfs_volume_unmount (vol, NULL, NULL)) {
+              unmounted = TRUE;
+              g_message ("Unmounted drive %s", mp_name);
+            } else {
+              g_message ("Failed to unmounted drive %s", mp_name);
+            }
+            g_free (mp_name);
+          }
+          break;
+        default:
+          break;
+      }
+
+      volume_list = g_list_next (volume_list);
+    }
+
+    g_object_unref (volman);
+
+    if (unmounted)
+      n_drives = xfburn_device_list_init ();
+    else
+      g_debug ("Could not umount any optical drives.");
+  }
+#endif
+#endif
+
   if (n_drives < 1) {
     GtkMessageDialog *dialog = (GtkMessageDialog *) gtk_message_dialog_new (NULL,
                                     GTK_DIALOG_DESTROY_WITH_PARENT,




More information about the Goodies-commits mailing list