[gnome-disk-utility/gnome-3-38] Ignore the --xid option when formatting from Nautilus



commit 79af8766e7cd79033bd06869accbc879e42c9f96
Author: Kai Lüke <kailueke riseup net>
Date:   Sun Feb 7 23:35:45 2021 +0100

    Ignore the --xid option when formatting from Nautilus
    
    The --format-device option required the --xid option to be set because
    under X11 the idea was that GNOME Disks provides a dialog on top of
    Nautilus. However, the integration wasn't really good because it lacked
    any progress and error reporting. Under Wayland it was finally
    completely broken to have GNOME Disks provide a dialog for Nautilus.
    Instead, we opened the app in the regular way and displayed the dialog
    there as usual which has the benefit of seeing the job state.
    Do the same now under X11 by just ignoring the --xid option.

 src/disks/gduapplication.c | 43 +++++++++++++------------------------------
 1 file changed, 13 insertions(+), 30 deletions(-)
---
diff --git a/src/disks/gduapplication.c b/src/disks/gduapplication.c
index b904ac72..d4507269 100644
--- a/src/disks/gduapplication.c
+++ b/src/disks/gduapplication.c
@@ -195,14 +195,12 @@ gdu_application_command_line (GApplication            *_app,
   gchar *error_message = NULL;
   gboolean opt_format = FALSE;
   const gchar *opt_restore_disk_image = NULL;
-  gint opt_xid = -1;
   GVariantDict *options;
 
   options = g_application_command_line_get_options_dict (command_line);
 
   g_variant_dict_lookup (options, "block-device", "&s", &opt_block_device);
   g_variant_dict_lookup (options, "format-device", "b", &opt_format);
-  g_variant_dict_lookup (options, "xid", "i", &opt_xid);
   g_variant_dict_lookup (options, "restore-disk-image", "^&ay", &opt_restore_disk_image);
  
   if (opt_format && opt_block_device == NULL)
@@ -211,12 +209,6 @@ gdu_application_command_line (GApplication            *_app,
       goto out;
     }
 
-  if (opt_xid != -1 && !opt_format)
-    {
-      g_application_command_line_printerr (command_line, _("--format-device must be specified when using 
--xid\n"));
-      goto out;
-    }
-
   gdu_application_ensure_client (app);
 
   if (opt_block_device != NULL)
@@ -241,31 +233,22 @@ gdu_application_command_line (GApplication            *_app,
         }
     }
 
-  if (opt_xid == -1)
+  if (app->window == NULL)
     {
-      if (app->window == NULL)
-        {
-          g_application_activate (G_APPLICATION (app));
-        }
-      else
-        {
-          /* TODO: startup notification stuff */
-          gtk_window_present (GTK_WINDOW (app->window));
-        }
-
-      if (object_to_select != NULL)
-        {
-          gdu_window_select_object (app->window, object_to_select);
-          if (opt_format)
-            gdu_create_format_show (app->client, GTK_WINDOW (app->window), object_to_select,
-                                    FALSE, 0, 0, NULL, NULL);
-        }
+      g_application_activate (G_APPLICATION (app));
     }
-  else if (opt_format)
+  else
+    {
+      /* TODO: startup notification stuff */
+      gtk_window_present (GTK_WINDOW (app->window));
+    }
+
+  if (object_to_select != NULL)
     {
-      g_application_hold (_app);
-      gdu_create_format_show (app->client, NULL, object_to_select,
-                              FALSE, 0, 0, (GCallback) g_application_release, _app);
+      gdu_window_select_object (app->window, object_to_select);
+      if (opt_format)
+        gdu_create_format_show (app->client, GTK_WINDOW (app->window), object_to_select,
+                                FALSE, 0, 0, NULL, NULL);
     }
 
   if (opt_restore_disk_image != NULL)


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