[gnome-disk-utility/display-unmount-error-once: 4/4] Remove redundant error showing



commit f0a7acaf564981177b589b928843fe5ab985335e
Author: Kai Lüke <kailueke riseup net>
Date:   Tue Sep 11 18:27:58 2018 +0200

    Remove redundant error showing
    
    The gdu_*_ensure_unused machinery already
    displays the unmounting error. At many places
    in the UI (but not in every case) the error
    was shown again a second time.
    
    This error was discovered as part of
    https://gitlab.gnome.org/GNOME/gnome-disk-utility/issues/101

 src/disks/gdufilesystemdialog.c | 12 +-------
 src/disks/gduresizedialog.c     | 16 ++---------
 src/disks/gduwindow.c           | 64 +++--------------------------------------
 3 files changed, 7 insertions(+), 85 deletions(-)
---
diff --git a/src/disks/gdufilesystemdialog.c b/src/disks/gdufilesystemdialog.c
index a12d5c56..a89e40e5 100644
--- a/src/disks/gdufilesystemdialog.c
+++ b/src/disks/gdufilesystemdialog.c
@@ -118,18 +118,8 @@ ensure_unused_cb (UDisksObject *object,
                   gpointer      user_data)
 {
   EditFilesystemData *data = user_data;
-  GError *error = NULL;
 
-  if (!gdu_window_ensure_unused_finish (data->window,
-                                        res,
-                                        &error))
-    {
-      gdu_utils_show_error (GTK_WINDOW (data->window),
-                            _("Error unmounting filesystem"),
-                            error);
-      g_error_free (error);
-    }
-  else
+  if (gdu_window_ensure_unused_finish (data->window, res, NULL))
     {
       udisks_filesystem_call_set_label (data->filesystem,
                                         data->new_label,
diff --git a/src/disks/gduresizedialog.c b/src/disks/gduresizedialog.c
index 2cea4650..521fa5df 100644
--- a/src/disks/gduresizedialog.c
+++ b/src/disks/gduresizedialog.c
@@ -543,15 +543,9 @@ ensure_unused_cb_offline_next_repair (GObject      *source_object,
                                       gpointer      user_data)
 {
   ResizeDialogData *data = user_data;
-  GError *error = NULL;
 
-  if (!gdu_utils_ensure_unused_finish (data->client, res, &error))
+  if (!gdu_utils_ensure_unused_finish (data->client, res, NULL))
     {
-      gdu_utils_show_error (GTK_WINDOW (data->window),
-                            _("Error unmounting filesystem for repairing"),
-                            error);
-
-      g_error_free (error);
       resize_dialog_data_unref (data);
     }
   else
@@ -684,15 +678,9 @@ unmount_cb (GObject      *source_object,
             gpointer      user_data)
 {
   ResizeDialogData *data = user_data;
-  GError *error = NULL;
 
-  if (!gdu_utils_ensure_unused_finish (data->client, res, &error))
+  if (!gdu_utils_ensure_unused_finish (data->client, res, NULL))
     {
-      gdu_utils_show_error (GTK_WINDOW (data->window),
-                            _("Error unmounting filesystem for resizing"),
-                            error);
-
-      g_error_free (error);
       resize_dialog_data_unref (data);
     }
   else
diff --git a/src/disks/gduwindow.c b/src/disks/gduwindow.c
index fba5128d..3b43bc32 100644
--- a/src/disks/gduwindow.c
+++ b/src/disks/gduwindow.c
@@ -3200,18 +3200,8 @@ fs_repair_unmount_cb (GduWindow        *window,
                       gpointer          user_data)
 {
   UDisksObject *object = UDISKS_OBJECT (user_data);
-  GError *error = NULL;
 
-  if (!gdu_window_ensure_unused_finish (window,
-                                        res,
-                                        &error))
-    {
-      gdu_utils_show_error (GTK_WINDOW (window),
-                            _("Error unmounting filesystem"),
-                            error);
-      g_error_free (error);
-    }
-  else
+  if (gdu_window_ensure_unused_finish (window, res, NULL))
     {
       UDisksFilesystem *filesystem;
 
@@ -3328,18 +3318,8 @@ fs_check_unmount_cb (GduWindow        *window,
                      gpointer          user_data)
 {
   UDisksObject *object = UDISKS_OBJECT (user_data);
-  GError *error = NULL;
 
-  if (!gdu_window_ensure_unused_finish (window,
-                                        res,
-                                        &error))
-    {
-      gdu_utils_show_error (GTK_WINDOW (window),
-                            _("Error unmounting filesystem"),
-                            error);
-      g_error_free (error);
-    }
-  else
+  if (gdu_window_ensure_unused_finish (window, res, NULL))
     {
       UDisksFilesystem *filesystem;
 
@@ -3824,24 +3804,6 @@ on_mount_tool_button_clicked (GtkToolButton *button, gpointer user_data)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
-unmount_cb (GduWindow        *window,
-            GAsyncResult     *res,
-            gpointer          user_data)
-{
-  GError *error = NULL;
-
-  if (!gdu_window_ensure_unused_finish (window,
-                                        res,
-                                        &error))
-    {
-      gdu_utils_show_error (GTK_WINDOW (window),
-                            _("Error unmounting filesystem"),
-                            error);
-      g_error_free (error);
-    }
-}
-
 static void
 on_unmount_tool_button_clicked (GtkToolButton *button, gpointer user_data)
 {
@@ -3851,7 +3813,7 @@ on_unmount_tool_button_clicked (GtkToolButton *button, gpointer user_data)
   object = gdu_volume_grid_get_selected_device (GDU_VOLUME_GRID (window->volume_grid));
   gdu_window_ensure_unused (window,
                             object,
-                            (GAsyncReadyCallback) unmount_cb,
+                            NULL,
                             NULL,
                             NULL);
 }
@@ -4031,24 +3993,6 @@ on_unlock_tool_button_clicked (GtkToolButton *button, gpointer user_data)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
-lock_cb (GduWindow       *window,
-         GAsyncResult    *res,
-         gpointer         user_data)
-{
-  GError *error = NULL;
-
-  if (!gdu_window_ensure_unused_finish (window,
-                                        res,
-                                        &error))
-    {
-      gdu_utils_show_error (GTK_WINDOW (window),
-                            _("Error locking encrypted device"),
-                            error);
-      g_error_free (error);
-    }
-}
-
 static void
 on_lock_tool_button_clicked (GtkToolButton *button, gpointer user_data)
 {
@@ -4058,7 +4002,7 @@ on_lock_tool_button_clicked (GtkToolButton *button, gpointer user_data)
   object = gdu_volume_grid_get_selected_device (GDU_VOLUME_GRID (window->volume_grid));
   gdu_window_ensure_unused (window,
                             object,
-                            (GAsyncReadyCallback) lock_cb,
+                            NULL,
                             NULL, /* GCancellable */
                             NULL);
 }


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