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
100
101
102
103
104
105
106
107
|
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* GStuff */
#include <glib.h>
#include <glib-object.h>
/* Indicator Stuff */
#include <libindicator/indicator.h>
#include <libindicator/indicator-object.h>
#define INDICATOR_DATETIME_TYPE (indicator_datetime_get_type ())
#define INDICATOR_DATETIME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATOR_DATETIME_TYPE, IndicatorDatetime))
#define INDICATOR_DATETIME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATOR_DATETIME_TYPE, IndicatorDatetimeClass))
#define IS_INDICATOR_DATETIME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATOR_DATETIME_TYPE))
#define IS_INDICATOR_DATETIME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATOR_DATETIME_TYPE))
#define INDICATOR_DATETIME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATOR_DATETIME_TYPE, IndicatorDatetimeClass))
typedef struct _IndicatorDatetime IndicatorDatetime;
typedef struct _IndicatorDatetimeClass IndicatorDatetimeClass;
typedef struct _IndicatorDatetimePrivate IndicatorDatetimePrivate;
struct _IndicatorDatetimeClass {
IndicatorObjectClass parent_class;
};
struct _IndicatorDatetime {
IndicatorObject parent;
IndicatorDatetimePrivate * priv;
};
struct _IndicatorDatetimePrivate {
GtkLabel * label;
};
#define INDICATOR_DATETIME_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_DATETIME_TYPE, IndicatorDatetimePrivate))
GType indicator_datetime_get_type (void);
static void indicator_datetime_class_init (IndicatorDatetimeClass *klass);
static void indicator_datetime_init (IndicatorDatetime *self);
static void indicator_datetime_dispose (GObject *object);
static void indicator_datetime_finalize (GObject *object);
static GtkLabel * get_label (IndicatorObject * io);
/* Indicator Module Config */
INDICATOR_SET_VERSION
INDICATOR_SET_TYPE(INDICATOR_DATETIME_TYPE)
G_DEFINE_TYPE (IndicatorDatetime, indicator_datetime, INDICATOR_OBJECT_TYPE);
static void
indicator_datetime_class_init (IndicatorDatetimeClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (IndicatorDatetimePrivate));
object_class->dispose = indicator_datetime_dispose;
object_class->finalize = indicator_datetime_finalize;
IndicatorObjectClass * io_class = INDICATOR_OBJECT_CLASS(klass);
io_class->get_label = get_label;
return;
}
static void
indicator_datetime_init (IndicatorDatetime *self)
{
self->priv = INDICATOR_DATETIME_GET_PRIVATE(self);
return;
}
static void
indicator_datetime_dispose (GObject *object)
{
G_OBJECT_CLASS (indicator_datetime_parent_class)->dispose (object);
return;
}
static void
indicator_datetime_finalize (GObject *object)
{
G_OBJECT_CLASS (indicator_datetime_parent_class)->finalize (object);
return;
}
static GtkLabel *
get_label (IndicatorObject * io)
{
IndicatorDatetime * self = INDICATOR_DATETIME(io);
if (self->priv->label == NULL) {
self->priv->label = GTK_LABEL(gtk_label_new("Time"));
gtk_widget_show(GTK_WIDGET(self->priv->label));
}
return self->priv->label;
}
|