Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=402dea3d293fd3ce2c0f8618b600fed937bba43b

commit 402dea3d293fd3ce2c0f8618b600fed937bba43b
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Tue Sep 14 23:01:09 2010 +0200

*fixes cache
*fixes some inits
*some clean up

diff --git a/frugal-mono-tools/Configuration.cs 
b/frugal-mono-tools/Configuration.cs
index 2f3f7f1..4b2d816 100644
--- a/frugal-mono-tools/Configuration.cs
+++ b/frugal-mono-tools/Configuration.cs
@@ -25,7 +25,6 @@ namespace frugalmonotools
public class Cache
{
private const string confFile=@"/.cache/FrugalTools";
-               private int _nbFlux = 0;
private string _latest="";
public Cache()
{
@@ -36,14 +35,9 @@ namespace frugalmonotools
string[] lines = content.Split('\n');
foreach (string line in lines)
{
-                                        if (Regex.Matches(line, 
"nbRSS").Count>0)
-                                               {
-                                                       int nb = 
int.Parse(line.Split('=')[1]);
-                                                       this.SetNbFlux(nb);
-                                               }
if (Regex.Matches(line, "last").Count>0)
{
-                                                       string last = 
line.Split('=')[1];
+                                                       string last = 
line.Split('"')[1];
this.SetLatest(last);
}
}
@@ -55,8 +49,7 @@ namespace frugalmonotools
try
{
StreamWriter FileConf = new StreamWriter(GetConfFile());
-                               FileConf.WriteLine("nbRSS="+this.GetNbFlux());
-                               FileConf.WriteLine("last="+this.GetLatest());
+                               
FileConf.WriteLine("last=\""+this.GetLatest()+"\"");
FileConf.Close();
}
catch(Exception exe)
@@ -68,14 +61,6 @@ namespace frugalmonotools
return Environment.GetFolderPath(System.Environment.SpecialFolder
.Personal)+confFile;
}
-               public int GetNbFlux()
-               {
-                       return _nbFlux;
-               }
-               public void SetNbFlux(int valeur)
-               {
-                       _nbFlux=valeur;
-               }

public string GetLatest()
{
diff --git a/frugal-mono-tools/Main.cs b/frugal-mono-tools/Main.cs
index c6d3c90..5332ff4 100644
--- a/frugal-mono-tools/Main.cs
+++ b/frugal-mono-tools/Main.cs
@@ -85,7 +85,7 @@ namespace frugalmonotools
}
}
private static splash win;
-               public static StatusIcon trayIcon;
+               public static StatusIcon trayIcon = null ;
// Create the popup menu, on right click.
static void OnTrayIconPopup (object o, EventArgs args) {
Menu popupMenu = new Menu();
diff --git a/frugal-mono-tools/WID_Hardware.cs 
b/frugal-mono-tools/WID_Hardware.cs
index 254f25b..98d55d0 100644
--- a/frugal-mono-tools/WID_Hardware.cs
+++ b/frugal-mono-tools/WID_Hardware.cs
@@ -27,11 +27,7 @@ namespace frugalmonotools
}
public void InitHardware()
{
-                       if(!MainClass.boRoot)
-                       {
-                               BTN_Setup.Visible = false;
-                       }
-                       
if(!MainClass.pacmanG2.IsInstalled("system-config-printer"))
+               if(!MainClass.pacmanG2.IsInstalled("system-config-printer"))
{
BTN_Printer.Visible=false;
LAB_Printer.Visible=true;
@@ -51,7 +47,10 @@ namespace frugalmonotools
BTN_Setup.Visible=true;
LIB_Setup.Visible=false;
}
-
+               if(!MainClass.boRoot)
+               {
+                       BTN_Setup.Visible = false;
+               }
string dmesgOutput=Outils.ReadFile( 
"/var/log/syslog");//Outils.getoutput("/bin/dmesg");
if(dmesgOutput.IndexOf("lirc")>0)
{
diff --git a/frugal-mono-tools/WID_Network.cs b/frugal-mono-tools/WID_Network.cs
index e5435c4..a47bf67 100644
--- a/frugal-mono-tools/WID_Network.cs
+++ b/frugal-mono-tools/WID_Network.cs
@@ -31,18 +31,12 @@ namespace frugalmonotools
if(!MainClass.boRoot)
BTN_Network.Visible=false;
//network init
-               INT_NM.Active=Outils.ServiceOnStartUp("S99rc.networkmanager");
-               EnableDisable(INT_NM,"networkmanager",LIB_NMNotInstalled);
-               INT_WICD.Active=Outils.ServiceOnStartUp("S99rc.wicd");
EnableDisable(INT_WICD,"wicd",LIB_WICDNotInstalled);
-               if((!INT_NM.Active) && (!INT_WICD.Active))
-               {
-                       INT_FW.Active=true;
-               }
-               else
-               {
-                       INT_FW.Active=false;
-               }
+               EnableDisable(INT_NM,"networkmanager",LIB_NMNotInstalled);
+               Service nm = new Service("networkmanager");
+               INT_NM.Active=nm.IsStartedOnBoot();
+               Service wicd = new Service("wicd");
+               INT_WICD.Active=wicd.IsStartedOnBoot();
}

public void EnableDisable(CheckButton INT_Option,string packageName, Label text)
diff --git a/frugal-mono-tools/WID_Services.cs 
b/frugal-mono-tools/WID_Services.cs
index 3a90016..d1b2a6f 100644
--- a/frugal-mono-tools/WID_Services.cs
+++ b/frugal-mono-tools/WID_Services.cs
@@ -32,6 +32,14 @@ namespace frugalmonotools
}
public void InitService()
{
+               ServicesRc.CheckList();
+               if(!MainClass.boRoot)
+               {
+                                       BTN_ServiceStop.Visible=false;
+                                       BTN_ServiceStart.Visible=false;
+                                       BTN_ServiceDelBoot.Visible=false;
+                                       BTN_ServiceAddBoot.Visible=false;
+               }
// services
Gtk.TreeViewColumn ColumnServiceName = new Gtk.TreeViewColumn ();
ColumnServiceName.Title = "Services";
@@ -64,7 +72,8 @@ namespace frugalmonotools
ColumnServiceDesc.PackStart (ServiceDescCell, true);
TREE_Services.AppendColumn (ColumnServiceDesc);
ColumnServiceDesc.AddAttribute (ServiceDescCell, "text", 3);
-
+               serviceListStore.Clear();
+
foreach(Service service in ServicesRc.Services)
{
string Etat = "yes";
diff --git a/frugal-mono-tools/WID_Update.cs b/frugal-mono-tools/WID_Update.cs
index ec37df4..a261ba0 100644
--- a/frugal-mono-tools/WID_Update.cs
+++ b/frugal-mono-tools/WID_Update.cs
@@ -29,6 +29,18 @@ namespace frugalmonotools
public WID_Update ()
{
this.Build ();
+                       //update package list
+                       // Create a column for the package name
+                       Gtk.TreeViewColumn pkgupdateColumn = new 
Gtk.TreeViewColumn ();
+                       pkgupdateColumn.Title = "Package name";
+                       Gtk.CellRendererText pkgupdateNameCell = new 
Gtk.CellRendererText ();
+                       // Add the cell to the column
+                       pkgupdateColumn.PackStart (pkgupdateNameCell, true);
+                       TREE_UpdatePkg.AppendColumn (pkgupdateColumn);
+                       pkgupdateColumn.AddAttribute (pkgupdateNameCell, 
"text", 0);
+                       // Event on treeview
+                       TREE_UpdatePkg.Selection.Changed += 
OnSelectionEntryUpdate;
+                       TREE_UpdatePkg.Model=UpdateListStore;
}
public  void InitUpdate()
{
@@ -36,19 +48,9 @@ namespace frugalmonotools
{
BTN_UpdateDatabase.Visible = false;
BTN_ApplyIgnorePkg.Visible=false;
+                       BTN_Hide.Visible=false;
+                       BTN_Update.Visible=false;
}
-               //update package list
-               // Create a column for the package name
-               Gtk.TreeViewColumn pkgupdateColumn = new Gtk.TreeViewColumn ();
-               pkgupdateColumn.Title = "Package name";
-               Gtk.CellRendererText pkgupdateNameCell = new 
Gtk.CellRendererText ();
-               // Add the cell to the column
-               pkgupdateColumn.PackStart (pkgupdateNameCell, true);
-               TREE_UpdatePkg.AppendColumn (pkgupdateColumn);
-               pkgupdateColumn.AddAttribute (pkgupdateNameCell, "text", 0);
-               // Event on treeview
-               TREE_UpdatePkg.Selection.Changed += OnSelectionEntryUpdate;
-               TREE_UpdatePkg.Model=UpdateListStore;

//update
UpdateToTreeview();
@@ -65,26 +67,32 @@ namespace frugalmonotools
}
private void _refreshUpdate()
{
-               if(Update.CheckUpdate())
-               {
-                       Gdk.Pixbuf ico = global::Gdk.Pixbuf.LoadFromResource 
("frugalmonotools.Pictures.systray.png");
-                       MainClass.trayIcon.Pixbuf=ico;
-               }
-               else
-               {
-                       Gdk.Pixbuf ico = global::Gdk.Pixbuf.LoadFromResource 
("frugalmonotools.Pictures.systray.png");
-                       MainClass.trayIcon.Pixbuf=ico;
-               }
-               UpdateToTreeview();
+                       if(Update.CheckUpdate())
+                       {
+                               if (MainClass.trayIcon!=null)
+                               {
+                                       Gdk.Pixbuf ico = 
global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.systray.png");
+                                       MainClass.trayIcon.Pixbuf=ico;
+                               }
+                       }
+                       else
+                       {
+                               if(MainClass.trayIcon!=null)
+                               {
+                                       Gdk.Pixbuf ico = 
global::Gdk.Pixbuf.LoadFromResource ("frugalmonotools.Pictures.systray.png");
+                                       MainClass.trayIcon.Pixbuf=ico;
+                               }
+                       }
+                       UpdateToTreeview();
}
public void UpdateToTreeview()
{
-               UpdateListStore.Clear();
-               foreach (packageCheck package in Update.UpdatePkg)
-                       {
-                       // Add some data to the store
-                       UpdateListStore.AppendValues 
(package.packagename+"-"+package.packageversion);
-                       }
+                       UpdateListStore.Clear();
+                       foreach (packageCheck package in Update.UpdatePkg)
+                               {
+                               // Add some data to the store
+                               UpdateListStore.AppendValues 
(package.packagename+"-"+package.packageversion);
+                               }
}
protected void OnSelectionEntryUpdate(object o, EventArgs args)
{
diff --git a/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Update.cs 
b/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Update.cs
index cd129d5..94320c9 100644
--- a/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Update.cs
+++ b/frugal-mono-tools/gtk-gui/frugalmonotools.WID_Update.cs
@@ -97,7 +97,7 @@ namespace frugalmonotools
this.BTN_Hide.CanFocus = true;
this.BTN_Hide.Name = "BTN_Hide";
this.BTN_Hide.UseUnderline = true;
-                       this.BTN_Hide.Label = 
global::Mono.Unix.Catalog.GetString ("Hide this update package");
+                       this.BTN_Hide.Label = 
global::Mono.Unix.Catalog.GetString ("Hide this package");
this.hbox22.Add (this.BTN_Hide);
global::Gtk.Box.BoxChild w7 = 
((global::Gtk.Box.BoxChild)(this.hbox22[this.BTN_Hide]));
w7.Position = 0;
@@ -108,7 +108,7 @@ namespace frugalmonotools
this.BTN_UpdateDatabase.CanFocus = true;
this.BTN_UpdateDatabase.Name = "BTN_UpdateDatabase";
this.BTN_UpdateDatabase.UseUnderline = true;
-                       this.BTN_UpdateDatabase.Label = 
global::Mono.Unix.Catalog.GetString ("Update pacman-g2 database");
+                       this.BTN_UpdateDatabase.Label = 
global::Mono.Unix.Catalog.GetString ("Update database");
this.hbox22.Add (this.BTN_UpdateDatabase);
global::Gtk.Box.BoxChild w8 = 
((global::Gtk.Box.BoxChild)(this.hbox22[this.BTN_UpdateDatabase]));
w8.Position = 1;
diff --git a/frugal-mono-tools/gtk-gui/gui.stetic 
b/frugal-mono-tools/gtk-gui/gui.stetic
index 05e9e86..c626ed9 100644
--- a/frugal-mono-tools/gtk-gui/gui.stetic
+++ b/frugal-mono-tools/gtk-gui/gui.stetic
@@ -514,7 +514,7 @@
<property name="Visible">False</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
-                <property name="Label" translatable="yes">Hide this update 
package</property>
+                <property name="Label" translatable="yes">Hide this 
package</property>
<property name="UseUnderline">True</property>
<signal name="Clicked" handler="OnBTNHideClicked" />
</widget>
@@ -530,7 +530,7 @@
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
-                <property name="Label" translatable="yes">Update pacman-g2 
database</property>
+                <property name="Label" translatable="yes">Update 
database</property>
<property name="UseUnderline">True</property>
<signal name="Clicked" handler="OnBTNUpdateDatabaseClicked" />
</widget>
diff --git a/frugal-mono-tools/splash.cs b/frugal-mono-tools/splash.cs
index d97ee98..80da2f1 100644
--- a/frugal-mono-tools/splash.cs
+++ b/frugal-mono-tools/splash.cs
@@ -13,7 +13,6 @@ namespace frugalmonotools

private void Start() {
Fen_Menu win = new Fen_Menu();
-                       win.Show();
this.Hide();
Console.WriteLine("Start control center");
//now notifications
@@ -29,7 +28,7 @@ namespace frugalmonotools
Outils.Inform("Frugalware","Some update are available.");
Console.WriteLine("Some packages can be updated.");
}
-
+                       win.Show();
}
public void InitFinish()
{
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to