summaryrefslogtreecommitdiff
path: root/extra/monodevelop/monodevelop_gnome3.patch
blob: 4ea101f6a0bf3c0e5aaec8a656ea29f547d9992a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
diff --git a/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Object.cs b/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Object.cs
index 4d8954c..e1a1937 100644
--- a/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Object.cs
+++ b/src/addins/MonoDevelop.GtkCore/libstetic/wrapper/Object.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections;
+using System.Collections.Generic;
 
 namespace Stetic.Wrapper {
 	public abstract class Object : Stetic.ObjectWrapper {
@@ -11,17 +12,32 @@ namespace Stetic.Wrapper {
 			((GLib.Object)Wrapped).RemoveNotification (NotifyHandler);
 			base.Dispose ();
 		}
-
+		
+		IEnumerable<string> GladePropertyNames {
+			get {
+				foreach (ItemGroup group in ClassDescriptor.ItemGroups) {
+					foreach (ItemDescriptor item in group) {
+						TypedPropertyDescriptor prop = item as TypedPropertyDescriptor;
+						if (prop != null && !string.IsNullOrEmpty (prop.GladeName)) {
+							yield return prop.GladeName;
+						}
+					}
+				}
+			}
+		}
+		
 		internal protected override void OnDesignerAttach (IDesignArea designer)
 		{
 			base.OnDesignerAttach (designer);
-			((GLib.Object)Wrapped).AddNotification (NotifyHandler);
+			foreach (string property in GladePropertyNames)
+				((GLib.Object)Wrapped).AddNotification (property, NotifyHandler);
 		}
 		
 		internal protected override void OnDesignerDetach (IDesignArea designer)
 		{
 			base.OnDesignerDetach (designer);
-			((GLib.Object)Wrapped).RemoveNotification (NotifyHandler);
+			foreach (string property in GladePropertyNames)
+				((GLib.Object)Wrapped).RemoveNotification (property, NotifyHandler);
 		}
 		
 		public static Object Lookup (GLib.Object obj)

diff --git a/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs b/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
index 89f04b5..75d7b17 100644
--- a/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
+++ b/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
@@ -1540,22 +1540,39 @@ namespace MonoDevelop.Components.Commands
 	internal class ToolbarTracker
 	{
 		Gtk.IconSize lastSize;
-		
+		 
 		public void Track (Gtk.Toolbar toolbar)
 		{
 			lastSize = toolbar.IconSize;
-			toolbar.AddNotification (OnToolbarPropChanged);
+			toolbar.AddNotification ("icon-size", IconSizeChanged);
+			toolbar.OrientationChanged += HandleToolbarOrientationChanged;
+			toolbar.StyleChanged += HandleToolbarStyleChanged;
+			
 			toolbar.Destroyed += delegate {
-				toolbar.RemoveNotification (OnToolbarPropChanged);
+				toolbar.StyleChanged -= HandleToolbarStyleChanged;
+				toolbar.OrientationChanged -= HandleToolbarOrientationChanged;
+				toolbar.RemoveNotification ("icon-size", IconSizeChanged);
 			};
 		}
-		
-		void OnToolbarPropChanged (object ob, GLib.NotifyArgs args)
+
+		void HandleToolbarStyleChanged (object o, Gtk.StyleChangedArgs args)
 		{
-			Gtk.Toolbar t = (Gtk.Toolbar) ob;
-			if (lastSize != t.IconSize || args.Property == "orientation" || args.Property == "toolbar-style")
+			Gtk.Toolbar t = (Gtk.Toolbar) o;
+			if (lastSize != t.IconSize)
 				UpdateCustomItems (t);
-			lastSize = t.IconSize;
+		}
+
+		void HandleToolbarOrientationChanged (object o, Gtk.OrientationChangedArgs args)
+		{
+			Gtk.Toolbar t = (Gtk.Toolbar) o;
+			if (lastSize != t.IconSize)
+				UpdateCustomItems (t);
+		}
+
+		void IconSizeChanged (object o, GLib.NotifyArgs args)
+		{
+			this.lastSize = ((Gtk.Toolbar) o).IconSize;
+			UpdateCustomItems ((Gtk.Toolbar) o);
 		}
 		
 		void UpdateCustomItems (Gtk.Toolbar t)