Пример #1
0
		public InetAddress (byte[] bytes, GLib.SocketFamily family) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (InetAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("bytes");
				vals.Add (new GLib.Value (bytes));
				names.Add ("family");
				vals.Add (new GLib.Value (family));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_inet_address_new_from_bytes(bytes, (int) family);
		}
Пример #2
0
		public ZlibCompressor (GLib.ZlibCompressorFormat format, int level) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ZlibCompressor)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("format");
				vals.Add (new GLib.Value (format));
				names.Add ("level");
				vals.Add (new GLib.Value (level));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_zlib_compressor_new((int) format, level);
		}
Пример #3
0
		public Application (string application_id, GLib.ApplicationFlags flags) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Application)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("application_id");
				vals.Add (new GLib.Value (application_id));
				names.Add ("flags");
				vals.Add (new GLib.Value (flags));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_application_id = GLib.Marshaller.StringToPtrGStrdup (application_id);
			Raw = g_application_new(native_application_id, (int) flags);
			GLib.Marshaller.Free (native_application_id);
		}
Пример #4
0
		public Emblem (GLib.IIcon icon, GLib.EmblemOrigin origin) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Emblem)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (icon != null) {
					names.Add ("icon");
					vals.Add (new GLib.Value (icon));
				}
				names.Add ("origin");
				vals.Add (new GLib.Value (origin));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_emblem_new_with_origin(icon == null ? IntPtr.Zero : ((icon is GLib.Object) ? (icon as GLib.Object).Handle : (icon as GLib.IconAdapter).Handle), (int) origin);
		}
Пример #5
0
		public SimpleAction (string name, GLib.VariantType parameter_type) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (SimpleAction)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("name");
				vals.Add (new GLib.Value (name));
				names.Add ("parameter_type");
				vals.Add (new GLib.Value (parameter_type));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			Raw = g_simple_action_new(native_name, parameter_type == null ? IntPtr.Zero : parameter_type.Handle);
			GLib.Marshaller.Free (native_name);
		}
Пример #6
0
		public NetworkAddress (string hostname, ushort port) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (NetworkAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("hostname");
				vals.Add (new GLib.Value (hostname));
				names.Add ("port");
				vals.Add (new GLib.Value (port));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_hostname = GLib.Marshaller.StringToPtrGStrdup (hostname);
			Raw = g_network_address_new(native_hostname, port);
			GLib.Marshaller.Free (native_hostname);
		}
Пример #7
0
 public ListStoreMapping()
 {
     store_types = new List<GType>();
     callbacks = new List<GetStoreValueCallback>();
     store_types.Add((GType)typeof(DataRow));
     ColumnsStore = new NodeStore(typeof(ConfigurableColumn));
 }
Пример #8
0
		public InetSocketAddress (GLib.InetAddress address, ushort port) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (InetSocketAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (address != null) {
					names.Add ("address");
					vals.Add (new GLib.Value (address));
				}
				names.Add ("port");
				vals.Add (new GLib.Value (port));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_inet_socket_address_new(address == null ? IntPtr.Zero : address.Handle, port);
		}
Пример #9
0
		public TcpWrapperConnection (GLib.IOStream base_io_stream, GLib.Socket socket) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (TcpWrapperConnection)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (base_io_stream != null) {
					names.Add ("base_io_stream");
					vals.Add (new GLib.Value (base_io_stream));
				}
				if (socket != null) {
					names.Add ("socket");
					vals.Add (new GLib.Value (socket));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_tcp_wrapper_connection_new(base_io_stream == null ? IntPtr.Zero : base_io_stream.Handle, socket == null ? IntPtr.Zero : socket.Handle);
		}
Пример #10
0
		public Settings (string schema, GLib.SettingsBackend backend) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Settings)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("schema");
				vals.Add (new GLib.Value (schema));
				if (backend != null) {
					names.Add ("backend");
					vals.Add (new GLib.Value (backend));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_schema = GLib.Marshaller.StringToPtrGStrdup (schema);
			Raw = g_settings_new_with_backend(native_schema, backend == null ? IntPtr.Zero : backend.Handle);
			GLib.Marshaller.Free (native_schema);
		}
Пример #11
0
		public ConverterOutputStream (GLib.OutputStream base_stream, GLib.IConverter converter) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ConverterOutputStream)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (base_stream != null) {
					names.Add ("base_stream");
					vals.Add (new GLib.Value (base_stream));
				}
				if (converter != null) {
					names.Add ("converter");
					vals.Add (new GLib.Value (converter));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_converter_output_stream_new(base_stream == null ? IntPtr.Zero : base_stream.Handle, converter == null ? IntPtr.Zero : ((converter is GLib.Object) ? (converter as GLib.Object).Handle : (converter as GLib.ConverterAdapter).Handle));
		}
Пример #12
0
		public MemoryOutputStream (IntPtr data, ulong size, GLib.ReallocFunc realloc_function, GLib.DestroyNotify destroy_function) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (MemoryOutputStream)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("data");
				vals.Add (new GLib.Value (data));
				names.Add ("size");
				vals.Add (new GLib.Value (size));
				names.Add ("realloc_function");
				vals.Add (new GLib.Value (realloc_function));
				names.Add ("destroy_function");
				vals.Add (new GLib.Value (destroy_function));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			GLibSharp.ReallocFuncWrapper realloc_function_wrapper = new GLibSharp.ReallocFuncWrapper (realloc_function);
			Raw = g_memory_output_stream_new(data, new UIntPtr (size), realloc_function_wrapper.NativeDelegate, destroy_function);
		}
Пример #13
0
		public ThreadedSocketService (int max_threads) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ThreadedSocketService)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("max_threads");
				vals.Add (new GLib.Value (max_threads));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_threaded_socket_service_new(max_threads);
		}
Пример #14
0
		public SimplePermission (bool allowed) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (SimplePermission)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("allowed");
				vals.Add (new GLib.Value (allowed));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_simple_permission_new(allowed);
		}
Пример #15
0
		public NetworkService (string service, string protocol, string domain) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (NetworkService)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("service");
				vals.Add (new GLib.Value (service));
				names.Add ("protocol");
				vals.Add (new GLib.Value (protocol));
				names.Add ("domain");
				vals.Add (new GLib.Value (domain));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_service = GLib.Marshaller.StringToPtrGStrdup (service);
			IntPtr native_protocol = GLib.Marshaller.StringToPtrGStrdup (protocol);
			IntPtr native_domain = GLib.Marshaller.StringToPtrGStrdup (domain);
			Raw = g_network_service_new(native_service, native_protocol, native_domain);
			GLib.Marshaller.Free (native_service);
			GLib.Marshaller.Free (native_protocol);
			GLib.Marshaller.Free (native_domain);
		}
Пример #16
0
		public Settings (string schema) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Settings)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("schema");
				vals.Add (new GLib.Value (schema));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_schema = GLib.Marshaller.StringToPtrGStrdup (schema);
			Raw = g_settings_new(native_schema);
			GLib.Marshaller.Free (native_schema);
		}
Пример #17
0
		public FileIcon (GLib.IFile file) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (FileIcon)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (file != null) {
					names.Add ("file");
					vals.Add (new GLib.Value (file));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_file_icon_new(file == null ? IntPtr.Zero : ((file is GLib.Object) ? (file as GLib.Object).Handle : (file as GLib.FileAdapter).Handle));
		}
Пример #18
0
		public BufferedOutputStream (GLib.OutputStream base_stream) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (BufferedOutputStream)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (base_stream != null) {
					names.Add ("base_stream");
					vals.Add (new GLib.Value (base_stream));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_buffered_output_stream_new(base_stream == null ? IntPtr.Zero : base_stream.Handle);
		}
Пример #19
0
		public UnixFDMessage (GLib.UnixFDList fd_list) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (UnixFDMessage)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (fd_list != null) {
					names.Add ("fd_list");
					vals.Add (new GLib.Value (fd_list));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_unix_fd_message_new_with_fd_list(fd_list == null ? IntPtr.Zero : fd_list.Handle);
		}
Пример #20
0
		public UnixCredentialsMessage (GLib.Credentials credentials) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (UnixCredentialsMessage)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (credentials != null) {
					names.Add ("credentials");
					vals.Add (new GLib.Value (credentials));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_unix_credentials_message_new_with_credentials(credentials == null ? IntPtr.Zero : credentials.Handle);
		}
Пример #21
0
		public UnixSocketAddress (string path) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (UnixSocketAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("path");
				vals.Add (new GLib.Value (path));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			Raw = g_unix_socket_address_new(native_path);
			GLib.Marshaller.Free (native_path);
		}
Пример #22
0
        public static List<RGB> ListNames(out List<string> names)
        {
            IntPtr namesPtr;
              IntPtr colorsPtr;

              int len = gimp_rgb_list_names(out namesPtr, out colorsPtr);

              names = Util.ToStringList(namesPtr, len);
              Marshaller.Free(namesPtr);

              var colors = new List<RGB>();
              Util.Iterate<GimpRGB>(colorsPtr, len, (_, rgb) => colors.Add(new RGB(rgb)));
              Marshaller.Free(colorsPtr);

              return colors;
        }
Пример #23
0
 public void ReorderColumns()
 {
     List<ConfigurableColumn> result = new List<ConfigurableColumn>();
     foreach(ConfigurableColumn col in ColumnsStore)
         result.Add(col);
     result.Sort(CompareConfigurableColumnPosition);
     ColumnsStore.Clear();
     foreach(ConfigurableColumn col in result)
         ColumnsStore.AddNode(col);
 }
Пример #24
0
 public ConfigurableColumn[] GetColumns()
 {
     List<ConfigurableColumn> result = new List<ConfigurableColumn>();
     foreach(ConfigurableColumn col in ColumnsStore)
     {
         result.Add(col);
     }
     return result.ToArray();
 }
Пример #25
0
        protected void LoadItems(System.IO.FileInfo [] files)
        {
            List<IBrowsableItem> items = new List<IBrowsableItem> ();
            foreach (var f in files) {
                if (FSpot.ImageFile.HasLoader (f.FullName)) {
                    Console.WriteLine (f.FullName);
                    items.Add (new FileBrowsableItem (f.FullName));
                }
            }

            list = items;
            this.Reload ();
        }
Пример #26
0
 void InfoLoaded(GLib.Object o, GLib.AsyncResult res)
 {
     List<FileBrowsableItem> items = new List<FileBrowsableItem> ();
     foreach (GLib.FileInfo info in file.EnumerateChildrenFinish (res)) {
         Uri i = file.GetChild (info.Name).Uri;
         FSpot.Utils.Log.Debug ("testing uri = {0}", i);
         if (FSpot.ImageFile.HasLoader (i))
             items.Add (new FileBrowsableItem (i));
     }
     Gtk.Application.Invoke (items, System.EventArgs.Empty, delegate (object sender, EventArgs args) {
         collection.Add (items.ToArray ());
     });
 }
Пример #27
0
 List<Vectors> GetVectorsFromIntPtr(IntPtr vectorsIds, int numVectors)
 {
     var vectors = new List<Vectors>();
       if (numVectors > 0)
     {
       var dest = new int[numVectors];
       Marshal.Copy(vectorsIds, dest, 0, numVectors);
       Array.ForEach(dest,
     vectorsID => vectors.Add(new Vectors(vectorsID)));
     }
       return vectors;
 }
        private void TrackListViewOnColumnsChanged(object sender, EventArgs eventArgs)
        {
            List<TrackProperty> trackPropertyList = new List<TrackProperty>(TrackListView.Columns.Count());
            foreach (TrackListViewColumn column in TrackListView.Columns)
            {
                TrackProperty trackProperty;
                if (ColumnsToProperties.TryGetValue(column, out trackProperty))
                    trackPropertyList.Add(trackProperty);
            }

            _settings.ColumnPropertyList = trackPropertyList;
        }
 AppInfo[] ApplicationsFor(IEnumerable<string> types)
 {
     List<AppInfo> app_infos = new List<AppInfo> ();
     List<string> existing_ids = new List<string> ();
     foreach (string type in types)
         foreach (AppInfo appinfo in AppInfoAdapter.GetAllForType (type)) {
             if (existing_ids.Contains (appinfo.Id))
                 continue;
             if (!appinfo.SupportsUris)
                 continue;
             if (ignore_apps != null && ignore_apps.Contains (appinfo.Executable))
                 continue;
             app_infos.Add (appinfo);
             existing_ids.Add (appinfo.Id);
         }
     return app_infos.ToArray ();
 }
		static bool RequireGenerics (IMethodSymbol method)
		{
			System.Collections.Immutable.ImmutableArray<ITypeSymbol> typeArgs;
			if (method.MethodKind == MethodKind.Constructor) {
				typeArgs = method.ContainingType.TypeArguments;
			} else {
				typeArgs = method.TypeArguments;
			}
			
			if (!typeArgs.Any (ta => ta.TypeKind == TypeKind.TypeParameter))
				return false;

			var parameterTypes = new List<ITypeSymbol> (method.Parameters.Select (p => p.Type));
			if (method.IsExtensionMethod) {
				parameterTypes.Add (method.ReducedFrom.Parameters [0].Type);
			}

			return typeArgs.Any (t => !parameterTypes.Any (pt => ContainsType (pt, t)));
		}