~pishuilu1128/unity-china-video-scope/unity-china-video-scope

« back to all changes in this revision

Viewing changes to src/remote-uri.vala

  • Committer: Package Import Robot
  • Author(s): shijing
  • Date: 2013-07-20 17:01:30 UTC
  • Revision ID: package-import@ubuntu.com-20130720170130-ngvubtekpiuzfrls
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by Pawel Stolowski <pawel.stolowski@canonical.com>
 
17
 */
 
18
 
 
19
namespace Unity.VideoLens
 
20
{
 
21
  public class RemoteUri
 
22
  {
 
23
    public string uri { get; set; }
 
24
    public string title { get; set; }
 
25
    public string icon { get; set; }
 
26
    public string details_uri { get; set; }
 
27
 
 
28
 
 
29
    public RemoteUri (string uri, string title, string icon, string details_uri)
 
30
    {
 
31
      this.uri = uri;
 
32
      this.title = title;
 
33
      this.icon = icon;
 
34
      this.details_uri = details_uri;
 
35
 
 
36
    }
 
37
 
 
38
    public static RemoteUri? from_rawuri (string raw_uri)
 
39
    {
 
40
      RemoteUri uri = null;
 
41
      string[] args = raw_uri.split ("lens-meta://", 4);
 
42
      if (args.length == 4)
 
43
      {
 
44
        uri = new RemoteUri (args[0], args[1], args[2], args[3]);
 
45
      }
 
46
      return uri;
 
47
    }
 
48
 
 
49
    public string to_rawuri ()
 
50
    {
 
51
      return string.join ("lens-meta://", uri, title, icon, details_uri);
 
52
    }
 
53
  }
 
54
}