Back to index

libappindicator  12.10.0
IndicatorExample.cs
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009 Canonical Ltd.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as published
00006  * by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License along
00014  * with this program.  If not, see <http://www.gnu.org/licenses/>.
00015  *
00016  * Authors:
00017  *   Cody Russell <cody.russell@canonical.com>
00018  */
00019 
00020 using Gtk;
00021 using AppIndicator;
00022 
00023 public class IndicatorExample
00024 {
00025         public static void Main ()
00026         {
00027                 Application.Init ();
00028 
00029                 Window win = new Window ("Test");
00030                 win.Resize (200, 200);
00031 
00032                 Label label = new Label ();
00033                 label.Text = "Hello, world!";
00034 
00035                 win.Add (label);
00036 
00037                 ApplicationIndicator indicator = new ApplicationIndicator ("Example",
00038                                                                            "applications-microblogging-panel",
00039                                                                            Category.ApplicationStatus);
00040 
00041                 indicator.Status = Status.Attention;
00042 
00043                 Menu menu = new Menu ();
00044                 var foo = new MenuItem ("Foo");
00045                 menu.Append (foo);
00046                 foo.Activated += delegate {
00047                         System.Console.WriteLine ("Foo item has been activated");
00048                 };
00049 
00050                 menu.Append (new MenuItem ("Bar"));
00051 
00052                 indicator.Menu = menu;
00053                 indicator.Menu.ShowAll ();
00054 
00055                 indicator.SecondaryActivateTarget = foo;
00056 
00057                 win.ShowAll ();
00058 
00059                 Application.Run ();
00060         }
00061 }