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

commit 27453a08f609caac9efdb76090233a786dacd7b3
Author: bouleetbil <bouleet...@frogdev.info>
Date:   Mon Jan 3 23:05:09 2011 +0100

*added systray class

diff --git a/frugal-tweak-vala/Makefile b/frugal-tweak-vala/Makefile
index 7a8f5c7..e2af77f 100644
--- a/frugal-tweak-vala/Makefile
+++ b/frugal-tweak-vala/Makefile
@@ -14,7 +14,7 @@ PACMANUPDATESOURCES = $(SOURCEDIR)/Tree.vala 
$(SOURCEDIR)/Pacman-update.vala $(S

#for start modules
FRUGALTWEAKSOURCES = $(SOURCEDIR)/MainClient.vala $(SOURCEDIR)/Tree.vala 
$(SOURCEDIR)/pacman.vala $(SOURCEDIR)/tools.vala \
-                                               $(SOURCEDIR)/popup.vala 
$(SOURCEDIR)/configuration.vala $(SOURCEDIR)/Module.vala\
+                                               $(SOURCEDIR)/popup.vala 
$(SOURCEDIR)/configuration.vala $(SOURCEDIR)/Module.vala 
$(SOURCEDIR)/systray.vala \
./vapi/config.vapi

ENABLEINDICATE = 0
diff --git a/frugal-tweak-vala/src/MainClient.vala 
b/frugal-tweak-vala/src/MainClient.vala
index fcfb318..555e288 100644
--- a/frugal-tweak-vala/src/MainClient.vala
+++ b/frugal-tweak-vala/src/MainClient.vala
@@ -29,7 +29,7 @@ class DbusUpd : GLib.Object {

public void update_available (bool upd) {
if(upd)
-                       Popup.PopupShow("frugalware","Updates package 
available.");
+                       informUpdate();
}
}

@@ -38,7 +38,7 @@ void on_bus_aquired (DBusConnection conn) {
conn.register_object ("/org/frugalware/tweak", new DbusUpd ());
Tools.ConsoleDebug("register dbus application");
} catch (IOError e) {
-        Tools.ConsoleDebug("Could not register service);
+        Tools.ConsoleDebug("Could not register service");
}
}

@@ -47,10 +47,16 @@ void* func()
pacman pacmang2 = new pacman();
if(pacmang2.CheckUpdate())
{
-               Popup.PopupShow("frugalware","Updates package available.");
+               informUpdate();
}
return null;
}
+
+void informUpdate()
+{
+       Popup.PopupShow("Frugalware tweak","Some update are available.");
+}
+
int main (string[] args) {

if(!Thread.supported())
@@ -79,12 +85,10 @@ int main (string[] args) {
Bus.own_name (BusType.SYSTEM, "org.frugalware.tweak", BusNameOwnerFlags.NONE,
on_bus_aquired,
() => {},
-                  () => Tools.ConsoleDebug("Could not aquire name));
+                  () => Tools.ConsoleDebug("Could not aquire name"));

/* Create tray icon */
-        StatusIcon trayicon = new 
StatusIcon.from_file("/usr/share/frugalware-tweak/pictures/frugalware-tweak.png");
-        trayicon.set_tooltip_text ("Frugalware Tweak !");
-        trayicon.set_visible(true);
+       systray.init();
//TODO
//trayicon.activate += icon_clicked;
//create_menu()
diff --git a/frugal-tweak-vala/src/systray.vala 
b/frugal-tweak-vala/src/systray.vala
new file mode 100644
index 0000000..bc76fc8
--- /dev/null
+++ b/frugal-tweak-vala/src/systray.vala
@@ -0,0 +1,41 @@
+/*
+ *
+ * (C) 2010 bouleetbil <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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  
USA
+ */
+
+using Gtk;
+public static class systray
+{
+       static StatusIcon trayicon ;
+
+       public static void init()
+       {
+                /* Create tray icon */
+               trayicon = new 
StatusIcon.from_file("/usr/share/frugalware-tweak/pictures/frugalware-tweak.png");
+               trayicon.set_tooltip_text ("Frugalware Tweak !");
+               show();
+       }
+       public static void hide()
+       {
+               trayicon.set_visible(false);
+       }
+       public static void show()
+       {
+               trayicon.set_visible(true);
+       }
+
+}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to