summaryrefslogtreecommitdiff
path: root/src/ld-lua-symbol.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2010-10-27 15:52:36 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2010-10-27 16:52:00 +0200
commit9156953cc95cd4d814ea0ad0e9407efc9a6a0a7d (patch)
tree9bb740c24230eb0d4c5d79fa6ad684ca1f328eb3 /src/ld-lua-symbol.c
parentaa33db342b4fc194cdb4966381ac1e5f44b73465 (diff)
downloadlogdiag-9156953cc95cd4d814ea0ad0e9407efc9a6a0a7d.tar.gz
logdiag-9156953cc95cd4d814ea0ad0e9407efc9a6a0a7d.tar.xz
logdiag-9156953cc95cd4d814ea0ad0e9407efc9a6a0a7d.zip
Add more properties to LdSymbol.
Also move the actual storage of symbol properties to implementations of the abstract LdSymbol class. All the properties are read only.
Diffstat (limited to 'src/ld-lua-symbol.c')
-rw-r--r--src/ld-lua-symbol.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/ld-lua-symbol.c b/src/ld-lua-symbol.c
index cfbdeac..cdc512f 100644
--- a/src/ld-lua-symbol.c
+++ b/src/ld-lua-symbol.c
@@ -34,6 +34,9 @@ G_DEFINE_TYPE (LdLuaSymbol, ld_lua_symbol, LD_TYPE_SYMBOL);
static void ld_lua_symbol_finalize (GObject *gobject);
+static const gchar *ld_lua_symbol_get_name (LdSymbol *symbol);
+static const gchar *ld_lua_symbol_get_human_name (LdSymbol *symbol);
+static void ld_lua_symbol_get_area (LdSymbol *symbol, LdSymbolArea *area);
static void ld_lua_symbol_draw (LdSymbol *symbol, cairo_t *cr);
@@ -45,6 +48,9 @@ ld_lua_symbol_class_init (LdLuaSymbolClass *klass)
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = ld_lua_symbol_finalize;
+ klass->parent_class.get_name = ld_lua_symbol_get_name;
+ klass->parent_class.get_human_name = ld_lua_symbol_get_human_name;
+ klass->parent_class.get_area = ld_lua_symbol_get_area;
klass->parent_class.draw = ld_lua_symbol_draw;
g_type_class_add_private (klass, sizeof (LdLuaSymbolPrivate));
@@ -67,18 +73,49 @@ ld_lua_symbol_finalize (GObject *gobject)
ld_lua_private_unregister (self->priv->lua, self);
g_object_unref (self->priv->lua);
+ if (self->priv->name)
+ g_free (self->priv->name);
+ if (self->priv->human_name)
+ g_free (self->priv->human_name);
+
/* Chain up to the parent class. */
G_OBJECT_CLASS (ld_lua_symbol_parent_class)->finalize (gobject);
}
+const gchar *
+ld_lua_symbol_get_name (LdSymbol *symbol)
+{
+ g_return_val_if_fail (LD_IS_LUA_SYMBOL (symbol), NULL);
+ return LD_LUA_SYMBOL (symbol)->priv->name;
+}
+
+const gchar *
+ld_lua_symbol_get_human_name (LdSymbol *symbol)
+{
+ g_return_val_if_fail (LD_IS_LUA_SYMBOL (symbol), NULL);
+ return LD_LUA_SYMBOL (symbol)->priv->human_name;
+}
+
+void
+ld_lua_symbol_get_area (LdSymbol *symbol, LdSymbolArea *area)
+{
+ LdLuaSymbol *self;
+
+ g_return_if_fail (LD_IS_LUA_SYMBOL (symbol));
+ g_return_if_fail (area != NULL);
+
+ self = LD_LUA_SYMBOL (symbol);
+ *area = self->priv->area;
+}
+
static void
ld_lua_symbol_draw (LdSymbol *symbol, cairo_t *cr)
{
LdLuaSymbol *self;
+ g_return_if_fail (LD_IS_LUA_SYMBOL (symbol));
g_return_if_fail (cr != NULL);
- g_return_if_fail (LD_IS_SYMBOL (symbol));
self = LD_LUA_SYMBOL (symbol);
ld_lua_private_draw (self->priv->lua, self, cr);