f-spot r4237 - in trunk/src: . Extensions Widgets



Author: sdelcroix
Date: Mon Aug 11 12:13:25 2008
New Revision: 4237
URL: http://svn.gnome.org/viewvc/f-spot?rev=4237&view=rev

Log:
Referencing the parent while creating a PhotoPopup, allow fixing 546678


Modified:
   trunk/src/Extensions/ComplexMenuItemNode.cs
   trunk/src/Extensions/MenuNode.cs
   trunk/src/FullScreenView.cs
   trunk/src/PhotoPopup.cs
   trunk/src/SingleView.cs
   trunk/src/Widgets/RatingMenuItem.cs
   trunk/src/Widgets/Sidebar.cs

Modified: trunk/src/Extensions/ComplexMenuItemNode.cs
==============================================================================
--- trunk/src/Extensions/ComplexMenuItemNode.cs	(original)
+++ trunk/src/Extensions/ComplexMenuItemNode.cs	Mon Aug 11 12:13:25 2008
@@ -27,9 +27,9 @@
 
 		ICommand cmd;
 
-		public override Gtk.MenuItem GetMenuItem ()
+		public override Gtk.MenuItem GetMenuItem (object parent)
 		{
-			ComplexMenuItem item = System.Activator.CreateInstance (Type.GetType (widget_type)) as ComplexMenuItem;
+			ComplexMenuItem item = System.Activator.CreateInstance (Type.GetType (widget_type), parent) as ComplexMenuItem;
 			cmd = (ICommand) Addin.CreateInstance (command_type);
 			
 			if (item != null)

Modified: trunk/src/Extensions/MenuNode.cs
==============================================================================
--- trunk/src/Extensions/MenuNode.cs	(original)
+++ trunk/src/Extensions/MenuNode.cs	Mon Aug 11 12:13:25 2008
@@ -24,11 +24,11 @@
 	[ExtensionNodeChild (typeof (ComplexMenuItemNode))]
 	public class SubmenuNode : MenuNode
 	{
-		public override Gtk.MenuItem GetMenuItem ()
+		public override Gtk.MenuItem GetMenuItem (object parent)
 		{
-			Gtk.MenuItem item = base.GetMenuItem ();
+			Gtk.MenuItem item = base.GetMenuItem (parent);
 
-			Gtk.Menu submenu = GetSubmenu ();
+			Gtk.Menu submenu = GetSubmenu (parent);
 
 			if (item.Submenu != null)
 				item.Submenu.Dispose ();	
@@ -39,10 +39,15 @@
 
 		public Gtk.Menu GetSubmenu ()
 		{
+			return GetSubmenu (null);
+		}
+
+		public Gtk.Menu GetSubmenu (object parent)
+		{
 			Gtk.Menu submenu = new Gtk.Menu ();
 
 			foreach (MenuNode node in ChildNodes)
-				submenu.Insert (node.GetMenuItem (), -1);
+				submenu.Insert (node.GetMenuItem (parent), -1);
 
 			return submenu;				
 		}
@@ -56,9 +61,9 @@
 
 		private IMenuGenerator menu_generator;
 
-		public override Gtk.MenuItem GetMenuItem ()
+		public override Gtk.MenuItem GetMenuItem (object parent)
 		{
-			Gtk.MenuItem item = base.GetMenuItem ();
+			Gtk.MenuItem item = base.GetMenuItem (parent);
 			menu_generator = (IMenuGenerator) Addin.CreateInstance (command_type); 
 			item.Submenu = menu_generator.GetMenu ();
 			item.Activated += menu_generator.OnActivated;
@@ -69,9 +74,9 @@
 	[ExtensionNode ("MenuItem")]
 	public class MenuItemNode : MenuNode
 	{
-		public override Gtk.MenuItem GetMenuItem ()
+		public override Gtk.MenuItem GetMenuItem (object parent)
 		{
-			Gtk.MenuItem item = base.GetMenuItem ();
+			Gtk.MenuItem item = base.GetMenuItem (parent);
 			item.Activated += OnActivated;
 			return item;
 		}
@@ -84,7 +89,7 @@
 	[ExtensionNode ("MenuSeparator")]
 	public class MenuSeparatorNode : MenuNode
 	{
-		public override Gtk.MenuItem GetMenuItem ()
+		public override Gtk.MenuItem GetMenuItem (object parent)
 		{
 			return new Gtk.SeparatorMenuItem ();
 		}
@@ -98,7 +103,7 @@
 		[NodeAttribute]
 		protected string icon;
 
-		public virtual Gtk.MenuItem GetMenuItem ()
+		public virtual Gtk.MenuItem GetMenuItem (object parent)
 		{
 			Gtk.MenuItem item;
 			if (icon == null)

Modified: trunk/src/FullScreenView.cs
==============================================================================
--- trunk/src/FullScreenView.cs	(original)
+++ trunk/src/FullScreenView.cs	Mon Aug 11 12:13:25 2008
@@ -279,7 +279,7 @@
 		{
 			if (args.Event.Type == Gdk.EventType.ButtonPress
 			    && args.Event.Button == 3) {
-				PhotoPopup popup = new PhotoPopup ();
+				PhotoPopup popup = new PhotoPopup (this);
 				popup.Activate (this.Toplevel, args.Event);
 			}
 		}

Modified: trunk/src/PhotoPopup.cs
==============================================================================
--- trunk/src/PhotoPopup.cs	(original)
+++ trunk/src/PhotoPopup.cs	Mon Aug 11 12:13:25 2008
@@ -24,10 +24,14 @@
 		{
 		}
 
-		public PhotoPopup () : base ()
+		public PhotoPopup () : this (null)
+		{
+		}
+
+		public PhotoPopup (Widget parent) : base ()
 		{
 			foreach (MenuNode node in AddinManager.GetExtensionNodes ("/FSpot/Menus/PhotoPopup"))
-				Append (node.GetMenuItem ());
+				Append (node.GetMenuItem (parent));
 			ShowAll ();
 		}
 

Modified: trunk/src/SingleView.cs
==============================================================================
--- trunk/src/SingleView.cs	(original)
+++ trunk/src/SingleView.cs	Mon Aug 11 12:13:25 2008
@@ -173,7 +173,7 @@
 			if (collection.Count > 0)
 				directory_view.Selection.Add (0);
 
-			export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem ().Submenu;
+			export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem (this).Submenu;
 			export.Submenu.ShowAll ();
 			export.Activated += HandleExportActivated ;
 		}

Modified: trunk/src/Widgets/RatingMenuItem.cs
==============================================================================
--- trunk/src/Widgets/RatingMenuItem.cs	(original)
+++ trunk/src/Widgets/RatingMenuItem.cs	Mon Aug 11 12:13:25 2008
@@ -38,7 +38,11 @@
 		private bool pressing;
 		private bool can_activate = true;
 
-		public RatingMenuItem () : base ()
+		public RatingMenuItem () : this (null)
+		{
+		}
+
+		public RatingMenuItem (object parent) : base ()
 		{
 			HBox box = new HBox ();
 			box.Spacing = 5;
@@ -48,7 +52,11 @@
 					GLib.Markup.EscapeText (Catalog.GetString ("Rating:")));
 			box.PackStart (label, false, false, 0);
 
-			if(MainWindow.Toplevel.Selection.Count==1)
+			if (parent is FullScreenView) {
+				FSpot.Utils.Log.Debug ("PARENT IS FSVIEW");
+				FullScreenView fsview = parent as FullScreenView;
+				entry = new Rating ((int)fsview.View.Item.Current.Rating, true);
+			} else if (MainWindow.Toplevel.Selection.Count == 1)
 				entry = new Rating ((int)MainWindow.Toplevel.Selection[0].Rating, true);
 			else
 				entry = new Rating (-1, true);

Modified: trunk/src/Widgets/Sidebar.cs
==============================================================================
--- trunk/src/Widgets/Sidebar.cs	(original)
+++ trunk/src/Widgets/Sidebar.cs	Mon Aug 11 12:13:25 2008
@@ -155,7 +155,7 @@
 
 		public event EventHandler CloseRequested;
 
-        // Selection change events, sidebar pages can subscribed to this.
+        	// Selection change events, sidebar pages can subscribed to this.
 		public event IBrowsableCollectionChangedHandler SelectionChanged;
 		public event IBrowsableCollectionItemsChangedHandler SelectionItemsChanged;
 
@@ -320,10 +320,9 @@
 			return (notebook.GetNthPage (notebook.CurrentPage) == page.SidebarWidget);
 		}
 
-        // Proxy selection change to the subscribed sidebar pages.
 		public void HandleSelectionChanged (IBrowsableCollection collection) {
-			Console.WriteLine("Selection Changed: {0}, {1}", collection, collection.Count);
 			Selection = collection;
+        		// Proxy selection change to the subscribed sidebar pages.
 			if (SelectionChanged != null) 
 				SelectionChanged (collection);
 		}



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