~ps-jenkins/indicator-transfer/ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to src/transfer-mock.cpp

  • Committer: Charles Kerr
  • Date: 2014-06-17 01:36:16 UTC
  • mto: This revision was merged to the branch mainline in revision 2.
  • Revision ID: charles.kerr@canonical.com-20140617013616-7fcd22wh3hbgaovh
code drop

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2014 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU General Public License version 3, as published
6
 
 * by the Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
10
 
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
 
 * PURPOSE.  See the GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License along
14
 
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 *
16
 
 * Authors:
17
 
 *   Charles Kerr <charles.kerr@canonical.com>
18
 
 */
19
 
 
20
 
#include <transfer/transfer-mock.h>
21
 
 
22
 
#include <gio/gio.h>
23
 
 
24
 
namespace unity {
25
 
namespace indicator {
26
 
namespace transfer {
27
 
 
28
 
/***
29
 
****
30
 
***/
31
 
 
32
 
MockTransfer::MockTransfer(const Id& id, const std::string& icon_filename):
33
 
    m_id(id),
34
 
    m_icon_filename(icon_filename)
35
 
{
36
 
}
37
 
 
38
 
MockTransfer::~MockTransfer()
39
 
{
40
 
}
41
 
 
42
 
void
43
 
MockTransfer::pause()
44
 
{
45
 
    m_state.set(PAUSED);
46
 
    m_history.push_back(Pause);
47
 
}
48
 
 
49
 
void
50
 
MockTransfer::resume()
51
 
{
52
 
    m_state.set(RUNNING);
53
 
    m_history.push_back(Resume);
54
 
}
55
 
 
56
 
void
57
 
MockTransfer::cancel()
58
 
{
59
 
    m_state.set(CANCELING);
60
 
    m_history.push_back(Cancel);
61
 
}
62
 
 
63
 
void
64
 
MockTransfer::clear()
65
 
{
66
 
    m_history.push_back(Clear);
67
 
}
68
 
 
69
 
void
70
 
MockTransfer::open()
71
 
{
72
 
    g_warn_if_fail(state().get() == DONE);
73
 
    m_history.push_back(Open);
74
 
}
75
 
 
76
 
GIcon*
77
 
MockTransfer::icon() const
78
 
{
79
 
    auto file = g_file_new_for_path(m_icon_filename.c_str());
80
 
    auto icon = g_file_icon_new (file);
81
 
    g_object_unref(file);
82
 
    return icon;
83
 
}
84
 
 
85
 
/***
86
 
****
87
 
***/
88
 
 
89
 
} // namespace transfer
90
 
} // namespace indicator
91
 
} // namespace unity