1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/*
* ld-lua-symbol.c
*
* This file is a part of logdiag.
* Copyright Přemysl Janouch 2010. All rights reserved.
*
* See the file LICENSE for licensing information.
*
*/
#include <gtk/gtk.h>
#include "config.h"
#include "ld-symbol.h"
#include "ld-symbol-category.h"
#include "ld-library.h"
#include "ld-lua.h"
#include "ld-lua-symbol.h"
/**
* SECTION:ld-lua-symbol
* @short_description: A symbol.
* @see_also: #LdSymbol
*
* #LdLuaSymbol is an implementation of #LdSymbol.
*/
/*
* LdLuaSymbolPrivate:
* @lua: Parent #LdLua object.
* @ident: Identifier for the symbol.
*/
struct _LdLuaSymbolPrivate
{
LdLua *lua;
/* XXX: Note that this identifier != symbol name,
* since there can be more symbols with the same name,
* only in different categories.
*/
gchar *ident;
};
G_DEFINE_TYPE (LdLuaSymbol, ld_lua_symbol, LD_TYPE_SYMBOL);
static void ld_lua_symbol_finalize (GObject *gobject);
static void ld_lua_symbol_draw (LdSymbol *self, cairo_t *cr);
static void
ld_lua_symbol_class_init (LdLuaSymbolClass *klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ld_lua_symbol_finalize;
klass->parent_class.draw = ld_lua_symbol_draw;
g_type_class_add_private (klass, sizeof (LdLuaSymbolPrivate));
}
static void
ld_lua_symbol_init (LdLuaSymbol *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE
(self, LD_TYPE_LUA_SYMBOL, LdLuaSymbolPrivate);
}
static void
ld_lua_symbol_finalize (GObject *gobject)
{
LdLuaSymbol *self;
self = LD_LUA_SYMBOL (gobject);
g_object_unref (self->priv->lua);
g_free (self->priv->ident);
/* Chain up to the parent class. */
G_OBJECT_CLASS (ld_lua_symbol_parent_class)->finalize (gobject);
}
/**
* ld_symbol_new:
* @lua: An #LdLua object.
* @ident: Identifier for the symbol.
*
* Load a symbol from a file into the library.
*/
LdSymbol *
ld_lua_symbol_new (const gchar *name, LdLua *lua, const gchar *ident)
{
LdLuaSymbol *self;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (LD_IS_LUA (lua), NULL);
g_return_val_if_fail (ident != NULL, NULL);
self = g_object_new (LD_TYPE_LUA_SYMBOL, NULL);
/* TODO: Set the symbol name. */
self->priv->lua = lua;
g_object_ref (lua);
self->priv->ident = g_strdup (ident);
return LD_SYMBOL (self);
}
static void
ld_lua_symbol_draw (LdSymbol *self, cairo_t *cr)
{
g_return_if_fail (LD_IS_SYMBOL (self));
g_return_if_fail (cr != NULL);
/* TODO: Implement. */
/* Retrieve the function for rendering from the registry or wherever
* it's going to end up, and call it.
*/
}
|