3 class AddPasswordDialog : Dialog
5 private Entry password_entry;
6 private CheckButton remember_checkbutton;
8 public string password {
9 get { return password_entry.get_text (); }
12 public bool remember {
13 get { return remember_checkbutton.get_active (); }
16 public AddPasswordDialog ()
18 this.set_title (_("Please enter your password"));
19 this.set_modal (true);
21 this.add_buttons (_("Send"), ResponseType.OK,
22 _("Return to application"), ResponseType.CANCEL);
23 this.set_default_response (ResponseType.OK);
25 var content_area = this.get_content_area ();
26 ((Box) content_area).set_spacing (12);
28 var password_label = new Label (_("Password:"));
29 password_label.set_alignment (1, (float) 0.5);
30 this.password_entry = new Entry ();
31 password_entry.set_invisible_char ('*');
32 password_entry.set_visibility (false);
33 password_entry.activates_default = true;
34 remember_checkbutton = new CheckButton.with_label (_("Remember password"));
36 set_atk_relation (password_entry, password_entry, Atk.RelationType.LABEL_FOR);
38 var table = new Table (2, 2, false);
39 table.set_col_spacings (10);
40 table.set_row_spacings (10);
41 table.attach_defaults (password_label, 0, 1, 2, 3);
42 table.attach_defaults (password_entry, 1, 2, 2, 3);
43 table.attach_defaults (remember_checkbutton, 1, 2, 3, 4);
45 var vbox = new VBox (false, 0);
46 vbox.set_border_width (6);
47 vbox.pack_start (table, false, false, 0);
49 ((Container) content_area).add (vbox);
51 this.set_border_width (6);
52 this.set_resizable (false);
56 private void set_atk_relation (Widget widget, Widget target_widget, Atk.RelationType relationship)
58 var atk_widget = widget.get_accessible ();
59 var atk_target_widget = target_widget.get_accessible ();
61 atk_widget.add_relationship (relationship, atk_target_widget);