banshee r3224 - in trunk/banshee: . build src src/Extensions/Banshee.LastFM src/Extensions/Banshee.LastFM/Banshee.LastFM src/Extensions/Banshee.LastFM/Resources src/Libraries src/Libraries/Lastfm src/Libraries/Lastfm.Gui src/Libraries/Lastfm.Gui/Lastfm.Gui src/Libraries/Lastfm.Gui/Resources src/Libraries/Lastfm/Last.FM src/Libraries/Lastfm/Last.FM.Gui src/Libraries/Lastfm/Lastfm
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3224 - in trunk/banshee: . build src src/Extensions/Banshee.LastFM src/Extensions/Banshee.LastFM/Banshee.LastFM src/Extensions/Banshee.LastFM/Resources src/Libraries src/Libraries/Lastfm src/Libraries/Lastfm.Gui src/Libraries/Lastfm.Gui/Lastfm.Gui src/Libraries/Lastfm.Gui/Resources src/Libraries/Lastfm/Last.FM src/Libraries/Lastfm/Last.FM.Gui src/Libraries/Lastfm/Lastfm
- Date: Mon, 11 Feb 2008 22:26:25 +0000 (GMT)
Author: gburt
Date: Mon Feb 11 22:26:25 2008
New Revision: 3224
URL: http://svn.gnome.org/viewvc/banshee?rev=3224&view=rev
Log:
2008-02-11 Gabriel Burt <gabriel burt gmail com>
* src/Makefile.am:
* src/Libraries/Makefile.am: New directory for what was Extras in stable.
* build/build.environment.mk:
* configure.ac:
* src/Libraries/Lastfm/*:
* src/Libraries/Lastfm.Gui/*: Bring Last.FM library over from stable, and
rip out the Gnome.Keyring dependency.
* src/Extensions/Banshee.LastFM/*: Bring Last.FM plugin over from stable.
Not part of the default build yet; lots of porting still to do.
Added:
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/Connection.cs (contents, props changed)
- copied, changed from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/Connection.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/LastFMSource.cs (contents, props changed)
- copied, changed from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/LastFMSource.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/LastFMTrackInfo.cs (contents, props changed)
- copied, changed from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/LastFMTrackInfo.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/Plugin.cs (contents, props changed)
- copied, changed from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/Plugin.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationEditor.cs (contents, props changed)
- copied, changed from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/Editor.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationSource.cs (contents, props changed)
- copied, changed from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/StationSource.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationType.cs (contents, props changed)
- copied, changed from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/StationType.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Resources/Banshee.LastFM.addin.xml
trunk/banshee/src/Libraries/
trunk/banshee/src/Libraries/Lastfm/ (props changed)
- copied from r3223, /branches/banshee/stable/src/Extras/Last.FM/
trunk/banshee/src/Libraries/Lastfm.Gui/
trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/ (props changed)
- copied from r3223, /branches/banshee/stable/src/Extras/Last.FM/Last.FM.Gui/
trunk/banshee/src/Libraries/Lastfm.Gui/Resources/
trunk/banshee/src/Libraries/Lastfm.Gui/Resources/badge-hover.png (props changed)
- copied unchanged from r3223, /branches/banshee/stable/src/Extras/Last.FM/badge-hover.png
trunk/banshee/src/Libraries/Lastfm.Gui/Resources/badge.png (props changed)
- copied unchanged from r3223, /branches/banshee/stable/src/Extras/Last.FM/badge.png
trunk/banshee/src/Libraries/Lastfm/Lastfm/ (props changed)
- copied from r3223, /branches/banshee/stable/src/Extras/Last.FM/Last.FM/
trunk/banshee/src/Libraries/Makefile.am
Removed:
trunk/banshee/src/Extensions/Banshee.LastFM/Connection.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Editor.cs
trunk/banshee/src/Extensions/Banshee.LastFM/LastFMSource.cs
trunk/banshee/src/Extensions/Banshee.LastFM/LastFMTrackInfo.cs
trunk/banshee/src/Extensions/Banshee.LastFM/Plugin.cs
trunk/banshee/src/Extensions/Banshee.LastFM/StationSource.cs
trunk/banshee/src/Extensions/Banshee.LastFM/StationType.cs
trunk/banshee/src/Libraries/Lastfm/Last.FM/
trunk/banshee/src/Libraries/Lastfm/Last.FM.Gui/
trunk/banshee/src/Libraries/Lastfm/badge-hover.png
trunk/banshee/src/Libraries/Lastfm/badge.png
Modified:
trunk/banshee/ChangeLog
trunk/banshee/build/build.environment.mk
trunk/banshee/configure.ac
trunk/banshee/src/Extensions/Banshee.LastFM/Makefile.am
trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs
trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs
trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/Badge.cs
trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/LinkButton.cs
trunk/banshee/src/Libraries/Lastfm/Lastfm/Account.cs
trunk/banshee/src/Libraries/Lastfm/Lastfm/Browser.cs
trunk/banshee/src/Libraries/Lastfm/Makefile.am
trunk/banshee/src/Makefile.am
Modified: trunk/banshee/build/build.environment.mk
==============================================================================
--- trunk/banshee/build/build.environment.mk (original)
+++ trunk/banshee/build/build.environment.mk Mon Feb 11 22:26:25 2008
@@ -23,10 +23,11 @@
# Internal directories/libraries
-# Extras
-#DIR_EXTRAS = $(top_srcdir)/src/Extras
+DIR_BIN = $(top_builddir)/bin
+
+# Libraries
#
-#DIR_BOO = $(DIR_EXTRAS)/Boo
+#DIR_BOO = $(DIR_LIBRARIES)/Boo
#if EXTERNAL_BOO
#LINK_BOO = $(BOO_LIBS)
#else
@@ -36,31 +37,32 @@
# -r:$(DIR_BOO)/Boo.Lang.Interpreter.dll
#endif
#
-#DIR_BOOBUDDY = $(DIR_EXTRAS)/BooBuddy
+#DIR_BOOBUDDY = $(DIR_LIBRARIES)/BooBuddy
#MONO_BASE_PATH += $(DIR_BOOBUDDY)
#REF_BOOBUDDY = $(LINK_GTK) $(LINK_BOO)
#LINK_BOOBUDDY = -r:$(DIR_BOOBUDDY)/BooBuddy.dll
#LINK_BOOBUDDY_DEPS = $(REF_BOOBUDDY) $(LINK_BOOBUDDY)
#
-#DIR_GNOME_KEYRING = $(DIR_EXTRAS)/Gnome.Keyring
+#DIR_GNOME_KEYRING = $(DIR_LIBRARIES)/Gnome.Keyring
#MONO_BASE_PATH += $(DIR_GNOME_KEYRING)
#REF_GNOME_KEYRING = $(LINK_DBUS) $(LINK_MONO_POSIX)
#LINK_GNOME_KEYRING = -r:$(DIR_GNOME_KEYRING)/Gnome.Keyring.dll
#LINK_GNOME_KEYRING_DEPS = $(REF_GNOME_KEYRING) $(LINK_GNOME_KEYRING)
#
-#DIR_LAST_FM = $(DIR_EXTRAS)/Last.FM
-#MONO_BASE_PATH += $(DIR_LAST_FM)
-#REF_LAST_FM = $(LINK_GTK) $(LINK_GNOME_KEYRING_DEPS)
-#LINK_LAST_FM = -r:$(DIR_LAST_FM)/Last.FM.dll
-#LINK_LAST_FM_DEPS = $(REF_LAST_FM) $(LINK_LAST_FM)
+REF_LASTFM = $(LINK_SYSTEM)
+LINK_LASTFM = -r:$(DIR_BIN)/Lastfm.dll
+LINK_LASTFM_DEPS = $(REF_LASTFM) $(LINK_LASTFM)
+
+REF_LASTFM_GUI = $(LINK_MONO_POSIX) $(LINK_GLIB) $(LINK_GTK) $(LINK_LASTFM_DEPS)
+LINK_LASTFM_GUI = -r:$(DIR_BIN)/Lastfm.Gui.dll
+LINK_LASTFM_GUI_DEPS = $(REF_LASTFM_GUI) $(LINK_LASTFM_GUI)
#
-#DIR_MUSICBRAINZ = $(DIR_EXTRAS)/MusicBrainz
+#DIR_MUSICBRAINZ = $(DIR_LIBRARIES)/MusicBrainz
#MONO_BASE_PATH += $(DIR_MUSICBRAINZ)
#REF_MUSICBRAINZ = $(LINK_SYSTEM)
#LINK_MUSICBRAINZ = -r:$(DIR_MUSICBRAINZ)/MusicBrainz.dll
#LINK_MUSICBRAINZ_DEPS = $(REF_MUSICBRAINZ) $(LINK_MUSICBRAINZ)
-DIR_BIN = $(top_builddir)/bin
# Core
REF_HYENA = $(LINK_SYSTEM) $(LINK_SQLITE)
@@ -102,12 +104,12 @@
REF_BACKEND_GSTREAMER = $(LINK_BANSHEE_SERVICES_DEPS) $(LINK_GLIB)
REF_BACKEND_UNIX = $(LINK_BANSHEE_CORE_DEPS) $(LINK_MONO_POSIX)
-
# Extensions
REF_EXTENSION_AUDIOSCROBBLER = $(LINK_BANSHEE_SERVICES_DEPS)
REF_EXTENSION_MULTIMEDIAKEYS = $(LINK_BANSHEE_SERVICES_DEPS)
REF_EXTENSION_NOTIFICATIONAREA = $(LINK_BANSHEE_THICKCLIENT_DEPS)
REF_EXTENSION_PLAYQUEUE = $(LINK_BANSHEE_THICKCLIENT_DEPS)
+REF_EXTENSION_LASTFM = $(LINK_BANSHEE_THICKCLIENT_DEPS) $(LINK_LAST_FM) -r:System.Data -r:System.Web -r:System.Xml
# Build rules
# Ignoring 0278 due to a bug in gmcs:
Modified: trunk/banshee/configure.ac
==============================================================================
--- trunk/banshee/configure.ac (original)
+++ trunk/banshee/configure.ac Mon Feb 11 22:26:25 2008
@@ -139,8 +139,13 @@
src/Backends/Banshee.GStreamer/Makefile
src/Backends/Banshee.Unix/Makefile
+src/Libraries/Makefile
+src/Libraries/Lastfm/Makefile
+src/Libraries/Lastfm.Gui/Makefile
+
src/Extensions/Makefile
src/Extensions/Banshee.Audioscrobbler/Makefile
+src/Extensions/Banshee.LastFM/Makefile
src/Extensions/Banshee.MultimediaKeys/Makefile
src/Extensions/Banshee.NotificationArea/Makefile
src/Extensions/Banshee.PlayQueue/Makefile
Copied: trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/Connection.cs (from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/Connection.cs)
==============================================================================
--- /trunk/banshee/src/Extensions/Banshee.LastFM/Connection.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/Connection.cs Mon Feb 11 22:26:25 2008
@@ -36,13 +36,13 @@
using System.Xml;
using System.Web;
-using Mono.Gettext;
+using Mono.Unix;
using Banshee.Base;
using Banshee.Playlists.Formats.Xspf;
using Last.FM;
-namespace Banshee.Plugins.LastFM
+namespace Banshee.LastFM
{
public class ConnectionStateChangedArgs : EventArgs
{
Copied: trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/LastFMSource.cs (from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/LastFMSource.cs)
==============================================================================
--- /trunk/banshee/src/Extensions/Banshee.LastFM/LastFMSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/LastFMSource.cs Mon Feb 11 22:26:25 2008
@@ -30,17 +30,19 @@
using System.IO;
using System.Collections;
using System.Collections.Generic;
-using Mono.Gettext;
+using Mono.Unix;
using Gtk;
using Banshee.Base;
+using Banshee.Collection;
using Banshee.Configuration;
using Banshee.Widgets;
using Banshee.Sources;
using Banshee.MediaEngine;
+
using Last.FM.Gui;
-namespace Banshee.Plugins.LastFM
+namespace Banshee.LastFM
{
public class LastFMSource : Source
{
Copied: trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/LastFMTrackInfo.cs (from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/LastFMTrackInfo.cs)
==============================================================================
--- /trunk/banshee/src/Extensions/Banshee.LastFM/LastFMTrackInfo.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/LastFMTrackInfo.cs Mon Feb 11 22:26:25 2008
@@ -34,9 +34,10 @@
using Gdk;
using Banshee.Base;
+using Banshee.Collection;
using Banshee.Playlists.Formats.Xspf;
-namespace Banshee.Plugins.LastFM
+namespace Banshee.LastFM
{
public class LastFMTrackInfo : TrackInfo
{
Copied: trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/Plugin.cs (from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/Plugin.cs)
==============================================================================
--- /trunk/banshee/src/Extensions/Banshee.LastFM/Plugin.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/Plugin.cs Mon Feb 11 22:26:25 2008
@@ -31,7 +31,7 @@
using System.Collections.Generic;
using Gtk;
-using Mono.Gettext;
+using Mono.Unix;
using Banshee.Base;
using Banshee.Sources;
@@ -50,7 +50,7 @@
}
}
-namespace Banshee.Plugins.LastFM
+namespace Banshee.LastFM
{
public class LastFMPlugin : Banshee.Plugins.Plugin
{
@@ -212,7 +212,7 @@
private void OnAddStation (object sender, EventArgs args)
{
- Editor ed = new Editor ();
+ StationEditor ed = new StationEditor ();
ed.Window.ShowAll ();
ed.RunDialog ();
}
Copied: trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationEditor.cs (from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/Editor.cs)
==============================================================================
--- /trunk/banshee/src/Extensions/Banshee.LastFM/Editor.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationEditor.cs Mon Feb 11 22:26:25 2008
@@ -1,5 +1,5 @@
/***************************************************************************
- * Editor.cs
+ * StationEditor.cs
*
* Copyright (C) 2007-2008 Novell, Inc.
* Written by Gabriel Burt <gabriel burt gmail com>
@@ -30,16 +30,18 @@
using System.Collections;
using Gtk;
using Glade;
-using Mono.Gettext;
+using Mono.Unix;
using Banshee.Base;
-using Banshee.Widgets;
using Banshee.Sources;
using Banshee.Database;
-namespace Banshee.Plugins.LastFM
+using Banshee.Widgets;
+using Banshee.Gui.Dialogs;
+
+namespace Banshee.LastFM
{
- public class Editor : Banshee.Gui.GladeDialog
+ public class StationEditor : GladeDialog
{
const string dialog_name = "StationSourceEditorDialog";
const string dialog_resource = "lastfm.glade";
@@ -52,7 +54,7 @@
[Widget] private Gtk.Label arg_label;
[Widget] private Gtk.Button ok_button;
- public Editor (StationSource source) : base (dialog_name, new Glade.XML (
+ public StationEditor (StationSource source) : base (dialog_name, new Glade.XML (
System.Reflection.Assembly.GetExecutingAssembly (), dialog_resource, dialog_name, "banshee"))
{
this.source = source;
@@ -62,7 +64,7 @@
Dialog.Title = Catalog.GetString ("Edit Station");
}
- public Editor () : base (dialog_name, new Glade.XML (
+ public StationEditor () : base (dialog_name, new Glade.XML (
System.Reflection.Assembly.GetExecutingAssembly (), dialog_resource, dialog_name, "banshee"))
{
Initialize ();
Copied: trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationSource.cs (from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/StationSource.cs)
==============================================================================
--- /trunk/banshee/src/Extensions/Banshee.LastFM/StationSource.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationSource.cs Mon Feb 11 22:26:25 2008
@@ -31,7 +31,7 @@
using System.Data;
using System.Collections.Generic;
using System.Threading;
-using Mono.Gettext;
+using Mono.Unix;
using Gtk;
using Banshee.Base;
@@ -42,9 +42,9 @@
using Banshee.MediaEngine;
using Banshee.Playlists.Formats.Xspf;
-namespace Banshee.Plugins.LastFM
+namespace Banshee.LastFM
{
- public class StationSource : ChildSource
+ public class StationSource : Source
{
private static readonly Gdk.Pixbuf refresh_pixbuf = IconThemeUtils.LoadIcon (22, Stock.Refresh);
private static readonly Gdk.Pixbuf error_pixbuf = IconThemeUtils.LoadIcon (22, Stock.DialogError);
Copied: trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationType.cs (from r3223, /trunk/banshee/src/Extensions/Banshee.LastFM/StationType.cs)
==============================================================================
--- /trunk/banshee/src/Extensions/Banshee.LastFM/StationType.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Banshee.LastFM/StationType.cs Mon Feb 11 22:26:25 2008
@@ -30,7 +30,7 @@
using System.Collections.Generic;
using Mono.Gettext;
-namespace Banshee.Plugins.LastFM
+namespace Banshee.LastFM
{
public class StationType
{
Modified: trunk/banshee/src/Extensions/Banshee.LastFM/Makefile.am
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.LastFM/Makefile.am (original)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Makefile.am Mon Feb 11 22:26:25 2008
@@ -1,38 +1,22 @@
-include $(top_srcdir)/build/Common.Makefile
+ASSEMBLY = Banshee.LastFM
+TARGET = library
+LINK = $(REF_EXTENSION_LASTFM)
-lastfm_resources = \
+SOURCES = \
+ Banshee.LastFM/Editor.cs \
+ Banshee.LastFM/Connection.cs \
+ Banshee.LastFM/Plugin.cs \
+ Banshee.LastFM/LastFMSource.cs \
+ Banshee.LastFM/LastFMTrackInfo.cs \
+ Banshee.LastFM/StationSource.cs \
+ Banshee.LastFM/StationType.cs
+
+RESOURCES = \
+ Resources/Banshee.LastFM.addin.xml \
Resources/lastfm.glade \
Resources/Actions.xml \
Resources/audioscrobbler.png \
Resources/recommended.png
-lastfm_resources_build = $(foreach res,$(lastfm_resources), $(addprefix -resource:,$(srcdir)/$(res)),$(notdir $(res)))
-
-ASSEMBLY = Banshee.Plugins.LastFM.dll
-ASSEMBLY_GCONF_SCHEMA = banshee-plugin-lastfm.schemas.in
-
-SOURCES = \
- $(srcdir)/Editor.cs \
- $(srcdir)/Connection.cs \
- $(srcdir)/Plugin.cs \
- $(srcdir)/LastFMSource.cs \
- $(srcdir)/LastFMTrackInfo.cs \
- $(srcdir)/StationSource.cs \
- $(srcdir)/StationType.cs \
- $(top_srcdir)/src/AssemblyInfo.cs
-
-plugindir = $(pkglibdir)/Banshee.Plugins
-plugin_SCRIPTS = $(ASSEMBLY) $(ASSEMBLY).mdb
-
-all: $(ASSEMBLY)
-
-$(ASSEMBLY): $(SOURCES) $(lastfm_resources)
- $(BUILD_LIB_BANSHEE_CORE) -out:$@ $(LINK_LAST_FM) -r:System.Data -r:System.Web -r:System.Xml $(lastfm_resources_build) $(LINK_GTK) $(SOURCES)
-
-include $(top_srcdir)/build/gconf-schema-rules
-
-EXTRA_DIST = $(SOURCES) $(ASSEMBLY_GCONF_SCHEMA) $(lastfm_resources)
-CLEANFILES = *.dll *.mdb
-MAINTAINERCLEANFILES = Makefile.in *.pidb
-DISTCLEANFILES = $(schema_DATA)
+include $(top_srcdir)/build/build.mk
Added: trunk/banshee/src/Extensions/Banshee.LastFM/Resources/Banshee.LastFM.addin.xml
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Extensions/Banshee.LastFM/Resources/Banshee.LastFM.addin.xml Mon Feb 11 22:26:25 2008
@@ -0,0 +1,12 @@
+<Addin id="Banshee.LastFM">
+
+ <Dependencies>
+ <Addin id="Banshee.Services" version="1.0"/>
+ <Addin id="Banshee.ThickClient" version="1.0"/>
+ </Dependencies>
+
+ <Extension path="/Banshee/SourceManager/Source">
+ <Source class="Banshee.LastFM.LastFMSource"/>
+ </Extension>
+
+</Addin>
Modified: trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs
==============================================================================
--- /branches/banshee/stable/src/Extras/Last.FM/Last.FM.Gui/AccountLoginDialog.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginDialog.cs Mon Feb 11 22:26:25 2008
@@ -1,121 +1,125 @@
-/***************************************************************************
- * AccountLoginDialog.cs
- *
- * Copyright (C) 2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
-
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.
- */
-
+//
+// AccountLoginDialog.cs
+//
+// Authors:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006 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 Mono.Unix;
using Gtk;
-namespace Last.FM.Gui
+using Lastfm;
+
+namespace Lastfm.Gui
{
public class AccountLoginDialog : Gtk.Dialog
{
private AccelGroup accel_group;
private AccountLoginForm login_form;
private Label message;
+ private Account account;
- public AccountLoginDialog() : this(false)
+ public AccountLoginDialog (Account account) : this (account, false)
{
}
- public AccountLoginDialog(bool addCloseButton) : base()
+ public AccountLoginDialog (Account account, bool addCloseButton) : base ()
{
- Title = Catalog.GetString("Last.fm Account Login");
+ this.account = account;
+
+ Title = Catalog.GetString ("Last.fm Account Login");
HasSeparator = false;
BorderWidth = 5;
IconName = "gtk-dialog-authentication";
- accel_group = new AccelGroup();
- AddAccelGroup(accel_group);
+ accel_group = new AccelGroup ();
+ AddAccelGroup (accel_group);
- HBox hbox = new HBox(false, 12);
- VBox vbox = new VBox(false, 0);
+ HBox hbox = new HBox (false, 12);
+ VBox vbox = new VBox (false, 0);
hbox.BorderWidth = 5;
vbox.Spacing = 5;
- hbox.Show();
- vbox.Show();
+ hbox.Show ();
+ vbox.Show ();
- Image image = new Image();
+ Image image = new Image ();
image.Yalign = 0.0f;
image.IconName = "gtk-dialog-authentication";
image.IconSize = (int)IconSize.Dialog;
- image.Show();
+ image.Show ();
- hbox.PackStart(image, false, false, 0);
- hbox.PackStart(vbox, true, true, 0);
+ hbox.PackStart (image, false, false, 0);
+ hbox.PackStart (vbox, true, true, 0);
- Label header = new Label();
+ Label header = new Label ();
header.Xalign = 0.0f;
- header.Markup = String.Format("<big><b>{0}</b></big>", Catalog.GetString("Last.fm Account Login"));
- header.Show();
+ header.Markup = String.Format ("<big><b>{0}</b></big>", Catalog.GetString ("Last.fm Account Login"));
+ header.Show ();
- message = new Label(Catalog.GetString("Please enter your Last.fm account credentials."));
+ message = new Label (Catalog.GetString ("Please enter your Last.fm account credentials."));
message.Xalign = 0.0f;
- message.Show();
+ message.Show ();
- vbox.PackStart(header, false, false, 0);
- vbox.PackStart(message, false, false, 0);
+ vbox.PackStart (header, false, false, 0);
+ vbox.PackStart (message, false, false, 0);
- login_form = new AccountLoginForm();
- login_form.Show();
+ login_form = new AccountLoginForm (account);
+ login_form.Show ();
- vbox.PackStart(login_form, true, true, 0);
+ vbox.PackStart (login_form, true, true, 0);
- VBox.PackStart(hbox, true, true, 0);
- VBox.Remove(ActionArea);
+ VBox.PackStart (hbox, true, true, 0);
+ VBox.Remove (ActionArea);
VBox.Spacing = 10;
- HBox bottom_box = new HBox();
- bottom_box.PackStart(new Badge(), true, true, 5);
- bottom_box.PackStart(ActionArea, false, false, 0);
- bottom_box.ShowAll();
- VBox.PackEnd(bottom_box, false, false, 0);
+ HBox bottom_box = new HBox ();
+ bottom_box.PackStart (new Badge (account), true, true, 5);
+ bottom_box.PackStart (ActionArea, false, false, 0);
+ bottom_box.ShowAll ();
+ VBox.PackEnd (bottom_box, false, false, 0);
- if(addCloseButton) {
- AddButton(Stock.Close, ResponseType.Close);
+ if (addCloseButton) {
+ AddButton (Stock.Close, ResponseType.Close);
}
}
- public void AddButton(string message, ResponseType response, bool isDefault)
+ public void AddButton (string message, ResponseType response, bool isDefault)
{
- Button button = (Button)AddButton(message, response);
+ Button button = (Button)AddButton (message, response);
- if(isDefault) {
+ if (isDefault) {
DefaultResponse = response;
- button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Return,
+ button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return,
0, Gtk.AccelFlags.Visible);
}
}
- public void AddSignUpButton()
+ public void AddSignUpButton ()
{
- login_form.AddSignUpButton();
+ login_form.AddSignUpButton ();
}
public string Message {
Modified: trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs
==============================================================================
--- /branches/banshee/stable/src/Extras/Last.FM/Last.FM.Gui/AccountLoginForm.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs Mon Feb 11 22:26:25 2008
@@ -1,39 +1,42 @@
-/***************************************************************************
- * AccountLoginForm.cs
- *
- * Copyright (C) 2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
-
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.
- */
+//
+// AccountLoginForm.cs
+//
+// Authors:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006 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 Mono.Unix;
using Gtk;
-namespace Last.FM.Gui
+using Lastfm;
+
+namespace Lastfm.Gui
{
public class AccountLoginForm : Gtk.Table
{
+ private Account account;
private Entry username_entry;
private Entry password_entry;
private LinkButton signup_button;
@@ -41,121 +44,93 @@
private bool is_destroyed = false;
private bool save_on_edit = false;
- public AccountLoginForm() : base(2, 2, false)
+ public AccountLoginForm (Account account) : base (2, 2, false)
{
+ this.account = account;
+
BorderWidth = 5;
RowSpacing = 5;
ColumnSpacing = 5;
- Label username_label = new Label(Catalog.GetString("Account Name:"));
+ Label username_label = new Label (Catalog.GetString ("User Name:"));
username_label.Xalign = 1.0f;
- username_label.Show();
+ username_label.Show ();
- username_entry = new Entry();
- username_entry.Show();
+ username_entry = new Entry ();
+ username_entry.Show ();
- Label password_label = new Label(Catalog.GetString("Password:"));
+ Label password_label = new Label (Catalog.GetString ("Password:"));
password_label.Xalign = 1.0f;
- password_label.Show();
+ password_label.Show ();
- password_entry = new Entry();
+ password_entry = new Entry ();
password_entry.Visibility = false;
- password_entry.Show();
+ password_entry.Show ();
- Attach(username_label, 0, 1, 0, 1, AttachOptions.Fill,
+ Attach (username_label, 0, 1, 0, 1, AttachOptions.Fill,
AttachOptions.Shrink, 0, 0);
- Attach(username_entry, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand,
+ Attach (username_entry, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Shrink, 0, 0);
- Attach(password_label, 0, 1, 1, 2, AttachOptions.Fill,
+ Attach (password_label, 0, 1, 1, 2, AttachOptions.Fill,
AttachOptions.Shrink, 0, 0);
- Attach(password_entry, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand,
+ Attach (password_entry, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Shrink, 0, 0);
- Account.LoginRequestFinished += OnAccountLoginRequestFinished;
- }
-
- private bool have_requested_on_shown;
-
- protected override void OnShown()
- {
- base.OnShown();
-
- if(!have_requested_on_shown) {
- have_requested_on_shown = true;
- GLib.Timeout.Add(500, delegate {
- Account.RequestLogin();
- return false;
- });
- }
+ username_entry.Text = account.Username;
+ password_entry.Text = account.Password;
+
+ username_entry.Changed += OnEntryChanged;
+ password_entry.Changed += OnEntryChanged;
}
- protected override void OnDestroyed()
+ protected override void OnDestroyed ()
{
- if(save_on_edit) {
- UpdateLogin();
+ if (save_on_edit) {
+ UpdateLogin ();
}
- base.OnDestroyed();
+ base.OnDestroyed ();
is_destroyed = true;
}
- public void AddSignUpButton()
+ public void AddSignUpButton ()
{
- if(signup_button != null) {
+ if (signup_button != null) {
return;
}
- Resize(3, 2);
- signup_button = new LinkButton("Sign Up for Last.fm");
- signup_button.Clicked += delegate { Account.SignUp(); };
- signup_button.Show();
- Attach(signup_button, 1, 2, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
+ Resize (3, 2);
+ signup_button = new LinkButton ("Sign Up for Last.fm");
+ //signup_button.Clicked += delegate { Account.SignUp (); };
+ signup_button.Show ();
+ Attach (signup_button, 1, 2, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
}
private uint update_login_timeout = 0;
- private void OnEntryChanged(object o, EventArgs args)
+ private void OnEntryChanged (object o, EventArgs args)
{
- if(!save_on_edit || update_login_timeout > 0) {
+ if (!save_on_edit || update_login_timeout > 0) {
return;
}
- update_login_timeout = GLib.Timeout.Add(1000, delegate {
- UpdateLogin();
+ update_login_timeout = GLib.Timeout.Add (1000, delegate {
+ UpdateLogin ();
update_login_timeout = 0;
return false;
});
}
- private void UpdateLogin()
+ private void UpdateLogin ()
{
- Account.Username = username_entry.Text.Trim();
- Account.Password = password_entry.Text.Trim();
- Account.CommitLogin();
+ account.Username = username_entry.Text.Trim ();
+ account.Password = password_entry.Text.Trim ();
+ account.Save ();
}
- private void OnAccountLoginRequestFinished(AccountEventArgs args)
- {
- Application.Invoke(delegate {
- if(is_destroyed) {
- return;
- }
-
- Sensitive = true;
-
- if(args.Success) {
- username_entry.Text = Account.Username;
- password_entry.Text = Account.Password;
- }
-
- username_entry.Changed += OnEntryChanged;
- password_entry.Changed += OnEntryChanged;
- });
- }
-
public bool SaveOnEdit {
get { return save_on_edit; }
set { save_on_edit = value; }
Modified: trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/Badge.cs
==============================================================================
--- /branches/banshee/stable/src/Extras/Last.FM/Last.FM.Gui/Badge.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/Badge.cs Mon Feb 11 22:26:25 2008
@@ -1,80 +1,84 @@
-/***************************************************************************
- * Badge.cs
- *
- * Copyright (C) 2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
-
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.
- */
+//
+// Badge.cs
+//
+// Authors:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006 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 Mono.Unix;
using Gtk;
-namespace Last.FM.Gui
+using Lastfm;
+
+namespace Lastfm.Gui
{
public class Badge : Gtk.EventBox
{
- private static Gdk.Cursor hand_cursor = new Gdk.Cursor(Gdk.CursorType.Hand1);
- private static Gdk.Pixbuf pixbuf = Gdk.Pixbuf.LoadFromResource("badge.png");
- private static Gdk.Pixbuf pixbuf_hover = Gdk.Pixbuf.LoadFromResource("badge-hover.png");
+ private static Gdk.Cursor hand_cursor = new Gdk.Cursor (Gdk.CursorType.Hand1);
+ private static Gdk.Pixbuf pixbuf = Gdk.Pixbuf.LoadFromResource ("badge.png");
+ private static Gdk.Pixbuf pixbuf_hover = Gdk.Pixbuf.LoadFromResource ("badge-hover.png");
+ private Account account;
private Image image;
private bool link = true;
- public Badge() : base()
+ public Badge (Account account) : base ()
{
- image = new Image();
+ this.account = account;
+ image = new Image ();
image.Pixbuf = pixbuf;
image.Xalign = 0.0f;
- image.Show();
- Add(image);
+ image.Show ();
+ Add (image);
}
- protected override bool OnEnterNotifyEvent(Gdk.EventCrossing evnt)
+ protected override bool OnEnterNotifyEvent (Gdk.EventCrossing evnt)
{
- if(link) {
+ if (link) {
GdkWindow.Cursor = hand_cursor;
image.Pixbuf = pixbuf_hover;
}
- return base.OnEnterNotifyEvent(evnt);
+ return base.OnEnterNotifyEvent (evnt);
}
- protected override bool OnLeaveNotifyEvent(Gdk.EventCrossing evnt)
+ protected override bool OnLeaveNotifyEvent (Gdk.EventCrossing evnt)
{
image.Pixbuf = pixbuf;
GdkWindow.Cursor = null;
- return base.OnLeaveNotifyEvent(evnt);
+ return base.OnLeaveNotifyEvent (evnt);
}
- protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt)
+ protected override bool OnButtonReleaseEvent (Gdk.EventButton evnt)
{
- if(evnt.Button == 1) {
- Account.VisitHomePage();
+ if (evnt.Button == 1) {
+ account.VisitHomePage ();
}
- return base.OnButtonReleaseEvent(evnt);
+ return base.OnButtonReleaseEvent (evnt);
}
public bool Link {
Modified: trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/LinkButton.cs
==============================================================================
--- /branches/banshee/stable/src/Extras/Last.FM/Last.FM.Gui/LinkButton.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/LinkButton.cs Mon Feb 11 22:26:25 2008
@@ -1,35 +1,37 @@
-/***************************************************************************
- * LinkButton.cs
- *
- * Copyright (C) 2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
-
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.
- */
+//
+// LinkButton.cs
+//
+// Authors:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006 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 Last.FM.Gui
+using Lastfm;
+
+namespace Lastfm.Gui
{
public class LinkButton : Gtk.Button
{
Modified: trunk/banshee/src/Libraries/Lastfm/Lastfm/Account.cs
==============================================================================
--- /branches/banshee/stable/src/Extras/Last.FM/Last.FM/Account.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm/Lastfm/Account.cs Mon Feb 11 22:26:25 2008
@@ -1,202 +1,76 @@
-/***************************************************************************
- * Account.cs
- *
- * Copyright (C) 2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
-
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.
- */
+//
+// Account.cs
+//
+// Authors:
+// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
+//
+// Copyright (C) 2006-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 System.Collections;
using System.Text;
using System.Security.Cryptography;
-using Gnome.Keyring;
-
-namespace Last.FM
+namespace Lastfm
{
- public delegate void AccountEventHandler(AccountEventArgs args);
-
- public class AccountEventArgs : EventArgs
- {
- private Exception exception;
-
- public bool Success {
- get { return exception == null; }
- }
-
- public Exception Exception {
- get { return exception; }
- internal set { exception = value; }
- }
- }
-
- public static class Account
+ public abstract class Account
{
- private const string keyring_item_name = "Last.fm Account";
- private static Hashtable request_attributes = new Hashtable();
-
- private static string username;
- private static string password;
-
- public static event AccountEventHandler LoginRequestFinished;
- public static event AccountEventHandler LoginCommitFinished;
-
- static Account()
- {
- request_attributes["name"] = keyring_item_name;
+ private string username;
+ public string Username {
+ get { return username; }
+ set { username = value; }
}
-
- public static void RequestLoginSync()
- {
- try {
- Ring.Unlock (Ring.GetDefaultKeyring ());
- } catch {}
-
- foreach(ItemData result in Ring.Find(ItemType.NetworkPassword, request_attributes)) {
- if(result.Attributes["name"] as string != keyring_item_name) {
- continue;
- }
-
- username = ((string)result.Attributes["user"]).Trim();
- password = result.Secret.Trim();
-
- return;
- }
- throw new ApplicationException("Last.fm account information not found in default keyring");
+ private string password;
+ public string Password {
+ get { return password; }
+ set { password = value; }
}
- public static void CommitLoginSync()
- {
- try {
- Ring.Unlock (Ring.GetDefaultKeyring ());
- } catch {}
-
- Hashtable update_request_attributes = request_attributes.Clone() as Hashtable;
- update_request_attributes["user"] = username;
-
- ItemData [] items = null;
- try {
- items = Ring.Find(ItemType.NetworkPassword, request_attributes);
- } catch {}
-
- string keyring = Ring.GetDefaultKeyring();
- if (items == null || items.Length == 0) {
- Ring.CreateItem(keyring, ItemType.NetworkPassword, keyring_item_name,
- update_request_attributes, password, true);
- } else {
- Ring.SetItemInfo(keyring, items[0].ItemID, ItemType.NetworkPassword,
- keyring_item_name, password);
- Ring.SetItemAttributes(keyring, items[0].ItemID, update_request_attributes);
- }
- }
-
- private static void RequestLoginAsync(AccountEventArgs args)
- {
- try {
- RequestLoginSync();
- } catch(Exception e) {
- args.Exception = e;
- }
-
- AccountEventHandler handler = LoginRequestFinished;
- if(handler != null) {
- handler(args);
- }
- }
-
- private static void CommitLoginAsync(AccountEventArgs args)
- {
- try {
- CommitLoginSync();
- } catch(Exception e) {
- args.Exception = e;
- }
-
- AccountEventHandler handler = LoginCommitFinished;
- if(handler != null) {
- handler(args);
- }
+ public string Md5Password {
+ get { return password == null ? null : Md5Encode (password); }
+ set { password = value; }
}
- public static void RequestLogin()
- {
- AccountEventHandler handler = new AccountEventHandler(RequestLoginAsync);
- handler.BeginInvoke(new AccountEventArgs(), null, null);
- }
-
- public static void CommitLogin()
- {
- AccountEventHandler handler = new AccountEventHandler(CommitLoginAsync);
- handler.BeginInvoke(new AccountEventArgs(), null, null);
- }
-
- public static void CommitLogin(string username, string password)
- {
- Username = username;
- Password = password;
- CommitLogin();
- }
-
- public static void SignUp()
- {
- Browser.Open("http://www.last.fm/join");
- }
-
- public static void VisitUserProfile(string username)
+ public void SignUp ()
{
- Browser.Open(String.Format("http://last.fm/user/{0}", username));
+ //Browser.Open ("http://www.last.fm/join");
}
- public static void VisitUserProfile()
+ public void VisitUserProfile (string username)
{
- VisitUserProfile(Username);
+ //Browser.Open (String.Format ("http://last.fm/user/{0}", username));
}
- public static void VisitHomePage()
+ public void VisitHomePage ()
{
- Browser.Open("http://last.fm/");
- }
-
- public static string Username {
- get { return username; }
- set { username = value; }
+ //Browser.Open ("http://last.fm/");
}
- public static string Password {
- get { return password; }
- set { password = value; }
- }
-
- public static string Md5Password {
- get { return password == null ? null : Md5Encode (password); }
- set { password = value; }
- }
-
public static string Md5Encode (string text)
{
- if(text == null || text == String.Empty)
+ if (text == null || text == String.Empty)
return String.Empty;
MD5 md5 = MD5.Create ();
@@ -209,6 +83,8 @@
return shash.ToString ();
}
+
+ public abstract void Save ();
}
}
Modified: trunk/banshee/src/Libraries/Lastfm/Lastfm/Browser.cs
==============================================================================
--- /branches/banshee/stable/src/Extras/Last.FM/Last.FM/Browser.cs (original)
+++ trunk/banshee/src/Libraries/Lastfm/Lastfm/Browser.cs Mon Feb 11 22:26:25 2008
@@ -1,36 +1,36 @@
-/***************************************************************************
- * Browser.cs
- *
- * Copyright (C) 2006 Novell, Inc.
- * Written by Aaron Bockover <aaron abock org>
- ****************************************************************************/
-
-/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
- *
- * 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.
- */
+//
+// Browser.cs
+//
+// Authors:
+// Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2006 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;
-namespace Last.FM
+namespace Lastfm
{
- public delegate bool UriOpenHandler(string uri);
+ /*public delegate bool UriOpenHandler (string uri);
public static class Browser
{
@@ -38,14 +38,15 @@
public static UriOpenHandler Open {
get {
- if(open_handler == null) {
- open_handler = new UriOpenHandler(Gnome.Url.Show);
+ if (open_handler == null) {
+ open_handler = new UriOpenHandler (Gnome.Url.Show);
}
return open_handler;
}
set { open_handler = value; }
- }
+ }
}
+ */
}
Modified: trunk/banshee/src/Libraries/Lastfm/Makefile.am
==============================================================================
--- /branches/banshee/stable/src/Extras/Last.FM/Makefile.am (original)
+++ trunk/banshee/src/Libraries/Lastfm/Makefile.am Mon Feb 11 22:26:25 2008
@@ -1,37 +1,10 @@
-include $(top_srcdir)/build/Common.Makefile
+ASSEMBLY = Lastfm
+TARGET = library
+LINK = $(REF_LASTFM)
+
+SOURCES = \
+ Lastfm/Account.cs \
+ Lastfm/Browser.cs
-ASSEMBLY_NAME = Last.FM
-ASSEMBLY = $(ASSEMBLY_NAME).dll
-
-last_fmdir= $(pkglibdir)
-last_fm_SCRIPTS = $(ASSEMBLY) $(ASSEMBLY).mdb
-
-LAST_FM_SOURCES = \
- $(srcdir)/Last.FM/Account.cs \
- $(srcdir)/Last.FM/Browser.cs
-
-LAST_FM_GUI_SOURCES = \
- $(srcdir)/Last.FM.Gui/AccountLoginForm.cs \
- $(srcdir)/Last.FM.Gui/AccountLoginDialog.cs \
- $(srcdir)/Last.FM.Gui/Badge.cs \
- $(srcdir)/Last.FM.Gui/LinkButton.cs
-
-ASSEMBLY_SOURCES = \
- $(LAST_FM_SOURCES) \
- $(LAST_FM_GUI_SOURCES)
-
-$(ASSEMBLY): $(ASSEMBLY_SOURCES) $(srcdir)/badge.png $(srcdir)/badge-hover.png
- $(BUILD_LIB) -out:$@ $(LINK_MONO_UNIX) $(LINK_GNOME_KEYRING) $(LINK_GTK) -resource:$(srcdir)/badge.png,badge.png -resource:$(srcdir)/badge-hover.png,badge-hover.png $(ASSEMBLY_SOURCES)
-
-EXTRA_DIST = $(ASSEMBLY_SOURCES) badge.png badge-hover.png
-
-CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
-DISTCLEANFILES = *.pidb
-MAINTAINERCLEANFILES = Makefile.in
-
-run: test
- mono last-fm-test.exe
-
-test: $(ASSEMBLY_SOURCES) Test.cs
- mcs ../Gnome.Keyring/*.cs $(ASSEMBLY_SOURCES) Test.cs -out:last-fm-test.exe -resource:badge.png,badge.png -resource:badge-hover.png,badge-hover.png -pkg:gtk-sharp-2.0 -r:Mono.Posix -pkg:gnome-sharp-2.0
+include $(top_srcdir)/build/build.mk
Added: trunk/banshee/src/Libraries/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/banshee/src/Libraries/Makefile.am Mon Feb 11 22:26:25 2008
@@ -0,0 +1,6 @@
+SUBDIRS = \
+ Lastfm \
+ Lastfm.Gui
+
+MAINTAINERCLEANFILES = \
+ Makefile.in
Modified: trunk/banshee/src/Makefile.am
==============================================================================
--- trunk/banshee/src/Makefile.am (original)
+++ trunk/banshee/src/Makefile.am Mon Feb 11 22:26:25 2008
@@ -1,4 +1,5 @@
SUBDIRS = \
+ Libraries \
Core \
Dap \
Backends \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]