turn into a GimpObject subclass. No logical changes yet.
2008-05-13 Michael Natterer <mitch@gimp.org> * app/widgets/gimpsessioninfo.[ch]: turn into a GimpObject subclass. No logical changes yet. * app/widgets/widgets-types.h * app/widgets/gimpdialogfactory.c: changed accordingly. svn path=/trunk/; revision=25655
This commit is contained in:

committed by
Michael Natterer

parent
ddf2dca558
commit
0b0d0aad78
@ -1,3 +1,11 @@
|
||||
2008-05-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpsessioninfo.[ch]: turn into a GimpObject
|
||||
subclass. No logical changes yet.
|
||||
|
||||
* app/widgets/widgets-types.h
|
||||
* app/widgets/gimpdialogfactory.c: changed accordingly.
|
||||
|
||||
2008-05-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
First prototype of a button in the levels tool dialog that will
|
||||
|
@ -188,8 +188,7 @@ gimp_dialog_factory_dispose (GObject *object)
|
||||
|
||||
if (factory->session_infos)
|
||||
{
|
||||
g_list_foreach (factory->session_infos,
|
||||
(GFunc) gimp_session_info_free, NULL);
|
||||
g_list_foreach (factory->session_infos, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (factory->session_infos);
|
||||
factory->session_infos = NULL;
|
||||
}
|
||||
@ -1034,7 +1033,7 @@ gimp_dialog_factory_remove_dialog (GimpDialogFactory *factory,
|
||||
/* don't save session info for empty docks */
|
||||
factory->session_infos = g_list_remove (factory->session_infos,
|
||||
session_info);
|
||||
gimp_session_info_free (session_info);
|
||||
g_object_unref (session_info);
|
||||
|
||||
g_signal_emit (factory, factory_signals[DOCK_REMOVED], 0,
|
||||
dialog);
|
||||
|
@ -49,18 +49,37 @@ enum
|
||||
#define DEFAULT_SCREEN -1
|
||||
|
||||
|
||||
/* public functions */
|
||||
static void gimp_session_info_finalize (GObject *object);
|
||||
|
||||
GimpSessionInfo *
|
||||
gimp_session_info_new (void)
|
||||
static gint64 gimp_session_info_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpSessionInfo, gimp_session_info, GIMP_TYPE_OBJECT)
|
||||
|
||||
#define parent_class gimp_session_info_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_session_info_class_init (GimpSessionInfoClass *klass)
|
||||
{
|
||||
return g_slice_new0 (GimpSessionInfo);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gimp_session_info_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_session_info_get_memsize;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_session_info_free (GimpSessionInfo *info)
|
||||
static void
|
||||
gimp_session_info_init (GimpSessionInfo *info)
|
||||
{
|
||||
g_return_if_fail (info != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_session_info_finalize (GObject *object)
|
||||
{
|
||||
GimpSessionInfo *info = GIMP_SESSION_INFO (object);
|
||||
|
||||
if (info->aux_info)
|
||||
{
|
||||
@ -76,7 +95,29 @@ gimp_session_info_free (GimpSessionInfo *info)
|
||||
g_list_free (info->books);
|
||||
}
|
||||
|
||||
g_slice_free (GimpSessionInfo, info);
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gint64
|
||||
gimp_session_info_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size)
|
||||
{
|
||||
#if 0
|
||||
GimpSessionInfo *info = GIMP_SESSION_INFO (object);
|
||||
#endif
|
||||
gint64 memsize = 0;
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
||||
gui_size);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GimpSessionInfo *
|
||||
gimp_session_info_new (void)
|
||||
{
|
||||
return g_object_new (GIMP_TYPE_SESSION_INFO, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -308,13 +349,13 @@ gimp_session_info_deserialize (GScanner *scanner,
|
||||
if (!skip && g_scanner_peek_next_token (scanner) == token)
|
||||
factory->session_infos = g_list_append (factory->session_infos, info);
|
||||
else
|
||||
gimp_session_info_free (info);
|
||||
g_object_unref (info);
|
||||
}
|
||||
else
|
||||
{
|
||||
error:
|
||||
if (info)
|
||||
gimp_session_info_free (info);
|
||||
g_object_unref (info);
|
||||
}
|
||||
|
||||
g_scanner_scope_remove_symbol (scanner, scope, "position");
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpsessioninfo.h
|
||||
* Copyright (C) 2001-2007 Michael Natterer <mitch@gimp.org>
|
||||
* Copyright (C) 2001-2008 Michael Natterer <mitch@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -23,8 +23,23 @@
|
||||
#define __GIMP_SESSION_INFO_H__
|
||||
|
||||
|
||||
#include "core/gimpobject.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_SESSION_INFO (gimp_session_info_get_type ())
|
||||
#define GIMP_SESSION_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SESSION_INFO, GimpSessionInfo))
|
||||
#define GIMP_SESSION_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SESSION_INFO, GimpSessionInfoClass))
|
||||
#define GIMP_IS_SESSION_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SESSION_INFO))
|
||||
#define GIMP_IS_SESSION_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SESSION_INFO))
|
||||
#define GIMP_SESSION_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SESSION_INFO, GimpSessionInfoClass))
|
||||
|
||||
|
||||
typedef struct _GimpSessionInfoClass GimpSessionInfoClass;
|
||||
|
||||
struct _GimpSessionInfo
|
||||
{
|
||||
GimpObject parent_instance;
|
||||
|
||||
gint x;
|
||||
gint y;
|
||||
gint width;
|
||||
@ -49,9 +64,15 @@ struct _GimpSessionInfo
|
||||
GList *books;
|
||||
};
|
||||
|
||||
struct _GimpSessionInfoClass
|
||||
{
|
||||
GimpObjectClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_session_info_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GimpSessionInfo * gimp_session_info_new (void);
|
||||
void gimp_session_info_free (GimpSessionInfo *info);
|
||||
|
||||
void gimp_session_info_serialize (GimpConfigWriter *writer,
|
||||
GimpSessionInfo *info,
|
||||
|
@ -215,6 +215,14 @@ typedef struct _GimpCellRendererViewable GimpCellRendererViewable;
|
||||
typedef struct _GimpDialogFactory GimpDialogFactory;
|
||||
|
||||
|
||||
/* session management objects and structs */
|
||||
|
||||
typedef struct _GimpSessionInfo GimpSessionInfo;
|
||||
typedef struct _GimpSessionInfoBook GimpSessionInfoBook;
|
||||
typedef struct _GimpSessionInfoDockable GimpSessionInfoDockable;
|
||||
typedef struct _GimpSessionInfoAux GimpSessionInfoAux;
|
||||
|
||||
|
||||
/* structs */
|
||||
|
||||
typedef struct _GimpActionEntry GimpActionEntry;
|
||||
@ -226,11 +234,6 @@ typedef struct _GimpPlugInActionEntry GimpPlugInActionEntry;
|
||||
|
||||
typedef struct _GimpDialogFactoryEntry GimpDialogFactoryEntry;
|
||||
|
||||
typedef struct _GimpSessionInfo GimpSessionInfo;
|
||||
typedef struct _GimpSessionInfoBook GimpSessionInfoBook;
|
||||
typedef struct _GimpSessionInfoDockable GimpSessionInfoDockable;
|
||||
typedef struct _GimpSessionInfoAux GimpSessionInfoAux;
|
||||
|
||||
|
||||
/* function types */
|
||||
|
||||
|
Reference in New Issue
Block a user