mirror of https://github.com/GNOME/gimp.git
libgimpconfig: Prevent GIR conflicts in GimpConfigWriter
GimpConfigWriter contains several constructors with the convention `gimp_config_writer_new_* ()`. This will lead to problems however with languages like Vala, where it cannot disambiguate the following: ``` // calls config_writer_new_string() Gimp.ConfigWriter w = new ConfigWriter.string("xxx"); // calls config_writer_string() w.string("xxx") ``` Using `from_` in constructors is general practice in GObject-bsed libraries because of this. This also fixes an error when trying to use vapigen on the GIMP .GIR file.
This commit is contained in:
parent
ebc09985b0
commit
284ba5c870
|
@ -75,7 +75,7 @@ gimp_config_dump (GObject *gimp,
|
|||
output = g_unix_output_stream_new (1, FALSE);
|
||||
#endif
|
||||
|
||||
writer = gimp_config_writer_new_stream (output, NULL, NULL);
|
||||
writer = gimp_config_writer_new_from_stream (output, NULL, NULL);
|
||||
|
||||
switch (format)
|
||||
{
|
||||
|
|
|
@ -190,8 +190,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_gfile (file, TRUE,
|
||||
"GIMP modulerc", &error);
|
||||
writer = gimp_config_writer_new_from_gfile (file,
|
||||
TRUE,
|
||||
"GIMP modulerc",
|
||||
&error);
|
||||
g_object_unref (file);
|
||||
|
||||
if (writer)
|
||||
|
|
|
@ -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_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_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);
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
|
|
|
@ -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_gfile (file,
|
||||
TRUE,
|
||||
"GIMP colorrc\n\n"
|
||||
"This file holds a list of "
|
||||
"recently used colors.",
|
||||
NULL);
|
||||
writer = gimp_config_writer_new_from_gfile (file,
|
||||
TRUE,
|
||||
"GIMP colorrc\n\n"
|
||||
"This file holds a list of "
|
||||
"recently used colors.",
|
||||
NULL);
|
||||
if (! writer)
|
||||
return;
|
||||
|
||||
|
|
|
@ -368,18 +368,18 @@ session_save (Gimp *gimp,
|
|||
g_print ("Writing '%s'\n", gimp_file_get_utf8_name (file));
|
||||
|
||||
writer =
|
||||
gimp_config_writer_new_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_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);
|
||||
g_object_unref (file);
|
||||
|
||||
if (!writer)
|
||||
|
|
|
@ -1109,13 +1109,13 @@ plug_in_rc_write (GSList *plug_in_defs,
|
|||
GEnumClass *enum_class;
|
||||
GSList *list;
|
||||
|
||||
writer = gimp_config_writer_new_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);
|
||||
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)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -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_gfile (file, TRUE, "GIMP action-history",
|
||||
NULL);
|
||||
writer = gimp_config_writer_new_from_gfile (file, TRUE, "GIMP action-history",
|
||||
NULL);
|
||||
g_object_unref (file);
|
||||
|
||||
for (actions = history.items->head, i = 0;
|
||||
|
|
|
@ -115,11 +115,11 @@ gimp_config_string_append_escaped
|
|||
<FILE>gimpconfigwriter</FILE>
|
||||
<TITLE>GimpConfigWriter</TITLE>
|
||||
GimpConfigWriter
|
||||
gimp_config_writer_new_file
|
||||
gimp_config_writer_new_gfile
|
||||
gimp_config_writer_new_stream
|
||||
gimp_config_writer_new_fd
|
||||
gimp_config_writer_new_string
|
||||
gimp_config_writer_new_from_file
|
||||
gimp_config_writer_new_from_gfile
|
||||
gimp_config_writer_new_from_stream
|
||||
gimp_config_writer_new_from_fd
|
||||
gimp_config_writer_new_from_string
|
||||
gimp_config_writer_ref
|
||||
gimp_config_writer_unref
|
||||
gimp_config_writer_open
|
||||
|
|
|
@ -306,7 +306,7 @@ gimp_config_serialize_to_file (GimpConfig *config,
|
|||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
writer = gimp_config_writer_new_file (filename, TRUE, header, error);
|
||||
writer = gimp_config_writer_new_from_file (filename, TRUE, header, error);
|
||||
if (!writer)
|
||||
return FALSE;
|
||||
|
||||
|
@ -347,7 +347,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_gfile (file, TRUE, header, error);
|
||||
writer = gimp_config_writer_new_from_gfile (file, TRUE, header, error);
|
||||
if (!writer)
|
||||
return FALSE;
|
||||
|
||||
|
@ -386,7 +386,7 @@ gimp_config_serialize_to_stream (GimpConfig *config,
|
|||
g_return_val_if_fail (G_IS_OUTPUT_STREAM (output), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
writer = gimp_config_writer_new_stream (output, header, error);
|
||||
writer = gimp_config_writer_new_from_stream (output, header, error);
|
||||
if (!writer)
|
||||
return FALSE;
|
||||
|
||||
|
@ -418,7 +418,7 @@ gimp_config_serialize_to_fd (GimpConfig *config,
|
|||
g_return_val_if_fail (GIMP_IS_CONFIG (config), FALSE);
|
||||
g_return_val_if_fail (fd > 0, FALSE);
|
||||
|
||||
writer = gimp_config_writer_new_fd (fd);
|
||||
writer = gimp_config_writer_new_from_fd (fd);
|
||||
if (!writer)
|
||||
return FALSE;
|
||||
|
||||
|
@ -448,7 +448,7 @@ gimp_config_serialize_to_string (GimpConfig *config,
|
|||
g_return_val_if_fail (GIMP_IS_CONFIG (config), NULL);
|
||||
|
||||
str = g_string_new (NULL);
|
||||
writer = gimp_config_writer_new_string (str);
|
||||
writer = gimp_config_writer_new_from_string (str);
|
||||
|
||||
GIMP_CONFIG_GET_INTERFACE (config)->serialize (config, writer, data);
|
||||
|
||||
|
|
|
@ -63,11 +63,11 @@ EXPORTS
|
|||
gimp_config_writer_get_type
|
||||
gimp_config_writer_identifier
|
||||
gimp_config_writer_linefeed
|
||||
gimp_config_writer_new_fd
|
||||
gimp_config_writer_new_file
|
||||
gimp_config_writer_new_gfile
|
||||
gimp_config_writer_new_stream
|
||||
gimp_config_writer_new_string
|
||||
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
|
||||
gimp_config_writer_print
|
||||
gimp_config_writer_printf
|
||||
|
|
|
@ -117,7 +117,7 @@ gimp_config_writer_newline (GimpConfigWriter *writer)
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_config_writer_new_file:
|
||||
* 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
|
||||
|
@ -133,10 +133,10 @@ gimp_config_writer_newline (GimpConfigWriter *writer)
|
|||
* Since: 2.4
|
||||
**/
|
||||
GimpConfigWriter *
|
||||
gimp_config_writer_new_file (const gchar *filename,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
gimp_config_writer_new_from_file (const gchar *filename,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
GFile *file;
|
||||
|
@ -146,7 +146,7 @@ gimp_config_writer_new_file (const gchar *filename,
|
|||
|
||||
file = g_file_new_for_path (filename);
|
||||
|
||||
writer = gimp_config_writer_new_gfile (file, atomic, header, error);
|
||||
writer = gimp_config_writer_new_from_gfile (file, atomic, header, error);
|
||||
|
||||
g_object_unref (file);
|
||||
|
||||
|
@ -154,7 +154,7 @@ gimp_config_writer_new_file (const gchar *filename,
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_config_writer_new_gfile:
|
||||
* 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 +170,10 @@ gimp_config_writer_new_file (const gchar *filename,
|
|||
* Since: 2.10
|
||||
**/
|
||||
GimpConfigWriter *
|
||||
gimp_config_writer_new_gfile (GFile *file,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
gimp_config_writer_new_from_gfile (GFile *file,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
GOutputStream *output;
|
||||
|
@ -234,7 +234,7 @@ gimp_config_writer_new_gfile (GFile *file,
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_config_writer_new_stream:
|
||||
* gimp_config_writer_new_from_stream:
|
||||
* @output: a #GOutputStream
|
||||
* @header: text to include as comment at the top of the file
|
||||
* @error: return location for errors
|
||||
|
@ -247,9 +247,9 @@ gimp_config_writer_new_gfile (GFile *file,
|
|||
* Since: 2.10
|
||||
**/
|
||||
GimpConfigWriter *
|
||||
gimp_config_writer_new_stream (GOutputStream *output,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
gimp_config_writer_new_from_stream (GOutputStream *output,
|
||||
const gchar *header,
|
||||
GError **error)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
|
||||
|
@ -272,7 +272,7 @@ gimp_config_writer_new_stream (GOutputStream *output,
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_config_writer_new_fd:
|
||||
* gimp_config_writer_new_from_fd:
|
||||
* @fd:
|
||||
*
|
||||
* Returns: (nullable): a new #GimpConfigWriter or %NULL in case of an error
|
||||
|
@ -280,7 +280,7 @@ gimp_config_writer_new_stream (GOutputStream *output,
|
|||
* Since: 2.4
|
||||
**/
|
||||
GimpConfigWriter *
|
||||
gimp_config_writer_new_fd (gint fd)
|
||||
gimp_config_writer_new_from_fd (gint fd)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
|
||||
|
@ -302,7 +302,7 @@ gimp_config_writer_new_fd (gint fd)
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_config_writer_new_string:
|
||||
* gimp_config_writer_new_from_string:
|
||||
* @string:
|
||||
*
|
||||
* Returns: (nullable): a new #GimpConfigWriter or %NULL in case of an error
|
||||
|
@ -310,7 +310,7 @@ gimp_config_writer_new_fd (gint fd)
|
|||
* Since: 2.4
|
||||
**/
|
||||
GimpConfigWriter *
|
||||
gimp_config_writer_new_string (GString *string)
|
||||
gimp_config_writer_new_from_string (GString *string)
|
||||
{
|
||||
GimpConfigWriter *writer;
|
||||
|
||||
|
|
|
@ -40,19 +40,19 @@
|
|||
|
||||
GType gimp_config_writer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpConfigWriter * gimp_config_writer_new_file (const gchar *filename,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error);
|
||||
GimpConfigWriter * gimp_config_writer_new_gfile (GFile *file,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error);
|
||||
GimpConfigWriter * gimp_config_writer_new_stream (GOutputStream *output,
|
||||
const gchar *header,
|
||||
GError **error);
|
||||
GimpConfigWriter * gimp_config_writer_new_fd (gint fd);
|
||||
GimpConfigWriter * gimp_config_writer_new_string (GString *string);
|
||||
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,
|
||||
gboolean atomic,
|
||||
const gchar *header,
|
||||
GError **error);
|
||||
GimpConfigWriter * gimp_config_writer_new_from_stream (GOutputStream *output,
|
||||
const gchar *header,
|
||||
GError **error);
|
||||
GimpConfigWriter * gimp_config_writer_new_from_fd (gint fd);
|
||||
GimpConfigWriter * gimp_config_writer_new_from_string (GString *string);
|
||||
|
||||
GimpConfigWriter * gimp_config_writer_ref (GimpConfigWriter *writer);
|
||||
void gimp_config_writer_unref (GimpConfigWriter *writer);
|
||||
|
|
|
@ -698,10 +698,10 @@ gimp_color_profile_store_save (GimpColorProfileStore *store,
|
|||
gboolean iter_valid;
|
||||
gint i;
|
||||
|
||||
writer = gimp_config_writer_new_file (filename,
|
||||
TRUE,
|
||||
"GIMP color profile history",
|
||||
error);
|
||||
writer = gimp_config_writer_new_from_file (filename,
|
||||
TRUE,
|
||||
"GIMP color profile history",
|
||||
error);
|
||||
if (! writer)
|
||||
return FALSE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue