muine r1216 - in trunk: . plugins
- From: lmedinas svn gnome org
- To: svn-commits-list gnome org
- Subject: muine r1216 - in trunk: . plugins
- Date: Sun, 28 Sep 2008 01:03:47 +0000 (UTC)
Author: lmedinas
Date: Sun Sep 28 01:03:47 2008
New Revision: 1216
URL: http://svn.gnome.org/viewvc/muine?rev=1216&view=rev
Log:
2008-09-28 Luis Medinas <lmedinas gnome org>
* plugins/TrayIcon.cs:
* plugins/TrayIcon.xml:
Improve tray icon usuability. Fixes bgo #312110 and #378019.
Patch from Ryan Lortie (desrt) <desrt desrt ca> minor
change on menu from me.
Modified:
trunk/ChangeLog
trunk/plugins/TrayIcon.cs
trunk/plugins/TrayIcon.xml
Modified: trunk/plugins/TrayIcon.cs
==============================================================================
--- trunk/plugins/TrayIcon.cs (original)
+++ trunk/plugins/TrayIcon.cs Sun Sep 28 01:03:47 2008
@@ -19,6 +19,7 @@
using System;
+using GConf;
using Gtk;
using Gdk;
@@ -57,6 +58,11 @@
private bool playing = false;
+ // GConf settings (mouse button behaviour)
+ private GConf.Client gconf_client;
+ private bool old_mouse_behaviour;
+ private const string old_behaviour_key = "/apps/muine/plugins/trayicon/old_behaviour";
+
// Plugin initializer
public override void Initialize (IPlayer player)
{
@@ -79,6 +85,19 @@
// Build menu
player.UIManager.AddUiFromResource ("TrayIcon.xml");
+
+ // Setup GConf
+ gconf_client = new GConf.Client();
+ gconf_client.AddNotify (old_behaviour_key, BehaviourNotify);
+ try {
+ old_mouse_behaviour = (bool) gconf_client.Get(old_behaviour_key);
+ } catch {
+ old_mouse_behaviour = false;
+ gconf_client.Set(old_behaviour_key, false);
+ }
+
+ // Maybe prevent 'delete' event from closing window by intercepting it
+ player.Window.WidgetEvent += new WidgetEventHandler (OnWindowEvent);
menu = (Menu) player.UIManager.GetWidget ("/Menu");
menu.Deactivated += OnMenuDeactivated;
@@ -203,6 +222,12 @@
{
case 1:
case 3:
+ if (!old_mouse_behaviour && args.Event.Button == 1)
+ {
+ player.SetWindowVisible (!player.WindowVisible, args.Event.Time);
+ break;
+ }
+
icon.State = StateType.Active;
menu_x = (int) args.Event.XRoot - (int) args.Event.X;
@@ -214,7 +239,10 @@
break;
case 2:
- player.SetWindowVisible (!player.WindowVisible, args.Event.Time);
+ if (old_mouse_behaviour)
+ player.SetWindowVisible (!player.WindowVisible, args.Event.Time);
+ else
+ player.Playing = !player.Playing;
break;
@@ -257,5 +285,19 @@
UpdateImage ();
}
+
+ private void OnWindowEvent (object o, WidgetEventArgs args)
+ {
+ if (args.Event.Type == EventType.Delete && !old_mouse_behaviour)
+ {
+ player.SetWindowVisible (false, 0);
+ args.RetVal = true;
+ }
+ }
+
+ private void BehaviourNotify (object sender, NotifyEventArgs args)
+ {
+ old_mouse_behaviour = (bool) args.Value;
+ }
}
}
Modified: trunk/plugins/TrayIcon.xml
==============================================================================
--- trunk/plugins/TrayIcon.xml (original)
+++ trunk/plugins/TrayIcon.xml Sun Sep 28 01:03:47 2008
@@ -8,6 +8,6 @@
<menuitem action="PlaySong" />
<menuitem action="PlayAlbum" />
<separator />
- <menuitem action="ToggleVisible" />
+ <menuitem action="Quit" />
</popup>
</ui>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]