public void SetLocaleStringList(string group_name, string key, string locale, string[] list) { if (key == null) { throw new ArgumentNullException("key"); } if (locale == null) { throw new ArgumentNullException("locale"); } if (list == null) { throw new ArgumentNullException("list"); } IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); IntPtr native_locale = Marshaller.StringToPtrGStrdup(locale); IntPtr native_list = Marshaller.StringArrayToStrvPtr(list); g_key_file_set_locale_string_list(Handle, native_group_name, native_key, native_locale, native_list, new UIntPtr((ulong)list.Length)); Marshaller.Free(native_group_name); Marshaller.Free(native_key); Marshaller.Free(native_locale); Marshaller.StrFreeV(native_list); }
public GString(string text) { IntPtr native_text = Marshaller.StringToPtrGStrdup(text); handle = g_string_new(native_text); Marshaller.Free(native_text); }
public bool[] GetBooleanList(string group_name, string key) { IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); UIntPtr native_length; IntPtr error; IntPtr raw_ret = g_key_file_get_boolean_list(Handle, native_group_name, native_key, out native_length, out error); Marshaller.Free(native_group_name); Marshaller.Free(native_key); if (error != IntPtr.Zero) { throw new GException(error); } int length = (int)(ulong)native_length; int[] ints = new int [length]; Marshal.Copy(raw_ret, ints, 0, length); Marshaller.Free(raw_ret); bool[] ret = new bool [length]; for (int i = 0; i < length; i++) { ret [i] = ints [i] != 0; } return(ret); }
void Invoke(string message) { IntPtr nmessage = Marshaller.StringToPtrGStrdup(message); native(nmessage); Marshaller.Free(nmessage); }
public Variant(string val) { IntPtr native_val = Marshaller.StringToPtrGStrdup(val); handle = g_variant_ref_sink(g_variant_new_string(native_val)); Marshaller.Free(native_val); }
public Argv(string[] args, bool add_program_name) { add_progname = add_program_name; if (add_progname) { string[] full = new string [args.Length + 1]; full [0] = System.Environment.GetCommandLineArgs()[0]; args.CopyTo(full, 1); args = full; } arg_ptrs = new IntPtr [args.Length]; for (int i = 0; i < args.Length; i++) { arg_ptrs [i] = Marshaller.StringToPtrGStrdup(args[i]); } handle = g_malloc(new IntPtr(IntPtr.Size * args.Length)); for (int i = 0; i < args.Length; i++) { Marshal.WriteIntPtr(handle, i * IntPtr.Size, arg_ptrs [i]); } }
public static bool SpawnSync(string working_directory, string[] argv, string[] envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, out string stdout, out string stderr, out int exit_status) { IntPtr native_stdout, native_stderr, error; IntPtr native_dir = Marshaller.StringToPtrGStrdup(working_directory); IntPtr[] native_argv = Marshaller.StringArrayToNullTermPointer(argv); IntPtr[] native_envp = Marshaller.StringArrayToNullTermPointer(envp); SpawnChildSetupWrapper wrapper = new SpawnChildSetupWrapper(child_setup); bool result; if (Global.IsWindowsPlatform) { result = g_spawn_sync(native_dir, native_argv, native_envp, (int)flags, wrapper.NativeCallback, wrapper.Data, out native_stdout, out native_stderr, out exit_status, out error); } else { result = g_spawn_sync(native_dir, native_argv, native_envp, (int)flags, wrapper.NativeCallback, wrapper.Data, out native_stdout, out native_stderr, out exit_status, out error); } Marshaller.Free(native_dir); Marshaller.Free(native_argv); Marshaller.Free(native_envp); stdout = Marshaller.PtrToStringGFree(native_stdout); stderr = Marshaller.PtrToStringGFree(native_stderr); if (error != IntPtr.Zero) { throw new GLib.GException(error); } return(result); }
protected void Connect(string name, Delegate cb, int flags) { IntPtr native_name = Marshaller.StringToPtrGStrdup(name); _HandlerID = g_signal_connect_data(_obj.Handle, native_name, cb, _key, new IntPtr(0), flags); Marshaller.Free(native_name); }
public VariantType(string type_string) { IntPtr native = Marshaller.StringToPtrGStrdup(type_string); handle = g_variant_type_new(native); Marshaller.Free(native); }
public static bool SpawnAsync(string working_directory, string[] argv, string[] envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, out Process child_process) { int pid; IntPtr error; IntPtr native_dir = Marshaller.StringToPtrGStrdup(working_directory); IntPtr[] native_argv = Marshaller.StringArrayToNullTermPointer(argv); IntPtr[] native_envp = Marshaller.StringArrayToNullTermPointer(envp); SpawnChildSetupWrapper wrapper = new SpawnChildSetupWrapper(child_setup); bool result; if (Global.IsWindowsPlatform) { result = g_spawn_async_utf8(native_dir, native_argv, native_envp, (int)flags, wrapper.NativeCallback, wrapper.Data, out pid, out error); } else { result = g_spawn_async(native_dir, native_argv, native_envp, (int)flags, wrapper.NativeCallback, wrapper.Data, out pid, out error); } child_process = new Process(pid); Marshaller.Free(native_dir); Marshaller.Free(native_argv); Marshaller.Free(native_envp); if (error != IntPtr.Zero) { throw new GLib.GException(error); } return(result); }
public static bool StringIsValid(string type_string) { IntPtr native = Marshaller.StringToPtrGStrdup(type_string); bool ret = g_variant_type_string_is_valid(native); Marshaller.Free(native); return(ret); }
public bool HasGroup(string group_name) { IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); bool ret = g_key_file_has_group(Handle, native_group_name); Marshaller.Free(native_group_name); return(ret); }
public static LogLevelFlags SetAlwaysFatal(string logDomain, LogLevelFlags fatalMask) { IntPtr ndom = Marshaller.StringToPtrGStrdup(logDomain); LogLevelFlags result = g_log_set_fatal_mask(ndom, fatalMask); Marshaller.Free(ndom); return(result); }
public void SetInteger(string group_name, string key, int value) { IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); g_key_file_set_integer(Handle, native_group_name, native_key, value); Marshaller.Free(native_group_name); Marshaller.Free(native_key); }
public void SetBoolean(string group_name, string key, bool value) { IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); g_key_file_set_boolean(Handle, native_group_name, native_key, value); Marshaller.Free(native_group_name); Marshaller.Free(native_key); }
public void WriteLog(string logDomain, LogLevelFlags flags, string format, params object [] args) { IntPtr ndom = Marshaller.StringToPtrGStrdup(logDomain); IntPtr nmessage = Marshaller.StringToPtrGStrdup(String.Format(format, args)); g_logv(ndom, flags, nmessage); Marshaller.Free(ndom); Marshaller.Free(nmessage); }
void Invoke(string log_domain, LogLevelFlags flags, string message) { IntPtr ndom = Marshaller.StringToPtrGStrdup(log_domain); IntPtr nmess = Marshaller.StringToPtrGStrdup(message); native(ndom, flags, nmess, IntPtr.Zero); Marshaller.Free(ndom); Marshaller.Free(nmess); }
public static void DefaultHandler(string logDomain, LogLevelFlags logLevel, string message) { IntPtr ndom = Marshaller.StringToPtrGStrdup(logDomain); IntPtr nmess = Marshaller.StringToPtrGStrdup(message); g_log_default_handler(ndom, logLevel, nmess, IntPtr.Zero); Marshaller.Free(ndom); Marshaller.Free(nmess); }
public static uint SetLogHandler(string logDomain, LogLevelFlags flags, LogFunc logFunc) { IntPtr ndom = Marshaller.StringToPtrGStrdup(logDomain); uint result = g_log_set_handler(ndom, flags, LogFuncTrampoline, logFunc); Marshaller.Free(ndom); EnsureHash(); handlers [result] = logFunc; return(result); }
public void SetValue(string group_name, string key, string value) { IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); IntPtr native_value = Marshaller.StringToPtrGStrdup(value); g_key_file_set_value(Handle, native_group_name, native_key, native_value); Marshaller.Free(native_group_name); Marshaller.Free(native_key); Marshaller.Free(native_value); }
public static void RemoveLogHandler(string logDomain, uint handlerID) { if (handlers != null && handlers.ContainsKey(handlerID)) { handlers.Remove(handlerID); } IntPtr ndom = Marshaller.StringToPtrGStrdup(logDomain); g_log_remove_handler(ndom, handlerID); Marshaller.Free(ndom); }
public string[] GetKeys(string group_name) { IntPtr error; IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); string[] ret = Marshaller.NullTermPtrToStringArray(g_key_file_get_keys(Handle, native_group_name, IntPtr.Zero, out error), true); Marshaller.Free(native_group_name); if (error != IntPtr.Zero) { throw new GException(error); } return(ret); }
public bool RemoveGroup(string group_name) { IntPtr error; IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); bool ret = g_key_file_remove_group(Handle, native_group_name, out error); Marshaller.Free(native_group_name); if (error != IntPtr.Zero) { throw new GException(error); } return(ret); }
public void SetIntegerList(string group_name, string key, int[] list) { if (list == null) { throw new ArgumentNullException("list"); } IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); g_key_file_set_integer_list(Handle, native_group_name, native_key, list, new UIntPtr((ulong)list.Length)); Marshaller.Free(native_group_name); Marshaller.Free(native_key); }
static public string EscapeText(string s) { if (s == null) { return(String.Empty); } IntPtr native = Marshaller.StringToPtrGStrdup(s); string result = Marshaller.PtrToStringGFree(g_markup_escape_text(native, -1)); Marshaller.Free(native); return(result); }
public int GetInteger(string group_name, string key) { IntPtr error; IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); int ret = g_key_file_get_integer(Handle, native_group_name, native_key, out error); Marshaller.Free(native_group_name); Marshaller.Free(native_key); if (error != IntPtr.Zero) { throw new GException(error); } return(ret); }
public string GetValue(string group_name, string key) { IntPtr error; IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); string ret = Marshaller.PtrToStringGFree(g_key_file_get_value(Handle, native_group_name, native_key, out error)); Marshaller.Free(native_group_name); Marshaller.Free(native_key); if (error != IntPtr.Zero) { throw new GException(error); } return(ret); }
public bool HasKey(string group_name, string key) { IntPtr error; IntPtr native_group_name = Marshaller.StringToPtrGStrdup(group_name); IntPtr native_key = Marshaller.StringToPtrGStrdup(key); bool ret = g_key_file_has_key(Handle, native_group_name, native_key, out error); Marshaller.Free(native_group_name); Marshaller.Free(native_key); if (error != IntPtr.Zero) { throw new GException(error); } return(ret); }
public bool LoadFromDataDirs(string file, out string full_path, KeyFileFlags flags) { IntPtr error; IntPtr native_full_path; IntPtr native_file = Marshaller.StringToPtrGStrdup(file); bool ret = g_key_file_load_from_data_dirs(Handle, native_file, out native_full_path, (int)flags, out error); Marshaller.Free(native_file); if (error != IntPtr.Zero) { throw new GException(error); } full_path = Marshaller.PtrToStringGFree(native_full_path); return(ret); }
public static bool SpawnAsyncWithPipes(string working_directory, string[] argv, string[] envp, SpawnFlags flags, SpawnChildSetupFunc child_setup, out Process child_process, ref int stdin, ref int stdout, ref int stderr) { int pid; IntPtr error; IntPtr native_dir = Marshaller.StringToPtrGStrdup(working_directory); IntPtr[] native_argv = Marshaller.StringArrayToNullTermPointer(argv); IntPtr[] native_envp = Marshaller.StringArrayToNullTermPointer(envp); SpawnChildSetupWrapper wrapper = new SpawnChildSetupWrapper(child_setup); IntPtr in_ptr = stdin == IgnorePipe ? IntPtr.Zero : Marshal.AllocHGlobal(4); IntPtr out_ptr = stdout == IgnorePipe ? IntPtr.Zero : Marshal.AllocHGlobal(4); IntPtr err_ptr = stderr == IgnorePipe ? IntPtr.Zero : Marshal.AllocHGlobal(4); bool result; if (Global.IsWindowsPlatform) { result = g_spawn_async_with_pipes_utf8(native_dir, native_argv, native_envp, (int)flags, wrapper.NativeCallback, wrapper.Data, out pid, in_ptr, out_ptr, err_ptr, out error); } else { result = g_spawn_async_with_pipes(native_dir, native_argv, native_envp, (int)flags, wrapper.NativeCallback, wrapper.Data, out pid, in_ptr, out_ptr, err_ptr, out error); } child_process = new Process(pid); if (in_ptr != IntPtr.Zero) { stdin = Marshal.ReadInt32(in_ptr); Marshal.FreeHGlobal(in_ptr); } if (out_ptr != IntPtr.Zero) { stdout = Marshal.ReadInt32(out_ptr); Marshal.FreeHGlobal(out_ptr); } if (err_ptr != IntPtr.Zero) { stderr = Marshal.ReadInt32(err_ptr); Marshal.FreeHGlobal(err_ptr); } Marshaller.Free(native_dir); Marshaller.Free(native_argv); Marshaller.Free(native_envp); if (error != IntPtr.Zero) { throw new GLib.GException(error); } return(result); }