Exemplo n.º 1
0
 private void Start()
 {
     this.Hide();
     Console.WriteLine("Start control center");
     //now notifications
     if (MainClass.updatePkg)
     {
         if(Debug.ModeDebug)
         {
             foreach (packageCheck pkg in Update.UpdatePkg)
             {
                 Console.WriteLine(pkg.packagename+" can be updated to "+pkg.packageversion);
             }
         }
         Outils.Inform("Frugalware","Some update are available.");
         Console.WriteLine("Some packages can be updated.");
     }
     Fen_Menu win = new Fen_Menu();
     win.Show();
 }
Exemplo n.º 2
0
        // Create the popup menu, on right click.
        static void OnTrayIconPopup(object o, EventArgs args)
        {
            Menu popupMenu = new Menu();
                ImageMenuItem menuItemcc = new ImageMenuItem ("Start Control Center");
                Gtk.Image ccimg = new Gtk.Image(Stock.Execute, IconSize.Menu);
                menuItemcc.Image = ccimg;
                popupMenu.Add(menuItemcc);

                ImageMenuItem menuItemccRoot = new ImageMenuItem ("Start Control Center as root");
                Gtk.Image ccimgRoot = new Gtk.Image(Stock.Execute, IconSize.Menu);
                menuItemccRoot.Image = ccimgRoot;
                popupMenu.Add(menuItemccRoot);

                ImageMenuItem menuItemForum = new ImageMenuItem ("Frugalware Forums");
                Gtk.Image Forumimg = new Gtk.Image(Stock.Help, IconSize.Menu);
                menuItemForum.Image = Forumimg;
                popupMenu.Add(menuItemForum);

                ImageMenuItem menuItemWiki = new ImageMenuItem ("Frugalware Wiki");
                Gtk.Image Wikiimg = new Gtk.Image(Stock.Help, IconSize.Menu);
                menuItemWiki.Image = Wikiimg;
                popupMenu.Add(menuItemWiki);

                ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");
                Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
                menuItemQuit.Image = appimg;
                popupMenu.Add(menuItemQuit);

                menuItemForum.Activated += delegate {
                                                    WebkitBrowser browser = new WebkitBrowser("http://forums.frugalware.org");
                                                    browser.Show();
                                                    };
                menuItemWiki.Activated += delegate {
                                                    WebkitBrowser browser = new WebkitBrowser("http://wiki.frugalware.org");
                                                    browser.Show();
                                                    };
                menuItemcc.Activated += delegate {
                                                    if(Fen==null)
                                                    {
                                                        Fen = new Fen_Menu();
                                                        Fen.Show();
                                                    }
                                                    else
                                                    {
                                                        Fen.Destroy();
                                                        Fen.Dispose();
                                                        Fen=null;
                                                    }
                                            };

                menuItemccRoot.Activated += delegate { Outils.Excecute("sucontrolcenter","",false); };

                // Quit the application when quit has been clicked.
                menuItemQuit.Activated += delegate { Application.Quit(); };
                popupMenu.ShowAll();
                popupMenu.Popup();
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            //root options
            if (Mono.Unix.Native.Syscall.getuid()!=0)
                boRoot=false;
            else
                boRoot=true;

            System.Timers.Timer aTimer;
            if(args.Length==0)
            {
                Gtk.Application.Init();
                _checkRoadmap();
                if (configuration.Get_ShowSplash())
                {
                    win = new splash ();
                    win.Show ();
                    Thread th = new Thread(new ThreadStart(checktest));
                    th.IsBackground=true;
                    th.SetApartmentState(ApartmentState.STA);
                    th.Start();
                }
                else
                {
                    System.Threading.Thread.Sleep(1000);
                    Fen = new Fen_Menu();
                    Fen.Show();
                }
                Gtk.Application.Run ();
            }
            else
            {
                Console.WriteLine(args[0]);
                switch(args[0])
                {
                    case "--update":
                        if(configuration.Get_StartWithX())
                        {
                            //check if an update is avalaible
                            //started with X session
                            Gtk.Application.Init();
                            Console.WriteLine("check update packages.");
                            // Creation of the Icon
                            Pixbuf ico = global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.systray.png");

                            trayIcon = new StatusIcon(ico);
                            trayIcon.Visible = true;
                            check();
                            StartedAutomatic=true;
                            aTimer = new System.Timers.Timer();
                 			aTimer.Elapsed+=new ElapsedEventHandler(checkUpdate);
                            // Set the Interval to 1 hour.
                            aTimer.Interval=3600000;
                 			aTimer.Enabled=true;

                            trayIcon.Activate += delegate {
                                if(Fen==null)
                                {
                                    Fen = new Fen_Menu();
                                    Fen.Show();
                                }
                                else
                                {
                                    Fen.Destroy();
                                    Fen.Dispose();
                                    Fen=null;
                                }

                            };

                            // Show a pop up menu when the icon has been right clicked.
                            trayIcon.PopupMenu += OnTrayIconPopup;

                            // A Tooltip for the Icon
                            trayIcon.Tooltip = "Frugalware Control Center";
                            Gtk.Application.Run ();
                        }
                        break;

                    default:
                        Console.WriteLine("Bad parameters exit...");
                        break;
                }
            }
        }