~kelemeng/banshee/bug743928

« back to all changes in this revision

Viewing changes to src/Extensions/Banshee.UbuntuOneMusicStore/Banshee.UbuntuOneMusicStore/UbuntuOneMusicStoreSource.cs

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-02-28 14:06:16 UTC
  • Revision ID: james.westby@ubuntu.com-20110228140616-qkdvtz1ywphu3bbi
Tags: 1.9.4-1ubuntu2
* 0001-Add-support-for-u1ms-links.patch:
  - Handle u1ms:// links in the U1 Music Store (LP: #723960)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
//
4
4
// Authors:
5
5
//   Jo Shields <directhex@apebox.org>
 
6
//   Rodney Dawes <rodney.dawes@canonical.com>
6
7
//
7
8
// Copyright (C) 2010 Jo Shields
 
9
// Copyright (C) 2011 Canonical, Ltd.
8
10
//
9
11
// Permission is hereby granted, free of charge, to any person obtaining
10
12
// a copy of this software and associated documentation files (the
28
30
 
29
31
using Mono.Unix;
30
32
using Gdk;
 
33
using System;
31
34
 
32
35
using Hyena;
33
36
 
51
54
            sort_order, "ubuntu-one-music-store")
52
55
        {
53
56
            Properties.SetString ("Icon.Name", "ubuntuone");
 
57
 
 
58
            // So we can handle u1ms:// URIs
 
59
            ServiceManager.Get<DBusCommandService> ().ArgumentPushed += OnCommandLineArgument;
 
60
        }
 
61
 
 
62
        ~UbuntuOneMusicStoreSource ()
 
63
        {
 
64
            ServiceManager.Get<DBusCommandService> ().ArgumentPushed -= OnCommandLineArgument;
 
65
        }
 
66
 
 
67
        private void OnCommandLineArgument (string uri, object value, bool isFile)
 
68
        {
 
69
            if (!isFile || String.IsNullOrEmpty (uri)) {
 
70
                return;
 
71
            }
 
72
 
 
73
            Log.Debug ("U1MS: URI requested: ", uri);
 
74
            // Handle u1ms:// URIs
 
75
            if (uri.StartsWith ("u1ms://")) {
 
76
                string http_url = uri.Replace ("u1ms://", "http://");
 
77
                custom_view.Store.LoadStoreLink (http_url);
 
78
                ServiceManager.SourceManager.SetActiveSource (this);
 
79
            }
54
80
        }
55
81
 
56
82
        // A count of 0 will be hidden in the source TreeView
127
153
            public void ResetSource () { }
128
154
            public Gtk.Widget Widget { get { return store; } }
129
155
            public ISource Source { get { return null; } }
 
156
            public UbuntuOne.U1MusicStore Store { get { return store; } }
130
157
        }
131
158
    }
132
159
}