2
* Copyright (C) 2010 Canonical Ltd
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.
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.
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/>.
16
* Authored by: Jason Smith <jason.smith@canonical.com>
19
#include "LauncherModel.h"
20
#include "LauncherIcon.h"
29
LauncherModel::LauncherModel()
33
LauncherModel::~LauncherModel()
38
LauncherModel::AddIcon (LauncherIcon *icon)
40
icon->SinkReference ();
42
_inner.push_front (icon);
43
icon_added.emit (icon);
45
icon->remove.connect (sigc::mem_fun (this, &LauncherModel::OnIconRemove));
49
LauncherModel::RemoveIcon (LauncherIcon *icon)
51
size_t size = _inner.size ();
54
if (size != _inner.size ())
55
icon_removed.emit (icon);
61
LauncherModel::RemoveCallback (gpointer data)
63
RemoveArg *arg = (RemoveArg*) data;
65
arg->self->RemoveIcon (arg->icon);
72
LauncherModel::OnIconRemove (void *icon_pointer)
74
RemoveArg *arg = (RemoveArg*) g_malloc0 (sizeof (RemoveArg));
75
arg->icon = (LauncherIcon*) icon_pointer;
78
g_timeout_add (1000, &LauncherModel::RemoveCallback, arg);
82
LauncherModel::Sort (SortFunc func)
88
LauncherModel::Size ()
90
return _inner.size ();
93
LauncherModel::iterator
94
LauncherModel::begin ()
96
return _inner.begin ();
99
LauncherModel::iterator
100
LauncherModel::end ()
102
return _inner.end ();
105
LauncherModel::reverse_iterator
106
LauncherModel::rbegin ()
108
return _inner.rbegin ();
111
LauncherModel::reverse_iterator
112
LauncherModel::rend ()
114
return _inner.rend ();