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