Signal parent widgets when expanding identity (LP 1228259)
[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         check_resize();
28     }
29
30     public void add_id_card_widget (IdCardWidget id_card_widget)
31     {
32         pack_start (id_card_widget, false, false);
33     }
34
35     public void remove_id_card_widget (IdCardWidget id_card_widget)
36     {
37         remove (id_card_widget);
38     }
39 }