[webp] Added confirmation dialog
authorAlberto Ruiz <aruiz@gnome.org>
Thu, 7 Jul 2011 16:49:25 +0000 (17:49 +0100)
committerAlberto Ruiz <aruiz@gnome.org>
Thu, 7 Jul 2011 16:49:25 +0000 (17:49 +0100)
Makefile.am
po/POTFILES.in
src/moonshot-server.vala
src/moonshot-webp-dialog.vala [new file with mode: 0644]

index e7e930c..c3f5807 100644 (file)
@@ -42,7 +42,8 @@ src_moonshot_SOURCES = \
         src/moonshot-server.vala \
         src/moonshot-window.vala \
         src/moonshot-password-dialog.vala \
-        src/moonshot-utils.vala
+        src/moonshot-utils.vala \
+        src/moonshot-webp-dialog.vala
 
 src_moonshot_LDADD = \
         $(moonshot_LIBS)
index 651b08b..77dd93b 100644 (file)
@@ -1,2 +1,3 @@
 # List of source files which contain translatable strings.
 src/moonshot-window.vala
+src/moonshot-webp-dialog.vala
index c7de581..0a056db 100644 (file)
@@ -112,15 +112,24 @@ public class MoonshotServer : Object {
       idcard.trust_anchor.subject = subject;
       idcard.trust_anchor.subject_alt = subject_alt;
       idcard.trust_anchor.server_cert = server_cert;
-      /* TODO: Ask for confirmation */
+
       /* TODO: Check if display name already exists */
       
       idcard.pixbuf = find_icon ("avatar-default", 48);
+
+      /* TODO: Act on close */      
+      var dialog = new WebProvisioning.ConfirmDialog (idcard);
+      dialog.show_all ();
+      var ret = dialog.run ();
+      dialog.hide ();
+
+      if (ret == Gtk.ResponseType.ACCEPT)      
+      {
+        main_window.insert_id_card (idcard);
+        return true;
+      }
       
-      main_window.insert_id_card (idcard);
-      
-      debug ("%s", idcard.nai);
-      return true;
+      return false;
     }
                                        
 }
diff --git a/src/moonshot-webp-dialog.vala b/src/moonshot-webp-dialog.vala
new file mode 100644 (file)
index 0000000..d0bdade
--- /dev/null
@@ -0,0 +1,17 @@
+namespace WebProvisioning
+{
+
+  class ConfirmDialog: Gtk.Dialog
+  {
+    public ConfirmDialog (IdCard id_card)
+    {
+      add_button (_("Add"), Gtk.ResponseType.ACCEPT);
+      add_button (_("Don't add"), Gtk.ResponseType.REJECT);
+      
+      Gtk.VBox vbox = (Gtk.VBox)get_child();
+      var label = new Gtk.Label("");
+      label.set_markup ("<b>" + _("Would you like to add '") + id_card.display_name + _("' ID Card to the ID Card Organizer?") + "</b>");
+      vbox.add (label);
+    }
+  } 
+}