[Xfce4-commits] [xfce/thunar] 03/06: Deactivate spinner when user cancels volume mount (Bug #14536)

noreply at xfce.org noreply at xfce.org
Wed Jul 18 22:07:31 CEST 2018


This is an automated email from the git hooks/post-receive script.

a   l   e   x       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       x   f   c   e   -   4   .   1   4   
   in repository xfce/thunar.

commit a5b9d1c1a3a363f2551e36bc3fa7b36ea2a05137
Author: Andre Miranda <andreldm at xfce.org>
Date:   Sun Jul 15 11:30:16 2018 -0300

    Deactivate spinner when user cancels volume mount (Bug #14536)
---
 thunar/thunar-browser.c        | 33 ++++++++++++++++++++-------------
 thunar/thunar-browser.h        |  3 ++-
 thunar/thunar-shortcuts-view.c |  9 +++++++--
 3 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/thunar/thunar-browser.c b/thunar/thunar-browser.c
index a6e5b80..c005c77 100644
--- a/thunar/thunar-browser.c
+++ b/thunar/thunar-browser.c
@@ -547,7 +547,7 @@ thunar_browser_poke_device_file_finish (GFile      *location,
   if (poke_data->func != NULL)
     {
       (poke_data->func) (poke_data->browser, poke_data->device, file, error,
-                         poke_data->user_data);
+                         poke_data->user_data, FALSE);
     }
 
   thunar_browser_poke_device_data_free (poke_data);
@@ -561,7 +561,8 @@ thunar_browser_poke_device_finish (ThunarDevice *device,
                                    gpointer      user_data)
 {
   PokeDeviceData *poke_data = user_data;
-  GFile          *mount_point;
+  GFile          *mount_point = NULL;
+  gboolean        cancelled = FALSE;
 
   _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
   _thunar_return_if_fail (user_data != NULL);
@@ -570,9 +571,15 @@ thunar_browser_poke_device_finish (ThunarDevice *device,
   _thunar_return_if_fail (device == poke_data->device);
 
   if (error == NULL)
-    {
-      mount_point = thunar_device_get_root (device);
+    mount_point = thunar_device_get_root (device);
 
+  if (mount_point == NULL)
+    {
+      /* mount_point is NULL when user dismisses the authentication dialog */
+      cancelled = TRUE;
+    }
+  else
+    {
       /* resolve the ThunarFile for the mount point asynchronously
        * and defer cleaning up the poke data until that has finished */
       thunar_file_get_async (mount_point, NULL,
@@ -580,17 +587,17 @@ thunar_browser_poke_device_finish (ThunarDevice *device,
                              poke_data);
 
       g_object_unref (mount_point);
-    }
-  else
-    {
-      if (poke_data->func != NULL)
-        {
-          (poke_data->func) (poke_data->browser, poke_data->device, NULL, (GError *) error,
-                             poke_data->user_data);
-        }
 
-      thunar_browser_poke_device_data_free (poke_data);
+      return;
     }
+
+    if (poke_data->func != NULL)
+      {
+        (poke_data->func) (poke_data->browser, poke_data->device, NULL,
+                           (GError *) error, poke_data->user_data, cancelled);
+      }
+
+    thunar_browser_poke_device_data_free (poke_data);
 }
 
 
diff --git a/thunar/thunar-browser.h b/thunar/thunar-browser.h
index 78e8607..cb79206 100644
--- a/thunar/thunar-browser.h
+++ b/thunar/thunar-browser.h
@@ -44,7 +44,8 @@ typedef void (*ThunarBrowserPokeDeviceFunc)   (ThunarBrowser *browser,
                                                ThunarDevice  *volume,
                                                ThunarFile    *mount_point,
                                                GError        *error,
-                                               gpointer       user_data);
+                                               gpointer       user_data,
+                                               gboolean       cancelled);
 
 typedef void (*ThunarBrowserPokeLocationFunc) (ThunarBrowser *browser,
                                                GFile         *location,
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index c818cc0..a2e154e 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -1717,7 +1717,8 @@ thunar_shortcuts_view_poke_device_finish (ThunarBrowser *browser,
                                           ThunarDevice  *device,
                                           ThunarFile    *mount_point,
                                           GError        *error,
-                                          gpointer       user_data)
+                                          gpointer       user_data,
+                                          gboolean       cancelled)
 {
   gchar        *device_name;
   GtkTreeModel *model;
@@ -1726,7 +1727,11 @@ thunar_shortcuts_view_poke_device_finish (ThunarBrowser *browser,
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_VIEW (browser));
   _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
 
-  if (error == NULL)
+  if (cancelled)
+    {
+      /* do nothing */
+    }
+  else if (error == NULL)
     {
       thunar_browser_poke_file (browser, mount_point, GTK_WIDGET (browser),
                                 thunar_shortcuts_view_poke_file_finish,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list