[gimp] libgimpconfig: get rid of filenames in all config related APIs
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpconfig: get rid of filenames in all config related APIs
- Date: Sat, 21 Sep 2019 10:55:40 +0000 (UTC)
commit dbd793d63190a97e304f170ef79338aeada7bf1f
Author: Michael Natterer <mitch gimp org>
Date: Sat Sep 21 12:53:38 2019 +0200
libgimpconfig: get rid of filenames in all config related APIs
and rename function names which say "gfile" to just "file".
app/config/gimplangrc.c | 8 +--
app/config/gimprc.c | 20 +++---
app/core/gimp-contexts.c | 16 ++---
app/core/gimp-modules.c | 10 +--
app/core/gimp-parasites.c | 12 ++--
app/core/gimp-templates.c | 32 ++++-----
app/core/gimp-units.c | 24 +++----
app/core/gimpextensionmanager.c | 16 ++---
app/core/gimppalettemru.c | 14 ++--
app/core/gimptooloptions.c | 18 ++---
app/dialogs/color-profile-dialog.c | 6 +-
app/dialogs/dialogs.c | 16 ++---
app/dialogs/preferences-dialog.c | 8 +--
app/gui/session.c | 28 ++++----
app/operations/gimp-operation-config.c | 16 ++---
app/plug-in/plug-in-rc.c | 18 ++---
app/tools/gimp-tools.c | 14 ++--
app/widgets/gimpaction-history.c | 6 +-
app/widgets/gimpcontrollers.c | 16 ++---
app/widgets/gimpdevices.c | 20 +++---
libgimp/gimpprocedureconfig.c | 16 ++---
libgimpconfig/gimpconfig-iface.c | 113 ++++--------------------------
libgimpconfig/gimpconfig-iface.h | 10 ---
libgimpconfig/gimpconfig.def | 4 --
libgimpconfig/gimpconfigwriter.c | 45 ++----------
libgimpconfig/gimpconfigwriter.h | 6 +-
libgimpconfig/gimpscanner.c | 30 +-------
libgimpconfig/gimpscanner.h | 4 +-
libgimpwidgets/gimpcolorprofilecombobox.c | 7 +-
libgimpwidgets/gimpcolorprofilecombobox.h | 2 +-
libgimpwidgets/gimpcolorprofilestore.c | 40 ++++++-----
libgimpwidgets/gimpcolorprofilestore.h | 2 +-
32 files changed, 214 insertions(+), 383 deletions(-)
---
diff --git a/app/config/gimplangrc.c b/app/config/gimplangrc.c
index e2e1267fde..b713733572 100644
--- a/app/config/gimplangrc.c
+++ b/app/config/gimplangrc.c
@@ -111,8 +111,8 @@ 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),
- rc->system_gimprc, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
+ rc->system_gimprc, NULL, &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
g_message ("%s", error->message);
@@ -124,8 +124,8 @@ 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),
- rc->user_gimprc, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
+ rc->user_gimprc, NULL, &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
g_message ("%s", error->message);
diff --git a/app/config/gimprc.c b/app/config/gimprc.c
index 2b9e648b4d..e6db2ad95f 100644
--- a/app/config/gimprc.c
+++ b/app/config/gimprc.c
@@ -315,8 +315,8 @@ 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),
- rc->system_gimprc, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
+ rc->system_gimprc, NULL, &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
g_message ("%s", error->message);
@@ -336,8 +336,8 @@ 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),
- rc->user_gimprc, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (rc),
+ rc->user_gimprc, NULL, &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
{
@@ -530,8 +530,8 @@ gimp_rc_save (GimpRc *rc)
if (gimp)
g_object_unref (gimp);
- gimp_config_deserialize_gfile (GIMP_CONFIG (global),
- rc->system_gimprc, NULL, NULL);
+ gimp_config_deserialize_file (GIMP_CONFIG (global),
+ rc->system_gimprc, NULL, NULL);
header = g_strconcat (top, gimp_file_get_utf8_name (rc->system_gimprc),
bottom, NULL);
@@ -540,10 +540,10 @@ 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),
- rc->user_gimprc,
- header, footer, global,
- &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (rc),
+ rc->user_gimprc,
+ header, footer, global,
+ &error))
{
g_message ("%s", error->message);
g_error_free (error);
diff --git a/app/core/gimp-contexts.c b/app/core/gimp-contexts.c
index 59d1e53cf6..572df6f0d3 100644
--- a/app/core/gimp-contexts.c
+++ b/app/core/gimp-contexts.c
@@ -84,9 +84,9 @@ 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)),
- file,
- NULL, &my_error);
+ success = gimp_config_deserialize_file (GIMP_CONFIG (gimp_get_user_context (gimp)),
+ file,
+ NULL, &my_error);
g_object_unref (file);
@@ -121,11 +121,11 @@ 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)),
- file,
- "GIMP user context",
- "end of user context",
- NULL, error);
+ success = gimp_config_serialize_to_file (GIMP_CONFIG (gimp_get_user_context (gimp)),
+ file,
+ "GIMP user context",
+ "end of user context",
+ NULL, error);
g_object_unref (file);
diff --git a/app/core/gimp-modules.c b/app/core/gimp-modules.c
index 129a9ce217..4ab685ac25 100644
--- a/app/core/gimp-modules.c
+++ b/app/core/gimp-modules.c
@@ -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,10 +195,10 @@ 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,
- TRUE,
- "GIMP modulerc",
- &error);
+ writer = gimp_config_writer_new_from_file (file,
+ TRUE,
+ "GIMP modulerc",
+ &error);
g_object_unref (file);
if (writer)
diff --git a/app/core/gimp-parasites.c b/app/core/gimp-parasites.c
index e781a54b5c..1bf1cc03f9 100644
--- a/app/core/gimp-parasites.c
+++ b/app/core/gimp-parasites.c
@@ -124,8 +124,8 @@ 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),
- file, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->parasites),
+ file, NULL, &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
@@ -157,10 +157,10 @@ 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),
- file,
- header, footer, NULL,
- &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->parasites),
+ file,
+ header, footer, NULL,
+ &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
g_error_free (error);
diff --git a/app/core/gimp-templates.c b/app/core/gimp-templates.c
index ba0800dc44..3d0142a1bc 100644
--- a/app/core/gimp-templates.c
+++ b/app/core/gimp-templates.c
@@ -49,8 +49,8 @@ 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),
- file, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates),
+ file, NULL, &error))
{
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{
@@ -59,8 +59,8 @@ gimp_templates_load (Gimp *gimp)
file = gimp_sysconf_directory_file ("templaterc", NULL);
- if (! gimp_config_deserialize_gfile (GIMP_CONFIG (gimp->templates),
- file, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (gimp->templates),
+ file, NULL, &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR,
error->message);
@@ -100,10 +100,10 @@ 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),
- file,
- header, footer, NULL,
- &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (gimp->templates),
+ file,
+ header, footer, NULL,
+ &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
g_error_free (error);
@@ -171,8 +171,8 @@ 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,
- NULL, NULL))
+ if (gimp_config_deserialize_file (GIMP_CONFIG (templates), file,
+ NULL, NULL))
{
GFile *sysconf_file;
@@ -190,23 +190,23 @@ 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),
- sysconf_file, NULL, NULL);
+ 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),
- sysconf_file, NULL, NULL);
+ gimp_config_deserialize_file (GIMP_CONFIG (templates),
+ sysconf_file, NULL, NULL);
}
g_object_unref (sysconf_file);
gimp_list_reverse (GIMP_LIST (templates));
- gimp_config_serialize_to_gfile (GIMP_CONFIG (templates), file,
- NULL, NULL, NULL, NULL);
+ gimp_config_serialize_to_file (GIMP_CONFIG (templates), file,
+ NULL, NULL, NULL, NULL);
}
g_object_unref (file);
diff --git a/app/core/gimp-units.c b/app/core/gimp-units.c
index 07c2bcf2da..77a4c84f14 100644
--- a/app/core/gimp-units.c
+++ b/app/core/gimp-units.c
@@ -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,16 +303,16 @@ gimp_unitrc_save (Gimp *gimp)
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
writer =
- gimp_config_writer_new_from_gfile (file,
- TRUE,
- "GIMP units\n\n"
- "This file contains the user unit database. "
- "You can edit this list with the unit "
- "editor. You are not supposed to edit it "
- "manually, but of course you can do.\n"
- "This file will be entirely rewritten each "
- "time you exit.",
- NULL);
+ gimp_config_writer_new_from_file (file,
+ TRUE,
+ "GIMP units\n\n"
+ "This file contains the user unit database. "
+ "You can edit this list with the unit "
+ "editor. You are not supposed to edit it "
+ "manually, but of course you can do.\n"
+ "This file will be entirely rewritten each "
+ "time you exit.",
+ NULL);
g_object_unref (file);
diff --git a/app/core/gimpextensionmanager.c b/app/core/gimpextensionmanager.c
index 4bfbdce48c..e32eab5f17 100644
--- a/app/core/gimpextensionmanager.c
+++ b/app/core/gimpextensionmanager.c
@@ -576,8 +576,8 @@ 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),
- file, &processed_ids, &error);
+ gimp_config_deserialize_file (GIMP_CONFIG (manager),
+ file, &processed_ids, &error);
if (error)
{
g_printerr ("Failed to parse '%s': %s\n",
@@ -653,12 +653,12 @@ 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),
- file,
- "GIMP extensionrc",
- "end of extensionrc",
- NULL,
- &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager),
+ file,
+ "GIMP extensionrc",
+ "end of extensionrc",
+ NULL,
+ &error))
{
gimp_message_literal (manager->p->gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
g_error_free (error);
diff --git a/app/core/gimppalettemru.c b/app/core/gimppalettemru.c
index 637006616e..e1c60981f9 100644
--- a/app/core/gimppalettemru.c
+++ b/app/core/gimppalettemru.c
@@ -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,12 +153,12 @@ 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,
- TRUE,
- "GIMP colorrc\n\n"
- "This file holds a list of "
- "recently used colors.",
- NULL);
+ writer = gimp_config_writer_new_from_file (file,
+ TRUE,
+ "GIMP colorrc\n\n"
+ "This file holds a list of "
+ "recently used colors.",
+ NULL);
if (! writer)
return;
diff --git a/app/core/gimptooloptions.c b/app/core/gimptooloptions.c
index 8a19d6edaa..db2dafbd20 100644
--- a/app/core/gimptooloptions.c
+++ b/app/core/gimptooloptions.c
@@ -297,11 +297,11 @@ 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),
- file,
- header, footer,
- NULL,
- error);
+ retval = gimp_config_serialize_to_file (GIMP_CONFIG (tool_options),
+ file,
+ header, footer,
+ NULL,
+ error);
g_free (header);
g_free (footer);
@@ -326,10 +326,10 @@ 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),
- file,
- NULL,
- error);
+ retval = gimp_config_deserialize_file (GIMP_CONFIG (tool_options),
+ file,
+ NULL,
+ error);
g_object_unref (file);
diff --git a/app/dialogs/color-profile-dialog.c b/app/dialogs/color-profile-dialog.c
index b025d3bcad..0fbee6d28a 100644
--- a/app/dialogs/color-profile-dialog.c
+++ b/app/dialogs/color-profile-dialog.c
@@ -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)
{
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index 721118671b..6cbabfe6ca 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -616,9 +616,9 @@ 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),
- file,
- NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (global_recent_docks),
+ file,
+ NULL, &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
@@ -651,11 +651,11 @@ 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),
- file,
- "recently closed docks",
- "end of recently closed docks",
- NULL, &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (global_recent_docks),
+ file,
+ "recently closed docks",
+ "end of recently closed docks",
+ NULL, &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
g_clear_error (&error);
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 1af823d561..246d72c2b7 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -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);
diff --git a/app/gui/session.c b/app/gui/session.c
index 66bcbbf9b6..3d52817dd4 100644
--- a/app/gui/session.c
+++ b/app/gui/session.c
@@ -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,18 +368,18 @@ session_save (Gimp *gimp,
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
writer =
- gimp_config_writer_new_from_gfile (file,
- TRUE,
- "GIMP sessionrc\n\n"
- "This file takes session-specific info "
- "(that is info, you want to keep between "
- "two GIMP sessions). You are not supposed "
- "to edit it manually, but of course you "
- "can do. The sessionrc will be entirely "
- "rewritten every time you quit GIMP. "
- "If this file isn't found, defaults are "
- "used.",
- NULL);
+ gimp_config_writer_new_from_file (file,
+ TRUE,
+ "GIMP sessionrc\n\n"
+ "This file takes session-specific info "
+ "(that is info, you want to keep between "
+ "two GIMP sessions). You are not supposed "
+ "to edit it manually, but of course you "
+ "can do. The sessionrc will be entirely "
+ "rewritten every time you quit GIMP. "
+ "If this file isn't found, defaults are "
+ "used.",
+ NULL);
g_object_unref (file);
if (!writer)
diff --git a/app/operations/gimp-operation-config.c b/app/operations/gimp-operation-config.c
index efa08a3b1d..4135d7d50d 100644
--- a/app/operations/gimp-operation-config.c
+++ b/app/operations/gimp-operation-config.c
@@ -264,11 +264,11 @@ gimp_operation_config_serialize (Gimp *gimp,
gimp_operation_config_remove_sep (container);
- if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (container),
- file,
- "settings",
- "end of settings",
- NULL, &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (container),
+ file,
+ "settings",
+ "end of settings",
+ NULL, &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR,
error->message);
@@ -305,9 +305,9 @@ 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),
- file,
- NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (container),
+ file,
+ NULL, &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR,
diff --git a/app/plug-in/plug-in-rc.c b/app/plug-in/plug-in-rc.c
index f61459eecb..1f82829fef 100644
--- a/app/plug-in/plug-in-rc.c
+++ b/app/plug-in/plug-in-rc.c
@@ -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,14 +1105,14 @@ plug_in_rc_write (GSList *plug_in_defs,
GEnumClass *enum_class;
GSList *list;
- writer = gimp_config_writer_new_from_gfile (file,
- FALSE,
- "GIMP pluginrc\n\n"
- "This file can safely be removed and "
- "will be automatically regenerated by "
- "querying the installed plug-ins.",
- error);
- if (!writer)
+ writer = gimp_config_writer_new_from_file (file,
+ FALSE,
+ "GIMP pluginrc\n\n"
+ "This file can safely be removed and "
+ "will be automatically regenerated by "
+ "querying the installed plug-ins.",
+ error);
+ if (! writer)
return FALSE;
enum_class = g_type_class_ref (GIMP_TYPE_ICON_TYPE);
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 979b3cff37..3d8b5ff764 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -270,8 +270,8 @@ 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,
- NULL, &error))
+ if (gimp_config_deserialize_file (GIMP_CONFIG (gimp_list), file,
+ NULL, &error))
{
gint n = gimp_container_get_n_children (gimp->tool_info_list);
gint i;
@@ -423,11 +423,11 @@ 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),
- file,
- "GIMP toolrc",
- "end of toolrc",
- NULL, NULL);
+ gimp_config_serialize_to_file (GIMP_CONFIG (gimp->tool_info_list),
+ file,
+ "GIMP toolrc",
+ "end of toolrc",
+ NULL, NULL);
g_object_unref (file);
}
diff --git a/app/widgets/gimpaction-history.c b/app/widgets/gimpaction-history.c
index e448dec722..5bfefd1cce 100644
--- a/app/widgets/gimpaction-history.c
+++ b/app/widgets/gimpaction-history.c
@@ -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,8 +222,8 @@ 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",
- NULL);
+ writer = gimp_config_writer_new_from_file (file, TRUE, "GIMP action-history",
+ NULL);
g_object_unref (file);
for (actions = history.items->head, i = 0;
diff --git a/app/widgets/gimpcontrollers.c b/app/widgets/gimpcontrollers.c
index 3a4b921144..9268627121 100644
--- a/app/widgets/gimpcontrollers.c
+++ b/app/widgets/gimpcontrollers.c
@@ -150,8 +150,8 @@ 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),
- file, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (manager->controllers),
+ file, NULL, &error))
{
if (error->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{
@@ -160,8 +160,8 @@ gimp_controllers_restore (Gimp *gimp,
file = gimp_sysconf_directory_file ("controllerrc", NULL);
- if (! gimp_config_deserialize_gfile (GIMP_CONFIG (manager->controllers),
- file, NULL, &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (manager->controllers),
+ file, NULL, &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR,
error->message);
@@ -205,10 +205,10 @@ 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),
- file,
- header, footer, NULL,
- &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager->controllers),
+ file,
+ header, footer, NULL,
+ &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
g_error_free (error);
diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c
index 2d4950591e..3145272ea9 100644
--- a/app/widgets/gimpdevices.c
+++ b/app/widgets/gimpdevices.c
@@ -113,10 +113,10 @@ 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),
- file,
- gimp,
- &error))
+ if (! gimp_config_deserialize_file (GIMP_CONFIG (manager),
+ file,
+ gimp,
+ &error))
{
if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
@@ -183,12 +183,12 @@ gimp_devices_save (Gimp *gimp,
gimp_device_info_save_tool (current_device);
}
- if (! gimp_config_serialize_to_gfile (GIMP_CONFIG (manager),
- file,
- "GIMP devicerc",
- "end of devicerc",
- NULL,
- &error))
+ if (! gimp_config_serialize_to_file (GIMP_CONFIG (manager),
+ file,
+ "GIMP devicerc",
+ "end of devicerc",
+ NULL,
+ &error))
{
gimp_message_literal (gimp, NULL, GIMP_MESSAGE_ERROR, error->message);
g_error_free (error);
diff --git a/libgimp/gimpprocedureconfig.c b/libgimp/gimpprocedureconfig.c
index a64bb5f610..cec4646e06 100644
--- a/libgimp/gimpprocedureconfig.c
+++ b/libgimp/gimpprocedureconfig.c
@@ -405,9 +405,9 @@ 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),
- file,
- NULL, error);
+ success = gimp_config_deserialize_file (GIMP_CONFIG (config),
+ file,
+ NULL, error);
if (! success && (*error)->code == GIMP_CONFIG_ERROR_OPEN_ENOENT)
{
@@ -427,11 +427,11 @@ 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),
- file,
- "settings",
- "end of settings",
- NULL, error);
+ success = gimp_config_serialize_to_file (GIMP_CONFIG (config),
+ file,
+ "settings",
+ "end of settings",
+ NULL, error);
g_object_unref (file);
diff --git a/libgimpconfig/gimpconfig-iface.c b/libgimpconfig/gimpconfig-iface.c
index acae2cd822..c54da020d3 100644
--- a/libgimpconfig/gimpconfig-iface.c
+++ b/libgimpconfig/gimpconfig-iface.c
@@ -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,12 +293,12 @@ gimp_config_serialize_to_file (GimpConfig *config,
* Since: 2.10
**/
gboolean
-gimp_config_serialize_to_gfile (GimpConfig *config,
- GFile *file,
- const gchar *header,
- const gchar *footer,
- gpointer data,
- GError **error)
+gimp_config_serialize_to_file (GimpConfig *config,
+ GFile *file,
+ const gchar *header,
+ const gchar *footer,
+ gpointer data,
+ GError **error)
{
GimpConfigWriter *writer;
@@ -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,10 +473,10 @@ gimp_config_deserialize_file (GimpConfig *config,
* Since: 2.10
**/
gboolean
-gimp_config_deserialize_gfile (GimpConfig *config,
- GFile *file,
- gpointer data,
- GError **error)
+gimp_config_deserialize_file (GimpConfig *config,
+ GFile *file,
+ gpointer data,
+ GError **error)
{
GScanner *scanner;
gboolean success;
@@ -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;
diff --git a/libgimpconfig/gimpconfig-iface.h b/libgimpconfig/gimpconfig-iface.h
index 5b8aa2352d..b765db9e57 100644
--- a/libgimpconfig/gimpconfig-iface.h
+++ b/libgimpconfig/gimpconfig-iface.h
@@ -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);
diff --git a/libgimpconfig/gimpconfig.def b/libgimpconfig/gimpconfig.def
index 21baee3274..dedc32de94 100644
--- a/libgimpconfig/gimpconfig.def
+++ b/libgimpconfig/gimpconfig.def
@@ -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
diff --git a/libgimpconfig/gimpconfigwriter.c b/libgimpconfig/gimpconfigwriter.c
index c813940624..a8816d6b3d 100644
--- a/libgimpconfig/gimpconfigwriter.c
+++ b/libgimpconfig/gimpconfigwriter.c
@@ -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,10 +133,10 @@ gimp_config_writer_new_from_file (const gchar *filename,
* Since: 2.10
**/
GimpConfigWriter *
-gimp_config_writer_new_from_gfile (GFile *file,
- gboolean atomic,
- const gchar *header,
- GError **error)
+gimp_config_writer_new_from_file (GFile *file,
+ gboolean atomic,
+ const gchar *header,
+ GError **error)
{
GimpConfigWriter *writer;
GOutputStream *output;
diff --git a/libgimpconfig/gimpconfigwriter.h b/libgimpconfig/gimpconfigwriter.h
index 1995e5619a..5e60fa3427 100644
--- a/libgimpconfig/gimpconfigwriter.h
+++ b/libgimpconfig/gimpconfigwriter.h
@@ -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);
diff --git a/libgimpconfig/gimpscanner.c b/libgimpconfig/gimpscanner.c
index f3c3632226..63d3305187 100644
--- a/libgimpconfig/gimpscanner.c
+++ b/libgimpconfig/gimpscanner.c
@@ -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,8 +86,8 @@ gimp_scanner_new_file (const gchar *filename,
* Since: 2.10
**/
GimpScanner *
-gimp_scanner_new_gfile (GFile *file,
- GError **error)
+gimp_scanner_new_file (GFile *file,
+ GError **error)
{
GimpScanner *scanner;
gchar *path;
diff --git a/libgimpconfig/gimpscanner.h b/libgimpconfig/gimpscanner.h
index fc84f62371..3fd7dced20 100644
--- a/libgimpconfig/gimpscanner.h
+++ b/libgimpconfig/gimpscanner.h
@@ -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);
diff --git a/libgimpwidgets/gimpcolorprofilecombobox.c b/libgimpwidgets/gimpcolorprofilecombobox.c
index 1459ddf18c..77b85bed6c 100644
--- a/libgimpwidgets/gimpcolorprofilecombobox.c
+++ b/libgimpwidgets/gimpcolorprofilecombobox.c
@@ -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
@@ -313,13 +313,14 @@ gimp_color_profile_combo_box_changed (GtkComboBox *combo)
* Since: 2.4
**/
GtkWidget *
-gimp_color_profile_combo_box_new (GtkWidget *dialog,
- const gchar *history)
+gimp_color_profile_combo_box_new (GtkWidget *dialog,
+ 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,
diff --git a/libgimpwidgets/gimpcolorprofilecombobox.h b/libgimpwidgets/gimpcolorprofilecombobox.h
index 31fdf978fb..86f041dc52 100644
--- a/libgimpwidgets/gimpcolorprofilecombobox.h
+++ b/libgimpwidgets/gimpcolorprofilecombobox.h
@@ -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);
diff --git a/libgimpwidgets/gimpcolorprofilestore.c b/libgimpwidgets/gimpcolorprofilestore.c
index 5fab72299e..6367de3cc5 100644
--- a/libgimpwidgets/gimpcolorprofilestore.c
+++ b/libgimpwidgets/gimpcolorprofilestore.c
@@ -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);
diff --git a/libgimpwidgets/gimpcolorprofilestore.h b/libgimpwidgets/gimpcolorprofilestore.h
index e9e90b422c..a644684114 100644
--- a/libgimpwidgets/gimpcolorprofilestore.h
+++ b/libgimpwidgets/gimpcolorprofilestore.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]