nemo r85 - in trunk: . gtk
- From: arj svn gnome org
- To: svn-commits-list gnome org
- Subject: nemo r85 - in trunk: . gtk
- Date: Wed, 13 Feb 2008 13:13:47 +0000 (GMT)
Author: arj
Date: Wed Feb 13 13:13:47 2008
New Revision: 85
URL: http://svn.gnome.org/viewvc/nemo?rev=85&view=rev
Log:
Use StatusIcon instead of ugly Traylib wrapper
This information http://www.mono-project.com/GtkSharpNotificationIcon is outdated
Removed:
trunk/gtk/TrayLib.cs
Modified:
trunk/gtk/Main.cs
trunk/gtk/MainWindow.cs
trunk/gtk/Tray.cs
trunk/nemo.mdp
Modified: trunk/gtk/Main.cs
==============================================================================
--- trunk/gtk/Main.cs (original)
+++ trunk/gtk/Main.cs Wed Feb 13 13:13:47 2008
@@ -24,6 +24,7 @@
MainWindow win = new MainWindow(reindex, hidden);
if (!hidden)
win.Show();
+
Application.Run();
}
}
Modified: trunk/gtk/MainWindow.cs
==============================================================================
--- trunk/gtk/MainWindow.cs (original)
+++ trunk/gtk/MainWindow.cs Wed Feb 13 13:13:47 2008
@@ -12,7 +12,7 @@
public partial class MainWindow: Gtk.Window
{
// helper classes
- Tray tray;
+ private Tray tray;
// restrictions
CalendarDriver calendar_driver;
@@ -85,7 +85,7 @@
tray.main_quit = delegate {
broker.stop();
};
-
+
// helpers
starred_button_active = false;
Modified: trunk/gtk/Tray.cs
==============================================================================
--- trunk/gtk/Tray.cs (original)
+++ trunk/gtk/Tray.cs Wed Feb 13 13:13:47 2008
@@ -23,86 +23,29 @@
hidden = true;
}
+ private StatusIcon icon;
+
public Tray(MainWindow window)
{
main_window = window;
hidden = false;
- EventBox eb = new Gtk.EventBox();
- eb.Add(new Gtk.Image(null, "small_blue_guy.png"));
- eb.ButtonPressEvent += OnImageClick;
- Egg.TrayIcon icon = new Egg.TrayIcon("Test");
- icon.Add(eb);
- icon.ShowAll();
+ icon = new StatusIcon(Gdk.Pixbuf.LoadFromResource("small_blue_guy.png"));
+ icon.Activate += popupActivated;
+ icon.PopupMenu += popupMenuHandler;
+ icon.Tooltip = " Nemo ";
}
- private void OnImageClick(object o, ButtonPressEventArgs args)
+ private void popupActivated(object o, System.EventArgs args)
{
- if (args.Event.Button == 3) //right click
- {
- Menu popupMenu = new Menu();
-
- // add show
- ImageMenuItem menuPopup1;
- if (hidden)
- menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Show window"));
- else
- menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Hide window"));
- menuPopup1.Image = new Image(Stock.Refresh, IconSize.Menu);
- popupMenu.Add(menuPopup1);
- menuPopup1.Activated += delegate {
- if (hidden)
- {
- main_window.ShowAll();
- restore_position();
- hidden = false;
- main_window.Unref(); // restore correct reference count
- }
- else
- {
- hide_window();
- }
- };
-
- ImageMenuItem menuPopup0 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Indexing status"));
- popupMenu.Add(menuPopup0);
- menuPopup0.Activated += delegate {
- Singleton<Indexing>.Instance.Show();
- };
-
- ImageMenuItem menuPopup2 = new ImageMenuItem(Mono.Unix.Catalog.GetString("About"));
- menuPopup2.Image = new Image(Stock.About, IconSize.Menu);
- popupMenu.Add(menuPopup2);
- menuPopup2.Activated += delegate {
- Gtk.AboutDialog about = new AboutDialog();
- about.Name = "Nemo";
- about.Authors = new string[] { "Anders Rune Jensen", "Lau Bech Lauritzen", "Ole Laursen" };
- about.Artists = new string[] { "Linda Nhu", "Sune Theodorsen" };
- about.Comments = Mono.Unix.Catalog.GetString("Nemo is a file manager for those who would rather have their files manage themselves.");
- about.Logo = new Gdk.Pixbuf(null, "blue_guy_med.png");
- about.Response += delegate {
- about.Destroy();
- };
- about.Show();
- };
-
- // add quit
- ImageMenuItem menuPopup3 = new ImageMenuItem (Mono.Unix.Catalog.GetString("Quit"));
- menuPopup3.Image = new Image(Stock.Quit, IconSize.Menu);
- popupMenu.Add(menuPopup3);
- menuPopup3.Activated += new EventHandler(this.OnPopupClick);
-
- popupMenu.ShowAll();
- popupMenu.Popup(null, null, null, args.Event.Button, args.Event.Time);
- }
- else if (args.Event.Button == 1 && hidden)
+ if (hidden)
{
main_window.ShowAll();
restore_position();
hidden = false;
main_window.Unref(); // restore correct reference count
}
- else if (args.Event.Button == 1 && !hidden)
+ else
{
if (main_window.HasToplevelFocus)
hide_window();
@@ -110,7 +53,65 @@
main_window.Present();
}
}
+
+ private void popupMenuHandler(object o, Gtk.PopupMenuArgs args)
+ {
+ Menu popupMenu = new Menu();
+
+ // add show
+ ImageMenuItem menuPopup1;
+ if (hidden)
+ menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Show window"));
+ else
+ menuPopup1 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Hide window"));
+ menuPopup1.Image = new Image(Stock.Refresh, IconSize.Menu);
+ popupMenu.Add(menuPopup1);
+ menuPopup1.Activated += delegate {
+ if (hidden)
+ {
+ main_window.ShowAll();
+ restore_position();
+ hidden = false;
+ main_window.Unref(); // restore correct reference count
+ }
+ else
+ {
+ hide_window();
+ }
+ };
+ ImageMenuItem menuPopup0 = new ImageMenuItem(Mono.Unix.Catalog.GetString("Indexing status"));
+ popupMenu.Add(menuPopup0);
+ menuPopup0.Activated += delegate {
+ Singleton<Indexing>.Instance.Show();
+ };
+
+ ImageMenuItem menuPopup2 = new ImageMenuItem(Mono.Unix.Catalog.GetString("About"));
+ menuPopup2.Image = new Image(Stock.About, IconSize.Menu);
+ popupMenu.Add(menuPopup2);
+ menuPopup2.Activated += delegate {
+ Gtk.AboutDialog about = new AboutDialog();
+ about.Name = "Nemo";
+ about.Authors = new string[] { "Anders Rune Jensen", "Lau Bech Lauritzen", "Ole Laursen" };
+ about.Artists = new string[] { "Linda Nhu", "Sune Theodorsen" };
+ about.Comments = Mono.Unix.Catalog.GetString("Nemo is a file manager for those who would rather have their files manage themselves.");
+ about.Logo = new Gdk.Pixbuf(null, "blue_guy_med.png");
+ about.Response += delegate {
+ about.Destroy();
+ };
+ about.Show();
+ };
+
+ // add quit
+ ImageMenuItem menuPopup3 = new ImageMenuItem (Mono.Unix.Catalog.GetString("Quit"));
+ menuPopup3.Image = new Image(Stock.Quit, IconSize.Menu);
+ popupMenu.Add(menuPopup3);
+ menuPopup3.Activated += new EventHandler(this.OnPopupClick);
+
+ popupMenu.ShowAll();
+ popupMenu.Popup(null, null, null, (uint)args.Args[0], (uint)args.Args[1]);
+ }
+
private void save_main_window_pos()
{
int x, y, w, h; // used to restore position on the screen
Modified: trunk/nemo.mdp
==============================================================================
--- trunk/nemo.mdp (original)
+++ trunk/nemo.mdp Wed Feb 13 13:13:47 2008
@@ -26,7 +26,6 @@
<File name="gtk/SearchInput.cs" subtype="Code" buildaction="Compile" />
<File name="gtk/Starred.cs" subtype="Code" buildaction="Compile" />
<File name="gtk/Tray.cs" subtype="Code" buildaction="Compile" />
- <File name="gtk/TrayLib.cs" subtype="Code" buildaction="Compile" />
<File name="uicommon/CalendarDriver.cs" subtype="Code" buildaction="Compile" />
<File name="gtk/CalendarDrawer.cs" subtype="Code" buildaction="Compile" />
<File name="uicommon/FileLayout.cs" subtype="Code" buildaction="Compile" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]