mirror of https://github.com/GNOME/gimp.git
Move "parasites" to GimpImagePrivate
This commit is contained in:
parent
4a247e9182
commit
4143f5cd62
|
@ -33,6 +33,7 @@
|
|||
#include "gimpimage-duplicate.h"
|
||||
#include "gimpimage-grid.h"
|
||||
#include "gimpimage-guides.h"
|
||||
#include "gimpimage-private.h"
|
||||
#include "gimpimage-sample-points.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplayer-floating-sel.h"
|
||||
|
@ -436,9 +437,12 @@ static void
|
|||
gimp_image_duplicate_parasites (GimpImage *image,
|
||||
GimpImage *new_image)
|
||||
{
|
||||
if (image->parasites)
|
||||
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
||||
GimpImagePrivate *new_private = GIMP_IMAGE_GET_PRIVATE (new_image);
|
||||
|
||||
if (private->parasites)
|
||||
{
|
||||
g_object_unref (new_image->parasites);
|
||||
new_image->parasites = gimp_parasite_list_copy (image->parasites);
|
||||
g_object_unref (new_private->parasites);
|
||||
new_private->parasites = gimp_parasite_list_copy (private->parasites);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,8 @@ struct _GimpImagePrivate
|
|||
|
||||
GimpLayer *floating_sel; /* the FS layer */
|
||||
GimpChannel *selection_mask; /* the selection mask channel */
|
||||
|
||||
GimpParasiteList *parasites; /* Plug-in parasite data */
|
||||
};
|
||||
|
||||
#define GIMP_IMAGE_GET_PRIVATE(image) \
|
||||
|
|
|
@ -659,7 +659,7 @@ gimp_image_init (GimpImage *image)
|
|||
private->floating_sel = NULL;
|
||||
private->selection_mask = NULL;
|
||||
|
||||
image->parasites = gimp_parasite_list_new ();
|
||||
private->parasites = gimp_parasite_list_new ();
|
||||
|
||||
for (i = 0; i < MAX_CHANNELS; i++)
|
||||
{
|
||||
|
@ -921,10 +921,10 @@ gimp_image_finalize (GObject *object)
|
|||
image->preview = NULL;
|
||||
}
|
||||
|
||||
if (image->parasites)
|
||||
if (private->parasites)
|
||||
{
|
||||
g_object_unref (image->parasites);
|
||||
image->parasites = NULL;
|
||||
g_object_unref (private->parasites);
|
||||
private->parasites = NULL;
|
||||
}
|
||||
|
||||
if (private->guides)
|
||||
|
@ -1034,7 +1034,7 @@ gimp_image_get_memsize (GimpObject *object,
|
|||
memsize += gimp_object_get_memsize (GIMP_OBJECT (private->selection_mask),
|
||||
gui_size);
|
||||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (image->parasites),
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (private->parasites),
|
||||
gui_size);
|
||||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (image->undo_stack),
|
||||
|
@ -2552,7 +2552,8 @@ gimp_image_parasite_find (const GimpImage *image,
|
|||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
return gimp_parasite_list_find (image->parasites, name);
|
||||
return gimp_parasite_list_find (GIMP_IMAGE_GET_PRIVATE (image)->parasites,
|
||||
name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2567,15 +2568,18 @@ gchar **
|
|||
gimp_image_parasite_list (const GimpImage *image,
|
||||
gint *count)
|
||||
{
|
||||
gchar **list;
|
||||
gchar **cur;
|
||||
GimpImagePrivate *private;
|
||||
gchar **list;
|
||||
gchar **cur;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
|
||||
*count = gimp_parasite_list_length (image->parasites);
|
||||
private = GIMP_IMAGE_GET_PRIVATE (image);
|
||||
|
||||
*count = gimp_parasite_list_length (private->parasites);
|
||||
cur = list = g_new (gchar *, *count);
|
||||
|
||||
gimp_parasite_list_foreach (image->parasites, (GHFunc) list_func, &cur);
|
||||
gimp_parasite_list_foreach (private->parasites, (GHFunc) list_func, &cur);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -2608,7 +2612,7 @@ gimp_image_parasite_attach (GimpImage *image,
|
|||
* Now we simply attach the parasite without pushing an undo. That way
|
||||
* it's undoable but does not block the undo system. --Sven
|
||||
*/
|
||||
gimp_parasite_list_add (image->parasites, ©);
|
||||
gimp_parasite_list_add (GIMP_IMAGE_GET_PRIVATE (image)->parasites, ©);
|
||||
|
||||
if (gimp_parasite_has_flag (©, GIMP_PARASITE_ATTACH_PARENT))
|
||||
{
|
||||
|
@ -2627,12 +2631,15 @@ void
|
|||
gimp_image_parasite_detach (GimpImage *image,
|
||||
const gchar *name)
|
||||
{
|
||||
GimpImagePrivate *private;
|
||||
const GimpParasite *parasite;
|
||||
|
||||
g_return_if_fail (GIMP_IS_IMAGE (image));
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
if (! (parasite = gimp_parasite_list_find (image->parasites, name)))
|
||||
private = GIMP_IMAGE_GET_PRIVATE (image);
|
||||
|
||||
if (! (parasite = gimp_parasite_list_find (private->parasites, name)))
|
||||
return;
|
||||
|
||||
if (gimp_parasite_is_undoable (parasite))
|
||||
|
@ -2640,7 +2647,7 @@ gimp_image_parasite_detach (GimpImage *image,
|
|||
_("Remove Parasite from Image"),
|
||||
name);
|
||||
|
||||
gimp_parasite_list_remove (image->parasites, name);
|
||||
gimp_parasite_list_remove (private->parasites, name);
|
||||
|
||||
g_signal_emit (image, gimp_image_signals[PARASITE_DETACHED], 0,
|
||||
name);
|
||||
|
|
|
@ -105,8 +105,6 @@ struct _GimpImage
|
|||
|
||||
Gimp *gimp; /* the GIMP the image belongs to*/
|
||||
|
||||
GimpParasiteList *parasites; /* Plug-in parasite data */
|
||||
|
||||
gboolean visible[MAX_CHANNELS]; /* visible channels */
|
||||
gboolean active[MAX_CHANNELS]; /* active channels */
|
||||
|
||||
|
|
|
@ -444,9 +444,9 @@ gimp_image_undo_pop (GimpUndo *undo,
|
|||
(gimp_image_parasite_find (image, image_undo->parasite_name));
|
||||
|
||||
if (parasite)
|
||||
gimp_parasite_list_add (image->parasites, parasite);
|
||||
gimp_parasite_list_add (private->parasites, parasite);
|
||||
else
|
||||
gimp_parasite_list_remove (image->parasites,
|
||||
gimp_parasite_list_remove (private->parasites,
|
||||
image_undo->parasite_name);
|
||||
|
||||
name = parasite ? parasite->name : image_undo->parasite_name;
|
||||
|
|
|
@ -161,7 +161,9 @@ xcf_load_image (Gimp *gimp,
|
|||
|
||||
if (grid)
|
||||
{
|
||||
gimp_parasite_list_remove (GIMP_IMAGE (image)->parasites,
|
||||
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
||||
|
||||
gimp_parasite_list_remove (private->parasites,
|
||||
gimp_parasite_name (parasite));
|
||||
|
||||
gimp_image_set_grid (GIMP_IMAGE (image), grid, FALSE);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "core/gimpimage-colormap.h"
|
||||
#include "core/gimpimage-grid.h"
|
||||
#include "core/gimpimage-guides.h"
|
||||
#include "core/gimpimage-private.h"
|
||||
#include "core/gimpimage-sample-points.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
|
@ -372,10 +373,11 @@ xcf_save_image_props (XcfInfo *info,
|
|||
GimpImage *image,
|
||||
GError **error)
|
||||
{
|
||||
GimpParasite *parasite = NULL;
|
||||
GimpUnit unit = gimp_image_get_unit (image);
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
|
||||
GimpParasite *parasite = NULL;
|
||||
GimpUnit unit = gimp_image_get_unit (image);
|
||||
gdouble xres;
|
||||
gdouble yres;
|
||||
|
||||
gimp_image_get_resolution (image, &xres, &yres);
|
||||
|
||||
|
@ -422,18 +424,18 @@ xcf_save_image_props (XcfInfo *info,
|
|||
GimpGrid *grid = gimp_image_get_grid (image);
|
||||
|
||||
parasite = gimp_grid_to_parasite (grid);
|
||||
gimp_parasite_list_add (GIMP_IMAGE (image)->parasites, parasite);
|
||||
gimp_parasite_list_add (private->parasites, parasite);
|
||||
}
|
||||
|
||||
if (gimp_parasite_list_length (GIMP_IMAGE (image)->parasites) > 0)
|
||||
if (gimp_parasite_list_length (private->parasites) > 0)
|
||||
{
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_PARASITES, error,
|
||||
GIMP_IMAGE (image)->parasites));
|
||||
private->parasites));
|
||||
}
|
||||
|
||||
if (parasite)
|
||||
{
|
||||
gimp_parasite_list_remove (GIMP_IMAGE (image)->parasites,
|
||||
gimp_parasite_list_remove (private->parasites,
|
||||
gimp_parasite_name (parasite));
|
||||
gimp_parasite_free (parasite);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue