Merge branch 'master' into gregoa
authorgregor herrmann <gregoa@debian.org>
Sun, 28 Mar 2010 09:21:41 +0000 (11:21 +0200)
committergregor herrmann <gregoa@debian.org>
Sun, 28 Mar 2010 09:21:41 +0000 (11:21 +0200)
13 files changed:
.gitignore [new file with mode: 0644]
icons/bt_0.png [new file with mode: 0644]
icons/bt_1.png [new file with mode: 0644]
icons/gsm_0.png [new file with mode: 0644]
icons/gsm_000.png [new file with mode: 0644]
icons/gsm_020.png [new file with mode: 0644]
icons/gsm_040.png [new file with mode: 0644]
icons/gsm_060.png [new file with mode: 0644]
icons/gsm_080.png [new file with mode: 0644]
icons/gsm_100.png [new file with mode: 0644]
icons/wifi_0.png [new file with mode: 0644]
icons/wifi_1.png [new file with mode: 0644]
src/app_wifi.vala

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..378eac2
--- /dev/null
@@ -0,0 +1 @@
+build
diff --git a/icons/bt_0.png b/icons/bt_0.png
new file mode 100644 (file)
index 0000000..b634150
Binary files /dev/null and b/icons/bt_0.png differ
diff --git a/icons/bt_1.png b/icons/bt_1.png
new file mode 100644 (file)
index 0000000..17806cb
Binary files /dev/null and b/icons/bt_1.png differ
diff --git a/icons/gsm_0.png b/icons/gsm_0.png
new file mode 100644 (file)
index 0000000..8c09196
Binary files /dev/null and b/icons/gsm_0.png differ
diff --git a/icons/gsm_000.png b/icons/gsm_000.png
new file mode 100644 (file)
index 0000000..d7f5846
Binary files /dev/null and b/icons/gsm_000.png differ
diff --git a/icons/gsm_020.png b/icons/gsm_020.png
new file mode 100644 (file)
index 0000000..db9a75e
Binary files /dev/null and b/icons/gsm_020.png differ
diff --git a/icons/gsm_040.png b/icons/gsm_040.png
new file mode 100644 (file)
index 0000000..2a8aa0d
Binary files /dev/null and b/icons/gsm_040.png differ
diff --git a/icons/gsm_060.png b/icons/gsm_060.png
new file mode 100644 (file)
index 0000000..4e10af8
Binary files /dev/null and b/icons/gsm_060.png differ
diff --git a/icons/gsm_080.png b/icons/gsm_080.png
new file mode 100644 (file)
index 0000000..84356df
Binary files /dev/null and b/icons/gsm_080.png differ
diff --git a/icons/gsm_100.png b/icons/gsm_100.png
new file mode 100644 (file)
index 0000000..8881dac
Binary files /dev/null and b/icons/gsm_100.png differ
diff --git a/icons/wifi_0.png b/icons/wifi_0.png
new file mode 100644 (file)
index 0000000..928d615
Binary files /dev/null and b/icons/wifi_0.png differ
diff --git a/icons/wifi_1.png b/icons/wifi_1.png
new file mode 100644 (file)
index 0000000..ff28d9e
Binary files /dev/null and b/icons/wifi_1.png differ
index b694be5c5265a0b48f99fd3e87f84b8db4fb54f9..57d22d5746923c26c2588a116336a8ee17aa5b68 100644 (file)
@@ -24,10 +24,57 @@ namespace zavai {
 namespace ui {
 namespace wifi {
 
+public class WifiIcon : Gtk.StatusIcon
+{
+    bool requested = false;
+
+    public WifiIcon()
+    {
+        activate += on_activate;
+        update_icon();
+    }
+
+    private void on_activate()
+    {
+        requested = !requested;
+        update_icon();
+        if (requested)
+        {
+            //zavai.wifi.wifi.start();
+            stderr.printf("wifi should be started here\n");
+            stderr.printf("wifi status: %d\n", (int) zavai.wifi.wifi.started);
+        }
+        else
+        {
+            //zavai.wifi.wifi.stop();
+            stderr.printf("wifi should be stopped here\n");
+            stderr.printf("wifi status: %d\n", (int) zavai.wifi.wifi.started);
+        }
+    }
+
+    protected void update_icon()
+    {
+        string name = zavai.config.icondir + "/";
+        name += (active() ? "wifi_1.png" : "wifi_0.png");
+        stderr.printf("load icon from %s\n", name);
+        set_from_file(name);
+    }
+
+    private bool active()
+    {
+        return zavai.wifi.wifi.started;
+    }
+}
+
+WifiIcon icon;
+
 public void init()
 {
     // Menus
     zavai.menu_misc.add_service_toggle(zavai.wifi.wifi, "Start Wifi", "Stop Wifi");
+    // Icon
+    icon = new WifiIcon();
+    icon.set_visible(true);
 }
 
 }