[banshee] [AmazonMp3.Store] Add about, signout menu links
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [AmazonMp3.Store] Add about, signout menu links
- Date: Thu, 26 Aug 2010 18:01:46 +0000 (UTC)
commit a1206887ebe8407c5a9587fdd7dac73271c8ee8c
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Aug 26 12:53:27 2010 -0500
[AmazonMp3.Store] Add about, signout menu links
Remove the Sign-out button, making it a dropdown link instead. And
instead of just clearing the cookies, go to Amazon's signout page so the
session is actually invalidated. The 'How Your Purchases Support GNOME'
link goes to a banshee.fm page explaining where our affiliate revenue
goes (100% to the GNOME Foundation).
po/POTFILES.in | 1 -
.../Banshee.AmazonMp3.Store.csproj | 1 -
.../Banshee.AmazonMp3.Store/SignOutButton.cs | 57 --------------------
.../Banshee.AmazonMp3.Store/StoreView.cs | 19 +++++--
.../StoreWebBrowserShell.cs | 15 +++--
src/Extensions/Banshee.AmazonMp3.Store/Makefile.am | 1 -
.../Banshee.AmazonMp3.Store/server/redirect.c | 33 ++++++++----
7 files changed, 44 insertions(+), 83 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a6df696..a0706bb 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -182,7 +182,6 @@ src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/AmazonMp3DownloaderService.cs
src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/ImportSource.cs
src/Extensions/Banshee.AmazonMp3/Banshee.AmazonMp3/UserJobDownloadManager.cs
-src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/SignOutButton.cs
src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSource.cs
src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreSourcePreferences.cs
src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreWebBrowserShell.cs
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj
index d4bca61..42ff2dd 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store.csproj
@@ -120,6 +120,5 @@
<Compile Include="Banshee.AmazonMp3.Store\StoreView.cs" />
<Compile Include="Banshee.AmazonMp3.Store\StoreWebBrowserShell.cs" />
<Compile Include="Banshee.AmazonMp3.Store\StoreSourcePreferences.cs" />
- <Compile Include="Banshee.AmazonMp3.Store\SignOutButton.cs" />
</ItemGroup>
</Project>
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreView.cs b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreView.cs
index c177d58..c8e1bb7 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreView.cs
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreView.cs
@@ -1,7 +1,7 @@
//
// StoreView.cs
//
-// Author:
+// Authors:
// Aaron Bockover <abockover novell com>
// Gabriel Burt <gburt novell com>
//
@@ -139,24 +139,26 @@ namespace Banshee.AmazonMp3.Store
public override void GoHome ()
{
- LoadUri ("http://integrated-services.banshee.fm/amz/redirect.do/" + Country + "/home/");
+ LoadUri (GetActionUrl ("home/"));
}
public override void GoSearch (string query)
{
- LoadUri (new Uri ("http://integrated-services.banshee.fm/amz/redirect.do/" + Country + "/search/" + query).AbsoluteUri);
+ LoadUri (new Uri (GetActionUrl ("search/" + query)).AbsoluteUri);
}
public void SignOut ()
{
- foreach (var name in new [] { "at-main", "x-main", "session-id",
+ // Shouldn't just clear these cookies; going to Amazon's signout page is more secure,
+ // since it will invalidate the session itself.
+ /*foreach (var name in new [] { "at-main", "x-main", "session-id",
"session-id-time", "session-token", "uidb-main", "pf"}) {
foreach (var domain in domains) {
OssiferSession.DeleteCookie (name, ".amazon." + domain, "/");
}
- }
+ }*/
- FullReload ();
+ LoadUri (GetActionUrl ("sign_out/"));
}
private void CheckSignIn ()
@@ -179,5 +181,10 @@ namespace Banshee.AmazonMp3.Store
handler (this, EventArgs.Empty);
}
}
+
+ public string GetActionUrl (string action)
+ {
+ return "http://integrated-services.banshee.fm/amz/redirect.do/" + Country + "/" + action;
+ }
}
}
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreWebBrowserShell.cs b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreWebBrowserShell.cs
index ad2fc14..b9362be 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreWebBrowserShell.cs
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Banshee.AmazonMp3.Store/StoreWebBrowserShell.cs
@@ -1,8 +1,9 @@
//
// StoreWebBrowserShell.cs
//
-// Author:
+// Authors:
// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
//
// Copyright 2010 Novell, Inc.
//
@@ -39,13 +40,15 @@ namespace Banshee.AmazonMp3.Store
{
StoreView = store_view;
- Attach (new SignOutButton (StoreView) { Relief = ReliefStyle.None }, 2, 3, 0, 1,
- AttachOptions.Shrink,
- AttachOptions.Shrink,
- 0, 0);
-
SearchEntry.EmptyMessage = String.Format (Catalog.GetString ("Search the Amazon MP3 Store"));
+ NavigationControl.AddLink (Catalog.GetString ("How Your Purchases Support GNOME"), StoreView.GetActionUrl ("about/"));
+
+ var signout = NavigationControl.AddLink ("Sign out of Amazon", null);
+ store_view.SignInChanged += (o, a) => signout.Visible = store_view.IsSignedIn;
+ signout.Activated += (o, a) => store_view.SignOut ();
+ signout.Visible = store_view.IsSignedIn;
+
ShowAll ();
}
}
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am b/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am
index b98caa5..0435529 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am
+++ b/src/Extensions/Banshee.AmazonMp3.Store/Makefile.am
@@ -4,7 +4,6 @@ LINK = $(REF_EXTENSION_AMAZONMP3_STORE)
INSTALL_DIR = $(EXTENSIONS_INSTALL_DIR)
SOURCES = \
- Banshee.AmazonMp3.Store/SignOutButton.cs \
Banshee.AmazonMp3.Store/StoreSource.cs \
Banshee.AmazonMp3.Store/StoreSourcePreferences.cs \
Banshee.AmazonMp3.Store/StoreView.cs \
diff --git a/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c b/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c
index 447a971..b196736 100644
--- a/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c
+++ b/src/Extensions/Banshee.AmazonMp3.Store/server/redirect.c
@@ -2,6 +2,7 @@
//
// Authors:
// Aaron Bockover <abockover novell com>
+// Gabriel Burt <gburt novell com>
//
// Copyright 2010 Novell, Inc.
//
@@ -45,7 +46,8 @@ main (gint argc, gchar **argv)
gchar *domain;
gchar *affiliate_code;
gchar *p;
- gchar *dest_url;
+ gchar *dest_url = NULL;
+ gboolean direct_url = FALSE;
country = NULL;
input = NULL;
@@ -96,19 +98,28 @@ main (gint argc, gchar **argv)
affiliate_code = "banshee-20";
}
- if (input == NULL || action == NULL || strcmp (action, "home") == 0) {
- dest_url = g_strdup_printf ("http://www.amazon.%s/mp3/", domain);
- } else if (strcmp (action, "search") == 0) {
+ if (strcmp (action, "search") == 0) {
dest_url = g_strdup_printf ("http://www.amazon.%s/s/ref=nb_sb_noss?url=search-alias%%3Ddigital-music&field-keywords=%s", domain, input);
- } else {
- return 1;
+ } else if (strcmp (action, "sign_out") == 0) {
+ dest_url = g_strdup_printf ("http://www.amazon.%s/gp/help/customer/sign-out.html/ref=ya__lo?ie=UTF8&returnPath=%%2Fmp3", domain);
+ } else if (strcmp (action, "about") == 0) {
+ dest_url = g_strdup ("http://banshee.fm/about/revenue/");
+ direct_url = TRUE;
}
- printf ("Location: http://www.amazon.%s/gp/redirect.html?ie=UTF8&location=%s&tag=%s" "\n\n",
- domain,
- g_uri_escape_string (dest_url, NULL, TRUE),
- affiliate_code
- );
+ if (dest_url == NULL) {
+ dest_url = g_strdup_printf ("http://www.amazon.%s/mp3/", domain);
+ }
+
+ if (direct_url) {
+ printf ("Location: %s" "\n\n", dest_url);
+ } else {
+ printf ("Location: http://www.amazon.%s/gp/redirect.html?ie=UTF8&location=%s&tag=%s" "\n\n",
+ domain,
+ g_uri_escape_string (dest_url, NULL, TRUE),
+ affiliate_code
+ );
+ }
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]