Created
March 26, 2015 08:09
-
-
Save sneetsher/7b95177c650c5d17ffa0 to your computer and use it in GitHub Desktop.
Ubuntu Unity - indicator demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Compile & Run: | |
dmcs -pkg:gtk-sharp-2.0 -pkg:appindicator-sharp-0.1 indicator_demo.cs | |
mono indicator_demo.exe | |
*/ | |
using Gtk; | |
using AppIndicator; | |
public class IndicatorExample | |
{ | |
static Window win; | |
static ApplicationIndicator indicator; | |
static int c; | |
public static void Main () | |
{ | |
Application.Init (); | |
win = new Window ("Test"); | |
win.Resize (200, 200); | |
Label label = new Label (); | |
label.Text = "Hello, world!"; | |
win.Add (label); | |
indicator = new ApplicationIndicator ("my-id", | |
"my-name", | |
Category.ApplicationStatus); | |
indicator.Status = Status.Attention; | |
Menu menu = new Menu (); | |
//menu.Append (new MenuItem ("Foo")); | |
//menu.Append (new MenuItem ("Bar")); | |
indicator.Menu = menu; | |
indicator.Menu.Show(); | |
indicator.Label = "init label"; | |
win.ShowAll (); | |
indicator.Label = "label2"; | |
c = 0; | |
GLib.Timeout.Add (1000, new GLib.TimeoutHandler (update)); | |
Application.Run (); | |
} | |
public static bool update() | |
{ | |
c+=1; | |
indicator.Label = c.ToString(); | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment