2 * Copyright (c) 2011-2016, JANET(UK)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of JANET(UK) nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 class AddPasswordDialog : Dialog
36 private static Gdk.Color white = make_color(65535, 65535, 65535);
38 private Entry password_entry;
39 private CheckButton remember_checkbutton;
41 public string password {
42 get { return password_entry.get_text(); }
45 public bool remember {
46 get { return remember_checkbutton.get_active(); }
49 public AddPasswordDialog(IdCard id_card, IdentityRequest? request)
51 this.set_title(_("Moonshot - Password"));
55 this.add_buttons(_("Cancel"), ResponseType.CANCEL,
56 _("Connect"), ResponseType.OK);
58 this.set_default_response(ResponseType.OK);
60 var content_area = this.get_content_area();
61 ((Box) content_area).set_spacing(12);
62 set_bg_color(content_area);
64 Label dialog_label = new Label(_("Enter the password for ") + id_card.display_name);
65 dialog_label.set_alignment(0, 0);
67 var nai_label = new Label(_("User (NAI):"));
68 nai_label.set_alignment(0, 1);
69 var nai_value = new Label(id_card.nai);
70 nai_value.set_alignment(0, 0);
72 var password_label = new Label(_("Password:"));
73 password_label.set_alignment(0, (float) 1);
74 this.password_entry = new Entry();
75 password_entry.set_invisible_char('*');
76 password_entry.set_visibility(false);
77 password_entry.activates_default = true;
78 remember_checkbutton = new CheckButton.with_label(_("Remember password"));
80 set_atk_relation(password_label, password_entry, Atk.RelationType.LABEL_FOR);
82 var table = new Table(6, 1, false);
83 AttachOptions opts = AttachOptions.EXPAND | AttachOptions.FILL;
85 table.set_col_spacings(6);
86 table.set_row_spacings(0);
87 table.attach(dialog_label, 0, 1, row, row + 1, opts, opts, 0, 2);
88 // table.attach_defaults(service_value, 1, 2, row, row + 1);
91 VBox nai_vbox = new VBox(false, 0);
92 nai_vbox.pack_start(nai_label, false, false, 0);
93 nai_vbox.pack_start(nai_value, false, false, 0);
94 table.attach(nai_vbox, 0, 1, row, row + 1, opts, opts, 0, 12);
97 VBox password_vbox = new VBox(false, 1);
98 var empty_box2 = new VBox(false, 0);
99 empty_box2.set_size_request(0, 0);
100 password_vbox.pack_start(empty_box2, false, false, 3);
101 password_vbox.pack_start(password_label, false, false, 0);
102 password_vbox.pack_start(password_entry, false, false, 0);
103 table.attach(password_vbox, 0, 1, row, row + 1, opts, opts, 0, 0);
106 table.attach(remember_checkbutton, 0, 1, row, row + 1, opts, opts, 20, 2);
109 var empty_box3 = new VBox(false, 0);
110 empty_box3.set_size_request(0, 0);
111 table.attach(empty_box3, 0, 1, row, row + 1, opts, opts, 0, 10);
114 var vbox = new VBox(false, 0);
115 vbox.set_border_width(6);
116 vbox.pack_start(table, false, false, 0);
118 ((Container) content_area).add(vbox);
120 this.set_border_width(6);
121 //this.set_resizable(false);