Example #1
0
        static MimeIconEngine()
        {
            SmallIcons.ColorDepth       = ColorDepth.Depth32Bit;
            SmallIcons.TransparentColor = Color.Transparent;
            LargeIcons.ColorDepth       = ColorDepth.Depth32Bit;
            LargeIcons.TransparentColor = Color.Transparent;

                        #if !NO_GTK
            string session = Environment.GetEnvironmentVariable("DESKTOP_SESSION");

            if (session != null)
            {
                session = session.ToUpper();

                if (session == "DEFAULT")
                {
                    string helper = Environment.GetEnvironmentVariable("GNOME_DESKTOP_SESSION_ID");

                    if (helper != null)
                    {
                        session = "GNOME";
                    }
                }
            }
            else
            {
                session = String.Empty;
            }

            if (Mime.MimeAvailable && session == "GNOME")
            {
                SmallIcons.ImageSize = new Size(24, 24);
                LargeIcons.ImageSize = new Size(48, 48);

                platformMimeHandler = new GnomeHandler();
                if (platformMimeHandler.Start() == MimeExtensionHandlerStatus.OK)
                {
                    platform = EPlatformHandler.GNOME;
                }
                else
                {
                    MimeIconEngine.LargeIcons.Images.Clear();
                    MimeIconEngine.SmallIcons.Images.Clear();
                    platformMimeHandler = new PlatformDefaultHandler();
                    platformMimeHandler.Start();
                }
            }
            else
                        #endif
            {
                SmallIcons.ImageSize = new Size(16, 16);
                LargeIcons.ImageSize = new Size(48, 48);

                platformMimeHandler = new PlatformDefaultHandler();
                platformMimeHandler.Start();
            }
        }
		static MimeIconEngine ()
		{
			SmallIcons.ColorDepth = ColorDepth.Depth32Bit;
			SmallIcons.TransparentColor = Color.Transparent;
			LargeIcons.ColorDepth = ColorDepth.Depth32Bit;
			LargeIcons.TransparentColor = Color.Transparent;
			
			string session =  Environment.GetEnvironmentVariable ("DESKTOP_SESSION");
			
			if (session != null) {
				session = session.ToUpper ();
				
				if (session == "DEFAULT") {
					string helper = Environment.GetEnvironmentVariable ("GNOME_DESKTOP_SESSION_ID");
					
					if (helper != null)
						session = "GNOME";
				}
			} else
				session = String.Empty;
			
			if (Mime.MimeAvailable && session == "GNOME") {
				SmallIcons.ImageSize = new Size (24, 24);
				LargeIcons.ImageSize = new Size (48, 48);
				
				platformMimeHandler = new GnomeHandler ();
				if (platformMimeHandler.Start () == MimeExtensionHandlerStatus.OK) {
					platform = EPlatformHandler.GNOME;
				} else {
					MimeIconEngine.LargeIcons.Images.Clear ();
					MimeIconEngine.SmallIcons.Images.Clear ();
					platformMimeHandler = new PlatformDefaultHandler ();
					platformMimeHandler.Start ();
				}
			} else {
				SmallIcons.ImageSize = new Size (16, 16);
				LargeIcons.ImageSize = new Size (48, 48);
				
				platformMimeHandler = new PlatformDefaultHandler ();
				platformMimeHandler.Start ();
			}
		}