diff options
author | rbuj <[email protected]> | 2020-08-31 10:53:21 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-09-05 16:53:47 +0200 |
commit | 545aa50c558a85d5b718a6ebe0c06538331af74a (patch) | |
tree | f3758aefe0462f5f4b333ee7a98f6e1aabd8b193 | |
parent | b340338baf81a74d20f09a00fb715a7d2c0add5e (diff) | |
download | caja-545aa50c558a85d5b718a6ebe0c06538331af74a.tar.bz2 caja-545aa50c558a85d5b718a6ebe0c06538331af74a.tar.xz |
fm-directory-view: Error message when a link could not be created
-rw-r--r-- | libcaja-private/caja-link.c | 5 | ||||
-rw-r--r-- | libcaja-private/caja-link.h | 3 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 31 |
3 files changed, 28 insertions, 11 deletions
diff --git a/libcaja-private/caja-link.c b/libcaja-private/caja-link.c index 232ee213..d0677731 100644 --- a/libcaja-private/caja-link.c +++ b/libcaja-private/caja-link.c @@ -197,7 +197,8 @@ caja_link_local_create (const char *directory_uri, const char *target_uri, const GdkPoint *point, int screen, - gboolean unique_filename) + gboolean unique_filename, + GError **error) { char *real_directory_uri; char *contents; @@ -274,7 +275,7 @@ caja_link_local_create (const char *directory_uri, contents, strlen (contents), NULL, FALSE, G_FILE_CREATE_NONE, - NULL, NULL, NULL)) + NULL, NULL, error)) { g_free (contents); g_object_unref (file); diff --git a/libcaja-private/caja-link.h b/libcaja-private/caja-link.h index a4752d57..9f62bf63 100644 --- a/libcaja-private/caja-link.h +++ b/libcaja-private/caja-link.h @@ -34,7 +34,8 @@ gboolean caja_link_local_create (const char const char *target_uri, const GdkPoint *point, int screen, - gboolean unique_filename); + gboolean unique_filename, + GError **error); gboolean caja_link_local_set_text (const char *uri, const char *text); gboolean caja_link_local_set_icon (const char *uri, diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index bb0963fc..ad10b01a 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -10732,6 +10732,8 @@ fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view, GdkScreen *screen; int screen_num; char *link_display_name; + GError *error = NULL; + gboolean success; link_display_name = g_strdup_printf (_("Link to %s"), link_name); @@ -10745,14 +10747,27 @@ fm_directory_view_handle_netscape_url_drop (FMDirectoryView *view, screen = gtk_widget_get_screen (GTK_WIDGET (view)); screen_num = gdk_x11_screen_get_screen_number (screen); - caja_link_local_create (target_uri != NULL ? target_uri : container_uri, - link_name, - link_display_name, - "mate-fs-bookmark", - url, - &point, - screen_num, - TRUE); + success = caja_link_local_create (target_uri != NULL ? target_uri : container_uri, + link_name, + link_display_name, + "mate-fs-bookmark", + url, + &point, + screen_num, + TRUE, + &error); + if (!success) { + if (error) { + eel_show_error_dialog (_("Link Creation Failed"), + error->message, NULL); + g_error_free (error); + } else { + gchar *error_message = g_strdup_printf (_("Cannot create the link to %s"), url); + eel_show_error_dialog (_("Link Creation Failed"), + error_message, NULL); + g_free (error_message); + } + } g_free (link_display_name); } |