Fixed S598 [bug] 911172 - File Association
authorPete Fotheringham <pete.fotheringham@codethink.co.uk>
Wed, 1 Feb 2012 14:35:30 +0000 (14:35 +0000)
committerPete Fotheringham <pete.fotheringham@codethink.co.uk>
Wed, 1 Feb 2012 14:35:30 +0000 (14:35 +0000)
Now works, but with crash on exit

Makefile.am
src/moonshot-identity-manager-app.vala
src/moonshot-server.vala
vapi/gtk-mac-integration.vapi

index 73dcd09..b36f1a5 100644 (file)
@@ -9,15 +9,15 @@ bin_PROGRAMS = \
          src/moonshot \
          src/moonshot-webp
 
-AM_CFLAGS =
+AM_CFLAGS = -g -O0
 
-AM_CPPFLAGS = \
+AM_CPPFLAGS = -g -O0 \
        -include config.h \
        -DLOCALEDIR=\""$(localedir)"\" \
        -I$(top_srcdir)/libmoonshot \
        -I$(top_builddir)/libmoonshot
 
-AM_VALAFLAGS = \
+AM_VALAFLAGS = -g \
         config.vapi \
        --vapidir=$(top_srcdir)/vapi \
         --pkg gio-2.0
@@ -58,6 +58,7 @@ src_moonshot_webp_SOURCES = \
 src_moonshot_VALAFLAGS = --pkg gdk-2.0 --pkg gtk+-2.0 --pkg gee-1.0 $(AM_VALAFLAGS)
 src_moonshot_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)  
 src_moonshot_LDADD = $(moonshot_LIBS) 
+src_moonshot_LDFLAGS = -g -O0
 
 src_moonshot_webp_VALAFLAGS = --vapidir=$(top_srcdir)/libmoonshot  --pkg gtk+-2.0 --pkg gdk-2.0 --pkg libmoonshot $(AM_VALAFLAGS)
 src_moonshot_webp_CPPFLAGS = $(moonshot_CFLAGS) $(AM_CPPFLAGS)
index 4a0d15d..9d22ad6 100644 (file)
@@ -7,6 +7,10 @@ class IdentityManagerApp {
     private MoonshotServer ipc_server;
 #if OS_MACOS
        public OSXApplication osxApp;
+       public bool on_osx_open_files (string file_name ) {
+       print ("on_osx_open_files()  file_name = %s\n", file_name);
+               return ipc_server.install_from_file(file_name);
+       }
 #endif
     private const int WINDOW_WIDTH = 400;
     private const int WINDOW_HEIGHT = 500;
@@ -23,7 +27,8 @@ class IdentityManagerApp {
 // This wont work with Vala 0.12               
 //             osxApp.ns_application_open_file.connect(ipc_server.install_from_file);
 // so we have to use this old way
-               Signal.connect(osxApp, "NSApplicationOpenFile", (GLib.Callback)(ipc_server.install_from_file), null);
+               Signal.connect(osxApp, "NSApplicationOpenFile", (GLib.Callback)(on_osx_open_files), ipc_server);
+//             Signal.connect_data(osxApp, "NSApplicationOpenFile", (GLib.Callback)(ipc_server.install_from_file), ipc_server, null, 0);
 
 #endif
         view.show();
index 681d0dd..b7fcfbb 100644 (file)
@@ -3,7 +3,7 @@
 [DBus (name = "org.janet.Moonshot")]
 public class MoonshotServer : Object {
 
-    private IdentityManagerView main_window;
+    private static IdentityManagerView main_window;
 
     public MoonshotServer (Gtk.Window window)
     {
@@ -115,15 +115,15 @@ public class MoonshotServer : Object {
 
     public bool install_id_card (string   display_name,
                                  string   user_name,
-                                 string   password,
-                                 string   realm,
-                                 string[] rules_patterns,
-                                 string[] rules_always_confirm,
-                                 string[] services,
-                                 string   ca_cert,
-                                 string   subject,
-                                 string   subject_alt,
-                                 string   server_cert)
+                                 string   ?password,
+                                 string   ?realm,
+                                 string[] ?rules_patterns,
+                                 string[] ?rules_always_confirm,
+                                 string[] ?services,
+                                 string   ?ca_cert,
+                                 string   ?subject,
+                                 string   ?subject_alt,
+                                 string   ?server_cert)
     {
       IdCard idcard = new IdCard ();
 
@@ -148,13 +148,14 @@ public class MoonshotServer : Object {
         }
       }
 
-      return this.main_window.add_identity (idcard);
+      return main_window.add_identity (idcard);
     }
 
 
     public bool install_from_file (string file_name)
     {
     var webp = new WebProvisioning.Parser (file_name);
+       print ("install_from_file()  file_name = %s", file_name);
     webp.parse();
     bool result = false;
     
@@ -188,7 +189,8 @@ public class MoonshotServer : Object {
                                 card.trust_anchor.server_cert);
        }
 
-    return true;
+print ("install_from_file() result %s\n", result.to_string());
+    return result;
     }
 
 }
index dcc7b54..f02b71d 100644 (file)
            public bool use_quartz_accelerators();
 
     /* Signals */
-
+/*
        [CCode(cname="NSApplicationOpenFile")]
         public signal bool ns_application_open_file(string file_name);
+*/
+
+       [CCode(cname="nsapplicationopenfile")]
+  
+        public signal bool nsapplicationopenfile(string file_name);
+
     }