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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
/*
*
* Connection Manager UI
*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <connman-ui-gtk.h>
static GtkIconTheme *icon_theme = NULL;
void cui_theme_get_tethering_icone_and_info(GdkPixbuf **image,
const char **info)
{
if (image != NULL)
*image = gtk_icon_theme_load_icon(icon_theme,
"nm-adhoc", 24, 0, NULL);
if (info != NULL)
*info = _("Tethering");
}
void cui_theme_get_type_icone_and_info(const char *type,
GdkPixbuf **image, const char **info)
{
const char *nfo = NULL;
GdkPixbuf *img = NULL;
if (g_strcmp0(type, "ethernet") == 0) {
img = gtk_icon_theme_load_icon(icon_theme,
"network-wired-symbolic", 22, 0, NULL);
nfo = _("Ethernet");
} else if (g_strcmp0(type, "cellular") == 0) {
img = gtk_icon_theme_load_icon(icon_theme,
"gsm-3g-full", 22, 0, NULL);
nfo = _("Cellular");
}
if (image != NULL)
*image = img;
if (info != NULL)
*info = nfo;
}
void cui_theme_get_signal_icone_and_info(uint8_t signal_strength,
GdkPixbuf **image, const char **info)
{
const char *nfo;
GdkPixbuf *img;
if (signal_strength >= 80) {
img = gtk_icon_theme_load_icon(icon_theme,
"network-wireless-signal-excellent-symbolic", 22, 0, NULL);
nfo = _("Very good signal");
} else if (signal_strength >= 60 && signal_strength < 80) {
img = gtk_icon_theme_load_icon(icon_theme,
"network-wireless-signal-good-symbolic", 22, 0, NULL);
nfo = _("Good signal");
} else if (signal_strength >= 40 && signal_strength < 60) {
img = gtk_icon_theme_load_icon(icon_theme,
"network-wireless-signal-ok-symbolic", 22, 0, NULL);
nfo = _("Low signal");
} else {
img = gtk_icon_theme_load_icon(icon_theme,
"network-wireless-signal-weak-symbolic", 22, 0, NULL);
nfo = _("Very low signal");
}
if (image != NULL)
*image = img;
if (info != NULL)
*info = nfo;
}
void cui_theme_get_state_icone_and_info(enum connman_state state,
GdkPixbuf **image, const char **info)
{
const char *nfo = NULL;
GdkPixbuf *img = NULL;
switch (state) {
case CONNMAN_STATE_UNKNOWN:
img = gtk_icon_theme_load_icon(icon_theme,
"network-offline-symbolic", 24, 0, NULL);
nfo = _("Connman is not running");
break;
case CONNMAN_STATE_READY:
img = gtk_icon_theme_load_icon(icon_theme,
"network-idle-symbolic", 24, 0, NULL);
nfo = _("Connected");
break;
case CONNMAN_STATE_ONLINE:
img = gtk_icon_theme_load_icon(icon_theme,
"network-transmit-receive-symbolic", 24, 0, NULL);
nfo = _("Online");
break;
default:
img = gtk_icon_theme_load_icon(icon_theme,
"network-offline-symbolic", 24, 0, NULL);
nfo = _("Disconnected");
break;
}
if (image != NULL)
*image = img;
if (info != NULL)
*info = nfo;
}
void cui_load_theme(void)
{
icon_theme = gtk_icon_theme_get_default ();
gtk_icon_theme_append_search_path(icon_theme, CUI_ICON_PATH);
}
|