Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=0998de1603a41046391e59db3d9bee1fede805b2
commit 0998de1603a41046391e59db3d9bee1fede805b2 Author: bouleetbil <bouleet...@frogdev.info> Date: Fri Sep 10 13:37:36 2010 +0000 *can change IgnorePkg diff --git a/frugal-mono-tools/MainWindow.cs b/frugal-mono-tools/MainWindow.cs index 281c33a..d5fc5ea 100644 --- a/frugal-mono-tools/MainWindow.cs +++ b/frugal-mono-tools/MainWindow.cs @@ -1045,41 +1045,8 @@ public partial class MainWindow : Gtk.Window protected virtual void OnBTNHideClicked (object sender, System.EventArgs e) { - try - { - if(UpdateSelected=="") return; - string pacmanConf = @"/etc/pacman-g2.conf"; - string strPacmanConf =Outils.ReadFile(pacmanConf); - string[] lines = strPacmanConf.Split('\n'); - string[] result= new string[lines.Length]; - string lineResult; - int i = 0; - foreach (string line in lines) - { - lineResult=line; - if (System.Text.RegularExpressions.Regex.Matches(line, "IgnorePkg").Count>0) - { - //find it :p - lineResult=lineResult.Replace("=","= "+UpdateSelected+" "); - lineResult=lineResult.Replace("#",""); - MainClass.pacmanG2.ignorePkg.Add(UpdateSelected); - } - result[i]=lineResult; - i++; - } - StreamWriter File = new StreamWriter(pacmanConf); - foreach (string line in result) - { - File.WriteLine(line); - } - File.Close(); - IgnorepkgToSAI(); - } - catch(Exception exe) - { - Console.WriteLine("Can't update pacman-g2.conf"); - Console.WriteLine(exe.Message); - } + MainClass.pacmanG2.SetIgnorePkg(UpdateSelected,false); + IgnorepkgToSAI(); } protected virtual void OnBTNIrc1Clicked (object sender, System.EventArgs e) @@ -1099,14 +1066,16 @@ public partial class MainWindow : Gtk.Window confSystem.Save(); } - protected virtual void OnButton2Clicked (object sender, System.EventArgs e) + protected virtual void OnBTNApplyIgnorePkgClicked (object sender, System.EventArgs e) { - MainClass.DbusCom.Hello("test"); + MainClass.pacmanG2.SetIgnorePkg(SAI_ignorePkg.Text,true); + IgnorepkgToSAI(); } + } diff --git a/frugal-mono-tools/PacmanG2.cs b/frugal-mono-tools/PacmanG2.cs index a32ace6..42c6e02 100644 --- a/frugal-mono-tools/PacmanG2.cs +++ b/frugal-mono-tools/PacmanG2.cs @@ -177,8 +177,57 @@ namespace frugalmonotools } catch{} } + public void SetIgnorePkg(string packagename,bool updateAllIgnore ) + { + try + { + if(packagename=="") return; + string strPacmanConf =Outils.ReadFile(cch_pacmanconf); + string[] lines = strPacmanConf.Split('\n'); + string[] result= new string[lines.Length]; + string lineResult; + int i = 0; + foreach (string line in lines) + { + lineResult=line; + if (System.Text.RegularExpressions.Regex.Matches(line, "IgnorePkg").Count>0) + { + //find it :p + if(updateAllIgnore) + { + lineResult="IgnorePkg = "+ packagename; + } + else + { + lineResult=lineResult.Replace("=","= "+packagename+" "); + lineResult=lineResult.Replace("#",""); + this.ignorePkg.Add(packagename); + } + } + result[i]=lineResult; + i++; + } + StreamWriter File = new StreamWriter(cch_pacmanconf); + foreach (string line in result) + { + File.WriteLine(line); + } + File.Close(); + + } + catch(Exception exe) + { + Console.WriteLine("Can't update pacman-g2.conf"); + Console.WriteLine(exe.Message); + } + if(updateAllIgnore) + { + _ReadIgnorePkg(); + } + } private void _ReadIgnorePkg(){ try{ + ignorePkg.Clear(); string filedesc = cch_pacmanconf; string content = Outils.ReadFile(filedesc); string[] lines = content.Split('\n'); diff --git a/frugal-mono-tools/gtk-gui/MainWindow.cs b/frugal-mono-tools/gtk-gui/MainWindow.cs index 6221272..a45b8fe 100644 --- a/frugal-mono-tools/gtk-gui/MainWindow.cs +++ b/frugal-mono-tools/gtk-gui/MainWindow.cs @@ -319,7 +319,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 = 6; + this.ONG_principal.CurrentPage = 1; // Container child ONG_principal.Gtk.Notebook+NotebookChild this.vbox4 = new global::Gtk.VBox (); this.vbox4.Name = "vbox4"; @@ -1732,7 +1732,6 @@ public partial class MainWindow } this.DefaultWidth = 1064; this.DefaultHeight = 536; - this.BTN_ApplyIgnorePkg.Hide (); this.BTN_Hide.Hide (); this.BTN_Setup.Hide (); this.BTN_ServiceStart.Hide (); @@ -1745,6 +1744,7 @@ public partial class MainWindow this.BTN_Search.Clicked += new global::System.EventHandler (this.OnBTNSearchClicked); this.BTN_Uninstall.Clicked += new global::System.EventHandler (this.OnBTNUninstallClicked); this.BTN_Install.Clicked += new global::System.EventHandler (this.OnBTNInstallClicked); + this.BTN_ApplyIgnorePkg.Clicked += new global::System.EventHandler (this.OnBTNApplyIgnorePkgClicked); this.BTN_Hide.Clicked += new global::System.EventHandler (this.OnBTNHideClicked); this.BTN_UpdateDatabase.Clicked += new global::System.EventHandler (this.OnBTNUpdateDatabaseClicked); this.BTN_Refresh.Clicked += new global::System.EventHandler (this.OnBTNRefreshClicked); diff --git a/frugal-mono-tools/gtk-gui/gui.stetic b/frugal-mono-tools/gtk-gui/gui.stetic index 55ccf23..641fa25 100644 --- a/frugal-mono-tools/gtk-gui/gui.stetic +++ b/frugal-mono-tools/gtk-gui/gui.stetic @@ -27,7 +27,7 @@ <widget class="Gtk.Notebook" id="ONG_principal"> <property name="MemberName" /> <property name="CanFocus">True</property> - <property name="CurrentPage">6</property> + <property name="CurrentPage">1</property> <child> <widget class="Gtk.VBox" id="vbox4"> <property name="MemberName" /> @@ -217,11 +217,11 @@ <child> <widget class="Gtk.Button" id="BTN_ApplyIgnorePkg"> <property name="MemberName" /> - <property name="Visible">False</property> <property name="CanFocus">True</property> <property name="Type">TextOnly</property> <property name="Label" translatable="yes">Apply</property> <property name="UseUnderline">True</property> + <signal name="Clicked" handler="OnBTNApplyIgnorePkgClicked" /> </widget> <packing> <property name="Position">2</property> _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git