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

commit 2db986c884c2b9aaa166e7df47842b407afd210a
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Thu Aug 26 18:08:05 2010 +0000

*check if package is installed

diff --git a/frugal-mono-tools/MainWindow.cs b/frugal-mono-tools/MainWindow.cs
index 1a9f001..cc76e61 100644
--- a/frugal-mono-tools/MainWindow.cs
+++ b/frugal-mono-tools/MainWindow.cs
@@ -27,6 +27,7 @@ public partial class MainWindow : Gtk.Window
{
protected Gtk.TreeIter iter;

+       private bool boRoot = false;
//pacman-g2
// Create a model for treeview pkg
Gtk.ListStore pkgListStore = new Gtk.ListStore (typeof (string));
@@ -104,6 +105,10 @@ public partial class MainWindow : Gtk.Window
BTN_Uninstall.Visible=false;
BTN_Install.Visible=false;
}
+               else
+               {
+                       boRoot=true;
+               }

//xorg configuration
SAI_Layout.Text=this.LayoutXorg();
@@ -505,7 +510,20 @@ public partial class MainWindow : Gtk.Window
{
string T =(string)model.GetValue (iter, 0);
T=Pkg.extractNamePackage(T);
-                                       Console.WriteLine(T);
+                                       if(boRoot)
+                                       {
+                                               //installed ?
+                                               if(Pkg.IsInstalled(T))
+                                               {
+                                                       
BTN_Uninstall.Visible=true;
+                                                       
BTN_Install.Visible=false;
+                                               }
+                                               else
+                                               {
+                                                       
BTN_Uninstall.Visible=false;
+                                                       
BTN_Install.Visible=true;
+                                               }
+                                       }
}
}
catch{}
diff --git a/frugal-mono-tools/PacmanG2.cs b/frugal-mono-tools/PacmanG2.cs
index d0de793..410b9e5 100644
--- a/frugal-mono-tools/PacmanG2.cs
+++ b/frugal-mono-tools/PacmanG2.cs
@@ -182,6 +182,13 @@ namespace frugalmonotools

return packageName;
}
+               public bool IsInstalled(string strSearch)
+               {
+                       string dirpkg=ROOT_PATH+PACMANG2_BDD+PACMAN_LOCAL+"/";
+                       string[] dirs= 
Directory.GetDirectories(dirpkg,strSearch+"-*");
+                       if (dirs.Length==0) return false;
+                       return true;
+               }
}

}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to