Esempio n. 1
0
        public CConfiguration(ArtType type)
        {
            GConfClient            = new GConf.Client();
            systemProxy            = new ProxyAttrStruct();
            gangProxy              = new ProxyAttrStruct();
            systemProxy.Ip         = "";   //TODO:Why is it important to initialize it...an error occurs otherwise.
            gangProxy.Ip           = "";   //TODO:Why is it important to initialize it...an error occurs otherwise.
            artType                = type;
            dirSep                 = Path.DirectorySeparatorChar.ToString();
            homePath               = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + dirSep;
            settingsPath           = Path.Combine(homePath, ".gnome2" + dirSep + "gnome-art-ng");
            splashInstallPath      = homePath + ".local/share/pixmaps/splash" + dirSep;
            applicationInstallPath = homePath + "." + themesDir + dirSep;
            decorationInstallPath  = homePath + "." + themesDir + dirSep;
            iconInstallPath        = homePath + iconDir + dirSep;
            tarIsAvailable         = CUtility.TestIfProgIsInstalled("tar", "--version", "gnu tar");
            grepIsAvailable        = CUtility.TestIfProgIsInstalled("grep", "--version", "gnu grep");
            sedIsAvailable         = CUtility.TestIfProgIsInstalled("sed", "--version", "gnu sed");
            setDistributionDependendSettings();
            CreateDownloadDirectories();

            //Create GConf listeners
            GConf.NotifyEventHandler changed_handler = new GConf.NotifyEventHandler(onSettingsChanged);
            GConfClient.AddNotify(sProxyGconfPath, changed_handler);
            //Load Configurations
            settingsLoadOk = LoadProgramSettings();
        }
        override protected void PreInstallation(CStatusWindow sw)
        {
            string tarParams = "";

            client = new GConf.Client();

            LocalThemeFile = config.ThemesPath + Path.GetFileName(DownloadUrl);
            string InstallThemeFile = config.ApplicationInstallPath + Path.GetFileName(DownloadUrl);

            tarParams    = CUtility.GetTarParams(Path.GetExtension(DownloadUrl));
            sw.Mainlabel = Catalog.GetString(CConfiguration.txtDownloadTheme);
            //Herunterladen
            if (!File.Exists(InstallThemeFile))
            {
                GetThemeFile(sw);
            }
            sw.SetProgress("1/" + installationSteps);
            //Entpacken
            sw.Mainlabel = Catalog.GetString(CConfiguration.txtExtracting);
            Console.WriteLine("Command: tar" + tarParams + LocalThemeFile + " -C " + config.ApplicationInstallPath);
            ConOutp = CUtility.Execute("tar", tarParams + LocalThemeFile + " -C " + config.ApplicationInstallPath);
            sw.SetProgress("2/" + installationSteps);
            //Sichern
            sw.Mainlabel             = Catalog.GetString(CConfiguration.txtSavingForRestore);
            previousApplicationTheme = (string)client.Get(GConfApplicationKey);
            sw.SetProgress("3/" + installationSteps);
        }
Esempio n. 3
0
        override protected void PreInstallation(CStatusWindow sw)
        {
            //Herunterladen
            sw.Mainlabel = Catalog.GetString(CConfiguration.txtDownloadTheme);
            GetThemeFile(sw);
            sw.SetProgress("1/" + installationSteps);

            //Entpacken
            sw.Mainlabel = Catalog.GetString(CConfiguration.txtExtracting);
            System.Collections.ArrayList al = new System.Collections.ArrayList();
            al     = CUtility.UncompressFile(LocalThemeFile, Path.GetTempPath(), false, null, al);
            Folder = ((string)(al[0])).Split('/');
            //Console.WriteLine(Folder[0]);
            sw.SetProgress("2/" + installationSteps);

            //Convertieren
            sw.Mainlabel = Catalog.GetString(CConfiguration.txtConvertingIcons);
            sw.SetProgress("3/" + installationSteps);
            CIconThemeManager iconmanager = new CIconThemeManager();

            iconmanager.ThemeName    = Folder[0];
            iconmanager.StatusWindow = sw;
            iconmanager.ImportIcons(Path.GetTempPath() + Folder[0]);
            sw.SetProgress("4/" + installationSteps);
            iconmanager.SaveAllIcons(config.IconInstallPath + "/", true);

            //Sichern
            client        = new GConf.Client();
            sw.Mainlabel  = Catalog.GetString(CConfiguration.txtSavingForRestore);
            prevIconTheme = (string)client.Get(GConfIconThemeKey);
            sw.SetProgress("5/" + installationSteps);
        }
 private void onRestartClicked(object sender, EventArgs a)
 {
     removeClickHandler(onRestartClicked);
     //restart the application
     CUtility.Execute(System.Windows.Forms.Application.ExecutablePath, "", false);
     RestartRequested = true;
     Close();
 }
Esempio n. 5
0
        private void getDistributionAndVersion()
        {
            string sContent = CUtility.GetContentFromFile("/etc/issue", true);
            string vinfo    = String.Empty;

            distribution        = DistriType.Unknown;
            distributionVersion = DistriVersion.Unknown;

            //(K)Ubuntu, Suse
            if (sContent.IndexOf("kubuntu", StringComparison.CurrentCulture) > -1)
            {
                distribution = DistriType.Kubuntu;
            }
            if (sContent.IndexOf("ubuntu", StringComparison.CurrentCulture) > -1)
            {
                distribution = DistriType.Ubuntu;
            }
            if (sContent.Contains("suse"))
            {
                distribution = DistriType.Suse;
            }
            if (sContent.Contains("pclinuxos"))
            {
                distribution = DistriType.PcLinuxOs;
            }
            if (sContent.Contains("arch"))
            {
                distribution = DistriType.ArchLinux;
            }

            //Version
            if (distribution == DistriType.Ubuntu)
            {
                try {
                    sContent = CUtility.GetContentFromFile("/etc/lsb-release", true);
                    if (sContent.IndexOf("hardy", StringComparison.CurrentCulture) > -1)
                    {
                        distributionVersion = DistriVersion.Hardy;
                    }
                    if (sContent.IndexOf("intrepid", StringComparison.CurrentCulture) > -1)
                    {
                        distributionVersion = DistriVersion.Intrepid;
                    }
                    if (sContent.Contains("jaunty"))
                    {
                        distributionVersion = DistriVersion.Jaunty;
                    }
                    if (sContent.Contains("karmic"))
                    {
                        distributionVersion = DistriVersion.Karmic;
                    }
                    vinfo = ", version: " + distributionVersion;
                } catch (Exception e) {
                    Console.WriteLine("Couldn't detect the version of your distribution, error: " + e.Message);
                }
            }
            Console.WriteLine("It seems you're using an flavour of " + distribution + vinfo);
        }
Esempio n. 6
0
 public void LoadImage(string Filename)
 {
     Pixbuf = new Gdk.Pixbuf(Filename);
     if (Pixbuf.Width != Pixbuf.Height)
     {
         Pixbuf.ScaleSimple(Pixbuf.Width, Pixbuf.Width, Gdk.InterpType.Bilinear);
     }
     Size = Pixbuf.Width;
     Type = CUtility.StrToImageType(Path.GetExtension(Filename));
 }
Esempio n. 7
0
 public CAboutWindow(CConfiguration config, bool ShowWindow) : base(config, windowName, windowTitle, WindowShowType.wstNo)
 {
     AboutVersion.Text         = CConfiguration.Version;
     AboutCloseButton.Clicked += new EventHandler(OnAboutCloseButtonClicked);
     AboutImage.Pixbuf         = CUtility.GetPixbuf("./images/gnome.png", config);
     if (ShowWindow)
     {
         mainWindow.ShowAll();
     }
 }
Esempio n. 8
0
        override protected void PreInstallation(CStatusWindow sw)
        {
            gdmConfAvailable       = File.Exists(gdmconf);
            gdmConfCustomAvailable = File.Exists(gdmconfcustom);
            if (!gdmConfAvailable)
            {
                throw new Exception(Catalog.GetString("Installation is not possible!") + "-" + Catalog.GetString(String.Format("No {0} available", gdmconf)));
            }
            if (!installationIsPossible)
            {
                throw new Exception(Catalog.GetString("Installation is not possible!") + "-" + Catalog.GetString("Only GDM is supported"));
            }

            //TODO: grep ersetzen durch IniWorker
            sb = CUtility.Execute("grep", "GraphicalThemeRand= " + gdmconf);
            if (sb.Length < 1)
            {
                Console.WriteLine("Warning:grep returned no GraphicalThemeRand-Entry\"");
                randomThemeActive = false;
            }
            else
            {
                randomThemeActive = bool.Parse(sb.ToString().Split('=')[1]);
            }

            //Falls nicht vorhanden wird sie erzeugt
            if (!gdmConfCustomAvailable)
            {
                try{
                    FileStream fs = File.Create(gdmconfcustomtemp);
                    fs.Close();
                    CUtility.ExecuteSu(config, "mv " + gdmconfcustomtemp + " " + gdmconfcustom);
                }
                catch { throw new Exception("Gdm.conf-custom couldn't be created, aborting!"); }
            }
            sw.SetProgress("1/" + installationSteps);
            //Datei einlesen
            iworker = new CIniWorker(gdmconfcustom);
            iworker.CreateSections("daemon;security;xdmcp;gui;greeter;chooser;debug;servers", ';');
            //Entpackparameter
            tarParams = @"tar " + CUtility.GetTarParams(DownloadUrl);
            //Herunterladen
            GetThemeFile(sw);
            sw.SetProgress("2/" + installationSteps);
            //Entpacken
            sw.Mainlabel = CConfiguration.txtExtracting;
            sb           = CUtility.ExecuteSu(config, @tarParams + @LocalThemeFile + " -C " + @config.GdmInstallPath);
            FolderName   = sb.ToString().Split('/');
            if (FolderName[0] == "")
            {
                throw new Exception(Catalog.GetString("Couldn't get any usefull information from the tar-command...aborting"));
            }
            //Console.WriteLine(FolderName[0]);
            sw.SetProgress("3/" + installationSteps);
        }
        private void initializeWidgets()
        {
            UpdateCloseButton.Clicked  += new EventHandler(onCloseButtonClicked);
            UpdateDonateButton.Clicked += new EventHandler(onDonateButtonClicked);
            addClickHandler(onStatusButtonClicked);
            setHeaderLabelText(Catalog.GetString("Use \"Check\" to search for updates"));
            UpdateHeaderImage.Pixbuf = CUtility.GetPixbuf("./images/update_checking.png", config);

            UpdateDonatePayPalButtonImage.Pixbuf = CUtility.GetPixbuf("./images/paypal.gif", config);
            UpdateStatusLabel.Text = Catalog.GetString("Check");
        }
 private void onApplyClicked(object sender, EventArgs b)
 {
     try{
         string dfile = "/tmp/thumbs.tar.gz";
         FtaApplyButton.Sensitive = false;
         FtaCloseButton.Sensitive = false;
         new CFileDownloader(config).DownloadFile(CConfiguration.ThemeBulkUrl, dfile, FtaProgressBar);
         CUtility.UncompressFile(dfile, config.ProgramSettingsPath + config.DirectorySeperator, true, FtaProgressBar, new System.Collections.ArrayList());
         Close();
     }
     catch {
         FtaCloseButton.Sensitive = true;
         FtaApplyButton.Sensitive = false;
     }
 }
Esempio n. 11
0
        public bool Save(string DestinationThemeDir, bool OverwriteFile, bool CreateSymlinks)
        {
            char   Sep         = Path.DirectorySeparatorChar;
            string newpath     = DestinationThemeDir + Sep + GetSizeDir() + Sep + contextToStr(Context) + Sep;
            string newfilename = newpath + FdoName + Path.GetExtension(Filename);

            try{
                if (Context == ContextType.cNone)
                {
                    Context = guessContextFromStr(Path.GetFullPath(Filename));
                    Console.WriteLine("Guessing the icon " + Filename + ", belongs probably to " + Context.ToString());
                }
                if (!Directory.Exists(newpath))
                {
                    Directory.CreateDirectory(Path.GetFullPath(newpath));
                }
                //Console.WriteLine("Old: "+Filename+",New: "+ newfilename);
                if (Filename == "")
                {
                    Pixbuf.Save(newfilename, CUtility.ImageTypeToStr(Type));
                }
                else
                {
                    File.Copy(Filename, newfilename, OverwriteFile);                     //File.Move
                }
                //Has to be included in the icon-class if this unit will be the base of a icon-generator-app
                //For now, it's ok to copy it while saving
                string IconFile = Path.ChangeExtension(Filename, "icon");
                if (File.Exists(IconFile))
                {
                    File.Copy(IconFile, Path.ChangeExtension(newfilename, "icon"), OverwriteFile);                //File.Move
                }
                //for max compatibility
                if (CreateSymlinks)
                {
                    foreach (string link in LinkedNames)
                    {
                        CUtility.Execute("ln", "-s " + newfilename + " " + newpath + link + Path.GetExtension(Filename));
                    }
                }
            } catch (Exception e) {
                Console.WriteLine("Warning: " + e.Message);
            }
            return(true);
        }
        private void onInstallClicked(object sender, EventArgs a)
        {
            string tmpfile = "/tmp/newgang.deb";

            UpdateProgressBar.Show();
            try {
                new CFileDownloader(config).DownloadFile(config.NewestVersionDownloadLocation, tmpfile, UpdateProgressBar);
                if (File.Exists(tmpfile))
                {
                    CUtility.ExecuteSu(config, "gdebi-gtk " + tmpfile);
                }
                removeClickHandler(onInstallClicked);
                setHeaderLabelText(Catalog.GetString("All operations are done, do you like to restart GANG?"));
                UpdateStatusLabel.Text  = Catalog.GetString("Restart app?");
                UpdateStatusImage.Stock = Gtk.Stock.DialogQuestion;
                addClickHandler(onRestartClicked);
            }
            catch {
            }
        }
Esempio n. 13
0
 override public void Revert()
 {
     if (revertIsAvailable)
     {
         //Eintrag " GraphicalTheme=Themename"
         if (!randomThemeActive)
         {
             //IWorker wurde bei der Installation schon erzeugt
             iworker.setValue("greeter", "GraphicalTheme", previousTheme, true);
             //Kopieren an einen Ort an dem Schreibberechtigung vorhanden ist
             iworker.Save(gdmconfcustomtemp);
             CUtility.ExecuteSu(config, "mv " + gdmconfcustomtemp + " /etc/gdm/");
         }
         else
         {
             //Random ist aktiv :/
         }
         CUtility.Execute("gdmflexiserver", "--command=\"UPDATE_CONFIG greeter/GraphicalTheme\"");
         revertIsAvailable = false;
     }
 }
        private void onStatusButtonClicked(object sender, EventArgs a)
        {
            UpdateStatusLabel.Text = Catalog.GetString("Connecting");
            try{
                UpdateStatusButton.Sensitive = false;
                if (config.UpdateAvailable)
                {
                    setHeaderLabelText(Catalog.GetString("An online update is available, version ") + config.NewestVersionNumberOnServer);
                    UpdateHeaderImage.Pixbuf = CUtility.GetPixbuf("./images/update_available.png", config);
                    UpdateStatusImage.Stock  = Gtk.Stock.Yes;
                    removeClickHandler(onStatusButtonClicked);

                    if (config.Distribution == CConfiguration.DistriType.Ubuntu)
                    {
                        if (config.DistributionVersion != CConfiguration.DistriVersion.Unknown)
                        {
                            UpdateStatusLabel.Text = Catalog.GetString("Install");
                            addClickHandler(onInstallClicked);
                        }
                    }
                    else
                    {
                        UpdateStatusLabel.Text = Catalog.GetString("Open download location");
                        addClickHandler(onOpenLocationButtonClicked);
                    }
                }
                else
                {
                    UpdateStatusImage.Stock = Gtk.Stock.Refresh;
                    setHeaderLabelText(Catalog.GetString("There is no new version of GANG available"));
                    UpdateStatusLabel.Text   = Catalog.GetString("Check");
                    UpdateHeaderImage.Pixbuf = CUtility.GetPixbuf("./images/update_same.png", config);
                }
                UpdateCurrentVersionLabel.Text = CConfiguration.Version;
                UpdateNewVersionLabel.Text     = config.NewestVersionNumberOnServer;
            }
            finally {
                UpdateStatusButton.Sensitive = true;
            }
        }
Esempio n. 15
0
 /*
  * 2 Dateien sind wichtig:
  * /etc/gdm/gdm.conf um herauszufinden ob u.U Multiselect gewählt ist
  * /etc/gdm/gdm.conf-custom um die gewählten Themes herauszulesen und zu setzen
  */
 override protected void Installation(CStatusWindow sw)
 {
     //Eintrag "GraphicalTheme=Themename"
     sw.Mainlabel = CConfiguration.txtInstalling;
     if (!randomThemeActive)
     {
         //Sichern
         previousTheme = iworker.getValue("greeter", "GraphicalTheme", true);
         //Console.WriteLine("PreviousTheme: "+previousTheme);
         iworker.setValue("greeter", "GraphicalTheme", FolderName[0], true);
         //Kopieren an einen Ort an dem Schreibberechtigung vorhanden ist
         iworker.Save(gdmconfcustomtemp);
         //Per gksudo den Benutzer für diese Aktion zum Superuser werden lassen
         CUtility.ExecuteSu(config, "mv " + gdmconfcustomtemp + " /etc/gdm/");
     }
     else
     {
         //TODO: für Random
     }
     //GDM die Änderungen mitteilen
     CUtility.Execute("gdmflexiserver", "--command=\"UPDATE_CONFIG greeter/GraphicalTheme\"");
 }
 public static void onDonateButtonClicked(object sender, EventArgs a)
 {
     CUtility.Execute("gnome-www-browser", @"https://www.paypal.com/cgi-bin/webscr" +
                      "?cmd=_donations&business=software%40plasmasolutions%2ede&item_name=Gnome%2dArt%20Next%20Generation%20donation" +
                      "&no_shipping=0&no_note=1&tax=0&currency_code=EUR&lc=DE&bn=PP%2dDonationsBF&charset=UTF%2d8", false);
 }
 private void onOpenLocationButtonClicked(object sender, EventArgs a)
 {
     CUtility.Execute("gnome-www-browser", @"http://gnomeartng.berlios.de");
 }
Esempio n. 18
0
 public void addImage(string type, CBackgroundImage image)
 {
     //Console.WriteLine(type.ToLower());
     addImage(CUtility.StrToImageType(type), image);
 }