2006-08-16 [colin] 2.4.0cvs54
[claws.git] / src / plugins / pgpcore / prefs_gpg.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 2004 Hiroyuki Yamamoto & the Sylpheed-Claws team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #include <gtk/gtk.h>
21 #include <glib.h>
22 #include <glib/gi18n.h>
23
24 #include "defs.h"
25 #include "utils.h"
26 #include "prefs.h"
27 #include "prefs_gtk.h"
28 #include "prefs_gpg.h"
29 #include "sgpgme.h"
30
31 struct GPGConfig prefs_gpg;
32
33 static PrefParam param[] = {
34         /* Privacy */
35         {"auto_check_signatures", "FALSE",
36          &prefs_gpg.auto_check_signatures, P_BOOL,
37          NULL, NULL, NULL},
38         {"store_passphrase", "FALSE", &prefs_gpg.store_passphrase, P_BOOL,
39          NULL, NULL, NULL},
40         {"store_passphrase_timeout", "0",
41          &prefs_gpg.store_passphrase_timeout, P_INT,
42          NULL, NULL, NULL},
43         {"passphrase_grab", "FALSE", &prefs_gpg.passphrase_grab, P_BOOL,
44          NULL, NULL, NULL},
45         {"gpg_warning", "TRUE", &prefs_gpg.gpg_warning, P_BOOL,
46          NULL, NULL, NULL},
47         {"gpg_ask_create_key", "TRUE", &prefs_gpg.gpg_ask_create_key, P_BOOL,
48          NULL, NULL, NULL},
49
50         {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
51 };
52
53 struct GPGPage
54 {
55         PrefsPage page;
56
57         GtkWidget *checkbtn_auto_check_signatures;
58         GtkWidget *checkbtn_store_passphrase;  
59         GtkWidget *spinbtn_store_passphrase;  
60         GtkWidget *checkbtn_passphrase_grab;  
61         GtkWidget *checkbtn_gpg_warning;
62 };
63
64 static void prefs_gpg_create_widget_func(PrefsPage *_page,
65                                          GtkWindow *window,
66                                          gpointer data)
67 {
68         struct GPGPage *page = (struct GPGPage *) _page;
69         struct GPGConfig *config;
70
71         GtkWidget *checkbtn_passphrase_grab;
72         GtkWidget *checkbtn_store_passphrase;
73         GtkWidget *checkbtn_auto_check_signatures;
74         GtkWidget *checkbtn_gpg_warning;
75         GtkWidget *hbox1;
76         GtkWidget *vbox1, *vbox2;
77         GtkWidget *label_expire1;
78         GtkObject *spinbtn_store_passphrase_adj;
79         GtkWidget *spinbtn_store_passphrase;
80         GtkWidget *label_expire2;
81         GtkWidget *frame_passphrase;
82         GtkTooltips *tooltips;
83
84         tooltips = gtk_tooltips_new();
85
86         vbox1 = gtk_vbox_new (FALSE, VSPACING);
87         gtk_widget_show (vbox1);
88         gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
89
90         vbox2 = gtk_vbox_new (FALSE, 0);
91         gtk_widget_show (vbox2);
92         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
93
94         PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures,
95                         _("Automatically check signatures"));
96
97         PACK_FRAME(vbox1, frame_passphrase, _("Passphrase"));
98
99         vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
100         gtk_widget_show (vbox2);
101         gtk_container_add (GTK_CONTAINER (frame_passphrase), vbox2);
102         gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
103
104         PACK_CHECK_BUTTON (vbox2, checkbtn_store_passphrase,
105                         _("Store passphrase in memory"));
106
107         hbox1 = gtk_hbox_new (FALSE, 8);
108         gtk_widget_show (hbox1);
109         gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
110
111         label_expire1 = gtk_label_new(_("Expire after"));
112         gtk_widget_show (label_expire1);
113         gtk_box_pack_start (GTK_BOX (hbox1), label_expire1, FALSE, FALSE, 0);
114
115         spinbtn_store_passphrase_adj =
116             gtk_adjustment_new(1, 0, 1440, 1, 10, 10);
117         spinbtn_store_passphrase =
118             gtk_spin_button_new(GTK_ADJUSTMENT
119                                 (spinbtn_store_passphrase_adj), 1, 0);
120         gtk_widget_show(spinbtn_store_passphrase);
121         gtk_box_pack_start(GTK_BOX(hbox1), spinbtn_store_passphrase, FALSE,
122                            FALSE, 0);
123         gtk_widget_set_size_request(spinbtn_store_passphrase, 64, -1);
124         gtk_tooltips_set_tip(tooltips, spinbtn_store_passphrase,
125                              _
126                              ("Setting to '0' will store the passphrase for the whole session"),
127                              NULL);
128         gtk_spin_button_set_numeric(GTK_SPIN_BUTTON
129                                     (spinbtn_store_passphrase), TRUE);
130
131         label_expire2 = gtk_label_new(_("minute(s)"));
132         gtk_widget_show(label_expire2);
133         gtk_box_pack_start(GTK_BOX(hbox1), label_expire2, FALSE, FALSE, 0);
134         gtk_misc_set_alignment(GTK_MISC(label_expire2), 0.0, 0.5);
135
136         SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, label_expire1);
137         SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, spinbtn_store_passphrase);
138         SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, label_expire2);
139
140         PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
141                         _("Grab input while entering a passphrase"));
142
143         vbox2 = gtk_vbox_new (FALSE, 0);
144         gtk_widget_show (vbox2);
145         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
146
147         PACK_CHECK_BUTTON (vbox2, checkbtn_gpg_warning,
148                         _("Display warning on startup if GnuPG doesn't work"));
149
150         config = prefs_gpg_get_config();
151
152         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_auto_check_signatures), config->auto_check_signatures);
153         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_store_passphrase), config->store_passphrase);
154         gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_store_passphrase), (float) config->store_passphrase_timeout);
155         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_passphrase_grab), config->passphrase_grab);
156         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gpg_warning), config->gpg_warning);
157
158         page->checkbtn_auto_check_signatures = checkbtn_auto_check_signatures;
159         page->checkbtn_store_passphrase = checkbtn_store_passphrase;
160         page->spinbtn_store_passphrase = spinbtn_store_passphrase;
161         page->checkbtn_passphrase_grab = checkbtn_passphrase_grab;
162         page->checkbtn_gpg_warning = checkbtn_gpg_warning;
163
164         page->page.widget = vbox1;
165 }
166
167 static void prefs_gpg_destroy_widget_func(PrefsPage *_page)
168 {
169 }
170
171 static void prefs_gpg_save_func(PrefsPage *_page)
172 {
173         struct GPGPage *page = (struct GPGPage *) _page;
174         GPGConfig *config = prefs_gpg_get_config();
175
176         config->auto_check_signatures =
177                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_auto_check_signatures));
178         config->store_passphrase = 
179                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_store_passphrase));
180         config->store_passphrase_timeout = 
181                 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->spinbtn_store_passphrase));
182         config->passphrase_grab = 
183                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_passphrase_grab));
184         config->gpg_warning = 
185                 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_gpg_warning));
186
187         prefs_gpg_save_config();
188 }
189
190 struct GPGAccountPage
191 {
192         PrefsPage page;
193
194         GtkWidget *key_default;
195         GtkWidget *key_by_from;
196         GtkWidget *key_custom;
197         GtkWidget *keyid;
198         GtkWidget *keyid_label;
199         GtkWidget *new_key_label;
200         GtkWidget *new_key_btn;
201         GtkWidget *new_key_box;
202
203         PrefsAccount *account;
204 };
205
206 void key_custom_toggled(GtkToggleButton *togglebutton, gpointer user_data)
207 {
208         struct GPGAccountPage *page = (struct GPGAccountPage *) user_data;
209         gboolean active;
210
211         active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->key_custom));
212         gtk_widget_set_sensitive(GTK_WIDGET(page->keyid_label), active);
213         gtk_widget_set_sensitive(GTK_WIDGET(page->keyid), active);
214         if (!active)
215                 gtk_editable_delete_text(GTK_EDITABLE(page->keyid), 0, -1);
216 }
217
218 static void prefs_gpg_update_sens(struct GPGAccountPage *page)
219 {
220         gboolean active;
221         active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->key_custom));
222         if (sgpgme_has_secret_key()) {
223                 gtk_widget_hide(page->new_key_box);
224                 gtk_widget_set_sensitive(page->key_default, TRUE);
225                 gtk_widget_set_sensitive(page->key_by_from, TRUE);
226                 gtk_widget_set_sensitive(page->key_custom, TRUE);
227                 gtk_widget_set_sensitive(page->keyid, active);
228                 gtk_widget_set_sensitive(page->keyid_label, active);
229         } else {
230                 gtk_widget_show(page->new_key_box);
231                 gtk_widget_set_sensitive(page->key_default, FALSE);
232                 gtk_widget_set_sensitive(page->key_by_from, FALSE);
233                 gtk_widget_set_sensitive(page->key_custom, FALSE);
234                 gtk_widget_set_sensitive(page->keyid, FALSE);
235                 gtk_widget_set_sensitive(page->keyid_label, FALSE);
236         }
237 }
238
239 static void new_key_clicked(GtkWidget *widget, gpointer user_data)
240 {
241         struct GPGAccountPage *page = (struct GPGAccountPage *) user_data;
242         sgpgme_create_secret_key(page->account, FALSE);
243         prefs_gpg_update_sens(page);
244 }
245
246 static void prefs_gpg_account_create_widget_func(PrefsPage *_page,
247                                                  GtkWindow *window,
248                                                  gpointer data)
249 {
250         struct GPGAccountPage *page = (struct GPGAccountPage *) _page;
251         PrefsAccount *account = (PrefsAccount *) data;
252         GPGAccountConfig *config;
253
254         GtkWidget *vbox;
255         GtkWidget *frame1;
256         GtkWidget *vbox2;
257         GtkWidget *hbox;
258         GSList *key_group = NULL;
259         GtkWidget *key_default;
260         GtkWidget *key_by_from;
261         GtkWidget *key_custom;
262         GtkWidget *keyid_label;
263         GtkWidget *keyid;
264         GtkWidget *image;
265         GtkWidget *new_key_label;
266         GtkWidget *new_key_btn;
267         GtkWidget *new_key_box;
268
269         vbox = gtk_vbox_new(FALSE, VSPACING);
270         gtk_container_set_border_width (GTK_CONTAINER (vbox), VBOX_BORDER);
271         gtk_widget_show(vbox);
272
273         PACK_FRAME (vbox, frame1, _("Sign key"));
274
275         vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
276         gtk_container_set_border_width (GTK_CONTAINER (vbox2), VBOX_BORDER);
277         gtk_widget_show (vbox2);
278         gtk_container_add (GTK_CONTAINER (frame1), vbox2);
279
280         hbox = gtk_hbox_new (FALSE, 5);
281         gtk_widget_show (hbox);
282         gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
283         gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
284
285         key_default = gtk_radio_button_new_with_label(key_group,
286                         _("Use default GnuPG key"));
287         key_group = gtk_radio_button_group(GTK_RADIO_BUTTON(key_default));
288         gtk_widget_show(key_default);
289         gtk_box_pack_start(GTK_BOX(hbox), key_default, FALSE, FALSE, 0);
290
291         hbox = gtk_hbox_new (FALSE, 5);
292         gtk_widget_show (hbox);
293         gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
294         gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
295
296         key_by_from = gtk_radio_button_new_with_label(key_group,
297                 _("Select key by your email address"));
298         key_group = gtk_radio_button_group(GTK_RADIO_BUTTON(key_by_from));
299         gtk_widget_show(key_by_from);
300         gtk_box_pack_start(GTK_BOX(hbox), key_by_from, FALSE, FALSE, 0);
301
302         hbox = gtk_hbox_new (FALSE, 5);
303         gtk_widget_show (hbox);
304         gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
305         gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
306
307         key_custom = gtk_radio_button_new_with_label(key_group,
308                 _("Specify key manually"));
309         key_group = gtk_radio_button_group(GTK_RADIO_BUTTON(key_custom));
310         gtk_widget_show(key_custom);
311         gtk_box_pack_start(GTK_BOX(hbox), key_custom, FALSE, FALSE, 0);
312
313         hbox = gtk_hbox_new (FALSE, 5);
314         gtk_widget_show (hbox);
315         gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
316         gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
317
318         keyid_label = gtk_label_new(_("User or key ID:"));
319         gtk_widget_show(keyid_label);
320         gtk_label_set_justify(GTK_LABEL(keyid_label), GTK_JUSTIFY_LEFT);
321         gtk_box_pack_start(GTK_BOX(hbox), keyid_label, FALSE, FALSE, 0);
322
323         keyid = gtk_entry_new();
324         gtk_widget_show(keyid);
325         gtk_box_pack_start(GTK_BOX(hbox), keyid, FALSE, FALSE, 0);
326
327         config = prefs_gpg_account_get_config(account);
328         switch (config->sign_key) {
329         case SIGN_KEY_DEFAULT:
330                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(key_default), TRUE);
331                 gtk_widget_set_sensitive(GTK_WIDGET(keyid_label), FALSE);
332                 gtk_widget_set_sensitive(GTK_WIDGET(keyid), FALSE);
333                 break;
334         case SIGN_KEY_BY_FROM:
335                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(key_by_from), TRUE);
336                 gtk_widget_set_sensitive(GTK_WIDGET(keyid_label), FALSE);
337                 gtk_widget_set_sensitive(GTK_WIDGET(keyid), FALSE);
338                 break;
339         case SIGN_KEY_CUSTOM:
340                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(key_custom), TRUE);
341                 gtk_widget_set_sensitive(GTK_WIDGET(keyid_label), TRUE);
342                 gtk_widget_set_sensitive(GTK_WIDGET(keyid), TRUE);
343                 break;
344         }
345
346         new_key_box = gtk_hbox_new(FALSE, 6);
347         
348         image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_WARNING,
349                         GTK_ICON_SIZE_SMALL_TOOLBAR);
350
351         gtk_box_pack_start(GTK_BOX(new_key_box), image, FALSE, FALSE, 0);
352         new_key_label = gtk_label_new(
353                         _("No secret key found."));
354         gtk_box_pack_start(GTK_BOX(new_key_box), new_key_label, FALSE, FALSE, 0);
355
356         new_key_btn = gtk_button_new_with_label(_("Generate new secret key"));
357
358         gtk_box_pack_start(GTK_BOX(vbox2), new_key_box, FALSE, FALSE, 0);
359
360         hbox = gtk_hbox_new (FALSE, 5);
361         gtk_widget_show (hbox);
362         gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
363         gtk_box_pack_start(GTK_BOX(hbox), new_key_btn, FALSE, FALSE, 0);
364
365         gtk_widget_show_all(new_key_box);
366         gtk_widget_show(new_key_btn);
367
368         if (config->sign_key_id != NULL)
369                 gtk_entry_set_text(GTK_ENTRY(keyid), config->sign_key_id);
370
371         g_signal_connect(G_OBJECT(key_custom), "toggled", G_CALLBACK(key_custom_toggled), page);
372         g_signal_connect(G_OBJECT(new_key_btn), "clicked", G_CALLBACK(new_key_clicked), page);
373
374         page->key_default = key_default;
375         page->key_by_from = key_by_from;
376         page->key_custom = key_custom;
377         page->keyid = keyid;
378         page->keyid_label = keyid_label;
379         page->new_key_box = new_key_box;
380
381         page->page.widget = vbox;
382         page->account = account;
383         prefs_gpg_update_sens(page);
384 }
385
386 static void prefs_gpg_account_destroy_widget_func(PrefsPage *_page)
387 {
388         /* nothing to do here */
389 }
390
391 static void prefs_gpg_account_save_func(PrefsPage *_page)
392 {
393         struct GPGAccountPage *page = (struct GPGAccountPage *) _page;
394         GPGAccountConfig *config;
395
396         config = prefs_gpg_account_get_config(page->account);
397
398         if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->key_default)))
399                 config->sign_key = SIGN_KEY_DEFAULT;
400         else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->key_by_from)))
401                 config->sign_key = SIGN_KEY_BY_FROM;
402         else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->key_custom))) {
403                 config->sign_key = SIGN_KEY_CUSTOM;
404                 g_free(config->sign_key_id);
405                 config->sign_key_id = gtk_editable_get_chars(GTK_EDITABLE(page->keyid), 0, -1);
406         }
407
408         prefs_gpg_account_set_config(page->account, config);
409         prefs_gpg_account_free_config(config);
410 }
411
412 GPGConfig *prefs_gpg_get_config(void)
413 {
414         return &prefs_gpg;
415 }
416
417 void prefs_gpg_save_config(void)
418 {
419         PrefFile *pfile;
420         gchar *rcpath;
421
422         debug_print("Saving GPG config\n");
423
424         rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
425         pfile = prefs_write_open(rcpath);
426         g_free(rcpath);
427         if (!pfile || (prefs_set_block_label(pfile, "GPG") < 0))
428                 return;
429
430         if (prefs_write_param(param, pfile->fp) < 0) {
431                 g_warning("failed to write GPG configuration to file\n");
432                 prefs_file_close_revert(pfile);
433                 return;
434         }
435         fprintf(pfile->fp, "\n");
436
437         prefs_file_close(pfile);
438 }
439
440 struct GPGAccountConfig *prefs_gpg_account_get_config(PrefsAccount *account)
441 {
442         GPGAccountConfig *config;
443         const gchar *confstr;
444         gchar **strv;
445
446         config = g_new0(GPGAccountConfig, 1);
447         config->sign_key = SIGN_KEY_DEFAULT;
448         config->sign_key_id = NULL;
449
450         confstr = prefs_account_get_privacy_prefs(account, "gpg");
451         if (confstr == NULL)
452                 return config;
453
454         strv = g_strsplit(confstr, ";", 0);
455         if (strv[0] != NULL) {
456                 if (!strcmp(strv[0], "DEFAULT"))
457                         config->sign_key = SIGN_KEY_DEFAULT;
458                 if (!strcmp(strv[0], "BY_FROM"))
459                         config->sign_key = SIGN_KEY_BY_FROM;
460                 if (!strcmp(strv[0], "CUSTOM")) {
461                         if (strv[1] != NULL) {
462                                 config->sign_key = SIGN_KEY_CUSTOM;
463                                 config->sign_key_id = g_strdup(strv[1]);
464                         } else
465                                 config->sign_key = SIGN_KEY_DEFAULT;
466                 }
467         }
468         g_strfreev(strv);
469
470         return config;
471 }
472
473 void prefs_gpg_account_set_config(PrefsAccount *account, GPGAccountConfig *config)
474 {
475         gchar *confstr = NULL;
476
477         switch (config->sign_key) {
478         case SIGN_KEY_DEFAULT:
479                 confstr = g_strdup("DEFAULT");
480                 break;
481         case SIGN_KEY_BY_FROM:
482                 confstr = g_strdup("BY_FROM");
483                 break;
484         case SIGN_KEY_CUSTOM:
485                 confstr = g_strdup_printf("CUSTOM;%s", config->sign_key_id);
486                 break;
487         default:
488                 confstr = g_strdup("");
489                 g_warning("prefs_gpg_account_set_config: bad sign_key val\n");
490         }
491
492         prefs_account_set_privacy_prefs(account, "gpg", confstr);
493
494         g_free(confstr);
495 }
496
497 void prefs_gpg_account_free_config(GPGAccountConfig *config)
498 {
499         g_free(config->sign_key_id);
500         g_free(config);
501 }
502
503 static struct GPGPage gpg_page;
504 static struct GPGAccountPage gpg_account_page;
505
506 void prefs_gpg_init()
507 {
508         static gchar *path[3];
509         gchar *rcpath;
510
511         prefs_set_default(param);
512         rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
513         prefs_read_config(param, "GPG", rcpath, NULL);
514         g_free(rcpath);
515
516         path[0] = _("Plugins");
517         path[1] = _("GPG");
518         path[2] = NULL;
519
520         gpg_page.page.path = path;
521         gpg_page.page.create_widget = prefs_gpg_create_widget_func;
522         gpg_page.page.destroy_widget = prefs_gpg_destroy_widget_func;
523         gpg_page.page.save_page = prefs_gpg_save_func;
524         gpg_page.page.weight = 30.0;
525
526         prefs_gtk_register_page((PrefsPage *) &gpg_page);
527
528         gpg_account_page.page.path = path;
529         gpg_account_page.page.create_widget = prefs_gpg_account_create_widget_func;
530         gpg_account_page.page.destroy_widget = prefs_gpg_account_destroy_widget_func;
531         gpg_account_page.page.save_page = prefs_gpg_account_save_func;
532         gpg_account_page.page.weight = 30.0;
533
534         prefs_account_register_page((PrefsPage *) &gpg_account_page);
535 }
536
537 void prefs_gpg_done()
538 {
539         prefs_gtk_unregister_page((PrefsPage *) &gpg_page);
540         prefs_account_unregister_page((PrefsPage *) &gpg_account_page);
541 }