]> ToastFreeware Gitweb - gregoa/zavai.git/blobdiff - src/app.vala
butcher butcher butcher
[gregoa/zavai.git] / src / app.vala
index 4d1f6cae378aee52c62694b002c1732113bd116f..9725d2baafe1b05ecafbf82aef333a4c7b72fb25 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * app - zavai main window
  *
- * Copyright (C) 2009  Enrico Zini <enrico@enricozini.org>
+ * Copyright (C) 2009-2010  Enrico Zini <enrico@enricozini.org>
  *
  * 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
@@ -158,24 +158,6 @@ public class Zavai : Gtk.Window, zavai.Resource
             show_all();
         }
     }
-
-    public void run_script(string command)
-    {
-        zavai.log.info("Run program: " + command);
-        string[] args = command.split(" ");
-        Pid pid;
-        try {
-            Process.spawn_async(
-                Environment.get_home_dir(),
-                args,
-                null,
-                SpawnFlags.SEARCH_PATH,
-                null,
-                out pid);
-        } catch (SpawnError e) {
-            zavai.log.error("Running " + command + ": " + e.message);
-        }
-    }
 }
 
 public abstract class Applet : Gtk.VBox, Resource
@@ -308,7 +290,7 @@ public abstract class AppletLink : BigButton
         set_label(a.label);
     }
 
-    private abstract void on_clicked(Gtk.Button src);
+    public abstract void on_clicked(Gtk.Button src);
 
     public AppletLink(Applet? applet = null)
     {
@@ -326,7 +308,7 @@ public abstract class AppletLink : BigButton
 
 public class AppletStraightLink : AppletLink
 {
-    private override void on_clicked(Gtk.Button src)
+    public override void on_clicked(Gtk.Button src)
     {
 //stderr.printf("straight link: %s\n", _target);
         if (_target != null)
@@ -341,7 +323,7 @@ public class AppletStraightLink : AppletLink
 
 public class AppletPushLink : AppletLink
 {
-    private override void on_clicked(Gtk.Button src)
+    public override void on_clicked(Gtk.Button src)
     {
 //stderr.printf("push link: %s\n", _target);
         if (_target != null)
@@ -369,13 +351,21 @@ public class ServiceRequestLink : Gtk.ToggleButton
         set_label(get_active() ? label_stop : label_start);
     }
 
+    private void on_service_toggled(bool val)
+    {
+        set_active(val);
+        //set_label(val ? label_stop : label_start);
+    }
+
     public ServiceRequestLink(Service service, string label_start, string label_stop)
     {
         this.service = service;
         this.label_start = label_start;
         this.label_stop = label_stop;
         set_size_request(0, zavai.config.min_button_height);
+        set_active(service.started);
         toggled += on_toggled;
+        service.toggled += on_service_toggled;
 
         set_label(get_active() ? label_stop : label_start);
     }