Moved gps status icon to main screen
authorEnrico Zini <enrico@enricozini.org>
Mon, 17 Aug 2009 09:23:40 +0000 (10:23 +0100)
committerEnrico Zini <enrico@enricozini.org>
Mon, 17 Aug 2009 09:23:40 +0000 (10:23 +0100)
src/app.vala
src/app_gps.vala
src/app_main.vala
src/zavai.vala

index 47f0af952c48c8184059098d425fcfb9e984977e..1a9fc2dbbecda84e32134a864c974b77ec68550d 100644 (file)
@@ -390,6 +390,36 @@ public class ServiceRequestLink : Gtk.ToggleButton
        }
 }
 
+public class StatusIcon : Gtk.Button
+{
+       private Gtk.Image image_widget;
+
+       public signal void activate();
+
+       public StatusIcon()
+       {
+               relief = Gtk.ReliefStyle.NONE;
+               image_widget = new Gtk.Image();
+               image = image_widget;
+               clicked += on_clicked;
+       }
+
+       public void set_from_file(string file)
+       {
+               image_widget.set_from_file(file);
+       }
+
+       public void install()
+       {
+               zavai.ui.main.status.status_icons.pack_start(this, false, false, 0);
+       }
+
+       private void on_clicked(Gtk.Button b)
+       {
+               activate();
+       }
+}
+
 public class CommandButton : Gtk.Button
 {
        private string command;
index 12c5f05d1f5ce69db0f0d579977f4f3d5c055c51..694a53680dabaeb033ee1ce20148ddf90141e668 100644 (file)
@@ -154,7 +154,7 @@ public class GPSRequestLink : Gtk.ToggleButton
        protected string service_name;
        protected string label_start;
        protected string label_stop;
-       protected Gtk.StatusIcon status_icon;
+       protected zavai.StatusIcon status_icon;
        protected int fix_status = 0;
 
        public GPSRequestLink()
@@ -176,8 +176,8 @@ public class GPSRequestLink : Gtk.ToggleButton
                zavai.gps.gps.device.FixStatusChanged += on_fix_status_changed;
 
                // GPS status icon
-               status_icon = new Gtk.StatusIcon();
-               status_icon.set_visible(true);
+               status_icon = new zavai.StatusIcon();
+               status_icon.install();
                status_icon.activate += on_status_activate;
                update_icon();
        }
index 7553c1ae2105fa48187e3a0fdc3f843edb591459..550f338f5697d02aa8bcf7976c3a1d0b8a6dbc59 100644 (file)
@@ -113,15 +113,18 @@ public class Clock : Gtk.VBox
 
 public class Status : Applet
 {
+    public Gtk.HBox status_icons;
     public Clock clock;
     public AppletPushLink menu;
 
        public Status(string label)
        {
                _label = label;
+        status_icons = new Gtk.HBox(false, 0);
         clock = new Clock();
         menu = new AppletPushLink("menu.main");
 
+               pack_start(status_icons, false, false, 0);
                pack_start(clock, false, false, 0);
                pack_end(menu, false, false, 0);
        }
index ab026ecde9246ca72e2c844e6c0cfb89ec319a90..4b89f195006de7b2b3aea21966e988ee7ed15b6b 100644 (file)
@@ -64,13 +64,13 @@ static int main (string[] args) {
        zavai.registry.register_menu("menu.main", new zavai.Menu("Main menu"));
 
        // User interface
+       zavai.ui.main.init();
        zavai.ui.gps.init();
        zavai.ui.power.init();
        zavai.ui.kbd.init();
        zavai.ui.wm.init();
        zavai.ui.polygen.init();
        zavai.ui.debug.init();
-       zavai.ui.main.init();
 
        //zavai.app.show_applet("menu.main");
        zavai.app.show_applet("zavai.status");