fix dbus-glib: mangle show_ui->ShowUi
[moonshot-ui.git] / src / moonshot-custom-vbox.vala
index 3afadcb..3fb96ff 100644 (file)
@@ -2,14 +2,37 @@ using Gtk;
 
 class CustomVBox : VBox
 {
-    public CustomVBox (bool homogeneous, int spacing)
+    public IdCardWidget current_idcard { get; set; default = null; }
+    private IdentityManagerView main_window; 
+
+    public CustomVBox (IdentityManagerView window, bool homogeneous, int spacing)
+    {
+        main_window = window;
+        set_homogeneous (homogeneous);
+        set_spacing (spacing);
+    }
+
+    public void receive_expanded_event (IdCardWidget id_card_widget)
+    {
+        var list = get_children ();
+        foreach (Widget id_card in list)
+        {
+            if (id_card != id_card_widget)
+                ((IdCardWidget) id_card).collapse ();
+        }
+        current_idcard = id_card_widget;
+        
+        if (current_idcard != null && main_window.request_queue.length > 0)
+            current_idcard.send_button.set_sensitive (true);
+    }
+
+    public void add_id_card_widget (IdCardWidget id_card_widget)
     {
-        this.set_homogeneous (homogeneous);
-        this.set_spacing (spacing);
+        pack_start (id_card_widget, false, false);
     }
 
-    public void receive_expanded_event ()
+    public void remove_id_card_widget (IdCardWidget id_card_widget)
     {
-        var id_cards = this.get_children ();
+        remove (id_card_widget);
     }
 }