banshee r4424 - in branches/banshee/abock: . src/Core/Banshee.ThickClient src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor



Author: abock
Date: Sat Aug 23 02:00:53 2008
New Revision: 4424
URL: http://svn.gnome.org/viewvc/banshee?rev=4424&view=rev

Log:
2008-08-22  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs:
    Recursively find all SyncButton instances inside of the notebook and
    click them - this enables the 'sync all fields' button

    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs:
    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorUtilities.cs:
    * src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/SyncButton.cs:
    Removed the utility to create a sync button, replaced with a proper
    SyncButton class so that type detection can be done at runtime



Added:
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/SyncButton.cs
Modified:
   branches/banshee/abock/ChangeLog
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorUtilities.cs
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs
   branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
   branches/banshee/abock/src/Core/Banshee.ThickClient/Makefile.am

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorUtilities.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorUtilities.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/EditorUtilities.cs	Sat Aug 23 02:00:53 2008
@@ -57,12 +57,7 @@
             entry.WidthChars = charWidth;
             return entry;
         }
-        
-        public static Button CreateSyncButton ()
-        {
-            return CreateSmallStockButton (Stock.Copy);
-        }
-        
+
         public static Button CreateSmallStockButton (string stock)
         {
             Button button = new Button ();

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/FieldPage.cs	Sat Aug 23 02:00:53 2008
@@ -124,7 +124,7 @@
             slot.ReadClosure = readClosure;
             slot.WriteClosure = writeClosure;
             if (MultipleTracks && (options & FieldOptions.NoSync) == 0) {
-                slot.SyncButton = EditorUtilities.CreateSyncButton ();
+                slot.SyncButton = new SyncButton ();
                 slot.SyncButton.Clicked += delegate {
                     dialog.ForeachNonCurrentTrack (delegate (EditorTrackInfo track) {
                         slot.WriteClosure (track, slot.Field);

Added: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/SyncButton.cs
==============================================================================
--- (empty file)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/SyncButton.cs	Sat Aug 23 02:00:53 2008
@@ -0,0 +1,44 @@
+//
+// SyncButton.cs
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 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;
+using Gtk;
+
+namespace Banshee.Gui.TrackEditor
+{
+    public class SyncButton : Button
+    {
+        public SyncButton ()
+        {
+            Image image = new Image (Stock.Copy, IconSize.Menu);
+            Add (image);
+            Relief = ReliefStyle.None;
+            image.Show ();
+        }
+    }
+}

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/TrackEditorDialog.cs	Sat Aug 23 02:00:53 2008
@@ -228,6 +228,12 @@
                        
             if (TrackCount > 1) {
                 sync_all_button = new Button ();
+                sync_all_button.Clicked += delegate {
+                    for (int i = 0; i < notebook.NPages; i++) {
+                        InvokeFieldSync (notebook.GetNthPage (i) as Container);
+                    }        
+                };
+                
                 Alignment alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f);
                 HBox box = new HBox ();
                 box.Spacing = 2;
@@ -251,6 +257,25 @@
             button_box.ShowAll ();
         }
         
+        private void InvokeFieldSync (Container container)
+        {
+            if (container == null) {
+                return;
+            }
+            
+            foreach (Widget child in container.Children) {
+                SyncButton sync = child as SyncButton;
+                if (sync != null) {
+                    sync.Click ();
+                } else {
+                    Container child_container = child as Container;
+                    if (child_container != null) {
+                        InvokeFieldSync (child_container);
+                    }
+                }
+            }
+        }
+        
         private int action_area_children_allocated = 0;
         
         private void OnActionAreaChildSizeAllocated (object o, SizeAllocatedArgs args)

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Banshee.ThickClient.mdp	Sat Aug 23 02:00:53 2008
@@ -141,6 +141,7 @@
     <File name="Banshee.Gui.TrackEditor/EditorMode.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Gui.TrackEditor/PageType.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Gui.TrackEditor/HelpPage.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Gui.TrackEditor/SyncButton.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="False" refto="Hyena.Gui" />

Modified: branches/banshee/abock/src/Core/Banshee.ThickClient/Makefile.am
==============================================================================
--- branches/banshee/abock/src/Core/Banshee.ThickClient/Makefile.am	(original)
+++ branches/banshee/abock/src/Core/Banshee.ThickClient/Makefile.am	Sat Aug 23 02:00:53 2008
@@ -64,6 +64,7 @@
 	Banshee.Gui.TrackEditor/RatingEntry.cs \
 	Banshee.Gui.TrackEditor/SpinButtonEntry.cs \
 	Banshee.Gui.TrackEditor/StatisticsPage.cs \
+	Banshee.Gui.TrackEditor/SyncButton.cs \
 	Banshee.Gui.TrackEditor/TextEntry.cs \
 	Banshee.Gui.TrackEditor/TextViewEntry.cs \
 	Banshee.Gui.TrackEditor/TitleEntry.cs \



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