Exemplo n.º 1
0
		public ZlibDecompressor (GLib.ZlibCompressorFormat format) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ZlibDecompressor)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("format");
				vals.Add (new GLib.Value (format));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_zlib_decompressor_new((int) format);
		}
Exemplo n.º 2
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);
		}
Exemplo n.º 3
0
		public InetAddress (GLib.SocketFamily family) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (InetAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("family");
				vals.Add (new GLib.Value (family));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_inet_address_new_any((int) family);
		}
Exemplo n.º 4
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);
		}
Exemplo n.º 5
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);
		}
Exemplo n.º 6
0
		public Emblem (GLib.IIcon icon) : 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));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_emblem_new(icon == null ? IntPtr.Zero : ((icon is GLib.Object) ? (icon as GLib.Object).Handle : (icon as GLib.IconAdapter).Handle));
		}
Exemplo n.º 7
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);
		}
Exemplo n.º 8
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));
		}
Exemplo n.º 9
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);
		}
Exemplo n.º 10
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);
		}
Exemplo n.º 11
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);
		}
Exemplo n.º 12
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);
		}
Exemplo n.º 13
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);
		}
Exemplo n.º 14
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);
		}
Exemplo n.º 15
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);
		}
Exemplo n.º 16
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);
		}
Exemplo n.º 17
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);
		}
Exemplo n.º 18
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));
		}
Exemplo n.º 19
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);
		}
Exemplo n.º 20
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);
		}
Exemplo n.º 21
0
 public ConfigurableColumn[] GetColumns()
 {
     List<ConfigurableColumn> result = new List<ConfigurableColumn>();
     foreach(ConfigurableColumn col in ColumnsStore)
     {
         result.Add(col);
     }
     return result.ToArray();
 }
Exemplo n.º 22
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 ());
     });
 }
Exemplo n.º 23
0
 public Column[] GetVisibleColumnsInDrawOrder()
 {
     // TODO: could be initialzed on any change only and not an any method call
      List<Column> c = new List<Column>();
      foreach (KeyValuePair<Widget, Column> kvp in mColumns)
      {
     if (kvp.Key.Visible)
        c.Add(kvp.Value);
      }
      c.Sort(CompareSortOrder);
      return c.ToArray();
 }
 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 ();
 }
Exemplo n.º 25
0
        public static string[] NullTermPtrToStringArray(IntPtr null_term_array, bool owned)
        {
            if (null_term_array == IntPtr.Zero)
                return new string [0];

            int count = 0;
            var result = new List<string> ();
            IntPtr s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
            while (s != IntPtr.Zero) {
                result.Add (Utf8PtrToString (s));
                s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
            }

            if (owned)
                g_strfreev (null_term_array);

            return result.ToArray ();
        }
Exemplo n.º 26
0
 void InfoLoaded(GLib.Object o, GLib.AsyncResult res)
 {
     List<FilePhoto> items = new List<FilePhoto> ();
     foreach (GLib.FileInfo info in file.EnumerateChildrenFinish (res)) {
         SafeUri i = new SafeUri (file.GetChild (info.Name).Uri);
         Hyena.Log.DebugFormat ("testing uri = {0}", i);
         if (ImageFile.HasLoader (i))
             items.Add (new FilePhoto (i));
     }
     ThreadAssist.ProxyToMain (() => collection.Add (items.ToArray ()));
 }
Exemplo n.º 27
0
            public RssLoader(UriCollection collection, SafeUri uri)
            {
                XmlDocument doc = new XmlDocument ();
                doc.Load (uri.ToString ());
                XmlNamespaceManager ns = new XmlNamespaceManager (doc.NameTable);
                ns.AddNamespace ("media", "http://search.yahoo.com/mrss/");
                ns.AddNamespace ("pheed", "http://www.pheed.com/pheed/");
                ns.AddNamespace ("apple", "http://www.apple.com/ilife/wallpapers");

                List<FilePhoto> items = new List<FilePhoto> ();
                XmlNodeList list = doc.SelectNodes ("/rss/channel/item/media:content", ns);
                foreach (XmlNode item in list) {
                    SafeUri image_uri = new SafeUri (item.Attributes ["url"].Value);
                    Hyena.Log.DebugFormat ("flickr uri = {0}", image_uri.ToString ());
                    items.Add (new FilePhoto (image_uri));
                }

                if (list.Count < 1) {
                    list = doc.SelectNodes ("/rss/channel/item/pheed:imgsrc", ns);
                    foreach (XmlNode item in list) {
                        SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
                        Hyena.Log.DebugFormat ("pheed uri = {0}", uri);
                        items.Add (new FilePhoto (image_uri));
                    }
                }

                if (list.Count < 1) {
                    list = doc.SelectNodes ("/rss/channel/item/apple:image", ns);
                    foreach (XmlNode item in list) {
                        SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
                        Hyena.Log.DebugFormat ("apple uri = {0}", uri);
                        items.Add (new FilePhoto (image_uri));
                    }
                }
                collection.Add (items.ToArray ());
            }
Exemplo n.º 28
0
		public Variant (IDictionary<string, Variant> dict)
		{
			VariantType type = VariantType.NewDictionaryEntry (
				VariantType.String,
				VariantType.Variant);

			var pairs = new List<Variant> ();
			foreach (var kvp in dict)
				pairs.Add (NewDictEntry (new Variant (kvp.Key), NewVariant (kvp.Value)));

			handle = g_variant_ref_sink (NewArray (type, pairs.ToArray ()).Handle);
		}
Exemplo n.º 29
0
        void DeleteEntry(TreePath[] path)
        {
            try {

                if (!(path.Length > 1)) {

                    LdapEntry le = conn.Data.GetEntry (GetDN(path[0]));
                    Util.DeleteEntry (conn, le.DN);
                    return;
                }

                List<string> dnList = new List<string> ();

                foreach (TreePath tp in path) {
                    LdapEntry le = conn.Data.GetEntry (GetDN(tp));
                    dnList.Add (le.DN);
                }

                Util.DeleteEntry (conn, dnList.ToArray ());

            } catch {}
        }
Exemplo n.º 30
0
        void ChangePassword(LdapEntry entry, PasswordDialog pd)
        {
            List<LdapModification> mods = new List<LdapModification> ();

            LdapAttribute la;
            LdapModification lm;

            la = new LdapAttribute ("userPassword", pd.UnixPassword);
            lm = new LdapModification (LdapModification.REPLACE, la);
            mods.Add (lm);

            if (Util.CheckSamba (entry)) {
                la = new LdapAttribute ("sambaLMPassword", pd.LMPassword);
                lm = new LdapModification (LdapModification.REPLACE, la);
                mods.Add (lm);

                la = new LdapAttribute ("sambaNTPassword", pd.NTPassword);
                lm = new LdapModification (LdapModification.REPLACE, la);
                mods.Add (lm);
            }

            Util.ModifyEntry (conn, entry.DN, mods.ToArray());
        }