Hi abock,
Trying to understand the code.
Started with an easy feature request.
the diff is atteched for it.
It was half implemented :). So was an easy one.
I guess it is a clean hack. and can make its way through the repo i hope..
Best.
ulaas.
? ChangeVolumeFromTrayIcon.diff ? mdupdate.diff ? burn-sharp/.deps ? burn-sharp/.libs ? burn-sharp/glue.lo ? burn-sharp/libnautilusburnglue.la ? libbanshee/.deps ? libbanshee/.libs ? libbanshee/cd-detect.lo ? libbanshee/cd-rip.lo ? libbanshee/gst-encode.lo ? libbanshee/gst-init.lo ? libbanshee/gst-misc.lo ? libbanshee/gst-player-engine.lo ? libbanshee/libbanshee.la ? libbanshee/xing/.deps ? mediaengines/gst/plugin-core.dll ? mediaengines/gst/plugin-core.dll.mdb ? mediaengines/helix/plugin-core.dll ? mediaengines/helix/plugin-core.dll.mdb ? po/.intltool-merge-cache ? src/MusicBrainz.dll ? src/MusicBrainz.dll.mdb ? src/burn-sharp.dll ? src/burn-sharp.dll.mdb ? src/entagged-sharp.dll ? src/entagged-sharp.dll.mdb ? src/gst-player.dll ? src/gst-player.dll.mdb ? src/hal-sharp.dll ? src/hal-sharp.dll.mdb ? src/helix-sharp.dll ? src/helix-sharp.dll.mdb ? src/ipod-sharp-ui.dll ? src/ipod-sharp.dll ? src/ipod-sharp.dll.mdb ? src/plugin-core.dll ? src/plugin-core.dll.mdb Index: src/NotificationAreaIcon.cs =================================================================== RCS file: /cvs/gnome/banshee/src/NotificationAreaIcon.cs,v retrieving revision 1.9 diff -u -r1.9 NotificationAreaIcon.cs --- src/NotificationAreaIcon.cs 31 Oct 2005 05:33:33 -0000 1.9 +++ src/NotificationAreaIcon.cs 1 Nov 2005 22:30:20 -0000 @@ -55,6 +55,7 @@ private int menu_y; public event EventHandler ClickEvent; + public event ScrollEventHandler MouseScrollEvent; public NotificationAreaIcon() { @@ -67,16 +68,26 @@ public void Init() { ticon.DestroyEvent += OnDestroyEvent; - traybox = new EventBox(); traybox.ButtonPressEvent += - new ButtonPressEventHandler(OnTrayIconClick); + new ButtonPressEventHandler(OnTrayIconClick); + //ScrollEvent for mouse wheel handling. + traybox.ScrollEvent += + new ScrollEventHandler(OnMouseScroll); traybox.Add(new Gtk.Image(Gdk.Pixbuf. LoadFromResource("tray-icon.png"))); ticon.Add(traybox); ticon.ShowAll(); } + + private void OnMouseScroll(object o, ScrollEventArgs args) + { + if(MouseScrollEvent != null) + MouseScrollEvent(o, args); + + args.RetVal = false; + } private void OnTrayIconClick(object o, ButtonPressEventArgs args) { @@ -157,8 +168,8 @@ set { tooltips.SetTip(traybox, value, null); } - } - + } + } public class TrayIcon : Plug Index: src/PlayerInterface.cs =================================================================== RCS file: /cvs/gnome/banshee/src/PlayerInterface.cs,v retrieving revision 1.81 diff -u -r1.81 PlayerInterface.cs --- src/PlayerInterface.cs 1 Nov 2005 00:38:47 -0000 1.81 +++ src/PlayerInterface.cs 1 Nov 2005 22:30:26 -0000 @@ -398,7 +398,7 @@ try { trayIcon = new NotificationAreaIcon(); trayIcon.ClickEvent += new EventHandler(OnTrayClick); - //trayIcon.ScrollEvent += new ScrollEventHandler(OnTrayScroll); + trayIcon.MouseScrollEvent += new ScrollEventHandler(OnTrayScroll); trayIcon.PlayItem.Activated += OnButtonPlayPauseClicked; trayIcon.NextItem.Activated += OnButtonNextClicked; @@ -696,14 +696,24 @@ private void OnTrayScroll(object o, ScrollEventArgs args) { - switch(args.Event.Direction) { + int tmp_vol = volumeButton.Volume; + + switch (args.Event.Direction) { case Gdk.ScrollDirection.Up: - OnButtonNextClicked(o, args); + tmp_vol += 10; break; case Gdk.ScrollDirection.Down: - OnButtonPreviousClicked(o, args); + tmp_vol -= 10; break; - } + default: + break; + } + // A CLAMP equiv doesn't seem to exist ... doing that manually + tmp_vol = Math.Min (100, tmp_vol); + tmp_vol = Math.Max (0, tmp_vol); + + volumeButton.Volume = tmp_vol; + OnVolumeScaleChanged(volumeButton.Volume); } private void OnTrayMenuItemShuffleActivated(object o, EventArgs args)