summaryrefslogtreecommitdiff
path: root/src/librygel-core/rygel-writable-container.vala
blob: 17703d57a1d23e5603a047c3744491bc143f08fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
 * Copyright (C) 2010-2012 Nokia Corporation.
 *
 * Author: Jens Georg <jensg@openismus.com>
 *         Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

using Gee;

/**
 * Interface to be implemented by 'writable' container: ones that allow
 * creation, removal and editing of items directly under them. Currently, only
 * addition and removal is supported.
 *
 * In addition to implementing this interface, a writable container must also:
 *
 * 1. Provide one URI that points to a writable folder on a GIO supported
 * filesystem.
 * 2. Monitor not only it's own URI but also that of it's child items, though
 * the latter is implied in the former if you use GIO for monitoring.
 */
public interface Rygel.WritableContainer : MediaContainer {
    // List of classes that an object in this container could be created of
    public abstract ArrayList<string> create_classes { get; set; }

    /**
     * Check if this container claims to be able to create an item with the
     * given upnp class.
     *
     * @param upnp_class The class of an item to check
     *
     * @return true if it can, false, if not.ยจ
     */
    public bool can_create (string upnp_class) {
        return this.create_classes.contains (upnp_class);
    }

    /**
     * Add a new item directly under this container.
     *
     * This doesn't imply creation of file(s) pointed to by item's URI(s), that
     * is handled for you.
     *
     * @param item The item to add to this container
     * @param cancellable optional cancellable for this operation
     *
     * @return nothing.
     *
     */
    public async abstract void add_item (MediaItem    item,
                                         Cancellable? cancellable) throws Error;

    /**
     * Remove an item directly under this container that has the ID @id.
     *
     * This doesn't imply deletion of file(s) pointed to by item's URI(s), that
     * is handled for you.
     *
     * @param id The ID of the item to remove from this container
     * @param cancellable optional cancellable for this operation
     *
     * @return nothing.
     *
     */
    public async abstract void remove_item (string id, Cancellable? cancellable)
                                            throws Error;
}