Added the MoonshotLogger class, which by default, does nothing. But if the --enable...
[moonshot-ui.git] / src / moonshot-server.vala
index b78e8e0..bb26dc0 100644 (file)
 [DBus (name = "org.janet.Moonshot")]
 public class MoonshotServer : Object {
 
+    static MoonshotLogger logger = get_logger("MoonshotServer");
+
+    private string app_name = "Moonshot";
+
     private IdentityManagerApp parent_app;
 
     public MoonshotServer(IdentityManagerApp app)
     {
+        logger.trace("MoonshotServer.<constructor>; app=" + (app == null ? "null" : "non-null"));
         this.parent_app = app;
     }
 
     public bool show_ui()
     {
+        logger.trace("MoonshotServer.show_ui");
+
         if (parent_app.view == null) {
+            stderr.printf(app_name, "show_ui: parent_app.view is null!\n");
+            logger.warn("show_ui: parent_app.view is null!");
             return false;
         }
         parent_app.show();
         parent_app.explicitly_launched = true;
+        logger.trace("MoonshotServer.show_ui: returning true");
         return true;
     }
 
@@ -61,13 +71,17 @@ public class MoonshotServer : Object {
                                    out string subject_name_constraint,
                                    out string subject_alt_name_constraint)
     {
+        logger.trace(@"MoonshotServer.get_identity: nai='$nai'; service='$service'");
         var request = new IdentityRequest(parent_app,
                                           nai,
                                           password,
                                           service);
+        logger.trace(@"MoonshotServer.get_identity: Calling request.execute()");
         request.set_callback((IdentityRequest) => get_identity.callback());
         request.execute();
+        logger.trace(@"MoonshotServer.get_identity: Back from request.execute()");
         yield;
+        logger.trace(@"MoonshotServer.get_identity: back from yield");
 
         nai_out = "";
         password_out = "";
@@ -103,9 +117,12 @@ public class MoonshotServer : Object {
             if (subject_alt_name_constraint == null)
                 subject_alt_name_constraint = "";
 
+            logger.trace("MoonshotServer.get_identity: returning true");
+
             return true;
         }
 
+        logger.trace("MoonshotServer.get_identity: returning false");
         return false;
     }
 
@@ -116,6 +133,7 @@ public class MoonshotServer : Object {
                                            out string subject_name_constraint,
                                            out string subject_alt_name_constraint)
     {
+        logger.trace("MoonshotServer.get_default_identity");
         var request = new IdentityRequest.default(parent_app);
         request.set_callback((IdentityRequest) => get_default_identity.callback());
         request.execute();
@@ -151,6 +169,7 @@ public class MoonshotServer : Object {
             if (subject_alt_name_constraint == null)
                 subject_alt_name_constraint = "";
 
+            logger.trace("MoonshotServer.get_default_identity: returning true");
             return true;
         }
 
@@ -290,6 +309,8 @@ public class MoonshotServer : Object {
                                     ref string subject_name_constraint,
                                     ref string subject_alt_name_constraint)
     {
+        logger.trace("(static) get_identity");
+
         bool result = false;
 
         var request = new IdentityRequest(parent_app,
@@ -355,6 +376,8 @@ public class MoonshotServer : Object {
                                             ref string subject_name_constraint,
                                             ref string subject_alt_name_constraint)
     {
+        logger.trace("(static) get_default_identity");
+
         bool result;
 
         var request = new IdentityRequest.default(parent_app);
@@ -428,7 +451,9 @@ public class MoonshotServer : Object {
                                        string     server_cert,
                                        bool       force_flat_file_store)
     {
+        logger.trace("(static) install_id_card");
         IdCard idcard = new IdCard();
+
         bool success = false;
         Mutex mutex = new Mutex();
         Cond cond = new Cond();