diff --git a/thunar/thunar-browser.c b/thunar/thunar-browser.c index a6e5b805..c005c772 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 78e86074..cb79206b 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 c818cc0e..a2e154e5 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,