add a shortcut to the user's Pictures folder.

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

	* app/widgets/gimpfiledialog.c (gimp_file_dialog_new): add a
	shortcut to the user's Pictures folder.

	* libgimpbase/xdg-user-dir.c: cosmetic changes.


svn path=/trunk/; revision=22478
This commit is contained in:
Sven Neumann 2007-05-13 17:18:35 +00:00 committed by Sven Neumann
parent 5f56f1e23d
commit 8d0e00d43f
3 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2007-05-13 Sven Neumann <sven@gimp.org>
* app/widgets/gimpfiledialog.c (gimp_file_dialog_new): add a
shortcut to the user's Pictures folder.
* libgimpbase/xdg-user-dir.c: cosmetic changes.
2007-05-13 Sven Neumann <sven@gimp.org>
* plug-ins/help/gimp-help-lookup.c: include libgimpbase/gimpbase.h.

View File

@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
@ -252,6 +253,7 @@ gimp_file_dialog_new (Gimp *gimp,
GSList *file_procs;
const gchar *automatic;
const gchar *automatic_help_id;
gchar *pictures;
gboolean local_only;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
@ -330,6 +332,15 @@ gimp_file_dialog_new (Gimp *gimp,
g_object_set_data (G_OBJECT (dialog), "gimp-dialog-help-button", button);
}
pictures = gimp_user_directory (GIMP_USER_DIRECTORY_PICTURES);
if (pictures)
{
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog),
pictures, NULL);
g_free (pictures);
}
gimp_file_dialog_add_preview (dialog, gimp);
gimp_file_dialog_add_filters (dialog, gimp, file_procs);

View File

@ -82,7 +82,7 @@ _xdg_user_dir_lookup (const gchar *type)
filename = g_build_filename (config_home, "user-dirs.dirs", NULL);
}
file = g_fopen (filename, "rb");
file = g_fopen (filename, "r");
g_free (filename);
@ -103,9 +103,11 @@ _xdg_user_dir_lookup (const gchar *type)
if (strncmp (p, "XDG_", 4) != 0)
continue;
p += 4;
if (strncmp (p, type, strlen (type)) != 0)
continue;
p += strlen (type);
if (strncmp (p, "_DIR", 4) != 0)
continue;
p += 4;