From 313f7835cb398a253167495572015db30f82afba Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 7 Feb 2005 17:29:10 +0000 Subject: [PATCH] changed "Remote Image" to "Remote File". The state of the thumbnail 2005-02-07 Sven Neumann * app/core/gimpimagefile.c (gimp_imagefile_get_desc_string): changed "Remote Image" to "Remote File". The state of the thumbnail doesn't tell us if this is an image file at all. * app/widgets/gimpthumbbox.c: don't auto-thumbnail remote files. * libgimpthumb/gimpthumb-utils.[ch] * libgimpthumb/gimpthumbnail.c: do the same workaround for UNC paths as in file_utils_filename_from_uri(). --- ChangeLog | 12 +++++++++++ app/core/gimpimagefile.c | 2 +- app/widgets/gimpfiledialog.c | 7 +++--- app/widgets/gimpthumbbox.c | 3 +++ libgimpthumb/gimpthumb-utils.c | 39 ++++++++++++++++++++++++++++++++-- libgimpthumb/gimpthumb-utils.h | 1 + libgimpthumb/gimpthumbnail.c | 6 +++--- 7 files changed, 61 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f15b6a315..0831d03683 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-02-07 Sven Neumann + + * app/core/gimpimagefile.c (gimp_imagefile_get_desc_string): + changed "Remote Image" to "Remote File". The state of the + thumbnail doesn't tell us if this is an image file at all. + + * app/widgets/gimpthumbbox.c: don't auto-thumbnail remote files. + + * libgimpthumb/gimpthumb-utils.[ch] + * libgimpthumb/gimpthumbnail.c: do the same workaround for UNC + paths as in file_utils_filename_from_uri(). + 2005-02-07 Michael Natterer * plug-ins/uri/uri-backend.h: added backend methods diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c index ded102dcf1..0db00391b8 100644 --- a/app/core/gimpimagefile.c +++ b/app/core/gimpimagefile.c @@ -565,7 +565,7 @@ gimp_imagefile_get_desc_string (GimpImagefile *imagefile) break; case GIMP_THUMB_STATE_REMOTE: - imagefile->description = _("Remote image"); + imagefile->description = _("Remote File"); imagefile->static_desc = TRUE; break; diff --git a/app/widgets/gimpfiledialog.c b/app/widgets/gimpfiledialog.c index 57998c1dd2..54aada78d2 100644 --- a/app/widgets/gimpfiledialog.c +++ b/app/widgets/gimpfiledialog.c @@ -317,9 +317,10 @@ gimp_file_dialog_new (Gimp *gimp, } dialog = g_object_new (GIMP_TYPE_FILE_DIALOG, - "title", title, - "role", role, - "action", action, + "title", title, + "role", role, + "action", action, + "local-only", FALSE, NULL); gtk_dialog_add_buttons (GTK_DIALOG (dialog), diff --git a/app/widgets/gimpthumbbox.c b/app/widgets/gimpthumbbox.c index c97eeeb37e..00ab032782 100644 --- a/app/widgets/gimpthumbbox.c +++ b/app/widgets/gimpthumbbox.c @@ -535,6 +535,9 @@ gimp_thumb_box_thumb_state_notify (GimpThumbnail *thumb, if (box->idle_id) return; + if (thumb->image_state == GIMP_THUMB_STATE_REMOTE) + return; + switch (thumb->thumb_state) { case GIMP_THUMB_STATE_NOT_FOUND: diff --git a/libgimpthumb/gimpthumb-utils.c b/libgimpthumb/gimpthumb-utils.c index e530fe3704..960723a84f 100644 --- a/libgimpthumb/gimpthumb-utils.c +++ b/libgimpthumb/gimpthumb-utils.c @@ -358,7 +358,7 @@ gimp_thumb_name_from_uri_local (const gchar *uri, if (strstr (uri, thumb_dir)) return NULL; - filename = g_filename_from_uri (uri, NULL, NULL); + filename = _gimp_thumb_filename_from_uri (uri); if (filename) { @@ -419,7 +419,7 @@ gimp_thumb_find_thumb (const gchar *uri, if (! result) { - gchar *filename = g_filename_from_uri (uri, NULL, NULL); + gchar *filename = _gimp_thumb_filename_from_uri (uri); if (filename) { @@ -576,6 +576,41 @@ _gimp_thumbs_delete_others (const gchar *uri, } } +gchar * +_gimp_thumb_filename_from_uri (const gchar *uri) +{ + gchar *filename; + gchar *hostname; + + g_return_val_if_fail (uri != NULL, NULL); + + filename = g_filename_from_uri (uri, &hostname, NULL); + + if (!filename) + return NULL; + + if (hostname) + { + /* we have a file: URI with a hostname */ + +#ifdef G_OS_WIN32 + /* on Win32, create a valid UNC path and use it as the filename */ + gchar *tmp = g_build_filename ("//", hostname, filename, NULL); + + g_free (filename); + filename = tmp; +#else + /* otherwise return NULL, caller should use URI then */ + g_free (filename); + filename = NULL; +#endif + + g_free (hostname); + } + + return filename; +} + static void gimp_thumb_exit (void) { diff --git a/libgimpthumb/gimpthumb-utils.h b/libgimpthumb/gimpthumb-utils.h index 8010d3013d..94eddc1b8a 100644 --- a/libgimpthumb/gimpthumb-utils.h +++ b/libgimpthumb/gimpthumb-utils.h @@ -60,6 +60,7 @@ void gimp_thumbs_delete_for_uri_local (const gchar *uri); /* for internal use only */ void _gimp_thumbs_delete_others (const gchar *uri, GimpThumbSize size); +gchar * _gimp_thumb_filename_from_uri (const gchar *uri); G_END_DECLS diff --git a/libgimpthumb/gimpthumbnail.c b/libgimpthumb/gimpthumbnail.c index 1fdfab8962..b12b185a3c 100644 --- a/libgimpthumb/gimpthumbnail.c +++ b/libgimpthumb/gimpthumbnail.c @@ -639,8 +639,8 @@ gimp_thumbnail_update_image (GimpThumbnail *thumbnail) case GIMP_THUMB_STATE_UNKNOWN: g_return_if_fail (thumbnail->image_filename == NULL); - thumbnail->image_filename = g_filename_from_uri (thumbnail->image_uri, - NULL, NULL); + thumbnail->image_filename = + _gimp_thumb_filename_from_uri (thumbnail->image_uri); if (! thumbnail->image_filename) state = GIMP_THUMB_STATE_REMOTE; @@ -1212,7 +1212,7 @@ gimp_thumbnail_save_thumb_local (GimpThumbnail *thumbnail, if (size < 1) return TRUE; - filename = g_filename_from_uri (thumbnail->image_uri, NULL, NULL); + filename = _gimp_thumb_filename_from_uri (thumbnail->image_uri); if (! filename) return TRUE;