mirror of https://github.com/GNOME/gimp.git
Bug 555954 – Merge Tagging of Gimp Resources GSoC Project
Partial merge of code from Aurimas Juška. * app/core/gimpdata.[ch] (gimp_data_make_internal): Add an 'identifier' parameter/instance struct member that can be used to identify the internal GimpData object across sessions. It is the internal-object counterpart to a file path. * app/core/gimp.c * app/core/gimpcurve.c * app/core/gimpbrush.c * app/core/gimppattern.c * app/core/gimppalette.c * app/core/gimpgradient.c * app/core/gimp-gradients.c: Assign an identifier to the the internal GimpData objects. svn path=/trunk/; revision=27781
This commit is contained in:
parent
41ad6f4ea4
commit
70ed5218d6
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2008-12-12 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
Bug 555954 – Merge Tagging of Gimp Resources GSoC Project
|
||||
|
||||
Partial merge of code from Aurimas Juška.
|
||||
|
||||
* app/core/gimpdata.[ch] (gimp_data_make_internal): Add an
|
||||
'identifier' parameter/instance struct member that can be used to
|
||||
identify the internal GimpData object across sessions. It is the
|
||||
internal-object counterpart to a file path.
|
||||
|
||||
* app/core/gimp.c
|
||||
* app/core/gimpcurve.c
|
||||
* app/core/gimpbrush.c
|
||||
* app/core/gimppattern.c
|
||||
* app/core/gimppalette.c
|
||||
* app/core/gimpgradient.c
|
||||
* app/core/gimp-gradients.c: Assign an identifier to the the
|
||||
internal GimpData objects.
|
||||
|
||||
2008-12-12 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/core/gimptagged.c (gimp_tagged_get_identifier): Clarify
|
||||
|
|
|
@ -88,7 +88,7 @@ gimp_gradients_add_gradient (Gimp *gimp,
|
|||
{
|
||||
GimpGradient *gradient = GIMP_GRADIENT (gimp_gradient_new (name));
|
||||
|
||||
gimp_data_make_internal (GIMP_DATA (gradient));
|
||||
gimp_data_make_internal (GIMP_DATA (gradient), id);
|
||||
|
||||
gradient->segments->left_color_type = GIMP_GRADIENT_COLOR_FOREGROUND;
|
||||
gradient->segments->right_color_type = GIMP_GRADIENT_COLOR_BACKGROUND;
|
||||
|
|
|
@ -602,14 +602,16 @@ gimp_real_initialize (Gimp *gimp,
|
|||
|
||||
/* add the clipboard brush */
|
||||
clipboard_brush = gimp_brush_clipboard_new (gimp);
|
||||
gimp_data_make_internal (GIMP_DATA (clipboard_brush));
|
||||
gimp_data_make_internal (GIMP_DATA (clipboard_brush),
|
||||
"gimp-brush-clipboard");
|
||||
gimp_container_add (gimp->brush_factory->container,
|
||||
GIMP_OBJECT (clipboard_brush));
|
||||
g_object_unref (clipboard_brush);
|
||||
|
||||
/* add the clipboard pattern */
|
||||
clipboard_pattern = gimp_pattern_clipboard_new (gimp);
|
||||
gimp_data_make_internal (GIMP_DATA (clipboard_pattern));
|
||||
gimp_data_make_internal (GIMP_DATA (clipboard_pattern),
|
||||
"gimp-pattern-clipboard");
|
||||
gimp_container_add (gimp->pattern_factory->container,
|
||||
GIMP_OBJECT (clipboard_pattern));
|
||||
g_object_unref (clipboard_pattern);
|
||||
|
|
|
@ -380,7 +380,8 @@ gimp_brush_get_standard (void)
|
|||
standard_brush = gimp_brush_new ("Standard");
|
||||
|
||||
standard_brush->dirty = FALSE;
|
||||
gimp_data_make_internal (standard_brush);
|
||||
gimp_data_make_internal (standard_brush,
|
||||
"gimp-brush-standard");
|
||||
|
||||
/* set ref_count to 2 --> never swap the standard brush */
|
||||
g_object_ref (standard_brush);
|
||||
|
|
|
@ -534,7 +534,8 @@ gimp_curve_get_standard (void)
|
|||
standard_curve = gimp_curve_new ("Standard");
|
||||
|
||||
standard_curve->dirty = FALSE;
|
||||
gimp_data_make_internal (standard_curve);
|
||||
gimp_data_make_internal (standard_curve,
|
||||
"gimp-curve-standard");
|
||||
|
||||
g_object_ref (standard_curve);
|
||||
}
|
||||
|
|
|
@ -210,6 +210,7 @@ gimp_data_init (GimpData *data,
|
|||
data->freeze_count = 0;
|
||||
data->mtime = 0;
|
||||
data->tags = NULL;
|
||||
data->identifier = NULL;
|
||||
|
||||
/* look at the passed class pointer, not at GIMP_DATA_GET_CLASS(data)
|
||||
* here, because the latter is always GimpDataClass itself
|
||||
|
@ -252,6 +253,12 @@ gimp_data_finalize (GObject *object)
|
|||
data->tags = NULL;
|
||||
}
|
||||
|
||||
if (data->identifier)
|
||||
{
|
||||
g_free (data->identifier);
|
||||
data->identifier = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -713,9 +720,13 @@ gimp_data_duplicate (GimpData *data)
|
|||
* saved to disk. Note that if you do this, later calls to
|
||||
* gimp_data_save() and gimp_data_delete_from_disk() will
|
||||
* automatically return successfully without giving any warning.
|
||||
*
|
||||
* The identifier name shall be an untranslated globally unique string
|
||||
* that identifies the internal object across sessions.
|
||||
**/
|
||||
void
|
||||
gimp_data_make_internal (GimpData *data)
|
||||
gimp_data_make_internal (GimpData *data,
|
||||
const gchar *identifier)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DATA (data));
|
||||
|
||||
|
@ -725,6 +736,8 @@ gimp_data_make_internal (GimpData *data)
|
|||
data->filename = NULL;
|
||||
}
|
||||
|
||||
data->identifier = g_strdup (identifier);
|
||||
|
||||
data->internal = TRUE;
|
||||
data->writable = FALSE;
|
||||
data->deletable = FALSE;
|
||||
|
|
|
@ -59,6 +59,11 @@ struct _GimpData
|
|||
gint freeze_count;
|
||||
time_t mtime;
|
||||
|
||||
/* Identifies the GimpData object across sessions. Used when there
|
||||
* is not a filename associated with the object.
|
||||
*/
|
||||
gchar *identifier;
|
||||
|
||||
GList *tags;
|
||||
};
|
||||
|
||||
|
@ -102,7 +107,8 @@ const gchar * gimp_data_get_mime_type (GimpData *data);
|
|||
|
||||
GimpData * gimp_data_duplicate (GimpData *data);
|
||||
|
||||
void gimp_data_make_internal (GimpData *data);
|
||||
void gimp_data_make_internal (GimpData *data,
|
||||
const gchar *identifier);
|
||||
|
||||
gint gimp_data_compare (GimpData *data1,
|
||||
GimpData *data2);
|
||||
|
|
|
@ -285,7 +285,8 @@ gimp_gradient_get_standard (void)
|
|||
standard_gradient = gimp_gradient_new ("Standard");
|
||||
|
||||
standard_gradient->dirty = FALSE;
|
||||
gimp_data_make_internal (standard_gradient);
|
||||
gimp_data_make_internal (standard_gradient,
|
||||
"gimp-gradient-standard");
|
||||
|
||||
g_object_ref (standard_gradient);
|
||||
}
|
||||
|
|
|
@ -281,7 +281,8 @@ gimp_palette_get_standard (void)
|
|||
standard_palette = gimp_palette_new ("Standard");
|
||||
|
||||
standard_palette->dirty = FALSE;
|
||||
gimp_data_make_internal (standard_palette);
|
||||
gimp_data_make_internal (standard_palette,
|
||||
"gimp-palette-standard");
|
||||
|
||||
g_object_ref (standard_palette);
|
||||
}
|
||||
|
|
|
@ -214,7 +214,8 @@ gimp_pattern_get_standard (void)
|
|||
standard_pattern = gimp_pattern_new ("Standard");
|
||||
|
||||
standard_pattern->dirty = FALSE;
|
||||
gimp_data_make_internal (standard_pattern);
|
||||
gimp_data_make_internal (standard_pattern,
|
||||
"gimp-pattern-standard");
|
||||
|
||||
/* set ref_count to 2 --> never swap the standard pattern */
|
||||
g_object_ref (standard_pattern);
|
||||
|
|
Loading…
Reference in New Issue