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

commit e9fef0ef294410a6557f4ebfbb0f7d5a2bc4cb8c
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Mon Aug 30 18:20:42 2010 +0000

*added basic configuration
*by default don't check on startup (more quicly, have some daemon for alert)
*added notebook configuration not yet implemented

diff --git a/frugal-mono-tools/Configuration.cs 
b/frugal-mono-tools/Configuration.cs
new file mode 100644
index 0000000..ff2d269
--- /dev/null
+++ b/frugal-mono-tools/Configuration.cs
@@ -0,0 +1,74 @@
+/*
+ *  Copyright (C) 2010 by Gaetan Gourdin <bouleet...@frogdev.info>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+using System;
+using System.Text.RegularExpressions;
+using System.IO;
+namespace frugalmonotools
+{
+       public class Configuration
+       {
+
+               private const string confFile=".config/FrugalTools.conf";
+               private bool _checkUpdate = false;
+               public string GetConfFile(){
+                       return "~/"+confFile;
+               }
+               public bool Get_CheckUpdate()
+               {
+                       return _checkUpdate;
+               }
+               public void Set_CheckUpdate(bool valeur)
+               {
+                       _checkUpdate=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(false);
+                                       }
+                       }
+                       }
+                       catch
+                       {
+                               //default value
+                       }
+
+
+               }
+               public void ConfSave()
+               {
+                       try
+                       {
+                               StreamWriter FileConf = new 
StreamWriter(GetConfFile());
+                               if (Get_CheckUpdate()) 
FileConf.WriteLine("checkupdate");
+                               FileConf.Close();
+                       }
+                       catch{}
+               }
+       }
+}
+
diff --git a/frugal-mono-tools/Main.cs b/frugal-mono-tools/Main.cs
index bfa7bfd..3149ebe 100644
--- a/frugal-mono-tools/Main.cs
+++ b/frugal-mono-tools/Main.cs
@@ -29,6 +29,7 @@ namespace frugalmonotools
{
//pacman-g2 initialise
public static PacmanG2 pacmanG2 = new PacmanG2();
+               public static Configuration configuration = new Configuration();

private static void checkUpdate(object source, ElapsedEventArgs e)
{
@@ -38,7 +39,8 @@ namespace frugalmonotools
public static bool updatePkg = false;
public static void checktest()
{
-                       updatePkg=Update.CheckUpdate();
+                       if (configuration.Get_CheckUpdate())
+                               updatePkg=Update.CheckUpdate();
win.InitFinish();
}

@@ -67,12 +69,12 @@ namespace frugalmonotools
if(args.Length==0)
{
Gtk.Application.Init();
+                               win = new splash ();
+                               win.Show ();
Thread th = new Thread(new ThreadStart(checktest));
th.IsBackground=true;
th.SetApartmentState(ApartmentState.STA);
th.Start();
-                               win = new splash ();
-                               win.Show ();
Gtk.Application.Run ();
}
else
diff --git a/frugal-mono-tools/frugal-mono-tools.csproj 
b/frugal-mono-tools/frugal-mono-tools.csproj
index 4a2d33d..ed77433 100644
--- a/frugal-mono-tools/frugal-mono-tools.csproj
+++ b/frugal-mono-tools/frugal-mono-tools.csproj
@@ -80,6 +80,7 @@
<Compile Include="IconSummaryBody.cs" />
<Compile Include="splash.cs" />
<Compile Include="gtk-gui\frugalmonotools.splash.cs" />
+    <Compile Include="Configuration.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
diff --git a/frugal-mono-tools/gtk-gui/MainWindow.cs 
b/frugal-mono-tools/gtk-gui/MainWindow.cs
index 35653a5..a1023ba 100644
--- a/frugal-mono-tools/gtk-gui/MainWindow.cs
+++ b/frugal-mono-tools/gtk-gui/MainWindow.cs
@@ -177,11 +177,13 @@ public partial class MainWindow

private global::Gtk.Label LIB_News;

+       private global::Gtk.Label Configuration;
+
private global::Gtk.ScrolledWindow GtkScrolledWindow2;

private global::Gtk.TextView textview2;

-       private global::Gtk.Label label5;
+       private global::Gtk.Label label6;

protected virtual void Build ()
{
@@ -195,7 +197,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 = 0;
+               this.ONG_principal.CurrentPage = 8;
// Container child ONG_principal.Gtk.Notebook+NotebookChild
this.vbox4 = new global::Gtk.VBox ();
this.vbox4.Name = "vbox4";
@@ -1007,6 +1009,15 @@ public partial class MainWindow
this.LIB_News.LabelProp = global::Mono.Unix.Catalog.GetString ("News");
this.ONG_principal.SetTabLabel (this.vbox5, this.LIB_News);
this.LIB_News.ShowAll ();
+               // Notebook tab
+               global::Gtk.Label w80 = new global::Gtk.Label ();
+               w80.Visible = true;
+               this.ONG_principal.Add (w80);
+               this.Configuration = new global::Gtk.Label ();
+               this.Configuration.Name = "Configuration";
+               this.Configuration.LabelProp = 
global::Mono.Unix.Catalog.GetString ("Configuration");
+               this.ONG_principal.SetTabLabel (w80, this.Configuration);
+               this.Configuration.ShowAll ();
// Container child ONG_principal.Gtk.Notebook+NotebookChild
this.GtkScrolledWindow2 = new global::Gtk.ScrolledWindow ();
this.GtkScrolledWindow2.Name = "GtkScrolledWindow2";
@@ -1018,14 +1029,14 @@ public partial class MainWindow
this.textview2.Name = "textview2";
this.GtkScrolledWindow2.Add (this.textview2);
this.ONG_principal.Add (this.GtkScrolledWindow2);
-               global::Gtk.Notebook.NotebookChild w81 = 
((global::Gtk.Notebook.NotebookChild)(this.ONG_principal[this.GtkScrolledWindow2]));
-               w81.Position = 7;
+               global::Gtk.Notebook.NotebookChild w82 = 
((global::Gtk.Notebook.NotebookChild)(this.ONG_principal[this.GtkScrolledWindow2]));
+               w82.Position = 8;
// Notebook tab
-               this.label5 = new global::Gtk.Label ();
-               this.label5.Name = "label5";
-               this.label5.LabelProp = global::Mono.Unix.Catalog.GetString 
("About");
-               this.ONG_principal.SetTabLabel (this.GtkScrolledWindow2, 
this.label5);
-               this.label5.ShowAll ();
+               this.label6 = new global::Gtk.Label ();
+               this.label6.Name = "label6";
+               this.label6.LabelProp = global::Mono.Unix.Catalog.GetString 
("About");
+               this.ONG_principal.SetTabLabel (this.GtkScrolledWindow2, 
this.label6);
+               this.label6.ShowAll ();
this.Add (this.ONG_principal);
if ((this.Child != null)) {
this.Child.ShowAll ();
diff --git a/frugal-mono-tools/gtk-gui/gui.stetic 
b/frugal-mono-tools/gtk-gui/gui.stetic
index 6da5ae2..ca4d345 100644
--- a/frugal-mono-tools/gtk-gui/gui.stetic
+++ b/frugal-mono-tools/gtk-gui/gui.stetic
@@ -20,7 +20,7 @@
<widget class="Gtk.Notebook" id="ONG_principal">
<property name="MemberName" />
<property name="CanFocus">True</property>
-        <property name="CurrentPage">0</property>
+        <property name="CurrentPage">8</property>
<child>
<widget class="Gtk.VBox" id="vbox4">
<property name="MemberName" />
@@ -1179,6 +1179,18 @@ ztv</property>
</packing>
</child>
<child>
+          <placeholder />
+        </child>
+        <child>
+          <widget class="Gtk.Label" id="Configuration">
+            <property name="MemberName" />
+            <property name="LabelProp" 
translatable="yes">Configuration</property>
+          </widget>
+          <packing>
+            <property name="type">tab</property>
+          </packing>
+        </child>
+        <child>
<widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow2">
<property name="MemberName" />
<property name="ShadowType">In</property>
@@ -1537,11 +1549,11 @@ Public License instead of this License.
</child>
</widget>
<packing>
-            <property name="Position">7</property>
+            <property name="Position">8</property>
</packing>
</child>
<child>
-          <widget class="Gtk.Label" id="label5">
+          <widget class="Gtk.Label" id="label6">
<property name="MemberName" />
<property name="LabelProp" translatable="yes">About</property>
</widget>
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to