[gnome-disk-utility/udisks2-port] Show "Format Disk" for partitionable non-drive devices even if insensitive



commit 913e621bac9b378c9160b2fd404a56ead1426c57
Author: David Zeuthen <davidz redhat com>
Date:   Wed Nov 16 16:34:02 2011 -0500

    Show "Format Disk" for partitionable non-drive devices even if insensitive
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 src/palimpsest/gduwindow.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index 1793ed7..5bddc03 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -330,13 +330,18 @@ update_for_show_flags (GduWindow *window,
   gtk_widget_set_visible (GTK_WIDGET (window->generic_menu_item_format_disk), is_drive);
   gtk_widget_set_visible (GTK_WIDGET (window->generic_menu_item_drive_separator), is_drive);
 
-  /* except, if FORMAT_DISK is set (example: partitionable non-drive, e.g. /dev/loop0), then
-   * show the separator and the FORMAT_DISK item
+  /* except, if partitionable (example of partitionable non-drive
+   * device: /dev/loop0), then show the separator and the FORMAT_DISK
+   * item
    */
-  if (!is_drive && (show_flags & SHOW_FLAGS_POPUP_MENU_FORMAT_DISK))
+  if (!is_drive)
     {
-      gtk_widget_set_visible (GTK_WIDGET (window->generic_menu_item_format_disk), TRUE);
-      gtk_widget_set_visible (GTK_WIDGET (window->generic_menu_item_drive_separator), TRUE);
+      UDisksBlock *block = udisks_object_peek_block (window->current_object);
+      if (block != NULL && udisks_block_get_hint_partitionable (block))
+        {
+          gtk_widget_set_visible (GTK_WIDGET (window->generic_menu_item_format_disk), TRUE);
+          gtk_widget_set_visible (GTK_WIDGET (window->generic_menu_item_drive_separator), TRUE);
+        }
     }
 
   gtk_widget_set_sensitive (GTK_WIDGET (window->generic_menu_item_view_smart),



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