Commit d4249a10 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/app_procs.c moved code from app_procs.c to file-utils.

2007-01-19  Sven Neumann  <sven@gimp.org>

	* app/app_procs.c
	* app/file/file-utils.[ch]: moved code from app_procs.c to file-utils.


svn path=/trunk/; revision=21735
parent ed5a5685
2007-01-19 Sven Neumann <sven@gimp.org>
* app/app_procs.c
* app/file/file-utils.[ch]: moved code from app_procs.c to file-utils.
2007-01-19 Raphaël Quinet <raphael@gimp.org>
* app/tools/gimpiscissorstool.h
* app/tools/gimpiscissorstool.c: Added some status bar messages.
* app/tools/gimpiscissorstool.[ch]: Added some status bar messages.
Use ISCISSORS_OP_CONNECT to let the user know when the cursor is
above the first point and the user can connect and close the
curve. Allow the user to press Enter or Escape to confirm the
......
......@@ -262,28 +262,10 @@ app_run (const gchar *full_prog_name,
GError *error = NULL;
gchar *uri;
/* first try if we got a file uri */
uri = g_filename_from_uri (filenames[i], NULL, NULL);
uri = file_utils_any_to_uri (gimp->plug_in_manager->load_procs,
filenames[i], &error);
if (uri)
{
g_free (uri);
uri = g_strdup (filenames[i]);
}
else
{
uri =
file_utils_filename_to_uri (gimp->plug_in_manager->load_procs,
filenames[i], &error);
}
if (! uri)
{
g_printerr ("conversion filename -> uri failed: %s\n",
error->message);
g_clear_error (&error);
}
else
{
GimpImage *image;
GimpPDBStatusType status;
......@@ -307,6 +289,12 @@ app_run (const gchar *full_prog_name,
g_free (uri);
}
else
{
g_printerr ("conversion filename -> uri failed: %s\n",
error->message);
g_clear_error (&error);
}
}
}
......
......@@ -110,6 +110,7 @@ file_utils_filename_to_uri (GSList *procs,
g_return_val_if_fail (procs != NULL, NULL);
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* check for prefixes like http or ftp */
if (file_proc_find_by_prefix (procs, filename, FALSE))
......@@ -170,6 +171,34 @@ file_utils_filename_to_uri (GSList *procs,
return uri;
}
gchar *
file_utils_any_to_uri (GSList *procs,
const gchar *filename_or_uri,
GError **error)
{
gchar *uri;
g_return_val_if_fail (procs != NULL, NULL);
g_return_val_if_fail (filename_or_uri != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* first try if we got a file uri */
uri = g_filename_from_uri (filename_or_uri, NULL, NULL);
if (uri)
{
g_free (uri);
uri = g_strdup (filename_or_uri);
}
else
{
uri = file_utils_filename_to_uri (procs, filename_or_uri, error);
}
return uri;
}
/**
* file_utils_filename_from_uri:
* @uri: a URI
......
......@@ -28,6 +28,9 @@
gchar * file_utils_filename_to_uri (GSList *procs,
const gchar *filename,
GError **error);
gchar * file_utils_any_to_uri (GSList *procs,
const gchar *filename_or_uri,
GError **error);
gchar * file_utils_filename_from_uri (const gchar *uri);
gchar * file_utils_uri_to_utf8_filename (const gchar *uri);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment