[banshee] [Banshee.Moblin] Expanded the Mutter panel binding



commit ee43d695952bfada43978a1912787e28bd46a0fd
Author: Aaron Bockover <abockover novell com>
Date:   Wed Oct 14 19:05:37 2009 -0400

    [Banshee.Moblin] Expanded the Mutter panel binding
    
    Cache the widget returned from mpl_panel_gtk_get_window
    and bind the signals on the base PanelClient class.

 .../Banshee.Moblin/Mutter/PanelClient.cs           |   62 ++++++++++++++++++++
 src/Extensions/Banshee.Moblin/Mutter/PanelGtk.cs   |    4 +-
 .../Banshee.Moblin/Mutter/SetSizeHandler.cs        |   42 +++++++++++++
 3 files changed, 106 insertions(+), 2 deletions(-)
---
diff --git a/src/Extensions/Banshee.Moblin/Mutter/PanelClient.cs b/src/Extensions/Banshee.Moblin/Mutter/PanelClient.cs
index e6b4838..5e86b83 100644
--- a/src/Extensions/Banshee.Moblin/Mutter/PanelClient.cs
+++ b/src/Extensions/Banshee.Moblin/Mutter/PanelClient.cs
@@ -102,5 +102,67 @@ namespace Mutter
         public uint Xid {
             get { return mpl_panel_client_get_xid (Handle); }
         }
+        
+        [GLib.Signal ("set-size")]
+        public event SetSizeHandler SetSizeEvent {
+            add { GLib.Signal.Lookup (this, "set-size", typeof (SetSizeArgs)).AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "set-size", typeof (SetSizeArgs)).RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("show-begin")]
+        public event EventHandler ShowBeginEvent {
+            add { GLib.Signal.Lookup (this, "show-begin").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "show-begin").RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("show-end")]
+        public event EventHandler ShowEndEvent {
+            add { GLib.Signal.Lookup (this, "show-end").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "show-end").RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("hide-begin")]
+        public event EventHandler HideBeginEvent {
+            add { GLib.Signal.Lookup (this, "hide-begin").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "hide-begin").RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("hide-end")]
+        public event EventHandler HideEndEvent {
+            add { GLib.Signal.Lookup (this, "hide-end").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "hide-end").RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("request-show")]
+        public event EventHandler RequestShowEvent {
+            add { GLib.Signal.Lookup (this, "request-show").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "request-show").RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("request-hide")]
+        public event EventHandler RequestHideEvent {
+            add { GLib.Signal.Lookup (this, "request-hide").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "request-hide").RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("request-focus")]
+        public event EventHandler RequestFocusEvent {
+            add { GLib.Signal.Lookup (this, "request-focus").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "request-focus").RemoveDelegate (value); }
+        }
+        
+        // FIXME: need to define an delegate and args class
+        
+        [GLib.Signal ("request-button-style")]
+        public event EventHandler RequestButtonStyleEvent {
+            add { GLib.Signal.Lookup (this, "request-button-style").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "request-button-style").RemoveDelegate (value); }
+        }
+        
+        [GLib.Signal ("request-tooltip")]
+        public event EventHandler RequestTooltipEvent {
+            add { GLib.Signal.Lookup (this, "request-tooltip").AddDelegate (value); }
+            remove { GLib.Signal.Lookup (this, "request-tooltip").RemoveDelegate (value); }
+        }
     }
 }
diff --git a/src/Extensions/Banshee.Moblin/Mutter/PanelGtk.cs b/src/Extensions/Banshee.Moblin/Mutter/PanelGtk.cs
index 6e003ab..51d7e71 100644
--- a/src/Extensions/Banshee.Moblin/Mutter/PanelGtk.cs
+++ b/src/Extensions/Banshee.Moblin/Mutter/PanelGtk.cs
@@ -57,9 +57,9 @@ namespace Mutter
         [DllImport ("libmoblin-panel-gtk")]
         private static extern IntPtr mpl_panel_gtk_get_window (IntPtr panel);
     
-        // FIXME: can probably cache this
+        private Container container_window;
         public Container Window {
-            get { return new Container (mpl_panel_gtk_get_window (Handle)); }
+            get { return container_window ?? (container_window = new Container (mpl_panel_gtk_get_window (Handle))); }
         }
     }
 }
diff --git a/src/Extensions/Banshee.Moblin/Mutter/SetSizeHandler.cs b/src/Extensions/Banshee.Moblin/Mutter/SetSizeHandler.cs
new file mode 100644
index 0000000..bc2b43b
--- /dev/null
+++ b/src/Extensions/Banshee.Moblin/Mutter/SetSizeHandler.cs
@@ -0,0 +1,42 @@
+// 
+// SetSizeHandler.cs
+//  
+// Author:
+//   Aaron Bockover <abockover novell com>
+// 
+// Copyright 2009 Novell, Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+// 
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace Mutter
+{
+    public delegate void SetSizeHandler (object o, SetSizeArgs args);
+
+    public class SetSizeArgs : GLib.SignalArgs {
+        public uint Width {
+            get { return (uint)Args[0]; }
+        }
+        
+        public uint Height {
+            get { return (uint)Args[1]; }
+        }
+    }
+}



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