Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=frugal-tweak.git;a=commitdiff;h=50a95f89a3e43ea14db707810ecf3deaeabee433
commit 50a95f89a3e43ea14db707810ecf3deaeabee433 Author: bouleetbil <bouleet...@frogdev.info> Date: Mon Jan 10 23:53:36 2011 +0100 *fixes check update diff --git a/frugal-tweak-vala/DATA/org.frugalware.frugaltweak.gschema.xml b/frugal-tweak-vala/DATA/org.frugalware.frugaltweak.gschema.xml index 0f96a95..38fc592 100644 --- a/frugal-tweak-vala/DATA/org.frugalware.frugaltweak.gschema.xml +++ b/frugal-tweak-vala/DATA/org.frugalware.frugaltweak.gschema.xml @@ -11,9 +11,9 @@ <key name="checkupdate" type="b"> <summary>Check update</summary> - <default>false</default> + <default>true</default> <description> - Search update package on startup + Search update packages </description> </key> diff --git a/frugal-tweak-vala/UI/MainUI.ui b/frugal-tweak-vala/UI/MainUI.ui index 063359c..65b88c9 100644 --- a/frugal-tweak-vala/UI/MainUI.ui +++ b/frugal-tweak-vala/UI/MainUI.ui @@ -239,7 +239,7 @@ </child> <child> <object class="GtkCheckButton" id="chk_update"> - <property name="label" translatable="yes">Check update packages on startup</property> + <property name="label" translatable="yes">Check update packages</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> @@ -539,7 +539,7 @@ <child> <object class="GtkScrolledWindow" id="scrolledwindow6"> <property name="width_request">400</property> - <property name="height_request">300</property> + <property name="height_request">270</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">automatic</property> @@ -593,7 +593,36 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkHBox" id="hbox10"> + <property name="visible">True</property> + <child> + <object class="GtkButton" id="button3"> + <property name="label" translatable="yes">Update database</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="clicked" handler="on_EventGtk_button_upd_database_clicked"/> + </object> + <packing> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button4"> + <property name="label" translatable="yes">Optimize database</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="clicked" handler="EventGtk_on_buttonoptimize_clicked"/> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> </child> </object> </child> diff --git a/frugal-tweak-vala/src/EventGtk.vala b/frugal-tweak-vala/src/EventGtk.vala index 31461d6..26f829a 100644 --- a/frugal-tweak-vala/src/EventGtk.vala +++ b/frugal-tweak-vala/src/EventGtk.vala @@ -121,5 +121,12 @@ public class EventGtk{ 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 88ce2b0..c210dda 100644 --- a/frugal-tweak-vala/src/GtkObj.vala +++ b/frugal-tweak-vala/src/GtkObj.vala @@ -20,6 +20,7 @@ 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; diff --git a/frugal-tweak-vala/src/MainClient.vala b/frugal-tweak-vala/src/MainClient.vala index c64f105..3271c5e 100644 --- a/frugal-tweak-vala/src/MainClient.vala +++ b/frugal-tweak-vala/src/MainClient.vala @@ -46,12 +46,15 @@ void* func() { while (true) { - Thread.usleep(1800000000); //1/2 hour - pacman pacmang2 = new pacman(); - if(pacmang2.CheckUpdate()) + if (MyConf.GetCheckUpd()) { - informUpdate(); + pacman pacmang2 = new pacman(); + if(pacmang2.CheckUpdate()) + { + informUpdate(); + } } + Thread.usleep(1800000000); //1/2 hour //roadmap.GetDateRelease(); } return null; @@ -61,17 +64,18 @@ void* func() void informUpdate() { Popup.PopupShow("Frugalware tweak","Some update are available."); + systrayIcon.SetTooltip("Some update are available."); + systrayIcon.SetIco("/usr/share/frugalware-tweak/pictures/frugalware-tweak-update.png"); } //declarations -Window window; ConfSystem confsystem; Systray systrayIcon; Configuration MyConf ; bool onClose(Gdk.Event e) { - window.hide(); + GtkObj.MainWindow.hide(); return true; } int main (string[] args) { @@ -111,8 +115,8 @@ int main (string[] args) { EventGtk event = new EventGtk(); builder.connect_signals (event); - window = builder.get_object ("window") as Window; - window.delete_event += onClose; + GtkObj.MainWindow = builder.get_object ("window") as Window; + GtkObj.MainWindow.delete_event += onClose; //added some var to window GtkObj.host = builder.get_object("entry_host") as Gtk.Entry; @@ -150,16 +154,8 @@ int main (string[] args) { } /* Create tray icon */ - systrayIcon = new Systray(window); - if(MyConf.GetCheckUpd()) - { - pacman pacmang2 = new pacman(); - if(pacmang2.CheckUpdate()) - { - Popup.PopupShow("Frugalware tweak","Some update are available."); - systrayIcon.SetIco("/usr/share/frugalware-tweak/pictures/frugalware-tweak-update.png"); - } - } + systrayIcon = new Systray(); + //start thread try { @@ -169,8 +165,6 @@ int main (string[] args) { { Tools.ConsoleDebug("Couldn't start thread\n"); } - - Gtk.main (); return 0; } diff --git a/frugal-tweak-vala/src/systray.vala b/frugal-tweak-vala/src/systray.vala index dfa0181..1ffc6f1 100644 --- a/frugal-tweak-vala/src/systray.vala +++ b/frugal-tweak-vala/src/systray.vala @@ -28,14 +28,14 @@ public class Systray private string _defaultIco = "/usr/share/frugalware-tweak/pictures/frugalware-tweak.png"; private string _ico =""; private Configuration conf = new Configuration(); - public Systray(Window MainWindow) + public Systray() { - _window = MainWindow; + _window = GtkObj.MainWindow; _ico=_defaultIco; /* Create tray icon */ try { - _trayicon = new StatusIcon.from_file(_defaultIco); + _trayicon =new StatusIcon.from_file(_defaultIco); _window.set_icon_from_file(_defaultIco); } catch(GLib.Error err) @@ -49,6 +49,10 @@ public class Systray create_menu(); this.show(); } + public void SetTooltip(string text) + { + _trayicon.set_tooltip_text (text); + } private void create_menu () { _popup = new Menu(); @@ -90,7 +94,6 @@ public class Systray try { _ico=ico; - _trayicon.set_from_pixbuf(new Gdk.Pixbuf.from_file(_ico)); _window.set_icon_from_file(_ico); } catch(GLib.Error err) _______________________________________________ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git