Example #1
0
File: Global.cs Project: MrJoe/lat
		public static IntPtr SetNetworkPassword(string user, string server, string protocol, uint port, string password, GnomeKeyring.OperationGetIntCallback cb) {
			IntPtr keyring_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
			IntPtr user_as_native = GLib.Marshaller.StringToPtrGStrdup (user);
			IntPtr domain_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
			IntPtr server_as_native = GLib.Marshaller.StringToPtrGStrdup (server);
			IntPtr objekt_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
			IntPtr protocol_as_native = GLib.Marshaller.StringToPtrGStrdup (protocol);
			IntPtr authtype_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
			IntPtr password_as_native = GLib.Marshaller.StringToPtrGStrdup (password);
			GnomeKeyringSharp.OperationGetIntCallbackWrapper cb_wrapper;
			IntPtr data;
			GLib.DestroyNotify destroy_data;
			if (cb == null) {
				cb_wrapper = null;
				data = IntPtr.Zero;
				destroy_data = null;
			} else {
				cb_wrapper = new GnomeKeyringSharp.OperationGetIntCallbackWrapper (cb);
				data = (IntPtr) GCHandle.Alloc (cb_wrapper);
				destroy_data = GLib.DestroyHelper.NotifyHandler;
			}
			IntPtr raw_ret = gnome_keyring_set_network_password(keyring_as_native, user_as_native, domain_as_native, server_as_native, objekt_as_native, protocol_as_native, authtype_as_native, port, password_as_native, cb_wrapper.NativeDelegate, data, destroy_data);
			IntPtr ret = raw_ret;
			GLib.Marshaller.Free (keyring_as_native);
			GLib.Marshaller.Free (user_as_native);
			GLib.Marshaller.Free (domain_as_native);
			GLib.Marshaller.Free (server_as_native);
			GLib.Marshaller.Free (objekt_as_native);
			GLib.Marshaller.Free (protocol_as_native);
			GLib.Marshaller.Free (authtype_as_native);
			GLib.Marshaller.Free (password_as_native);
			return ret;
		}
Example #2
0
File: Found.cs Project: MrJoe/lat
		static extern void gnome_keyring_found_free(ref GnomeKeyring.Found raw);
 public OperationGetIntCallbackWrapper(GnomeKeyring.OperationGetIntCallback managed)
 {
     this.managed = managed;
     if (managed != null)
         NativeDelegate = new OperationGetIntCallbackNative (NativeCallback);
 }
Example #4
0
File: Global.cs Project: MrJoe/lat
		public static IntPtr FindItems(GnomeKeyring.ItemType type, Attribute[] attributes, GnomeKeyring.OperationGetListCallback cb) {
			IntPtr native_attributes = toGArray(attributes);
			GnomeKeyringSharp.OperationGetListCallbackWrapper cb_wrapper;
			IntPtr data;
			GLib.DestroyNotify destroy_data;
			if (cb == null) {
				cb_wrapper = null;
				data = IntPtr.Zero;
				destroy_data = null;
			} else {
				cb_wrapper = new GnomeKeyringSharp.OperationGetListCallbackWrapper (cb);
				data = (IntPtr) GCHandle.Alloc (cb_wrapper);
				destroy_data = GLib.DestroyHelper.NotifyHandler;
			}
			IntPtr raw_ret = gnome_keyring_find_items((int) type, native_attributes, cb_wrapper.NativeDelegate, data, destroy_data);
			IntPtr ret = raw_ret;
			// the array is copied as part of the synchronous part of the call
			g_array_free(native_attributes, true);
			native_attributes = IntPtr.Zero;
			return ret;
		}
Example #5
0
File: Global.cs Project: MrJoe/lat
		private static IntPtr toGArray(GnomeKeyring.Attribute[] attributes) {
			IntPtr native_attributes = g_array_new(false, false, (uint)Marshal.SizeOf(typeof(Attribute)));
			foreach (Attribute thisattrib in attributes) {
				IntPtr native_item = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Attribute)));
				Marshal.StructureToPtr(thisattrib, native_item, false);
				g_array_append_vals(native_attributes, native_item, 1);
				Marshal.FreeHGlobal(native_item);
				native_item = IntPtr.Zero;
			}
			return native_attributes;
		}