105
106
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
107
gobject_class->dispose = xpad_settings_dispose;
108
108
gobject_class->finalize = xpad_settings_finalize;
109
109
gobject_class->set_property = xpad_settings_set_property;
110
110
gobject_class->get_property = xpad_settings_get_property;
112
g_object_class_install_property (gobject_class,
114
g_param_spec_uint ("width",
115
"Default Width of Pads",
116
"Window width of pads on creation",
122
g_object_class_install_property (gobject_class,
124
g_param_spec_uint ("height",
125
"Default Height of Pads",
126
"Window height of pads on creation",
132
g_object_class_install_property (gobject_class,
133
PROP_HAS_DECORATIONS,
134
g_param_spec_boolean ("has-decorations",
136
"Whether pads have window decorations",
140
g_object_class_install_property (gobject_class,
141
PROP_CONFIRM_DESTROY,
142
g_param_spec_boolean ("confirm-destroy",
144
"Whether destroying a pad requires user confirmation",
148
g_object_class_install_property (gobject_class,
150
g_param_spec_boolean ("edit-lock",
152
"Whether edit lock mode is enabled",
155
g_object_class_install_property (gobject_class,
157
g_param_spec_boolean ("tray-enabled",
158
"Enable the tray icon",
159
"Whether to enable or disable the systray icon",
163
g_object_class_install_property (gobject_class,
164
PROP_TRAY_CLICK_CONFIGURATION,
165
g_param_spec_uint ("tray-click-configuration",
166
"Tray click configuration",
167
"What configuration is selected on tray click",
172
g_object_class_install_property (gobject_class,
174
g_param_spec_boolean ("has-toolbar",
175
"Each pad has a toolbar",
176
"Whether pads have toolbars",
180
g_object_class_install_property (gobject_class,
181
PROP_AUTOHIDE_TOOLBAR,
182
g_param_spec_boolean ("autohide-toolbar",
184
"Whether toolbars hide when not used",
188
g_object_class_install_property (gobject_class,
190
g_param_spec_boolean ("has-scrollbar",
192
"Whether pads have scrollbars",
196
g_object_class_install_property (gobject_class,
198
g_param_spec_string ("fontname",
200
"Default name of pad font",
204
g_object_class_install_property (gobject_class,
206
g_param_spec_boxed ("text-color",
208
"Default color of pad text",
212
g_object_class_install_property (gobject_class,
214
g_param_spec_boxed ("back-color",
216
"Default color of pad background",
220
g_object_class_install_property (gobject_class,
222
g_param_spec_boolean ("autostart-xpad",
223
"Automatically start xpad",
224
"Whether to start xpad after login",
228
g_object_class_install_property (gobject_class,
229
PROP_AUTOSTART_WAIT_SYSTRAY,
230
g_param_spec_boolean ("autostart-wait-systray",
231
"Autostart Xpad wait for systray",
232
"Whether to wait for the systray before starting xpad automatically after login",
236
g_object_class_install_property (gobject_class,
237
PROP_AUTOSTART_NEW_PAD,
238
g_param_spec_boolean ("autostart-new-pad",
239
"Autostart a new pad",
240
"Whether to create a new pad on startup",
244
g_object_class_install_property (gobject_class,
245
PROP_AUTOSTART_STICKY,
246
g_param_spec_boolean ("autostart-sticky",
247
"Default Stickiness",
248
"Whether pads are sticky on creation",
252
g_object_class_install_property (gobject_class,
253
PROP_AUTOSTART_DELAY,
254
g_param_spec_uint ("autostart-delay",
255
"Delay autostart of Xpad",
256
"How many seconds will Xpad wait before continuing startup",
262
g_object_class_install_property (gobject_class,
263
PROP_AUTOSTART_DISPLAY_PADS,
264
g_param_spec_uint ("autostart-display-pads",
265
"Autostart display pads",
266
"How to show the different pads when Xpad is started",
272
signals[CHANGE_BUTTONS] =
273
g_signal_new ("change_buttons",
274
G_OBJECT_CLASS_TYPE (gobject_class),
276
G_STRUCT_OFFSET (XpadSettingsClass, change_buttons),
278
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
112
obj_prop[PROP_WIDTH] = g_param_spec_uint ("width", "Default width of pads", "Window width of pads on creation", 0, G_MAXUINT, 200, G_PARAM_READWRITE);
113
obj_prop[PROP_HEIGHT] = g_param_spec_uint ("height", "Default height of pads", "Window height of pads on creation", 0, G_MAXUINT, 200, G_PARAM_READWRITE);
114
obj_prop[PROP_HAS_DECORATIONS] = g_param_spec_boolean ("has-decorations", "Has decorations", "Whether pads have window decorations", TRUE, G_PARAM_READWRITE);
115
obj_prop[PROP_CONFIRM_DESTROY] = g_param_spec_boolean ("confirm-destroy", "Confirm destroy", "Ask for delete confirmation", TRUE, G_PARAM_READWRITE);
116
obj_prop[PROP_EDIT_LOCK] = g_param_spec_boolean ("edit-lock", "Edit lock", "Toggle read-only mode", FALSE, G_PARAM_READWRITE);
117
obj_prop[PROP_TRAY_ENABLED] = g_param_spec_boolean ("tray-enabled", "Enable tray icon", "Enable or disable the systray icon", TRUE, G_PARAM_READWRITE);
118
obj_prop[PROP_TRAY_CLICK_CONFIGURATION] = g_param_spec_uint ("tray-click-configuration", "Tray click configuration", "Configure tray left click", 0, G_MAXUINT, 0, G_PARAM_READWRITE);
119
obj_prop[PROP_HAS_TOOLBAR] = g_param_spec_boolean ("has-toolbar", "Has toolbar", "Whether pads have toolbars", TRUE, G_PARAM_READWRITE);
120
obj_prop[PROP_AUTOHIDE_TOOLBAR] = g_param_spec_boolean ("autohide-toolbar", "Autohide toolbar", "Hide toolbars when not used", TRUE, G_PARAM_READWRITE);
121
obj_prop[PROP_HAS_SCROLLBAR] = g_param_spec_boolean ("has-scrollbar", "Has scrollbar", "Whether pads have scrollbars", TRUE, G_PARAM_READWRITE);
122
obj_prop[PROP_FONTNAME] = g_param_spec_string ("fontname", "Font name", "Default name of pad font", NULL, G_PARAM_READWRITE);
123
obj_prop[PROP_TEXT_COLOR] = g_param_spec_boxed ("text-color", "Text color", "Default color of pad text", GDK_TYPE_RGBA, G_PARAM_READWRITE);
124
obj_prop[PROP_BACK_COLOR] = g_param_spec_boxed ("back-color", "Back color", "Default color of pad background", GDK_TYPE_RGBA, G_PARAM_READWRITE);
125
obj_prop[PROP_AUTOSTART_XPAD] = g_param_spec_boolean ("autostart-xpad", "Automatically start xpad", "Start Xpad after login", FALSE, G_PARAM_READWRITE);
126
obj_prop[PROP_AUTOSTART_WAIT_SYSTRAY] = g_param_spec_boolean ("autostart-wait-systray", "Wait for systray", "Whether to wait for the systray after login", TRUE, G_PARAM_READWRITE);
127
obj_prop[PROP_AUTOSTART_NEW_PAD] = g_param_spec_boolean ("autostart-new-pad", "Start a new pad", "Whether to create a new pad on startup", FALSE, G_PARAM_READWRITE);
128
obj_prop[PROP_AUTOSTART_STICKY] = g_param_spec_boolean ("autostart-sticky", "Stick to desktop", "Whether pads are sticky on creation", FALSE, G_PARAM_READWRITE);
129
obj_prop[PROP_AUTOSTART_DELAY] = g_param_spec_uint ("autostart-delay", "Delay autostart of Xpad", "Number of seconds to wait before start of Xpad", 0, G_MAXUINT, 0, G_PARAM_READWRITE);
130
obj_prop[PROP_AUTOSTART_DISPLAY_PADS] = g_param_spec_uint ("autostart-display-pads", "Autostart display pads", "Show/hide/restore pads at start", 0, G_MAXUINT, 2, G_PARAM_READWRITE);
132
g_object_class_install_properties (gobject_class, N_PROPERTIES, obj_prop);
134
signals[CHANGE_BUTTONS] = g_signal_new ("change_buttons", G_OBJECT_CLASS_TYPE (gobject_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (XpadSettingsClass, change_buttons), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
282
138
xpad_settings_init (XpadSettings *settings)
284
settings->priv = xpad_settings_get_instance_private(settings);
140
settings->priv = xpad_settings_get_instance_private (settings);
143
* FIXME: Although the default values below have been set in the xpad_settings_class_init above,
144
* these default values are not applied to the private variables of this instance.
145
* I haven't found a way to resolve this yet. So, for now we have a double
146
* administration of defaults values. It would be awesome to reduce this to 1 administration.
148
* Found the explanation, but not a solution:
149
* http://blogs.gnome.org/desrt/2012/02/26/a-gentle-introduction-to-gobject-construction/
151
settings->priv->width = 200;
152
settings->priv->height = 200;
153
settings->priv->has_decorations = TRUE;
154
settings->priv->confirm_destroy = TRUE;
155
settings->priv->edit_lock = FALSE;
156
settings->priv->tray_enabled = TRUE;
157
settings->priv->tray_click_configuration = 1;
158
settings->priv->has_toolbar = TRUE;
159
settings->priv->autohide_toolbar = TRUE;
160
settings->priv->has_scrollbar = TRUE;
161
settings->priv->fontname = NULL;
286
162
/* A pleasant light yellow background color, similar to commercial sticky notes, with black text. */
287
163
settings->priv->text = gdk_rgba_copy(&(GdkRGBA) {0, 0, 0, 1});
288
164
settings->priv->back = gdk_rgba_copy(&(GdkRGBA) {1, 0.933334350586, 0.6, 1});
165
settings->priv->autostart_wait_systray = TRUE;
166
settings->priv->autostart_new_pad = FALSE;
167
settings->priv->autostart_sticky = FALSE;
168
settings->priv->autostart_delay = 0;
169
settings->priv->autostart_display_pads = 2;
290
171
settings->priv->toolbar_buttons = NULL;
291
172
settings->priv->toolbar_buttons = g_slist_append (settings->priv->toolbar_buttons, g_strdup ("New"));