From 55c25ae1bd95b9956952a4fe0c9699bb62251079 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Janouch?=
Date: Wed, 15 Sep 2010 19:31:57 +0200
Subject: Added basic loading of categories.
Added two empty sample categories with corresponding icons.
The categories are now being loaded into the toolbar
in the main program window.
---
src/symbol-library.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'src/symbol-library.c')
diff --git a/src/symbol-library.c b/src/symbol-library.c
index 743aa39..869e3f2 100644
--- a/src/symbol-library.c
+++ b/src/symbol-library.c
@@ -74,8 +74,8 @@ logdiag_symbol_library_init (LogdiagSymbolLibrary *self)
/* TODO: lua */
self->priv->lua_state = NULL;
- /* TODO: use _new_full and specify destroy functions. */
- self->categories = g_hash_table_new (g_str_hash, g_str_equal);
+ self->categories = g_hash_table_new_full (g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free, (GDestroyNotify) g_object_unref);
}
static void
@@ -110,7 +110,7 @@ logdiag_symbol_library_new (void)
*
* Loads a category into the library.
*/
-LogdiagSymbolCategory *
+static LogdiagSymbolCategory *
load_category (LogdiagSymbolLibrary *self, const char *path, const char *name)
{
LogdiagSymbolCategory *cat;
@@ -120,6 +120,9 @@ load_category (LogdiagSymbolLibrary *self, const char *path, const char *name)
g_return_val_if_fail (path != NULL, NULL);
g_return_val_if_fail (name != NULL, NULL);
+ if (!g_file_test (path, G_FILE_TEST_IS_DIR))
+ return NULL;
+
icon_file = g_build_filename (path, "icon.svg", NULL);
if (!g_file_test (icon_file, G_FILE_TEST_IS_REGULAR))
{
--
cgit v1.2.3