Commit b03d69dd authored by Michael Natterer's avatar Michael Natterer 😴

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/.
parent b328bd30
...@@ -79,7 +79,7 @@ gimp_contexts_load (Gimp *gimp, ...@@ -79,7 +79,7 @@ gimp_contexts_load (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, 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) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -116,7 +116,7 @@ gimp_contexts_save (Gimp *gimp, ...@@ -116,7 +116,7 @@ gimp_contexts_save (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, 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) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -142,7 +142,7 @@ gimp_contexts_clear (Gimp *gimp, ...@@ -142,7 +142,7 @@ gimp_contexts_clear (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE); 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) && if (! g_file_delete (file, NULL, &my_error) &&
my_error->code != G_IO_ERROR_NOT_FOUND) my_error->code != G_IO_ERROR_NOT_FOUND)
......
...@@ -76,7 +76,7 @@ gimp_modules_load (Gimp *gimp) ...@@ -76,7 +76,7 @@ gimp_modules_load (Gimp *gimp)
/* FIXME, gimp->be_verbose is not yet initialized in init() */ /* FIXME, gimp->be_verbose is not yet initialized in init() */
gimp->module_db->verbose = gimp->be_verbose; gimp->module_db->verbose = gimp->be_verbose;
file = gimp_personal_rc_gfile ("modulerc"); file = gimp_directory_file ("modulerc", NULL);
if (gimp->be_verbose) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -192,7 +192,7 @@ gimp_modules_unload (Gimp *gimp) ...@@ -192,7 +192,7 @@ gimp_modules_unload (Gimp *gimp)
else else
p = ""; p = "";
file = gimp_personal_rc_gfile ("modulerc"); file = gimp_directory_file ("modulerc", NULL);
if (gimp->be_verbose) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
......
...@@ -119,7 +119,7 @@ gimp_parasiterc_load (Gimp *gimp) ...@@ -119,7 +119,7 @@ gimp_parasiterc_load (Gimp *gimp)
g_return_if_fail (GIMP_IS_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) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -152,7 +152,7 @@ gimp_parasiterc_save (Gimp *gimp) ...@@ -152,7 +152,7 @@ gimp_parasiterc_save (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_PARASITE_LIST (gimp->parasites)); 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) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
......
...@@ -72,6 +72,7 @@ static const gchar* attribute_name_to_value (const gchar * ...@@ -72,6 +72,7 @@ static const gchar* attribute_name_to_value (const gchar *
gboolean gboolean
gimp_tags_user_install (void) gimp_tags_user_install (void)
{ {
GFile *file;
gchar *filename; gchar *filename;
GMarkupParser markup_parser; GMarkupParser markup_parser;
GimpXmlParser *xml_parser; GimpXmlParser *xml_parser;
...@@ -105,8 +106,7 @@ gimp_tags_user_install (void) ...@@ -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, "<?xml version='1.0' encoding='UTF-8'?>\n");
g_string_append (tags_installer.buf, "<tags>\n"); g_string_append (tags_installer.buf, "<tags>\n");
filename = g_build_filename (gimp_data_directory (), "tags", file = gimp_data_directory_file ("tags", "gimp-tags-default.xml", NULL);
"gimp-tags-default.xml", NULL);
markup_parser.start_element = gimp_tags_installer_load_start_element; markup_parser.start_element = gimp_tags_installer_load_start_element;
markup_parser.end_element = gimp_tags_installer_load_end_element; markup_parser.end_element = gimp_tags_installer_load_end_element;
...@@ -116,9 +116,9 @@ gimp_tags_user_install (void) ...@@ -116,9 +116,9 @@ gimp_tags_user_install (void)
xml_parser = gimp_xml_parser_new (&markup_parser, &tags_installer); 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); gimp_xml_parser_free (xml_parser);
if (! result) if (! result)
......
...@@ -44,7 +44,7 @@ gimp_templates_load (Gimp *gimp) ...@@ -44,7 +44,7 @@ gimp_templates_load (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_LIST (gimp->templates)); 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) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -54,14 +54,10 @@ gimp_templates_load (Gimp *gimp) ...@@ -54,14 +54,10 @@ gimp_templates_load (Gimp *gimp)
{ {
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT) if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{ {
gchar *tmp;
g_clear_error (&error); g_clear_error (&error);
g_object_unref (file); g_object_unref (file);
tmp = g_build_filename (gimp_sysconf_directory (), "templaterc", NULL); file = gimp_sysconf_directory_file ("templaterc", NULL);
file = g_file_new_for_path (tmp);
g_free (tmp);
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (gimp->templates), if (! gimp_config_deserialize_gfile (GIMP_CONFIG (gimp->templates),
file, NULL, &error)) file, NULL, &error))
...@@ -99,7 +95,7 @@ gimp_templates_save (Gimp *gimp) ...@@ -99,7 +95,7 @@ gimp_templates_save (Gimp *gimp)
g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_GIMP (gimp));
g_return_if_fail (GIMP_IS_LIST (gimp->templates)); 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) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -173,17 +169,14 @@ void ...@@ -173,17 +169,14 @@ void
gimp_templates_migrate (const gchar *olddir) gimp_templates_migrate (const gchar *olddir)
{ {
GimpContainer *templates = gimp_list_new (GIMP_TYPE_TEMPLATE, TRUE); 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, if (gimp_config_deserialize_gfile (GIMP_CONFIG (templates), file,
NULL, NULL)) NULL, NULL))
{ {
gchar *tmp;
GFile *sysconf_file; GFile *sysconf_file;
tmp = g_build_filename (gimp_sysconf_directory (), "templaterc", NULL); sysconf_file = gimp_sysconf_directory_file ("templaterc", NULL);
sysconf_file = g_file_new_for_path (tmp);
g_free (tmp);
if (olddir && (strstr (olddir, "2.0") || strstr (olddir, "2.2"))) if (olddir && (strstr (olddir, "2.0") || strstr (olddir, "2.2")))
{ {
......
...@@ -90,7 +90,7 @@ gimp_unitrc_load (Gimp *gimp) ...@@ -90,7 +90,7 @@ gimp_unitrc_load (Gimp *gimp)
g_return_if_fail (GIMP_IS_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) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -99,14 +99,10 @@ gimp_unitrc_load (Gimp *gimp) ...@@ -99,14 +99,10 @@ gimp_unitrc_load (Gimp *gimp)
if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT) if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{ {
gchar *tmp;
g_clear_error (&error); g_clear_error (&error);
g_object_unref (file); g_object_unref (file);
tmp = g_build_filename (gimp_sysconf_directory (), "unitrc", NULL); file = gimp_sysconf_directory_file ("unitrc", NULL);
file = g_file_new_for_path (tmp);
g_free (tmp);
scanner = gimp_scanner_new_gfile (file, NULL); scanner = gimp_scanner_new_gfile (file, NULL);
} }
...@@ -191,7 +187,7 @@ gimp_unitrc_save (Gimp *gimp) ...@@ -191,7 +187,7 @@ gimp_unitrc_save (Gimp *gimp)
g_return_if_fail (GIMP_IS_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) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
......
...@@ -380,7 +380,7 @@ gimp_tool_options_delete (GimpToolOptions *tool_options, ...@@ -380,7 +380,7 @@ gimp_tool_options_delete (GimpToolOptions *tool_options,
void void
gimp_tool_options_create_folder (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_file_make_directory (file, NULL, NULL);
g_object_unref (file); g_object_unref (file);
......
...@@ -578,7 +578,7 @@ dialogs_get_dockrc_file (void) ...@@ -578,7 +578,7 @@ dialogs_get_dockrc_file (void)
if (! basename) if (! basename)
basename = "dockrc"; basename = "dockrc";
return gimp_personal_rc_gfile (basename); return gimp_directory_file (basename, NULL);
} }
void void
......
...@@ -73,13 +73,9 @@ tips_dialog_create (Gimp *gimp) ...@@ -73,13 +73,9 @@ tips_dialog_create (Gimp *gimp)
if (!tips) if (!tips)
{ {
GError *error = NULL; GError *error = NULL;
gchar *filename;
GFile *file; GFile *file;
filename = g_build_filename (gimp_data_directory (), "tips", file = gimp_data_directory_file ("tips", "gimp-tips.xml", NULL);
"gimp-tips.xml", NULL);
file = g_file_new_for_path (filename);
g_free (filename);
tips = gimp_tips_from_file (file, &error); tips = gimp_tips_from_file (file, &error);
......
...@@ -57,7 +57,7 @@ color_history_save (Gimp *gimp) ...@@ -57,7 +57,7 @@ color_history_save (Gimp *gimp)
g_return_if_fail (GIMP_IS_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) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -111,7 +111,7 @@ color_history_restore (Gimp *gimp) ...@@ -111,7 +111,7 @@ color_history_restore (Gimp *gimp)
g_return_if_fail (GIMP_IS_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) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
......
...@@ -81,14 +81,10 @@ session_init (Gimp *gimp) ...@@ -81,14 +81,10 @@ session_init (Gimp *gimp)
if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT) if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{ {
gchar *tmp;
g_clear_error (&error); g_clear_error (&error);
g_object_unref (file); g_object_unref (file);
tmp = g_build_filename (gimp_sysconf_directory (), "sessionrc", NULL); file = gimp_sysconf_directory_file ("sessionrc", NULL);
file = g_file_new_for_path (tmp);
g_free (tmp);
scanner = gimp_scanner_new_gfile (file, NULL); scanner = gimp_scanner_new_gfile (file, NULL);
} }
......
...@@ -261,7 +261,7 @@ themes_apply_theme (Gimp *gimp, ...@@ -261,7 +261,7 @@ themes_apply_theme (Gimp *gimp,
g_return_if_fail (GIMP_IS_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) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (themerc)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (themerc));
...@@ -295,7 +295,7 @@ themes_apply_theme (Gimp *gimp, ...@@ -295,7 +295,7 @@ themes_apply_theme (Gimp *gimp,
gtkrc_theme = g_file_new_for_path (gimp_gtkrc ()); 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); tmp = g_file_get_path (gtkrc_theme);
esc_gtkrc_theme = g_strescape (tmp, NULL); esc_gtkrc_theme = g_strescape (tmp, NULL);
......
...@@ -272,7 +272,7 @@ gimp_plug_in_manager_get_pluginrc (GimpPlugInManager *manager) ...@@ -272,7 +272,7 @@ gimp_plug_in_manager_get_pluginrc (GimpPlugInManager *manager)
} }
else else
{ {
pluginrc = gimp_personal_rc_gfile ("pluginrc"); pluginrc = gimp_directory_file ("pluginrc", NULL);
} }
return pluginrc; return pluginrc;
......
...@@ -266,7 +266,7 @@ gimp_tools_restore (Gimp *gimp) ...@@ -266,7 +266,7 @@ gimp_tools_restore (Gimp *gimp)
gimp_list = gimp_list_new (GIMP_TYPE_TOOL_INFO, FALSE); 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) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -411,7 +411,7 @@ gimp_tools_save (Gimp *gimp, ...@@ -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) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
......
...@@ -143,7 +143,7 @@ gimp_controllers_restore (Gimp *gimp, ...@@ -143,7 +143,7 @@ gimp_controllers_restore (Gimp *gimp,
manager->ui_manager = g_object_ref (ui_manager); manager->ui_manager = g_object_ref (ui_manager);
file = gimp_personal_rc_gfile ("controllerrc"); file = gimp_directory_file ("controllerrc", NULL);
if (gimp->be_verbose) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -153,15 +153,10 @@ gimp_controllers_restore (Gimp *gimp, ...@@ -153,15 +153,10 @@ gimp_controllers_restore (Gimp *gimp,
{ {
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT) if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{ {
gchar *tmp;
g_clear_error (&error); g_clear_error (&error);
g_object_unref (file); g_object_unref (file);
tmp = g_build_filename (gimp_sysconf_directory (), file = gimp_sysconf_directory_file ("controllerrc", NULL);
"controllerrc", NULL);
file = g_file_new_for_path (tmp);
g_free (tmp);
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (manager->controllers), if (! gimp_config_deserialize_gfile (GIMP_CONFIG (manager->controllers),
file, NULL, &error)) file, NULL, &error))
...@@ -203,7 +198,7 @@ gimp_controllers_save (Gimp *gimp) ...@@ -203,7 +198,7 @@ gimp_controllers_save (Gimp *gimp)
g_return_if_fail (manager != NULL); g_return_if_fail (manager != NULL);
file = gimp_personal_rc_gfile ("controllerrc"); file = gimp_directory_file ("controllerrc", NULL);
if (gimp->be_verbose) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
......
...@@ -111,7 +111,7 @@ gimp_devices_restore (Gimp *gimp) ...@@ -111,7 +111,7 @@ gimp_devices_restore (Gimp *gimp)
gimp_device_info_set_default_tool (device_info); gimp_device_info_set_default_tool (device_info);
} }
file = gimp_personal_rc_gfile ("devicerc"); file = gimp_directory_file ("devicerc", NULL);
if (gimp->be_verbose) if (gimp->be_verbose)
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -154,7 +154,7 @@ gimp_devices_save (Gimp *gimp, ...@@ -154,7 +154,7 @@ gimp_devices_save (Gimp *gimp,
if (devicerc_deleted && ! always_save) if (devicerc_deleted && ! always_save)
return; return;
file = gimp_personal_rc_gfile ("devicerc"); file = gimp_directory_file ("devicerc", NULL);
if (gimp->be_verbose) if (gimp->be_verbose)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file)); g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
...@@ -190,7 +190,7 @@ gimp_devices_clear (Gimp *gimp, ...@@ -190,7 +190,7 @@ gimp_devices_clear (Gimp *gimp,
g_return_val_if_fail (GIMP_IS_DEVICE_MANAGER (manager), FALSE); 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) && if (! g_file_delete (file, NULL, &my_error) &&
my_error->code != G_IO_ERROR_NOT_FOUND) my_error->code != G_IO_ERROR_NOT_FOUND)
......
...@@ -18,10 +18,12 @@ EXPORTS ...@@ -18,10 +18,12 @@ EXPORTS
gimp_cpu_accel_get_support gimp_cpu_accel_get_support
gimp_cpu_accel_set_use gimp_cpu_accel_set_use
gimp_data_directory gimp_data_directory
gimp_data_directory_file
gimp_datafiles_check_extension gimp_datafiles_check_extension
gimp_datafiles_read_directories gimp_datafiles_read_directories
gimp_desaturate_mode_get_type gimp_desaturate_mode_get_type
gimp_directory gimp_directory
gimp_directory_file
gimp_dodge_burn_type_get_type gimp_dodge_burn_type_get_type
gimp_enum_get_desc gimp_enum_get_desc
gimp_enum_get_value gimp_enum_get_value
...@@ -54,6 +56,7 @@ EXPORTS ...@@ -54,6 +56,7 @@ EXPORTS
gimp_installation_directory gimp_installation_directory
gimp_interpolation_type_get_type gimp_interpolation_type_get_type
gimp_locale_directory gimp_locale_directory
gimp_locale_directory_file
gimp_major_version gimp_major_version
gimp_mask_apply_mode_get_type gimp_mask_apply_mode_get_type
gimp_memsize_deserialize gimp_memsize_deserialize
...@@ -112,12 +115,12 @@ EXPORTS ...@@ -112,12 +115,12 @@ EXPORTS
gimp_pdb_proc_type_get_type gimp_pdb_proc_type_get_type
gimp_pdb_status_type_get_type gimp_pdb_status_type_get_type
gimp_personal_rc_file gimp_personal_rc_file
gimp_personal_rc_gfile
gimp_pixels_to_units gimp_pixels_to_units
gimp_pixpipe_params_build gimp_pixpipe_params_build
gimp_pixpipe_params_init gimp_pixpipe_params_init
gimp_pixpipe_params_parse gimp_pixpipe_params_parse
gimp_plug_in_directory gimp_plug_in_directory
gimp_plug_in_directory_file
gimp_precision_get_type gimp_precision_get_type
gimp_progress_command_get_type gimp_progress_command_get_type
gimp_rectangle_intersect gimp_rectangle_intersect
...@@ -131,6 +134,7 @@ EXPORTS ...@@ -131,6 +134,7 @@ EXPORTS
gimp_stack_trace_mode_get_type gimp_stack_trace_mode_get_type
gimp_strip_uline gimp_strip_uline
gimp_sysconf_directory gimp_sysconf_directory
gimp_sysconf_directory_file
gimp_text_direction_get_type gimp_text_direction_get_type
gimp_text_hint_style_get_type gimp_text_hint_style_get_type
gimp_text_justification_get_type gimp_text_justification_get_type
......
...@@ -554,23 +554,6 @@ gimp_sysconf_directory (void) ...@@ -554,23 +554,6 @@ gimp_sysconf_directory (void)
return gimp_sysconf_dir; 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: * gimp_plug_in_directory:
* *
...@@ -606,52 +589,212 @@ gimp_plug_in_directory (void) ...@@ -606,52 +589,212 @@ gimp_plug_in_directory (void)
return gimp_plug_in_dir; 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_personal_rc_file: * gimp_directory_file:
* @basename: The basename of a rc_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 the name of a file in the user-specific GIMP settings directory. * Returns a #GFile in the user's GIMP directory, or the data
* directory itself if @first_element is %NULL.
* *
* The returned string is newly allocated and should be freed with * See also: gimp_directory().
* g_free() after use. The returned string is in the encoding used for
* filenames by GLib, which isn't necessarily UTF-8. (On Windows it
* always is UTF-8.)
* *
* Returns: The name of a file in the user-specific GIMP settings directory. * Since: GIMP 2.10
*
* Returns: a new @GFile for the path, Free with g_object_unref().
**/ **/
gchar * GFile *
gimp_personal_rc_file (const gchar *basename) gimp_directory_file (const gchar *first_element,
...)
{ {
return g_build_filename (gimp_directory (), basename, NULL); 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_personal_rc_gfile: * gimp_data_directory_file:
* @basename: The basename of a rc_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.
*