app: derive GimpFont from GimpData

This commit is contained in:
Michael Natterer 2018-06-02 21:53:55 +02:00
parent 5280d7a277
commit 4d3c715990
2 changed files with 15 additions and 5 deletions

View File

@ -62,7 +62,7 @@ enum
struct _GimpFont
{
GimpViewable parent_instance;
GimpData parent_instance;
PangoContext *pango_context;
@ -73,10 +73,11 @@ struct _GimpFont
struct _GimpFontClass
{
GimpViewableClass parent_class;
GimpDataClass parent_class;
};
static void gimp_font_constructed (GObject *object);
static void gimp_font_finalize (GObject *object);
static void gimp_font_set_property (GObject *object,
guint property_id,
@ -104,7 +105,7 @@ static const gchar * gimp_font_get_sample_string (PangoContext *context,
PangoFontDescription *font_desc);
G_DEFINE_TYPE (GimpFont, gimp_font, GIMP_TYPE_VIEWABLE)
G_DEFINE_TYPE (GimpFont, gimp_font, GIMP_TYPE_DATA)
#define parent_class gimp_font_parent_class
@ -115,6 +116,7 @@ gimp_font_class_init (GimpFontClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
object_class->constructed = gimp_font_constructed;
object_class->finalize = gimp_font_finalize;
object_class->set_property = gimp_font_set_property;
@ -134,7 +136,15 @@ gimp_font_class_init (GimpFontClass *klass)
static void
gimp_font_init (GimpFont *font)
{
font->pango_context = NULL;
}
static void
gimp_font_constructed (GObject *object)
{
G_OBJECT_CLASS (parent_class)->constructed (object);
gimp_data_make_internal (GIMP_DATA (object),
gimp_object_get_name (object));
}
static void

View File

@ -23,7 +23,7 @@
#define __GIMP_FONT_H__
#include "core/gimpviewable.h"
#include "core/gimpdata.h"
#define GIMP_TYPE_FONT (gimp_font_get_type ())