Re: [Muine] Tray Icon [PATCH]
- From: Tom Coleman <tmcol bigpond net au>
- To: muine-list gnome org
- Subject: Re: [Muine] Tray Icon [PATCH]
- Date: Tue, 23 Nov 2004 01:29:01 +1100
--- Begin Message ---
- From: Tom Coleman <tmcol bigpond net au>
- To: Link Dupont <link dupont gmail com>
- Subject: Re: [Muine] Tray Icon [PATCH]
- Date: Sat, 20 Nov 2004 13:16:35 +1100
On Thu, 2004-11-18 at 07:36 -0800, Link Dupont wrote:
> Might be useful, though I tend to set Muine's volume & then control the
> master volume. This might be too easy to tweak. Since middle clicking
> shows/hides the window, it might be very easy to scroll up or down while
> middle-clicking.
I suppose it depends on your mouse, but in my case I think it would be
unlikely (not that its probably that big an issue anyway).
> > 2) Pressing the back and forward mouse buttons (aka scrolling sideways)
> > skips back and forward
>
> I presume this is different than left & right clicks? I only have 3
> buttons, so this feature would be useless to me.
These are the back/forward (generally very useful) buttons that come on
most mice these days.
> > 3) double right-clicking opens the add new album dialog
>
> Interesting idea. No one ever thinks to double-right-click though. These
> would have to be documented poweruser features, otherwise no one would
> ever find them.
>
> > Thus now enabling me to do almost everything i want to do in day to day
> > life with very few clicks (sort of the mouse equivalent of my multimedia
> > buttons)
> >
> > Before I submit a patch though, I thought I should enquire as to what
> > peoples thoughts were regarding which clicks/scrolls should do what. I
> > know Jorn has a position on the single left click (although I haven't
> > been able to find the original mail).
>
> There's no harm in submitting a patch. Whether or not Jorn wants to
> apply it is the question.
Attached is a patch for anyone that wants to give it a try. I've changed
to double left click opening a new album dialog, and double right click
opening the new song dialog. In my opinion a very useful little feature,
although I agree that its not intuitive by any means.
My first foray into C#/mono/gtk so please let me know about anything I'm
doing wrong/could be doing better etc.
Thanks,
Tom
? 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;
--- End Message ---
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]