Store the logo in the ID Card
[moonshot-ui.git] / src / moonshot-idcard-widget.vala
index ff73f42..69345d5 100644 (file)
@@ -13,6 +13,8 @@ class IdCardWidget : Box
     private EventBox event_box;
 
     public signal void expanded ();
+    public signal void remove_id ();
+    public signal void details_id ();
 
     public void collapse ()
     {
@@ -33,6 +35,16 @@ class IdCardWidget : Box
         return false;
     }
 
+    private void delete_button_cb ()
+    {
+       this.remove_id ();
+    }
+
+    private void details_button_cb ()
+    {
+       this.details_id ();
+    }
+
     private void set_idcard_color ()
     {
         var color = Gdk.Color ();
@@ -53,25 +65,13 @@ class IdCardWidget : Box
         this.event_box.modify_bg (state, color);
     }
 
-    public IdCardWidget ()
+    public IdCardWidget (IdCard id_card)
     {
-        Gdk.Pixbuf pixbuf;
+        this.id_card = id_card;
 
-        var icon_theme = IconTheme.get_default ();
-        try
-        {
-            pixbuf = icon_theme.load_icon ("avatar-default",
-                                           48,
-                                           IconLookupFlags.FORCE_SIZE);
-        }
-        catch (Error e)
-        {
-            pixbuf = null;
-            stdout.printf("Error: %s\n", e.message);
-        }
-        var image = new Image.from_pixbuf (pixbuf);
+        var image = new Image.from_pixbuf (id_card.pixbuf);
 
-        var issuer = Markup.printf_escaped ("<b>%s</b>", "University");
+        var issuer = Markup.printf_escaped ("<b>%s</b>", this.id_card.issuer);
         var services = Markup.printf_escaped ("<i>%s</i>", "Send Email, Connect to jabber");
         var text = issuer + "\n" + services;
 
@@ -90,6 +90,9 @@ class IdCardWidget : Box
         hbutton_box.pack_end (details_button);
         hbutton_box.pack_end (send_button);
 
+        delete_button.clicked.connect (delete_button_cb);
+        details_button.clicked.connect (details_button_cb);
+
         this.main_vbox = new VBox (false, 12);
         main_vbox.pack_start (table, true, true, 0);
         main_vbox.pack_start (hbutton_box, false, false, 0);