mirror of https://github.com/GNOME/gimp.git
libgimpbase, app: add variants of gimp_$foo_directory() which return GFiles
gimp_directory_file(), gimp_data_directory_file() etc. The new functions take a variable list of path elements to the file, the list has to be NULL-terminated. Remove the newly added gimp_personal_rc_gfile(). Start using the new functions in app/.
This commit is contained in:
parent
b328bd3087
commit
b03d69dd40
|
@ -79,7 +79,7 @@ gimp_contexts_load (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
file = gimp_personal_rc_gfile ("contextrc");
|
||||
file = gimp_directory_file ("contextrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -116,7 +116,7 @@ gimp_contexts_save (Gimp *gimp,
|
|||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
file = gimp_personal_rc_gfile ("contextrc");
|
||||
file = gimp_directory_file ("contextrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -142,7 +142,7 @@ gimp_contexts_clear (Gimp *gimp,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
|
||||
file = gimp_personal_rc_gfile ("contextrc");
|
||||
file = gimp_directory_file ("contextrc", NULL);
|
||||
|
||||
if (! g_file_delete (file, NULL, &my_error) &&
|
||||
my_error->code != G_IO_ERROR_NOT_FOUND)
|
||||
|
|
|
@ -76,7 +76,7 @@ gimp_modules_load (Gimp *gimp)
|
|||
/* FIXME, gimp->be_verbose is not yet initialized in init() */
|
||||
gimp->module_db->verbose = gimp->be_verbose;
|
||||
|
||||
file = gimp_personal_rc_gfile ("modulerc");
|
||||
file = gimp_directory_file ("modulerc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -192,7 +192,7 @@ gimp_modules_unload (Gimp *gimp)
|
|||
else
|
||||
p = "";
|
||||
|
||||
file = gimp_personal_rc_gfile ("modulerc");
|
||||
file = gimp_directory_file ("modulerc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
|
|
@ -119,7 +119,7 @@ gimp_parasiterc_load (Gimp *gimp)
|
|||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
file = gimp_personal_rc_gfile ("parasiterc");
|
||||
file = gimp_directory_file ("parasiterc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -152,7 +152,7 @@ gimp_parasiterc_save (Gimp *gimp)
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GIMP_IS_PARASITE_LIST (gimp->parasites));
|
||||
|
||||
file = gimp_personal_rc_gfile ("parasiterc");
|
||||
file = gimp_directory_file ("parasiterc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
|
|
@ -72,6 +72,7 @@ static const gchar* attribute_name_to_value (const gchar *
|
|||
gboolean
|
||||
gimp_tags_user_install (void)
|
||||
{
|
||||
GFile *file;
|
||||
gchar *filename;
|
||||
GMarkupParser markup_parser;
|
||||
GimpXmlParser *xml_parser;
|
||||
|
@ -105,8 +106,7 @@ gimp_tags_user_install (void)
|
|||
g_string_append (tags_installer.buf, "<?xml version='1.0' encoding='UTF-8'?>\n");
|
||||
g_string_append (tags_installer.buf, "<tags>\n");
|
||||
|
||||
filename = g_build_filename (gimp_data_directory (), "tags",
|
||||
"gimp-tags-default.xml", NULL);
|
||||
file = gimp_data_directory_file ("tags", "gimp-tags-default.xml", NULL);
|
||||
|
||||
markup_parser.start_element = gimp_tags_installer_load_start_element;
|
||||
markup_parser.end_element = gimp_tags_installer_load_end_element;
|
||||
|
@ -116,9 +116,9 @@ gimp_tags_user_install (void)
|
|||
|
||||
xml_parser = gimp_xml_parser_new (&markup_parser, &tags_installer);
|
||||
|
||||
result = gimp_xml_parser_parse_file (xml_parser, filename, &error);
|
||||
result = gimp_xml_parser_parse_gfile (xml_parser, file, &error);
|
||||
|
||||
g_free (filename);
|
||||
g_object_unref (file);
|
||||
gimp_xml_parser_free (xml_parser);
|
||||
|
||||
if (! result)
|
||||
|
|
|
@ -44,7 +44,7 @@ gimp_templates_load (Gimp *gimp)
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GIMP_IS_LIST (gimp->templates));
|
||||
|
||||
file = gimp_personal_rc_gfile ("templaterc");
|
||||
file = gimp_directory_file ("templaterc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -54,14 +54,10 @@ gimp_templates_load (Gimp *gimp)
|
|||
{
|
||||
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
g_clear_error (&error);
|
||||
g_object_unref (file);
|
||||
|
||||
tmp = g_build_filename (gimp_sysconf_directory (), "templaterc", NULL);
|
||||
file = g_file_new_for_path (tmp);
|
||||
g_free (tmp);
|
||||
file = gimp_sysconf_directory_file ("templaterc", NULL);
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (gimp->templates),
|
||||
file, NULL, &error))
|
||||
|
@ -99,7 +95,7 @@ gimp_templates_save (Gimp *gimp)
|
|||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (GIMP_IS_LIST (gimp->templates));
|
||||
|
||||
file = gimp_personal_rc_gfile ("templaterc");
|
||||
file = gimp_directory_file ("templaterc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -173,17 +169,14 @@ void
|
|||
gimp_templates_migrate (const gchar *olddir)
|
||||
{
|
||||
GimpContainer *templates = gimp_list_new (GIMP_TYPE_TEMPLATE, TRUE);
|
||||
GFile *file = gimp_personal_rc_gfile ("templaterc");
|
||||
GFile *file = gimp_directory_file ("templaterc", NULL);
|
||||
|
||||
if (gimp_config_deserialize_gfile (GIMP_CONFIG (templates), file,
|
||||
NULL, NULL))
|
||||
{
|
||||
gchar *tmp;
|
||||
GFile *sysconf_file;
|
||||
|
||||
tmp = g_build_filename (gimp_sysconf_directory (), "templaterc", NULL);
|
||||
sysconf_file = g_file_new_for_path (tmp);
|
||||
g_free (tmp);
|
||||
sysconf_file = gimp_sysconf_directory_file ("templaterc", NULL);
|
||||
|
||||
if (olddir && (strstr (olddir, "2.0") || strstr (olddir, "2.2")))
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ gimp_unitrc_load (Gimp *gimp)
|
|||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
file = gimp_personal_rc_gfile ("unitrc");
|
||||
file = gimp_directory_file ("unitrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -99,14 +99,10 @@ gimp_unitrc_load (Gimp *gimp)
|
|||
|
||||
if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
g_clear_error (&error);
|
||||
g_object_unref (file);
|
||||
|
||||
tmp = g_build_filename (gimp_sysconf_directory (), "unitrc", NULL);
|
||||
file = g_file_new_for_path (tmp);
|
||||
g_free (tmp);
|
||||
file = gimp_sysconf_directory_file ("unitrc", NULL);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, NULL);
|
||||
}
|
||||
|
@ -191,7 +187,7 @@ gimp_unitrc_save (Gimp *gimp)
|
|||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
file = gimp_personal_rc_gfile ("unitrc");
|
||||
file = gimp_directory_file ("unitrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
|
|
@ -380,7 +380,7 @@ gimp_tool_options_delete (GimpToolOptions *tool_options,
|
|||
void
|
||||
gimp_tool_options_create_folder (void)
|
||||
{
|
||||
GFile *file = gimp_personal_rc_gfile ("tool-options");
|
||||
GFile *file = gimp_directory_file ("tool-options", NULL);
|
||||
|
||||
g_file_make_directory (file, NULL, NULL);
|
||||
g_object_unref (file);
|
||||
|
|
|
@ -578,7 +578,7 @@ dialogs_get_dockrc_file (void)
|
|||
if (! basename)
|
||||
basename = "dockrc";
|
||||
|
||||
return gimp_personal_rc_gfile (basename);
|
||||
return gimp_directory_file (basename, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -73,13 +73,9 @@ tips_dialog_create (Gimp *gimp)
|
|||
if (!tips)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *filename;
|
||||
GFile *file;
|
||||
|
||||
filename = g_build_filename (gimp_data_directory (), "tips",
|
||||
"gimp-tips.xml", NULL);
|
||||
file = g_file_new_for_path (filename);
|
||||
g_free (filename);
|
||||
file = gimp_data_directory_file ("tips", "gimp-tips.xml", NULL);
|
||||
|
||||
tips = gimp_tips_from_file (file, &error);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ color_history_save (Gimp *gimp)
|
|||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
file = gimp_personal_rc_gfile ("colorrc");
|
||||
file = gimp_directory_file ("colorrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -111,7 +111,7 @@ color_history_restore (Gimp *gimp)
|
|||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
file = gimp_personal_rc_gfile ("colorrc");
|
||||
file = gimp_directory_file ("colorrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
|
|
@ -81,14 +81,10 @@ session_init (Gimp *gimp)
|
|||
|
||||
if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
g_clear_error (&error);
|
||||
g_object_unref (file);
|
||||
|
||||
tmp = g_build_filename (gimp_sysconf_directory (), "sessionrc", NULL);
|
||||
file = g_file_new_for_path (tmp);
|
||||
g_free (tmp);
|
||||
file = gimp_sysconf_directory_file ("sessionrc", NULL);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, NULL);
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ themes_apply_theme (Gimp *gimp,
|
|||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
|
||||
themerc = gimp_personal_rc_gfile ("themerc");
|
||||
themerc = gimp_directory_file ("themerc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (themerc));
|
||||
|
@ -295,7 +295,7 @@ themes_apply_theme (Gimp *gimp,
|
|||
gtkrc_theme = g_file_new_for_path (gimp_gtkrc ());
|
||||
}
|
||||
|
||||
gtkrc_user = gimp_personal_rc_gfile ("gtkrc");
|
||||
gtkrc_user = gimp_directory_file ("gtkrc", NULL);
|
||||
|
||||
tmp = g_file_get_path (gtkrc_theme);
|
||||
esc_gtkrc_theme = g_strescape (tmp, NULL);
|
||||
|
|
|
@ -272,7 +272,7 @@ gimp_plug_in_manager_get_pluginrc (GimpPlugInManager *manager)
|
|||
}
|
||||
else
|
||||
{
|
||||
pluginrc = gimp_personal_rc_gfile ("pluginrc");
|
||||
pluginrc = gimp_directory_file ("pluginrc", NULL);
|
||||
}
|
||||
|
||||
return pluginrc;
|
||||
|
|
|
@ -266,7 +266,7 @@ gimp_tools_restore (Gimp *gimp)
|
|||
|
||||
gimp_list = gimp_list_new (GIMP_TYPE_TOOL_INFO, FALSE);
|
||||
|
||||
file = gimp_personal_rc_gfile ("toolrc");
|
||||
file = gimp_directory_file ("toolrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -411,7 +411,7 @@ gimp_tools_save (Gimp *gimp,
|
|||
}
|
||||
}
|
||||
|
||||
file = gimp_personal_rc_gfile ("toolrc");
|
||||
file = gimp_directory_file ("toolrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
|
|
@ -143,7 +143,7 @@ gimp_controllers_restore (Gimp *gimp,
|
|||
|
||||
manager->ui_manager = g_object_ref (ui_manager);
|
||||
|
||||
file = gimp_personal_rc_gfile ("controllerrc");
|
||||
file = gimp_directory_file ("controllerrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -153,15 +153,10 @@ gimp_controllers_restore (Gimp *gimp,
|
|||
{
|
||||
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
g_clear_error (&error);
|
||||
g_object_unref (file);
|
||||
|
||||
tmp = g_build_filename (gimp_sysconf_directory (),
|
||||
"controllerrc", NULL);
|
||||
file = g_file_new_for_path (tmp);
|
||||
g_free (tmp);
|
||||
file = gimp_sysconf_directory_file ("controllerrc", NULL);
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (manager->controllers),
|
||||
file, NULL, &error))
|
||||
|
@ -203,7 +198,7 @@ gimp_controllers_save (Gimp *gimp)
|
|||
|
||||
g_return_if_fail (manager != NULL);
|
||||
|
||||
file = gimp_personal_rc_gfile ("controllerrc");
|
||||
file = gimp_directory_file ("controllerrc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
|
|
@ -111,7 +111,7 @@ gimp_devices_restore (Gimp *gimp)
|
|||
gimp_device_info_set_default_tool (device_info);
|
||||
}
|
||||
|
||||
file = gimp_personal_rc_gfile ("devicerc");
|
||||
file = gimp_directory_file ("devicerc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -154,7 +154,7 @@ gimp_devices_save (Gimp *gimp,
|
|||
if (devicerc_deleted && ! always_save)
|
||||
return;
|
||||
|
||||
file = gimp_personal_rc_gfile ("devicerc");
|
||||
file = gimp_directory_file ("devicerc", NULL);
|
||||
|
||||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
@ -190,7 +190,7 @@ gimp_devices_clear (Gimp *gimp,
|
|||
|
||||
g_return_val_if_fail (GIMP_IS_DEVICE_MANAGER (manager), FALSE);
|
||||
|
||||
file = gimp_personal_rc_gfile ("devicerc");
|
||||
file = gimp_directory_file ("devicerc", NULL);
|
||||
|
||||
if (! g_file_delete (file, NULL, &my_error) &&
|
||||
my_error->code != G_IO_ERROR_NOT_FOUND)
|
||||
|
|
|
@ -18,10 +18,12 @@ EXPORTS
|
|||
gimp_cpu_accel_get_support
|
||||
gimp_cpu_accel_set_use
|
||||
gimp_data_directory
|
||||
gimp_data_directory_file
|
||||
gimp_datafiles_check_extension
|
||||
gimp_datafiles_read_directories
|
||||
gimp_desaturate_mode_get_type
|
||||
gimp_directory
|
||||
gimp_directory_file
|
||||
gimp_dodge_burn_type_get_type
|
||||
gimp_enum_get_desc
|
||||
gimp_enum_get_value
|
||||
|
@ -54,6 +56,7 @@ EXPORTS
|
|||
gimp_installation_directory
|
||||
gimp_interpolation_type_get_type
|
||||
gimp_locale_directory
|
||||
gimp_locale_directory_file
|
||||
gimp_major_version
|
||||
gimp_mask_apply_mode_get_type
|
||||
gimp_memsize_deserialize
|
||||
|
@ -112,12 +115,12 @@ EXPORTS
|
|||
gimp_pdb_proc_type_get_type
|
||||
gimp_pdb_status_type_get_type
|
||||
gimp_personal_rc_file
|
||||
gimp_personal_rc_gfile
|
||||
gimp_pixels_to_units
|
||||
gimp_pixpipe_params_build
|
||||
gimp_pixpipe_params_init
|
||||
gimp_pixpipe_params_parse
|
||||
gimp_plug_in_directory
|
||||
gimp_plug_in_directory_file
|
||||
gimp_precision_get_type
|
||||
gimp_progress_command_get_type
|
||||
gimp_rectangle_intersect
|
||||
|
@ -131,6 +134,7 @@ EXPORTS
|
|||
gimp_stack_trace_mode_get_type
|
||||
gimp_strip_uline
|
||||
gimp_sysconf_directory
|
||||
gimp_sysconf_directory_file
|
||||
gimp_text_direction_get_type
|
||||
gimp_text_hint_style_get_type
|
||||
gimp_text_justification_get_type
|
||||
|
|
|
@ -554,23 +554,6 @@ gimp_sysconf_directory (void)
|
|||
return gimp_sysconf_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_user_directory:
|
||||
* @type: the type of user directory to retrieve
|
||||
*
|
||||
* This procedure is deprecated! Use g_get_user_special_dir() instead.
|
||||
*
|
||||
* Returns: The path to the specified user directory, or %NULL if the
|
||||
* logical ID was not found.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
const gchar *
|
||||
gimp_user_directory (GimpUserDirectory type)
|
||||
{
|
||||
return g_get_user_special_dir (type);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_plug_in_directory:
|
||||
*
|
||||
|
@ -606,6 +589,193 @@ gimp_plug_in_directory (void)
|
|||
return gimp_plug_in_dir;
|
||||
}
|
||||
|
||||
static GFile *
|
||||
gimp_child_file (const gchar *parent,
|
||||
const gchar *element,
|
||||
va_list args)
|
||||
{
|
||||
GFile *file = g_file_new_for_path (parent);
|
||||
|
||||
while (element)
|
||||
{
|
||||
GFile *child = g_file_get_child (file, element);
|
||||
|
||||
g_object_unref (file);
|
||||
file = child;
|
||||
|
||||
element = va_arg (args, const gchar *);
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_directory_file:
|
||||
* @first_element: the first element of a path to a file in the
|
||||
* user's GIMP directory, or %NULL.
|
||||
* @...: a %NULL terminated list of the remaining elements of the path
|
||||
* to the file.
|
||||
*
|
||||
* Returns a #GFile in the user's GIMP directory, or the data
|
||||
* directory itself if @first_element is %NULL.
|
||||
*
|
||||
* See also: gimp_directory().
|
||||
*
|
||||
* Since: GIMP 2.10
|
||||
*
|
||||
* Returns: a new @GFile for the path, Free with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
gimp_directory_file (const gchar *first_element,
|
||||
...)
|
||||
{
|
||||
GFile *file;
|
||||
va_list args;
|
||||
|
||||
va_start (args, first_element);
|
||||
file = gimp_child_file (gimp_directory (), first_element, args);
|
||||
va_end (args);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_data_directory_file:
|
||||
* @first_element: the first element of a path to a file in the
|
||||
* data directory, or %NULL.
|
||||
* @...: a %NULL terminated list of the remaining elements of the path
|
||||
* to the file.
|
||||
*
|
||||
* Returns a #GFile in the data directory, or the data directory
|
||||
* itself if @first_element is %NULL.
|
||||
*
|
||||
* See also: gimp_data_directory().
|
||||
*
|
||||
* Since: GIMP 2.10
|
||||
*
|
||||
* Returns: a new @GFile for the path, Free with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
gimp_data_directory_file (const gchar *first_element,
|
||||
...)
|
||||
{
|
||||
GFile *file;
|
||||
va_list args;
|
||||
|
||||
va_start (args, first_element);
|
||||
file = gimp_child_file (gimp_data_directory (), first_element, args);
|
||||
va_end (args);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_locale_directory_file:
|
||||
* @first_element: the first element of a path to a file in the
|
||||
* locale directory, or %NULL.
|
||||
* @...: a %NULL terminated list of the remaining elements of the path
|
||||
* to the file.
|
||||
*
|
||||
* Returns a #GFile in the locale directory, or the locale directory
|
||||
* itself if @first_element is %NULL.
|
||||
*
|
||||
* See also: gimp_locale_directory().
|
||||
*
|
||||
* Since: GIMP 2.10
|
||||
*
|
||||
* Returns: a new @GFile for the path, Free with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
gimp_locale_directory_file (const gchar *first_element,
|
||||
...)
|
||||
{
|
||||
GFile *file;
|
||||
va_list args;
|
||||
|
||||
va_start (args, first_element);
|
||||
file = gimp_child_file (gimp_locale_directory (), first_element, args);
|
||||
va_end (args);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_sysconf_directory_file:
|
||||
* @first_element: the first element of a path to a file in the
|
||||
* sysconf directory, or %NULL.
|
||||
* @...: a %NULL terminated list of the remaining elements of the path
|
||||
* to the file.
|
||||
*
|
||||
* Returns a #GFile in the sysconf directory, or the sysconf directory
|
||||
* itself if @first_element is %NULL.
|
||||
*
|
||||
* See also: gimp_sysconf_directory().
|
||||
*
|
||||
* Since: GIMP 2.10
|
||||
*
|
||||
* Returns: a new @GFile for the path, Free with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
gimp_sysconf_directory_file (const gchar *first_element,
|
||||
...)
|
||||
{
|
||||
GFile *file;
|
||||
va_list args;
|
||||
|
||||
va_start (args, first_element);
|
||||
file = gimp_child_file (gimp_sysconf_directory (), first_element, args);
|
||||
va_end (args);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_plug_in_directory_file:
|
||||
* @first_element: the first element of a path to a file in the
|
||||
* plug-in directory, or %NULL.
|
||||
* @...: a %NULL terminated list of the remaining elements of the path
|
||||
* to the file.
|
||||
*
|
||||
* Returns a #GFile in the plug-in directory, or the plug-in directory
|
||||
* itself if @first_element is %NULL.
|
||||
*
|
||||
* See also: gimp_plug_in_directory().
|
||||
*
|
||||
* Since: GIMP 2.10
|
||||
*
|
||||
* Returns: a new @GFile for the path, Free with g_object_unref().
|
||||
**/
|
||||
GFile *
|
||||
gimp_plug_in_directory_file (const gchar *first_element,
|
||||
...)
|
||||
{
|
||||
GFile *file;
|
||||
va_list args;
|
||||
|
||||
va_start (args, first_element);
|
||||
file = gimp_child_file (gimp_plug_in_directory (), first_element, args);
|
||||
va_end (args);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_user_directory:
|
||||
* @type: the type of user directory to retrieve
|
||||
*
|
||||
* This procedure is deprecated! Use g_get_user_special_dir() instead.
|
||||
*
|
||||
* Returns: The path to the specified user directory, or %NULL if the
|
||||
* logical ID was not found.
|
||||
*
|
||||
* Since: GIMP 2.4
|
||||
**/
|
||||
const gchar *
|
||||
gimp_user_directory (GimpUserDirectory type)
|
||||
{
|
||||
return g_get_user_special_dir (type);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_personal_rc_file:
|
||||
* @basename: The basename of a rc_file.
|
||||
|
@ -625,33 +795,6 @@ gimp_personal_rc_file (const gchar *basename)
|
|||
return g_build_filename (gimp_directory (), basename, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_personal_rc_gfile:
|
||||
* @basename: The basename of a rc_file.
|
||||
*
|
||||
* Returns a #GFile in the user-specific GIMP settings directory.
|
||||
*
|
||||
* The returned #GFile is newly allocated and should be freed with
|
||||
* g_object_unref() after use.
|
||||
*
|
||||
* See gimp_personal_rc_file().
|
||||
*
|
||||
* Since: GIMP 2.10
|
||||
*
|
||||
* Returns: A #GFile in the user-specific GIMP settings directory.
|
||||
**/
|
||||
GFile *
|
||||
gimp_personal_rc_gfile (const gchar *basename)
|
||||
{
|
||||
gchar *path = gimp_personal_rc_file (basename);
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_path (path);
|
||||
g_free (path);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_gtkrc:
|
||||
*
|
||||
|
|
|
@ -54,6 +54,17 @@ const gchar * gimp_locale_directory (void) G_GNUC_CONST;
|
|||
const gchar * gimp_sysconf_directory (void) G_GNUC_CONST;
|
||||
const gchar * gimp_plug_in_directory (void) G_GNUC_CONST;
|
||||
|
||||
GFile * gimp_directory_file (const gchar *first_element,
|
||||
...) G_GNUC_MALLOC;
|
||||
GFile * gimp_data_directory_file (const gchar *first_element,
|
||||
...) G_GNUC_MALLOC;
|
||||
GFile * gimp_locale_directory_file (const gchar *first_element,
|
||||
...) G_GNUC_MALLOC;
|
||||
GFile * gimp_sysconf_directory_file (const gchar *first_element,
|
||||
...) G_GNUC_MALLOC;
|
||||
GFile * gimp_plug_in_directory_file (const gchar *first_element,
|
||||
...) G_GNUC_MALLOC;
|
||||
|
||||
#ifndef GIMP_DISABLE_DEPRECATED
|
||||
GIMP_DEPRECATED_FOR(g_get_user_special_dir)
|
||||
const gchar * gimp_user_directory (GimpUserDirectory type) G_GNUC_CONST;
|
||||
|
@ -61,7 +72,6 @@ const gchar * gimp_user_directory (GimpUserDirectory type) G_GNUC_
|
|||
|
||||
const gchar * gimp_gtkrc (void) G_GNUC_CONST;
|
||||
gchar * gimp_personal_rc_file (const gchar *basename) G_GNUC_MALLOC;
|
||||
GFile * gimp_personal_rc_gfile (const gchar *basename);
|
||||
|
||||
GList * gimp_path_parse (const gchar *path,
|
||||
gint max_paths,
|
||||
|
|
Loading…
Reference in New Issue