banshee r4195 - in trunk/banshee: . src/Clients/Nereid/Nereid src/Extensions/Banshee.Daap src/Extensions/Banshee.Daap/Banshee.Daap



Author: gburt
Date: Tue Jun 24 21:49:05 2008
New Revision: 4195
URL: http://svn.gnome.org/viewvc/banshee?rev=4195&view=rev

Log:
2008-06-24  Gabriel Burt  <gabriel burt gmail com>

	* src/Extensions/Banshee.Daap/Banshee.Daap.mdp: Reflect addins mv and
	proxy file from last commit, new error view file and refs this commit.

	* src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs: Set the
	ErrorView when we fail to login to a share we detected.

	* src/Extensions/Banshee.Daap/Banshee.Daap/DaapErrorView.cs: Tweak for
	trunk, subclassing from RoundedFrame and no border, and implementing
	ISourceContents.

	* src/Extensions/Banshee.Daap/Makefile.am:  Add the new error view.

	* src/Clients/Nereid/Nereid/PlayerInterface.cs: Listen for changed to the
	active source's Nereid.SourceContents property, keeping it synced - so
	that we can change to the error source for a daap share, and then back to
	the normal contents by unsetting the property.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapErrorView.cs
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs
   trunk/banshee/src/Extensions/Banshee.Daap/Makefile.am

Modified: trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs
==============================================================================
--- trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	(original)
+++ trunk/banshee/src/Clients/Nereid/Nereid/PlayerInterface.cs	Tue Jun 24 21:49:05 2008
@@ -280,6 +280,7 @@
             view_container.SearchEntry.Ready = true;
         }
         
+        private Source previous_source = null;
         private TrackListModel previous_track_model = null;
         private void OnActiveSourceChanged (SourceEventArgs args)
         {
@@ -313,7 +314,33 @@
                 previous_track_model = (source as ITrackModelSource).TrackModel;
                 previous_track_model.Reloaded += HandleTrackModelReloaded;
             }
-
+            
+            if (previous_source != null) {
+                previous_source.Properties.PropertyChanged -= OnSourcePropertyChanged;
+            }
+            
+            previous_source = source;
+            previous_source.Properties.PropertyChanged += OnSourcePropertyChanged;
+            
+            UpdateSourceContents (source);
+            
+            UpdateSourceInformation ();
+            view_container.SearchEntry.Ready = true;
+        }
+        
+        private void OnSourcePropertyChanged (object o, PropertyChangeEventArgs args)
+        {
+            if (args.PropertyName == "Nereid.SourceContents") {
+                UpdateSourceContents (previous_source);
+            }
+        }
+        
+        private void UpdateSourceContents (Source source)
+        {
+            if (source == null) {
+                return;
+            }
+            
             // Connect the source models to the views if possible
             if (source.Properties.Contains ("Nereid.SourceContents")) {
                 view_container.Content = source.Properties.Get<ISourceContents> ("Nereid.SourceContents");
@@ -356,9 +383,6 @@
             if (footer_widget != null) {
                 view_container.SetFooter (footer_widget);
             }
-            
-            UpdateSourceInformation ();
-            view_container.SearchEntry.Ready = true;
         }
 
         private void OnSourceUpdated (SourceEventArgs args)

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp	Tue Jun 24 21:49:05 2008
@@ -29,9 +29,11 @@
     <File name="Daap/User.cs" subtype="Code" buildaction="Compile" />
     <File name="Daap/Utility.cs" subtype="Code" buildaction="Compile" />
     <File name="Daap/content-codes" subtype="Code" buildaction="EmbedAsResource" />
-    <File name="Resources/Banshee.Daap.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
     <File name="Banshee.Daap/DaapLoginDialog.cs" subtype="Code" buildaction="Compile" />
     <File name="Banshee.Daap/DaapPlaylistSource.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Daap/DaapProxyWebServer.cs" subtype="Code" buildaction="Compile" />
+    <File name="Banshee.Daap.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
+    <File name="Banshee.Daap/DaapErrorView.cs" subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="Banshee.Core" />
@@ -39,6 +41,8 @@
     <ProjectReference type="Project" localcopy="True" refto="Hyena" />
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Zeroconf, Version=2.0.0.76, Culture=neutral, PublicKeyToken=e60c4f4a95e1099e" />
+    <ProjectReference type="Project" localcopy="True" refto="Banshee.ThickClient" />
+    <ProjectReference type="Project" localcopy="True" refto="Hyena.Gui" />
   </References>
   <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="./Makefile.am">
     <BuildFilesVar Sync="True" Name="SOURCES" />

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapErrorView.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapErrorView.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapErrorView.cs	Tue Jun 24 21:49:05 2008
@@ -31,9 +31,10 @@
 using Gtk;
 
 using Banshee.Base;
+using Banshee.Gui;
 using Banshee.Widgets;
 
-namespace Banshee.Plugins.Daap
+namespace Banshee.Daap
 {
     public enum DaapErrorType {
         BrokenAuthentication,
@@ -41,17 +42,25 @@
         UserDisconnect
     }
     
-    public class DaapErrorView : ShadowContainer
+    public class DaapErrorView : Hyena.Widgets.RoundedFrame, Banshee.Sources.Gui.ISourceContents
     {
         private MessagePane pane;
         private bool info_link_clicked;
         private DaapSource source;
         private DaapErrorType failure;
         
-        public DaapErrorView(DaapSource source, DaapErrorType failure) : base()
+        public Banshee.Sources.ISource Source {
+            get { return source; }
+        }
+
+        public Widget Widget {
+            get { return this; }
+        }
+        
+        public DaapErrorView (DaapSource source, DaapErrorType failure) : base()
         {
-            AppPaintable = true;
-            BorderWidth = 10;
+            //AppPaintable = true;
+            //BorderWidth = 10;
             
             this.source = source;
             this.failure = failure;
@@ -139,5 +148,14 @@
                 pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
             }
         }
+
+        public bool SetSource (Banshee.Sources.ISource source)
+        {
+            return this.source == source;
+        }
+
+        public void ResetSource ()
+        {
+        }
     }
 }

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap/DaapSource.cs	Tue Jun 24 21:49:05 2008
@@ -84,6 +84,8 @@
                 return;
             }
             
+            ClearErrorView ();
+            
             is_activating = true;
             base.Activate ();
             
@@ -100,7 +102,7 @@
                         ThreadAssist.ProxyToMain (PromptLogin);
                     }
                 } catch(Exception e) {
-                    SetStatus (String.Format (Catalog.GetString ("Failed to connect to {0}"), service.Name), true);
+                    ShowErrorView (DaapErrorType.BrokenAuthentication);
                     Hyena.Log.Exception (e);
                 }
                
@@ -108,6 +110,20 @@
             });
         }
         
+        private void ShowErrorView (DaapErrorType error_type)
+        {
+            client = null;
+            DaapErrorView error_view = new DaapErrorView (this, error_type);
+            error_view.Show ();
+            Properties.Set<Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", error_view);
+            HideStatus ();
+        }
+        
+        private void ClearErrorView ()
+        {
+            Properties.Remove ("Nereid.SourceContents");
+        }
+        
         internal bool Disconnect (bool logout)
         {
             // Stop currently playing track if its from us.
@@ -163,14 +179,14 @@
         
         private void PromptLogin ()
         {
-            SetStatus (String.Format (Catalog.GetString ("Logging in to {0}"), Name), false);
+            SetStatus (Catalog.GetString ("Logging in to {0}."), false);
             
             DaapLoginDialog dialog = new DaapLoginDialog (client.Name, 
             client.AuthenticationMethod == DAAP.AuthenticationMethod.UserAndPassword);
             if (dialog.Run () == (int) Gtk.ResponseType.Ok) {
                 AuthenticatedLogin (dialog.Username, dialog.Password);
             } else {
-                Unmap ();
+                ShowErrorView (DaapErrorType.UserDisconnect);
             }
 
             dialog.Destroy ();
@@ -182,7 +198,9 @@
                 try {
                     client.Login (username, password);
                 } catch (DAAP.AuthenticationException) {
-                    ThreadAssist.ProxyToMain (PromptLogin);
+                    ThreadAssist.ProxyToMain (delegate {
+                        ShowErrorView (DaapErrorType.InvalidAuthentication);
+                    });
                 }
             });
         }
@@ -195,7 +213,7 @@
                 database.TrackAdded += OnDatabaseTrackAdded;
                 database.TrackRemoved += OnDatabaseTrackRemoved;
                 
-                SetStatus (String.Format (Catalog.GetString ("Loading {0} tracks"), database.Tracks.Count), false, true, "gtk-refresh");
+                SetStatus (String.Format (Catalog.GetString ("Loading {0} tracks."), database.Tracks.Count), false);
                 
                 int count = 0;
                 DaapTrackInfo daap_track = null;

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Makefile.am	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Makefile.am	Tue Jun 24 21:49:05 2008
@@ -5,6 +5,7 @@
 
 SOURCES =  \
 	Banshee.Daap/DaapContainerSource.cs \
+	Banshee.Daap/DaapErrorView.cs \
 	Banshee.Daap/DaapLoginDialog.cs \
 	Banshee.Daap/DaapPlaylistSource.cs \
 	Banshee.Daap/DaapProxyWebServer.cs \



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