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 public signal void expanded ();
17 public void collapse ()
19 this.hbutton_box.set_visible (false);
24 private bool button_press_cb ()
26 this.hbutton_box.set_visible (!hbutton_box.get_visible ());
30 if (hbutton_box.get_visible () == true)
36 private void set_idcard_color ()
38 var color = Gdk.Color ();
40 if (hbutton_box.get_visible () == false)
52 var state = this.get_state ();
53 this.event_box.modify_bg (state, color);
56 public IdCardWidget ()
60 var icon_theme = IconTheme.get_default ();
63 pixbuf = icon_theme.load_icon ("avatar-default",
65 IconLookupFlags.FORCE_SIZE);
70 stdout.printf("Error: %s\n", e.message);
72 var image = new Image.from_pixbuf (pixbuf);
74 var issuer = Markup.printf_escaped ("<b>%s</b>", "University");
75 var services = Markup.printf_escaped ("<i>%s</i>", "Send Email, Connect to jabber");
76 var text = issuer + "\n" + services;
78 var id_data_label = new Label (null);
79 id_data_label.set_markup (text);
81 this.table = new Table (1, 2, false);
82 table.attach_defaults (image, 0, 1, 0, 1);
83 table.attach_defaults (id_data_label, 1, 2, 0, 1);
85 this.delete_button = new Button.with_label ("Delete");
86 this.details_button = new Button.with_label ("View details");
87 this.send_button = new Button.with_label ("Send");
88 this.hbutton_box = new HButtonBox ();
89 hbutton_box.pack_end (delete_button);
90 hbutton_box.pack_end (details_button);
91 hbutton_box.pack_end (send_button);
93 this.main_vbox = new VBox (false, 12);
94 main_vbox.pack_start (table, true, true, 0);
95 main_vbox.pack_start (hbutton_box, false, false, 0);
96 main_vbox.set_border_width (12);
98 event_box = new EventBox ();
99 event_box.add (main_vbox);
100 event_box.button_press_event.connect (button_press_cb);
101 this.pack_start (event_box, true, true);
104 this.hbutton_box.hide ();