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: Neil Jagdish Patel <neil.patel@canonical.com>
19
#include "IndicatorObjectProxyRemote.h"
21
#include "IndicatorObjectEntryProxyRemote.h"
23
IndicatorObjectProxyRemote::IndicatorObjectProxyRemote (const char *name)
28
IndicatorObjectProxyRemote::~IndicatorObjectProxyRemote ()
30
std::vector<IndicatorObjectEntryProxy*>::iterator it;
32
for (it = _entries.begin(); it != _entries.end(); it++)
34
IndicatorObjectEntryProxyRemote *remote = static_cast<IndicatorObjectEntryProxyRemote *> (*it);
38
_entries.erase (_entries.begin (), _entries.end ());
42
IndicatorObjectProxyRemote::GetName ()
47
std::vector<IndicatorObjectEntryProxy *>&
48
IndicatorObjectProxyRemote::GetEntries ()
55
IndicatorObjectProxyRemote::BeginSync ()
57
std::vector<IndicatorObjectEntryProxy*>::iterator it;
59
for (it = _entries.begin(); it != _entries.end(); it++)
61
IndicatorObjectEntryProxyRemote *remote = static_cast<IndicatorObjectEntryProxyRemote *> (*it);
62
remote->_dirty = true;
67
IndicatorObjectProxyRemote::AddEntry (const gchar *entry_id,
72
const gchar *image_data,
76
IndicatorObjectEntryProxyRemote *remote = NULL;
77
std::vector<IndicatorObjectEntryProxy*>::iterator it;
79
for (it = _entries.begin(); it != _entries.end(); it++)
81
IndicatorObjectEntryProxyRemote *r = static_cast<IndicatorObjectEntryProxyRemote *> (*it);
82
if (r->_dirty == true)
89
/* Create a new one */
92
remote = new IndicatorObjectEntryProxyRemote ();
93
remote->OnShowMenuRequest.connect (sigc::mem_fun (this,
94
&IndicatorObjectProxyRemote::OnShowMenuRequestReceived));
95
_entries.push_back (remote);
98
remote->Refresh (entry_id,
107
remote->_dirty = false;
109
OnEntryAdded.emit (remote);
113
IndicatorObjectProxyRemote::EndSync ()
115
std::vector<IndicatorObjectEntryProxy*>::iterator it;
117
for (it = _entries.begin(); it != _entries.end(); it++)
119
IndicatorObjectEntryProxyRemote *remote = static_cast<IndicatorObjectEntryProxyRemote *> (*it);
120
if (remote->_dirty == true)
122
/* We don't get rid of the entries as there's no real need to, and it saves us
123
* having to do a bunch of object creation everytime the menu changes
125
remote->Refresh ("|",
138
IndicatorObjectProxyRemote::OnShowMenuRequestReceived (const char *entry_id,
144
OnShowMenuRequest.emit (entry_id, x, y, timestamp, button);