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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
/*******************************************************************************
**3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
** 10 20 30 40 50 60 70 80
**
** notify-osd
**
** defaults.h - a singelton providing all default values for sizes, colors etc.
**
** Copyright 2009 Canonical Ltd.
**
** Authors:
** Mirco "MacSlow" Mueller <mirco.mueller@canonical.com>
** David Barth <david.barth@canonical.com>
**
** This program is free software: you can redistribute it and/or modify it
** under the terms of the GNU General Public License version 3, as published
** by the Free Software Foundation.
**
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranties of
** MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
** PURPOSE. See the GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License along
** with this program. If not, see <http://www.gnu.org/licenses/>.
**
*******************************************************************************/
#ifndef __DEFAULTS_H
#define __DEFAULTS_H
#include <glib-object.h>
#include <gconf/gconf-client.h>
G_BEGIN_DECLS
#define DEFAULTS_TYPE (defaults_get_type ())
#define DEFAULTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEFAULTS_TYPE, Defaults))
#define DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEFAULTS_TYPE, DefaultsClass))
#define IS_DEFAULTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEFAULTS_TYPE))
#define IS_DEFAULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEFAULTS_TYPE))
#define DEFAULTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEFAULTS_TYPE, DefaultsClass))
/* FIXME: quick hack to get every measurement to use em instead of pixels, to
* correctly use these two macros you'll need to pass it a valid Defaults class
* object
*
* example use:
* PIXEL2EM(42, defaults) - that will returns a gdouble
* EM2PIXEL(0.375, defaults) - that will return a gint */
#define PIXELS2EM(pixel_value, d) ((gdouble) ((gdouble) pixel_value / defaults_get_pixel_per_em(d)))
#define EM2PIXELS(em_value, d) ((gint) (em_value * defaults_get_pixel_per_em(d)))
typedef struct _Defaults Defaults;
typedef struct _DefaultsClass DefaultsClass;
/* instance structure */
struct _Defaults
{
GObject parent;
/* private */
GConfClient* context;
guint notifier[5];
gint desktop_width;
gint desktop_height;
gint desktop_top;
gint desktop_bottom;
gint desktop_left;
gint desktop_right;
gdouble desktop_bottom_gap;
gdouble stack_height;
gdouble bubble_vert_gap;
gdouble bubble_horz_gap;
gdouble bubble_width;
gdouble bubble_min_height;
gdouble bubble_max_height;
gdouble bubble_shadow_size;
GString* bubble_shadow_color;
GString* bubble_bg_color;
GString* bubble_bg_opacity;
GString* bubble_hover_opacity;
gdouble bubble_corner_radius;
gdouble content_shadow_size;
GString* content_shadow_color;
gdouble margin_size;
gdouble icon_size;
gdouble gauge_size;
gdouble gauge_outline_width;
gint fade_in_timeout;
gint fade_out_timeout;
gint on_screen_timeout;
GString* text_font_face;
GString* text_title_color;
gint text_title_weight;
gdouble text_title_size;
GString* text_body_color;
gint text_body_weight;
gdouble text_body_size;
gdouble pixels_per_em;
gdouble system_font_size;
gdouble screen_dpi;
};
/* class structure */
struct _DefaultsClass
{
GObjectClass parent;
/*< signals >*/
void (*value_changed) (Defaults* defaults); /* used to "inform" bubble
** about any changes in
** rendering and position */
};
GType defaults_get_type (void);
Defaults*
defaults_new (void);
gint
defaults_get_desktop_width (Defaults* self);
gint
defaults_get_desktop_height (Defaults* self);
gint
defaults_get_desktop_top (Defaults* self);
gint
defaults_get_desktop_bottom (Defaults* self);
gint
defaults_get_desktop_left (Defaults* self);
gint
defaults_get_desktop_right (Defaults* self);
gdouble
defaults_get_desktop_bottom_gap (Defaults* self);
gdouble
defaults_get_stack_height (Defaults* self);
gdouble
defaults_get_bubble_width (Defaults* self);
gdouble
defaults_get_bubble_min_height (Defaults* self);
gdouble
defaults_get_bubble_max_height (Defaults* self);
gdouble
defaults_get_bubble_vert_gap (Defaults* self);
gdouble
defaults_get_bubble_horz_gap (Defaults* self);
gdouble
defaults_get_bubble_shadow_size (Defaults* self);
gchar*
defaults_get_bubble_shadow_color (Defaults* self);
gchar*
defaults_get_bubble_bg_color (Defaults* self);
gchar*
defaults_get_bubble_bg_opacity (Defaults* self);
gchar*
defaults_get_bubble_hover_opacity (Defaults* self);
gdouble
defaults_get_bubble_corner_radius (Defaults* self);
gdouble
defaults_get_content_shadow_size (Defaults* self);
gchar*
defaults_get_content_shadow_color (Defaults* self);
gdouble
defaults_get_margin_size (Defaults* self);
gdouble
defaults_get_icon_size (Defaults* self);
gdouble
defaults_get_gauge_size (Defaults* self);
gdouble
defaults_get_gauge_outline_width (Defaults* self);
gint
defaults_get_fade_in_timeout (Defaults* self);
gint
defaults_get_fade_out_timeout (Defaults* self);
gint
defaults_get_on_screen_timeout (Defaults* self);
gchar*
defaults_get_text_font_face (Defaults* self);
gchar*
defaults_get_text_title_color (Defaults* self);
gint
defaults_get_text_title_weight (Defaults* self);
gdouble
defaults_get_text_title_size (Defaults* self);
gchar*
defaults_get_text_body_color (Defaults* self);
gint
defaults_get_text_body_weight (Defaults* self);
gdouble
defaults_get_text_body_size (Defaults* self);
gdouble
defaults_get_pixel_per_em (Defaults* self);
gdouble
defaults_get_system_font_size (Defaults* self);
gdouble
defaults_get_screen_dpi (Defaults* self);
void
defaults_refresh_screen_dimension_properties (Defaults *self);
void
defaults_get_top_corner (Defaults *self, gint *x, gint *y);
G_END_DECLS
#endif /* __DEFAULTS_H */
|