aboutsummaryrefslogtreecommitdiff
path: root/bindings/vala/examples/ayatana-indicator-example.vala
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-11-09 20:58:24 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2015-11-10 04:58:57 +0000
commitdef21c26e7c517b3abd8db299b8601742bccbafd (patch)
tree1ab46a157df1b28f1545b89d05c5b00a1466ec0a /bindings/vala/examples/ayatana-indicator-example.vala
parentbf7bc280421b10b395e8620181568ea389b8a396 (diff)
downloadlibayatana-appindicator-def21c26e7c517b3abd8db299b8601742bccbafd.tar.gz
libayatana-appindicator-def21c26e7c517b3abd8db299b8601742bccbafd.tar.bz2
libayatana-appindicator-def21c26e7c517b3abd8db299b8601742bccbafd.zip
Fork from Ubuntu's libappindicator project.
Diffstat (limited to 'bindings/vala/examples/ayatana-indicator-example.vala')
-rw-r--r--bindings/vala/examples/ayatana-indicator-example.vala66
1 files changed, 66 insertions, 0 deletions
diff --git a/bindings/vala/examples/ayatana-indicator-example.vala b/bindings/vala/examples/ayatana-indicator-example.vala
new file mode 100644
index 0000000..764009f
--- /dev/null
+++ b/bindings/vala/examples/ayatana-indicator-example.vala
@@ -0,0 +1,66 @@
+/*
+ * 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);
+ if (!(indicator is Indicator)) return -1;
+
+ indicator.set_status(IndicatorStatus.ACTIVE);
+ indicator.set_attention_icon("indicator-messages-new");
+
+ var menu = new Gtk.Menu();
+
+ var item = new Gtk.MenuItem.with_label("Foo");
+ item.activate.connect(() => {
+ indicator.set_status(IndicatorStatus.ATTENTION);
+ });
+ item.show();
+ menu.append(item);
+
+ var bar = item = new Gtk.MenuItem.with_label("Bar");
+ item.show();
+ item.activate.connect(() => {
+ indicator.set_status(IndicatorStatus.ACTIVE);
+ });
+ menu.append(item);
+
+ indicator.set_menu(menu);
+ indicator.set_secondary_activate_target(bar);
+
+ win.show_all();
+
+ Gtk.main();
+ return 0;
+ }
+}