Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-mono-tools.git;a=commitdiff;h=43e78b267ed0d29d290f72748aad881baf23c957

commit 43e78b267ed0d29d290f72748aad881baf23c957
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Tue Aug 31 21:48:10 2010 +0200

*added configuration for disable it when x session is started

diff --git a/frugal-mono-tools/Configuration.cs 
b/frugal-mono-tools/Configuration.cs
index bcfe33d..24208af 100644
--- a/frugal-mono-tools/Configuration.cs
+++ b/frugal-mono-tools/Configuration.cs
@@ -25,6 +25,7 @@ namespace frugalmonotools

private const string confFile=@"/.config/FrugalTools.conf";
private bool _checkUpdate = false;
+               private bool _startWithX = true;
public string GetConfFile(){
return Environment.GetFolderPath(System.Environment.SpecialFolder
.Personal)+confFile;
@@ -37,21 +38,32 @@ namespace frugalmonotools
{
_checkUpdate=valeur;
}
-
+               public bool Get_StartWithX()
+               {
+                       return _startWithX;
+               }
+               public void Set_StartWithX(bool valeur)
+               {
+                       _startWithX=valeur;
+               }
public Configuration ()
{
//read value
try{
-                       string filedesc = GetConfFile();
-                       string content = Outils.ReadFile(filedesc);
-                       string[] lines = content.Split('\n');
-                       foreach (string line in lines)
-                       {
-                                if (Regex.Matches(line, "checkupdate").Count>0)
-                                       {
-                                               Set_CheckUpdate(true);
-                                       }
-                       }
+                               string filedesc = GetConfFile();
+                               string content = Outils.ReadFile(filedesc);
+                               string[] lines = content.Split('\n');
+                               foreach (string line in lines)
+                               {
+                                        if (Regex.Matches(line, 
"checkupdate").Count>0)
+                                               {
+                                                       Set_CheckUpdate(true);
+                                               }
+                                       if (Regex.Matches(line, 
"dontstartwithx").Count>0)
+                                               {
+                                                       Set_StartWithX(false);
+                                               }
+                               }
}
catch
{
@@ -66,6 +78,7 @@ namespace frugalmonotools
{
StreamWriter FileConf = new StreamWriter(GetConfFile());
if (Get_CheckUpdate()) FileConf.WriteLine("checkupdate");
+                               if (!Get_StartWithX()) 
FileConf.WriteLine("dontstartwithx");
FileConf.Close();
}
catch(Exception exe)
diff --git a/frugal-mono-tools/Main.cs b/frugal-mono-tools/Main.cs
index 5452ab1..fa7b55b 100644
--- a/frugal-mono-tools/Main.cs
+++ b/frugal-mono-tools/Main.cs
@@ -117,26 +117,29 @@ namespace frugalmonotools
switch(args[0])
{
case "--update":
-                                               //check if an update is 
avalaible
-                                               //started with X session
-                                               Gtk.Application.Init();
-                                               Console.WriteLine("check update 
packages.");
-                                               check();
-                                               aTimer = new 
System.Timers.Timer();
-                                       aTimer.Elapsed+=new 
ElapsedEventHandler(checkUpdate);
-                                       // Set the Interval to 1 hour.
-                                       aTimer.Interval=3600000;
-                                       aTimer.Enabled=true;
-                                               // Creation of the Icon
-                                               trayIcon = new StatusIcon(new 
Pixbuf ("/usr/share/pixmaps/FrugalTools.png"));
-                                               trayIcon.Visible = true;
-
-                                               // 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 ();
+                                               
if(configuration.Get_StartWithX())
+                                               {
+                                                       //check if an update is 
avalaible
+                                                       //started with X session
+                                                       Gtk.Application.Init();
+                                                       
Console.WriteLine("check update packages.");
+                                                       check();
+                                                       aTimer = new 
System.Timers.Timer();
+                                               aTimer.Elapsed+=new 
ElapsedEventHandler(checkUpdate);
+                                               // Set the Interval to 1 hour.
+                                               aTimer.Interval=3600000;
+                                               aTimer.Enabled=true;
+                                                       // Creation of the Icon
+                                                       trayIcon = new 
StatusIcon(new Pixbuf ("/usr/share/pixmaps/FrugalTools.png"));
+                                                       trayIcon.Visible = true;
+
+                                                       // 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:
diff --git a/frugal-mono-tools/MainWindow.cs b/frugal-mono-tools/MainWindow.cs
index 8169c45..8d7c5dd 100644
--- a/frugal-mono-tools/MainWindow.cs
+++ b/frugal-mono-tools/MainWindow.cs
@@ -274,6 +274,7 @@ public partial class MainWindow : Gtk.Window

//configuration
INT_CheckStartup.Active=MainClass.configuration.Get_CheckUpdate();
+               
INT_StartWithXSession.Active=MainClass.configuration.Get_StartWithX();
}

protected void OnDeleteEvent (object sender, DeleteEventArgs a)
@@ -720,6 +721,7 @@ public partial class MainWindow : Gtk.Window
protected virtual void OnBTNSaveConfClicked (object sender, System.EventArgs e)
{
MainClass.configuration.Set_CheckUpdate(INT_CheckStartup.Active);
+               
MainClass.configuration.Set_StartWithX(INT_StartWithXSession.Active);
MainClass.configuration.ConfSave();
}

diff --git a/frugal-mono-tools/gtk-gui/MainWindow.cs 
b/frugal-mono-tools/gtk-gui/MainWindow.cs
index bd6af09..5af816c 100644
--- a/frugal-mono-tools/gtk-gui/MainWindow.cs
+++ b/frugal-mono-tools/gtk-gui/MainWindow.cs
@@ -181,6 +181,8 @@ public partial class MainWindow

private global::Gtk.CheckButton INT_CheckStartup;

+       private global::Gtk.CheckButton INT_StartWithXSession;
+
private global::Gtk.HBox hbox21;

private global::Gtk.Button BTN_SaveConf;
@@ -205,7 +207,7 @@ public partial class MainWindow
this.ONG_principal = new global::Gtk.Notebook ();
this.ONG_principal.CanFocus = true;
this.ONG_principal.Name = "ONG_principal";
-               this.ONG_principal.CurrentPage = 2;
+               this.ONG_principal.CurrentPage = 7;
// Container child ONG_principal.Gtk.Notebook+NotebookChild
this.vbox4 = new global::Gtk.VBox ();
this.vbox4.Name = "vbox4";
@@ -1025,7 +1027,7 @@ public partial class MainWindow
this.INT_CheckStartup = new global::Gtk.CheckButton ();
this.INT_CheckStartup.CanFocus = true;
this.INT_CheckStartup.Name = "INT_CheckStartup";
-               this.INT_CheckStartup.Label = 
global::Mono.Unix.Catalog.GetString ("Check update on startup");
+               this.INT_CheckStartup.Label = 
global::Mono.Unix.Catalog.GetString ("Check update on frugal-mono-tools 
startup");
this.INT_CheckStartup.DrawIndicator = true;
this.INT_CheckStartup.UseUnderline = true;
this.vbox8.Add (this.INT_CheckStartup);
@@ -1034,6 +1036,19 @@ public partial class MainWindow
w80.Expand = false;
w80.Fill = false;
// Container child vbox8.Gtk.Box+BoxChild
+               this.INT_StartWithXSession = new global::Gtk.CheckButton ();
+               this.INT_StartWithXSession.CanFocus = true;
+               this.INT_StartWithXSession.Name = "INT_StartWithXSession";
+               this.INT_StartWithXSession.Label = 
global::Mono.Unix.Catalog.GetString ("Start with X session");
+               this.INT_StartWithXSession.Active = true;
+               this.INT_StartWithXSession.DrawIndicator = true;
+               this.INT_StartWithXSession.UseUnderline = true;
+               this.vbox8.Add (this.INT_StartWithXSession);
+               global::Gtk.Box.BoxChild w81 = 
((global::Gtk.Box.BoxChild)(this.vbox8[this.INT_StartWithXSession]));
+               w81.Position = 1;
+               w81.Expand = false;
+               w81.Fill = false;
+               // Container child vbox8.Gtk.Box+BoxChild
this.hbox21 = new global::Gtk.HBox ();
this.hbox21.Name = "hbox21";
this.hbox21.Spacing = 6;
@@ -1044,18 +1059,18 @@ public partial class MainWindow
this.BTN_SaveConf.UseUnderline = true;
this.BTN_SaveConf.Label = global::Mono.Unix.Catalog.GetString ("Apply");
this.hbox21.Add (this.BTN_SaveConf);
-               global::Gtk.Box.BoxChild w81 = 
((global::Gtk.Box.BoxChild)(this.hbox21[this.BTN_SaveConf]));
-               w81.Position = 2;
-               w81.Expand = false;
-               w81.Fill = false;
-               this.vbox8.Add (this.hbox21);
-               global::Gtk.Box.BoxChild w82 = 
((global::Gtk.Box.BoxChild)(this.vbox8[this.hbox21]));
+               global::Gtk.Box.BoxChild w82 = 
((global::Gtk.Box.BoxChild)(this.hbox21[this.BTN_SaveConf]));
w82.Position = 2;
w82.Expand = false;
w82.Fill = false;
+               this.vbox8.Add (this.hbox21);
+               global::Gtk.Box.BoxChild w83 = 
((global::Gtk.Box.BoxChild)(this.vbox8[this.hbox21]));
+               w83.Position = 3;
+               w83.Expand = false;
+               w83.Fill = false;
this.ONG_principal.Add (this.vbox8);
-               global::Gtk.Notebook.NotebookChild w83 = 
((global::Gtk.Notebook.NotebookChild)(this.ONG_principal[this.vbox8]));
-               w83.Position = 7;
+               global::Gtk.Notebook.NotebookChild w84 = 
((global::Gtk.Notebook.NotebookChild)(this.ONG_principal[this.vbox8]));
+               w84.Position = 7;
// Notebook tab
this.Configuration = new global::Gtk.Label ();
this.Configuration.Name = "Configuration";
@@ -1073,8 +1088,8 @@ public partial class MainWindow
this.textview2.Name = "textview2";
this.GtkScrolledWindow2.Add (this.textview2);
this.ONG_principal.Add (this.GtkScrolledWindow2);
-               global::Gtk.Notebook.NotebookChild w85 = 
((global::Gtk.Notebook.NotebookChild)(this.ONG_principal[this.GtkScrolledWindow2]));
-               w85.Position = 8;
+               global::Gtk.Notebook.NotebookChild w86 = 
((global::Gtk.Notebook.NotebookChild)(this.ONG_principal[this.GtkScrolledWindow2]));
+               w86.Position = 8;
// Notebook tab
this.label6 = new global::Gtk.Label ();
this.label6.Name = "label6";
diff --git a/frugal-mono-tools/gtk-gui/gui.stetic 
b/frugal-mono-tools/gtk-gui/gui.stetic
index 7c94b65..ec97857 100644
--- a/frugal-mono-tools/gtk-gui/gui.stetic
+++ b/frugal-mono-tools/gtk-gui/gui.stetic
@@ -8,8 +8,8 @@
<widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
<widget-library name="webkit-sharp, Version=1.1.15.0, Culture=neutral, 
PublicKeyToken=eaa1d335d2e19745" />
<widget-library name="notify-sharp, Version=0.4.0.0, Culture=neutral, 
PublicKeyToken=2df29c54e245917a" />
-    <widget-library name="../bin/Debug/frugal-mono-tools.exe" internal="true" 
/>
<widget-library name="vte-sharp, Version=0.16.0.0, Culture=neutral, 
PublicKeyToken=35e10195dab3c99f" />
+    <widget-library name="../bin/Debug/frugal-mono-tools.exe" internal="true" 
/>
</import>
<icon-factory>
<icon-set id="iconeFwCC">
@@ -28,7 +28,7 @@
<widget class="Gtk.Notebook" id="ONG_principal">
<property name="MemberName" />
<property name="CanFocus">True</property>
-        <property name="CurrentPage">2</property>
+        <property name="CurrentPage">7</property>
<child>
<widget class="Gtk.VBox" id="vbox4">
<property name="MemberName" />
@@ -1195,7 +1195,7 @@ ztv</property>
<widget class="Gtk.CheckButton" id="INT_CheckStartup">
<property name="MemberName" />
<property name="CanFocus">True</property>
-                <property name="Label" translatable="yes">Check update on 
startup</property>
+                <property name="Label" translatable="yes">Check update on 
frugal-mono-tools startup</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
@@ -1208,6 +1208,23 @@ ztv</property>
</packing>
</child>
<child>
+              <widget class="Gtk.CheckButton" id="INT_StartWithXSession">
+                <property name="MemberName" />
+                <property name="CanFocus">True</property>
+                <property name="Label" translatable="yes">Start with X 
session</property>
+                <property name="Active">True</property>
+                <property name="DrawIndicator">True</property>
+                <property name="HasLabel">True</property>
+                <property name="UseUnderline">True</property>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+                <property name="AutoSize">True</property>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+            <child>
<placeholder />
</child>
<child>
@@ -1238,7 +1255,7 @@ ztv</property>
</child>
</widget>
<packing>
-                <property name="Position">2</property>
+                <property name="Position">3</property>
<property name="AutoSize">True</property>
<property name="Expand">False</property>
<property name="Fill">False</property>
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to