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);
        }
 private void onRestartClicked(object sender, EventArgs a)
 {
     removeClickHandler(onRestartClicked);
     //restart the application
     CUtility.Execute(System.Windows.Forms.Application.ExecutablePath, "", false);
     RestartRequested = true;
     Close();
 }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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;
     }
 }
예제 #6
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\"");
 }
 private void onOpenLocationButtonClicked(object sender, EventArgs a)
 {
     CUtility.Execute("gnome-www-browser", @"http://gnomeartng.berlios.de");
 }
 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);
 }