Fix service removal bug
authorAlberto Ruiz <aruiz@gnome.org>
Wed, 13 Jul 2011 13:11:25 +0000 (14:11 +0100)
committerAlberto Ruiz <aruiz@gnome.org>
Mon, 18 Jul 2011 16:12:54 +0000 (17:12 +0100)
src/moonshot-idcard-widget.vala
src/moonshot-window.vala

index 4c8cfc5..fcfd45b 100644 (file)
@@ -11,6 +11,8 @@ class IdCardWidget : Box
     public Button send_button { get; private set; default = null; }
     private HButtonBox hbutton_box;
     private EventBox event_box;
+    
+    private Label label;
 
     public signal void expanded ();
     public signal void remove_id ();
@@ -70,16 +72,12 @@ class IdCardWidget : Box
         var state = this.get_state ();
         this.event_box.modify_bg (state, color);
     }
-
-    public IdCardWidget (IdCard id_card)
+    
+    public void
+    update_id_card_label ()
     {
         string services_text = "";
-        this.id_card = id_card;
-
-        var image = new Image.from_pixbuf (id_card.pixbuf);
-
         var display_name = Markup.printf_escaped ("<b>%s</b>", this.id_card.display_name);
-        
         for (int i=0; i<id_card.services.length; i++)
         {
             var service = id_card.services[i];
@@ -89,16 +87,23 @@ class IdCardWidget : Box
             else
               services_text = services_text + Markup.printf_escaped ("<i>%s, </i>", service);
         }
-        var text = display_name + "\n" + services_text;
+        label.set_markup (display_name + "\n" + services_text);
+    }
+
+    public IdCardWidget (IdCard id_card)
+    {
+        this.id_card = id_card;
+
+        var image = new Image.from_pixbuf (id_card.pixbuf);
 
-        var id_data_label = new Label (null);
-        id_data_label.set_markup (text);
-        id_data_label.set_alignment ((float) 0, (float) 0.5);
-        id_data_label.set_ellipsize (Pango.EllipsizeMode.END);
+        label = new Label (null);
+        label.set_alignment ((float) 0, (float) 0.5);
+        label.set_ellipsize (Pango.EllipsizeMode.END);
+        update_id_card_label();
 
         table = new Gtk.HBox (false, 6);
         table.pack_start (image, false, false, 0);
-        table.pack_start (id_data_label, true, true, 0);
+        table.pack_start (label, true, true, 0);
 
         this.delete_button = new Button.with_label (_("Delete"));
         this.details_button = new Button.with_label (_("View details"));
index 40a4987..bf7ae19 100644 (file)
@@ -105,7 +105,7 @@ class MainWindow : Window
 
     private void search_entry_icon_press_cb (EntryIconPosition pos, Gdk.Event event)
     {
-       if (pos == EntryIconPosition.PRIMARY)
+        if (pos == EntryIconPosition.PRIMARY)
         {
             print ("Search entry icon pressed\n");
         }
@@ -508,7 +508,7 @@ class MainWindow : Window
                   hbox.destroy();
                 
                 fill_services_vbox (id_card);
-                
+                custom_vbox.current_idcard.update_id_card_label ();
               }
               
             });
@@ -726,7 +726,7 @@ SUCH DAMAGE.
         vbox_right.pack_start (services_vbox, false, true, 0);
 
         var hbox = new HBox (false, 12);
-        hbox.pack_start (vbox_left, false, false, 0);
+        hbox.pack_start (vbox_left, true, true, 0);
         hbox.pack_start (vbox_right, false, false, 0);
 
         var main_vbox = new VBox (false, 0);