eeze_disk_cancel for canceling pending operations
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 16 May 2011 01:32:40 +0000 (01:32 +0000)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 16 May 2011 01:32:40 +0000 (01:32 +0000)
SVN revision: 59430

legacy/eeze/ChangeLog
legacy/eeze/src/lib/Eeze_Disk.h
legacy/eeze/src/lib/eeze_disk_mount.c

index ff98020..82b8467 100644 (file)
@@ -1,4 +1,7 @@
 2011-05-15  Mike Blumenkrantz (discomfitor/zmike)
++eeze_disk_cancel
+Cancel the current pending mount/umount operation on a disk
+-------------------------------------
 +EEZE_DISK_MOUNTOPT_UID
 Add a uid=%i mount option using getuid, NOT geteuid
 --------------------------------------
index fb9e9fc..2571e9e 100644 (file)
@@ -302,6 +302,15 @@ EAPI Eina_Bool      eeze_disk_mount(Eeze_Disk *disk);
 EAPI Eina_Bool      eeze_disk_unmount(Eeze_Disk *disk);
 
 /**
+ * @brief Cancel a pending operation on the disk
+ * @param disk The disk
+ *
+ * This function cancels the current pending operation on @p disk which was previously
+ * started with eeze_disk_mount or eeze_disk_unmount.
+ */
+EAPI void           eeze_disk_cancel(Eeze_Disk *disk);
+
+/**
  * @brief Return the mount point of a disk
  * @param disk The disk
  * @return The mount point
index 229c2d1..af059ae 100644 (file)
@@ -68,6 +68,8 @@ _eeze_disk_mount_result_handler(void *data __UNUSED__, int type __UNUSED__, Ecor
    eeze_events = eina_list_remove_list(eeze_events, l);
    if (disk->mount_status == EEZE_DISK_MOUNTING)
      {
+        disk->mount_status = EEZE_DISK_NULL;
+        disk->mounter = NULL;
         if (!ev->exit_code)
           { 
               e = malloc(sizeof(Eeze_Event_Disk_Mount));
@@ -97,6 +99,8 @@ _eeze_disk_mount_result_handler(void *data __UNUSED__, int type __UNUSED__, Ecor
           e = malloc(sizeof(Eeze_Event_Disk_Unmount));
           EINA_SAFETY_ON_NULL_RETURN_VAL(e, ECORE_CALLBACK_RENEW);
           e->disk = disk;
+          disk->mount_status = EEZE_DISK_NULL;
+          disk->mounter = NULL;
           ecore_event_add(EEZE_EVENT_DISK_UNMOUNT, e, NULL, NULL);
           break;
 
@@ -322,6 +326,15 @@ eeze_disk_unmount(Eeze_Disk *disk)
    return EINA_TRUE;
 }
 
+EAPI void
+eeze_disk_cancel(Eeze_Disk *disk)
+{
+   EINA_SAFETY_ON_NULL_RETURN(disk);
+   if ((!disk->mount_status) || (!disk->mounter)) return;
+   disk->mount_status = EEZE_DISK_NULL;
+   ecore_exe_quit(disk->mounter);
+}
+
 EAPI const char *
 eeze_disk_mount_point_get(Eeze_Disk *disk)
 {