[network-manager-applet/lr/symbolic-icons: 2/2] applet: use symbolic icons instead of our ones
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/lr/symbolic-icons: 2/2] applet: use symbolic icons instead of our ones
- Date: Mon, 25 Oct 2021 07:28:50 +0000 (UTC)
commit b0bf21de6916b3a1cf2ac0e50469a05bbfd57e73
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Oct 21 16:37:57 2021 +0200
applet: use symbolic icons instead of our ones
This reworks the applet icon, so that doesn't look out of place in
modern desktop environments that utilize it, such as Xfce.
It does away with custom icons and the animation in favor of standard
symbolic icons provided by the desktop theme, making things more
consistent and simple along the way.
Makefile.am | 143 --
icons/16/nm-device-wired.png | Bin 473 -> 0 bytes
icons/16/nm-no-connection.png | Bin 601 -> 0 bytes
icons/16/nm-vpn-standalone-lock.png | Bin 595 -> 0 bytes
icons/22/nm-adhoc.png | Bin 748 -> 0 bytes
icons/22/nm-device-wired-secure.png | Bin 945 -> 0 bytes
icons/22/nm-device-wired.png | Bin 672 -> 0 bytes
icons/22/nm-device-wwan.png | Bin 817 -> 0 bytes
icons/22/nm-mb-roam.png | Bin 267 -> 0 bytes
icons/22/nm-no-connection.png | Bin 811 -> 0 bytes
icons/22/nm-secure-lock.png | Bin 335 -> 0 bytes
icons/22/nm-signal-00-secure.png | Bin 775 -> 0 bytes
icons/22/nm-signal-00.png | Bin 494 -> 0 bytes
icons/22/nm-signal-100-secure.png | Bin 688 -> 0 bytes
icons/22/nm-signal-100.png | Bin 413 -> 0 bytes
icons/22/nm-signal-25-secure.png | Bin 779 -> 0 bytes
icons/22/nm-signal-25.png | Bin 500 -> 0 bytes
icons/22/nm-signal-50-secure.png | Bin 770 -> 0 bytes
icons/22/nm-signal-50.png | Bin 496 -> 0 bytes
icons/22/nm-signal-75-secure.png | Bin 747 -> 0 bytes
icons/22/nm-signal-75.png | Bin 474 -> 0 bytes
icons/22/nm-stage01-connecting01.png | Bin 1168 -> 0 bytes
icons/22/nm-stage01-connecting02.png | Bin 1188 -> 0 bytes
icons/22/nm-stage01-connecting03.png | Bin 1206 -> 0 bytes
icons/22/nm-stage01-connecting04.png | Bin 1220 -> 0 bytes
icons/22/nm-stage01-connecting05.png | Bin 1200 -> 0 bytes
icons/22/nm-stage01-connecting06.png | Bin 1144 -> 0 bytes
icons/22/nm-stage01-connecting07.png | Bin 1139 -> 0 bytes
icons/22/nm-stage01-connecting08.png | Bin 1092 -> 0 bytes
icons/22/nm-stage01-connecting09.png | Bin 1157 -> 0 bytes
icons/22/nm-stage01-connecting10.png | Bin 1205 -> 0 bytes
icons/22/nm-stage01-connecting11.png | Bin 1152 -> 0 bytes
icons/22/nm-stage02-connecting01.png | Bin 1190 -> 0 bytes
icons/22/nm-stage02-connecting02.png | Bin 1198 -> 0 bytes
icons/22/nm-stage02-connecting03.png | Bin 1204 -> 0 bytes
icons/22/nm-stage02-connecting04.png | Bin 1258 -> 0 bytes
icons/22/nm-stage02-connecting05.png | Bin 1218 -> 0 bytes
icons/22/nm-stage02-connecting06.png | Bin 1173 -> 0 bytes
icons/22/nm-stage02-connecting07.png | Bin 1156 -> 0 bytes
icons/22/nm-stage02-connecting08.png | Bin 1131 -> 0 bytes
icons/22/nm-stage02-connecting09.png | Bin 1209 -> 0 bytes
icons/22/nm-stage02-connecting10.png | Bin 1229 -> 0 bytes
icons/22/nm-stage02-connecting11.png | Bin 1201 -> 0 bytes
icons/22/nm-stage03-connecting01.png | Bin 1174 -> 0 bytes
icons/22/nm-stage03-connecting02.png | Bin 1214 -> 0 bytes
icons/22/nm-stage03-connecting03.png | Bin 1207 -> 0 bytes
icons/22/nm-stage03-connecting04.png | Bin 1235 -> 0 bytes
icons/22/nm-stage03-connecting05.png | Bin 1204 -> 0 bytes
icons/22/nm-stage03-connecting06.png | Bin 1156 -> 0 bytes
icons/22/nm-stage03-connecting07.png | Bin 1120 -> 0 bytes
icons/22/nm-stage03-connecting08.png | Bin 1102 -> 0 bytes
icons/22/nm-stage03-connecting09.png | Bin 1188 -> 0 bytes
icons/22/nm-stage03-connecting10.png | Bin 1216 -> 0 bytes
icons/22/nm-stage03-connecting11.png | Bin 1185 -> 0 bytes
icons/22/nm-tech-3g.png | Bin 209 -> 0 bytes
icons/22/nm-tech-cdma-1x.png | Bin 212 -> 0 bytes
icons/22/nm-tech-edge.png | Bin 205 -> 0 bytes
icons/22/nm-tech-evdo.png | Bin 215 -> 0 bytes
icons/22/nm-tech-gprs.png | Bin 207 -> 0 bytes
icons/22/nm-tech-hspa.png | Bin 213 -> 0 bytes
icons/22/nm-tech-lte.png | Bin 158 -> 0 bytes
icons/22/nm-tech-umts.png | Bin 196 -> 0 bytes
icons/22/nm-vpn-active-lock.png | Bin 560 -> 0 bytes
icons/22/nm-vpn-connecting01.png | Bin 890 -> 0 bytes
icons/22/nm-vpn-connecting02.png | Bin 981 -> 0 bytes
icons/22/nm-vpn-connecting03.png | Bin 1109 -> 0 bytes
icons/22/nm-vpn-connecting04.png | Bin 1142 -> 0 bytes
icons/22/nm-vpn-connecting05.png | Bin 1286 -> 0 bytes
icons/22/nm-vpn-connecting06.png | Bin 1301 -> 0 bytes
icons/22/nm-vpn-connecting07.png | Bin 1259 -> 0 bytes
icons/22/nm-vpn-connecting08.png | Bin 1046 -> 0 bytes
icons/22/nm-vpn-connecting09.png | Bin 911 -> 0 bytes
icons/22/nm-vpn-connecting10.png | Bin 791 -> 0 bytes
icons/22/nm-vpn-connecting11.png | Bin 554 -> 0 bytes
icons/22/nm-vpn-connecting12.png | Bin 571 -> 0 bytes
icons/22/nm-vpn-connecting13.png | Bin 578 -> 0 bytes
icons/22/nm-vpn-connecting14.png | Bin 575 -> 0 bytes
icons/22/nm-wwan-tower.png | Bin 227 -> 0 bytes
icons/32/nm-device-wired.png | Bin 989 -> 0 bytes
icons/32/nm-no-connection.png | Bin 1143 -> 0 bytes
icons/48/nm-device-wireless.png | Bin 1752 -> 0 bytes
icons/meson.build | 145 --
icons/scalable/nm-device-wired-secure-symbolic.svg | 72 -
icons/scalable/nm-device-wired-symbolic.svg | 74 -
icons/scalable/nm-device-wired.svg | 2466 -------------------
icons/scalable/nm-device-wwan-symbolic.svg | 70 -
icons/scalable/nm-no-connection-symbolic.svg | 1 -
icons/scalable/nm-no-connection.svg | 2588 --------------------
icons/scalable/nm-signal-00-secure-symbolic.svg | 120 -
icons/scalable/nm-signal-00-symbolic.svg | 1 -
icons/scalable/nm-signal-100-secure-symbolic.svg | 109 -
icons/scalable/nm-signal-100-symbolic.svg | 79 -
icons/scalable/nm-signal-25-secure-symbolic.svg | 111 -
icons/scalable/nm-signal-25-symbolic.svg | 1 -
icons/scalable/nm-signal-50-secure-symbolic.svg | 110 -
icons/scalable/nm-signal-50-symbolic.svg | 79 -
icons/scalable/nm-signal-75-secure-symbolic.svg | 109 -
icons/scalable/nm-signal-75-symbolic.svg | 78 -
icons/scalable/nm-vpn-active-lock-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting01-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting02-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting03-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting04-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting05-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting06-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting07-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting08-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting09-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting10-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting11-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting12-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting13-symbolic.svg | 1 -
icons/scalable/nm-vpn-connecting14-symbolic.svg | 1 -
icons/scalable/nm-vpn-standalone-lock-symbolic.svg | 1 -
meson.build | 2 -
src/ap-menu-item.c | 52 +-
src/applet-device-broadband.c | 33 +-
src/applet-device-bt.c | 46 +-
src/applet-device-ethernet.c | 46 +-
src/applet-device-wifi.c | 82 +-
src/applet.c | 704 ++----
src/applet.h | 27 +-
src/connection-editor/meson.build | 1 -
src/connection-editor/page-mobile.c | 4 +-
src/mb-menu-item.c | 17 +-
src/meson.build | 1 -
src/mobile-helpers.c | 176 +-
src/mobile-helpers.h | 21 -
128 files changed, 209 insertions(+), 7375 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index d97d54cc..0e2be745 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -51,147 +51,6 @@ dflt_cppflags = -std=gnu99
###############################################################################
-icon16dir = $(datadir)/icons/hicolor/16x16/apps
-icon16_DATA = \
- icons/16/nm-device-wired.png \
- icons/16/nm-no-connection.png \
- icons/16/nm-vpn-standalone-lock.png \
- $(NULL)
-EXTRA_DIST += $(icon16_DATA)
-
-icon22dir = $(datadir)/icons/hicolor/22x22/apps
-icon22_DATA = \
- icons/22/nm-adhoc.png \
- icons/22/nm-device-wired-secure.png \
- icons/22/nm-device-wired.png \
- icons/22/nm-device-wwan.png \
- icons/22/nm-mb-roam.png \
- icons/22/nm-no-connection.png \
- icons/22/nm-secure-lock.png \
- icons/22/nm-signal-00-secure.png \
- icons/22/nm-signal-00.png \
- icons/22/nm-signal-100-secure.png \
- icons/22/nm-signal-100.png \
- icons/22/nm-signal-25-secure.png \
- icons/22/nm-signal-25.png \
- icons/22/nm-signal-50-secure.png \
- icons/22/nm-signal-50.png \
- icons/22/nm-signal-75-secure.png \
- icons/22/nm-signal-75.png \
- icons/22/nm-stage01-connecting01.png \
- icons/22/nm-stage01-connecting02.png \
- icons/22/nm-stage01-connecting03.png \
- icons/22/nm-stage01-connecting04.png \
- icons/22/nm-stage01-connecting05.png \
- icons/22/nm-stage01-connecting06.png \
- icons/22/nm-stage01-connecting07.png \
- icons/22/nm-stage01-connecting08.png \
- icons/22/nm-stage01-connecting09.png \
- icons/22/nm-stage01-connecting10.png \
- icons/22/nm-stage01-connecting11.png \
- icons/22/nm-stage02-connecting01.png \
- icons/22/nm-stage02-connecting02.png \
- icons/22/nm-stage02-connecting03.png \
- icons/22/nm-stage02-connecting04.png \
- icons/22/nm-stage02-connecting05.png \
- icons/22/nm-stage02-connecting06.png \
- icons/22/nm-stage02-connecting07.png \
- icons/22/nm-stage02-connecting08.png \
- icons/22/nm-stage02-connecting09.png \
- icons/22/nm-stage02-connecting10.png \
- icons/22/nm-stage02-connecting11.png \
- icons/22/nm-stage03-connecting01.png \
- icons/22/nm-stage03-connecting02.png \
- icons/22/nm-stage03-connecting03.png \
- icons/22/nm-stage03-connecting04.png \
- icons/22/nm-stage03-connecting05.png \
- icons/22/nm-stage03-connecting06.png \
- icons/22/nm-stage03-connecting07.png \
- icons/22/nm-stage03-connecting08.png \
- icons/22/nm-stage03-connecting09.png \
- icons/22/nm-stage03-connecting10.png \
- icons/22/nm-stage03-connecting11.png \
- icons/22/nm-tech-3g.png \
- icons/22/nm-tech-cdma-1x.png \
- icons/22/nm-tech-edge.png \
- icons/22/nm-tech-evdo.png \
- icons/22/nm-tech-gprs.png \
- icons/22/nm-tech-hspa.png \
- icons/22/nm-tech-lte.png \
- icons/22/nm-tech-umts.png \
- icons/22/nm-vpn-active-lock.png \
- icons/22/nm-vpn-connecting01.png \
- icons/22/nm-vpn-connecting02.png \
- icons/22/nm-vpn-connecting03.png \
- icons/22/nm-vpn-connecting04.png \
- icons/22/nm-vpn-connecting05.png \
- icons/22/nm-vpn-connecting06.png \
- icons/22/nm-vpn-connecting07.png \
- icons/22/nm-vpn-connecting08.png \
- icons/22/nm-vpn-connecting09.png \
- icons/22/nm-vpn-connecting10.png \
- icons/22/nm-vpn-connecting11.png \
- icons/22/nm-vpn-connecting12.png \
- icons/22/nm-vpn-connecting13.png \
- icons/22/nm-vpn-connecting14.png \
- icons/22/nm-wwan-tower.png \
- $(NULL)
-EXTRA_DIST += $(icon22_DATA)
-
-icon32dir = $(datadir)/icons/hicolor/32x32/apps
-icon32_DATA = \
- icons/32/nm-device-wired.png \
- icons/32/nm-no-connection.png \
- $(NULL)
-EXTRA_DIST += $(icon32_DATA)
-
-icon48dir = $(datadir)/icons/hicolor/48x48/apps
-icon48_DATA = \
- icons/48/nm-device-wireless.png \
- $(NULL)
-EXTRA_DIST += $(icon48_DATA)
-
-iconscalabledir=$(datadir)/icons/hicolor/scalable/apps
-iconscalable_DATA = \
- icons/scalable/nm-device-wired-secure-symbolic.svg \
- icons/scalable/nm-device-wired-symbolic.svg \
- icons/scalable/nm-device-wired.svg \
- icons/scalable/nm-device-wwan-symbolic.svg \
- icons/scalable/nm-no-connection-symbolic.svg \
- icons/scalable/nm-no-connection.svg \
- icons/scalable/nm-signal-00-secure-symbolic.svg \
- icons/scalable/nm-signal-00-symbolic.svg \
- icons/scalable/nm-signal-100-secure-symbolic.svg \
- icons/scalable/nm-signal-100-symbolic.svg \
- icons/scalable/nm-signal-25-secure-symbolic.svg \
- icons/scalable/nm-signal-25-symbolic.svg \
- icons/scalable/nm-signal-50-secure-symbolic.svg \
- icons/scalable/nm-signal-50-symbolic.svg \
- icons/scalable/nm-signal-75-secure-symbolic.svg \
- icons/scalable/nm-signal-75-symbolic.svg \
- icons/scalable/nm-vpn-active-lock-symbolic.svg \
- icons/scalable/nm-vpn-connecting01-symbolic.svg \
- icons/scalable/nm-vpn-connecting02-symbolic.svg \
- icons/scalable/nm-vpn-connecting03-symbolic.svg \
- icons/scalable/nm-vpn-connecting04-symbolic.svg \
- icons/scalable/nm-vpn-connecting05-symbolic.svg \
- icons/scalable/nm-vpn-connecting06-symbolic.svg \
- icons/scalable/nm-vpn-connecting07-symbolic.svg \
- icons/scalable/nm-vpn-connecting08-symbolic.svg \
- icons/scalable/nm-vpn-connecting09-symbolic.svg \
- icons/scalable/nm-vpn-connecting10-symbolic.svg \
- icons/scalable/nm-vpn-connecting11-symbolic.svg \
- icons/scalable/nm-vpn-connecting12-symbolic.svg \
- icons/scalable/nm-vpn-connecting13-symbolic.svg \
- icons/scalable/nm-vpn-connecting14-symbolic.svg \
- icons/scalable/nm-vpn-standalone-lock-symbolic.svg \
- $(NULL)
-EXTRA_DIST += $(iconscalable_DATA)
-
-EXTRA_DIST += icons/meson.build
-
-###############################################################################
-
shared_files = \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-shared-utils.h \
@@ -360,7 +219,6 @@ nodist_src_connection_editor_nm_connection_editor_SOURCES = \
src_connection_editor_nm_connection_editor_CPPFLAGS = \
$(dflt_cppflags) \
- -DICONDIR=\""$(datadir)/icons"\" \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBDIR=\""$(libdir)"\" \
@@ -486,7 +344,6 @@ nodist_src_nm_applet_SOURCES = \
src_nm_applet_CPPFLAGS = \
$(dflt_cppflags) \
- -DICONDIR=\""$(datadir)/icons"\" \
-DBINDIR=\""$(bindir)"\" \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\" \
diff --git a/meson.build b/meson.build
index 6af3879c..5d4890b4 100644
--- a/meson.build
+++ b/meson.build
@@ -32,7 +32,6 @@ nma_sysconfdir = join_paths(nma_prefix, get_option('sysconfdir'))
nma_appdir = join_paths(nma_datadir, 'applications')
nma_autostartdir = join_paths(nma_sysconfdir, 'xdg', 'autostart')
-nma_icondir = join_paths(nma_datadir, 'icons')
soversion = 0
current = 0
@@ -234,7 +233,6 @@ po_dir = join_paths(meson.source_root(), 'po')
top_inc = include_directories('.')
subdir('po')
-subdir('icons')
subdir('shared')
subdir('src')
subdir('man')
diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c
index 1da010fa..93a25718 100644
--- a/src/ap-menu-item.c
+++ b/src/ap-menu-item.c
@@ -24,6 +24,7 @@ G_DEFINE_TYPE (NMNetworkMenuItem, nm_network_menu_item, GTK_TYPE_MENU_ITEM);
typedef struct {
GtkWidget * ssid;
+ GtkWidget * security;
GtkWidget * strength;
GtkWidget * hbox;
@@ -82,52 +83,21 @@ update_icon (NMNetworkMenuItem *item, NMApplet *applet)
{
NMNetworkMenuItemPrivate *priv = NM_NETWORK_MENU_ITEM_GET_PRIVATE (item);
gs_unref_object GdkPixbuf *icon_free = NULL, *icon_free2 = NULL;
- GdkPixbuf *icon;
- int icon_size, scale;
const char *icon_name = NULL;
if (priv->is_adhoc)
- icon_name = "nm-adhoc";
+ icon_name = "network-wireless-hotspot-symbolic";
else
icon_name = mobile_helper_get_quality_icon_name (priv->int_strength);
- scale = gtk_widget_get_scale_factor (GTK_WIDGET (item));
- icon_size = 24;
- if (INDICATOR_ENABLED (applet)) {
- /* Since app_indicator relies on GdkPixbuf, we should not scale it */
- } else
- icon_size *= scale;
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->strength),
+ icon_name,
+ GTK_ICON_SIZE_MENU);
- icon = nma_icon_check_and_load (icon_name, applet);
- if (icon) {
- if (priv->is_encrypted) {
- GdkPixbuf *encrypted = nma_icon_check_and_load ("nm-secure-lock", applet);
-
- if (encrypted) {
- icon = icon_free = gdk_pixbuf_copy (icon);
-
- gdk_pixbuf_composite (encrypted, icon, 0, 0,
- gdk_pixbuf_get_width (encrypted),
- gdk_pixbuf_get_height (encrypted),
- 0, 0, 1.0, 1.0,
- GDK_INTERP_NEAREST, 255);
- }
- }
-
- /* Scale to menu size if larger so the menu doesn't look awful */
- if (gdk_pixbuf_get_height (icon) > icon_size || gdk_pixbuf_get_width (icon) > icon_size)
- icon = icon_free2 = gdk_pixbuf_scale_simple (icon, icon_size, icon_size,
GDK_INTERP_BILINEAR);
- }
-
- if (INDICATOR_ENABLED (applet)) {
- /* app_indicator only uses GdkPixbuf */
- gtk_image_set_from_pixbuf (GTK_IMAGE (priv->strength), icon);
- } else {
- cairo_surface_t *surface;
-
- surface = gdk_cairo_surface_create_from_pixbuf (icon, scale, NULL);
- gtk_image_set_from_surface (GTK_IMAGE (priv->strength), surface);
- cairo_surface_destroy (surface);
+ if (priv->is_encrypted) {
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->security),
+ "network-wireless-encrypted-symbolic",
+ GTK_ICON_SIZE_MENU);
}
}
@@ -318,6 +288,10 @@ nm_network_menu_item_init (NMNetworkMenuItem *item)
gtk_box_pack_end (GTK_BOX (priv->hbox), priv->strength, FALSE, TRUE, 0);
gtk_widget_show (priv->strength);
+ priv->security = gtk_image_new ();
+ gtk_box_pack_end (GTK_BOX (priv->hbox), priv->security, FALSE, TRUE, 0);
+ gtk_widget_show (priv->security);
+
gtk_widget_show (priv->ssid);
gtk_widget_show (priv->hbox);
}
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index 9c47318a..437c21b8 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -606,43 +606,24 @@ broadband_act_to_mb_act (BroadbandDeviceInfo *info)
return MB_TECH_UNKNOWN;
}
-static void
-get_icon (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection,
- GdkPixbuf **out_pixbuf,
- const char **out_icon_name,
- char **tip,
- NMApplet *applet)
+static guint8
+get_signal_strength (NMDevice *device, NMApplet *applet)
{
BroadbandDeviceInfo *info;
- g_return_if_fail (out_icon_name && !*out_icon_name);
- g_return_if_fail (tip && !*tip);
-
if (!applet->mm1) {
g_warning ("ModemManager is not available for modem at %s", nm_device_get_udi (device));
- return;
+ return 0;
}
info = g_object_get_data (G_OBJECT (device), BROADBAND_INFO_TAG);
if (!info) {
g_warning ("ModemManager is not available for modem at %s",
nm_device_get_udi (device));
- return;
+ return 0;
}
- mobile_helper_get_icon (device,
- state,
- connection,
- out_pixbuf,
- out_icon_name,
- tip,
- applet,
- broadband_state_to_mb_state (info),
- broadband_act_to_mb_act (info),
- mm_modem_get_signal_quality (info->mm_modem, NULL),
- (mm_modem_get_state (info->mm_modem) >= MM_MODEM_STATE_ENABLED));
+ return mm_modem_get_signal_quality (info->mm_modem, NULL);
}
/********************************************************************/
@@ -808,7 +789,7 @@ notify_connected (NMDevice *device,
applet_do_notify_with_pref (applet,
_("Connection Established"),
msg ? msg : _("You are now connected to the Mobile Broadband network."),
- "nm-device-wwan",
+ "network-cellular-connected-symbolic",
PREF_DISABLE_CONNECTED_NOTIFICATIONS);
}
@@ -1074,7 +1055,7 @@ applet_device_broadband_get_class (NMApplet *applet)
dclass->add_menu_item = add_menu_item;
dclass->device_added = device_added;
dclass->notify_connected = notify_connected;
- dclass->get_icon = get_icon;
+ dclass->get_signal_strength = get_signal_strength;
dclass->get_secrets = get_secrets;
dclass->secrets_request_size = sizeof (MobileHelperSecretsInfo);
diff --git a/src/applet-device-bt.c b/src/applet-device-bt.c
index a78f1068..edffee87 100644
--- a/src/applet-device-bt.c
+++ b/src/applet-device-bt.c
@@ -74,53 +74,10 @@ bt_notify_connected (NMDevice *device,
applet_do_notify_with_pref (applet,
_("Connection Established"),
msg ? msg : _("You are now connected to the mobile broadband network."),
- "nm-device-wwan",
+ "network-cellular-connected-symbolic",
PREF_DISABLE_CONNECTED_NOTIFICATIONS);
}
-static void
-bt_get_icon (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection,
- GdkPixbuf **out_pixbuf,
- const char **out_icon_name,
- char **tip,
- NMApplet *applet)
-{
- NMSettingConnection *s_con;
- const char *id;
-
- g_return_if_fail (out_icon_name && !*out_icon_name);
- g_return_if_fail (tip && !*tip);
-
- id = nm_device_get_iface (NM_DEVICE (device));
- if (connection) {
- s_con = nm_connection_get_setting_connection (connection);
- id = nm_setting_connection_get_id (s_con);
- }
-
- switch (state) {
- case NM_DEVICE_STATE_PREPARE:
- *tip = g_strdup_printf (_("Preparing mobile broadband connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_CONFIG:
- *tip = g_strdup_printf (_("Configuring mobile broadband connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- *tip = g_strdup_printf (_("User authentication required for mobile broadband connection
“%s”…"), id);
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- *tip = g_strdup_printf (_("Requesting a network address for “%s”…"), id);
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- *out_icon_name = "nm-device-wwan";
- *tip = g_strdup_printf (_("Mobile broadband connection “%s” active"), id);
- break;
- default:
- break;
- }
-}
-
typedef struct {
SecretsRequest req;
GtkWidget *dialog;
@@ -247,7 +204,6 @@ applet_device_bt_get_class (NMApplet *applet)
dclass->new_auto_connection = bt_new_auto_connection;
dclass->add_menu_item = bt_add_menu_item;
dclass->notify_connected = bt_notify_connected;
- dclass->get_icon = bt_get_icon;
dclass->get_secrets = bt_get_secrets;
dclass->secrets_request_size = sizeof (NMBtSecretsInfo);
diff --git a/src/applet-device-ethernet.c b/src/applet-device-ethernet.c
index 52f70a1d..8adb47b9 100644
--- a/src/applet-device-ethernet.c
+++ b/src/applet-device-ethernet.c
@@ -123,53 +123,10 @@ ethernet_notify_connected (NMDevice *device,
applet_do_notify_with_pref (applet,
_("Connection Established"),
msg ? msg : _("You are now connected to the ethernet network."),
- "nm-device-wired",
+ "network-wired-symbolic",
PREF_DISABLE_CONNECTED_NOTIFICATIONS);
}
-static void
-ethernet_get_icon (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection,
- GdkPixbuf **out_pixbuf,
- const char **out_icon_name,
- char **tip,
- NMApplet *applet)
-{
- NMSettingConnection *s_con;
- const char *id;
-
- g_return_if_fail (out_icon_name && !*out_icon_name);
- g_return_if_fail (tip && !*tip);
-
- id = nm_device_get_iface (NM_DEVICE (device));
- if (connection) {
- s_con = nm_connection_get_setting_connection (connection);
- id = nm_setting_connection_get_id (s_con);
- }
-
- switch (state) {
- case NM_DEVICE_STATE_PREPARE:
- *tip = g_strdup_printf (_("Preparing ethernet network connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_CONFIG:
- *tip = g_strdup_printf (_("Configuring ethernet network connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- *tip = g_strdup_printf (_("User authentication required for ethernet network connection
“%s”…"), id);
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- *tip = g_strdup_printf (_("Requesting an ethernet network address for “%s”…"), id);
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- *out_icon_name = "nm-device-wired";
- *tip = g_strdup_printf (_("Ethernet network connection “%s” active"), id);
- break;
- default:
- break;
- }
-}
-
/* PPPoE */
typedef struct {
@@ -494,7 +451,6 @@ applet_device_ethernet_get_class (NMApplet *applet)
dclass->new_auto_connection = ethernet_new_auto_connection;
dclass->add_menu_item = ethernet_add_menu_item;
dclass->notify_connected = ethernet_notify_connected;
- dclass->get_icon = ethernet_get_icon;
dclass->get_secrets = ethernet_get_secrets;
dclass->secrets_request_size = MAX (sizeof (NM8021xInfo), sizeof (NMPppoeInfo));
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 8419bc43..459da1f3 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1110,7 +1110,7 @@ idle_check_avail_access_point_notification (gpointer datap)
NOTIFY_URGENCY_LOW,
_("Wi-Fi Networks Available"),
_("Use the network menu to connect to a Wi-Fi network"),
- "nm-device-wireless",
+ "network-wireless-symbolic",
"dont-show",
_("Don’t show this message again"),
wifi_available_dont_show_cb,
@@ -1274,6 +1274,21 @@ wifi_device_state_changed (NMDevice *device,
queue_avail_access_point_notification (device);
}
+static const char *
+wifi_quality_icon_name (guint32 quality)
+{
+ if (quality > 80)
+ return "network-wireless-signal-excellent-symbolic";
+ else if (quality > 55)
+ return "network-wireless-signal-good-symbolic";
+ else if (quality > 30)
+ return "network-wireless-signal-ok-symbolic";
+ else if (quality > 5)
+ return "network-wireless-signal-weak-symbolic";
+ else
+ return "network-wireless-signal-none-symbolic";
+}
+
static void
wifi_notify_connected (NMDevice *device,
const char *msg,
@@ -1288,10 +1303,12 @@ wifi_notify_connected (NMDevice *device,
esc_ssid = get_ssid_utf8 (ap);
+ nm_access_point_get_strength (ap);
+
if (!ap)
- signal_strength_icon = "nm-device-wireless";
+ signal_strength_icon = "network-wireless-symbolic";
else
- signal_strength_icon = mobile_helper_get_quality_icon_name (nm_access_point_get_strength
(ap));
+ signal_strength_icon = wifi_quality_icon_name (nm_access_point_get_strength (ap));
ssid_msg = g_strdup_printf (_("You are now connected to the Wi-Fi network “%s”."), esc_ssid);
applet_do_notify_with_pref (applet, _("Connection Established"),
@@ -1301,65 +1318,18 @@ wifi_notify_connected (NMDevice *device,
g_free (esc_ssid);
}
-static void
-wifi_get_icon (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection,
- GdkPixbuf **out_pixbuf,
- const char **out_icon_name,
- char **tip,
- NMApplet *applet)
+static guint8
+wifi_get_signal_strength (NMDevice *device, NMApplet *applet)
{
- NMSettingConnection *s_con;
NMAccessPoint *ap;
- const char *id;
- guint8 strength;
-
- g_return_if_fail (out_icon_name && !*out_icon_name);
- g_return_if_fail (tip && !*tip);
ap = _active_ap_get (applet, device);
+ if (!ap)
+ return 0;
- id = nm_device_get_iface (device);
- if (connection) {
- s_con = nm_connection_get_setting_connection (connection);
- id = nm_setting_connection_get_id (s_con);
- }
-
- switch (state) {
- case NM_DEVICE_STATE_PREPARE:
- *tip = g_strdup_printf (_("Preparing Wi-Fi network connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_CONFIG:
- *tip = g_strdup_printf (_("Configuring Wi-Fi network connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- *tip = g_strdup_printf (_("User authentication required for Wi-Fi network “%s”…"), id);
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- *tip = g_strdup_printf (_("Requesting a Wi-Fi network address for “%s”…"), id);
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- strength = ap ? nm_access_point_get_strength (ap) : 0;
- strength = MIN (strength, 100);
-
- *out_icon_name = mobile_helper_get_quality_icon_name (strength);
-
- if (ap) {
- char *ssid = get_ssid_utf8 (ap);
-
- *tip = g_strdup_printf (_("Wi-Fi network connection “%s” active: %s (%d%%)"),
- id, ssid, strength);
- g_free (ssid);
- } else
- *tip = g_strdup_printf (_("Wi-Fi network connection “%s” active"), id);
- break;
- default:
- break;
- }
+ return nm_access_point_get_strength (ap);
}
-
static void
activate_existing_cb (GObject *client,
GAsyncResult *result,
@@ -1665,7 +1635,7 @@ applet_device_wifi_get_class (NMApplet *applet)
dclass->device_added = wifi_device_added;
dclass->device_state_changed = wifi_device_state_changed;
dclass->notify_connected = wifi_notify_connected;
- dclass->get_icon = wifi_get_icon;
+ dclass->get_signal_strength = wifi_get_signal_strength;
dclass->get_secrets = wifi_get_secrets;
dclass->secrets_request_size = sizeof (NMWifiInfo);
diff --git a/src/applet.c b/src/applet.c
index ab787b9c..5e1b4426 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -174,75 +174,6 @@ get_device_class_from_connection (NMConnection *connection, NMApplet *applet)
return NULL;
}
-static NMActiveConnection *
-applet_get_best_activating_connection (NMApplet *applet, NMDevice **device)
-{
- NMActiveConnection *best = NULL;
- NMDevice *best_dev = NULL;
- const GPtrArray *connections;
- int i;
-
- g_return_val_if_fail (NM_IS_APPLET (applet), NULL);
- g_return_val_if_fail (device != NULL, NULL);
- g_return_val_if_fail (*device == NULL, NULL);
-
- connections = nm_client_get_active_connections (applet->nm_client);
- for (i = 0; connections && (i < connections->len); i++) {
- NMActiveConnection *candidate = g_ptr_array_index (connections, i);
- const GPtrArray *devices;
- NMDevice *candidate_dev;
-
- if (nm_active_connection_get_state (candidate) != NM_ACTIVE_CONNECTION_STATE_ACTIVATING)
- continue;
-
- devices = nm_active_connection_get_devices (candidate);
- if (!devices || !devices->len)
- continue;
-
- candidate_dev = g_ptr_array_index (devices, 0);
- if (!get_device_class (candidate_dev, applet))
- continue;
-
- if (!best_dev) {
- best_dev = candidate_dev;
- best = candidate;
- continue;
- }
-
- if (NM_IS_DEVICE_WIFI (best_dev)) {
- if (NM_IS_DEVICE_ETHERNET (candidate_dev)) {
- best_dev = candidate_dev;
- best = candidate;
- }
- } else if (NM_IS_DEVICE_MODEM (best_dev)) {
- NMDeviceModemCapabilities best_caps;
- NMDeviceModemCapabilities candidate_caps = NM_DEVICE_MODEM_CAPABILITY_NONE;
-
- best_caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (best_dev));
- if (NM_IS_DEVICE_MODEM (candidate_dev))
- candidate_caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM
(candidate_dev));
-
- if (best_caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) {
- if ( NM_IS_DEVICE_ETHERNET (candidate_dev)
- || NM_IS_DEVICE_WIFI (candidate_dev)) {
- best_dev = candidate_dev;
- best = candidate;
- }
- } else if (best_caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) {
- if ( NM_IS_DEVICE_ETHERNET (candidate_dev)
- || NM_IS_DEVICE_WIFI (candidate_dev)
- || (candidate_caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
- best_dev = candidate_dev;
- best = candidate;
- }
- }
- }
- }
-
- *device = best_dev;
- return best;
-}
-
static NMActiveConnection *
applet_get_default_active_connection (NMApplet *applet, NMDevice **device,
gboolean only_known_devices)
@@ -829,51 +760,6 @@ void applet_do_notify_with_pref (NMApplet *applet,
applet);
}
-static gboolean
-animation_timeout (gpointer data)
-{
- applet_schedule_update_icon (NM_APPLET (data));
- return TRUE;
-}
-
-static void
-start_animation_timeout (NMApplet *applet)
-{
- if (applet->animation_id == 0) {
- applet->animation_step = 0;
- applet->animation_id = g_timeout_add (100, animation_timeout, applet);
- }
-}
-
-static void
-clear_animation_timeout (NMApplet *applet)
-{
- if (applet->animation_id) {
- g_source_remove (applet->animation_id);
- applet->animation_id = 0;
- applet->animation_step = 0;
- }
-}
-
-static gboolean
-applet_is_any_device_activating (NMApplet *applet)
-{
- const GPtrArray *devices;
- int i;
-
- /* Check for activating devices */
- devices = nm_client_get_devices (applet->nm_client);
- for (i = 0; devices && (i < devices->len); i++) {
- NMDevice *candidate = NM_DEVICE (g_ptr_array_index (devices, i));
- NMDeviceState state;
-
- state = nm_device_get_state (candidate);
- if (state > NM_DEVICE_STATE_DISCONNECTED && state < NM_DEVICE_STATE_ACTIVATED)
- return TRUE;
- }
- return FALSE;
-}
-
static gboolean
connection_is_vpn (NMConnection *connection)
{
@@ -881,26 +767,6 @@ connection_is_vpn (NMConnection *connection)
|| nm_connection_is_type (connection, NM_SETTING_WIREGUARD_SETTING_NAME);
}
-static gboolean
-applet_is_any_vpn_activating (NMApplet *applet)
-{
- const GPtrArray *connections;
- int i;
-
- connections = nm_client_get_active_connections (applet->nm_client);
- for (i = 0; connections && (i < connections->len); i++) {
- NMActiveConnection *candidate = NM_ACTIVE_CONNECTION (g_ptr_array_index (connections, i));
- NMActiveConnectionState state;
-
- if (NM_IS_VPN_CONNECTION (candidate)) {
- state = nm_active_connection_get_state (candidate);
- if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATING)
- return TRUE;
- }
- }
- return FALSE;
-}
-
static char *
make_active_failure_message (NMActiveConnection *active,
NMActiveConnectionStateReason reason,
@@ -954,18 +820,8 @@ vpn_active_connection_state_changed (NMVpnConnection *vpn,
NMApplet *applet = NM_APPLET (user_data);
const char *banner;
char *title = NULL, *msg;
- gboolean device_activating, vpn_activating;
-
- device_activating = applet_is_any_device_activating (applet);
- vpn_activating = applet_is_any_vpn_activating (applet);
switch (state) {
- case NM_ACTIVE_CONNECTION_STATE_ACTIVATING:
- /* Be sure to turn animation timeout on here since the dbus signals
- * for new active connections might not have come through yet.
- */
- vpn_activating = TRUE;
- break;
case NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
banner = nm_vpn_connection_get_banner (vpn);
if (banner && strlen (banner))
@@ -991,11 +847,6 @@ vpn_active_connection_state_changed (NMVpnConnection *vpn,
break;
}
- if (device_activating || vpn_activating)
- start_animation_timeout (applet);
- else
- clear_animation_timeout (applet);
-
applet_schedule_update_icon (applet);
applet_schedule_update_menu (applet);
}
@@ -1019,8 +870,6 @@ activate_vpn_cb (GObject *client,
g_clear_object (&active);
if (error) {
- clear_animation_timeout (info->applet);
-
title = _("VPN Connection Failed");
name = g_dbus_error_get_remote_error (error);
@@ -1089,7 +938,6 @@ nma_menu_vpn_item_clicked (GtkMenuItem *item, gpointer user_data)
NULL,
activate_vpn_cb,
info);
- start_animation_timeout (applet);
}
@@ -1121,74 +969,6 @@ nma_menu_add_vpn_item_activate (GtkMenuItem *item, gpointer user_data)
g_spawn_async (NULL, (gchar **) argv, NULL, 0, NULL, NULL, NULL, NULL);
}
-static NMVpnConnectionState
-ac_state_to_vpn_state (NMActiveConnectionState ac_state)
-{
- switch (ac_state) {
- case NM_ACTIVE_CONNECTION_STATE_UNKNOWN:
- return NM_VPN_CONNECTION_STATE_UNKNOWN;
- case NM_ACTIVE_CONNECTION_STATE_ACTIVATING:
- return NM_VPN_CONNECTION_STATE_PREPARE;
- case NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
- case NM_ACTIVE_CONNECTION_STATE_DEACTIVATING:
- return NM_VPN_CONNECTION_STATE_ACTIVATED;
- case NM_ACTIVE_CONNECTION_STATE_DEACTIVATED:
- return NM_VPN_CONNECTION_STATE_DISCONNECTED;
- }
-
- nm_assert_not_reached ();
- return NM_VPN_CONNECTION_STATE_UNKNOWN;
-}
-
-/*
- * applet_get_active_vpn_connection:
- *
- * Gets a VPN connection along with its state. If there are more, ones that
- * are not yet fully activated are preferred.
- *
- */
-static NMActiveConnection *
-applet_get_active_vpn_connection (NMApplet *applet,
- NMVpnConnectionState *out_state)
-{
- const GPtrArray *active_list;
- NMActiveConnection *ret = NULL;
- NMVpnConnectionState state = NM_VPN_CONNECTION_STATE_UNKNOWN;
- int i;
-
- active_list = nm_client_get_active_connections (applet->nm_client);
- for (i = 0; active_list && (i < active_list->len); i++) {
- NMActiveConnection *candidate;
- NMConnection *connection;
-
- candidate = g_ptr_array_index (active_list, i);
-
- connection = (NMConnection *) nm_active_connection_get_connection (candidate);
- if (!connection)
- continue;
-
- if (!connection_is_vpn (connection))
- continue;
-
- ret = candidate;
- if (nm_connection_is_type (connection, NM_SETTING_VPN_SETTING_NAME)) {
- state = nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (candidate));
- } else {
- NMActiveConnectionState ac_state;
-
- ac_state = nm_active_connection_get_state (candidate);
- state = ac_state_to_vpn_state (ac_state);
- }
- if (state != NM_VPN_CONNECTION_STATE_ACTIVATED)
- break;
- }
-
- if (ret && out_state)
- *out_state = state;
-
- return ret;
-}
-
/*
* nma_menu_add_separator_item
*
@@ -2099,67 +1879,6 @@ applet_schedule_update_menu (NMApplet *applet)
applet->update_menu_id = g_idle_add (applet_update_menu, applet);
}
-/*****************************************************************************/
-
-static void
-foo_set_icon (NMApplet *applet, guint32 layer, GdkPixbuf *pixbuf, const char *icon_name)
-{
- gs_unref_object GdkPixbuf *pixbuf_free = NULL;
-
- g_return_if_fail (layer == ICON_LAYER_LINK || layer == ICON_LAYER_VPN);
-
-#ifdef WITH_APPINDICATOR
- if (INDICATOR_ENABLED (applet)) {
- /* FIXME: We rely on the fact that VPN icon gets drawn later and therefore
- * wins but we cannot currently set a combined pixmap made of both the link
- * icon and the VPN icon.
- */
- if (icon_name == NULL && layer == ICON_LAYER_LINK)
- icon_name = "nm-no-connection";
- if (icon_name != NULL && g_strcmp0 (app_indicator_get_icon (applet->app_indicator),
icon_name) != 0)
- app_indicator_set_icon_full (applet->app_indicator, icon_name, applet->tip);
- return;
- }
-#endif /* WITH_APPINDICATOR */
-
- /* Load the pixbuf by icon name */
- if (icon_name && !pixbuf)
- pixbuf = nma_icon_check_and_load (icon_name, applet);
-
- /* Ignore setting of the same icon as is already displayed */
- if (applet->icon_layers[layer] == pixbuf)
- return;
-
- g_clear_object (&applet->icon_layers[layer]);
-
- if (pixbuf)
- applet->icon_layers[layer] = g_object_ref (pixbuf);
-
- if (applet->icon_layers[0]) {
- int i;
-
- pixbuf = applet->icon_layers[0];
-
- for (i = ICON_LAYER_LINK + 1; i <= ICON_LAYER_MAX; i++) {
- GdkPixbuf *top = applet->icon_layers[i];
-
- if (!top)
- continue;
-
- if (!pixbuf_free)
- pixbuf = pixbuf_free = gdk_pixbuf_copy (pixbuf);
-
- gdk_pixbuf_composite (top, pixbuf, 0, 0, gdk_pixbuf_get_width (top),
- gdk_pixbuf_get_height (top),
- 0, 0, 1.0, 1.0,
- GDK_INTERP_NEAREST, 255);
- }
- } else
- pixbuf = nma_icon_check_and_load ("nm-no-connection", applet);
-
- gtk_status_icon_set_from_pixbuf (applet->status_icon, pixbuf);
-}
-
NMRemoteConnection *
applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet)
{
@@ -2189,43 +1908,6 @@ applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet)
return NULL;
}
-static void
-applet_common_device_state_changed (NMDevice *device,
- NMDeviceState new_state,
- NMDeviceState old_state,
- NMDeviceStateReason reason,
- NMApplet *applet)
-{
- gboolean device_activating = FALSE, vpn_activating = FALSE;
-
- device_activating = applet_is_any_device_activating (applet);
- vpn_activating = applet_is_any_vpn_activating (applet);
-
-
- switch (new_state) {
- case NM_DEVICE_STATE_PREPARE:
- case NM_DEVICE_STATE_CONFIG:
- case NM_DEVICE_STATE_NEED_AUTH:
- case NM_DEVICE_STATE_IP_CONFIG:
- /* Be sure to turn animation timeout on here since the dbus signals
- * for new active connections or devices might not have come through yet.
- */
- device_activating = TRUE;
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- default:
- break;
- }
-
- /* If there's an activating device but we're not animating, start animation.
- * If we're animating, but there's no activating device or VPN, stop animating.
- */
- if (device_activating || vpn_activating)
- start_animation_timeout (applet);
- else
- clear_animation_timeout (applet);
-}
-
static void
foo_device_state_changed_cb (NMDevice *device,
NMDeviceState new_state,
@@ -2241,8 +1923,6 @@ foo_device_state_changed_cb (NMDevice *device,
if (dclass && dclass->device_state_changed)
dclass->device_state_changed (device, new_state, old_state, reason, applet);
- applet_common_device_state_changed (device, new_state, old_state, reason, applet);
-
if ( dclass
&& new_state == NM_DEVICE_STATE_ACTIVATED
&& !g_settings_get_boolean (applet->gsettings, PREF_DISABLE_CONNECTED_NOTIFICATIONS)) {
@@ -2293,7 +1973,7 @@ foo_client_state_changed_cb (NMClient *client, GParamSpec *pspec, gpointer user_
case NM_STATE_DISCONNECTED:
applet_do_notify_with_pref (applet, _("Disconnected"),
_("The network connection has been disconnected."),
- "nm-no-connection",
+ "network-offline-symbolic",
PREF_DISABLE_DISCONNECTED_NOTIFICATIONS);
break;
default:
@@ -2322,7 +2002,6 @@ foo_manager_running_cb (NMClient *client,
g_debug ("NM appeared");
} else {
g_debug ("NM disappeared");
- clear_animation_timeout (applet);
}
applet_schedule_update_icon (applet);
@@ -2361,7 +2040,6 @@ foo_active_connections_changed_cb (NMClient *client,
|| g_object_get_data (G_OBJECT (candidate), VPN_STATE_ID_TAG))
continue;
- /* Start/stop animation when the AC state changes ... */
id = g_signal_connect (G_OBJECT (candidate), "state-changed",
G_CALLBACK (vpn_active_connection_state_changed), applet);
/* ... and also update icon/tooltip when the VPN state changes */
@@ -2424,6 +2102,9 @@ foo_client_setup (NMApplet *applet)
g_signal_connect (applet->nm_client, "notify::state",
G_CALLBACK (foo_client_state_changed_cb),
applet);
+ g_signal_connect_swapped (applet->nm_client, "notify::connectivity",
+ G_CALLBACK (applet_schedule_update_icon),
+ applet);
g_signal_connect (applet->nm_client, "notify::active-connections",
G_CALLBACK (foo_active_connections_changed_cb),
applet);
@@ -2540,173 +2221,132 @@ mm1_client_setup (NMApplet *applet)
#endif /* WITH_WWAN */
-static void
-applet_common_get_device_icon (NMDeviceState state,
- GdkPixbuf **out_pixbuf,
- char **out_icon_name,
- NMApplet *applet)
+static NMActiveConnection *
+best_active_connection (NMApplet *applet)
{
- int stage = -1;
+ NMActiveConnection *best = NULL;
+ NMActiveConnection *candidate;
+ unsigned int best_score = 0x0000;
+ unsigned int candidate_score;
+ NMConnection *connection;
+ const GPtrArray *active_list;
+ int i;
- switch (state) {
- case NM_DEVICE_STATE_PREPARE:
- stage = 0;
- break;
- case NM_DEVICE_STATE_CONFIG:
- case NM_DEVICE_STATE_NEED_AUTH:
- stage = 1;
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- stage = 2;
- break;
- default:
- break;
- }
+ active_list = nm_client_get_active_connections (applet->nm_client);
+ for (i = 0; active_list && (i < active_list->len); i++) {
+ candidate = g_ptr_array_index (active_list, i);
- if (stage >= 0) {
- char *name = g_strdup_printf ("nm-stage%02d-connecting%02d", stage + 1,
applet->animation_step + 1);
+ connection = (NMConnection *) nm_active_connection_get_connection (candidate);
+ if (!connection)
+ continue;
- if (out_pixbuf)
- *out_pixbuf = nm_g_object_ref (nma_icon_check_and_load (name, applet));
- if (out_icon_name)
- *out_icon_name = name;
- else
- g_free (name);
+ candidate_score = 0x0000;
+ if (nm_active_connection_get_default (candidate))
+ candidate_score += 0x0010;
+ if (!connection_is_vpn (connection))
+ candidate_score += 0x0100;
+ if (nm_active_connection_get_state (candidate) == NM_ACTIVE_CONNECTION_STATE_ACTIVATING)
+ candidate_score += 0x1000;
- applet->animation_step++;
- if (applet->animation_step >= NUM_CONNECTING_FRAMES)
- applet->animation_step = 0;
+ if (candidate_score < best_score)
+ continue;
+
+ best_score = candidate_score;
+ best = candidate;
}
+
+ return best;
}
+
static char *
-get_tip_for_device_state (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection)
+get_tip_for_active_connection (NMActiveConnection *active)
{
- char *tip = NULL;
+ NMConnection *connection;
+ NMDevice *device;
const char *id = NULL;
- id = nm_device_get_iface (device);
- if (connection)
- id = nm_connection_get_id (connection);
+ id = nm_active_connection_get_id (active);
+ if (!id)
+ return NULL;
- switch (state) {
- case NM_DEVICE_STATE_PREPARE:
- case NM_DEVICE_STATE_CONFIG:
- tip = g_strdup_printf (_("Preparing network connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- tip = g_strdup_printf (_("User authentication required for network connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- tip = g_strdup_printf (_("Requesting a network address for “%s”…"), id);
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- tip = g_strdup_printf (_("Network connection “%s” active"), id);
- break;
- default:
- break;
+ connection = (NMConnection *) nm_active_connection_get_connection (active);
+ if (connection_is_vpn (connection)) {
+ switch (nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (active))) {
+ case NM_VPN_CONNECTION_STATE_CONNECT:
+ case NM_VPN_CONNECTION_STATE_PREPARE:
+ return g_strdup_printf (_("Starting VPN connection “%s”…"), id);
+ case NM_VPN_CONNECTION_STATE_NEED_AUTH:
+ return g_strdup_printf (_("User authentication required for VPN connection “%s”…"),
id);
+ case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
+ return g_strdup_printf (_("Requesting a VPN address for “%s”…"), id);
+ case NM_VPN_CONNECTION_STATE_ACTIVATED:
+ return g_strdup_printf (_("VPN connection active"));
+ default:
+ break;
+ }
+ } else {
+ device = g_ptr_array_index (nm_active_connection_get_devices (active), 0);
+
+ switch (nm_device_get_state (device)) {
+ case NM_DEVICE_STATE_PREPARE:
+ case NM_DEVICE_STATE_CONFIG:
+ return g_strdup_printf (_("Preparing network connection “%s”…"), id);
+ case NM_DEVICE_STATE_NEED_AUTH:
+ return g_strdup_printf (_("User authentication required for network connection
“%s”…"), id);
+ case NM_DEVICE_STATE_IP_CONFIG:
+ return g_strdup_printf (_("Requesting a network address for “%s”…"), id);
+ case NM_DEVICE_STATE_ACTIVATED:
+ return g_strdup_printf (_("Network connection “%s” active"), id);
+ default:
+ break;
+ }
}
- return tip;
+ return NULL;
}
-static void
-applet_get_device_icon_for_state (NMApplet *applet,
- GdkPixbuf **out_pixbuf,
- char **out_icon_name,
- char **out_tip)
+static const char *
+signal_strength (NMApplet *applet, NMActiveConnection *active)
{
- NMActiveConnection *active;
- NMDevice *device = NULL;
- NMDeviceState state = NM_DEVICE_STATE_UNKNOWN;
+ NMConnection *connection = (NMConnection *) nm_active_connection_get_connection (active);
NMADeviceClass *dclass;
+ NMDevice *device;
+ guint8 strength;
- g_assert (out_pixbuf && out_icon_name && out_tip);
- g_assert (!*out_pixbuf && !*out_icon_name && !*out_tip);
-
- // FIXME: handle multiple device states here
-
- /* First show the best activating device's state */
- active = applet_get_best_activating_connection (applet, &device);
- if (!active || !device) {
- /* If there aren't any activating devices, then show the state of
- * the default active connection instead.
- */
- active = applet_get_default_active_connection (applet, &device, TRUE);
- if (!active || !device)
- goto out;
- }
-
- state = nm_device_get_state (device);
-
- dclass = get_device_class (device, applet);
- if (dclass) {
- NMConnection *connection;
- const char *icon_name = NULL;
-
- connection = applet_find_active_connection_for_device (device, applet, NULL);
-
- dclass->get_icon (device, state, connection, out_pixbuf, &icon_name, out_tip, applet);
-
- if (!*out_pixbuf && icon_name)
- *out_pixbuf = nm_g_object_ref (nma_icon_check_and_load (icon_name, applet));
- *out_icon_name = g_strdup (icon_name);
- if (!*out_tip)
- *out_tip = get_tip_for_device_state (device, state, connection);
- if (icon_name || *out_pixbuf)
- return;
- }
-
-out:
- applet_common_get_device_icon (state, out_pixbuf, out_icon_name, applet);
-}
-
-static char *
-get_tip_for_vpn (NMActiveConnection *active, NMVpnConnectionState state, NMApplet *applet)
-{
- char *tip = NULL;
- const char *id = NULL;
-
- id = nm_active_connection_get_id (active);
- if (!id)
- return NULL;
+ device = g_ptr_array_index (nm_active_connection_get_devices (active), 0);
+ g_return_val_if_fail (device, "");
- switch (state) {
- case NM_VPN_CONNECTION_STATE_CONNECT:
- case NM_VPN_CONNECTION_STATE_PREPARE:
- tip = g_strdup_printf (_("Starting VPN connection “%s”…"), id);
- break;
- case NM_VPN_CONNECTION_STATE_NEED_AUTH:
- tip = g_strdup_printf (_("User authentication required for VPN connection “%s”…"), id);
- break;
- case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
- tip = g_strdup_printf (_("Requesting a VPN address for “%s”…"), id);
- break;
- case NM_VPN_CONNECTION_STATE_ACTIVATED:
- tip = g_strdup_printf (_("VPN connection active"));
- break;
- default:
- break;
- }
+ dclass = get_device_class_from_connection (connection, applet);
+ if (!dclass || !dclass->get_signal_strength)
+ return "";
- return tip;
+ strength = dclass->get_signal_strength (device, applet);
+ if (strength < 20)
+ return "-signal-none";
+ if (strength < 40)
+ return "-signal-weak";
+ if (strength < 60)
+ return "-signal-ok";
+ if (strength < 80)
+ return "-signal-good";
+ return "-signal-excellent";
}
static gboolean
applet_update_icon (gpointer user_data)
{
+
NMApplet *applet = NM_APPLET (user_data);
- gs_unref_object GdkPixbuf *pixbuf = NULL;
+ NMActiveConnection *active = NULL;
+ NMActiveConnectionState ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATED;
+ NMConnection *connection;
NMState state;
- const char *icon_name, *dev_tip;
- char *vpn_tip = NULL;
- gs_free char *icon_name_free = NULL;
+ gs_free char *icon_name = NULL;
+ char *dev_tip = NULL;
gs_free char *dev_tip_free = NULL;
- NMVpnConnectionState vpn_state = NM_VPN_CONNECTION_STATE_UNKNOWN;
gboolean nm_running;
- NMActiveConnection *active_vpn = NULL;
+ GString *name;
applet->update_icon_id = 0;
@@ -2730,65 +2370,75 @@ applet_update_icon (gpointer user_data)
switch (state) {
case NM_STATE_UNKNOWN:
case NM_STATE_ASLEEP:
- icon_name = "nm-no-connection";
dev_tip = _("Networking disabled");
break;
case NM_STATE_DISCONNECTED:
- icon_name = "nm-no-connection";
dev_tip = _("No network connection");
break;
default:
- applet_get_device_icon_for_state (applet, &pixbuf, &icon_name_free, &dev_tip_free);
- icon_name = icon_name_free;
- dev_tip = dev_tip_free;
+ active = best_active_connection (applet);
break;
}
- foo_set_icon (applet, ICON_LAYER_LINK, pixbuf, icon_name);
-
- icon_name = NULL;
- g_clear_pointer (&icon_name_free, g_free);
+ name = g_string_new ("network");
+ if (active) {
+ connection = (NMConnection *) nm_active_connection_get_connection (active);
+ dev_tip = dev_tip_free = get_tip_for_active_connection (active);
+ ac_state = nm_active_connection_get_state (active);
+
+ if (connection_is_vpn (connection)) {
+ g_string_append (name, "-vpn");
+ } else if (nm_connection_is_type (connection, NM_SETTING_WIRELESS_SETTING_NAME)) {
+ g_string_append (name, "-wireless");
+ } else if ( nm_connection_is_type (connection, NM_SETTING_GSM_SETTING_NAME)
+ || nm_connection_is_type (connection, NM_SETTING_CDMA_SETTING_NAME)) {
+ g_string_append (name, "-cellular");
+ } else {
+ g_string_append (name, "-wired");
+ }
+ }
- /* VPN state next */
- active_vpn = applet_get_active_vpn_connection (applet, &vpn_state);
- if (active_vpn) {
- switch (vpn_state) {
- case NM_VPN_CONNECTION_STATE_ACTIVATED:
- icon_name = "nm-vpn-active-lock";
-#ifdef WITH_APPINDICATOR
- if (INDICATOR_ENABLED (applet))
- icon_name = icon_name_free = g_strdup_printf ("%s-secure",
app_indicator_get_icon (applet->app_indicator));
-#endif /* WITH_APPINDICATOR */
+ switch (ac_state) {
+ case NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
+ switch (nm_client_get_connectivity (applet->nm_client)) {
+ case NM_CONNECTIVITY_UNKNOWN:
+ case NM_CONNECTIVITY_FULL:
+ g_string_append (name, signal_strength (applet, active));
break;
- case NM_VPN_CONNECTION_STATE_PREPARE:
- case NM_VPN_CONNECTION_STATE_NEED_AUTH:
- case NM_VPN_CONNECTION_STATE_CONNECT:
- case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
- icon_name = icon_name_free = g_strdup_printf ("nm-vpn-connecting%02d",
applet->animation_step + 1);
- applet->animation_step++;
- if (applet->animation_step >= NUM_VPN_CONNECTING_FRAMES)
- applet->animation_step = 0;
+ case NM_CONNECTIVITY_NONE:
+ g_string_append (name, "-offline");
break;
- default:
+ case NM_CONNECTIVITY_PORTAL:
+ case NM_CONNECTIVITY_LIMITED:
+ g_string_append (name, "-no-route");
break;
}
+ break;
+ case NM_ACTIVE_CONNECTION_STATE_ACTIVATING:
+ g_string_append (name, "-acquiring");
+ break;
+ case NM_ACTIVE_CONNECTION_STATE_UNKNOWN:
+ case NM_ACTIVE_CONNECTION_STATE_DEACTIVATING:
+ case NM_ACTIVE_CONNECTION_STATE_DEACTIVATED:
+ g_string_append (name, "-offline");
+ break;
+ }
- vpn_tip = get_tip_for_vpn (active_vpn, vpn_state, applet);
- if (vpn_tip && dev_tip) {
- char *tmp;
-
- tmp = g_strdup_printf ("%s\n%s", dev_tip, vpn_tip);
- g_free (vpn_tip);
- vpn_tip = tmp;
- }
+ g_string_append (name, "-symbolic");
+ icon_name = g_string_free (name, FALSE);
+#ifdef WITH_APPINDICATOR
+ if (INDICATOR_ENABLED (applet)) {
+ app_indicator_set_icon_full (applet->app_indicator, icon_name, applet->tip);
+ }
+ else
+#endif /* WITH_APPINDICATOR */
+ {
+ gtk_status_icon_set_from_icon_name (applet->status_icon, icon_name);
}
- foo_set_icon (applet, ICON_LAYER_VPN, NULL, icon_name);
/* update tooltip */
g_free (applet->tip);
- if (vpn_tip)
- applet->tip = vpn_tip;
- else if (dev_tip == dev_tip_free) {
+ if (dev_tip == dev_tip_free) {
applet->tip = dev_tip_free;
dev_tip_free = NULL;
} else
@@ -3039,46 +2689,6 @@ applet_agent_cancel_secrets_cb (AppletAgent *agent,
/*****************************************************************************/
-static void nma_icons_free (NMApplet *applet)
-{
- guint i;
-
- g_return_if_fail (NM_IS_APPLET (applet));
-
- for (i = 0; i <= ICON_LAYER_MAX; i++)
- g_clear_object (&applet->icon_layers[i]);
-}
-
-GdkPixbuf *
-nma_icon_check_and_load (const char *name, NMApplet *applet)
-{
- GError *error = NULL;
- GdkPixbuf *icon;
- int scale;
-
- g_assert (name != NULL);
- g_assert (applet != NULL);
-
- /* icon already loaded successfully */
- if (g_hash_table_lookup_extended (applet->icon_cache, name, NULL, (gpointer) &icon))
- return icon;
-
- scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
-
- /* Try to load the icon; if the load fails, log the problem, and set
- * the icon to the fallback icon if requested.
- */
- if (!(icon = gtk_icon_theme_load_icon_for_scale (applet->icon_theme, name, applet->icon_size, scale,
GTK_ICON_LOOKUP_FORCE_SIZE, &error))) {
- g_warning ("failed to load icon \"%s\": %s", name, error->message);
- g_clear_error (&error);
- icon = nm_g_object_ref (applet->fallback_icon);
- }
-
- g_hash_table_insert (applet->icon_cache, g_strdup (name), icon);
-
- return icon;
-}
-
#include "fallback-icon.h"
static void
@@ -3090,7 +2700,6 @@ nma_icons_reload (NMApplet *applet)
g_return_if_fail (applet->icon_size > 0);
g_hash_table_remove_all (applet->icon_cache);
- nma_icons_free (applet);
if (applet->fallback_icon)
return;
@@ -3125,8 +2734,6 @@ static void nma_icon_theme_changed (GtkIconTheme *icon_theme, NMApplet *applet)
static void nma_icons_init (NMApplet *applet)
{
- gboolean path_appended;
-
if (applet->icon_theme) {
g_signal_handlers_disconnect_by_func (applet->icon_theme,
G_CALLBACK (nma_icon_theme_changed),
@@ -3139,16 +2746,6 @@ static void nma_icons_init (NMApplet *applet)
else
applet->icon_theme = gtk_icon_theme_get_default ();
- /* If not done yet, append our search path */
- path_appended = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (applet->icon_theme),
- "NMAIconPathAppended"));
- if (path_appended == FALSE) {
- gtk_icon_theme_append_search_path (applet->icon_theme, ICONDIR);
- g_object_set_data (G_OBJECT (applet->icon_theme),
- "NMAIconPathAppended",
- GINT_TO_POINTER (TRUE));
- }
-
g_signal_connect (applet->icon_theme, "changed", G_CALLBACK (nma_icon_theme_changed), applet);
nma_icons_reload (applet);
@@ -3250,7 +2847,7 @@ setup_widgets (NMApplet *applet)
#ifdef WITH_APPINDICATOR
if (with_appindicator) {
applet->app_indicator = app_indicator_new ("nm-applet",
- "nm-no-connection",
+ "network-offline-symbolic",
APP_INDICATOR_CATEGORY_SYSTEM_SERVICES);
if (!applet->app_indicator)
return FALSE;
@@ -3448,7 +3045,6 @@ static void finalize (GObject *object)
g_clear_pointer (&applet->icon_cache, g_hash_table_destroy);
g_clear_object (&applet->fallback_icon);
g_free (applet->tip);
- nma_icons_free (applet);
while (g_slist_length (applet->secrets_reqs))
applet_secrets_request_free ((SecretsRequest *) applet->secrets_reqs->data);
diff --git a/src/applet.h b/src/applet.h
index 2bc2246f..bc862745 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -58,10 +58,6 @@ typedef struct {
#define PREF_SUPPRESS_WIFI_NETWORKS_AVAILABLE "suppress-wireless-networks-available"
#define PREF_SHOW_APPLET "show-applet"
-#define ICON_LAYER_LINK 0
-#define ICON_LAYER_VPN 1
-#define ICON_LAYER_MAX ICON_LAYER_VPN
-
typedef struct NMADeviceClass NMADeviceClass;
/*
@@ -98,20 +94,11 @@ typedef struct {
guint update_icon_id;
char * tip;
- /* Animation stuff */
- int animation_step;
- guint animation_id;
-#define NUM_CONNECTING_FRAMES 11
-#define NUM_VPN_CONNECTING_FRAMES 14
-
GtkIconTheme * icon_theme;
GHashTable * icon_cache;
GdkPixbuf * fallback_icon;
int icon_size;
- /* Active status icon pixbufs */
- GdkPixbuf * icon_layers[ICON_LAYER_MAX + 1];
-
/* Direct UI elements */
#ifdef WITH_APPINDICATOR
AppIndicator * app_indicator;
@@ -204,16 +191,7 @@ struct NMADeviceClass {
const char *msg,
NMApplet *applet);
- /* Device class is expected to pass a *referenced* pixbuf, which will
- * be unrefed by the icon code. This allows the device class to create
- * a composited pixbuf if necessary and pass the reference to the caller.
- */
- void (*get_icon) (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection,
- GdkPixbuf **out_pixbuf,
- const char **out_icon_name,
- char **tip,
+ guint8 (*get_signal_strength) (NMDevice *device,
NMApplet *applet);
size_t secrets_request_size;
@@ -280,9 +258,6 @@ GtkWidget * applet_new_menu_item_helper (NMConnection *connection,
NMConnection *active,
gboolean add_active);
-GdkPixbuf * nma_icon_check_and_load (const char *name,
- NMApplet *applet);
-
gboolean applet_wifi_connect_to_hidden_network (NMApplet *applet);
gboolean applet_wifi_create_wifi_network (NMApplet *applet);
gboolean applet_wifi_can_create_wifi_network (NMApplet *applet);
diff --git a/src/connection-editor/meson.build b/src/connection-editor/meson.build
index 48e598d8..79fdbd85 100644
--- a/src/connection-editor/meson.build
+++ b/src/connection-editor/meson.build
@@ -98,7 +98,6 @@ cflags = [
'-DLIBDIR="@0@"'.format(nma_libdir),
'-DNMALOCALEDIR="@0@"'.format(nma_localedir),
'-DSYSCONFDIR="@0@"'.format(nma_sysconfdir),
- '-DICONDIR="@0@"'.format(nma_icondir)
]
if enable_selinux
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 0dd3c3be..7b7155c2 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -533,7 +533,7 @@ mobile_connection_new (FUNC_TAG_PAGE_NEW_CONNECTION_IMPL,
GTK_RESPONSE_OK,
NULL);
g_signal_connect (dialog, "delete-event", G_CALLBACK (cancel_dialog), NULL);
- gtk_window_set_icon_name (GTK_WINDOW (dialog), "nm-device-wwan");
+ gtk_window_set_icon_name (GTK_WINDOW (dialog), "network-cellular-connected-symbolic");
content = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
alignment = gtk_alignment_new (0, 0, 0.5, 0.5);
@@ -543,7 +543,7 @@ mobile_connection_new (FUNC_TAG_PAGE_NEW_CONNECTION_IMPL,
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_container_add (GTK_CONTAINER (alignment), hbox);
- image = gtk_image_new_from_icon_name ("nm-device-wwan", GTK_ICON_SIZE_DIALOG);
+ image = gtk_image_new_from_icon_name ("network-cellular-connected-symbolic", GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0);
gtk_misc_set_padding (GTK_MISC (image), 0, 6);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 6);
diff --git a/src/mb-menu-item.c b/src/mb-menu-item.c
index cab10b66..b5542268 100644
--- a/src/mb-menu-item.c
+++ b/src/mb-menu-item.c
@@ -165,20 +165,9 @@ nm_mb_menu_item_new (const char *connection_name,
/* And the strength icon, if we have strength information at all */
if (enabled && strength) {
- const char *icon_name = mobile_helper_get_quality_icon_name (strength);
- GdkPixbuf *icon = nma_icon_check_and_load (icon_name, applet);
-
- if (INDICATOR_ENABLED (applet)) {
- /* app_indicator only uses GdkPixbuf */
- gtk_image_set_from_pixbuf (GTK_IMAGE (priv->strength), icon);
- } else {
- int scale = gtk_widget_get_scale_factor (GTK_WIDGET (priv->strength));
- cairo_surface_t *surface;
-
- surface = gdk_cairo_surface_create_from_pixbuf (icon, scale, NULL);
- gtk_image_set_from_surface (GTK_IMAGE (priv->strength), surface);
- cairo_surface_destroy (surface);
- }
+ gtk_image_set_from_icon_name (GTK_IMAGE (priv->strength),
+ mobile_helper_get_quality_icon_name (strength),
+ GTK_ICON_SIZE_MENU);
}
return GTK_WIDGET (item);
diff --git a/src/meson.build b/src/meson.build
index 2d910bb2..fd64f29b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -59,7 +59,6 @@ cflags = [
'-DNMALOCALEDIR="@0@"'.format(nma_localedir),
'-DSYSCONFDIR="@0@"'.format(nma_sysconfdir),
'-DAUTOSTARTDIR="@0@"'.format(nma_autostartdir),
- '-DICONDIR="@0@"'.format(nma_icondir),
'-DG_LOG_DOMAIN="@0@"'.format(nma_name)
]
diff --git a/src/mobile-helpers.c b/src/mobile-helpers.c
index 0621a81b..9fe52c4b 100644
--- a/src/mobile-helpers.c
+++ b/src/mobile-helpers.c
@@ -16,119 +16,19 @@
#include "mobile-helpers.h"
#include "applet-dialogs.h"
-GdkPixbuf *
-mobile_helper_get_status_pixbuf (guint32 quality,
- gboolean quality_valid,
- guint32 state,
- guint32 access_tech,
- NMApplet *applet)
-{
- GdkPixbuf *pixbuf, *qual_pixbuf, *tmp;
-
- if (!quality_valid)
- quality = 0;
- qual_pixbuf = nma_icon_check_and_load (mobile_helper_get_quality_icon_name (quality), applet);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- TRUE,
- qual_pixbuf ? gdk_pixbuf_get_bits_per_sample (qual_pixbuf) : 8,
- qual_pixbuf ? gdk_pixbuf_get_width (qual_pixbuf) : 22,
- qual_pixbuf ? gdk_pixbuf_get_height (qual_pixbuf) : 22);
- gdk_pixbuf_fill (pixbuf, 0xFFFFFF00);
-
- /* Composite the tower icon into the final icon at the bottom layer */
- tmp = nma_icon_check_and_load ("nm-wwan-tower", applet);
- if (tmp) {
- gdk_pixbuf_composite (tmp, pixbuf,
- 0, 0,
- gdk_pixbuf_get_width (tmp),
- gdk_pixbuf_get_height (tmp),
- 0, 0, 1.0, 1.0,
- GDK_INTERP_BILINEAR, 255);
- }
-
- /* Composite the signal quality onto the icon on top of the WWAN tower */
- if (qual_pixbuf) {
- gdk_pixbuf_composite (qual_pixbuf, pixbuf,
- 0, 0,
- gdk_pixbuf_get_width (qual_pixbuf),
- gdk_pixbuf_get_height (qual_pixbuf),
- 0, 0, 1.0, 1.0,
- GDK_INTERP_BILINEAR, 255);
- }
-
- /* And finally the roaming or technology icon */
- if (state == MB_STATE_ROAMING) {
- tmp = nma_icon_check_and_load ("nm-mb-roam", applet);
- if (tmp) {
- gdk_pixbuf_composite (tmp, pixbuf, 0, 0,
- gdk_pixbuf_get_width (tmp),
- gdk_pixbuf_get_height (tmp),
- 0, 0, 1.0, 1.0,
- GDK_INTERP_BILINEAR, 255);
- }
- } else {
- const gchar *tech_icon_name;
-
- /* Only try to add the access tech info icon if we get a valid
- * access tech reported. */
- tech_icon_name = mobile_helper_get_tech_icon_name (access_tech);
- if (tech_icon_name) {
- tmp = nma_icon_check_and_load (tech_icon_name, applet);
- if (tmp) {
- gdk_pixbuf_composite (tmp, pixbuf, 0, 0,
- gdk_pixbuf_get_width (tmp),
- gdk_pixbuf_get_height (tmp),
- 0, 0, 1.0, 1.0,
- GDK_INTERP_BILINEAR, 255);
- }
- }
- }
-
- /* 'pixbuf' will be freed by the caller */
- return pixbuf;
-}
-
const char *
mobile_helper_get_quality_icon_name (guint32 quality)
{
if (quality > 80)
- return "nm-signal-100";
+ return "network-cellular-signal-excellent-symbolic";
else if (quality > 55)
- return "nm-signal-75";
+ return "network-cellular-signal-good-symbolic";
else if (quality > 30)
- return "nm-signal-50";
+ return "network-cellular-signal-ok-symbolic";
else if (quality > 5)
- return "nm-signal-25";
+ return "network-cellular-signal-weak-symbolic";
else
- return "nm-signal-00";
-}
-
-const char *
-mobile_helper_get_tech_icon_name (guint32 tech)
-{
- switch (tech) {
- case MB_TECH_1XRTT:
- return "nm-tech-cdma-1x";
- case MB_TECH_EVDO:
- return "nm-tech-evdo";
- case MB_TECH_GSM:
- case MB_TECH_GPRS:
- return "nm-tech-gprs";
- case MB_TECH_EDGE:
- return "nm-tech-edge";
- case MB_TECH_UMTS:
- return "nm-tech-umts";
- case MB_TECH_HSDPA:
- case MB_TECH_HSUPA:
- case MB_TECH_HSPA:
- case MB_TECH_HSPA_PLUS:
- return "nm-tech-hspa";
- case MB_TECH_LTE:
- return "nm-tech-lte";
- default:
- return NULL;
- }
+ return "network-cellular-signal-none-symbolic";
}
/********************************************************************/
@@ -552,72 +452,6 @@ mobile_helper_get_secrets (NMDeviceModemCapabilities capabilities,
return TRUE;
}
-/********************************************************************/
-
-void
-mobile_helper_get_icon (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection,
- GdkPixbuf **out_pixbuf,
- const char **out_icon_name,
- char **tip,
- NMApplet *applet,
- guint32 mb_state,
- guint32 mb_tech,
- guint32 quality,
- gboolean quality_valid)
-{
- NMSettingConnection *s_con;
- const char *id;
-
- g_return_if_fail (out_icon_name && !*out_icon_name);
- g_return_if_fail (tip && !*tip);
-
- id = nm_device_get_iface (NM_DEVICE (device));
- if (connection) {
- s_con = nm_connection_get_setting_connection (connection);
- id = nm_setting_connection_get_id (s_con);
- }
-
- switch (state) {
- case NM_DEVICE_STATE_PREPARE:
- *tip = g_strdup_printf (_("Preparing mobile broadband connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_CONFIG:
- *tip = g_strdup_printf (_("Configuring mobile broadband connection “%s”…"), id);
- break;
- case NM_DEVICE_STATE_NEED_AUTH:
- *tip = g_strdup_printf (_("User authentication required for mobile broadband connection
“%s”…"), id);
- break;
- case NM_DEVICE_STATE_IP_CONFIG:
- *tip = g_strdup_printf (_("Requesting a network address for “%s”…"), id);
- break;
- case NM_DEVICE_STATE_ACTIVATED:
- *out_pixbuf = mobile_helper_get_status_pixbuf (quality,
- quality_valid,
- mb_state,
- mb_tech,
- applet);
- *out_icon_name = mobile_helper_get_quality_icon_name (quality_valid ?
- quality : 0);
-
- if ((mb_state != MB_STATE_UNKNOWN) && quality_valid) {
- gboolean roaming = (mb_state == MB_STATE_ROAMING);
-
- *tip = g_strdup_printf (_("Mobile broadband connection “%s” active: (%d%%%s%s)"),
- id, quality,
- roaming ? ", " : "",
- roaming ? _("roaming") : "");
- } else
- *tip = g_strdup_printf (_("Mobile broadband connection “%s” active"), id);
- break;
- default:
- break;
- }
-}
-
-/********************************************************************/
-
char *
mobile_helper_parse_3gpp_operator_name (NMAMobileProvidersDatabase **mpd, /* I/O */
const char *orig,
diff --git a/src/mobile-helpers.h b/src/mobile-helpers.h
index 3be4fbd8..e642bec4 100644
--- a/src/mobile-helpers.h
+++ b/src/mobile-helpers.h
@@ -40,14 +40,7 @@ enum {
MB_TECH_LTE,
};
-GdkPixbuf *mobile_helper_get_status_pixbuf (guint32 quality,
- gboolean quality_valid,
- guint32 state,
- guint32 access_tech,
- NMApplet *applet);
-
const char *mobile_helper_get_quality_icon_name (guint32 quality);
-const char *mobile_helper_get_tech_icon_name (guint32 tech);
/********************************************************************/
@@ -80,20 +73,6 @@ gboolean mobile_helper_get_secrets (NMDeviceModemCapabilities capabilities,
/********************************************************************/
-void mobile_helper_get_icon (NMDevice *device,
- NMDeviceState state,
- NMConnection *connection,
- GdkPixbuf **out_pixbuf,
- const char **out_icon_name,
- char **tip,
- NMApplet *applet,
- guint32 mb_state,
- guint32 mb_tech,
- guint32 quality,
- gboolean quality_valid);
-
-/********************************************************************/
-
char *mobile_helper_parse_3gpp_operator_name (NMAMobileProvidersDatabase **mpd,
const char *orig,
const char *op_code);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]