mirror of https://github.com/GNOME/gimp.git
libgimpconfig: get rid of filenames in all config related APIs
and rename function names which say "gfile" to just "file".
This commit is contained in:
parent
b327e0ff2f
commit
dbd793d631
|
@ -111,7 +111,7 @@ gimp_lang_rc_constructed (GObject *object)
|
|||
g_print ("Parsing '%s' for configured language.\n",
|
||||
gimp_file_get_utf8_name (rc->system_gimprc));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
|
||||
rc->system_gimprc, NULL, &error))
|
||||
{
|
||||
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
|
@ -124,7 +124,7 @@ gimp_lang_rc_constructed (GObject *object)
|
|||
g_print ("Parsing '%s' for configured language.\n",
|
||||
gimp_file_get_utf8_name (rc->user_gimprc));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
|
||||
rc->user_gimprc, NULL, &error))
|
||||
{
|
||||
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
|
|
|
@ -315,7 +315,7 @@ gimp_rc_load_system (GimpRc *rc)
|
|||
g_print ("Parsing '%s'\n",
|
||||
gimp_file_get_utf8_name (rc->system_gimprc));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
|
||||
rc->system_gimprc, NULL, &error))
|
||||
{
|
||||
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
|
@ -336,7 +336,7 @@ gimp_rc_load_user (GimpRc *rc)
|
|||
g_print ("Parsing '%s'\n",
|
||||
gimp_file_get_utf8_name (rc->user_gimprc));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (rc),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
|
||||
rc->user_gimprc, NULL, &error))
|
||||
{
|
||||
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
|
@ -530,7 +530,7 @@ gimp_rc_save (GimpRc *rc)
|
|||
if (gimp)
|
||||
g_object_unref (gimp);
|
||||
|
||||
gimp_config_deserialize_gfile (GIMP_CONFIG (global),
|
||||
gimp_config_deserialize_file (GIMP_CONFIG (global),
|
||||
rc->system_gimprc, NULL, NULL);
|
||||
|
||||
header = g_strconcat (top, gimp_file_get_utf8_name (rc->system_gimprc),
|
||||
|
@ -540,7 +540,7 @@ gimp_rc_save (GimpRc *rc)
|
|||
g_print ("Writing '%s'\n",
|
||||
gimp_file_get_utf8_name (rc->user_gimprc));
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (rc),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (rc),
|
||||
rc->user_gimprc,
|
||||
header, footer, global,
|
||||
&error))
|
||||
|
|
|
@ -84,7 +84,7 @@ gimp_contexts_load (Gimp *gimp,
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
success = gimp_config_deserialize_gfile (GIMP_CONFIG (gimp_get_user_context (gimp)),
|
||||
success = gimp_config_deserialize_file (GIMP_CONFIG (gimp_get_user_context (gimp)),
|
||||
file,
|
||||
NULL, &my_error);
|
||||
|
||||
|
@ -121,7 +121,7 @@ gimp_contexts_save (Gimp *gimp,
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
success = gimp_config_serialize_to_gfile (GIMP_CONFIG (gimp_get_user_context (gimp)),
|
||||
success = gimp_config_serialize_to_file (GIMP_CONFIG (gimp_get_user_context (gimp)),
|
||||
file,
|
||||
"GIMP user context",
|
||||
"end of user context",
|
||||
|
|
|
@ -75,7 +75,7 @@ gimp_modules_load (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, NULL);
|
||||
scanner = gimp_scanner_new_file (file, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
if (scanner)
|
||||
|
@ -195,7 +195,7 @@ gimp_modules_unload (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
writer = gimp_config_writer_new_from_gfile (file,
|
||||
writer = gimp_config_writer_new_from_file (file,
|
||||
TRUE,
|
||||
"GIMP modulerc",
|
||||
&error);
|
||||
|
|
|
@ -124,7 +124,7 @@ gimp_parasiterc_load (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (gimp->parasites),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->parasites),
|
||||
file, NULL, &error))
|
||||
{
|
||||
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
|
@ -157,7 +157,7 @@ gimp_parasiterc_save (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (gimp->parasites),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->parasites),
|
||||
file,
|
||||
header, footer, NULL,
|
||||
&error))
|
||||
|
|
|
@ -49,7 +49,7 @@ gimp_templates_load (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (gimp->templates),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates),
|
||||
file, NULL, &error))
|
||||
{
|
||||
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
|
@ -59,7 +59,7 @@ gimp_templates_load (Gimp *gimp)
|
|||
|
||||
file = gimp_sysconf_directory_file ("templaterc", NULL);
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (gimp->templates),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates),
|
||||
file, NULL, &error))
|
||||
{
|
||||
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
|
@ -100,7 +100,7 @@ gimp_templates_save (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (gimp->templates),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->templates),
|
||||
file,
|
||||
header, footer, NULL,
|
||||
&error))
|
||||
|
@ -171,7 +171,7 @@ gimp_templates_migrate (const gchar *olddir)
|
|||
GimpContainer *templates = gimp_list_new (GIMP_TYPE_TEMPLATE, TRUE);
|
||||
GFile *file = gimp_directory_file ("templaterc", NULL);
|
||||
|
||||
if (gimp_config_deserialize_gfile (GIMP_CONFIG (templates), file,
|
||||
if (gimp_config_deserialize_file (GIMP_CONFIG (templates), file,
|
||||
NULL, NULL))
|
||||
{
|
||||
GFile *sysconf_file;
|
||||
|
@ -190,14 +190,14 @@ gimp_templates_migrate (const gchar *olddir)
|
|||
|
||||
class->get_child_by_name = gimp_templates_migrate_get_child_by_name;
|
||||
|
||||
gimp_config_deserialize_gfile (GIMP_CONFIG (templates),
|
||||
gimp_config_deserialize_file (GIMP_CONFIG (templates),
|
||||
sysconf_file, NULL, NULL);
|
||||
|
||||
class->get_child_by_name = func;
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_config_deserialize_gfile (GIMP_CONFIG (templates),
|
||||
gimp_config_deserialize_file (GIMP_CONFIG (templates),
|
||||
sysconf_file, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ gimp_templates_migrate (const gchar *olddir)
|
|||
|
||||
gimp_list_reverse (GIMP_LIST (templates));
|
||||
|
||||
gimp_config_serialize_to_gfile (GIMP_CONFIG (templates), file,
|
||||
gimp_config_serialize_to_file (GIMP_CONFIG (templates), file,
|
||||
NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ gimp_unitrc_load (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, &error);
|
||||
scanner = gimp_scanner_new_file (file, &error);
|
||||
|
||||
if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
{
|
||||
|
@ -214,7 +214,7 @@ gimp_unitrc_load (Gimp *gimp)
|
|||
|
||||
file = gimp_sysconf_directory_file ("unitrc", NULL);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, NULL);
|
||||
scanner = gimp_scanner_new_file (file, NULL);
|
||||
}
|
||||
|
||||
if (! scanner)
|
||||
|
@ -303,7 +303,7 @@ gimp_unitrc_save (Gimp *gimp)
|
|||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
writer =
|
||||
gimp_config_writer_new_from_gfile (file,
|
||||
gimp_config_writer_new_from_file (file,
|
||||
TRUE,
|
||||
"GIMP units\n\n"
|
||||
"This file contains the user unit database. "
|
||||
|
|
|
@ -576,7 +576,7 @@ gimp_extension_manager_initialize (GimpExtensionManager *manager)
|
|||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
processed_ids = NULL;
|
||||
gimp_config_deserialize_gfile (GIMP_CONFIG (manager),
|
||||
gimp_config_deserialize_file (GIMP_CONFIG (manager),
|
||||
file, &processed_ids, &error);
|
||||
if (error)
|
||||
{
|
||||
|
@ -653,7 +653,7 @@ gimp_extension_manager_exit (GimpExtensionManager *manager)
|
|||
if (manager->p->gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (manager),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager),
|
||||
file,
|
||||
"GIMP extensionrc",
|
||||
"end of extensionrc",
|
||||
|
|
|
@ -90,7 +90,7 @@ gimp_palette_mru_load (GimpPaletteMru *mru,
|
|||
|
||||
palette = GIMP_PALETTE (mru);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, NULL);
|
||||
scanner = gimp_scanner_new_file (file, NULL);
|
||||
if (! scanner)
|
||||
return;
|
||||
|
||||
|
@ -153,7 +153,7 @@ gimp_palette_mru_save (GimpPaletteMru *mru,
|
|||
g_return_if_fail (GIMP_IS_PALETTE_MRU (mru));
|
||||
g_return_if_fail (G_IS_FILE (file));
|
||||
|
||||
writer = gimp_config_writer_new_from_gfile (file,
|
||||
writer = gimp_config_writer_new_from_file (file,
|
||||
TRUE,
|
||||
"GIMP colorrc\n\n"
|
||||
"This file holds a list of "
|
||||
|
|
|
@ -297,7 +297,7 @@ gimp_tool_options_serialize (GimpToolOptions *tool_options,
|
|||
footer = g_strdup_printf ("end of %s options",
|
||||
gimp_object_get_name (tool_options->tool_info));
|
||||
|
||||
retval = gimp_config_serialize_to_gfile (GIMP_CONFIG (tool_options),
|
||||
retval = gimp_config_serialize_to_file (GIMP_CONFIG (tool_options),
|
||||
file,
|
||||
header, footer,
|
||||
NULL,
|
||||
|
@ -326,7 +326,7 @@ gimp_tool_options_deserialize (GimpToolOptions *tool_options,
|
|||
if (tool_options->tool_info->gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
retval = gimp_config_deserialize_gfile (GIMP_CONFIG (tool_options),
|
||||
retval = gimp_config_deserialize_file (GIMP_CONFIG (tool_options),
|
||||
file,
|
||||
NULL,
|
||||
error);
|
||||
|
|
|
@ -331,11 +331,11 @@ color_profile_combo_box_new (ProfileDialog *private)
|
|||
GtkListStore *store;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *chooser;
|
||||
gchar *history;
|
||||
GFile *history;
|
||||
|
||||
history = gimp_personal_rc_file ("profilerc");
|
||||
history = gimp_directory_file ("profilerc", NULL);
|
||||
store = gimp_color_profile_store_new (history);
|
||||
g_free (history);
|
||||
g_object_unref (history);
|
||||
|
||||
if (private->default_profile)
|
||||
{
|
||||
|
|
|
@ -616,7 +616,7 @@ dialogs_load_recent_docks (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (global_recent_docks),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (global_recent_docks),
|
||||
file,
|
||||
NULL, &error))
|
||||
{
|
||||
|
@ -651,7 +651,7 @@ dialogs_save_recent_docks (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (global_recent_docks),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (global_recent_docks),
|
||||
file,
|
||||
"recently closed docks",
|
||||
"end of recently closed docks",
|
||||
|
|
|
@ -1309,12 +1309,12 @@ prefs_dialog_new (Gimp *gimp,
|
|||
{
|
||||
GObject *color_config = G_OBJECT (core_config->color_management);
|
||||
GtkListStore *store;
|
||||
gchar *filename;
|
||||
GFile *file;
|
||||
gint row = 0;
|
||||
|
||||
filename = gimp_personal_rc_file ("profilerc");
|
||||
store = gimp_color_profile_store_new (filename);
|
||||
g_free (filename);
|
||||
file = gimp_directory_file ("profilerc");
|
||||
store = gimp_color_profile_store_new (file);
|
||||
g_object_unref (file);
|
||||
|
||||
gimp_color_profile_store_add_file (GIMP_COLOR_PROFILE_STORE (store),
|
||||
NULL, NULL);
|
||||
|
|
|
@ -79,7 +79,7 @@ session_init (Gimp *gimp)
|
|||
|
||||
file = session_file (gimp);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, &error);
|
||||
scanner = gimp_scanner_new_file (file, &error);
|
||||
|
||||
if (! scanner && error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ session_init (Gimp *gimp)
|
|||
|
||||
file = gimp_sysconf_directory_file ("sessionrc", NULL);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, NULL);
|
||||
scanner = gimp_scanner_new_file (file, NULL);
|
||||
}
|
||||
|
||||
if (! scanner)
|
||||
|
@ -368,7 +368,7 @@ session_save (Gimp *gimp,
|
|||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
writer =
|
||||
gimp_config_writer_new_from_gfile (file,
|
||||
gimp_config_writer_new_from_file (file,
|
||||
TRUE,
|
||||
"GIMP sessionrc\n\n"
|
||||
"This file takes session-specific info "
|
||||
|
|
|
@ -264,7 +264,7 @@ gimp_operation_config_serialize (Gimp *gimp,
|
|||
|
||||
gimp_operation_config_remove_sep (container);
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (container),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (container),
|
||||
file,
|
||||
"settings",
|
||||
"end of settings",
|
||||
|
@ -305,7 +305,7 @@ gimp_operation_config_deserialize (Gimp *gimp,
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (container),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (container),
|
||||
file,
|
||||
NULL, &error))
|
||||
{
|
||||
|
|
|
@ -115,7 +115,7 @@ plug_in_rc_parse (Gimp *gimp,
|
|||
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, error);
|
||||
scanner = gimp_scanner_new_file (file, error);
|
||||
|
||||
if (! scanner)
|
||||
return NULL;
|
||||
|
@ -1105,7 +1105,7 @@ plug_in_rc_write (GSList *plug_in_defs,
|
|||
GEnumClass *enum_class;
|
||||
GSList *list;
|
||||
|
||||
writer = gimp_config_writer_new_from_gfile (file,
|
||||
writer = gimp_config_writer_new_from_file (file,
|
||||
FALSE,
|
||||
"GIMP pluginrc\n\n"
|
||||
"This file can safely be removed and "
|
||||
|
|
|
@ -270,7 +270,7 @@ gimp_tools_restore (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (gimp_config_deserialize_gfile (GIMP_CONFIG (gimp_list), file,
|
||||
if (gimp_config_deserialize_file (GIMP_CONFIG (gimp_list), file,
|
||||
NULL, &error))
|
||||
{
|
||||
gint n = gimp_container_get_n_children (gimp->tool_info_list);
|
||||
|
@ -423,7 +423,7 @@ gimp_tools_save (Gimp *gimp,
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
gimp_config_serialize_to_gfile (GIMP_CONFIG (gimp->tool_info_list),
|
||||
gimp_config_serialize_to_file (GIMP_CONFIG (gimp->tool_info_list),
|
||||
file,
|
||||
"GIMP toolrc",
|
||||
"end of toolrc",
|
||||
|
|
|
@ -122,7 +122,7 @@ gimp_action_history_init (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, NULL);
|
||||
scanner = gimp_scanner_new_file (file, NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
if (! scanner)
|
||||
|
@ -222,7 +222,7 @@ gimp_action_history_exit (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
writer = gimp_config_writer_new_from_gfile (file, TRUE, "GIMP action-history",
|
||||
writer = gimp_config_writer_new_from_file (file, TRUE, "GIMP action-history",
|
||||
NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ gimp_controllers_restore (Gimp *gimp,
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (manager->controllers),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (manager->controllers),
|
||||
file, NULL, &error))
|
||||
{
|
||||
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
|
||||
|
@ -160,7 +160,7 @@ gimp_controllers_restore (Gimp *gimp,
|
|||
|
||||
file = gimp_sysconf_directory_file ("controllerrc", NULL);
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (manager->controllers),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (manager->controllers),
|
||||
file, NULL, &error))
|
||||
{
|
||||
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR,
|
||||
|
@ -205,7 +205,7 @@ gimp_controllers_save (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (manager->controllers),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager->controllers),
|
||||
file,
|
||||
header, footer, NULL,
|
||||
&error))
|
||||
|
|
|
@ -113,7 +113,7 @@ gimp_devices_restore (Gimp *gimp)
|
|||
if (gimp->be_verbose)
|
||||
g_print ("Parsing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
if (! gimp_config_deserialize_gfile (GIMP_CONFIG (manager),
|
||||
if (! gimp_config_deserialize_file (GIMP_CONFIG (manager),
|
||||
file,
|
||||
gimp,
|
||||
&error))
|
||||
|
@ -183,7 +183,7 @@ gimp_devices_save (Gimp *gimp,
|
|||
gimp_device_info_save_tool (current_device);
|
||||
}
|
||||
|
||||
if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (manager),
|
||||
if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager),
|
||||
file,
|
||||
"GIMP devicerc",
|
||||
"end of devicerc",
|
||||
|
|
|
@ -405,7 +405,7 @@ gimp_procedure_config_load_last (GimpProcedureConfig *config,
|
|||
GFile *file = gimp_procedure_config_get_file (config, ".last");
|
||||
gboolean success;
|
||||
|
||||
success = gimp_config_deserialize_gfile (GIMP_CONFIG (config),
|
||||
success = gimp_config_deserialize_file (GIMP_CONFIG (config),
|
||||
file,
|
||||
NULL, error);
|
||||
|
||||
|
@ -427,7 +427,7 @@ gimp_procedure_config_save_last (GimpProcedureConfig *config,
|
|||
GFile *file = gimp_procedure_config_get_file (config, ".last");
|
||||
gboolean success;
|
||||
|
||||
success = gimp_config_serialize_to_gfile (GIMP_CONFIG (config),
|
||||
success = gimp_config_serialize_to_file (GIMP_CONFIG (config),
|
||||
file,
|
||||
"settings",
|
||||
"end of settings",
|
||||
|
|
|
@ -277,47 +277,6 @@ gimp_config_iface_copy (GimpConfig *src,
|
|||
/**
|
||||
* gimp_config_serialize_to_file:
|
||||
* @config: a #GObject that implements the #GimpConfigInterface.
|
||||
* @filename: the name of the file to write the configuration to.
|
||||
* @header: optional file header (must be ASCII only)
|
||||
* @footer: optional file footer (must be ASCII only)
|
||||
* @data: user data passed to the serialize implementation.
|
||||
* @error: return location for a possible error
|
||||
*
|
||||
* Serializes the object properties of @config to the file specified
|
||||
* by @filename. If a file with that name already exists, it is
|
||||
* overwritten. Basically this function opens @filename for you and
|
||||
* calls the serialize function of the @config's #GimpConfigInterface.
|
||||
*
|
||||
* Returns: %TRUE if serialization succeeded, %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
gboolean
|
||||
gimp_config_serialize_to_file (GimpConfig *config,
|
||||
const gchar *filename,
|
||||
const gchar *header,
|
||||
const gchar *footer,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
writer = gimp_config_writer_new_from_file (filename, TRUE, header, error);
|
||||
if (!writer)
|
||||
return FALSE;
|
||||
|
||||
GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
|
||||
|
||||
return gimp_config_writer_finish (writer, footer, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_config_serialize_to_gfile:
|
||||
* @config: a #GObject that implements the #GimpConfigInterface.
|
||||
* @file: the #GFile to write the configuration to.
|
||||
* @header: optional file header (must be ASCII only)
|
||||
* @footer: optional file footer (must be ASCII only)
|
||||
|
@ -334,7 +293,7 @@ gimp_config_serialize_to_file (GimpConfig *config,
|
|||
* Since: 2.10
|
||||
**/
|
||||
gboolean
|
||||
gimp_config_serialize_to_gfile (GimpConfig *config,
|
||||
gimp_config_serialize_to_file (GimpConfig *config,
|
||||
GFile *file,
|
||||
const gchar *header,
|
||||
const gchar *footer,
|
||||
|
@ -347,7 +306,7 @@ gimp_config_serialize_to_gfile (GimpConfig *config,
|
|||
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
writer = gimp_config_writer_new_from_gfile (file, TRUE, header, error);
|
||||
writer = gimp_config_writer_new_from_file (file, TRUE, header, error);
|
||||
if (!writer)
|
||||
return FALSE;
|
||||
|
||||
|
@ -500,54 +459,6 @@ gimp_config_serialize_to_parasite (GimpConfig *config,
|
|||
/**
|
||||
* gimp_config_deserialize_file:
|
||||
* @config: a #GObject that implements the #GimpConfigInterface.
|
||||
* @filename: the name of the file to read configuration from.
|
||||
* @data: user data passed to the deserialize implementation.
|
||||
* @error: return location for a possible error
|
||||
*
|
||||
* Opens the file specified by @filename, reads configuration data
|
||||
* from it and configures @config accordingly. Basically this function
|
||||
* creates a properly configured #GScanner for you and calls the
|
||||
* deserialize function of the @config's #GimpConfigInterface.
|
||||
*
|
||||
* Returns: %TRUE if deserialization succeeded, %FALSE otherwise.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
gboolean
|
||||
gimp_config_deserialize_file (GimpConfig *config,
|
||||
const gchar *filename,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
GScanner *scanner;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
scanner = gimp_scanner_new_file (filename, error);
|
||||
if (! scanner)
|
||||
return FALSE;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (config));
|
||||
|
||||
success = GIMP_CONFIG_GET_INTERFACE (config)->deserialize (config,
|
||||
scanner, 0, data);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (config));
|
||||
|
||||
gimp_scanner_unref (scanner);
|
||||
|
||||
if (! success)
|
||||
g_assert (error == NULL || *error != NULL);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_config_deserialize_gfile:
|
||||
* @config: a #GObject that implements the #GimpConfigInterface.
|
||||
* @file: the #GFile to read configuration from.
|
||||
* @data: user data passed to the deserialize implementation.
|
||||
* @error: return location for a possible error
|
||||
|
@ -562,7 +473,7 @@ gimp_config_deserialize_file (GimpConfig *config,
|
|||
* Since: 2.10
|
||||
**/
|
||||
gboolean
|
||||
gimp_config_deserialize_gfile (GimpConfig *config,
|
||||
gimp_config_deserialize_file (GimpConfig *config,
|
||||
GFile *file,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
|
@ -574,7 +485,7 @@ gimp_config_deserialize_gfile (GimpConfig *config,
|
|||
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
scanner = gimp_scanner_new_gfile (file, error);
|
||||
scanner = gimp_scanner_new_file (file, error);
|
||||
if (! scanner)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -74,12 +74,6 @@ struct _GimpConfigInterface
|
|||
GType gimp_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gboolean gimp_config_serialize_to_file (GimpConfig *config,
|
||||
const gchar *filename,
|
||||
const gchar *header,
|
||||
const gchar *footer,
|
||||
gpointer data,
|
||||
GError **error);
|
||||
gboolean gimp_config_serialize_to_gfile (GimpConfig *config,
|
||||
GFile *file,
|
||||
const gchar *header,
|
||||
const gchar *footer,
|
||||
|
@ -103,10 +97,6 @@ GimpParasite *
|
|||
gpointer data);
|
||||
|
||||
gboolean gimp_config_deserialize_file (GimpConfig *config,
|
||||
const gchar *filename,
|
||||
gpointer data,
|
||||
GError **error);
|
||||
gboolean gimp_config_deserialize_gfile (GimpConfig *config,
|
||||
GFile *file,
|
||||
gpointer data,
|
||||
GError **error);
|
||||
|
|
|
@ -24,7 +24,6 @@ EXPORTS
|
|||
gimp_config_copy
|
||||
gimp_config_deserialize
|
||||
gimp_config_deserialize_file
|
||||
gimp_config_deserialize_gfile
|
||||
gimp_config_deserialize_parasite
|
||||
gimp_config_deserialize_properties
|
||||
gimp_config_deserialize_property
|
||||
|
@ -51,7 +50,6 @@ EXPORTS
|
|||
gimp_config_serialize_property_by_name
|
||||
gimp_config_serialize_to_fd
|
||||
gimp_config_serialize_to_file
|
||||
gimp_config_serialize_to_gfile
|
||||
gimp_config_serialize_to_parasite
|
||||
gimp_config_serialize_to_stream
|
||||
gimp_config_serialize_to_string
|
||||
|
@ -69,7 +67,6 @@ EXPORTS
|
|||
gimp_config_writer_linefeed
|
||||
gimp_config_writer_new_from_fd
|
||||
gimp_config_writer_new_from_file
|
||||
gimp_config_writer_new_from_gfile
|
||||
gimp_config_writer_new_from_stream
|
||||
gimp_config_writer_new_from_string
|
||||
gimp_config_writer_open
|
||||
|
@ -86,7 +83,6 @@ EXPORTS
|
|||
gimp_param_spec_config_path_type
|
||||
gimp_scanner_get_type
|
||||
gimp_scanner_new_file
|
||||
gimp_scanner_new_gfile
|
||||
gimp_scanner_new_stream
|
||||
gimp_scanner_new_string
|
||||
gimp_scanner_parse_boolean
|
||||
|
|
|
@ -118,43 +118,6 @@ gimp_config_writer_newline (GimpConfigWriter *writer)
|
|||
|
||||
/**
|
||||
* gimp_config_writer_new_from_file:
|
||||
* @filename: a filename
|
||||
* @atomic: if %TRUE the file is written atomically
|
||||
* @header: text to include as comment at the top of the file
|
||||
* @error: return location for errors
|
||||
*
|
||||
* Creates a new #GimpConfigWriter and sets it up to write to
|
||||
* @filename. If @atomic is %TRUE, a temporary file is used to avoid
|
||||
* possible race conditions. The temporary file is then moved to
|
||||
* @filename when the writer is closed.
|
||||
*
|
||||
* Returns: (nullable): a new #GimpConfigWriter or %NULL in case of an error
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
GimpConfigWriter *
|
||||
gimp_config_writer_new_from_file (const gchar *filename,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
GFile *file;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
file = g_file_new_for_path (filename);
|
||||
|
||||
writer = gimp_config_writer_new_from_gfile (file, atomic, header, error);
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
return writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_config_writer_new_from_gfile:
|
||||
* @file: a #GFile
|
||||
* @atomic: if %TRUE the file is written atomically
|
||||
* @header: text to include as comment at the top of the file
|
||||
|
@ -170,7 +133,7 @@ gimp_config_writer_new_from_file (const gchar *filename,
|
|||
* Since: 2.10
|
||||
**/
|
||||
GimpConfigWriter *
|
||||
gimp_config_writer_new_from_gfile (GFile *file,
|
||||
gimp_config_writer_new_from_file (GFile *file,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
|
|
|
@ -40,11 +40,7 @@
|
|||
|
||||
GType gimp_config_writer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpConfigWriter * gimp_config_writer_new_from_file (const gchar *filename,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error);
|
||||
GimpConfigWriter * gimp_config_writer_new_from_gfile (GFile *file,
|
||||
GimpConfigWriter * gimp_config_writer_new_from_file (GFile *file,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error);
|
||||
|
|
|
@ -78,32 +78,6 @@ static void gimp_scanner_message (GimpScanner *scanner,
|
|||
|
||||
/**
|
||||
* gimp_scanner_new_file:
|
||||
* @filename:
|
||||
* @error:
|
||||
*
|
||||
* Returns: (transfer full): The new #GimpScanner.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
GimpScanner *
|
||||
gimp_scanner_new_file (const gchar *filename,
|
||||
GError **error)
|
||||
{
|
||||
GimpScanner *scanner;
|
||||
GFile *file;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
file = g_file_new_for_path (filename);
|
||||
scanner = gimp_scanner_new_gfile (file, error);
|
||||
g_object_unref (file);
|
||||
|
||||
return scanner;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_scanner_new_gfile:
|
||||
* @file: a #GFile
|
||||
* @error: return location for #GError, or %NULL
|
||||
*
|
||||
|
@ -112,7 +86,7 @@ gimp_scanner_new_file (const gchar *filename,
|
|||
* Since: 2.10
|
||||
**/
|
||||
GimpScanner *
|
||||
gimp_scanner_new_gfile (GFile *file,
|
||||
gimp_scanner_new_file (GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
GimpScanner *scanner;
|
||||
|
|
|
@ -41,9 +41,7 @@
|
|||
|
||||
GType gimp_scanner_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpScanner * gimp_scanner_new_file (const gchar *filename,
|
||||
GError **error);
|
||||
GimpScanner * gimp_scanner_new_gfile (GFile *file,
|
||||
GimpScanner * gimp_scanner_new_file (GFile *file,
|
||||
GError **error);
|
||||
GimpScanner * gimp_scanner_new_stream (GInputStream *input,
|
||||
GError **error);
|
||||
|
|
|
@ -288,7 +288,7 @@ gimp_color_profile_combo_box_changed (GtkComboBox *combo)
|
|||
* gimp_color_profile_combo_box_new:
|
||||
* @dialog: a #GtkDialog to present when the user selects the
|
||||
* "Select color profile from disk..." item
|
||||
* @history: filename of the profilerc (or %NULL for no history)
|
||||
* @history: #GFile of the profilerc (or %NULL for no history)
|
||||
*
|
||||
* Create a combo-box widget for selecting color profiles. The combo-box
|
||||
* is populated from the file specified as @history. This filename is
|
||||
|
@ -314,12 +314,13 @@ gimp_color_profile_combo_box_changed (GtkComboBox *combo)
|
|||
**/
|
||||
GtkWidget *
|
||||
gimp_color_profile_combo_box_new (GtkWidget *dialog,
|
||||
const gchar *history)
|
||||
GFile *history)
|
||||
{
|
||||
GtkWidget *combo;
|
||||
GtkListStore *store;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL);
|
||||
g_return_val_if_fail (history == NULL || G_IS_FILE (history), NULL);
|
||||
|
||||
store = gimp_color_profile_store_new (history);
|
||||
combo = gimp_color_profile_combo_box_new_with_model (dialog,
|
||||
|
|
|
@ -65,7 +65,7 @@ struct _GimpColorProfileComboBoxClass
|
|||
GType gimp_color_profile_combo_box_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_color_profile_combo_box_new (GtkWidget *dialog,
|
||||
const gchar *history);
|
||||
GFile *history);
|
||||
GtkWidget * gimp_color_profile_combo_box_new_with_model (GtkWidget *dialog,
|
||||
GtkTreeModel *model);
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ enum
|
|||
|
||||
struct _GimpColorProfileStorePrivate
|
||||
{
|
||||
gchar *history;
|
||||
GFile *history;
|
||||
};
|
||||
|
||||
#define GET_PRIVATE(obj) (((GimpColorProfileStore *) (obj))->priv)
|
||||
|
@ -83,10 +83,10 @@ static void gimp_color_profile_store_get_separator (GimpColorProfileStore
|
|||
GtkTreeIter *iter,
|
||||
gboolean top);
|
||||
static gboolean gimp_color_profile_store_save (GimpColorProfileStore *store,
|
||||
const gchar *filename,
|
||||
GFile *file,
|
||||
GError **error);
|
||||
static gboolean gimp_color_profile_store_load (GimpColorProfileStore *store,
|
||||
const gchar *filename,
|
||||
GFile *file,
|
||||
GError **error);
|
||||
|
||||
|
||||
|
@ -110,16 +110,16 @@ gimp_color_profile_store_class_init (GimpColorProfileStoreClass *klass)
|
|||
/**
|
||||
* GimpColorProfileStore:history:
|
||||
*
|
||||
* Filename of the color history used to populate the profile store.
|
||||
* #GFile of the color history used to populate the profile store.
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_HISTORY,
|
||||
g_param_spec_string ("history",
|
||||
g_param_spec_object ("history",
|
||||
"History",
|
||||
"Filename of the color history used to populate the profile store",
|
||||
NULL,
|
||||
"Filen of the color history used to populate the profile store",
|
||||
G_TYPE_FILE,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
GIMP_PARAM_READWRITE));
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ gimp_color_profile_store_finalize (GObject *object)
|
|||
{
|
||||
GimpColorProfileStorePrivate *private = GET_PRIVATE (object);
|
||||
|
||||
g_clear_pointer (&private->history, g_free);
|
||||
g_clear_object (&private->history);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ gimp_color_profile_store_set_property (GObject *object,
|
|||
{
|
||||
case PROP_HISTORY:
|
||||
g_return_if_fail (private->history == NULL);
|
||||
private->history = g_value_dup_string (value);
|
||||
private->history = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -216,7 +216,7 @@ gimp_color_profile_store_get_property (GObject *object,
|
|||
switch (property_id)
|
||||
{
|
||||
case PROP_HISTORY:
|
||||
g_value_set_string (value, private->history);
|
||||
g_value_set_object (value, private->history);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -228,13 +228,13 @@ gimp_color_profile_store_get_property (GObject *object,
|
|||
|
||||
/**
|
||||
* gimp_color_profile_store_new:
|
||||
* @history: filename of the profilerc (or %NULL for no history)
|
||||
* @history: #GFile of the profilerc (or %NULL for no history)
|
||||
*
|
||||
* Creates a new #GimpColorProfileStore object and populates it with
|
||||
* last used profiles read from the file @history. The updated history
|
||||
* is written back to disk when the store is disposed.
|
||||
*
|
||||
* The filename passed as @history is typically created using the
|
||||
* The #GFile passed as @history is typically created using the
|
||||
* following code snippet:
|
||||
* <informalexample><programlisting>
|
||||
* gchar *history = gimp_personal_rc_file ("profilerc");
|
||||
|
@ -245,8 +245,10 @@ gimp_color_profile_store_get_property (GObject *object,
|
|||
* Since: 2.4
|
||||
**/
|
||||
GtkListStore *
|
||||
gimp_color_profile_store_new (const gchar *history)
|
||||
gimp_color_profile_store_new (GFile *history)
|
||||
{
|
||||
g_return_val_if_fail (history == NULL || G_IS_FILE (history), NULL);
|
||||
|
||||
return g_object_new (GIMP_TYPE_COLOR_PROFILE_STORE,
|
||||
"history", history,
|
||||
NULL);
|
||||
|
@ -255,9 +257,9 @@ gimp_color_profile_store_new (const gchar *history)
|
|||
/**
|
||||
* gimp_color_profile_store_add_file:
|
||||
* @store: a #GimpColorProfileStore
|
||||
* @file: file of the profile to add (or %NULL)
|
||||
* @file: #GFile of the profile to add (or %NULL)
|
||||
* @label: label to use for the profile
|
||||
* (may only be %NULL if @filename is %NULL)
|
||||
* (may only be %NULL if @file is %NULL)
|
||||
*
|
||||
* Adds a color profile item to the #GimpColorProfileStore. Items
|
||||
* added with this function will be kept at the top, separated from
|
||||
|
@ -635,14 +637,14 @@ gimp_color_profile_store_load_profile (GimpColorProfileStore *store,
|
|||
|
||||
static gboolean
|
||||
gimp_color_profile_store_load (GimpColorProfileStore *store,
|
||||
const gchar *filename,
|
||||
GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
GScanner *scanner;
|
||||
GTokenType token;
|
||||
gint i = 0;
|
||||
|
||||
scanner = gimp_scanner_new_file (filename, error);
|
||||
scanner = gimp_scanner_new_file (file, error);
|
||||
if (! scanner)
|
||||
return FALSE;
|
||||
|
||||
|
@ -687,7 +689,7 @@ gimp_color_profile_store_load (GimpColorProfileStore *store,
|
|||
|
||||
static gboolean
|
||||
gimp_color_profile_store_save (GimpColorProfileStore *store,
|
||||
const gchar *filename,
|
||||
GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
|
@ -698,7 +700,7 @@ gimp_color_profile_store_save (GimpColorProfileStore *store,
|
|||
gboolean iter_valid;
|
||||
gint i;
|
||||
|
||||
writer = gimp_config_writer_new_from_file (filename,
|
||||
writer = gimp_config_writer_new_from_file (file,
|
||||
TRUE,
|
||||
"GIMP color profile history",
|
||||
error);
|
||||
|
|
|
@ -64,7 +64,7 @@ struct _GimpColorProfileStoreClass
|
|||
|
||||
GType gimp_color_profile_store_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkListStore * gimp_color_profile_store_new (const gchar *history);
|
||||
GtkListStore * gimp_color_profile_store_new (GFile *history);
|
||||
|
||||
void gimp_color_profile_store_add_file (GimpColorProfileStore *store,
|
||||
GFile *file,
|
||||
|
|
Loading…
Reference in New Issue