app/widgets/gimpfiledialog.c save some string copies by changing

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

	* app/widgets/gimpfiledialog.c
	* app/widgets/gimpthumbbox.[ch]: save some string copies by
	changing gimp_thumb_box_set_uri() to gimp_thumb_box_take_uri().


svn path=/trunk/; revision=21701
This commit is contained in:
Sven Neumann 2007-01-13 16:56:30 +00:00 committed by Sven Neumann
parent 0130da6786
commit fa8e72ba1d
4 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,9 @@
2007-01-13 Sven Neumann <sven@gimp.org>
* app/widgets/gimpfiledialog.c
* app/widgets/gimpthumbbox.[ch]: save some string copies by
changing gimp_thumb_box_set_uri() to gimp_thumb_box_take_uri().
2007-01-12 Sven Neumann <sven@gimp.org>
* plug-ins/common/compose.c

View File

@ -415,8 +415,7 @@ gimp_file_dialog_set_image (GimpFileDialog *dialog,
#ifndef G_OS_WIN32
dirname = g_path_get_dirname (uri);
#else
/* g_path_get_dirname() is supposed to work on pathnames, not
* URIs.
/* g_path_get_dirname() is supposed to work on pathnames, not URIs.
*
* If uri points to a file on the root of a drive
* "file:///d:/foo.png", g_path_get_dirname() would return
@ -434,25 +433,31 @@ gimp_file_dialog_set_image (GimpFileDialog *dialog,
*/
if (g_str_has_prefix (uri, "file:///"))
{
char *filepath, *dirpath = NULL;
gchar *filepath = g_filename_from_uri (uri, NULL, NULL);
gchar *dirpath = NULL;
filepath = g_filename_from_uri (uri, NULL, NULL);
if (filepath != NULL)
{
dirpath = g_path_get_dirname (filepath);
g_free (filepath);
}
if (dirpath != NULL)
{
dirname = g_filename_to_uri (dirpath, NULL, NULL);
g_free (dirpath);
}
else
dirname = NULL;
{
dirname = NULL;
}
}
else
dirname = g_path_get_dirname (uri);
{
dirname = g_path_get_dirname (uri);
}
#endif
basename = file_utils_uri_display_basename (uri);
if (dirname && strlen (dirname) && strcmp (dirname, "."))
@ -636,11 +641,8 @@ static void
gimp_file_dialog_update_preview (GtkFileChooser *chooser,
GimpFileDialog *dialog)
{
gchar *uri = gtk_file_chooser_get_preview_uri (chooser);
gimp_thumb_box_set_uri (GIMP_THUMB_BOX (dialog->thumb_box), uri);
g_free (uri);
gimp_thumb_box_take_uri (GIMP_THUMB_BOX (dialog->thumb_box),
gtk_file_chooser_get_preview_uri (chooser));
}
static void

View File

@ -443,8 +443,8 @@ gimp_thumb_box_new (GimpContext *context)
}
void
gimp_thumb_box_set_uri (GimpThumbBox *box,
const gchar *uri)
gimp_thumb_box_take_uri (GimpThumbBox *box,
gchar *uri)
{
g_return_if_fail (GIMP_IS_THUMB_BOX (box));
@ -454,7 +454,7 @@ gimp_thumb_box_set_uri (GimpThumbBox *box,
box->idle_id = 0;
}
gimp_object_set_name (GIMP_OBJECT (box->imagefile), uri);
gimp_object_take_name (GIMP_OBJECT (box->imagefile), uri);
if (uri)
{

View File

@ -59,8 +59,8 @@ GType gimp_thumb_box_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_thumb_box_new (GimpContext *context);
void gimp_thumb_box_set_uri (GimpThumbBox *box,
const gchar *uri);
void gimp_thumb_box_take_uri (GimpThumbBox *box,
gchar *uri);
void gimp_thumb_box_take_uris (GimpThumbBox *box,
GSList *uris);