banshee r3084 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Core/Nereid/Nereid src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue src/Extensions/Banshee.PlayQueue/Resources



Author: abock
Date: Tue Jan 29 17:26:20 2008
New Revision: 3084
URL: http://svn.gnome.org/viewvc/banshee?rev=3084&view=rev

Log:
2008-01-29  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Gui/IHasSourceView.cs: Expose
    ResetHighlight

    * src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs: Reset
    the highlight in the source view when done with the context menu

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs:
    Draw a special highlight for the highlight path

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs: Add
    a concept of a highlight path which is now different from the selected
    path to avoid confusion of the selection changing source when using the
    context menu

    * src/Core/Nereid/Nereid/PlayerInterface.cs: Implement ResetHightlight

    * src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs:
    * src/Extensions/Banshee.PlayQueue/Resources/Actions.xml:
    Expose a source context menu



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IHasSourceView.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
   trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
   trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/Actions.xml

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IHasSourceView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IHasSourceView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/IHasSourceView.cs	Tue Jan 29 17:26:20 2008
@@ -33,6 +33,7 @@
     public interface IHasSourceView
     {
         Source HighlightedSource { get; }
+        void ResetHighlight ();
         void BeginRenameSource (Source source);
     }
 }

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/SourceActions.cs	Tue Jan 29 17:26:20 2008
@@ -156,6 +156,7 @@
             Gtk.Menu menu = action_service.UIManager.GetWidget (path) as Menu;
             menu.Show (); 
             menu.Popup (null, null, null, 0, Gtk.Global.CurrentEventTime);
+            menu.SelectionDone += delegate { SourceView.ResetHighlight (); };
         }
             
         private void OnImportSource (object o, EventArgs args)

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs	Tue Jan 29 17:26:20 2008
@@ -41,6 +41,7 @@
         public bool Italicized = false;
         public Source source;
         public SourceView view;
+        public TreePath path;
 
         public SourceRowRenderer()
         {
@@ -86,6 +87,13 @@
                 return;
             }
             
+            if(path != null && path.Equals (view.HighlightedPath) && !view.Selection.PathIsSelected (path)) {
+                drawable.DrawRectangle (widget.Style.BackgroundGC (StateType.Normal), true, background_area);
+                drawable.DrawRectangle (widget.Style.BackgroundGC (StateType.Selected), false,
+                    new Gdk.Rectangle (background_area.X, background_area.Y, 
+                        background_area.Width -1, background_area.Height - 1));
+            }
+            
             bool hideCounts = source.Count <= 0;
             
             StateType state = RendererStateToWidgetState(flags);

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceView.cs	Tue Jan 29 17:26:20 2008
@@ -50,6 +50,7 @@
         private TreeStore store;
         private TreeViewColumn focus_column;
         private SourceRowRenderer renderer;
+        private TreePath highlight_path;
         private int currentTimeout = -1;
         
         private static TargetEntry [] dnd_source_entries = new TargetEntry [] {
@@ -100,7 +101,7 @@
             };
             
             ServiceManager.SourceManager.ActiveSourceChanged += delegate(SourceEventArgs args) {
-                ResetHighlight();
+                ResetSelection();
             };
             
             ServiceManager.SourceManager.SourceUpdated += delegate(SourceEventArgs args) {
@@ -110,14 +111,8 @@
             };
             
             ServiceManager.PlaybackController.SourceChanged += delegate {
-                QueueDraw ();
+                QueueDraw();
             };
-            
-            if(ServiceManager.Contains ("GtkElementsService")) {
-                ServiceManager.Get<Banshee.Gui.GtkElementsService> ("GtkElementsService").ThemeChanged += delegate {
-                    QueueDraw();
-                };
-            }
         }
 
         private TreeIter FindSource(Source source)
@@ -262,6 +257,7 @@
             SourceRowRenderer renderer = (SourceRowRenderer)cell;
             renderer.view = this;
             renderer.source = (Source)store.GetValue(iter, 0);
+            renderer.path = store.GetPath (iter);
             
             if(renderer.source == null) {
                 return;
@@ -324,20 +320,7 @@
                 
             } else if(evnt.Button == 3) {
                 HighlightPath(path);
-
                 OnPopupMenu ();
-                /*ServiceManager.SourceManager.SensitizeActions(source);
-
-                string group_name = source.ActionPath == null ? "/SourceMenu" : source.ActionPath;
-                Menu source_menu = Globals.ActionManager.GetWidget(group_name) as Menu;
-                source_menu.SelectionDone += delegate {
-                    ServiceManager.SourceManager.SensitizeActions(ServiceManager.SourceManager.ActiveSource);
-                    ResetHighlight();
-                };
-            
-                source_menu.Popup(null, null, null, 0, evnt.Time);
-                source_menu.Show();*/
-                
                 return true;
             }
             
@@ -346,7 +329,7 @@
 
         protected override bool OnPopupMenu ()
         {
-            ServiceManager.Get<InterfaceActionService> ("InterfaceActionService").SourceActions["SourceContextMenuAction"].Activate ();
+            ServiceManager.Get<InterfaceActionService> ().SourceActions["SourceContextMenuAction"].Activate ();
             return true;
         }
 
@@ -571,11 +554,6 @@
             }*/
         }
         
-        public void HighlightPath(TreePath path)
-        {
-            Selection.SelectPath(path);
-        }
-        
         public Source GetSource(TreeIter iter)
         {
             return store.GetValue(iter, 0) as Source;
@@ -592,27 +570,44 @@
             return null;
         }
         
-        public void ResetHighlight()
+        private void ResetSelection()
         {
             TreeIter iter = FindSource (ServiceManager.SourceManager.ActiveSource);
             
             if(!iter.Equals(TreeIter.Zero)){
                 Selection.SelectIter(iter);
             }
-         }
+        }
+        
+        public void HighlightPath(TreePath path)
+        {
+            //Selection.SelectPath(path);
+            highlight_path = path;
+            QueueDraw ();
+        }
+        
+        public void ResetHighlight()
+        {   
+            highlight_path = null;
+            QueueDraw ();
+        }
         
         public Source HighlightedSource {
             get {
                 TreeModel model;
                 TreeIter iter;
                 
-                if(!Selection.GetSelected(out model, out iter)) {
+                if (highlight_path == null || !store.GetIter (out iter, highlight_path)) {
                     return null;
                 }
                     
                 return store.GetValue(iter, 0) as Source;
             }
         }
+        
+        internal TreePath HighlightedPath {
+            get { return highlight_path; }
+        }
 
         private bool editing_row = false;
         public bool EditingRow {

Modified: trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs	(original)
+++ trunk/banshee/src/Core/Nereid/Nereid/PlayerInterface.cs	Tue Jan 29 17:26:20 2008
@@ -402,6 +402,11 @@
         {
             source_view.BeginRenameSource (source);
         }
+        
+        public void ResetHighlight ()
+        {
+            source_view.ResetHighlight ();
+        }
 
 #endregion
         

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs	Tue Jan 29 17:26:20 2008
@@ -59,6 +59,7 @@
             Order = 0;
             Properties.SetString ("IconName", "audio-x-generic");
             Properties.SetString ("RemoveTracksActionLabel", Catalog.GetString ("Remove From Play Queue"));
+            Properties.SetString ("GtkActionPath", "/PlayQueueContextMenu");
             
             ((TrackListDatabaseModel)TrackModel).ForcedSortQuery = "CorePlaylistEntries.EntryID ASC";
             

Modified: trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/Actions.xml
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/Actions.xml	(original)
+++ trunk/banshee/src/Extensions/Banshee.PlayQueue/Resources/Actions.xml	Tue Jan 29 17:26:20 2008
@@ -9,4 +9,7 @@
             <menuitem name="AddToPlayQueue" action="AddToPlayQueueAction"></menuitem>
         </placeholder>
     </popup>
+    <popup name="PlayQueueContextMenu">
+        <menuitem action="ClearPlayQueueAction"></menuitem>
+    </popup>
 </ui>



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