updated on Fri Jan 13 08:00:32 UTC 2012
[aur-mirror.git] / dcsharp / trayicon.patch
blob0498047b5904d1b6ce5b714fce01a359fb9bff4a
1 *** gtk/src/MainWindow.cs.orig 2009-06-01 20:40:04.000000000 +0400
2 --- gtk/src/MainWindow.cs 2009-06-01 20:46:52.000000000 +0400
3 ***************
4 *** 73,78 ****
5 --- 73,81 ----
7 [Widget]
8 private ProgressBar progressBar;
9 +
10 + private static StatusIcon trayIcon;
13 #region Constructors
15 ***************
16 *** 200,210 ****
17 --- 203,239 ----
18 Box connectionStatus = new ConnectionStatusbar(connectionManager);
19 connectionStatus.Show();
20 statusBox.PackStart(connectionStatus, false, true, 0);
22 + trayIcon = StatusIcon.NewFromStock(Stock.Network);
23 + trayIcon.Visible = true;
25 + // Show/Hide the window (even from the Panel/Taskbar) when the TrayIcon has been clicked.
26 + trayIcon.Activate += delegate { Window.Visible = !Window.Visible; };
27 + // Show a pop up menu when the icon has been right clicked.
28 + trayIcon.PopupMenu += OnTrayIconPopup;
30 + // A Tooltip for the Icon
31 + trayIcon.Tooltip = "DC#";
34 // Events
35 favoriteHubManager.HubAdded += OnFavoriteHubCountChanged;
36 favoriteHubManager.HubRemoved += OnFavoriteHubCountChanged;
39 + static void OnTrayIconPopup (object o, EventArgs args)
40 + {
41 + Menu popupMenu = new Menu();
42 + ImageMenuItem menuItemQuit = new ImageMenuItem ("Quit");
43 + Gtk.Image appimg = new Gtk.Image(Stock.Quit, IconSize.Menu);
44 + menuItemQuit.Image = appimg;
45 + popupMenu.Add(menuItemQuit);
46 + // Quit the application when quit has been clicked.
47 + menuItemQuit.Activated += delegate { Application.Quit(); };
48 + popupMenu.ShowAll();
49 + popupMenu.Popup();
50 + }
53 #endregion