[gvfs] udisks2: Show "Eject Anyway" (not "Unmount Anyway") if ejecting



commit 3ac0a803e4fe58a4ac1b82a5770468c6801e93ab
Author: David Zeuthen <davidz redhat com>
Date:   Tue May 15 12:52:08 2012 -0400

    udisks2: Show "Eject Anyway" (not "Unmount Anyway") if ejecting
    
    ... instead of unmounting.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 monitor/udisks2/gvfsudisks2drive.c |    7 +++++++
 monitor/udisks2/gvfsudisks2mount.c |   13 ++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/monitor/udisks2/gvfsudisks2drive.c b/monitor/udisks2/gvfsudisks2drive.c
index da09548..87747ac 100644
--- a/monitor/udisks2/gvfsudisks2drive.c
+++ b/monitor/udisks2/gvfsudisks2drive.c
@@ -646,6 +646,13 @@ gvfs_udisks2_drive_eject_with_operation (GDrive              *_drive,
 {
   GVfsUDisks2Drive *drive = GVFS_UDISKS2_DRIVE (_drive);
 
+  /* This information is needed in GVfsDdisks2Volume when apps have
+   * open files on the device ... we need to know if the button should
+   * be "Unmount Anyway" or "Eject Anyway"
+   */
+  if (mount_operation != NULL)
+    g_object_set_data (G_OBJECT (mount_operation), "x-udisks2-is-eject", GINT_TO_POINTER (1));
+
   /* first we need to go through all the volumes and unmount their assoicated mounts (if any) */
   unmount_mounts (drive,
                   flags,
diff --git a/monitor/udisks2/gvfsudisks2mount.c b/monitor/udisks2/gvfsudisks2mount.c
index e882ba8..cf3b29a 100644
--- a/monitor/udisks2/gvfsudisks2mount.c
+++ b/monitor/udisks2/gvfsudisks2mount.c
@@ -691,6 +691,10 @@ lsof_command_cb (GObject       *source_object,
  out:
   if (!data->completed)
     {
+      gboolean is_eject;
+
+      is_eject = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (data->mount_operation), "x-udisks2-is-eject"));
+
       /* We want to emit the 'show-processes' signal even if launching
        * lsof(1) failed or if it didn't return any PIDs. This is because
        * it won't show e.g. root-owned processes operating on files
@@ -705,7 +709,14 @@ lsof_command_cb (GObject       *source_object,
                                                               G_CALLBACK (on_mount_op_reply),
                                                               data);
         }
-      choices[0] = _("Unmount Anyway");
+      if (is_eject)
+        {
+          choices[0] = _("Eject Anyway");
+        }
+      else
+        {
+          choices[0] = _("Unmount Anyway");
+        }
       choices[1] = _("Cancel");
       message = _("Volume is busy\n"
                   "One or more applications are keeping the volume busy.");



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