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 "IndicatorObjectEntryProxyRemote.h"
35
IndicatorObjectEntryProxyRemote::IndicatorObjectEntryProxyRemote (DeeModel *model,
41
label_visible = false;
42
label_sensitive = true;
44
icon_sensitive = true;
51
IndicatorObjectEntryProxyRemote::~IndicatorObjectEntryProxyRemote ()
57
IndicatorObjectEntryProxyRemote::GetLabel ()
59
return dee_model_get_string (_model, _iter, COL_LABEL);
63
IndicatorObjectEntryProxyRemote::GetPixbuf ()
65
GdkPixbuf *ret = NULL;
66
guint32 icon_hint = dee_model_get_uint (_model, _iter, COL_ICON_HINT);
68
if (icon_hint == GTK_IMAGE_PIXBUF)
74
decoded = g_base64_decode (dee_model_get_string (_model, _iter, COL_ICON_DATA), &len);
75
stream = g_memory_input_stream_new_from_data (decoded, len, NULL);
77
ret = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
80
g_input_stream_close (stream, NULL, NULL);
82
else if (icon_hint == GTK_IMAGE_STOCK
83
|| icon_hint == GTK_IMAGE_ICON_NAME)
85
ret = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
86
dee_model_get_string (_model, _iter, COL_ICON_DATA),
88
(GtkIconLookupFlags)0,
91
else if (icon_hint == GTK_IMAGE_GICON)
96
icon = g_icon_new_for_string (dee_model_get_string (_model, _iter, COL_ICON_DATA), NULL);
97
info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (),
100
(GtkIconLookupFlags)0);
102
ret = gtk_icon_info_load_icon (info, NULL);
104
gtk_icon_info_free (info);
105
g_object_unref (icon);
112
IndicatorObjectEntryProxyRemote::SetActive (bool active)
114
if (_active == active)
123
IndicatorObjectEntryProxyRemote::GetActive ()
129
IndicatorObjectEntryProxyRemote::Refresh ()
131
label_visible = dee_model_get_bool (_model, _iter, COL_LABEL_VISIBLE);
132
//label_sensitive = dee_model_get_bool (_model, _iter, COL_LABEL_SENSITIVE); FIXME: Re-enable these when the service supports them
133
icon_visible = dee_model_get_bool (_model, _iter, COL_ICON_VISIBLE);
134
//icon_sensitive = dee_model_get_bool (_model, _iter, COL_ICON_SENSITIVE);
140
IndicatorObjectEntryProxyRemote::GetId ()
142
return dee_model_get_string (_model, _iter, COL_ID);
146
IndicatorObjectEntryProxyRemote::ShowMenu (int x, int y, guint32 timestamp)
148
OnShowMenuRequest.emit (dee_model_get_string (_model, _iter, COL_ID), x, y, timestamp);