[gnome-disk-utility/wip/kailueke/no-xid: 1/2] Ignore the --xid option when formatting from Nautilus




commit 9f6571532c6b6f9c78f0ec4ce47ec3d0b178dba7
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 | 45 ++++++++++++++-------------------------------
 1 file changed, 14 insertions(+), 31 deletions(-)
---
diff --git a/src/disks/gduapplication.c b/src/disks/gduapplication.c
index 56518a1d..1358d179 100644
--- a/src/disks/gduapplication.c
+++ b/src/disks/gduapplication.c
@@ -172,7 +172,7 @@ gdu_application_object_from_block_device (GduApplication *app,
 static GOptionEntry opt_entries[] = {
     {"block-device", 0, 0, G_OPTION_ARG_STRING, NULL, N_("Select device"), "DEVICE" },
     {"format-device", 0, 0, G_OPTION_ARG_NONE, NULL, N_("Format selected device"), NULL },
-    {"xid", 0, 0, G_OPTION_ARG_INT, NULL, N_("Parent window XID for the format dialog"), "ID" },
+    {"xid", 0, 0, G_OPTION_ARG_INT, NULL, N_("Ignored, kept for compatibility"), "ID" },
     {"restore-disk-image", 0, 0, G_OPTION_ARG_FILENAME, NULL, N_("Restore disk image"), "FILE" },
     {NULL}
 };
@@ -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]