aboutsummaryrefslogtreecommitdiff
path: root/liblogdiag/ld-category-view-if.c
diff options
context:
space:
mode:
Diffstat (limited to 'liblogdiag/ld-category-view-if.c')
-rw-r--r--liblogdiag/ld-category-view-if.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/liblogdiag/ld-category-view-if.c b/liblogdiag/ld-category-view-if.c
new file mode 100644
index 0000000..18a37e1
--- /dev/null
+++ b/liblogdiag/ld-category-view-if.c
@@ -0,0 +1,99 @@
+/*
+ * ld-category-view-if.c
+ *
+ * This file is a part of logdiag.
+ * Copyright Přemysl Janouch 2012. All rights reserved.
+ *
+ * See the file LICENSE for licensing information.
+ *
+ */
+
+#include "liblogdiag.h"
+#include "config.h"
+
+
+/**
+ * SECTION:ld-category-view-if
+ * @short_description: Interface for objects displaying categories
+ * @see_also: #LdCategory
+ *
+ * #LdCategoryViewIf defines objects displaying contents of #LdCategory
+ * hierarchies.
+ */
+
+G_DEFINE_INTERFACE (LdCategoryViewIf, ld_category_view_if, 0);
+
+static void
+ld_category_view_if_default_init (LdCategoryViewIfInterface *iface)
+{
+ GParamSpec *pspec;
+
+/**
+ * LdCategoryViewIf::symbol-selected:
+ * @self: an #LdCategoryView object.
+ * @symbol: the selected #LdSymbol object.
+ * @path: location of the symbol within the library.
+ *
+ * A symbol has been selected.
+ */
+ iface->symbol_selected_signal = g_signal_new
+ ("symbol-selected", G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ ld_marshal_VOID__OBJECT_STRING,
+ G_TYPE_NONE, 2, LD_TYPE_SYMBOL,
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+/**
+ * LdCategoryViewIf::symbol-deselected:
+ * @self: an #LdCategoryView object.
+ * @symbol: the deselected #LdSymbol object.
+ * @path: location of the symbol within the library.
+ *
+ * A symbol has been deselected.
+ */
+ iface->symbol_deselected_signal = g_signal_new
+ ("symbol-deselected", G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ ld_marshal_VOID__OBJECT_STRING,
+ G_TYPE_NONE, 2, LD_TYPE_SYMBOL,
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
+
+/**
+ * LdCategoryViewIf:category:
+ *
+ * The #LdCategory this object retrieves content from.
+ */
+ pspec = g_param_spec_object ("category", "Category",
+ "The symbol category that is shown by this object.",
+ LD_TYPE_CATEGORY, G_PARAM_READWRITE);
+ g_object_interface_install_property (iface, pspec);
+}
+
+/**
+ * ld_category_view_if_set_category:
+ * @self: an #LdCategorylViewIf object.
+ * @category: the #LdCategory to be assigned to the view.
+ *
+ * Assign an #LdCategory object to the view.
+ */
+void
+ld_category_view_if_set_category (LdCategoryViewIf *self,
+ LdCategory *category)
+{
+ g_return_if_fail (LD_IS_CATEGORY_VIEW_IF (self));
+ LD_CATEGORY_VIEW_IF_GET_INTERFACE (self)->set_category (self, category);
+}
+
+/**
+ * ld_category_view_if_get_category:
+ * @self: an #LdCategoryViewIf object.
+ *
+ * Get the #LdCategory object assigned to this view.
+ * The reference count on the category is not incremented.
+ */
+LdCategory *
+ld_category_view_if_get_category (LdCategoryViewIf *self)
+{
+ g_return_val_if_fail (LD_IS_CATEGORY_VIEW_IF (self), NULL);
+ return LD_CATEGORY_VIEW_IF_GET_INTERFACE (self)->get_category (self);
+}