aboutsummaryrefslogtreecommitdiff
path: root/liblogdiag/ld-category-view.c
blob: 37b3937b5615bf63407157da9c71f378ea208c6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * ld-category-view.c
 *
 * This file is a part of logdiag.
 * Copyright 2012 Přemysl Eric Janouch
 *
 * See the file LICENSE for licensing information.
 *
 */

#include "liblogdiag.h"
#include "config.h"


/**
 * SECTION:ld-category-view
 * @short_description: Interface for objects displaying categories
 * @see_also: #LdCategory
 *
 * #LdCategoryView defines objects displaying contents of #LdCategory
 * hierarchies.
 */

G_DEFINE_INTERFACE (LdCategoryView, ld_category_view, 0)

static void
ld_category_view_default_init (LdCategoryViewInterface *iface)
{
	GParamSpec *pspec;

/**
 * LdCategoryView::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);

/**
 * LdCategoryView::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);

/**
 * LdCategoryView: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_set_category:
 * @self: an #LdCategoryView object.
 * @category: the #LdCategory to be assigned to the view.
 *
 * Assign an #LdCategory object to the view.
 */
void
ld_category_view_set_category (LdCategoryView *self,
	LdCategory *category)
{
	g_return_if_fail (LD_IS_CATEGORY_VIEW (self));
	LD_CATEGORY_VIEW_GET_INTERFACE (self)->set_category (self, category);
}

/**
 * ld_category_view_get_category:
 * @self: an #LdCategoryView object.
 *
 * Get the #LdCategory object assigned to this view.
 * The reference count on the category is not incremented.
 */
LdCategory *
ld_category_view_get_category (LdCategoryView *self)
{
	g_return_val_if_fail (LD_IS_CATEGORY_VIEW (self), NULL);
	return LD_CATEGORY_VIEW_GET_INTERFACE (self)->get_category (self);
}