示例#1
1
		public unsafe long Write(byte[] buffer, ulong count, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_output_stream_write(Handle, buffer, new UIntPtr (count), cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			long ret = (long) raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#2
1
		public AppChooserDialog (Gtk.Window parent, Gtk.DialogFlags flags, GLib.IFile file) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (AppChooserDialog)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			Raw = gtk_app_chooser_dialog_new(parent == null ? IntPtr.Zero : parent.Handle, (int) flags, file == null ? IntPtr.Zero : ((file is GLib.Object) ? (file as GLib.Object).Handle : (file as GLib.FileAdapter).Handle));
		}
示例#3
1
		public GLib.InputStream Load(int size, string type, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_loadable_icon_load(Handle, size, GLib.Marshaller.StringToPtrGStrdup(type), cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.InputStream ret = GLib.Object.GetObject(raw_ret) as GLib.InputStream;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#4
1
文件: Value.cs 项目: saraa/fishtastic
 public Value(GLib.GType gtype)
 {
     type = IntPtr.Zero;
     pad1 = new Padding ();
     pad2 = new Padding ();
     g_value_init (ref this, gtype.Val);
 }
		public BufferedOutputStream (GLib.OutputStream base_stream, ulong size) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (BufferedOutputStream)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			Raw = g_buffered_output_stream_new_sized(base_stream == null ? IntPtr.Zero : base_stream.Handle, new UIntPtr (size));
		}
示例#6
0
		public GLib.FileOutputStream AppendTo(GLib.FileCreateFlags flags, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_file_append_to(Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.FileOutputStream ret = GLib.Object.GetObject(raw_ret) as GLib.FileOutputStream;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#7
0
		public DesktopAppInfo (GLib.KeyFile key_file) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (DesktopAppInfo)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			Raw = g_desktop_app_info_new_from_keyfile(key_file == null ? IntPtr.Zero : key_file.Handle);
		}
示例#8
0
		public bool Truncate(long offset, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_seekable_truncate(Handle, offset, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#9
0
		public MemoryInputStream (IntPtr data, long len, GLib.DestroyNotify destroy) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (MemoryInputStream)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			Raw = g_memory_input_stream_new_from_data(data, new IntPtr (len), destroy);
		}
示例#10
0
		public GLib.IOStream ConnectFinish(GLib.IAsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_proxy_connect_finish(Handle, result == null ? IntPtr.Zero : ((result is GLib.Object) ? (result as GLib.Object).Handle : (result as GLib.AsyncResultAdapter).Handle), out error);
			GLib.IOStream ret = GLib.Object.GetObject(raw_ret) as GLib.IOStream;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#11
0
		public Image (GLib.IIcon icon, Gtk.IconSize size) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Image)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			Raw = gtk_image_new_from_gicon(icon == null ? IntPtr.Zero : ((icon is GLib.Object) ? (icon as GLib.Object).Handle : (icon as GLib.IconAdapter).Handle), (int) size);
		}
示例#12
0
		public GLib.IOStream Connect(GLib.IOStream connection, GLib.ProxyAddress proxy_address, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_proxy_connect(Handle, connection == null ? IntPtr.Zero : connection.Handle, proxy_address == null ? IntPtr.Zero : proxy_address.Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.IOStream ret = GLib.Object.GetObject(raw_ret) as GLib.IOStream;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#13
0
		public EmblemedIcon (GLib.IIcon icon, GLib.Emblem emblem) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (EmblemedIcon)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			Raw = g_emblemed_icon_new(icon == null ? IntPtr.Zero : ((icon is GLib.Object) ? (icon as GLib.Object).Handle : (icon as GLib.IconAdapter).Handle), emblem == null ? IntPtr.Zero : emblem.Handle);
		}
        public static bool CopyRecursive(this GLib.File source, GLib.File target, GLib.FileCopyFlags flags, GLib.Cancellable cancellable, GLib.FileProgressCallback callback)
        {
            bool result = true;

            GLib.FileType ft = source.QueryFileType (GLib.FileQueryInfoFlags.None, cancellable);

            if (ft != GLib.FileType.Directory) {
                Hyena.Log.DebugFormat ("Copying \"{0}\" to \"{1}\"", source.Path, target.Path);
                return source.Copy (target, flags, cancellable, callback);
            }

            if (!target.Exists) {
                Hyena.Log.DebugFormat ("Creating directory: \"{0}\"", target.Path);
                result = result && target.MakeDirectoryWithParents (cancellable);
            }

            GLib.FileEnumerator fe = source.EnumerateChildren ("standard::name", GLib.FileQueryInfoFlags.None, cancellable);
            GLib.FileInfo fi = fe.NextFile ();
            while (fi != null) {
                GLib.File source_file = GLib.FileFactory.NewForPath (Path.Combine (source.Path, fi.Name));
                GLib.File target_file = GLib.FileFactory.NewForPath (Path.Combine (target.Path, fi.Name));
                result = result && source_file.CopyRecursive(target_file, flags, cancellable, callback);
                fi = fe.NextFile ();
            }
            fe.Close (cancellable);
            return result;
        }
示例#15
0
		public unsafe GLib.FileInfo QueryInfoFinish(GLib.AsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_file_io_stream_query_info_finish(Handle, result == null ? IntPtr.Zero : result.Handle, out error);
			GLib.FileInfo ret = GLib.Object.GetObject(raw_ret) as GLib.FileInfo;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#16
0
文件: Bus.cs 项目: akrisiun/gtk-sharp
		public static unsafe GLib.DBusConnection GetFinish(GLib.IAsyncResult res) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_bus_get_finish(res == null ? IntPtr.Zero : ((res is GLib.Object) ? (res as GLib.Object).Handle : (res as GLib.AsyncResultAdapter).Handle), out error);
			GLib.DBusConnection ret = GLib.Object.GetObject(raw_ret) as GLib.DBusConnection;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#17
0
		public NoOpObject (GLib.Object obj) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (NoOpObject)) {
				throw new InvalidOperationException ("Can't override this constructor.");
			}
			Raw = atk_no_op_object_new(obj == null ? IntPtr.Zero : obj.Handle);
		}
示例#18
0
文件: Bus.cs 项目: akrisiun/gtk-sharp
		public static unsafe GLib.DBusConnection GetSync(GLib.BusType bus_type, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_bus_get_sync((int) bus_type, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			GLib.DBusConnection ret = GLib.Object.GetObject(raw_ret) as GLib.DBusConnection;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#19
0
		public static uint AddGlobalEventListener (GLib.Signal.EmissionHook hook, string event_type)
		{
			IntPtr native_event_type = GLib.Marshaller.StringToPtrGStrdup (event_type);
			uint id = atk_add_global_event_listener (new GLib.Signal.EmissionHookMarshaler (hook).Callback, native_event_type);
			GLib.Marshaller.Free (native_event_type);
			return id;
		}
示例#20
0
		public unsafe bool PutUint32(uint data, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_data_output_stream_put_uint32(Handle, data, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			bool ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#21
0
文件: Source.cs 项目: Zekom/gtk-sharp
 public Source(GLib.SourceFuncs source_funcs, uint struct_size)
 {
     IntPtr native_source_funcs = GLib.Marshaller.StructureToPtrAlloc (source_funcs);
     Raw = g_source_new(native_source_funcs, struct_size);
     source_funcs = GLib.SourceFuncs.New (native_source_funcs);
     Marshal.FreeHGlobal (native_source_funcs);
 }
示例#22
0
		public static SimpleAsyncResult NewTakeError(GLib.Object source_object, GLib.AsyncReadyCallback cb, IntPtr error)
		{
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			SimpleAsyncResult result = new SimpleAsyncResult (g_simple_async_result_new_take_error(source_object == null ? IntPtr.Zero : source_object.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero, error));
			return result;
		}
示例#23
0
		public unsafe int ReadByte(GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			int raw_ret = g_buffered_input_stream_read_byte(Handle, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			int ret = raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
示例#24
0
        static void LogFunc(string logDomain, GLib.LogLevelFlags logLevel, string message)
        {
            System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace (2, true);
            string msg = string.Format ("{0}-{1}: {2}\nStack trace: {3}{4}",
                logDomain, logLevel, message, Environment.NewLine, trace.ToString ());

            switch (logLevel) {
            case GLib.LogLevelFlags.Debug:
                Log.Debug (msg);
                break;
            case GLib.LogLevelFlags.Info:
                Log.Info (msg);
                break;
            case GLib.LogLevelFlags.Warning:
                Log.Warn (msg);
                break;
            case GLib.LogLevelFlags.Error:
                Log.Error (msg);
                break;
            case GLib.LogLevelFlags.Critical:
            default:
                Log.Fatal (msg);
                break;
            }
        }
		public static void EjectWithOperation (this GLib.Mount m, MountUnmountFlags flags, GLib.MountOperation operation, 
			Cancellable cancellable, AsyncReadyCallback callback)
		{
			m.MaybeEmptyTrashWithAction (() => {
				NativeInterop.EjectWithOperation (m, flags, operation, cancellable, callback);
			});
		}
示例#26
0
        public static void Connect(GLib.Object o, string name,
                                bool after, Delegate handler)
        {
            Delegate newHandler;

              ObjectSignalKey k = new ObjectSignalKey (o, name);

              if (!SignalInfo.IsValidDelegate (handler))
            throw new Exception ("Invalid delegate");

              if (SignalHandlers[k] != null) {
            SignalInfo si = (SignalInfo) SignalHandlers[k];
            if (!si.IsCompatibleDelegate (handler))
              throw new Exception ("Incompatible delegate");

            newHandler = Delegate.Combine (si.RegisteredHandler, handler);
            si.UpdateArgsType (handler);
            si.RegisteredHandler = newHandler;
              } else {
            if (!SignalInfo.IsValidDelegate (handler))
              throw new Exception ("Invalid delegate");

            IntPtr closure = g_closure_new_simple (g_closure_sizeof, IntPtr.Zero);
            g_closure_set_meta_marshal (closure, (IntPtr) GCHandle.Alloc (k),  marshalHandler);
            uint signalId = g_signal_connect_closure (o.Handle, name, closure, after);
            SignalHandlers.Add (k, new SignalInfo (signalId, closure, handler));
              }
        }
示例#27
0
		public void GetCurrentValue (ref GLib.Value value)
		{
			if (rangeValueProvider != null) {
				value = new GLib.Value (rangeValueProvider.Value);
				return;
			}
		}
示例#28
0
		public void QueryInfoAsync(string attributes, int io_priority, GLib.Cancellable cancellable, GLib.AsyncReadyCallback cb) {
			IntPtr native_attributes = GLib.Marshaller.StringToPtrGStrdup (attributes);
			GLibSharp.AsyncReadyCallbackWrapper cb_wrapper = new GLibSharp.AsyncReadyCallbackWrapper (cb);
			cb_wrapper.PersistUntilCalled ();
			g_file_io_stream_query_info_async(Handle, native_attributes, io_priority, cancellable == null ? IntPtr.Zero : cancellable.Handle, cb_wrapper.NativeDelegate, IntPtr.Zero);
			GLib.Marshaller.Free (native_attributes);
		}
示例#29
0
		public static unsafe DBusProxy NewForBusFinish(GLib.IAsyncResult res)
		{
			IntPtr error = IntPtr.Zero;
			DBusProxy result = new DBusProxy (g_dbus_proxy_new_for_bus_finish(res == null ? IntPtr.Zero : ((res is GLib.Object) ? (res as GLib.Object).Handle : (res as GLib.AsyncResultAdapter).Handle), out error));
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return result;
		}
示例#30
0
		public unsafe long Splice(GLib.InputStream source, GLib.OutputStreamSpliceFlags flags, GLib.Cancellable cancellable) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_output_stream_splice(Handle, source == null ? IntPtr.Zero : source.Handle, (int) flags, cancellable == null ? IntPtr.Zero : cancellable.Handle, out error);
			long ret = (long) raw_ret;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}