1
/* labelled-separator.c generated by valac 0.10.0, the Vala compiler
2
* generated from labelled-separator.vala, do not modify */
6
#include <glib-object.h>
13
#define TASK_MANAGER_TYPE_LABELLED_SEPARATOR (task_manager_labelled_separator_get_type ())
14
#define TASK_MANAGER_LABELLED_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparator))
15
#define TASK_MANAGER_LABELLED_SEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparatorClass))
16
#define TASK_MANAGER_IS_LABELLED_SEPARATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASK_MANAGER_TYPE_LABELLED_SEPARATOR))
17
#define TASK_MANAGER_IS_LABELLED_SEPARATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TASK_MANAGER_TYPE_LABELLED_SEPARATOR))
18
#define TASK_MANAGER_LABELLED_SEPARATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparatorClass))
20
typedef struct _TaskManagerLabelledSeparator TaskManagerLabelledSeparator;
21
typedef struct _TaskManagerLabelledSeparatorClass TaskManagerLabelledSeparatorClass;
22
typedef struct _TaskManagerLabelledSeparatorPrivate TaskManagerLabelledSeparatorPrivate;
24
struct _TaskManagerLabelledSeparator {
25
GtkSeparatorMenuItem parent_instance;
26
TaskManagerLabelledSeparatorPrivate * priv;
29
struct _TaskManagerLabelledSeparatorClass {
30
GtkSeparatorMenuItemClass parent_class;
33
struct _TaskManagerLabelledSeparatorPrivate {
34
GtkLabel* label_widget;
38
static gpointer task_manager_labelled_separator_parent_class = NULL;
40
GType task_manager_labelled_separator_get_type (void) G_GNUC_CONST;
41
#define TASK_MANAGER_LABELLED_SEPARATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TASK_MANAGER_TYPE_LABELLED_SEPARATOR, TaskManagerLabelledSeparatorPrivate))
43
TASK_MANAGER_LABELLED_SEPARATOR_DUMMY_PROPERTY
45
TaskManagerLabelledSeparator* task_manager_labelled_separator_new (const char* text);
46
TaskManagerLabelledSeparator* task_manager_labelled_separator_construct (GType object_type, const char* text);
47
static GType task_manager_labelled_separator_real_child_type (GtkContainer* base);
48
static gboolean task_manager_labelled_separator_real_expose_event (GtkWidget* base, GdkEventExpose* event);
49
static void task_manager_labelled_separator_finalize (GObject* obj);
53
TaskManagerLabelledSeparator* task_manager_labelled_separator_construct (GType object_type, const char* text) {
54
TaskManagerLabelledSeparator * self;
56
g_return_val_if_fail (text != NULL, NULL);
57
self = (TaskManagerLabelledSeparator*) g_object_new (object_type, "label", text, NULL);
58
self->priv->label_widget = (_tmp0_ = gtk_bin_get_child ((GtkBin*) self), GTK_IS_LABEL (_tmp0_) ? ((GtkLabel*) _tmp0_) : NULL);
59
gtk_misc_set_alignment ((GtkMisc*) self->priv->label_widget, 0.5f, 0.5f);
64
TaskManagerLabelledSeparator* task_manager_labelled_separator_new (const char* text) {
65
return task_manager_labelled_separator_construct (TASK_MANAGER_TYPE_LABELLED_SEPARATOR, text);
69
static GType task_manager_labelled_separator_real_child_type (GtkContainer* base) {
70
TaskManagerLabelledSeparator * self;
72
self = (TaskManagerLabelledSeparator*) base;
73
result = GTK_TYPE_WIDGET;
78
static gboolean task_manager_labelled_separator_real_expose_event (GtkWidget* base, GdkEventExpose* event) {
79
TaskManagerLabelledSeparator * self;
80
gboolean result = FALSE;
81
gboolean wide_separators = FALSE;
82
gint separator_height = 0;
83
gint horizontal_padding = 0;
84
GtkAllocation alloc = {0};
87
self = (TaskManagerLabelledSeparator*) base;
88
gtk_widget_get_allocation ((GtkWidget*) self, &alloc);
89
gtk_widget_style_get ((GtkWidget*) self, "wide-separators", &wide_separators, "separator-height", &separator_height, "horizontal-padding", &horizontal_padding, NULL, NULL);
90
xthickness = gtk_widget_get_style ((GtkWidget*) self)->xthickness;
91
ythickness = gtk_widget_get_style ((GtkWidget*) self)->ythickness;
92
if (wide_separators) {
93
gtk_paint_box (gtk_widget_get_style ((GtkWidget*) self), gtk_widget_get_window ((GtkWidget*) self), GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, &(*event).area, (GtkWidget*) self, "hseparator", (alloc.x + horizontal_padding) + xthickness, alloc.y + (((alloc.height - separator_height) - ythickness) / 2), alloc.width - (2 * (horizontal_padding + xthickness)), separator_height);
95
gtk_paint_hline (gtk_widget_get_style ((GtkWidget*) self), gtk_widget_get_window ((GtkWidget*) self), GTK_STATE_NORMAL, &(*event).area, (GtkWidget*) self, "menuitem", (alloc.x + horizontal_padding) + xthickness, (((alloc.x + alloc.width) - horizontal_padding) - xthickness) - 1, alloc.y + ((alloc.height - ythickness) / 2));
97
gtk_container_propagate_expose ((GtkContainer*) self, gtk_bin_get_child ((GtkBin*) self), event);
103
static void task_manager_labelled_separator_class_init (TaskManagerLabelledSeparatorClass * klass) {
104
task_manager_labelled_separator_parent_class = g_type_class_peek_parent (klass);
105
g_type_class_add_private (klass, sizeof (TaskManagerLabelledSeparatorPrivate));
106
GTK_CONTAINER_CLASS (klass)->child_type = task_manager_labelled_separator_real_child_type;
107
GTK_WIDGET_CLASS (klass)->expose_event = task_manager_labelled_separator_real_expose_event;
108
G_OBJECT_CLASS (klass)->finalize = task_manager_labelled_separator_finalize;
112
static void task_manager_labelled_separator_instance_init (TaskManagerLabelledSeparator * self) {
113
self->priv = TASK_MANAGER_LABELLED_SEPARATOR_GET_PRIVATE (self);
117
static void task_manager_labelled_separator_finalize (GObject* obj) {
118
TaskManagerLabelledSeparator * self;
119
self = TASK_MANAGER_LABELLED_SEPARATOR (obj);
120
G_OBJECT_CLASS (task_manager_labelled_separator_parent_class)->finalize (obj);
124
GType task_manager_labelled_separator_get_type (void) {
125
static volatile gsize task_manager_labelled_separator_type_id__volatile = 0;
126
if (g_once_init_enter (&task_manager_labelled_separator_type_id__volatile)) {
127
static const GTypeInfo g_define_type_info = { sizeof (TaskManagerLabelledSeparatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) task_manager_labelled_separator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TaskManagerLabelledSeparator), 0, (GInstanceInitFunc) task_manager_labelled_separator_instance_init, NULL };
128
GType task_manager_labelled_separator_type_id;
129
task_manager_labelled_separator_type_id = g_type_register_static (GTK_TYPE_SEPARATOR_MENU_ITEM, "TaskManagerLabelledSeparator", &g_define_type_info, 0);
130
g_once_init_leave (&task_manager_labelled_separator_type_id__volatile, task_manager_labelled_separator_type_id);
132
return task_manager_labelled_separator_type_id__volatile;