3 class IdCardWidget : Box
5 private VBox main_vbox;
7 private HButtonBox hbutton_box;
9 private bool button_press_cb ()
11 this.hbutton_box.set_visible (!hbutton_box.get_visible ());
16 public IdCardWidget ()
20 var icon_theme = IconTheme.get_default ();
23 pixbuf = icon_theme.load_icon ("avatar-default",
25 IconLookupFlags.FORCE_SIZE);
30 stdout.printf("Error: %s\n", e.message);
32 var image = new Image.from_pixbuf (pixbuf);
34 var issuer = Markup.printf_escaped ("<b>%s</b>", "University");
35 var services = Markup.printf_escaped ("<i>%s</i>", "Send Email, Connect to jabber");
36 var text = issuer + "\n" + services;
38 var id_data_label = new Label (null);
39 id_data_label.set_markup (text);
41 this.table = new Table (1, 2, false);
42 table.attach_defaults (image, 0, 1, 0, 1);
43 table.attach_defaults (id_data_label, 1, 2, 0, 1);
45 var delete_button = new Button.with_label ("Delete");
46 var details_button = new Button.with_label ("View details");
47 var send_button = new Button.with_label ("Send");
48 this.hbutton_box = new HButtonBox ();
49 hbutton_box.pack_end (delete_button);
50 hbutton_box.pack_end (details_button);
51 hbutton_box.pack_end (send_button);
53 this.main_vbox = new VBox (false, 12);
54 main_vbox.pack_start (table, true, true, 0);
55 main_vbox.pack_start (hbutton_box, false, false, 0);
56 main_vbox.set_border_width (12);
58 var event_box = new EventBox ();
59 event_box.add (main_vbox);
60 event_box.button_press_event.connect (button_press_cb);
63 event_box.show_all ();
64 this.hbutton_box.hide ();