f-spot r3596 - in trunk: . src src/Extensions src/Widgets
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r3596 - in trunk: . src src/Extensions src/Widgets
- Date: Thu, 24 Jan 2008 20:04:28 +0000 (GMT)
Author: sdelcroix
Date: Thu Jan 24 20:04:28 2008
New Revision: 3596
URL: http://svn.gnome.org/viewvc/f-spot?rev=3596&view=rev
Log:
2008-01-24 Stephane Delcroix <sdelcroix novell com>
* src/Widgets/ComplexMenuItem.cs:
* src/Widgets/RatingMenuItem.cs:
* src/Extensions/ComplexMenuItemNode.cs:
* src/Extensions/PopupCommands.cs:
* src/Extensions/MenuNode.cs:
* src/FSpot.addin.xml:
* src/Makefile.am: Using the RatingMenuItem instead of RatingMenu
* src/RatingMenu.cs: dropped.
Added:
trunk/src/Extensions/ComplexMenuItemNode.cs
Removed:
trunk/src/RatingMenu.cs
Modified:
trunk/ChangeLog
trunk/src/Extensions/MenuNode.cs
trunk/src/Extensions/PopupCommands.cs
trunk/src/FSpot.addin.xml
trunk/src/Makefile.am
trunk/src/Widgets/ComplexMenuItem.cs
trunk/src/Widgets/RatingMenuItem.cs
Added: trunk/src/Extensions/ComplexMenuItemNode.cs
==============================================================================
--- (empty file)
+++ trunk/src/Extensions/ComplexMenuItemNode.cs Thu Jan 24 20:04:28 2008
@@ -0,0 +1,48 @@
+/*
+ * FSpot.Extensions.ComplexMenuItemNode
+ *
+ * Author(s)
+ * Stephane Delcroix <stephane delcroix org>
+ *
+ * This is free software. See COPYING for details.
+ *
+ */
+
+using Mono.Addins;
+using FSpot.Widgets;
+using System;
+
+namespace FSpot.Extensions
+{
+ [ExtensionNode ("ComplexMenuItem")]
+ public class ComplexMenuItemNode : MenuNode
+ {
+ [NodeAttribute]
+ string widget_type;
+
+ [NodeAttribute]
+ string command_type;
+
+ public event EventHandler Changed;
+
+ ICommand cmd;
+
+ public override Gtk.MenuItem GetMenuItem ()
+ {
+ Console.WriteLine ("POOOOOOOOOOONG");
+ ComplexMenuItem item = System.Activator.CreateInstance (Type.GetType (widget_type)) as ComplexMenuItem;
+ cmd = (ICommand) Addin.CreateInstance (command_type);
+
+ if (item != null)
+ item.Changed += OnChanged;
+ return item;
+ }
+
+ private void OnChanged (object o, EventArgs e)
+ {
+ if (cmd != null)
+ cmd.Run (o, e);
+ }
+ }
+
+}
Modified: trunk/src/Extensions/MenuNode.cs
==============================================================================
--- trunk/src/Extensions/MenuNode.cs (original)
+++ trunk/src/Extensions/MenuNode.cs Thu Jan 24 20:04:28 2008
@@ -21,6 +21,7 @@
[ExtensionNodeChild (typeof (MenuSeparatorNode))]
[ExtensionNodeChild (typeof (SubmenuNode))]
[ExtensionNodeChild (typeof (MenuGeneratorNode))]
+ [ExtensionNodeChild (typeof (ComplexMenuItemNode))]
public class SubmenuNode : MenuNode
{
public override Gtk.MenuItem GetMenuItem ()
Modified: trunk/src/Extensions/PopupCommands.cs
==============================================================================
--- trunk/src/Extensions/PopupCommands.cs (original)
+++ trunk/src/Extensions/PopupCommands.cs Thu Jan 24 20:04:28 2008
@@ -105,22 +105,11 @@
}
}
- public class Rate : IMenuGenerator
+ public class Rate : ICommand
{
- private RatingMenu rating_menu;
-
- public Gtk.Menu GetMenu ()
+ public void Run (object o, EventArgs e)
{
- rating_menu = new RatingMenu (null);
- rating_menu.RatingSelected += MainWindow.Toplevel.HandleRatingMenuSelected;
- return (Gtk.Menu) rating_menu;
+ MainWindow.Toplevel.HandleRatingMenuSelected ((o as Widgets.Rating).Value);
}
-
- public void OnActivated (object o, EventArgs e)
- {
- if (rating_menu != null)
- rating_menu.Populate ();
- }
-
}
}
Modified: trunk/src/FSpot.addin.xml
==============================================================================
--- trunk/src/FSpot.addin.xml (original)
+++ trunk/src/FSpot.addin.xml Thu Jan 24 20:04:28 2008
@@ -36,6 +36,6 @@
<MenuSeparator id = "Separator3" />
<MenuGenerator id = "AttachTag" _label = "_Attach Tag" icon = "gtk-add" generator_type = "FSpot.Extensions.AttachTag" />
<MenuGenerator id = "RemoveTag" _label = "Rem_ove Tag" icon = "gtk-remove" generator_type = "FSpot.Extensions.RemoveTag" />
- <MenuGenerator id = "RatingMenu" _label = "Set ra_ting" generator_type = "FSpot.Extensions.Rate" />
+ <ComplexMenuItem id = "Rate" widget_type = "FSpot.Widgets.RatingMenuItem" command_type = "FSpot.Extensions.Rate"/>
</Extension>
</Addin>
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Thu Jan 24 20:04:28 2008
@@ -91,6 +91,7 @@
$(srcdir)/Extensions/MenuNode.cs \
$(srcdir)/Extensions/OpenWithMenu.cs \
$(srcdir)/Extensions/CommandMenuItemNode.cs \
+ $(srcdir)/Extensions/ComplexMenuItemNode.cs \
$(srcdir)/Extensions/PopupCommands.cs \
$(srcdir)/Fader.cs \
$(srcdir)/FlickrExport.cs \
@@ -193,7 +194,6 @@
$(srcdir)/Query/RollSet.cs \
$(srcdir)/Query/UntaggedCondition.cs \
$(srcdir)/RatingFilter.cs \
- $(srcdir)/RatingMenu.cs \
$(srcdir)/QueuedSqliteDatabase.cs \
$(srcdir)/RepairDialog.cs \
$(srcdir)/RotateCommand.cs \
Modified: trunk/src/Widgets/ComplexMenuItem.cs
==============================================================================
--- trunk/src/Widgets/ComplexMenuItem.cs (original)
+++ trunk/src/Widgets/ComplexMenuItem.cs Thu Jan 24 20:04:28 2008
@@ -36,6 +36,14 @@
{
private bool is_selected = false;
+ public event EventHandler Changed;
+ public void OnChanged (object o, EventArgs e)
+ {
+ EventHandler handler = Changed;
+ if (handler != null)
+ handler (o, e);
+ }
+
public ComplexMenuItem() : base()
{
}
Modified: trunk/src/Widgets/RatingMenuItem.cs
==============================================================================
--- trunk/src/Widgets/RatingMenuItem.cs (original)
+++ trunk/src/Widgets/RatingMenuItem.cs Thu Jan 24 20:04:28 2008
@@ -114,6 +114,7 @@
{
if (can_activate) {
Activate ();
+ OnChanged (o, args);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]