3 class IdCardWidget : Box
5 private VBox main_vbox;
7 public Button delete_button { get; private set; default = null; }
8 public Button details_button { get; private set; default = null; }
9 public Button send_button { get; private set; default = null; }
10 private HButtonBox hbutton_box;
12 private bool button_press_cb ()
14 this.hbutton_box.set_visible (!hbutton_box.get_visible ());
19 public IdCardWidget ()
23 var icon_theme = IconTheme.get_default ();
26 pixbuf = icon_theme.load_icon ("avatar-default",
28 IconLookupFlags.FORCE_SIZE);
33 stdout.printf("Error: %s\n", e.message);
35 var image = new Image.from_pixbuf (pixbuf);
37 var issuer = Markup.printf_escaped ("<b>%s</b>", "University");
38 var services = Markup.printf_escaped ("<i>%s</i>", "Send Email, Connect to jabber");
39 var text = issuer + "\n" + services;
41 var id_data_label = new Label (null);
42 id_data_label.set_markup (text);
44 this.table = new Table (1, 2, false);
45 table.attach_defaults (image, 0, 1, 0, 1);
46 table.attach_defaults (id_data_label, 1, 2, 0, 1);
48 this.delete_button = new Button.with_label ("Delete");
49 this.details_button = new Button.with_label ("View details");
50 this.send_button = new Button.with_label ("Send");
51 this.hbutton_box = new HButtonBox ();
52 hbutton_box.pack_end (delete_button);
53 hbutton_box.pack_end (details_button);
54 hbutton_box.pack_end (send_button);
56 this.main_vbox = new VBox (false, 12);
57 main_vbox.pack_start (table, true, true, 0);
58 main_vbox.pack_start (hbutton_box, false, false, 0);
59 main_vbox.set_border_width (12);
61 var event_box = new EventBox ();
62 event_box.add (main_vbox);
63 event_box.button_press_event.connect (button_press_cb);
67 this.hbutton_box.hide ();