Logo Search packages:      
Sourcecode: lat version File versions  Download package

Global.cs

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace GnomeKeyring {

      using System;
      using System.Runtime.InteropServices;

#region Autogenerated code
      public class Global {

            [DllImport("gnome-keyring")]
            static extern int gnome_keyring_set_network_password_sync(IntPtr keyring, IntPtr user, IntPtr domain, IntPtr server, IntPtr objekt, IntPtr protocol, IntPtr authtype, uint port, IntPtr password, out uint item_id);

            public static GnomeKeyring.Result SetNetworkPassword(string keyring, string user, string domain, string server, string objekt, string protocol, string authtype, uint port, string password, out uint item_id) {
                  IntPtr keyring_as_native = GLib.Marshaller.StringToPtrGStrdup (keyring);
                  IntPtr user_as_native = GLib.Marshaller.StringToPtrGStrdup (user);
                  IntPtr domain_as_native = GLib.Marshaller.StringToPtrGStrdup (domain);
                  IntPtr server_as_native = GLib.Marshaller.StringToPtrGStrdup (server);
                  IntPtr objekt_as_native = GLib.Marshaller.StringToPtrGStrdup (objekt);
                  IntPtr protocol_as_native = GLib.Marshaller.StringToPtrGStrdup (protocol);
                  IntPtr authtype_as_native = GLib.Marshaller.StringToPtrGStrdup (authtype);
                  IntPtr password_as_native = GLib.Marshaller.StringToPtrGStrdup (password);
                  int raw_ret = gnome_keyring_set_network_password_sync(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, out item_id);
                  GnomeKeyring.Result ret = (GnomeKeyring.Result) 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;
            }

            [DllImport("gnome-keyring")]
            static extern IntPtr gnome_keyring_find_network_password(IntPtr user, IntPtr domain, IntPtr server, IntPtr objekt, IntPtr protocol, IntPtr authtype, uint port, GnomeKeyringSharp.OperationGetListCallbackNative cb, IntPtr data, GLib.DestroyNotify destroy_data);

            public static IntPtr FindNetworkPassword(string user, string domain, string server, string objekt, string protocol, string authtype, uint port, GnomeKeyring.OperationGetListCallback cb) {
                  IntPtr user_as_native = GLib.Marshaller.StringToPtrGStrdup (user);
                  IntPtr domain_as_native = GLib.Marshaller.StringToPtrGStrdup (domain);
                  IntPtr server_as_native = GLib.Marshaller.StringToPtrGStrdup (server);
                  IntPtr objekt_as_native = GLib.Marshaller.StringToPtrGStrdup (objekt);
                  IntPtr protocol_as_native = GLib.Marshaller.StringToPtrGStrdup (protocol);
                  IntPtr authtype_as_native = GLib.Marshaller.StringToPtrGStrdup (authtype);
                  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_network_password(user_as_native, domain_as_native, server_as_native, objekt_as_native, protocol_as_native, authtype_as_native, port, cb_wrapper.NativeDelegate, data, destroy_data);
                  IntPtr ret = raw_ret;
                  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);
                  return ret;
            }

            [DllImport("gnome-keyring")]
            static extern IntPtr gnome_keyring_set_network_password(IntPtr keyring, IntPtr user, IntPtr domain, IntPtr server, IntPtr objekt, IntPtr protocol, IntPtr authtype, uint port, IntPtr password, GnomeKeyringSharp.OperationGetIntCallbackNative cb, IntPtr data, GLib.DestroyNotify destroy_data);

            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;
            }

#endregion
#region Customized extensions
#line 1 "Global.custom"

            [DllImport("gnome-keyring")]
            static extern int gnome_keyring_find_network_password_sync(IntPtr user, IntPtr domain, IntPtr server, IntPtr objekt, IntPtr protocol, IntPtr authtype, uint port, out IntPtr result);

            public static GnomeKeyring.Result FindNetworkPassword(string user, out NetworkPasswordData[] result) {
                  IntPtr result_handle;
                  IntPtr user_as_native = GLib.Marshaller.StringToPtrGStrdup (user);
                  IntPtr domain_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
                  IntPtr server_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
                  IntPtr objekt_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
                  IntPtr protocol_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
                  IntPtr authtype_as_native = GLib.Marshaller.StringToPtrGStrdup (null);
                  int raw_ret = gnome_keyring_find_network_password_sync(user_as_native, domain_as_native, server_as_native, objekt_as_native, protocol_as_native, authtype_as_native, 0, out result_handle);
                  GnomeKeyring.Result ret = (GnomeKeyring.Result) raw_ret;
                  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.List l = new GLib.List(result_handle, typeof(NetworkPasswordData));
                  result = new NetworkPasswordData[l.Count];
                  for (int i = 0; i < l.Count; i++)
                        result[i] = (NetworkPasswordData)l[i];
            
                  return ret;
            }

            [DllImport("gnome-keyring")]
            static extern IntPtr gnome_keyring_find_items(int type, IntPtr attributes, GnomeKeyringSharp.OperationGetListCallbackNative cb, IntPtr data, GLib.DestroyNotify destroy_data);
            [DllImport("libglib-2.0-0.dll")]
            static extern IntPtr g_array_new(bool zero_terminated, bool clear_, uint element_size);
            [DllImport("libglib-2.0-0.dll")]
            static extern IntPtr g_array_append_vals(IntPtr a, IntPtr v, uint c);
            [DllImport("libglib-2.0-0.dll")]
            static extern IntPtr g_array_free(IntPtr a, bool free_segment);

            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;
            }

            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;
            }


            // The synchronous version of this requires a Found type
            // The Found type contains a GList, but should contain an array
            // I haven't the energy to complete that now
            /*
            [DllImport("gnome-keyring")]
            static extern GnomeKeyring.Result gnome_keyring_find_items_sync(GnomeKeyring.ItemType type, IntPtr attributes, out IntPtr found);

            public static GnomeKeyring.Result FindItems(GnomeKeyring.ItemType type, Attribute[] attributes, out Found[] result) {
                  IntPtr native_attributes = toGArray(attributes);
                  GnomeKeyringSharp.OperationGetListCallbackWrapper cb_wrapper;
                  IntPtr result_handle;

                  GnomeKeyring.Result ret = gnome_keyring_find_items_sync(type, native_attributes, out result_handle);

                  GLib.List l = new GLib.List(result_handle, typeof(Found));
                  result = new Found[l.Count];
                  for (int i = 0; i < l.Count; i++)
                        result[i] = (Found)l[i];

                  g_array_free(native_attributes, true);
                  native_attributes = IntPtr.Zero;

                  return ret;
            }
            */

#endregion
      }
}

Generated by  Doxygen 1.6.0   Back to index