3 class IdCardWidget : Box
5 public IdCard id_card { get; set; default = null; }
7 private VBox main_vbox;
9 public Button delete_button { get; private set; default = null; }
10 public Button details_button { get; private set; default = null; }
11 public Button send_button { get; private set; default = null; }
12 private HButtonBox hbutton_box;
13 private EventBox event_box;
15 private bool button_press_cb ()
17 this.hbutton_box.set_visible (!hbutton_box.get_visible ());
24 private void set_idcard_color ()
26 var color = Gdk.Color ();
28 if (hbutton_box.get_visible () == false)
40 var state = this.get_state ();
41 this.event_box.modify_bg (state, color);
44 public IdCardWidget ()
48 var icon_theme = IconTheme.get_default ();
51 pixbuf = icon_theme.load_icon ("avatar-default",
53 IconLookupFlags.FORCE_SIZE);
58 stdout.printf("Error: %s\n", e.message);
60 var image = new Image.from_pixbuf (pixbuf);
62 var issuer = Markup.printf_escaped ("<b>%s</b>", "University");
63 var services = Markup.printf_escaped ("<i>%s</i>", "Send Email, Connect to jabber");
64 var text = issuer + "\n" + services;
66 var id_data_label = new Label (null);
67 id_data_label.set_markup (text);
69 this.table = new Table (1, 2, false);
70 table.attach_defaults (image, 0, 1, 0, 1);
71 table.attach_defaults (id_data_label, 1, 2, 0, 1);
73 this.delete_button = new Button.with_label ("Delete");
74 this.details_button = new Button.with_label ("View details");
75 this.send_button = new Button.with_label ("Send");
76 this.hbutton_box = new HButtonBox ();
77 hbutton_box.pack_end (delete_button);
78 hbutton_box.pack_end (details_button);
79 hbutton_box.pack_end (send_button);
81 this.main_vbox = new VBox (false, 12);
82 main_vbox.pack_start (table, true, true, 0);
83 main_vbox.pack_start (hbutton_box, false, false, 0);
84 main_vbox.set_border_width (12);
86 event_box = new EventBox ();
87 event_box.add (main_vbox);
88 event_box.button_press_event.connect (button_press_cb);
89 this.pack_start (event_box, true, true);
92 this.hbutton_box.hide ();