public CPreviewWindow(CTheme theme,bool Show)
 {
     string prevW="PreviewWindow";
     this.theme = theme;
     Glade.XML previewXml= new Glade.XML (null, "gui.glade", prevW, null);
     previewXml.Autoconnect (this);
     mainWindow = (Gtk.Window) previewXml.GetWidget (prevW);
     PreviewCloseButton.Clicked+=new EventHandler(OnCloseButtonClicked);
     PreviewInstallButton.Clicked+=new EventHandler(OnInstallButtonClicked);
     MainImagePixbuf = new Gdk.Pixbuf(theme.LocalPreviewFile);
     Headline = Catalog.GetString("Previewing \"")+ theme.Name+"\"";
     if(Show)
         MainWindow.ShowAll();
 }
Esempio n. 2
0
        public CTheme GetTheme(string themeName)
        {
            ArrayList themeList = getThemeList();
            CTheme    theme     = null;

            for (int i = 0; i < themeList.Count; i++)
            {
                theme = (CTheme)(themeList[i]);
                if (theme.Name == themeName)
                {
                    return(GetTheme(i));
                }
            }
            return(null);
        }
Esempio n. 3
0
        public CPreviewWindow(CTheme theme, bool Show)
        {
            string prevW = "PreviewWindow";

            this.theme = theme;
            Glade.XML previewXml = new Glade.XML(null, "gui.glade", prevW, null);
            previewXml.Autoconnect(this);
            mainWindow = (Gtk.Window)previewXml.GetWidget(prevW);
            PreviewCloseButton.Clicked   += new EventHandler(OnCloseButtonClicked);
            PreviewInstallButton.Clicked += new EventHandler(OnInstallButtonClicked);
            MainImagePixbuf = new Gdk.Pixbuf(theme.LocalPreviewFile);
            Headline        = Catalog.GetString("Previewing \"") + theme.Name + "\"";
            if (Show)
            {
                MainWindow.ShowAll();
            }
        }
Esempio n. 4
0
        private void AddThemeToVectorArray(CTheme Theme)
        {
            switch (config.ThemeType)
            {
            case CConfiguration.ArtType.atBackground_gnome:
                Gnome_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;

            case CConfiguration.ArtType.atBackground_other:
                Other_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;

            case CConfiguration.ArtType.atBackground_nature:
                Nature_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;

            case CConfiguration.ArtType.atBackground_abstract:
                Abstract_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;

            case CConfiguration.ArtType.atGdmGreeter:
                GdmGreeterThemeList.Add((CGdmTheme)Theme); break;

            case CConfiguration.ArtType.atGtkEngine:
                GtkThemeList.Add((CGtkTheme)Theme); break;

            case CConfiguration.ArtType.atIcon:
                IconThemeList.Add((CIconTheme)Theme); break;

            case CConfiguration.ArtType.atSplash:
                SplashThemeList.Add((CSplashTheme)Theme); break;

            case CConfiguration.ArtType.atApplication:
                ApplicationThemeList.Add((CApplicationTheme)Theme); break;

            case CConfiguration.ArtType.atWindowDecoration:
                WindowDecorationThemeList.Add((CWindowDecorationTheme)Theme); break;

            default: Console.WriteLine("AddThemeToVectorArray:null"); break;
            }
        }
Esempio n. 5
0
        //Die XMLDatei durchgehen und die Objekte erzeugen
        private void parseXMLFile()
        {
            if (getThemeList().Count == 0)
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(config.ArtFilePath());

                // Retrieve all bg from the xml
                XmlNodeList entries = doc.SelectNodes(config.NodeEntryPath());
                Console.WriteLine("Number of themes: " + entries.Count);

                foreach (XmlNode node in entries)
                {
                    //Neues Objekt anlegen, wird zu einem anderen gecastet wenn es nötigt ist
                    CTheme Theme = CreateNewThemeObject();

                    //Background-Attribute auslesen
                    if (node.NodeType == XmlNodeType.Element)
                    {
                        XmlAttributeCollection attributes = node.Attributes;
                        XmlNode item = null;
                        for (int i = 0; i < attributes.Count; i++)
                        {
                            item = attributes.Item(i);
                            if (item.Name == "release_date")
                            {
                                Theme.ReleaseDate = item.InnerText;
                            }
                            //TODO: will be rating soon votesum and count are deprecated
                            else if (item.Name == "vote_sum")
                            {
                                Theme.VoteSum = GetIntFromXML(item.InnerText);
                            }
                            else if (item.Name == "vote_count")
                            {
                                Theme.VoteCount = GetIntFromXML(item.InnerText);
                            }
                            else if (item.Name == "download_start_timestamp")
                            {
                                Theme.Timestamp = item.InnerText;
                            }
                            else if (item.Name == "download_count")
                            {
                                Theme.DownloadCount = GetIntFromXML(item.InnerText);
                            }
                        }

                        XmlNodeList Childs = node.ChildNodes;
                        for (int i = 0; i < Childs.Count; i++)
                        {
                            item = Childs.Item(i);
                            if (item.Name == "name")
                            {
                                Theme.Name = item.InnerText;
                            }
                            else if (item.Name == "description")
                            {
                                Theme.Description = item.InnerText;
                            }
                            else if (item.Name == "category")
                            {
                                Theme.Category = item.InnerText;
                            }
                            else if (item.Name == "author")
                            {
                                Theme.Author = item.InnerText;
                            }
                            else if (item.Name == "license")
                            {
                                Theme.License = item.InnerText;
                            }
                            else if (item.Name == "thumbnail")
                            {
                                //In der Background-XML ist "Thumbnail"==SmallThumbnailUrl
                                if (config.BackgroundChoosen)
                                {
                                    Theme.SmallThumbnailUrl = item.InnerText;
                                    Theme.PreviewUrl        = item.InnerText;
                                }
                                else
                                {
                                    Theme.PreviewUrl = item.InnerText;
                                }
                            }
                            else if (item.Name == "small_thumbnail")
                            {
                                Theme.SmallThumbnailUrl = item.InnerText;
                            }
                            else if (item.Name == "url")
                            {
                                Theme.DownloadUrl = item.InnerText;
                            }
                            else if (item.Name == "background_resolution")
                            {
                                XmlNodeList      BackgroundResolutions = item.ChildNodes;
                                CBackgroundImage bgImg = new CBackgroundImage();
                                for (int j = 0; j < BackgroundResolutions.Count; j++)
                                {
                                    XmlNode bgitem = BackgroundResolutions.Item(j);
                                    if (bgitem.Name == "type")
                                    {
                                        bgImg.Type = bgitem.InnerText;
                                        ((CBackgroundTheme)Theme).addImage(bgImg.Type, bgImg);
                                    }
                                    else if (bgitem.Name == "resolution")
                                    {
                                        string tmp = bgitem.InnerText;
                                        if (tmp.Contains("scalable"))
                                        {
                                            bgImg.xResolution = 9999;
                                            bgImg.yResolution = 9999;
                                        }
                                        else
                                        {
                                            string[] sa = tmp.Split('x');
                                            bgImg.xResolution = int.Parse(sa[0]);
                                            bgImg.yResolution = int.Parse(sa[1]);
                                        }
                                    }
                                    //Bei Hintergründen ist die URL auch gleichzeitig die DownloadUrl..jeweils die größte wählen
                                    else if (bgitem.Name == "url")
                                    {
                                        bgImg.URL         = bgitem.InnerText;
                                        Theme.DownloadUrl = bgImg.URL;
                                    }
                                }
                            }
                        }
                    }
                    //Füge Theme in die VektorArrays ein
                    AddThemeToVectorArray(Theme);
                }
            }              //if Cout==0
        }
Esempio n. 6
0
    private void FillExtendedSection(CTheme theme)
    {
        bool isImage = config.BackgroundChoosen;
        string themeRating = theme.VoteSum.ToString();
        ExtInfoImage.Pixbuf = theme.ThumbnailPic;
        ExtInfoName.Text = theme.Name;
        ExtInfoAuthor.Text = theme.Author;
        ExtInfoLicense.Text = theme.License;
        if (theme.Description.Trim() != "")
            ExtInfoDescription.Text = theme.Description;
        else
            ExtInfoDescription.Text = Catalog.GetString("No description has been entered by the author");
        ExtInfoDownloads.Text = theme.DownloadCount.ToString();

        if (themeRating=="0")
            themeRating=Catalog.GetString("not rated");

        ExtInfoRating.Text = themeRating;
        if (isImage){
            CBackgroundTheme bgt =(CBackgroundTheme)theme;
            imageTypeBox.Changed -= (EventHandler)OnImageTypeBoxChanged;
            imageResolutionsBox.Changed -= (EventHandler)OnImageResolutionsBoxChanged;
            FillComboboxWithStrings(imageTypeBox, bgt.GetAvailableTypes());
            FillComboboxWithStrings(imageResolutionsBox, bgt.GetAvailableResolutions(CUtility.StrToImageType(imageTypeBox.ActiveText)));
            imageTypeBox.Changed += new EventHandler(OnImageTypeBoxChanged);
            imageResolutionsBox.Changed += new EventHandler(OnImageResolutionsBoxChanged);
        }
        imageTypeBox.Visible=isImage;
        imageResolutionsBox.Visible = isImage;
        imageStyleBox.Visible = isImage;
        ExtInfoImageTypeLabel.Visible = isImage;
        ExtInfoResolutionsLabel.Visible = isImage;
        ExtInfoImageStyleLabel.Visible = isImage;
    }
 private void AddThemeToVectorArray(CTheme Theme)
 {
     switch (config.ThemeType){
         case CConfiguration.ArtType.atBackground_gnome:
             Gnome_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;
         case CConfiguration.ArtType.atBackground_other:
             Other_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;
         case CConfiguration.ArtType.atBackground_nature:
             Nature_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;
         case CConfiguration.ArtType.atBackground_abstract:
             Abstract_BackgroundThemeList.Add((CBackgroundTheme)Theme); break;
         case CConfiguration.ArtType.atGdmGreeter:
             GdmGreeterThemeList.Add((CGdmTheme)Theme); break;
         case CConfiguration.ArtType.atGtkEngine:
             GtkThemeList.Add((CGtkTheme)Theme); break;
         case CConfiguration.ArtType.atIcon:
             IconThemeList.Add((CIconTheme)Theme); break;
         case CConfiguration.ArtType.atSplash:
             SplashThemeList.Add((CSplashTheme)Theme); break;
         case CConfiguration.ArtType.atApplication:
             ApplicationThemeList.Add((CApplicationTheme)Theme); break;
         case CConfiguration.ArtType.atWindowDecoration:
             WindowDecorationThemeList.Add((CWindowDecorationTheme)Theme); break;
     default: Console.WriteLine("AddThemeToVectorArray:null"); break;
     }
 }