From e0e63649dc830cd63ae4e7a958e224ef3b2a1375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Thu, 30 Sep 2010 05:19:31 +0200 Subject: Redesign the library and related components. This step is needed, since the current design is quite chaotic and it would not be possible to finish the application. There's still a lot to be done. After this step, it's time to implement the rest of LdLua. --- src/ld-library.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/ld-library.c') diff --git a/src/ld-library.c b/src/ld-library.c index ba12d5d..d4eec09 100644 --- a/src/ld-library.c +++ b/src/ld-library.c @@ -12,9 +12,10 @@ #include "config.h" -#include "ld-library.h" -#include "ld-symbol-category.h" #include "ld-symbol.h" +#include "ld-symbol-category.h" +#include "ld-library.h" + #include "ld-lua.h" @@ -132,9 +133,10 @@ load_category (LdLibrary *self, const char *path, const char *name) /* TODO: Search for category.json and read the category name from it. */ /* TODO: Search for xyz.lua and load the objects into the category. */ - cat = ld_symbol_category_new (self); - cat->name = g_strdup (name); - cat->image_path = icon_file; + cat = ld_symbol_category_new (name); + ld_symbol_category_set_image_path (cat, icon_file); + + g_free (icon_file); return cat; } @@ -167,7 +169,8 @@ ld_library_load (LdLibrary *self, const char *path) categ_path = g_build_filename (path, item, NULL); cat = load_category (self, categ_path, item); if (cat) - g_hash_table_insert (self->categories, cat->name, cat); + g_hash_table_insert (self->categories, + g_strdup (ld_symbol_category_get_name (cat)), cat); g_free (categ_path); changed = TRUE; -- cgit v1.2.3