Tuesday, January 29, 2008

Slimming Down

tamara@nightdragon:~/My_Stuff/Computer/Programming/muine-cs3$ svk diff -r 1155 | diffstat
 About.cs          |    8 -
 Actions.cs        |  352 +++++++-----------------------------------------------
 AddAlbumWindow.cs |   52 +------
 AddSongWindow.cs  |   37 -----
 Makefile.am       |    3 
 PlaylistWindow.cs |   21 +--
 6 files changed, 74 insertions(+), 399 deletions(-)

Since we last spoke, I discovered a program called svk, which allows you to make a local copy of an SVN repository and make local commits to it and such. I am using it to fiddle with a C# 3.0 port of Muine. I was just going to make a branch on the SVN server but it's been so long since I've committed anything there, I either forgot my password or my account was disabled. I'm not even sure that I've committed anything since they switched to SVN.

So the majority of the changes are in the Actions.cs file and they look something like this:

Old

public Actions () : base ("Actions")
{
  this ["Import"].Activated += OnImport;
}

// Handlers :: OnImport
/// <summary>
///     Handler called when the Import action is activated.
/// </summary>
/// <remarks>
///     This opens the <see cref="ImportDialog" /> window.
/// </remarks>
/// <param name="o">
///     The calling object.
/// </param>
/// <param name="args">
///     The <see cref="EventArgs" />.
/// </param>
private void OnImport (object o, EventArgs args)
{
    new ImportDialog ();
}

New

this ["Import"].Activated += (o, args) => { new ImportDialog (); };

The braces are only necessary to eliminate an unwanted return value.

Hooray for lambda expressions!

(Yes, C# 2.0 anonymous delegates would have helped some but I never implemented those.)

Also, Muine is dying. I've mainly given up on it. I'm curious to see if I can fix it up though before it disappears beneath Banshee. I have put far too many hours into it that I don't want to see go to waste.

1 comment:

Anonymous said...

That diffstat utility is really useful! Thanks for that :)