diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2010-09-15 19:31:57 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2010-09-15 19:31:57 +0200 |
commit | 55c25ae1bd95b9956952a4fe0c9699bb62251079 (patch) | |
tree | 7cb58ce6d0d791baeac2583589beff9f2cb39750 /src/symbol-library.c | |
parent | 82cfa129209fbc76cd8fdac992703f66ccccfc7a (diff) | |
download | logdiag-55c25ae1bd95b9956952a4fe0c9699bb62251079.tar.gz logdiag-55c25ae1bd95b9956952a4fe0c9699bb62251079.tar.xz logdiag-55c25ae1bd95b9956952a4fe0c9699bb62251079.zip |
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.
Diffstat (limited to 'src/symbol-library.c')
-rw-r--r-- | src/symbol-library.c | 9 |
1 files changed, 6 insertions, 3 deletions
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)) { |