Re: [Banshee-List] Writing extentions for Banshee



On Fri, Apr 15, 2011 at 2:30 PM, Maciej Marcin Piechotka
<uzytkownik2 gmail com> wrote:
> On Tue, 2011-04-12 at 12:35 -0500, Gabriel Burt wrote:
>> I highly recommend finding an extension that is similar to the one you
>> want to make, and study it.  Our best documentation is a large set of
>> functional extensions that you can copy from.  If you have more
>> questions, do ask, here or on the #banshee IRC channel on gimpnet.
>>
>> Gabriel
>>
>
> The problem with studying is that not all 'magic' is explained. For
> example I have following method in view:
>
>        public bool SetSource (ISource source) {
>            spotify = source as SpotifySource;
>            Hyena.Log.DebugFormat ("{0} set as source", spotify.ToString
> ());
>            if (spotify == null) {
>                return false;
>            }
>            return true;
>        }
>
> The constructor is done as:
>
>       public SpotifySource () : base ("Spotify",
>                                       "Spotify",
>                                       sort_order,
>                                       "spotify")
>        {
>            Properties.Set<ISourceContents> ("Nereid.SourceContents",
> new SpotifyView ());
>            // Copied from LastfmSource probably w/out understending
>            ServiceManager.SourceManager.AddSource (this);
>            Hyena.Log.Information ("Testing!  Spotify source has been
> instantiated!");
>        }
>
> I cannot find how SetSource is called  anywhere in code although I
> assume it is called in Lastfm extension somehow. I may just add
> SetSource manually but I have feelings of crossover between programming
> by permutation[1] and reverse engineering (I'm not worried that the
> code won't work - I'm worried that it'll by spaghetti code that won't
> work correctly).

You don't have to call SetSource yourself, it is called automatically
when the source is activated (=selected).
You can find the code that does that here :

http://git.gnome.org/browse/banshee/tree/src/Clients/Nereid/Nereid/PlayerInterface.cs#n543

-- 
Bertrand Lorentz


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