2005-12-06 [paul] 1.9.100cvs69
[claws.git] / src / plugins / pgpcore / prefs_gpg.c
index a0d5ab18309d9a5be55d2c9c60302fc5b0ea8b28..e6d151fd1791044c1dfb5293f289e27fdbe41602 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #include <gtk/gtk.h>
@@ -31,7 +31,7 @@ struct GPGConfig prefs_gpg;
 
 static PrefParam param[] = {
        /* Privacy */
-       {"auto_check_signatures", "TRUE",
+       {"auto_check_signatures", "FALSE",
         &prefs_gpg.auto_check_signatures, P_BOOL,
         NULL, NULL, NULL},
        {"store_passphrase", "FALSE", &prefs_gpg.store_passphrase, P_BOOL,
@@ -65,100 +65,49 @@ static void prefs_gpg_create_widget_func(PrefsPage *_page,
        struct GPGPage *page = (struct GPGPage *) _page;
        struct GPGConfig *config;
 
-        /*
-         * BEGIN GLADE CODE 
-         * DO NOT EDIT 
-         */
-       GtkWidget *table;
        GtkWidget *checkbtn_passphrase_grab;
        GtkWidget *checkbtn_store_passphrase;
        GtkWidget *checkbtn_auto_check_signatures;
        GtkWidget *checkbtn_gpg_warning;
-       GtkWidget *label7;
-       GtkWidget *label6;
-       GtkWidget *label9;
-       GtkWidget *label10;
        GtkWidget *hbox1;
-       GtkWidget *label11;
+       GtkWidget *vbox1, *vbox2;
+       GtkWidget *label_expire1;
        GtkObject *spinbtn_store_passphrase_adj;
        GtkWidget *spinbtn_store_passphrase;
-       GtkWidget *label12;
+       GtkWidget *label_expire2;
+       GtkWidget *frame_passphrase;
        GtkTooltips *tooltips;
 
        tooltips = gtk_tooltips_new();
 
-       table = gtk_table_new(5, 2, FALSE);
-       gtk_widget_show(table);
-       gtk_container_set_border_width(GTK_CONTAINER(table), 8);
-       gtk_table_set_row_spacings(GTK_TABLE(table), 4);
-       gtk_table_set_col_spacings(GTK_TABLE(table), 8);
-
-       checkbtn_passphrase_grab = gtk_check_button_new_with_label("");
-       gtk_widget_show(checkbtn_passphrase_grab);
-       gtk_table_attach(GTK_TABLE(table), checkbtn_passphrase_grab, 0, 1,
-                        3, 4, (GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-
-       checkbtn_store_passphrase = gtk_check_button_new_with_label("");
-       gtk_widget_show(checkbtn_store_passphrase);
-       gtk_table_attach(GTK_TABLE(table), checkbtn_store_passphrase, 0, 1,
-                        1, 2, (GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-
-       checkbtn_auto_check_signatures =
-           gtk_check_button_new_with_label("");
-       gtk_widget_show(checkbtn_auto_check_signatures);
-       gtk_table_attach(GTK_TABLE(table), checkbtn_auto_check_signatures,
-                        0, 1, 0, 1,
-                        (GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-
-       checkbtn_gpg_warning = gtk_check_button_new_with_label("");
-       gtk_widget_show(checkbtn_gpg_warning);
-       gtk_table_attach(GTK_TABLE(table), checkbtn_gpg_warning, 0, 1, 4,
-                        5, (GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-
-       label7 = gtk_label_new(_("Store passphrase in memory"));
-       gtk_widget_show(label7);
-       gtk_table_attach(GTK_TABLE(table), label7, 1, 2, 1, 2,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label7), 0, 0.5);
+       vbox1 = gtk_vbox_new (FALSE, VSPACING);
+       gtk_widget_show (vbox1);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
-       label6 = gtk_label_new(_("Automatically check signatures"));
-       gtk_widget_show(label6);
-       gtk_table_attach(GTK_TABLE(table), label6, 1, 2, 0, 1,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label6), 0, 0.5);
+       vbox2 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox2);
+       gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
 
-       label9 =
-           gtk_label_new(_("Grab input while entering a passphrase"));
-       gtk_widget_show(label9);
-       gtk_table_attach(GTK_TABLE(table), label9, 1, 2, 3, 4,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label9), 0, 0.5);
-
-       label10 =
-           gtk_label_new(_
-                         ("Display warning on startup if GnuPG doesn't work"));
-       gtk_widget_show(label10);
-       gtk_table_attach(GTK_TABLE(table), label10, 1, 2, 4, 5,
-                        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
-       gtk_misc_set_alignment(GTK_MISC(label10), 0, 0.5);
+       PACK_CHECK_BUTTON (vbox2, checkbtn_auto_check_signatures,
+                       _("Automatically check signatures"));
+
+       PACK_FRAME(vbox1, frame_passphrase, _("Passphrase"));
+
+       vbox2 = gtk_vbox_new (FALSE, VSPACING_NARROW);
+       gtk_widget_show (vbox2);
+       gtk_container_add (GTK_CONTAINER (frame_passphrase), vbox2);
+       gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8);
 
-       hbox1 = gtk_hbox_new(FALSE, 8);
-       gtk_widget_show(hbox1);
-       gtk_table_attach(GTK_TABLE(table), hbox1, 1, 2, 2, 3,
-                        (GtkAttachOptions) (GTK_SHRINK | GTK_FILL),
-                        (GtkAttachOptions) (GTK_SHRINK), 0, 0);
+       PACK_CHECK_BUTTON (vbox2, checkbtn_store_passphrase,
+                       _("Store passphrase in memory"));
 
-       label11 = gtk_label_new(_("Expire after"));
-       gtk_widget_show(label11);
-       gtk_box_pack_start(GTK_BOX(hbox1), label11, FALSE, FALSE, 0);
+       hbox1 = gtk_hbox_new (FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
+
+       label_expire1 = gtk_label_new(_("Expire after"));
+       gtk_widget_show (label_expire1);
+       gtk_box_pack_start (GTK_BOX (hbox1), label_expire1, FALSE, FALSE, 0);
 
        spinbtn_store_passphrase_adj =
            gtk_adjustment_new(1, 0, 1440, 1, 10, 10);
@@ -168,7 +117,7 @@ static void prefs_gpg_create_widget_func(PrefsPage *_page,
        gtk_widget_show(spinbtn_store_passphrase);
        gtk_box_pack_start(GTK_BOX(hbox1), spinbtn_store_passphrase, FALSE,
                           FALSE, 0);
-       gtk_widget_set_size_request(spinbtn_store_passphrase, 64, -2);
+       gtk_widget_set_size_request(spinbtn_store_passphrase, 64, -1);
        gtk_tooltips_set_tip(tooltips, spinbtn_store_passphrase,
                             _
                             ("Setting to '0' will store the passphrase for the whole session"),
@@ -176,13 +125,24 @@ static void prefs_gpg_create_widget_func(PrefsPage *_page,
        gtk_spin_button_set_numeric(GTK_SPIN_BUTTON
                                    (spinbtn_store_passphrase), TRUE);
 
-       label12 = gtk_label_new(_("minute(s)"));
-       gtk_widget_show(label12);
-       gtk_box_pack_start(GTK_BOX(hbox1), label12, TRUE, TRUE, 0);
-       gtk_misc_set_alignment(GTK_MISC(label12), 0.0, 0.5);
-        /* 
-         * END GLADE CODE
-         */
+       label_expire2 = gtk_label_new(_("minute(s)"));
+       gtk_widget_show(label_expire2);
+       gtk_box_pack_start(GTK_BOX(hbox1), label_expire2, FALSE, FALSE, 0);
+       gtk_misc_set_alignment(GTK_MISC(label_expire2), 0.0, 0.5);
+
+       SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, label_expire1);
+       SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, spinbtn_store_passphrase);
+       SET_TOGGLE_SENSITIVITY (checkbtn_store_passphrase, label_expire2);
+
+       PACK_CHECK_BUTTON (vbox2, checkbtn_passphrase_grab,
+                       _("Grab input while entering a passphrase"));
+
+       vbox2 = gtk_vbox_new (FALSE, 0);
+       gtk_widget_show (vbox2);
+       gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
+
+       PACK_CHECK_BUTTON (vbox2, checkbtn_gpg_warning,
+                       _("Display warning on startup if GnuPG doesn't work"));
 
        config = prefs_gpg_get_config();
 
@@ -198,7 +158,7 @@ static void prefs_gpg_create_widget_func(PrefsPage *_page,
        page->checkbtn_passphrase_grab = checkbtn_passphrase_grab;
        page->checkbtn_gpg_warning = checkbtn_gpg_warning;
 
-       page->page.widget = table;
+       page->page.widget = vbox1;
 }
 
 static void prefs_gpg_destroy_widget_func(PrefsPage *_page)