File: IndicatorMonoExample.cs

package info (click to toggle)
libindicate 0.6.92-2%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 3,232 kB
  • ctags: 1,076
  • sloc: sh: 11,407; ansic: 5,175; xml: 1,491; makefile: 902; python: 96; cs: 35
file content (40 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using Indicate;
using Gtk;
using GLib;

namespace IndicatorExample
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			Application.Init ();
			Indicate.Server server = Indicate.Server.RefDefault();
			server.SetType("message.im");
			server.DesktopFile("/usr/share/applications/empathy.desktop");
			server.ServerDisplay += new Indicate.ServerDisplayHandler(ServerDisplay);
			server.Show();

			Indicator indicator = new Indicate.Indicator();
			indicator.SetProperty("subtype", "im");
			indicator.SetProperty("sender", "Barney Rubble");
			indicator.UserDisplay += new EventHandler(UserDisplay);
			indicator.Show();

			Application.Run ();
		}
		
		public static void ServerDisplay (object sender, Indicate.ServerDisplayArgs args)
		{
			Console.WriteLine ("Server was displayed");
		}
		
		public static void UserDisplay (object sender, System.EventArgs args)
		{
			Console.WriteLine ("Indicator was displayed");
			Indicate.Indicator indicator = sender as Indicate.Indicator;
			indicator.Hide();
		}
	}
}