~ubuntu-branches/ubuntu/hardy/blam/hardy-updates

« back to all changes in this revision

Viewing changes to src/TrayIcon.cs

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2005-09-27 21:38:56 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050927213856-8no09ppptvhpqqsh
Tags: 1.8.2-2ubuntu6
Change .desktop comment description

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
 
// Author: 
 
2
// Author:
3
3
//   Mikael Hallendal <micke@imendio.com>
4
4
//
5
5
// (C) 2004 Imendio HB
6
 
// 
 
6
//
7
7
 
8
8
using Gtk;
9
9
using System;
10
 
using System.Runtime.InteropServices;
11
10
 
12
11
namespace Imendio.Blam {
13
 
    public class TrayIcon : Gtk.Plug {
14
 
        private string       mName;
 
12
    public class TrayIcon : Egg.TrayIcon {
15
13
        private Gtk.EventBox mEventBox;
16
14
        private Gtk.Image    mImage;
17
15
        private Gtk.Tooltips mTooltips;
30
28
            }
31
29
        }
32
30
 
33
 
        [DllImport ("libblam.so")]
34
 
            static extern IntPtr egg_tray_icon_new (string name);
 
31
        public TrayIcon (string name) : base (name)
 
32
        {
 
33
            Init ();
 
34
        }
35
35
        
36
 
        public TrayIcon (string name) 
37
 
        {
38
 
            mName = name;
39
 
            
40
 
            Init ();
41
 
        }
42
 
 
43
 
        public new void Show ()
44
 
        {
45
 
            ShowAll ();
46
 
        }
47
 
 
48
36
        private void Init ()
49
37
        {
50
 
            Raw = egg_tray_icon_new (mName);
51
 
            
52
38
            DestroyEvent += HandleDestroyEvent;
53
39
 
54
 
            mImage = new Gtk.Image ();
55
40
            mEventBox = new Gtk.EventBox ();
56
 
            mEventBox.Add (mImage);
 
41
            mEventBox.Add (mImage = new Image ());
57
42
 
58
43
            mEventBox.ButtonPressEvent += ButtonPressedCb;
59
44
 
60
45
            mTooltips = new Gtk.Tooltips ();
61
 
            
62
 
            this.Add (mEventBox);       
 
46
 
 
47
            this.Add (mEventBox);
 
48
        }
 
49
 
 
50
        public new void Show ()
 
51
        {
 
52
            ShowAll ();
63
53
        }
64
54
 
65
55
        private void ButtonPressedCb (object o, ButtonPressEventArgs args)
71
61
 
72
62
        private void HandleDestroyEvent (object o, DestroyEventArgs args)
73
63
        {
 
64
            System.Console.WriteLine ("Tray destroyed");
74
65
            Init ();
75
66
        }
76
67
    }