aboutsummaryrefslogtreecommitdiff
path: root/bindings/vala/examples/indicator-example.vala
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-02-11 10:34:20 -0500
committerKen VanDine <ken.vandine@canonical.com>2011-02-11 10:34:20 -0500
commita83d65cd02023cdddb6f1455f1a9877c85bd84ea (patch)
tree9225a9b221d16cceae948cf8c528e2fe89ef2c9b /bindings/vala/examples/indicator-example.vala
parenta9d343cf51cb3595491cfcbc6c9686b049c30160 (diff)
parent26b952114c696b0f373d848c6de6b1c9bd937b46 (diff)
downloadlibayatana-appindicator-a83d65cd02023cdddb6f1455f1a9877c85bd84ea.tar.gz
libayatana-appindicator-a83d65cd02023cdddb6f1455f1a9877c85bd84ea.tar.bz2
libayatana-appindicator-a83d65cd02023cdddb6f1455f1a9877c85bd84ea.zip
releasing version 0.2.95-0ubuntu10.2.95-0ubuntu1
Diffstat (limited to 'bindings/vala/examples/indicator-example.vala')
-rw-r--r--bindings/vala/examples/indicator-example.vala64
1 files changed, 64 insertions, 0 deletions
diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala
new file mode 100644
index 0000000..621c962
--- /dev/null
+++ b/bindings/vala/examples/indicator-example.vala
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2011 Canonical Ltd.
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 3, as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranties of
+ * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Marco Trevisan (TreviƱo) <mail@3v1n0.net>
+ */
+
+using Gtk;
+using AppIndicator;
+
+public class IndicatorExample {
+ public static int main(string[] args) {
+ Gtk.init(ref args);
+
+ var win = new Window();
+ win.title = "Indicator Test";
+ win.resize(200, 200);
+ win.destroy.connect(Gtk.main_quit);
+
+ var label = new Label("Hello, world!");
+ win.add(label);
+
+ var indicator = new Indicator(win.title, "indicator-messages",
+ IndicatorCategory.APPLICATION_STATUS);
+
+ indicator.set_status(IndicatorStatus.ACTIVE);
+ indicator.set_attention_icon("indicator-messages-new");
+
+ var menu = new Menu();
+
+ var item = new MenuItem.with_label("Foo");
+ item.activate.connect(() => {
+ indicator.set_status(IndicatorStatus.ATTENTION);
+ });
+ item.show();
+ menu.append(item);
+
+ item = new MenuItem.with_label("Bar");
+ item.show();
+ item.activate.connect(() => {
+ indicator.set_status(IndicatorStatus.ATTENTION);
+ });
+ menu.append(item);
+
+ indicator.set_menu(menu);
+
+ win.show_all();
+
+ Gtk.main();
+ return 0;
+ }
+}