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

commit 32867778117d2829221a2ef745e537b965b5688b
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Sun Feb 6 18:04:41 2011 +0100

*fixes build with latest vala

diff --git a/frugal-tweak-vala/src/ConfSystem.vala 
b/frugal-tweak-vala/src/ConfSystem.vala
index a54a172..dbf1dfe 100644
--- a/frugal-tweak-vala/src/ConfSystem.vala
+++ b/frugal-tweak-vala/src/ConfSystem.vala
@@ -16,37 +16,38 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/
-
-public class ConfSystem
-{
-       private const string hostFile="/etc/HOSTNAME";
-       private const string distriFile="/etc/frugalware-release";
-
-       public string GetShell()
-       {
-               string result = "";
-               result = Posix.getusershell();
-               return result;
-       }
-       public string GetDitribution()
-       {
-               string distri = Tools. open_file(distriFile);
-               distri = distri.replace("\n","");
-               return distri;
-       }
-       public string GetHostname()
+namespace fwtweak {
+       public class ConfSystem
{
-               string host = Tools. open_file(hostFile);
-               host = host.replace("\n","");
-               return host;
-       }
-       public void SetHostname(string host)
-       {
-               Tools.write_file(hostFile,host);
-       }
-       public string GetKernel()
-       {
-               string kernel = Tools.ReadLine("uname -a");
-               return kernel.replace("\n","");
+               private const string hostFile="/etc/HOSTNAME";
+               private const string distriFile="/etc/frugalware-release";
+
+               public string GetShell()
+               {
+                       string result = "";
+                       result = Posix.getusershell();
+                       return result;
+               }
+               public string GetDitribution()
+               {
+                       string distri = Tools. open_file(distriFile);
+                       distri = distri.replace("\n","");
+                       return distri;
+               }
+               public string GetHostname()
+               {
+                       string host = Tools. open_file(hostFile);
+                       host = host.replace("\n","");
+                       return host;
+               }
+               public void SetHostname(string host)
+               {
+                       Tools.write_file(hostFile,host);
+               }
+               public string GetKernel()
+               {
+                       string kernel = Tools.ReadLine("uname -a");
+                       return kernel.replace("\n","");
+               }
}
}
diff --git a/frugal-tweak-vala/src/EventGtk.vala 
b/frugal-tweak-vala/src/EventGtk.vala
index 26f829a..05c2502 100644
--- a/frugal-tweak-vala/src/EventGtk.vala
+++ b/frugal-tweak-vala/src/EventGtk.vala
@@ -17,116 +17,119 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/

-using Gtk;
-using Pacman;

-public class EventGtk{
+namespace fwtweak {
+       using Gtk;
+       using Pacman;
+       using pacman;
+       public class EventGtk{

-       //frugalware-tweak2
-       [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_BTN_Save_clicked",instance_pos = -1)]
-       public void on_BTN_Save_clicked (Button source) {
-               Configuration Myconf = new Configuration();
-               Myconf.SetShowNotif(GtkObj.notif.active);
-               Myconf.SetCheckUpd(GtkObj.update.active);
-       }
-       [CCode (cname = "G_MODULE_EXPORT EventGtk_on_BTN_SaveHost",instance_pos 
= -1)]
-       public void on_BTN_SaveHost_clicked (Button source) {
-               Tools.run_command("fwroot 
frugalware-tweak-hostname",GtkObj.host.text,false);
-       }
-       [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_BTN_StartModule_clicked",instance_pos = -1)]
-       public void on_BTN_Module_start_clicked (Button source) {
-               TreeIter iter;
-               TreeModel model;
-               string str = "";
+               //frugalware-tweak2
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_BTN_Save_clicked",instance_pos = -1)]
+               public void on_BTN_Save_clicked (Button source) {
+                       Configuration Myconf = new Configuration();
+                       Myconf.SetShowNotif(GtkObj.notif.active);
+                       Myconf.SetCheckUpd(GtkObj.update.active);
+               }
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_BTN_SaveHost",instance_pos = -1)]
+               public void on_BTN_SaveHost_clicked (Button source) {
+                       Tools.run_command("fwroot 
frugalware-tweak-hostname",GtkObj.host.text,false);
+               }
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_BTN_StartModule_clicked",instance_pos = -1)]
+               public void on_BTN_Module_start_clicked (Button source) {
+                       TreeIter iter;
+                       TreeModel model;
+                       string str = "";

-               TreeSelection sel = GtkObj.modules.get_selection();
-               if (sel.count_selected_rows() == 1) {
-                       sel.get_selected( out model, out iter);
-                       GtkObj.listmodel_modules.get(iter, 2, out str);
+                       TreeSelection sel = GtkObj.modules.get_selection();
+                       if (sel.count_selected_rows() == 1) {
+                               sel.get_selected( out model, out iter);
+                               GtkObj.listmodel_modules.get(iter, 2, out str);
+                       }
+                       Tools.run_command(str,"",false);
}
-               Tools.run_command(str,"",false);
-       }
-       //pacman-g2 update
-       [CCode (cname = "G_MODULE_EXPORT EventGtk_On_Update",instance_pos = -1)]
-       public void on_BTN_Update_clicked (Button source) {
-               Tools.run_command("fwroot frugalware-tweak-terminal ","-e 
pacman-g2 -Syu",false);
-       }
-       //mini pacman-g2
-       [CCode (cname = "G_MODULE_EXPORT 
EventGtk_On_PacmanG2Search",instance_pos = -1)]
-       public void on_BTN_search_pkg_clicked (Button source) {
-               string str_repo = GtkObj.combobox_repo.get_active_text();
-               string str_search= GtkObj.entry_search_pkg.text;
-               Tools.ConsoleDebug("search package "+str_search+" into 
"+str_repo+"...");
-               if(str_repo== null)
-               {
-                       var msg = new 
Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.INFO,
-                                                                               
Gtk.ButtonsType.OK,"You should select a repo.");
-                       msg.run();
-                       msg.destroy();
-                       return ;
+               //pacman-g2 update
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_On_Update",instance_pos = -1)]
+               public void on_BTN_Update_clicked (Button source) {
+                       Tools.run_command("fwroot frugalware-tweak-terminal 
","-e pacman-g2 -Syu",false);
}
-               //search into pacman-g2 database
-               unowned Pacman.PM_LIST lst_packages = null;
-               unowned Pacman.PM_DB db_search = null;
-               PM_LIST         *i = null ;
-               PM_PKG          *pm_spkg;
-               TreeIter iter;
-               GtkObj.listmodel_pkg = new ListStore (3, typeof (string), 
typeof (string),
-                                         typeof (string));
+               //mini pacman-g2
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_On_PacmanG2Search",instance_pos = -1)]
+               public void on_BTN_search_pkg_clicked (Button source) {
+                       string str_repo = 
GtkObj.combobox_repo.get_active_text();
+                       string str_search= GtkObj.entry_search_pkg.text;
+                       Tools.ConsoleDebug("search package "+str_search+" into 
"+str_repo+"...");
+                       if(str_repo== null)
+                       {
+                               var msg = new 
Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.INFO,
+                                                                               
        Gtk.ButtonsType.OK,"You should select a repo.");
+                               msg.run();
+                               msg.destroy();
+                               return ;
+                       }
+                       //search into pacman-g2 database
+                       unowned Pacman.PM_LIST lst_packages = null;
+                       unowned Pacman.PM_DB db_search = null;
+                       PM_LIST         *i = null ;
+                       PM_PKG          *pm_spkg;
+                       TreeIter iter;
+                       GtkObj.listmodel_pkg = new ListStore (3, typeof 
(string), typeof (string),
+                                                 typeof (string));

-               GtkObj.tree_pkg.set_model (GtkObj.listmodel_pkg);
+                       GtkObj.tree_pkg.set_model (GtkObj.listmodel_pkg);

-               GtkObj.tree_pkg.insert_column_with_attributes (-1, "Package", 
new CellRendererText (), "text", 0);
-               GtkObj.tree_pkg.insert_column_with_attributes (-1, "Version", 
new CellRendererText (), "text", 1);
-               GtkObj.tree_pkg.insert_column_with_attributes (-1, 
"Description", new CellRendererText (), "text", 2);
+                       GtkObj.tree_pkg.insert_column_with_attributes (-1, 
"Package", new CellRendererText (), "text", 0);
+                       GtkObj.tree_pkg.insert_column_with_attributes (-1, 
"Version", new CellRendererText (), "text", 1);
+                       GtkObj.tree_pkg.insert_column_with_attributes (-1, 
"Description", new CellRendererText (), "text", 2);

-               if (static_obj.my_pacman.search(str_search,str_repo,out 
lst_packages, out db_search))
-               {
-                       for 
(i=pacman_list_first(lst_packages);i!=null;i=pacman_list_next(i)) {
-                                       pm_spkg = pacman_db_readpkg (db_search, 
pacman_list_getdata(i));
-                                       GtkObj.listmodel_pkg.append (out iter);
-                                       GtkObj.listmodel_pkg.set (iter, 0, 
(string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.NAME), 1, 
(string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.VERSION), 2, 
(string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.DESC), 3);
-                                       
Tools.ConsoleDebug((string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.NAME));
-                               }
+                       if (static_obj.my_pacman.search(str_search,str_repo,out 
lst_packages, out db_search))
+                       {
+                               for 
(i=pacman_list_first(lst_packages);i!=null;i=pacman_list_next(i)) {
+                                               pm_spkg = pacman_db_readpkg 
(db_search, pacman_list_getdata(i));
+                                               GtkObj.listmodel_pkg.append 
(out iter);
+                                               GtkObj.listmodel_pkg.set (iter, 
0, (string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.NAME), 1, 
(string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.VERSION), 2, 
(string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.DESC), 3);
+                                               
Tools.ConsoleDebug((string)pacman_pkg_getinfo(pm_spkg,OptionPMPKG.NAME));
+                                       }
+                       }
}
-       }

-       [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_button_install_clicked",instance_pos = -1)]
-       public void on_BTN_install_clicked (Button source) {
-               TreeIter iter;
-               TreeModel model;
-               string str = "";
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_button_install_clicked",instance_pos = -1)]
+               public void on_BTN_install_clicked (Button source) {
+                       TreeIter iter;
+                       TreeModel model;
+                       string str = "";

-               TreeSelection sel = GtkObj.tree_pkg.get_selection();
-               if (sel.count_selected_rows() == 1) {
-                       sel.get_selected( out model, out iter);
-                       GtkObj.listmodel_pkg.get(iter, 0, out str);
+                       TreeSelection sel = GtkObj.tree_pkg.get_selection();
+                       if (sel.count_selected_rows() == 1) {
+                               sel.get_selected( out model, out iter);
+                               GtkObj.listmodel_pkg.get(iter, 0, out str);
+                       }
+                       if(str=="") return;
+                       Tools.run_command("fwroot" ,"frugalware-tweak-terminal 
-e pacman-g2 -S "+str,false);
}
-               if(str=="") return;
-               Tools.run_command("fwroot" ,"frugalware-tweak-terminal -e 
pacman-g2 -S "+str,false);
-       }
-       [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_button_uninstall_clicked",instance_pos = -1)]
-       public void on_BTN_uninstall_clicked (Button source) {
-               TreeIter iter;
-               TreeModel model;
-               string str = "";
-               //can only uninstall package installed
-               if( GtkObj.combobox_repo.get_active_text()!=pacman.FW_LOCAL) 
return ;
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_button_uninstall_clicked",instance_pos = -1)]
+               public void on_BTN_uninstall_clicked (Button source) {
+                       TreeIter iter;
+                       TreeModel model;
+                       string str = "";
+                       //can only uninstall package installed
+                       if( 
GtkObj.combobox_repo.get_active_text()!=minipacman.FW_LOCAL) return ;

-               TreeSelection sel = GtkObj.tree_pkg.get_selection();
-               if (sel.count_selected_rows() == 1) {
-                       sel.get_selected( out model, out iter);
-                       GtkObj.listmodel_pkg.get(iter, 0, out str);
+                       TreeSelection sel = GtkObj.tree_pkg.get_selection();
+                       if (sel.count_selected_rows() == 1) {
+                               sel.get_selected( out model, out iter);
+                               GtkObj.listmodel_pkg.get(iter, 0, out str);
+                       }
+                       if(str=="") return;
+                       Tools.run_command("fwroot" ,"frugalware-tweak-terminal 
-e pacman-g2 -Rc "+str,false);
+               }
+               [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_buttonoptimize_clicked",instance_pos = -1)]
+               public void on_BTN_optimize_clicked (Button source) {
+                       Tools.run_command("fwroot frugalware-tweak-terminal 
","-e pacman-g2-optimize",false);
+               }
+               [CCode (cname = "G_MODULE_EXPORT 
on_EventGtk_button_upd_database_clicked",instance_pos = -1)]
+               public void on_BTN_Update_database_clicked (Button source) {
+                       Tools.run_command("fwroot frugalware-tweak-terminal 
","-e pacman-g2 -Syy",false);
}
-               if(str=="") return;
-               Tools.run_command("fwroot" ,"frugalware-tweak-terminal -e 
pacman-g2 -Rc "+str,false);
-       }
-       [CCode (cname = "G_MODULE_EXPORT 
EventGtk_on_buttonoptimize_clicked",instance_pos = -1)]
-       public void on_BTN_optimize_clicked (Button source) {
-               Tools.run_command("fwroot frugalware-tweak-terminal ","-e 
pacman-g2-optimize",false);
-       }
-       [CCode (cname = "G_MODULE_EXPORT 
on_EventGtk_button_upd_database_clicked",instance_pos = -1)]
-       public void on_BTN_Update_database_clicked (Button source) {
-               Tools.run_command("fwroot frugalware-tweak-terminal ","-e 
pacman-g2 -Syy",false);
}
}
diff --git a/frugal-tweak-vala/src/GtkObj.vala 
b/frugal-tweak-vala/src/GtkObj.vala
index c210dda..ae088d9 100644
--- a/frugal-tweak-vala/src/GtkObj.vala
+++ b/frugal-tweak-vala/src/GtkObj.vala
@@ -17,24 +17,26 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/

-public static class GtkObj {
+namespace fwtweak {
+       public static class GtkObj {

-       //frugalware-tweak
-       public static Gtk.Window MainWindow;
-       public static Gtk.CheckButton notif;
-       public static Gtk.CheckButton update;
-       public static Gtk.Entry host;
+               //frugalware-tweak
+               public static Gtk.Window MainWindow;
+               public static Gtk.CheckButton notif;
+               public static Gtk.CheckButton update;
+               public static Gtk.Entry host;

-       public static Gtk.TreeView modules;
-       public static Gtk.ListStore listmodel_modules;
+               public static Gtk.TreeView modules;
+               public static Gtk.ListStore listmodel_modules;

-       //mini pacman-g2
-       public static  Gtk.Entry entry_search_pkg;
-       public static  Gtk.ComboBox combobox_repo;
-       public static Gtk.ListStore listmodel_repo;
-       public static Gtk.TreeView tree_pkg;
-       public static Gtk.ListStore listmodel_pkg;
-       public static Gtk.Button uninstall_pkg;
-       public static Gtk.Button install_pkg;
+               //mini pacman-g2
+               public static  Gtk.Entry entry_search_pkg;
+               public static  Gtk.ComboBox combobox_repo;
+               public static Gtk.ListStore listmodel_repo;
+               public static Gtk.TreeView tree_pkg;
+               public static Gtk.ListStore listmodel_pkg;
+               public static Gtk.Button uninstall_pkg;
+               public static Gtk.Button install_pkg;

+       }
}
diff --git a/frugal-tweak-vala/src/MainClient.vala 
b/frugal-tweak-vala/src/MainClient.vala
index db32752..5742cc9 100644
--- a/frugal-tweak-vala/src/MainClient.vala
+++ b/frugal-tweak-vala/src/MainClient.vala
@@ -19,9 +19,7 @@
using GLib;
using Gtk;
using Unique;
-using Popup;
-using Tree;
-using Module;
+using fwtweak;
using pacman;

[DBus (name = "org.frugalware.tweak")]
@@ -42,13 +40,13 @@ void on_bus_aquired (DBusConnection conn) {
}
}

-void* func()
+bool func()
{
while (true)
{
if (MyConf.GetCheckUpd())
{
-                       pacman pacmang2 = new pacman();
+                       minipacman pacmang2 = new minipacman();
if(pacmang2.CheckUpdate())
{
informUpdate();
@@ -64,7 +62,7 @@ void* func()
Thread.usleep(1800000000);      //1/2 hour
//roadmap.GetDateRelease();
}
-       return null;
+       return true;
}


@@ -151,7 +149,7 @@ int main (string[] args) {
GtkObj.update.active=MyConf.GetCheckUpd();

GtkObj.modules = builder.get_object("treeview_modules") as Gtk.TreeView;
-               setup_treeviewModule(GtkObj.modules);
+               fwtweak.Tree.setup_treeviewModule(GtkObj.modules);

Gtk.TextView about = builder.get_object("textview_about") as Gtk.TextView;
about.buffer.text=Tools.open_file("/usr/share/frugalware-tweak/LICENCE");
@@ -167,7 +165,7 @@ int main (string[] args) {
//start thread
try
{
-               Thread.create(func,false);
+               Thread.create<bool> (func, false);
}
catch
{
diff --git a/frugal-tweak-vala/src/Pacman-update.vala 
b/frugal-tweak-vala/src/Pacman-update.vala
index b8b0905..c029083 100644
--- a/frugal-tweak-vala/src/Pacman-update.vala
+++ b/frugal-tweak-vala/src/Pacman-update.vala
@@ -19,7 +19,7 @@

using Gtk;
using Unique;
-using Tree;
+using fwtweak;

int main (string[] args) {
Unique.App app;
@@ -48,7 +48,7 @@ int main (string[] args) {
window.position = WindowPosition.CENTER;
window.set_default_size (800, 200);
window.destroy.connect (Gtk.main_quit);
-        Tree.setup_treeviewPacmanUpdate (pacman);
+        fwtweak.Tree.setup_treeviewPacmanUpdate (pacman);
//window.add(view);

window.show_all ();
diff --git a/frugal-tweak-vala/src/Tree.vala b/frugal-tweak-vala/src/Tree.vala
index 9f2a82e..918ea75 100644
--- a/frugal-tweak-vala/src/Tree.vala
+++ b/frugal-tweak-vala/src/Tree.vala
@@ -17,84 +17,86 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/

-using Gtk;
-using Pacman;
-using pacman;
+namespace fwtweak {
+       using Gtk;
+       using Pacman;
+       using pacman;

-public static class Tree {
+       public static class Tree {

-       public static void setup_treeviewModule(TreeView view) {
+               public static void setup_treeviewModule(TreeView view) {

-       GtkObj.listmodel_modules = new ListStore (4, typeof (string), typeof 
(string),
-                                         typeof (string), typeof (string));
-       view.set_model (GtkObj.listmodel_modules);
+               GtkObj.listmodel_modules = new ListStore (4, typeof (string), 
typeof (string),
+                                                 typeof (string), typeof 
(string));
+               view.set_model (GtkObj.listmodel_modules);

-       view.insert_column_with_attributes (-1, "Module", new CellRendererText 
(), "text", 0);
-       view.insert_column_with_attributes (-1, "Description", new 
CellRendererText (), "text", 1);
-       TreeIter iter;
+               view.insert_column_with_attributes (-1, "Module", new 
CellRendererText (), "text", 0);
+               view.insert_column_with_attributes (-1, "Description", new 
CellRendererText (), "text", 1);
+               TreeIter iter;

-       Configuration MyConf = new Configuration();
-       //check modules available
-       try {
-               var directory = File.new_for_path (MyConf.PLUGINSDIR);
-               var enumerator = directory.enumerate_children 
(FILE_ATTRIBUTE_STANDARD_NAME, 0);
-               FileInfo file_info;
-               while ((file_info = enumerator.next_file ()) != null) {
-                       //stdout.printf ("%s\n", file_info.get_name ());
-                       Module module = new Module( file_info.get_name ());
-                       GtkObj.listmodel_modules.append (out iter);
-                       GtkObj.listmodel_modules.set (iter, 0, 
module.GetTittle(), 1,module.GetDescription() , 2, 
module.GetCommand(),module.GetGroup(),3);
+               Configuration MyConf = new Configuration();
+               //check modules available
+               try {
+                       var directory = File.new_for_path (MyConf.PLUGINSDIR);
+                       var enumerator = directory.enumerate_children 
(FILE_ATTRIBUTE_STANDARD_NAME, 0);
+                       FileInfo file_info;
+                       while ((file_info = enumerator.next_file ()) != null) {
+                               //stdout.printf ("%s\n", file_info.get_name ());
+                               Module module = new Module( file_info.get_name 
());
+                               GtkObj.listmodel_modules.append (out iter);
+                               GtkObj.listmodel_modules.set (iter, 0, 
module.GetTittle(), 1,module.GetDescription() , 2, 
module.GetCommand(),module.GetGroup(),3);
+                       }
+               }
+               catch (Error e) {
+                       stderr.printf ("Error: %s\n", e.message);
}
-       }
-       catch (Error e) {
-               stderr.printf ("Error: %s\n", e.message);
-       }

-       }
+               }

-public static void setup_treeviewPacmanUpdate(TreeView view) {
+       public static void setup_treeviewPacmanUpdate(TreeView view) {

-       var listmodel = new ListStore (3, typeof (string), typeof (string),
-                                         typeof (string));
-       view.set_model (listmodel);
+               var listmodel = new ListStore (3, typeof (string), typeof 
(string),
+                                                 typeof (string));
+               view.set_model (listmodel);

-       view.insert_column_with_attributes (-1, "Package", new CellRendererText 
(), "text", 0);
-       view.insert_column_with_attributes (-1, "Version", new CellRendererText 
(), "text", 1);
-       view.insert_column_with_attributes (-1, "Description", new 
CellRendererText (), "text", 2);
+               view.insert_column_with_attributes (-1, "Package", new 
CellRendererText (), "text", 0);
+               view.insert_column_with_attributes (-1, "Version", new 
CellRendererText (), "text", 1);
+               view.insert_column_with_attributes (-1, "Description", new 
CellRendererText (), "text", 2);

-       pacman pacmang2 = new pacman();
-       PM_LIST *i = null;
+               minipacman pacmang2 = new minipacman();
+               PM_LIST *i = null;

-               if (pacman_trans_init(Pacman.OptionTrans.TYPE_SYNC, 0, null, 
null, null) == -1) {
-                       Tools.ConsoleDebug("pacman_trans_init  failed \n");
-                       return ;
-               }
+                       if (pacman_trans_init(Pacman.OptionTrans.TYPE_SYNC, 0, 
null, null, null) == -1) {
+                               Tools.ConsoleDebug("pacman_trans_init  failed 
\n");
+                               return ;
+                       }

-               if (Pacman.pacman_trans_sysupgrade() == -1)
-               {
-                       Tools.ConsoleDebug("pacman_trans_sysupgrade failed \n");
-                       return ;
-               }
-               packages = pacman_trans_getinfo (OptionPM.PACKAGES);
-               if (packages == null)
-               {
-                       Tools.ConsoleDebug("No new updates are available\n");
-               }
-               else
-               {
-                       Tools.ConsoleDebug("Updates are available\n");
-                       TreeIter iter;
+                       if (Pacman.pacman_trans_sysupgrade() == -1)
+                       {
+                               Tools.ConsoleDebug("pacman_trans_sysupgrade 
failed \n");
+                               return ;
+                       }
+                       minipacman.packages = pacman_trans_getinfo 
(OptionPM.PACKAGES);
+                       if (minipacman.packages == null)
+                       {
+                               Tools.ConsoleDebug("No new updates are 
available\n");
+                       }
+                       else
+                       {
+                               Tools.ConsoleDebug("Updates are available\n");
+                               TreeIter iter;

-                       for 
(i=pacman_list_first(packages);i!=null;i=pacman_list_next(i)) {
-                                       PM_SYNCPKG *spkg = pacman_list_getdata 
(i);
-                                       PM_PKG *pkg = pacman_sync_getinfo 
(spkg, OptionPMSYNC.PKG);
-                                       
Tools.ConsoleDebug((string)pacman_pkg_getinfo(pkg,OptionPMPKG.NAME)+"\n");
-                                       listmodel.append (out iter);
-                                       listmodel.set (iter, 0, 
(string)pacman_pkg_getinfo(pkg,OptionPMPKG.NAME), 1, 
(string)pacman_pkg_getinfo(pkg,OptionPMPKG.VERSION), 2, 
(string)pacman_pkg_getinfo(pkg,OptionPMPKG.DESC), 3);
-                               }
+                               for 
(i=pacman_list_first(minipacman.packages);i!=null;i=pacman_list_next(i)) {
+                                               PM_SYNCPKG *spkg = 
pacman_list_getdata (i);
+                                               PM_PKG *pkg = 
pacman_sync_getinfo (spkg, OptionPMSYNC.PKG);
+                                               
Tools.ConsoleDebug((string)pacman_pkg_getinfo(pkg,OptionPMPKG.NAME)+"\n");
+                                               listmodel.append (out iter);
+                                               listmodel.set (iter, 0, 
(string)pacman_pkg_getinfo(pkg,OptionPMPKG.NAME), 1, 
(string)pacman_pkg_getinfo(pkg,OptionPMPKG.VERSION), 2, 
(string)pacman_pkg_getinfo(pkg,OptionPMPKG.DESC), 3);
+                                       }

+                       }
+                       pacman_trans_release ();
}
-               pacman_trans_release ();
-       }

+       }
}
diff --git a/frugal-tweak-vala/src/configuration.vala 
b/frugal-tweak-vala/src/configuration.vala
index dbf6f2f..c405013 100644
--- a/frugal-tweak-vala/src/configuration.vala
+++ b/frugal-tweak-vala/src/configuration.vala
@@ -17,40 +17,41 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/

+namespace fwtweak {
+       public class Configuration  {

-public class Configuration  {
-
-       //Fixes home dir
-       public string  HOMEDIR=Environment.get_home_dir ();
-       private string  _CACHEDIR="/.cache/frugalware-tweak2";
-       public string PLUGINSDIR="/usr/share/frugalware-tweak/plugins/";
-       public string GLADEFILE="/usr/share/frugalware-tweak/UI/MainUI.ui";
-       public string Version="0.1";
-       private string _glibSechema="org.frugalware.frugaltweak";
+               //Fixes home dir
+               public string  HOMEDIR=Environment.get_home_dir ();
+               private string  _CACHEDIR="/.cache/frugalware-tweak2";
+               public string PLUGINSDIR="/usr/share/frugalware-tweak/plugins/";
+               public string 
GLADEFILE="/usr/share/frugalware-tweak/UI/MainUI.ui";
+               public string Version="0.1";
+               private string _glibSechema="org.frugalware.frugaltweak";

-       public string GetCacheDir()
-       {
-               Posix.mkdir(HOMEDIR+_CACHEDIR,0777);
-               return HOMEDIR+_CACHEDIR;
-       }
-       public bool GetShowNotif()
-       {
-               var settings = new Settings (_glibSechema);
-               return settings.get_boolean ("shownotif");
-       }
-       public void SetShowNotif(bool enable)
-       {
-               var settings = new Settings (_glibSechema);
-               settings.set_boolean ("shownotif", enable);
-       }
-       public bool GetCheckUpd()
-       {
-               var settings = new Settings (_glibSechema);
-               return settings.get_boolean ("checkupdate");
-       }
-       public void SetCheckUpd(bool enable)
-       {
-               var settings = new Settings (_glibSechema);
-               settings.set_boolean ("checkupdate", enable);
+               public string GetCacheDir()
+               {
+                       Posix.mkdir(HOMEDIR+_CACHEDIR,0777);
+                       return HOMEDIR+_CACHEDIR;
+               }
+               public bool GetShowNotif()
+               {
+                       var settings = new Settings (_glibSechema);
+                       return settings.get_boolean ("shownotif");
+               }
+               public void SetShowNotif(bool enable)
+               {
+                       var settings = new Settings (_glibSechema);
+                       settings.set_boolean ("shownotif", enable);
+               }
+               public bool GetCheckUpd()
+               {
+                       var settings = new Settings (_glibSechema);
+                       return settings.get_boolean ("checkupdate");
+               }
+               public void SetCheckUpd(bool enable)
+               {
+                       var settings = new Settings (_glibSechema);
+                       settings.set_boolean ("checkupdate", enable);
+               }
}
}
diff --git a/frugal-tweak-vala/src/daemon.vala 
b/frugal-tweak-vala/src/daemon.vala
index c099c80..fb7571e 100644
--- a/frugal-tweak-vala/src/daemon.vala
+++ b/frugal-tweak-vala/src/daemon.vala
@@ -17,39 +17,23 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/
using GLib;
-using DbusServer;
using pacman;

-[DBus (name = "org.frugalware.tweak")]
-interface DbusUpd : Object {
-       public abstract void update_available(bool update) throws IOError;
-}

class Deamon : GLib.Object {

-       public static pacman pacmang2 ;
+       public static minipacman pacmang2 ;

public static int main(string[] args) {
Tools.ConsoleDebug("Start Frugalware Tweak Daemon");
-       //dbus
-       DbusUpd dbusUpd = Bus.get_proxy_sync (BusType.SYSTEM, 
"org.frugalware.tweak", "/org/frugalware/tweak");
-       pacmang2 = new pacman();
+       pacmang2 = new minipacman();

while(true)
{
Thread.usleep(1800000000);      //1/2 hour
Thread.usleep(1800000000);      //1/2 hour
Thread.usleep(1800000000);      //1/2 hour
-               if (UpdateAllDatabase())
-               {
-                       Tools.ConsoleDebug("Send dbus event");
-                       try{
-                               dbusUpd.update_available(true);
-                       }
-                       catch {
-                               Tools.ConsoleDebug("couldn't send dbus event");
-                       }
-               }
+               UpdateAllDatabase();
}
}

diff --git a/frugal-tweak-vala/src/frugallog.vala 
b/frugal-tweak-vala/src/frugallog.vala
index 3ab9b45..2cd51e0 100644
--- a/frugal-tweak-vala/src/frugallog.vala
+++ b/frugal-tweak-vala/src/frugallog.vala
@@ -18,6 +18,7 @@
*/

using Gtk;
+using fwtweak;

static int main (string[] args) {
Gtk.init (ref args);
diff --git a/frugal-tweak-vala/src/mini-pacman-g2.vala 
b/frugal-tweak-vala/src/mini-pacman-g2.vala
index b56d903..7e1e7e5 100644
--- a/frugal-tweak-vala/src/mini-pacman-g2.vala
+++ b/frugal-tweak-vala/src/mini-pacman-g2.vala
@@ -18,6 +18,8 @@
*/

using Gtk;
+using pacman;
+using fwtweak;

int main (string[] args) {
Gtk.init (ref args);
@@ -29,7 +31,7 @@ int main (string[] args) {
var window = builder.get_object ("window_pacman") as Window;
window.destroy.connect (Gtk.main_quit);

-       static_obj.my_pacman = new pacman();
+       static_obj.my_pacman = new minipacman();
CellRenderer cell;
string [] repos = static_obj.my_pacman.repos();
GtkObj.combobox_repo = builder.get_object("combobox_repo") as Gtk.ComboBox;
diff --git a/frugal-tweak-vala/src/pacman.vala 
b/frugal-tweak-vala/src/pacman.vala
index 9b0ab39..73d69cb 100644
--- a/frugal-tweak-vala/src/pacman.vala
+++ b/frugal-tweak-vala/src/pacman.vala
@@ -18,22 +18,23 @@
*/

using GLib;
-using Tools;
+using fwtweak;
using Pacman;

-public class pacman
+namespace pacman {
+public class minipacman
{

private static const string CFG_FILE                    ="/etc/pacman-g2.conf";
private static const string FW_CURRENT                  ="frugalware-current";
private static const string FW_STABLE                   ="frugalware";
-       private static const string FW_LOCAL                    ="local";
+       public static const string FW_LOCAL                     ="local";
private static unowned Pacman.PM_DB sync_db     = null;
private static unowned Pacman.PM_DB local_db    = null;
public static Pacman.PM_LIST *packages                  = null;
private static string[] _repos                                  = new string[0];

-       public pacman()
+       public minipacman()
{
Pacman.pacman_release();
if (Pacman.pacman_initialize(Pacman.PM_ROOT) != -1)
@@ -156,3 +157,4 @@ public class pacman
return pkgUpdated;
}
}
+}
diff --git a/frugal-tweak-vala/src/popup.vala b/frugal-tweak-vala/src/popup.vala
index eae9466..6dd83e6 100644
--- a/frugal-tweak-vala/src/popup.vala
+++ b/frugal-tweak-vala/src/popup.vala
@@ -17,55 +17,56 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
*/

-using Notify;
-using Tools;
-using Configuration;
-#if ENABLEINDICATE
-       using Indicate;
-#endif
+namespace fwtweak {

-public static class Popup  {
+       #if ENABLEINDICATE
+               using Indicate;
+       #endif
+       using Notify;
+       using Tools;
+       using pacman;
+       public static class Popup  {

-       public static void PopupShow(string title,string text) {
-               Configuration conf= new Configuration();
-               if(!conf.GetShowNotif()) return ;
+               public static void PopupShow(string title,string text) {
+                       Configuration conf= new Configuration();
+                       if(!conf.GetShowNotif()) return ;

-               Notify.init("Frugalware-tweak");
-               var notification = new Notification (title,text, "icon_name", 
null);
-               notification.set_timeout(5000);
-               notification.set_urgency(Notify.Urgency.LOW);
-               try
-               {
-                       notification.show();
-                       ConsoleDebug(text);
-               }
-               catch
-               {
-                       ConsoleDebug("Unable to show low notification");
-               }
+                       Notify.init("Frugalware-tweak");
+                       Notification notification = new Notification 
(title,text, "icon_name");
+                       notification.set_timeout(5000);
+                       notification.set_urgency(Notify.Urgency.LOW);
+                       try
+                       {
+                               notification.show();
+                               ConsoleDebug(text);
+                       }
+                       catch
+                       {
+                               ConsoleDebug("Unable to show low notification");
+                       }

-               #if ENABLEINDICATE
-                       //indicator support
-                       /*var server = Indicate.Server.ref_default();
+                       #if ENABLEINDICATE
+                               //indicator support
+                               /*var server = Indicate.Server.ref_default();

-                       server.set_type("message.frugalware-tweak2");
-                       
server.set_desktop_file("/usr/share/indicators/messages/applications/frugalware-tweak2.desktop");
-                       server.server_display.connect(dirty_activate);
-                       server.show();*/
+                               server.set_type("message.frugalware-tweak2");
+                               
server.set_desktop_file("/usr/share/indicators/messages/applications/frugalware-tweak2.desktop");
+                               server.server_display.connect(dirty_activate);
+                               server.show();*/

-                       var indicator = new Indicate.Indicator();
-                       indicator.set_property("subtype", "im");
-                       indicator.set_property("sender", "frugalware-tweak2");
-                       indicator.set_property("body", text);
-                       indicator.user_display.connect(dirty_activate);
-                       indicator.show();
-               #endif
+                               var indicator = new Indicate.Indicator();
+                               indicator.set_property("subtype", "im");
+                               indicator.set_property("sender", 
"frugalware-tweak2");
+                               indicator.set_property("body", text);
+                               indicator.user_display.connect(dirty_activate);
+                               indicator.show();
+                       #endif

-               }
+                       }

-               public static void dirty_activate() {
-                       ConsoleDebug("libindicate activated");
-               }
-
-}
+                       public static void dirty_activate() {
+                               ConsoleDebug("libindicate activated");
+                       }
+       }
+}

diff --git a/frugal-tweak-vala/src/static_obj.vala 
b/frugal-tweak-vala/src/static_obj.vala
index a777e03..c9ab00b 100644
--- a/frugal-tweak-vala/src/static_obj.vala
+++ b/frugal-tweak-vala/src/static_obj.vala
@@ -18,6 +18,7 @@
*/

using GLib;
+using pacman;
public static class static_obj {
-       public static pacman my_pacman;
+       public static minipacman my_pacman;
}
diff --git a/frugal-tweak-vala/src/systray.vala 
b/frugal-tweak-vala/src/systray.vala
index 7daa2d1..641ba39 100644
--- a/frugal-tweak-vala/src/systray.vala
+++ b/frugal-tweak-vala/src/systray.vala
@@ -19,147 +19,148 @@

using Gtk;
using GLib;
-
-public class Systray
-{
-       public static const string defaultIco = 
"/usr/share/frugalware-tweak/pictures/frugalware-tweak.png";
-       private StatusIcon _trayicon ;
-       private Menu _popup;
-       private Window _window;
-       private string _ico ="";
-       private Configuration conf = new Configuration();
-       public Systray()
+namespace fwtweak {
+       public class Systray
{
-               _window = GtkObj.MainWindow;
-               _ico=defaultIco;
-                /* Create tray icon */
-               try
+               public static const string defaultIco = 
"/usr/share/frugalware-tweak/pictures/frugalware-tweak.png";
+               private StatusIcon _trayicon ;
+               private Menu _popup;
+               private Window _window;
+               private string _ico ="";
+               private Configuration conf = new Configuration();
+               public Systray()
{
-                       _trayicon =new StatusIcon.from_file(_ico);
-                       _window.set_icon_from_file(_ico);
+                       _window = GtkObj.MainWindow;
+                       _ico=defaultIco;
+                        /* Create tray icon */
+                       try
+                       {
+                               _trayicon =new StatusIcon.from_file(_ico);
+                               _window.set_icon_from_file(_ico);
+                       }
+                       catch(GLib.Error err)
+                       {
+                               var msg = new 
Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.ERROR,
+                                                                               
        Gtk.ButtonsType.OK,"Failed to load "+_ico+"\n"+err.message);
+                               msg.run();
+                               msg.destroy();
+                       }
+                       _trayicon.set_tooltip_text ("Frugalware Tweak2 !");
+                       create_menu();
+                       this.show();
}
-               catch(GLib.Error err)
+               public void SetTooltip(string text)
{
-                       var msg = new 
Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.ERROR,
-                                                                               
Gtk.ButtonsType.OK,"Failed to load "+_ico+"\n"+err.message);
-                       msg.run();
-                       msg.destroy();
+                       _trayicon.set_tooltip_text (text);
}
-               _trayicon.set_tooltip_text ("Frugalware Tweak2 !");
-               create_menu();
-               this.show();
-       }
-       public void SetTooltip(string text)
-       {
-               _trayicon.set_tooltip_text (text);
-       }
-       private void create_menu ()
-       {
-               _popup = new Menu();
-               var menuCheckUpdate = new ImageMenuItem.from_stock(STOCK_INFO, 
null);
-               menuCheckUpdate.label="Check update";
-               menuCheckUpdate.activate += update_clicked ;
-               _popup.append(menuCheckUpdate);
+               private void create_menu ()
+               {
+                       _popup = new Menu();
+                       var menuCheckUpdate = new 
ImageMenuItem.from_stock(STOCK_INFO, null);
+                       menuCheckUpdate.label="Check update";
+                       menuCheckUpdate.activate += update_clicked ;
+                       _popup.append(menuCheckUpdate);

-               var menuTerm = new ImageMenuItem.from_stock(STOCK_EDIT, null);
-               menuTerm.label="Terminal";
-               menuTerm.activate += terminal_clicked ;
-               _popup.append(menuTerm);
+                       var menuTerm = new ImageMenuItem.from_stock(STOCK_EDIT, 
null);
+                       menuTerm.label="Terminal";
+                       menuTerm.activate += terminal_clicked ;
+                       _popup.append(menuTerm);

-               var menuForums = new ImageMenuItem.from_stock(STOCK_NETWORK, 
null);
-               menuForums.label="Forums";
-               menuForums.activate += forums_clicked ;
-               _popup.append(menuForums);
+                       var menuForums = new 
ImageMenuItem.from_stock(STOCK_NETWORK, null);
+                       menuForums.label="Forums";
+                       menuForums.activate += forums_clicked ;
+                       _popup.append(menuForums);

-               var menuWiki = new ImageMenuItem.from_stock(STOCK_NETWORK, 
null);
-               menuWiki.label="Wiki";
-               menuWiki.activate += wiki_clicked ;
-               _popup.append(menuWiki);
+                       var menuWiki = new 
ImageMenuItem.from_stock(STOCK_NETWORK, null);
+                       menuWiki.label="Wiki";
+                       menuWiki.activate += wiki_clicked ;
+                       _popup.append(menuWiki);

-               var menuItem = new ImageMenuItem.from_stock(STOCK_ABOUT, null);
-               menuItem.activate += about_clicked ;
-               _popup.append(menuItem);
+                       var menuItem = new 
ImageMenuItem.from_stock(STOCK_ABOUT, null);
+                       menuItem.activate += about_clicked ;
+                       _popup.append(menuItem);

-               var menuItem2 = new ImageMenuItem.from_stock(STOCK_QUIT, null);
-               menuItem2.activate += exit_app ;
-               _popup.append(menuItem2);
+                       var menuItem2 = new 
ImageMenuItem.from_stock(STOCK_QUIT, null);
+                       menuItem2.activate += exit_app ;
+                       _popup.append(menuItem2);

-               _popup.show_all();
-               _trayicon.popup_menu += popup_Menu ;
-               _trayicon.activate +=  icon_clicked ;
+                       _popup.show_all();
+                       _trayicon.popup_menu += popup_Menu ;
+                       _trayicon.activate +=  icon_clicked ;

-       }
-       public delegate void Change_Ico(string ico);
-       public void SetIco(string ico)
-       {
-               try
+               }
+               public delegate void Change_Ico(string ico);
+               public void SetIco(string ico)
{
-                       _ico=ico;
-                       Gdk.threads_enter();
-                       _trayicon.set_from_file(_ico);
-                       _window.set_icon_from_file(_ico);
-                       Gdk.threads_leave();
+                       try
+                       {
+                               _ico=ico;
+                               Gdk.threads_enter();
+                               _trayicon.set_from_file(_ico);
+                               _window.set_icon_from_file(_ico);
+                               Gdk.threads_leave();
+                       }
+                       catch(GLib.Error err)
+                       {
+                               var msg = new 
Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.ERROR,
+                                                                               
        Gtk.ButtonsType.OK,"Failed to load "+_ico+"\n"+err.message);
+                               msg.run();
+                       }
}
-               catch(GLib.Error err)
+               private void popup_Menu(StatusIcon i , uint button,uint 
activateTime)
{
-                       var msg = new 
Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.ERROR,
-                                                                               
Gtk.ButtonsType.OK,"Failed to load "+_ico+"\n"+err.message);
-                       msg.run();
+                       _popup.popup(null,null,i.position_menu,0 ,activateTime);
}
-       }
-       private void popup_Menu(StatusIcon i , uint button,uint activateTime)
-       {
-               _popup.popup(null,null,i.position_menu,0 ,activateTime);
-       }
-       private void  icon_clicked ()
-       {
-               Tools.ConsoleDebug("clic TrayIcon");
-               if (_window.is_active)
+               private void  icon_clicked ()
{
-                       _window.hide();
+                       Tools.ConsoleDebug("clic TrayIcon");
+                       if (_window.is_active)
+                       {
+                               _window.hide();
+                       }
+                       else
+                       {
+                               _window.show_all();
+                       }
}
-               else
+               private void  terminal_clicked ()
{
-                       _window.show_all();
-               }
-       }
-       private void  terminal_clicked ()
-       {
-               Tools.run_command("frugalware-tweak-terminal","",false);
-       }
-       private void  update_clicked ()
-       {
-               Tools.run_command("frugalware-tweak-pacman-update","",false);
-       }
-       private void  forums_clicked ()
-       {
-               
Tools.run_command("frugalware-tweak-browser","http://forums.frugalware.org",false);
-       }
-       private void  wiki_clicked ()
-       {
-               
Tools.run_command("frugalware-tweak-browser","http://wiki.frugalware.org",false);
-       }
-       private void  about_clicked ()
-       {
-               var about = new AboutDialog ();
-               about.set_version(conf.Version);
-               about.set_program_name("Frugalware Tweak2 : ");
-               about.set_comments("This is a Simple tweak frugalware 
application");
-               about.set_copyright("gaetan gourdin alias bouleetbil");
-               about.run();
-               about.hide();
-       }
-       private void  exit_app ()
-       {
-               Gtk.main_quit();
-       }
-       public void hide()
-       {
-               _trayicon.set_visible(false);
-       }
-       public void show()
-       {
-               _trayicon.set_visible(true);
-       }
+                       Tools.run_command("frugalware-tweak-terminal","",false);
+               }
+               private void  update_clicked ()
+               {
+                       
Tools.run_command("frugalware-tweak-pacman-update","",false);
+               }
+               private void  forums_clicked ()
+               {
+                       
Tools.run_command("frugalware-tweak-browser","http://forums.frugalware.org",false);
+               }
+               private void  wiki_clicked ()
+               {
+                       
Tools.run_command("frugalware-tweak-browser","http://wiki.frugalware.org",false);
+               }
+               private void  about_clicked ()
+               {
+                       var about = new AboutDialog ();
+                       about.set_version(conf.Version);
+                       about.set_program_name("Frugalware Tweak2 : ");
+                       about.set_comments("This is a Simple tweak frugalware 
application");
+                       about.set_copyright("gaetan gourdin alias bouleetbil");
+                       about.run();
+                       about.hide();
+               }
+               private void  exit_app ()
+               {
+                       Gtk.main_quit();
+               }
+               public void hide()
+               {
+                       _trayicon.set_visible(false);
+               }
+               public void show()
+               {
+                       _trayicon.set_visible(true);
+               }

+       }
}
diff --git a/frugal-tweak-vala/src/tools.vala b/frugal-tweak-vala/src/tools.vala
index d17835b..66dd80c 100644
--- a/frugal-tweak-vala/src/tools.vala
+++ b/frugal-tweak-vala/src/tools.vala
@@ -18,9 +18,9 @@
*/

using GLib;
+using fwtweak;

-public static class Tools
-{
+namespace Tools {
public static string ReadLine(string commande)
{
string result="";
@@ -82,12 +82,12 @@ public static class Tools
} catch (Error e) {
ConsoleDebug(e.message);
}
-
+
}
public static void download()
{
ConsoleDebug("Donwload File");
-
+
}
public static int run_command(string cmd, string param, bool sync)
{
@@ -114,5 +114,5 @@ public static class Tools

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

Reply via email to