Added zavai icons
authorEnrico Zini <enrico@enricozini.org>
Mon, 27 Jul 2009 17:42:07 +0000 (19:42 +0200)
committerEnrico Zini <enrico@enricozini.org>
Mon, 27 Jul 2009 17:42:07 +0000 (19:42 +0200)
icons/zavai.xcf [new file with mode: 0644]
icons/zavai_off.png [new file with mode: 0644]
icons/zavai_on.png [new file with mode: 0644]
src/app_wm.vala

diff --git a/icons/zavai.xcf b/icons/zavai.xcf
new file mode 100644 (file)
index 0000000..c08be9e
Binary files /dev/null and b/icons/zavai.xcf differ
diff --git a/icons/zavai_off.png b/icons/zavai_off.png
new file mode 100644 (file)
index 0000000..548ec59
Binary files /dev/null and b/icons/zavai_off.png differ
diff --git a/icons/zavai_on.png b/icons/zavai_on.png
new file mode 100644 (file)
index 0000000..d674b87
Binary files /dev/null and b/icons/zavai_on.png differ
index 957d856aa6835ec0a7127cb259ecd5b805de42ce..630b25879fa9d8a309c71e8744a4530e9a08373d 100644 (file)
@@ -25,107 +25,6 @@ namespace ui {
 namespace wm {
 
 /*
-class GPSOn(gtk.ToggleAction):
-    states = [_("GPS always on"), _("GPS on when needed")]
-
-    def __init__(self, registry, **kw):
-        self.state = 0
-        super(GPSOn, self).__init__("menu.main.gps.alwayson", self.states[self.state], None, None)
-
-        self.registry = registry
-        self.set_active(False)
-
-        self.connect("toggled", self.on_toggle)
-
-    def on_toggle(self, *args):
-        self.state = (self.state + 1) % len(self.states)
-        self.set_property("label", self.states[self.state])
-        if self.get_active():
-            self.start()
-        else:
-            self.stop()
-
-    def start(self):
-        self.registry.resource("gps").connect("gps", self)
-
-    def stop(self):
-        self.registry.resource("gps").disconnect("gps", self)
-
-class GPXTracer(gtk.ToggleAction):
-    states = [_("Start GPX trace"), _("Stop GPX trace")]
-
-    def __init__(self, registry, **kw):
-        self.state = 0
-        super(GPXTracer, self).__init__("menu.main.gps.gpx", self.states[self.state], None, None)
-
-        self.registry = registry
-        self.set_active(False)
-
-        self.connect("toggled", self.on_toggle)
-
-    def on_toggle(self, *args):
-        self.state = (self.state + 1) % len(self.states)
-        self.set_property("label", self.states[self.state])
-        if self.get_active():
-            self.start()
-        else:
-            self.stop()
-
-    def start(self):
-        zavai.info("GPX trace started")
-        self.registry.resource("gpx").connect("gpx", self)
-
-    def stop(self):
-        zavai.info("GPX trace ended")
-        self.registry.resource("gpx").disconnect("gpx", self)
-*/
-
-/*
-class GPXAudioTracer(gtk.ToggleAction):
-    states = [_("Start GPX and audio trace"), _("Stop GPX and audio trace")]
-
-    def __init__(self, registry, **kw):
-        self.state = 0
-        super(GPXAudioTracer, self).__init__("menu.main.gps.gpxaudio", self.states[self.state], None, None)
-
-        self.registry = registry
-        self.recorder = zavai.Recorder(registry)
-        self.set_active(False)
-
-        self.connect("toggled", self.on_toggle)
-
-    def shutdown(self):
-        self.recorder.stop()
-        super(GPXAudioTracer, self).shutdown()
-
-    def on_toggle(self, *args):
-        self.state = (self.state + 1) % len(self.states)
-        self.set_property("label", self.states[self.state])
-        if self.get_active():
-            self.start()
-        else:
-            self.stop()
-
-    def start(self):
-        zavai.info("GPX trace started")
-        gpx = self.registry.resource("gpx")
-        gpx.connect("gpx", self)
-        gpx.add_activity_monitor(self.on_gpx_activity_changed)
-
-    def stop(self):
-        zavai.info("GPX trace ended")
-        gpx = self.registry.resource("gpx")
-        gpx.disconnect("gpx", self)
-        self.recorder.stop()
-        gpx.del_activity_monitor(self.on_gpx_activity_changed)
-
-    def on_gpx_activity_changed(self, gpx, state):
-        if state:
-            self.recorder.start(gpx.basename + ".wav")
-        else:
-            self.recorder.stop()
-*/
-
 static void print_window_state(Gtk.Window w)
 {
        Gdk.WindowState state = w.window.get_state();
@@ -149,33 +48,14 @@ static void print_window_state(Gtk.Window w)
                        is_tfocus ? "true" : "false"
                     );
 }
+*/
 
 public class RaiseIcon : Gtk.StatusIcon
 {
-       /*
-       public bool on_focus_in (Gdk.EventFocus event)
-       {
-               stderr.printf("FOCUS IN %c %d\n", event.send_event, event.in);
-               //update_icon();
-               return true;
-       }
-       public bool on_focus_out (Gdk.EventFocus event)
-       {
-               stderr.printf("FOCUS OUT %c %d\n", event.send_event, event.in);
-               //update_icon();
-               return true;
-       }
-       */
-
        public RaiseIcon()
        {
                activate += on_activate;
                zavai.app.visibility_changed += on_visibility_changed;
-               /*
-               zavai.app.focus_in_event += on_focus_in;
-               zavai.app.focus_out_event += on_focus_out;
-               */
-
                update_icon();
        }
 
@@ -188,105 +68,25 @@ public class RaiseIcon : Gtk.StatusIcon
        {
                zavai.app.toggle_visibility();
                update_icon();
-
        }
 
        protected void update_icon()
        {
                string name = zavai.config.icondir + "/";
                if (!zavai.app.visibility)
-                       name += "kbd_on.png";
+                       name += "zavai_on.png";
                else
-                       name += "kbd_off.png";
+                       name += "zavai_off.png";
                set_from_file(name);
        }
 }
 
-public class Test : BigButton
-{
-    public Test()
-    {
-           set_label("Window state");
-           clicked += on_clicked;
-    }
-
-    protected void on_clicked()
-    {
-           print_window_state(zavai.app);
-    }
-}
-
-
-/*
-public class Waypoint : BigButton
-{
-    public Waypoint()
-    {
-        set_label("Take waypoint");
-        zavai.gps.gpx.tracking_changed += on_gpx_tracking_changed;
-        clicked += on_clicked;
-        set_sensitive(zavai.gps.gpx.tracking);
-    }
-
-    protected void on_gpx_tracking_changed(zavai.gps.GPX gpx, bool new_state)
-    {
-stderr.printf("Toggled %d\n", (int)new_state);
-        set_sensitive(new_state);
-    }
-
-    protected void on_clicked()
-    {
-stderr.printf("Activate\n");
-        zavai.gps.gpx.waypoint();
-    }
-}
-*/
-
-/*
-public class GPSRequestLink : Gtk.ToggleButton
-{
-       public GPSRequestLink()
-       {
-        // GPS status icon
-        status_icon = new Gtk.StatusIcon();
-        status_icon.set_visible(true);
-        status_icon.activate += on_status_activate;
-        update_icon();
-       }
-
-    private void on_fix_status_changed(dynamic DBus.Object pos, int fix_status)
-    {
-        this.fix_status = fix_status;
-        update_icon();
-    }
-
-       private void on_toggled(Gtk.Button src)
-       {
-               Service s = zavai.registry.gets(service_name);
-               if (get_active())
-                       s.request("servicerequestlink");
-               else
-                       s.release("servicerequestlink");
-               set_label(get_active() ? label_stop : label_start);
-        update_icon();
-       }
-
-    private void on_status_activate()
-    {
-        set_active(!get_active());
-    }
-}
-*/
-
 RaiseIcon raise_icon;
 
 public void init()
 {
        raise_icon = new RaiseIcon();
        raise_icon.set_visible(true);
-
-       var menu_test = new Test();
-       zavai.registry.getmenu("menu.main").add_widget(menu_test);
 }
 
 }