aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--liblogdiag/ld-category.c (renamed from liblogdiag/ld-symbol-category.c)189
-rw-r--r--liblogdiag/ld-category.h77
-rw-r--r--liblogdiag/ld-library-pane.c8
-rw-r--r--liblogdiag/ld-library.c38
-rw-r--r--liblogdiag/ld-library.h2
-rw-r--r--liblogdiag/ld-symbol-category.h82
-rw-r--r--liblogdiag/liblogdiag.h2
8 files changed, 196 insertions, 206 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 282e49c..d59edba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -125,7 +125,7 @@ set (liblogdiag_SOURCES
liblogdiag/ld-diagram-view.c
liblogdiag/ld-library.c
liblogdiag/ld-library-pane.c
- liblogdiag/ld-symbol-category.c
+ liblogdiag/ld-category.c
liblogdiag/ld-symbol.c
liblogdiag/ld-lua.c
liblogdiag/ld-lua-symbol.c)
@@ -142,7 +142,7 @@ set (liblogdiag_HEADERS
liblogdiag/ld-diagram-view.h
liblogdiag/ld-library.h
liblogdiag/ld-library-pane.h
- liblogdiag/ld-symbol-category.h
+ liblogdiag/ld-category.h
liblogdiag/ld-symbol.h
liblogdiag/ld-lua.h
liblogdiag/ld-lua-private.h
diff --git a/liblogdiag/ld-symbol-category.c b/liblogdiag/ld-category.c
index f5f5b75..d0b2245 100644
--- a/liblogdiag/ld-symbol-category.c
+++ b/liblogdiag/ld-category.c
@@ -1,5 +1,5 @@
/*
- * ld-symbol-category.c
+ * ld-category.c
*
* This file is a part of logdiag.
* Copyright Přemysl Janouch 2010 - 2011. All rights reserved.
@@ -13,21 +13,21 @@
/**
- * SECTION:ld-symbol-category
+ * SECTION:ld-category
* @short_description: A category of symbols
* @see_also: #LdSymbol, #LdLibrary
*
- * #LdSymbolCategory represents a category of #LdSymbol objects.
+ * #LdCategory represents a category of #LdSymbol objects.
*/
/*
- * LdSymbolCategoryPrivate:
+ * LdCategoryPrivate:
* @name: the name of this category.
* @human_name: the localized human-readable name of this category.
* @symbols: (element-type LdSymbol *): symbols in this category.
- * @subcategories: (element-type LdSymbolCategory *) children of this category.
+ * @subcategories: (element-type LdCategory *) children of this category.
*/
-struct _LdSymbolCategoryPrivate
+struct _LdCategoryPrivate
{
gchar *name;
gchar *human_name;
@@ -42,31 +42,31 @@ enum
PROP_HUMAN_NAME
};
-static void ld_symbol_category_get_property (GObject *object, guint property_id,
+static void ld_category_get_property (GObject *object, guint property_id,
GValue *value, GParamSpec *pspec);
-static void ld_symbol_category_set_property (GObject *object, guint property_id,
+static void ld_category_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec);
-static void ld_symbol_category_finalize (GObject *gobject);
+static void ld_category_finalize (GObject *gobject);
-static void on_category_notify_name (LdSymbolCategory *category,
+static void on_category_notify_name (LdCategory *category,
GParamSpec *pspec, gpointer user_data);
-G_DEFINE_TYPE (LdSymbolCategory, ld_symbol_category, G_TYPE_OBJECT);
+G_DEFINE_TYPE (LdCategory, ld_category, G_TYPE_OBJECT);
static void
-ld_symbol_category_class_init (LdSymbolCategoryClass *klass)
+ld_category_class_init (LdCategoryClass *klass)
{
GObjectClass *object_class;
GParamSpec *pspec;
object_class = G_OBJECT_CLASS (klass);
- object_class->get_property = ld_symbol_category_get_property;
- object_class->set_property = ld_symbol_category_set_property;
- object_class->finalize = ld_symbol_category_finalize;
+ object_class->get_property = ld_category_get_property;
+ object_class->set_property = ld_category_set_property;
+ object_class->finalize = ld_category_finalize;
/**
- * LdSymbolCategory:name:
+ * LdCategory:name:
*
* The name of this symbol category.
*/
@@ -76,7 +76,7 @@ ld_symbol_category_class_init (LdSymbolCategoryClass *klass)
g_object_class_install_property (object_class, PROP_NAME, pspec);
/**
- * LdSymbolCategory:human-name:
+ * LdCategory:human-name:
*
* The localized human name of this symbol category.
*/
@@ -85,30 +85,30 @@ ld_symbol_category_class_init (LdSymbolCategoryClass *klass)
"", G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_HUMAN_NAME, pspec);
- g_type_class_add_private (klass, sizeof (LdSymbolCategoryPrivate));
+ g_type_class_add_private (klass, sizeof (LdCategoryPrivate));
}
static void
-ld_symbol_category_init (LdSymbolCategory *self)
+ld_category_init (LdCategory *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE
- (self, LD_TYPE_SYMBOL_CATEGORY, LdSymbolCategoryPrivate);
+ (self, LD_TYPE_CATEGORY, LdCategoryPrivate);
}
static void
-ld_symbol_category_get_property (GObject *object, guint property_id,
+ld_category_get_property (GObject *object, guint property_id,
GValue *value, GParamSpec *pspec)
{
- LdSymbolCategory *self;
+ LdCategory *self;
- self = LD_SYMBOL_CATEGORY (object);
+ self = LD_CATEGORY (object);
switch (property_id)
{
case PROP_NAME:
- g_value_set_string (value, ld_symbol_category_get_name (self));
+ g_value_set_string (value, ld_category_get_name (self));
break;
case PROP_HUMAN_NAME:
- g_value_set_string (value, ld_symbol_category_get_human_name (self));
+ g_value_set_string (value, ld_category_get_human_name (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -116,19 +116,19 @@ ld_symbol_category_get_property (GObject *object, guint property_id,
}
static void
-ld_symbol_category_set_property (GObject *object, guint property_id,
+ld_category_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
{
- LdSymbolCategory *self;
+ LdCategory *self;
- self = LD_SYMBOL_CATEGORY (object);
+ self = LD_CATEGORY (object);
switch (property_id)
{
case PROP_NAME:
- ld_symbol_category_set_name (self, g_value_get_string (value));
+ ld_category_set_name (self, g_value_get_string (value));
break;
case PROP_HUMAN_NAME:
- ld_symbol_category_set_human_name (self, g_value_get_string (value));
+ ld_category_set_human_name (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -136,7 +136,7 @@ ld_symbol_category_set_property (GObject *object, guint property_id,
}
static void
-uninstall_category_cb (LdSymbolCategory *category, LdSymbolCategory *self)
+uninstall_category_cb (LdCategory *category, LdCategory *self)
{
g_signal_handlers_disconnect_by_func (category,
on_category_notify_name, self);
@@ -144,11 +144,11 @@ uninstall_category_cb (LdSymbolCategory *category, LdSymbolCategory *self)
}
static void
-ld_symbol_category_finalize (GObject *gobject)
+ld_category_finalize (GObject *gobject)
{
- LdSymbolCategory *self;
+ LdCategory *self;
- self = LD_SYMBOL_CATEGORY (gobject);
+ self = LD_CATEGORY (gobject);
if (self->priv->name)
g_free (self->priv->name);
@@ -163,26 +163,26 @@ ld_symbol_category_finalize (GObject *gobject)
g_slist_free (self->priv->subcategories);
/* Chain up to the parent class. */
- G_OBJECT_CLASS (ld_symbol_category_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (ld_category_parent_class)->finalize (gobject);
}
/**
- * ld_symbol_category_new:
+ * ld_category_new:
* @name: the name of the new category.
* @human_name: the localized human name of the new category.
*
* Create an instance.
*/
-LdSymbolCategory *
-ld_symbol_category_new (const gchar *name, const gchar *human_name)
+LdCategory *
+ld_category_new (const gchar *name, const gchar *human_name)
{
- LdSymbolCategory *cat;
+ LdCategory *cat;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (human_name != NULL, NULL);
- cat = g_object_new (LD_TYPE_SYMBOL_CATEGORY, NULL);
+ cat = g_object_new (LD_TYPE_CATEGORY, NULL);
cat->priv->name = g_strdup (name);
cat->priv->human_name = g_strdup (human_name);
@@ -190,14 +190,14 @@ ld_symbol_category_new (const gchar *name, const gchar *human_name)
}
/**
- * ld_symbol_category_set_name:
- * @self: an #LdSymbolCategory object.
+ * ld_category_set_name:
+ * @self: an #LdCategory object.
* @name: the new name for this category.
*/
void
-ld_symbol_category_set_name (LdSymbolCategory *self, const gchar *name)
+ld_category_set_name (LdCategory *self, const gchar *name)
{
- g_return_if_fail (LD_IS_SYMBOL_CATEGORY (self));
+ g_return_if_fail (LD_IS_CATEGORY (self));
g_return_if_fail (name != NULL);
if (self->priv->name)
@@ -208,28 +208,27 @@ ld_symbol_category_set_name (LdSymbolCategory *self, const gchar *name)
}
/**
- * ld_symbol_category_get_name:
- * @self: an #LdSymbolCategory object.
+ * ld_category_get_name:
+ * @self: an #LdCategory object.
*
* Return the name of this category.
*/
const gchar *
-ld_symbol_category_get_name (LdSymbolCategory *self)
+ld_category_get_name (LdCategory *self)
{
- g_return_val_if_fail (LD_IS_SYMBOL_CATEGORY (self), NULL);
+ g_return_val_if_fail (LD_IS_CATEGORY (self), NULL);
return self->priv->name;
}
/**
- * ld_symbol_category_set_human_name:
- * @self: an #LdSymbolCategory object.
+ * ld_category_set_human_name:
+ * @self: an #LdCategory object.
* @human_name: the new localized human name for this category.
*/
void
-ld_symbol_category_set_human_name (LdSymbolCategory *self,
- const gchar *human_name)
+ld_category_set_human_name (LdCategory *self, const gchar *human_name)
{
- g_return_if_fail (LD_IS_SYMBOL_CATEGORY (self));
+ g_return_if_fail (LD_IS_CATEGORY (self));
g_return_if_fail (human_name != NULL);
if (self->priv->human_name)
@@ -240,21 +239,21 @@ ld_symbol_category_set_human_name (LdSymbolCategory *self,
}
/**
- * ld_symbol_category_get_human_name:
- * @self: an #LdSymbolCategory object.
+ * ld_category_get_human_name:
+ * @self: an #LdCategory object.
*
* Return the localized human name of this category.
*/
const gchar *
-ld_symbol_category_get_human_name (LdSymbolCategory *self)
+ld_category_get_human_name (LdCategory *self)
{
- g_return_val_if_fail (LD_IS_SYMBOL_CATEGORY (self), NULL);
+ g_return_val_if_fail (LD_IS_CATEGORY (self), NULL);
return self->priv->human_name;
}
/**
- * ld_symbol_category_insert_symbol:
- * @self: an #LdSymbolCategory object.
+ * ld_category_insert_symbol:
+ * @self: an #LdCategory object.
* @symbol: the symbol to be inserted.
* @pos: the position at which the symbol will be inserted.
* Negative values will append to the end of list.
@@ -264,13 +263,12 @@ ld_symbol_category_get_human_name (LdSymbolCategory *self)
* Return value: %TRUE if successful (no name collisions).
*/
gboolean
-ld_symbol_category_insert_symbol (LdSymbolCategory *self,
- LdSymbol *symbol, gint pos)
+ld_category_insert_symbol (LdCategory *self, LdSymbol *symbol, gint pos)
{
const gchar *name;
const GSList *iter;
- g_return_val_if_fail (LD_IS_SYMBOL_CATEGORY (self), FALSE);
+ g_return_val_if_fail (LD_IS_CATEGORY (self), FALSE);
g_return_val_if_fail (LD_IS_SYMBOL (symbol), FALSE);
/* Check for name collisions. */
@@ -280,7 +278,7 @@ ld_symbol_category_insert_symbol (LdSymbolCategory *self,
if (!strcmp (name, ld_symbol_get_name (iter->data)))
{
g_warning ("attempted to insert multiple `%s' symbols into"
- " category `%s'", name, ld_symbol_category_get_name (self));
+ " category `%s'", name, ld_category_get_name (self));
return FALSE;
}
}
@@ -291,17 +289,16 @@ ld_symbol_category_insert_symbol (LdSymbolCategory *self,
}
/**
- * ld_symbol_category_remove_symbol:
- * @self: an #LdSymbolCategory object.
+ * ld_category_remove_symbol:
+ * @self: an #LdCategory object.
* @symbol: the symbol to be removed.
*
* Removes a symbol from the category.
*/
void
-ld_symbol_category_remove_symbol (LdSymbolCategory *self,
- LdSymbol *symbol)
+ld_category_remove_symbol (LdCategory *self, LdSymbol *symbol)
{
- g_return_if_fail (LD_IS_SYMBOL_CATEGORY (self));
+ g_return_if_fail (LD_IS_CATEGORY (self));
g_return_if_fail (LD_IS_SYMBOL (symbol));
if (g_slist_find (self->priv->symbols, symbol))
@@ -312,38 +309,38 @@ ld_symbol_category_remove_symbol (LdSymbolCategory *self,
}
/**
- * ld_symbol_category_get_symbols:
- * @self: an #LdSymbolCategory object.
+ * ld_category_get_symbols:
+ * @self: an #LdCategory object.
*
* Return value: (element-type LdSymbol *): a list of symbols. Do not modify.
*/
const GSList *
-ld_symbol_category_get_symbols (LdSymbolCategory *self)
+ld_category_get_symbols (LdCategory *self)
{
- g_return_val_if_fail (LD_IS_SYMBOL_CATEGORY (self), NULL);
+ g_return_val_if_fail (LD_IS_CATEGORY (self), NULL);
return self->priv->symbols;
}
static void
-on_category_notify_name (LdSymbolCategory *category,
+on_category_notify_name (LdCategory *category,
GParamSpec *pspec, gpointer user_data)
{
- LdSymbolCategory *self;
+ LdCategory *self;
- self = (LdSymbolCategory *) user_data;
+ self = (LdCategory *) user_data;
g_warning ("name of a library subcategory has changed");
/* The easy way of handling it. */
g_object_ref (category);
- ld_symbol_category_remove_child (self, category);
- ld_symbol_category_add_child (self, category);
+ ld_category_remove_child (self, category);
+ ld_category_add_child (self, category);
g_object_unref (category);
}
/**
- * ld_symbol_category_add_child:
- * @self: an #LdSymbolCategory object.
+ * ld_category_add_child:
+ * @self: an #LdCategory object.
* @category: the category to be inserted.
*
* Insert a subcategory into the category.
@@ -351,25 +348,24 @@ on_category_notify_name (LdSymbolCategory *category,
* Return value: %TRUE if successful (no name collisions).
*/
gboolean
-ld_symbol_category_add_child (LdSymbolCategory *self,
- LdSymbolCategory *category)
+ld_category_add_child (LdCategory *self, LdCategory *category)
{
const gchar *name;
GSList *iter;
- g_return_val_if_fail (LD_IS_SYMBOL_CATEGORY (self), FALSE);
- g_return_val_if_fail (LD_IS_SYMBOL_CATEGORY (category), FALSE);
+ g_return_val_if_fail (LD_IS_CATEGORY (self), FALSE);
+ g_return_val_if_fail (LD_IS_CATEGORY (category), FALSE);
- name = ld_symbol_category_get_name (category);
+ name = ld_category_get_name (category);
for (iter = self->priv->subcategories; iter; iter = iter->next)
{
gint comp;
- comp = g_utf8_collate (name, ld_symbol_category_get_name (iter->data));
+ comp = g_utf8_collate (name, ld_category_get_name (iter->data));
if (!comp)
{
g_warning ("attempted to insert multiple `%s' subcategories into"
- " category `%s'", name, ld_symbol_category_get_name (self));
+ " category `%s'", name, ld_category_get_name (self));
return FALSE;
}
if (comp < 0)
@@ -385,18 +381,17 @@ ld_symbol_category_add_child (LdSymbolCategory *self,
}
/**
- * ld_symbol_category_remove_child:
- * @self: an #LdSymbolCategory object.
+ * ld_category_remove_child:
+ * @self: an #LdCategory object.
* @category: the category to be removed.
*
* Removes a subcategory from the category.
*/
void
-ld_symbol_category_remove_child (LdSymbolCategory *self,
- LdSymbolCategory *category)
+ld_category_remove_child (LdCategory *self, LdCategory *category)
{
- g_return_if_fail (LD_IS_SYMBOL_CATEGORY (self));
- g_return_if_fail (LD_IS_SYMBOL_CATEGORY (category));
+ g_return_if_fail (LD_IS_CATEGORY (self));
+ g_return_if_fail (LD_IS_CATEGORY (category));
if (g_slist_find (self->priv->subcategories, category))
{
@@ -409,16 +404,16 @@ ld_symbol_category_remove_child (LdSymbolCategory *self,
}
/**
- * ld_symbol_category_get_children:
- * @self: an #LdSymbolCategory object.
+ * ld_category_get_children:
+ * @self: an #LdCategory object.
*
- * Return value: (element-type LdSymbolCategory *):
+ * Return value: (element-type LdCategory *):
* a list of subcategories. Do not modify.
*/
const GSList *
-ld_symbol_category_get_children (LdSymbolCategory *self)
+ld_category_get_children (LdCategory *self)
{
- g_return_val_if_fail (LD_IS_SYMBOL_CATEGORY (self), NULL);
+ g_return_val_if_fail (LD_IS_CATEGORY (self), NULL);
return self->priv->subcategories;
}
diff --git a/liblogdiag/ld-category.h b/liblogdiag/ld-category.h
new file mode 100644
index 0000000..5bbb00f
--- /dev/null
+++ b/liblogdiag/ld-category.h
@@ -0,0 +1,77 @@
+/*
+ * ld-category.h
+ *
+ * This file is a part of logdiag.
+ * Copyright Přemysl Janouch 2010. All rights reserved.
+ *
+ * See the file LICENSE for licensing information.
+ *
+ */
+
+#ifndef __LD_CATEGORY_H__
+#define __LD_CATEGORY_H__
+
+G_BEGIN_DECLS
+
+
+#define LD_TYPE_CATEGORY (ld_category_get_type ())
+#define LD_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), LD_TYPE_CATEGORY, LdCategory))
+#define LD_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
+ ((klass), LD_TYPE_CATEGORY, LdCategoryClass))
+#define LD_IS_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), LD_TYPE_CATEGORY))
+#define LD_IS_CATEGORY_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((klass), LD_TYPE_CATEGORY))
+#define LD_CATEGORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), LD_CATEGORY, LdCategoryClass))
+
+typedef struct _LdCategory LdCategory;
+typedef struct _LdCategoryPrivate LdCategoryPrivate;
+typedef struct _LdCategoryClass LdCategoryClass;
+
+
+/**
+ * LdCategory:
+ */
+struct _LdCategory
+{
+/*< private >*/
+ GObject parent_instance;
+ LdCategoryPrivate *priv;
+};
+
+/* TODO: If required sometime, categories (and maybe symbols) should implement
+ * a "changed" signal. This can be somewhat tricky. The library might be
+ * a good candidate for what they call a proxy. See GtkUIManager.
+ */
+struct _LdCategoryClass
+{
+/*< private >*/
+ GObjectClass parent_class;
+};
+
+
+GType ld_category_get_type (void) G_GNUC_CONST;
+
+LdCategory *ld_category_new (const gchar *name, const gchar *human_name);
+
+void ld_category_set_name (LdCategory *self, const gchar *name);
+const gchar *ld_category_get_name (LdCategory *self);
+void ld_category_set_human_name (LdCategory *self, const gchar *human_name);
+const gchar *ld_category_get_human_name (LdCategory *self);
+
+gboolean ld_category_insert_symbol (LdCategory *self,
+ LdSymbol *symbol, gint pos);
+void ld_category_remove_symbol (LdCategory *self, LdSymbol *symbol);
+const GSList *ld_category_get_symbols (LdCategory *self);
+
+gboolean ld_category_add_child (LdCategory *self, LdCategory *category);
+void ld_category_remove_child (LdCategory *self, LdCategory *category);
+const GSList *ld_category_get_children (LdCategory *self);
+
+
+G_END_DECLS
+
+#endif /* ! __LD_CATEGORY_H__ */
+
diff --git a/liblogdiag/ld-library-pane.c b/liblogdiag/ld-library-pane.c
index 5fe85c1..484b2be 100644
--- a/liblogdiag/ld-library-pane.c
+++ b/liblogdiag/ld-library-pane.c
@@ -199,7 +199,7 @@ reload_library (LdLibraryPane *self)
{
GSList *categories;
- categories = (GSList *) ld_symbol_category_get_children
+ categories = (GSList *) ld_category_get_children
(ld_library_get_root (self->priv->library));
g_slist_foreach (categories, load_category_cb, self);
}
@@ -209,18 +209,18 @@ static void
load_category_cb (gpointer data, gpointer user_data)
{
LdLibraryPane *self;
- LdSymbolCategory *cat;
+ LdCategory *cat;
GtkExpander *expander;
const gchar *human_name;
g_return_if_fail (LD_IS_LIBRARY_PANE (user_data));
- g_return_if_fail (LD_IS_SYMBOL_CATEGORY (data));
+ g_return_if_fail (LD_IS_CATEGORY (data));
self = user_data;
cat = data;
/* TODO: Set a child for the expander, recurse into category children. */
- human_name = ld_symbol_category_get_human_name (cat);
+ human_name = ld_category_get_human_name (cat);
expander = GTK_EXPANDER (gtk_expander_new (human_name));
gtk_box_pack_start (GTK_BOX (self), GTK_WIDGET (expander), FALSE, FALSE, 0);
diff --git a/liblogdiag/ld-library.c b/liblogdiag/ld-library.c
index 31f3855..2b4c704 100644
--- a/liblogdiag/ld-library.c
+++ b/liblogdiag/ld-library.c
@@ -17,7 +17,7 @@
/**
* SECTION:ld-library
* @short_description: A symbol library
- * @see_also: #LdSymbol, #LdSymbolCategory
+ * @see_also: #LdSymbol, #LdCategory
*
* #LdLibrary is used for loading symbols from their files. The library object
* itself is a container for categories, which in turn contain other
@@ -32,12 +32,12 @@
struct _LdLibraryPrivate
{
LdLua *lua;
- LdSymbolCategory *root;
+ LdCategory *root;
};
static void ld_library_finalize (GObject *gobject);
-static LdSymbolCategory *load_category (LdLibrary *self,
+static LdCategory *load_category (LdLibrary *self,
const gchar *path, const gchar *name);
static gboolean load_category_cb (const gchar *base,
const gchar *path, gpointer userdata);
@@ -81,7 +81,7 @@ ld_library_init (LdLibrary *self)
(self, LD_TYPE_LIBRARY, LdLibraryPrivate);
self->priv->lua = ld_lua_new ();
- self->priv->root = ld_symbol_category_new ("/", "/");
+ self->priv->root = ld_category_new ("/", "/");
}
static void
@@ -150,7 +150,7 @@ foreach_dir (const gchar *path,
typedef struct
{
LdLibrary *self;
- LdSymbolCategory *cat;
+ LdCategory *cat;
guint changed : 1;
guint load_symbols : 1;
}
@@ -164,7 +164,7 @@ LoadCategoryData;
*
* Loads a category into the library.
*/
-static LdSymbolCategory *
+static LdCategory *
load_category (LdLibrary *self, const gchar *path, const gchar *name)
{
gchar *category_file, *human_name;
@@ -183,7 +183,7 @@ load_category (LdLibrary *self, const gchar *path, const gchar *name)
human_name = g_strdup (name);
data.self = self;
- data.cat = ld_symbol_category_new (name, human_name);
+ data.cat = ld_category_new (name, human_name);
data.load_symbols = TRUE;
data.changed = FALSE;
foreach_dir (path, load_category_cb, &data, NULL);
@@ -211,12 +211,12 @@ load_category_cb (const gchar *base, const gchar *path, gpointer userdata)
if (g_file_test (path, G_FILE_TEST_IS_DIR))
{
- LdSymbolCategory *cat;
+ LdCategory *cat;
cat = load_category (data->self, path, base);
if (cat)
{
- ld_symbol_category_add_child (data->cat, cat);
+ ld_category_add_child (data->cat, cat);
g_object_unref (cat);
}
}
@@ -239,13 +239,13 @@ load_category_cb (const gchar *base, const gchar *path, gpointer userdata)
static void
load_category_symbol_cb (LdSymbol *symbol, gpointer user_data)
{
- LdSymbolCategory *cat;
+ LdCategory *cat;
g_return_if_fail (LD_IS_SYMBOL (symbol));
- g_return_if_fail (LD_IS_SYMBOL_CATEGORY (user_data));
+ g_return_if_fail (LD_IS_CATEGORY (user_data));
- cat = LD_SYMBOL_CATEGORY (user_data);
- ld_symbol_category_insert_symbol (cat, symbol, -1);
+ cat = LD_CATEGORY (user_data);
+ ld_category_insert_symbol (cat, symbol, -1);
}
/*
@@ -348,7 +348,7 @@ ld_library_find_symbol (LdLibrary *self, const gchar *identifier)
{
gchar **id_el_start, **id_el;
const GSList *list, *list_el;
- LdSymbolCategory *cat;
+ LdCategory *cat;
g_return_val_if_fail (LD_IS_LIBRARY (self), NULL);
g_return_val_if_fail (identifier != NULL, NULL);
@@ -368,11 +368,11 @@ ld_library_find_symbol (LdLibrary *self, const gchar *identifier)
{
gboolean found = FALSE;
- list = ld_symbol_category_get_children (cat);
+ list = ld_category_get_children (cat);
for (list_el = list; list_el; list_el = g_slist_next (list_el))
{
- cat = LD_SYMBOL_CATEGORY (list_el->data);
- if (!strcmp (*id_el, ld_symbol_category_get_name (cat)))
+ cat = LD_CATEGORY (list_el->data);
+ if (!strcmp (*id_el, ld_category_get_name (cat)))
{
found = TRUE;
break;
@@ -387,7 +387,7 @@ ld_library_find_symbol (LdLibrary *self, const gchar *identifier)
}
/* And then the actual symbol. */
- list = ld_symbol_category_get_symbols (cat);
+ list = ld_category_get_symbols (cat);
for (list_el = list; list_el; list_el = g_slist_next (list_el))
{
LdSymbol *symbol;
@@ -411,7 +411,7 @@ ld_library_find_symbol_error:
*
* Return value: (transfer none): the root category. Do not modify.
*/
-LdSymbolCategory *
+LdCategory *
ld_library_get_root (LdLibrary *self)
{
g_return_val_if_fail (LD_IS_LIBRARY (self), NULL);
diff --git a/liblogdiag/ld-library.h b/liblogdiag/ld-library.h
index 667d861..1a71973 100644
--- a/liblogdiag/ld-library.h
+++ b/liblogdiag/ld-library.h
@@ -60,7 +60,7 @@ GType ld_library_get_type (void) G_GNUC_CONST;
LdLibrary *ld_library_new (void);
gboolean ld_library_load (LdLibrary *self, const gchar *directory);
LdSymbol *ld_library_find_symbol (LdLibrary *self, const gchar *identifier);
-LdSymbolCategory *ld_library_get_root (LdLibrary *self);
+LdCategory *ld_library_get_root (LdLibrary *self);
G_END_DECLS
diff --git a/liblogdiag/ld-symbol-category.h b/liblogdiag/ld-symbol-category.h
deleted file mode 100644
index 1ac7f59..0000000
--- a/liblogdiag/ld-symbol-category.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * ld-symbol-category.h
- *
- * This file is a part of logdiag.
- * Copyright Přemysl Janouch 2010. All rights reserved.
- *
- * See the file LICENSE for licensing information.
- *
- */
-
-#ifndef __LD_SYMBOL_CATEGORY_H__
-#define __LD_SYMBOL_CATEGORY_H__
-
-G_BEGIN_DECLS
-
-
-#define LD_TYPE_SYMBOL_CATEGORY (ld_symbol_category_get_type ())
-#define LD_SYMBOL_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_CAST \
- ((obj), LD_TYPE_SYMBOL_CATEGORY, LdSymbolCategory))
-#define LD_SYMBOL_CATEGORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST \
- ((klass), LD_TYPE_SYMBOL_CATEGORY, LdSymbolCategoryClass))
-#define LD_IS_SYMBOL_CATEGORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE \
- ((obj), LD_TYPE_SYMBOL_CATEGORY))
-#define LD_IS_SYMBOL_CATEGORY_CLASS(klass) (G_TYPE_CHECK_INSTANCE_TYPE \
- ((klass), LD_TYPE_SYMBOL_CATEGORY))
-#define LD_SYMBOL_CATEGORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS \
- ((obj), LD_SYMBOL_CATEGORY, LdSymbolCategoryClass))
-
-typedef struct _LdSymbolCategory LdSymbolCategory;
-typedef struct _LdSymbolCategoryPrivate LdSymbolCategoryPrivate;
-typedef struct _LdSymbolCategoryClass LdSymbolCategoryClass;
-
-
-/**
- * LdSymbolCategory:
- */
-struct _LdSymbolCategory
-{
-/*< private >*/
- GObject parent_instance;
- LdSymbolCategoryPrivate *priv;
-};
-
-/* TODO: If required sometime, categories (and maybe symbols) should implement
- * a "changed" signal. This can be somewhat tricky. The library might be
- * a good candidate for what they call a proxy. See GtkUIManager.
- */
-struct _LdSymbolCategoryClass
-{
-/*< private >*/
- GObjectClass parent_class;
-};
-
-
-GType ld_symbol_category_get_type (void) G_GNUC_CONST;
-
-LdSymbolCategory *ld_symbol_category_new (const gchar *name,
- const gchar *human_name);
-
-void ld_symbol_category_set_name (LdSymbolCategory *self, const gchar *name);
-const gchar *ld_symbol_category_get_name (LdSymbolCategory *self);
-void ld_symbol_category_set_human_name (LdSymbolCategory *self,
- const gchar *human_name);
-const gchar *ld_symbol_category_get_human_name (LdSymbolCategory *self);
-
-gboolean ld_symbol_category_insert_symbol (LdSymbolCategory *self,
- LdSymbol *symbol, gint pos);
-void ld_symbol_category_remove_symbol (LdSymbolCategory *self,
- LdSymbol *symbol);
-const GSList *ld_symbol_category_get_symbols (LdSymbolCategory *self);
-
-gboolean ld_symbol_category_add_child (LdSymbolCategory *self,
- LdSymbolCategory *category);
-void ld_symbol_category_remove_child (LdSymbolCategory *self,
- LdSymbolCategory *category);
-const GSList *ld_symbol_category_get_children (LdSymbolCategory *self);
-
-
-G_END_DECLS
-
-#endif /* ! __LD_SYMBOL_CATEGORY_H__ */
-
diff --git a/liblogdiag/liblogdiag.h b/liblogdiag/liblogdiag.h
index d5773ae..1ea87aa 100644
--- a/liblogdiag/liblogdiag.h
+++ b/liblogdiag/liblogdiag.h
@@ -18,7 +18,7 @@
#include "ld-types.h"
#include "ld-symbol.h"
-#include "ld-symbol-category.h"
+#include "ld-category.h"
#include "ld-library.h"
#include "ld-undo-action.h"