Use AC_INIT to set the project web page
[moonshot-ui.git] / src / moonshot-identity-management-view.vala
index b0e1db2..f5b9109 100644 (file)
@@ -5,6 +5,9 @@ class IdentityManagerView : Window {
     private const int WINDOW_WIDTH = 400;
     private const int WINDOW_HEIGHT = 500;
     protected IdentityManagerApp parent_app;
+#if OS_MACOS
+       public OSXApplication osxApp;
+#endif
     private UIManager ui_manager = new UIManager();
     private Entry search_entry;
     private VBox vbox_right;
@@ -50,15 +53,21 @@ class IdentityManagerView : Window {
 
     public IdentityManagerView(IdentityManagerApp app) {
        parent_app = app;
-       identities_manager = parent_app.model;
+#if OS_MACOS
+               osxApp = OSXApplication.get_instance();
+#endif
+          identities_manager = parent_app.model;
        request_queue = new GLib.Queue<IdentityRequest>();
        service_button_map = new HashTable<Gtk.Button, string> (direct_hash, direct_equal);
        this.title = "Moonshoot";
        this.set_position (WindowPosition.CENTER);
        set_default_size (WINDOW_WIDTH, WINDOW_HEIGHT);
        build_ui();
-       setup_list_model();
+       setup_list_model(); 
         load_id_cards(); 
+#if OS_MACOS
+               osxApp = app.osxApp;
+#endif
        connect_signals();
     }
     
@@ -415,7 +424,7 @@ class IdentityManagerView : Window {
 
         var dialog = new MessageDialog (null,
                                         DialogFlags.DESTROY_WITH_PARENT,
-                                        MessageType.INFO,
+                                        MessageType.QUESTION,
                                         Gtk.ButtonsType.YES_NO,
                                         _("Are you sure you want to delete %s ID Card?"), id_card.issuer);
         var result = dialog.run ();
@@ -587,7 +596,7 @@ class IdentityManagerView : Window {
 
             identity.services = services;
 
-//            identities_manager.store_id_cards();
+            identities_manager.update_card (identity);
         }
 
         if (identity.password == null)
@@ -609,7 +618,7 @@ class IdentityManagerView : Window {
         }
 
         if (this.request_queue.is_empty())
-            this.hide ();
+            Gtk.main_quit ();
 
         if (identity != null)
             this.default_id_card = identity;
@@ -667,8 +676,9 @@ class IdentityManagerView : Window {
                                       Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                       Gtk.MessageType.QUESTION,
                                       Gtk.ButtonsType.YES_NO,
-                                      _("Are you sure you want to stop '%s' ID Card to use %s?"),
-                                      custom_vbox.current_idcard.id_card.display_name);
+                                      _("Are you sure you want to stop '%s' ID Card from being used with %s?"),
+                                      custom_vbox.current_idcard.id_card.display_name,
+                                      _("this service"));
               var ret = dialog.run();
               dialog.hide();
               
@@ -719,7 +729,7 @@ class IdentityManagerView : Window {
 
         string copyright = "Copyright 2011 JANET";
 
-        string license =
+        const string license =
 """
 Copyright (c) 2011, JANET(UK)
 All rights reserved.
@@ -755,7 +765,8 @@ SUCH DAMAGE.
         Gtk.show_about_dialog (this,
             "comments", _("Moonshot project UI"),
             "copyright", copyright,
-            "website", "http://www.project-moonshot.org/",
+            "website", Config.PACKAGE_URL,
+            "version", Config.PACKAGE_VERSION,
             "license", license,
             "website-label", _("Visit the Moonshot project web site"),
             "authors", authors,
@@ -840,13 +851,15 @@ SUCH DAMAGE.
 
         set_atk_name_description (search_entry, _("Search entry"), _("Search for a specific ID Card"));
         this.search_entry.set_icon_from_pixbuf (EntryIconPosition.PRIMARY,
-                                                find_icon_sized ("edit-find-symbolic", Gtk.IconSize.MENU));
+                                                find_icon_sized ("edit-find", Gtk.IconSize.MENU));
+//                                                find_icon_sized ("edit-find-symbolic", Gtk.IconSize.MENU));
         this.search_entry.set_icon_tooltip_text (EntryIconPosition.PRIMARY,
                                                  _("Search identity or service"));
         this.search_entry.set_icon_sensitive (EntryIconPosition.PRIMARY, false);
 
         this.search_entry.set_icon_from_pixbuf (EntryIconPosition.SECONDARY,
-                                                find_icon_sized ("edit-clear-symbolic", Gtk.IconSize.MENU));
+                                                find_icon_sized ("process-stop", Gtk.IconSize.MENU));
+//                                                find_icon_sized ("edit-clear-symbolic", Gtk.IconSize.MENU));
         this.search_entry.set_icon_tooltip_text (EntryIconPosition.SECONDARY,
                                                  _("Clear the current search"));
         this.search_entry.set_icon_sensitive (EntryIconPosition.SECONDARY, false);
@@ -920,14 +933,26 @@ SUCH DAMAGE.
 
         var main_vbox = new VBox (false, 0);
         main_vbox.set_border_width (12);
+#if OS_MACOS
+        // hide the  File | Quit menu item which is now on the Mac Menu
+        Gtk.Widget quit_item =  this.ui_manager.get_widget("/MenuBar/FileMenu/Quit");
+        quit_item.hide();
+        
+               Gtk.MenuShell menushell = this.ui_manager.get_widget("/MenuBar") as Gtk.MenuShell;
+               osxApp.set_menu_bar(menushell);
+               osxApp.set_use_quartz_accelerators(true);
+               osxApp.sync_menu_bar();
+               osxApp.ready(); 
+#else
         var menubar = this.ui_manager.get_widget ("/MenuBar");
         main_vbox.pack_start (menubar, false, false, 0);
+#endif
         main_vbox.pack_start (hbox, true, true, 0);
         add (main_vbox);
-
         main_vbox.show_all();
         this.vbox_right.hide ();
-    }
+  } 
 
     private void set_atk_name_description (Widget widget, string name, string description)
     {