3fb96ffe0bc9bf9283641c1e95e30a45ea013286
[moonshot-ui.git] / src / moonshot-custom-vbox.vala
1 using Gtk;
2
3 class CustomVBox : VBox
4 {
5     public IdCardWidget current_idcard { get; set; default = null; }
6     private IdentityManagerView main_window; 
7
8     public CustomVBox (IdentityManagerView window, bool homogeneous, int spacing)
9     {
10         main_window = window;
11         set_homogeneous (homogeneous);
12         set_spacing (spacing);
13     }
14
15     public void receive_expanded_event (IdCardWidget id_card_widget)
16     {
17         var list = get_children ();
18         foreach (Widget id_card in list)
19         {
20             if (id_card != id_card_widget)
21                 ((IdCardWidget) id_card).collapse ();
22         }
23         current_idcard = id_card_widget;
24         
25         if (current_idcard != null && main_window.request_queue.length > 0)
26             current_idcard.send_button.set_sensitive (true);
27     }
28
29     public void add_id_card_widget (IdCardWidget id_card_widget)
30     {
31         pack_start (id_card_widget, false, false);
32     }
33
34     public void remove_id_card_widget (IdCardWidget id_card_widget)
35     {
36         remove (id_card_widget);
37     }
38 }