1 /*
2  * Osmo - a handy personal organizer
3  *
4  * Copyright (C) 2007-2009 Tomasz Maka <pasp@users.sourceforge.net>
5  *               2007-2009 Piotr Maka <silloz@users.sourceforge.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 
22 #include "i18n.h"
23 #include "notes.h"
24 #include "notes_preferences_gui.h"
25 #include "options_prefs.h"
26 #include "stock_icons.h"
27 #include "utils_gui.h"
28 
29 #ifdef HAVE_LIBGRINGOTTS
30 #include <libgringotts.h>
31 
32 /* ========================================================================== */
33 /* FIXME */
34 gint
get_enc_algorithm_value(void)35 get_enc_algorithm_value (void)
36 {
37 	gint algorithms_table [8] = {
38 		GRG_AES, GRG_SERPENT, GRG_TWOFISH, GRG_CAST_256,
39 		GRG_SAFERPLUS, GRG_LOKI97, GRG_3DES, GRG_RIJNDAEL_256
40 	};
41 
42 	return algorithms_table[config.notes_enc_algorithm % 8];
43 }
44 
45 /* ========================================================================== */
46 
47 gint
get_enc_hashing_value(void)48 get_enc_hashing_value (void)
49 {
50 	gint hashing_table [2] = {
51 	    GRG_SHA1, GRG_RIPEMD_160
52 	};
53 
54 	return hashing_table[config.notes_enc_hashing % 2];
55 }
56 
57 /* ========================================================================== */
58 
59 gint
get_comp_algorithm_value(void)60 get_comp_algorithm_value (void)
61 {
62 	gint algorithm_table [2] = {
63 		GRG_ZLIB, GRG_BZIP
64 	};
65 
66 	return algorithm_table[config.notes_comp_algorithm % 2];
67 }
68 
69 /* ========================================================================== */
70 
71 gint
get_comp_ratio_value(void)72 get_comp_ratio_value (void)
73 {
74 	gint ratio_table [4] = {
75 	    GRG_LVL_NONE, GRG_LVL_FAST, GRG_LVL_GOOD, GRG_LVL_BEST
76 	};
77 
78 	return ratio_table[config.notes_comp_ratio % 4];
79 }
80 
81 /* ========================================================================== */
82 
83 #endif /* HAVE_LIBGRINGOTTS */
84 
85 #ifdef NOTES_ENABLED
86 
87 /* ========================================================================== */
88 
89 static void
checkbutton_clicked_cb(GtkToggleButton * togglebutton,gint * option)90 checkbutton_clicked_cb (GtkToggleButton *togglebutton, gint *option)
91 {
92 	*option = gtk_toggle_button_get_active (togglebutton);
93 }
94 
95 /* ========================================================================== */
96 #ifdef HAVE_LIBGRINGOTTS
97 
98 static void
notes_comp_ratio_cb(GtkComboBox * combobox,gint * option)99 notes_comp_ratio_cb (GtkComboBox *combobox, gint *option)
100 {
101 	*option = gtk_combo_box_get_active (combobox) +1;
102 }
103 
104 /* ========================================================================== */
105 
106 static void
combobox_clicked_cb(GtkComboBox * combobox,gint * option)107 combobox_clicked_cb (GtkComboBox *combobox, gint *option)
108 {
109 	*option = gtk_combo_box_get_active (combobox);
110 }
111 /* ========================================================================== */
112 
113 static void
create_encryption_section(GtkWidget * encryption_vbox,GUI * appGUI)114 create_encryption_section (GtkWidget *encryption_vbox, GUI *appGUI)
115 {
116 	GtkWidget *table, *combobox, *label;
117 
118 	table = gtk_grid_new ();
119 	gtk_box_pack_start (GTK_BOX (encryption_vbox), table, FALSE, FALSE, 0);
120 	gtk_grid_set_row_spacing (GTK_GRID (table), 8);
121 	gtk_grid_set_column_spacing (GTK_GRID (table), 8);
122 
123 	label = utl_gui_create_label ("%s:", _("Algorithm"));
124         gtk_widget_set_hexpand(label, TRUE);
125 	gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
126 
127 	label = utl_gui_create_label ("%s:", _("Hashing"));
128         gtk_widget_set_hexpand(label, TRUE);
129 	gtk_grid_attach (GTK_GRID (table), label, 2, 0, 1, 1);
130 
131 	combobox = gtk_combo_box_text_new ();
132 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "AES");
133 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "Serpent");
134 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "Twofish");
135 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "CAST 256");
136 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "Safer+");
137 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "Loki 97");
138 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "Triple DES");
139 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "Rijndael");
140 	gtk_combo_box_set_active (GTK_COMBO_BOX(combobox), config.notes_enc_algorithm);
141         gtk_widget_set_hexpand(combobox, TRUE);
142 	gtk_grid_attach (GTK_GRID (table), combobox, 1, 0, 1, 1);
143 	g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (combobox_clicked_cb), &(config.notes_enc_algorithm));
144 	appGUI->opt->notes_enc_algorithm_combobox = combobox;
145 
146 	combobox = gtk_combo_box_text_new ();
147 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "SHA-1");
148 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "RIPEMD-160");
149 	gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), config.notes_enc_hashing);
150         gtk_widget_set_hexpand(combobox, TRUE);
151 	gtk_grid_attach (GTK_GRID (table), combobox, 3, 0, 1, 1);
152 	g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (combobox_clicked_cb), &(config.notes_enc_algorithm));
153 	appGUI->opt->notes_enc_hashing_combobox = combobox;
154 
155 	label = utl_gui_create_label ("%s:", _("Compression"));
156         gtk_widget_set_hexpand(label, TRUE);
157 	gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
158 
159 	label = utl_gui_create_label ("%s:", _("Ratio"));
160         gtk_widget_set_hexpand(label, TRUE);
161 	gtk_grid_attach (GTK_GRID (table), label, 2, 1, 1, 1);
162 
163 	combobox = gtk_combo_box_text_new ();
164         gtk_widget_set_hexpand(combobox, TRUE);
165 	gtk_grid_attach (GTK_GRID (table), combobox, 1, 1, 1, 1);
166 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "ZLib");
167 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, "BZip2");
168 	gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), config.notes_comp_algorithm);
169 	g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (combobox_clicked_cb), &(config.notes_comp_algorithm));
170 	appGUI->opt->notes_comp_algorithm_combobox = combobox;
171 
172 	combobox = gtk_combo_box_text_new ();
173         gtk_widget_set_hexpand(combobox, TRUE);
174 	gtk_grid_attach (GTK_GRID (table), combobox, 3, 1, 1, 1);
175 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, _("Fast"));
176 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, _("Good"));
177 	gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combobox), NULL, _("Best"));
178 	gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), config.notes_comp_ratio - 1);
179 	g_signal_connect (G_OBJECT (combobox), "changed", G_CALLBACK (notes_comp_ratio_cb), &(config.notes_comp_ratio));
180 	appGUI->opt->notes_comp_ratio_combobox = combobox;
181 }
182 
183 #endif /* HAVE_LIBGRINGOTTS */
184 
185 /* ========================================================================== */
186 
187 static void
notes_visible_columns_changed_cb(GtkToggleButton * widget,GUI * appGUI)188 notes_visible_columns_changed_cb (GtkToggleButton *widget, GUI *appGUI)
189 {
190 	config.nte_visible_type_column = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (appGUI->opt->nvc_type_checkbutton));
191 	gtk_tree_view_column_set_visible (appGUI->nte->notes_columns[N_COLUMN_TYPE], config.nte_visible_type_column);
192 
193 	config.nte_visible_category_column = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (appGUI->opt->nvc_category_checkbutton));
194 	gtk_tree_view_column_set_visible (appGUI->nte->notes_columns[N_COLUMN_CATEGORY], config.nte_visible_category_column);
195 
196 	config.nte_visible_last_changes_column = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (appGUI->opt->nvc_last_changes_checkbutton));
197 	gtk_tree_view_column_set_visible (appGUI->nte->notes_columns[N_COLUMN_LAST_CHANGES_DATE], config.nte_visible_last_changes_column);
198 
199 	config.nte_visible_created_column = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (appGUI->opt->nvc_created_checkbutton));
200 	gtk_tree_view_column_set_visible (appGUI->nte->notes_columns[N_COLUMN_CREATE_DATE], config.nte_visible_created_column);
201 
202 	set_note_columns_width (appGUI);
203 }
204 
205 /* ========================================================================== */
206 
207 static void
create_visible_columns_section(GtkWidget * visible_columns_vbox,GUI * appGUI)208 create_visible_columns_section (GtkWidget *visible_columns_vbox, GUI *appGUI)
209 {
210 	GtkWidget *table, *checkbutton;
211 
212 	table = gtk_grid_new ();
213 	gtk_box_pack_start (GTK_BOX (visible_columns_vbox), table, FALSE, FALSE, 0);
214 	gtk_grid_set_row_spacing (GTK_GRID (table), 4);
215 	gtk_grid_set_column_spacing (GTK_GRID (table), 8);
216 
217 	checkbutton = gtk_check_button_new_with_mnemonic (_("Type"));
218 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), config.nte_visible_type_column);
219         gtk_widget_set_hexpand(checkbutton, TRUE);
220 	gtk_grid_attach (GTK_GRID (table), checkbutton, 0, 0, 1, 1);
221 	g_signal_connect (G_OBJECT (checkbutton), "toggled", G_CALLBACK (notes_visible_columns_changed_cb), appGUI);
222 	appGUI->opt->nvc_type_checkbutton = checkbutton;
223 
224 	checkbutton = gtk_check_button_new_with_mnemonic (_("Category"));
225 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), config.nte_visible_category_column);
226         gtk_widget_set_hexpand(checkbutton, TRUE);
227 	gtk_grid_attach (GTK_GRID (table), checkbutton, 1, 0, 1, 1);
228 	g_signal_connect (G_OBJECT (checkbutton), "toggled", G_CALLBACK (notes_visible_columns_changed_cb), appGUI);
229 	appGUI->opt->nvc_category_checkbutton = checkbutton;
230 
231 	checkbutton = gtk_check_button_new_with_mnemonic (_("Last changes"));
232 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), config.nte_visible_last_changes_column);
233         gtk_widget_set_hexpand(checkbutton, TRUE);
234 	gtk_grid_attach (GTK_GRID (table), checkbutton, 2, 0, 1, 1);
235 	g_signal_connect (G_OBJECT (checkbutton), "toggled", G_CALLBACK (notes_visible_columns_changed_cb), appGUI);
236 	appGUI->opt->nvc_last_changes_checkbutton = checkbutton;
237 
238 	checkbutton = gtk_check_button_new_with_mnemonic (_("Created"));
239 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), config.nte_visible_created_column);
240         gtk_widget_set_hexpand(checkbutton, TRUE);
241 	gtk_grid_attach (GTK_GRID (table), checkbutton, 3, 0, 1, 1);
242 	g_signal_connect (G_OBJECT (checkbutton), "toggled", G_CALLBACK (notes_visible_columns_changed_cb), appGUI);
243 	appGUI->opt->nvc_created_checkbutton = checkbutton;
244 }
245 
246 /* ========================================================================== */
247 
248 static void
notes_category_selected_cb(GtkTreeSelection * selection,GUI * appGUI)249 notes_category_selected_cb (GtkTreeSelection *selection, GUI *appGUI)
250 {
251 	GtkTreeModel *model;
252 	GtkTreeIter iter;
253 
254 	if (gtk_tree_selection_get_selected (selection, &model, &iter))
255 		gtk_widget_set_sensitive (appGUI->opt->notes_category_remove_button, TRUE);
256 	else
257 		gtk_widget_set_sensitive (appGUI->opt->notes_category_remove_button, FALSE);
258 }
259 
260 /* ========================================================================== */
261 
262 static void
notes_category_add_cb(GtkWidget * widget,GUI * appGUI)263 notes_category_add_cb (GtkWidget *widget, GUI *appGUI)
264 {
265 	GtkListStore *store = appGUI->opt->notes_category_store;
266 	GtkTreeIter iter;
267 	const gchar *category_name;
268 	gchar *item;
269 	gboolean has_next;
270 
271 	category_name = gtk_entry_get_text (GTK_ENTRY (appGUI->opt->notes_category_entry));
272 	if (!strlen (category_name)) return;
273 
274 
275         has_next = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
276 	while (has_next) {
277 		gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, 0, &item, -1);
278 		if (!strcmp (category_name, item)) {
279 			g_free (item);
280 			return;
281 		}
282 		g_free (item);
283                 has_next = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
284 	}
285 
286 	gtk_list_store_append (store, &iter);
287 	gtk_list_store_set (store, &iter, 0, category_name, -1);
288 	gtk_entry_set_text (GTK_ENTRY (appGUI->opt->notes_category_entry), "");
289 	gtk_widget_set_sensitive (appGUI->opt->notes_category_add_button, FALSE);
290 
291 	utl_gui_create_category_combobox (GTK_COMBO_BOX (appGUI->nte->cf_combobox), store, FALSE);
292 	gtk_combo_box_set_active (GTK_COMBO_BOX (appGUI->nte->cf_combobox), 0);
293 }
294 
295 /* ========================================================================== */
296 
297 static gint
notes_category_entry_key_release_cb(GtkEntry * entry,GdkEventKey * event,GUI * appGUI)298 notes_category_entry_key_release_cb (GtkEntry *entry, GdkEventKey *event, GUI *appGUI)
299 {
300 	gboolean state = FALSE;
301 
302 	if (strlen (gtk_entry_get_text (entry)))
303 		state = TRUE;
304 
305 	gtk_widget_set_sensitive (appGUI->opt->notes_category_add_button, state);
306 
307 	if (event->keyval == GDK_KEY_Return) {
308 		if (state) notes_category_add_cb (NULL, appGUI);
309 		return TRUE;
310 	}
311 
312 	return FALSE;
313 }
314 
315 /* ========================================================================== */
316 
317 static void
notes_category_cell_edited_cb(GtkCellRendererText * renderer,gchar * path,gchar * new_text,GUI * appGUI)318 notes_category_cell_edited_cb (GtkCellRendererText *renderer, gchar *path, gchar *new_text, GUI *appGUI)
319 {
320 	GtkTreeModel *model;
321 	GtkTreeIter iter;
322 
323 	if (g_ascii_strcasecmp (new_text, "") == 0) return;
324 
325 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (appGUI->opt->notes_category_treeview));
326 	if (gtk_tree_model_get_iter_from_string (model, &iter, path))
327 		gtk_list_store_set (appGUI->opt->notes_category_store, &iter, 0, new_text, -1);
328 }
329 
330 /* ========================================================================== */
331 
332 static void
notes_category_remove_cb(GtkWidget * widget,GUI * appGUI)333 notes_category_remove_cb (GtkWidget *widget, GUI *appGUI)
334 {
335 	GtkTreePath *path;
336 	GtkTreeIter iter;
337 	GtkListStore *store = appGUI->opt->notes_category_store;
338 
339 	gtk_tree_view_get_cursor (GTK_TREE_VIEW (appGUI->opt->notes_category_treeview), &path, NULL);
340 	if (path == NULL) return;
341 
342 	gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path);
343 	gtk_list_store_remove (store, &iter);
344 	gtk_tree_path_free (path);
345 
346 	utl_gui_create_category_combobox (GTK_COMBO_BOX (appGUI->nte->cf_combobox), store, FALSE);
347 	gtk_combo_box_set_active (GTK_COMBO_BOX (appGUI->nte->cf_combobox), 0);
348 }
349 
350 /* ========================================================================== */
351 
352 static void
create_categories_section(GtkWidget * categories_vbox,GUI * appGUI)353 create_categories_section (GtkWidget *categories_vbox, GUI *appGUI)
354 {
355 	GtkWidget *table, *entry, *treeview, *scrolledwindow;
356 	GtkTreeViewColumn *column;
357 	GtkCellRenderer *renderer;
358 
359 	table = gtk_grid_new ();
360 	gtk_box_pack_start (GTK_BOX (categories_vbox), table, TRUE, TRUE, 0);
361 	gtk_container_set_border_width (GTK_CONTAINER (table), 8);
362 	gtk_grid_set_row_spacing (GTK_GRID (table), 8);
363 	gtk_grid_set_column_spacing (GTK_GRID (table), 4);
364 
365 	entry = gtk_entry_new ();
366         gtk_widget_set_hexpand(entry, TRUE);
367 	gtk_grid_attach (GTK_GRID (table), entry, 0, 3, 1, 1);
368 	g_signal_connect (G_OBJECT (entry), "key_release_event", G_CALLBACK (notes_category_entry_key_release_cb), appGUI);
369 	appGUI->opt->notes_category_entry = entry;
370 
371 	scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
372 	gtk_widget_set_hexpand(scrolledwindow, TRUE);
373 	gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW (scrolledwindow), 80);
374 	gtk_grid_attach (GTK_GRID (table), scrolledwindow, 0, 0, 3, 3);
375 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
376 	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN);
377 
378 	treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (appGUI->opt->notes_category_store));
379 	appGUI->opt->notes_category_treeview = treeview;
380 	gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview);
381 	gtk_container_set_border_width (GTK_CONTAINER (treeview), 4);
382 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
383 	gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE);
384 	gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), FALSE);
385 
386 	appGUI->opt->notes_category_select = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
387 	g_signal_connect (G_OBJECT (appGUI->opt->notes_category_select), "changed", G_CALLBACK (notes_category_selected_cb), appGUI);
388 
389 	renderer = gtk_cell_renderer_text_new ();
390 	g_object_set (renderer, "editable", TRUE, "editable-set", TRUE, NULL);
391 	g_signal_connect (G_OBJECT (renderer), "edited", G_CALLBACK (notes_category_cell_edited_cb), appGUI);
392 
393 	column = gtk_tree_view_column_new_with_attributes(NULL, renderer, "text", 0, NULL);
394 	gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
395 
396 	appGUI->opt->notes_category_add_button = gtk_button_new_from_icon_name ("list-add", GTK_ICON_SIZE_BUTTON);
397 	gtk_grid_attach (GTK_GRID (table), appGUI->opt->notes_category_add_button, 1, 3, 1, 1);
398 	gtk_widget_set_sensitive (appGUI->opt->notes_category_add_button, FALSE);
399 	g_signal_connect (appGUI->opt->notes_category_add_button, "clicked", G_CALLBACK (notes_category_add_cb), appGUI);
400 
401 	appGUI->opt->notes_category_remove_button = gtk_button_new_from_icon_name ("list-remove", GTK_ICON_SIZE_BUTTON);
402 	gtk_grid_attach (GTK_GRID (table), appGUI->opt->notes_category_remove_button, 2, 3, 1, 1);
403 	gtk_widget_set_sensitive (appGUI->opt->notes_category_remove_button, FALSE);
404 	g_signal_connect (appGUI->opt->notes_category_remove_button, "clicked", G_CALLBACK (notes_category_remove_cb), appGUI);
405 }
406 
407 /* ========================================================================== */
408 
409 static void
create_options_section(GtkWidget * notes_opt_vbox,GUI * appGUI)410 create_options_section (GtkWidget *notes_opt_vbox, GUI *appGUI)
411 {
412 	GtkWidget *checkbutton;
413 
414 	checkbutton = gtk_check_button_new_with_mnemonic (_("Remember the last selected category"));
415 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), config.remember_category_in_notes);
416 	gtk_box_pack_start (GTK_BOX (notes_opt_vbox), checkbutton, FALSE, FALSE, 4);
417 	g_signal_connect (G_OBJECT (checkbutton), "toggled", G_CALLBACK (checkbutton_clicked_cb), &(config.remember_category_in_notes));
418 	appGUI->opt->cn_remember_category_checkbutton = checkbutton;
419 
420 	checkbutton = gtk_check_button_new_with_mnemonic (_("Use system format for date and time"));
421 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbutton), config.use_system_date_in_notes);
422 	gtk_box_pack_start (GTK_BOX (notes_opt_vbox), checkbutton, FALSE, FALSE, 4);
423 	g_signal_connect (G_OBJECT (checkbutton), "toggled", G_CALLBACK (checkbutton_clicked_cb), &(config.use_system_date_in_notes));
424 	appGUI->opt->cn_use_system_date_checkbutton = checkbutton;
425 }
426 
427 /* ========================================================================== */
428 
429 GtkWidget *
nte_create_preferences_page(GtkWidget * notebook,GUI * appGUI)430 nte_create_preferences_page (GtkWidget *notebook, GUI *appGUI)
431 {
432 	GtkWidget *vbox_top, *vbox_icon, *vbox, *scrolledwindow;
433 
434 	vbox_top = gtk_box_new (GTK_ORIENTATION_VERTICAL, VBOX_SPACING);
435 	gtk_container_set_border_width (GTK_CONTAINER (vbox_top), BORDER_WIDTH);
436 	scrolledwindow = utl_gui_insert_in_scrolled_window (vbox_top, GTK_SHADOW_ETCHED_IN);
437 	gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 2);
438 	vbox_icon = utl_gui_create_icon_with_label (OSMO_STOCK_NOTES, _("Notes"));
439 
440 #ifdef HAVE_LIBGRINGOTTS
441 	vbox = utl_gui_create_vbox_in_frame (vbox_top, _("Encryption"));
442 	create_encryption_section (vbox, appGUI);
443 #endif /* HAVE_LIBGRINGOTTS */
444 
445 	vbox = utl_gui_create_vbox_in_frame (vbox_top, _("Visible columns"));
446 	create_visible_columns_section (vbox, appGUI);
447 
448 	vbox = utl_gui_create_vbox_in_frame (vbox_top, _("Categories"));
449 	create_categories_section (vbox, appGUI);
450 
451 	vbox = utl_gui_create_vbox_in_frame (vbox_top, _("Notes options"));
452 	create_options_section (vbox, appGUI);
453 
454 	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), scrolledwindow, vbox_icon);
455 	gtk_widget_show_all (scrolledwindow);
456 
457 	return scrolledwindow;
458 }
459 
460 /* ========================================================================== */
461 
462 #endif /* NOTES_ENABLED */
463 
464