Re: [Muine] Other TrayIcon issues



Hey,

Well over a year ago now I wrote a patch that added the scrolling to
change the volume. I've attached it here for reference. (Looking at it
now, I'm not sure it is the best way to do it, but I will leave that to
more experienced c# coders to decide).

The patch has some other extras, like left/right scrolling to go
back/forward songs---corresponding the the 'back' and 'forward' buttons
on my mouse; and double left/right clicking to open the new song/album
dialogs (I remember this was pretty useful--seeing as the new album
dialog is mostly what I use)

Anyway separating out the different functionality should be simple
enough--perhaps following on from Peter's idea to have two tray icons
(and the good point made by Jorn that this stuff is pretty obscure),
that we have a standard tray icon plugin and a souped up (or even
configurable) tray icon.

Hope that helps,
Tom

On Mon, 2006-03-20 at 09:45 +0100, Joachim Beckers wrote:
> Hi,
> 
> I didn't want to pollute the other threads, so I'm putting this here.
> 
> There are some other issues with the trayicon.
> 
> I remember a bug about the background color of the icon being wrong (and
> I can confirm this). With my theme, clicking the icon produces a grey
> overlay, while ideally it would be a blue background. Tomboy does this
> correctly, if you want to see the difference.
> 
> Also, as a feature request: scrolling the icon to control the volume. I
> requested this before, pointing to muine-applet which has that
> implemented. That code has vanished from the net however, and the author
> can't find it either. So if anyone still has it, please speak up.
> 
> Joachim
> 
> _______________________________________________
> muine-list mailing list
> muine-list gnome org
> http://mail.gnome.org/mailman/listinfo/muine-list
> 
? noticon.diff
Index: src/NotificationAreaIcon.cs
===================================================================
RCS file: /cvs/gnome/muine/src/NotificationAreaIcon.cs,v
retrieving revision 1.23
diff -u -r1.23 NotificationAreaIcon.cs
--- src/NotificationAreaIcon.cs	18 Nov 2004 15:02:46 -0000	1.23
+++ src/NotificationAreaIcon.cs	20 Nov 2004 02:08:13 -0000
@@ -28,7 +28,7 @@
 	[DllImport ("libmuine")]
 	private static extern IntPtr egg_tray_icon_new (string name);
 
-	private EventBox ebox;
+	public EventBox ebox;
 	private Gtk.Image image;
 	private Tooltips tooltips;
 
@@ -57,6 +57,7 @@
 		ebox = new EventBox ();
 		ebox.ButtonPressEvent += new ButtonPressEventHandler (HandleButtonPressEvent);
 		ebox.ButtonReleaseEvent += new ButtonReleaseEventHandler (HandleButtonReleaseEvent);
+		ebox.ScrollEvent += new ScrollEventHandler (HandleScrollEvent);
 		
 		image = new Gtk.Image ();
 
@@ -74,6 +75,8 @@
 	{
 		menu = new Menu ();
 		menu.SelectionDone += new EventHandler (HandleSelectionDone);
+		// attaching this to the menu means it only happens just after the menu opens.
+		menu.ButtonPressEvent += new ButtonPressEventHandler (Handle2ButtonPressEvent);
 		
 		play_pause_menu_item = new ImageMenuItem ("");
 		play_pause_menu_item_image = new Gtk.Image ();
@@ -263,6 +266,43 @@
 		args.RetVal = false;
 	}
 
+	private void Handle2ButtonPressEvent (object o, ButtonPressEventArgs args)
+	{
+		if (args.Event.Type == Gdk.EventType.TwoButtonPress) {
+			switch (args.Event.Button) 
+			{
+			case 1:
+				play_album_menu_item.Activate ();
+				break;
+
+			case 3:
+				play_song_menu_item.Activate ();
+				break;
+
+			default:
+				break;
+			}
+		}
+
+		args.RetVal = false;
+	}
+
+	private void HandleScrollEvent (object o, ScrollEventArgs args)
+	{
+		switch (args.Event.Direction)
+		{ 
+		case Gdk.ScrollDirection.Left:
+			previous_song_menu_item.Activate ();
+			break;
+						
+		case Gdk.ScrollDirection.Right:
+			next_song_menu_item.Activate ();
+			break;
+		}
+
+		args.RetVal = false;
+	}
+
 	private void HandleDestroyEvent (object o, DestroyEventArgs args)
 	{
 		Init ();
Index: src/PlaylistWindow.cs
===================================================================
RCS file: /cvs/gnome/muine/src/PlaylistWindow.cs,v
retrieving revision 1.136
diff -u -r1.136 PlaylistWindow.cs
--- src/PlaylistWindow.cs	17 Nov 2004 23:29:43 -0000	1.136
+++ src/PlaylistWindow.cs	20 Nov 2004 02:08:16 -0000
@@ -411,6 +411,7 @@
 		icon.play_song_menu_item.Activated += new EventHandler (HandleAddSongCommand);
 		icon.play_album_menu_item.Activated += new EventHandler (HandleAddAlbumCommand);
 		icon.show_window_menu_item.Activated += new EventHandler (HandleToggleWindowVisibilityCommand);
+		icon.ebox.ScrollEvent += new ScrollEventHandler (volume_button.ScrollHandler);
 	}
 
 	private Gdk.Pixbuf empty_pixbuf;
Index: src/VolumeButton.cs
===================================================================
RCS file: /cvs/gnome/muine/src/VolumeButton.cs,v
retrieving revision 1.6
diff -u -r1.6 VolumeButton.cs
--- src/VolumeButton.cs	17 Nov 2004 21:13:35 -0000	1.6
+++ src/VolumeButton.cs	20 Nov 2004 02:08:16 -0000
@@ -189,7 +189,7 @@
 		}
 	}
 
-	private void ScrollHandler (object obj, ScrollEventArgs args)
+	public void ScrollHandler (object obj, ScrollEventArgs args)
 	{
 		int tmp_vol = Volume;
 		


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]