Ejemplo n.º 1
0
        internal static bool Show(string realm, SslFailure failures, bool may_save, CertficateInfo certInfo, out SslFailure accepted_failures, out bool save)
        {
            SslFailure local_accepted_failures = SslFailure.None;
            bool       local_save = false;

            bool   res     = false;
            object monitor = new Object();

            EventHandler del = delegate
            {
                try
                {
                    SslServerTrustDialog dlg = new SslServerTrustDialog(realm, failures, certInfo, may_save);
                    res = (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok);
                    if (res)
                    {
                        local_save = dlg.Save;
                        local_accepted_failures = dlg.AcceptedFailures;
                    }

                    dlg.Destroy();
                }
                finally
                {
                    lock (monitor)
                    {
                        System.Threading.Monitor.Pulse(monitor);
                    }
                }
            };

            if (GLib.MainContext.Depth > 0)
            {
                // Already in GUI thread
                del(null, null);
            }
            else
            {
                lock (monitor)
                {
                    Gtk.Application.Invoke(del);
                    System.Threading.Monitor.Wait(monitor);
                }
            }
            accepted_failures = local_accepted_failures;
            save = local_save;
            return(res);
        }
Ejemplo n.º 2
0
		internal static bool Show (string realm, SslFailure failures, bool may_save, CertficateInfo certInfo, out SslFailure accepted_failures, out bool save)
		{
			SslFailure local_accepted_failures = SslFailure.None;
			bool local_save = false;
			
			bool res = false;
			object monitor = new Object ();
			
			EventHandler del = delegate {
					try {
						SslServerTrustDialog dlg = new SslServerTrustDialog (realm, failures, certInfo, may_save);
						res = (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok);
						if (res) {
							local_save = dlg.Save;
							local_accepted_failures = dlg.AcceptedFailures;
						}
					
						dlg.Destroy ();
					} finally {
						lock (monitor) {
							System.Threading.Monitor.Pulse (monitor);
						}
					}
				};
			
			if (GLib.MainContext.Depth > 0) {
				// Already in GUI thread
				del (null, null);
			}
			else {
				lock (monitor) {
					Gtk.Application.Invoke (del);
					System.Threading.Monitor.Wait (monitor);
				}
			}
			accepted_failures = local_accepted_failures;
			save = local_save;
			return res;
		}