Re: [PATCH] nm-applet for MBM (Show technology)
On Mon, 2008-10-27 at 16:35 -0400, Dan Williams wrote: On Mon, 2008-10-27 at 10:14 -0700, bjornrun wrote: Hello NetworkManager List! Here are some patches to networkmanager applet for MBM so technology used in connection is shown in applet. Note this uses the earlier patch in Modem-Manager. Hang on for a bit with these patches, we'll be switching over to ModemManager imminently and then we can start doing this sort of thing. But, for the icons, don't create completely new ones. Just create small badges (the same size as nm-vpn-active-lock.png) and then we'll just composite them on top of the existing icon in another layer. There's already a VPN layer, so we'll just add another for mobile broadband speeds. BTW, are there standard decals/icons for the speeds? I know most phones use a G or an E for GPRS/EDGE, and a 3G for UMTS/HSPA, maybe we can do a bit better and have some more color :) As long as people will recognize it of course. Dan However, where would it go? The VPN lock already occupies the lower-right corner, so that can't be used. We can't cover up too much of the signal strength bars, otherwise it starts getting rediculous... we may want to hold off on speed icons until we redesign the applet UI. Dan Regards, Bjorn @@ -316,6 +347,7 @@ char **tip, NMApplet *applet) { + NMAGsmModem *modem; GdkPixbuf *pixbuf = NULL; const char *iface; NMSettingConnection *s_con = NULL; @@ -335,16 +367,82 @@ *tip = g_strdup_printf (_(Waiting for user authentication on device '%s'...), iface); break; case NM_DEVICE_STATE_ACTIVATED: - if (s_con) { - const char *id; + modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), gsm-modem); + if (modem) { + char *oper_code; + char *oper_name; + guint32 reg_status; + guint32 quality; + guint32 network_mode; + + + quality = nma_gsm_modem_get_signal_quality (modem); + quality = CLAMP (quality, 0, 100); + network_mode = nma_gsm_modem_get_network_mode (modem); + + g_debug(quality = %d, net = %d, quality, network_mode); + + if (quality 80) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_100_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_100_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_100_E_icon; break; + default: + pixbuf = applet-wireless_100_icon; + } + } else if (quality 55) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_75_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_75_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_75_E_icon; break; + default: + pixbuf = applet-wireless_75_icon; + } + } else if (quality 30) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_50_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_50_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_50_E_icon; break; + default: + pixbuf = applet-wireless_50_icon; + } + } else if (quality 5) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_25_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_25_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: +
Re: [PATCH] nm-applet for MBM (Show technology)
On Tue, 2008-10-28 at 15:50 +, Karl Lattimer wrote: On Tue, 2008-10-28 at 11:15 -0400, Dan Williams wrote: On Mon, 2008-10-27 at 16:35 -0400, Dan Williams wrote: On Mon, 2008-10-27 at 10:14 -0700, bjornrun wrote: Hello NetworkManager List! Here are some patches to networkmanager applet for MBM so technology used in connection is shown in applet. Note this uses the earlier patch in Modem-Manager. Hang on for a bit with these patches, we'll be switching over to ModemManager imminently and then we can start doing this sort of thing. But, for the icons, don't create completely new ones. Just create small badges (the same size as nm-vpn-active-lock.png) and then we'll just composite them on top of the existing icon in another layer. There's already a VPN layer, so we'll just add another for mobile broadband speeds. BTW, are there standard decals/icons for the speeds? I know most phones use a G or an E for GPRS/EDGE, and a 3G for UMTS/HSPA, maybe we can do a bit better and have some more color :) As long as people will recognize it of course. I was going to mention this also, there is actually an icon for GPRS/GSM, a stylised E is used for Edge, and 3G for UMTS and 3.5G for HSDPA I believe (these are used on nokia phones and possibly others). It would of course be nice to get better metaphors for each of these, in the same way as the GPRS/GSM icon is descriptive of what it is even if it isn't descriptive of which it is. Further problems are abound though, for instance if we choose dark colours for the glyphs then they won't work on dark themes, and we will have some difficulty with tango styling as they'll be so small. 1px line width... Probably a good idea to speak with Garret/Jimmac about this as they'll probably have some good ideas as to how we can deal with the problem at this small size. Also Tango forbits the use of text in icons, I think this also refers to numbers and letters, they might not cross localisation boundaries very well. Attached is a drawing of the gsm/gprs icon. Ugh... changing the tower design itself is a non-starter, because I just don't think that works. I think decals or colors are really the only way to go here. The tower will also eventually have to have signal strength so it may have to shift to the left with the signal bars marching left - right. For CDMA in the Americas, 2.5G == 1xRTT (between GPRS and EDGE in speed) and the icon is usually just 1X. 3G == EVDO ( 3Mbps, comparable to HSDPA 3.6) usually gets an EV icon. I've never seen purely graphical icons for these. Dan ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
[PATCH] nm-applet for MBM (Show technology)
Hello NetworkManager List! Here are some patches to networkmanager applet for MBM so technology used in connection is shown in applet. Note this uses the earlier patch in Modem-Manager. Regards, Bjorn @@ -316,6 +347,7 @@ char **tip, NMApplet *applet) { + NMAGsmModem *modem; GdkPixbuf *pixbuf = NULL; const char *iface; NMSettingConnection *s_con = NULL; @@ -335,16 +367,82 @@ *tip = g_strdup_printf (_(Waiting for user authentication on device '%s'...), iface); break; case NM_DEVICE_STATE_ACTIVATED: - if (s_con) { - const char *id; + modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), gsm-modem); + if (modem) { + char *oper_code; + char *oper_name; + guint32 reg_status; + guint32 quality; + guint32 network_mode; + + + quality = nma_gsm_modem_get_signal_quality (modem); + quality = CLAMP (quality, 0, 100); + network_mode = nma_gsm_modem_get_network_mode (modem); + + g_debug(quality = %d, net = %d, quality, network_mode); + + if (quality 80) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_100_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_100_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_100_E_icon; break; + default: + pixbuf = applet-wireless_100_icon; + } + } else if (quality 55) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_75_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_75_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_75_E_icon; break; + default: + pixbuf = applet-wireless_75_icon; + } + } else if (quality 30) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_50_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_50_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_50_E_icon; break; + default: + pixbuf = applet-wireless_50_icon; + } + } else if (quality 5) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_25_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_25_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_25_E_icon; break; + default: + pixbuf = applet-wireless_25_icon; + } + } else + pixbuf = applet-wireless_00_icon; + + reg_status = nma_gsm_modem_get_registration_info (modem, oper_code, oper_name); + *tip = g_strdup_printf (_(%s GSM connection '%s' (%d%%)), + reg_status == MM_GSM_MODEM_REG_STATUS_ROAMING ? _(Roaming) : _(Home), + oper_name, quality); + + g_free (oper_name); + g_free (oper_code); + + } else { + pixbuf = applet-wireless_00_icon; + *tip = g_strdup_printf (_(GSM connection)); + } - id = nm_setting_connection_get_id
Re: [PATCH] nm-applet for MBM (Show technology)
Hello, I upload the patches instead. Regards, Bjorn http://www.nabble.com/file/p20192396/applet-device-gsm.c.patch applet-device-gsm.c.patch http://www.nabble.com/file/p20192396/applet.c.patch applet.c.patch http://www.nabble.com/file/p20192396/applet.h.patch applet.h.patch bjornrun wrote: Hello NetworkManager List! Here are some patches to networkmanager applet for MBM so technology used in connection is shown in applet. Note this uses the earlier patch in Modem-Manager. Regards, Bjorn @@ -316,6 +347,7 @@ char **tip, NMApplet *applet) { + NMAGsmModem *modem; GdkPixbuf *pixbuf = NULL; const char *iface; NMSettingConnection *s_con = NULL; @@ -335,16 +367,82 @@ *tip = g_strdup_printf (_(Waiting for user authentication on device '%s'...), iface); break; case NM_DEVICE_STATE_ACTIVATED: - if (s_con) { - const char *id; + modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), gsm-modem); + if (modem) { + char *oper_code; + char *oper_name; + guint32 reg_status; + guint32 quality; + guint32 network_mode; + + + quality = nma_gsm_modem_get_signal_quality (modem); + quality = CLAMP (quality, 0, 100); + network_mode = nma_gsm_modem_get_network_mode (modem); + + g_debug(quality = %d, net = %d, quality, network_mode); + + if (quality 80) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_100_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_100_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_100_E_icon; break; + default: + pixbuf = applet-wireless_100_icon; + } + } else if (quality 55) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_75_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_75_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_75_E_icon; break; + default: + pixbuf = applet-wireless_75_icon; + } + } else if (quality 30) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_50_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_50_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_50_E_icon; break; + default: + pixbuf = applet-wireless_50_icon; + } + } else if (quality 5) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_25_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_25_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_25_E_icon; break; + default: + pixbuf = applet-wireless_25_icon; + } + } else + pixbuf = applet-wireless_00_icon; + + reg_status = nma_gsm_modem_get_registration_info (modem, oper_code, oper_name); + *tip = g_strdup_printf (_(%s GSM connection '%s' (%d%%)), + reg_status == MM_GSM_MODEM_REG_STATUS_ROAMING ? _(Roaming) : _(Home), + oper_name, quality); + + g_free (oper_name); +
Re: [PATCH] nm-applet for MBM (Show technology)
Funny you ask. I just thought about that after I sent that email. I'm not sure there really is a standard way to represent HSDPA. Maybe having 3G symbol painted red. On Mon, 2008-10-27 at 21:03 +0100, Bjorn Runaker wrote: Hi Jerone, I'll probably change it. But what symbol to use for HSDPA? Regards, Bjorn 27 okt 2008 kl. 19.22 skrev Jerone Young: Havn't tried it yet. But I did notice you use a U for 3g . Why not just 3g like everyone else does it. On Mon, 2008-10-27 at 10:31 -0700, bjornrun wrote: Hello, I upload the patches instead. Regards, Bjorn http://www.nabble.com/file/p20192396/applet-device-gsm.c.patch applet-device-gsm.c.patch http://www.nabble.com/file/p20192396/applet.c.patch applet.c.patch http://www.nabble.com/file/p20192396/applet.h.patch applet.h.patch bjornrun wrote: Hello NetworkManager List! Here are some patches to networkmanager applet for MBM so technology used in connection is shown in applet. Note this uses the earlier patch in Modem-Manager. Regards, Bjorn @@ -316,6 +347,7 @@ char **tip, NMApplet *applet) { + NMAGsmModem *modem; GdkPixbuf *pixbuf = NULL; const char *iface; NMSettingConnection *s_con = NULL; @@ -335,16 +367,82 @@ *tip = g_strdup_printf (_(Waiting for user authentication on device '%s'...), iface); break; case NM_DEVICE_STATE_ACTIVATED: - if (s_con) { - const char *id; + modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), gsm-modem); + if (modem) { + char *oper_code; + char *oper_name; + guint32 reg_status; + guint32 quality; + guint32 network_mode; + + + quality = nma_gsm_modem_get_signal_quality (modem); + quality = CLAMP (quality, 0, 100); + network_mode = nma_gsm_modem_get_network_mode (modem); + + g_debug(quality = %d, net = %d, quality, network_mode); + + if (quality 80) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_100_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_100_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_100_E_icon; break; + default: + pixbuf = applet-wireless_100_icon; + } + } else if (quality 55) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_75_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_75_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_75_E_icon; break; + default: + pixbuf = applet-wireless_75_icon; + } + } else if (quality 30) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_50_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_50_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_50_E_icon; break; + default: + pixbuf = applet-wireless_50_icon; + } + } else if (quality 5) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_25_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_25_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_25_E_icon; break; + default: + pixbuf = applet-wireless_25_icon; + } + } else + pixbuf = applet-wireless_00_icon; + + reg_status = nma_gsm_modem_get_registration_info (modem, oper_code, oper_name); + *tip = g_strdup_printf (_(%s GSM connection '%s' (%d%%)), +reg_status == MM_GSM_MODEM_REG_STATUS_ROAMING ? _(Roaming) : _(Home), +oper_name, quality); + + g_free (oper_name); + g_free (oper_code); + + } else { + pixbuf = applet-wireless_00_icon; + *tip = g_strdup_printf (_(GSM connection)); + } - id = nm_setting_connection_get_id (s_con); - if (id) - *tip = g_strdup_printf (_(Mobile broadband connection '%s'), id); - } else - *tip = g_strdup (_(Mobile broadband connection)); - pixbuf = applet-wwan_icon; break; default: break; @@ -1974,6 +1965,21 @@ CLEAR_ICON(applet-wireless_50_icon); CLEAR_ICON(applet-wireless_75_icon); CLEAR_ICON(applet-wireless_100_icon); + CLEAR_ICON(applet-wireless_00_E_icon); + CLEAR_ICON(applet-wireless_25_E_icon); + CLEAR_ICON(applet-wireless_50_E_icon); + CLEAR_ICON(applet-wireless_75_E_icon); + CLEAR_ICON(applet-wireless_100_E_icon); + CLEAR_ICON(applet-wireless_00_U_icon); + CLEAR_ICON(applet-wireless_25_U_icon); + CLEAR_ICON(applet-wireless_50_U_icon); +
Re: [PATCH] nm-applet for MBM (Show technology)
On Mon, 2008-10-27 at 10:14 -0700, bjornrun wrote: Hello NetworkManager List! Here are some patches to networkmanager applet for MBM so technology used in connection is shown in applet. Note this uses the earlier patch in Modem-Manager. Hang on for a bit with these patches, we'll be switching over to ModemManager imminently and then we can start doing this sort of thing. But, for the icons, don't create completely new ones. Just create small badges (the same size as nm-vpn-active-lock.png) and then we'll just composite them on top of the existing icon in another layer. There's already a VPN layer, so we'll just add another for mobile broadband speeds. However, where would it go? The VPN lock already occupies the lower-right corner, so that can't be used. We can't cover up too much of the signal strength bars, otherwise it starts getting rediculous... we may want to hold off on speed icons until we redesign the applet UI. Dan Regards, Bjorn @@ -316,6 +347,7 @@ char **tip, NMApplet *applet) { + NMAGsmModem *modem; GdkPixbuf *pixbuf = NULL; const char *iface; NMSettingConnection *s_con = NULL; @@ -335,16 +367,82 @@ *tip = g_strdup_printf (_(Waiting for user authentication on device '%s'...), iface); break; case NM_DEVICE_STATE_ACTIVATED: - if (s_con) { - const char *id; + modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), gsm-modem); + if (modem) { + char *oper_code; + char *oper_name; + guint32 reg_status; + guint32 quality; + guint32 network_mode; + + + quality = nma_gsm_modem_get_signal_quality (modem); + quality = CLAMP (quality, 0, 100); + network_mode = nma_gsm_modem_get_network_mode (modem); + + g_debug(quality = %d, net = %d, quality, network_mode); + + if (quality 80) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_100_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_100_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_100_E_icon; break; + default: + pixbuf = applet-wireless_100_icon; + } + } else if (quality 55) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_75_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_75_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_75_E_icon; break; + default: + pixbuf = applet-wireless_75_icon; + } + } else if (quality 30) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_50_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_50_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_50_E_icon; break; + default: + pixbuf = applet-wireless_50_icon; + } + } else if (quality 5) { + switch (network_mode) { + case MM_MODEM_GSM_NETWORK_MODE_HSDPA: + pixbuf = applet-wireless_25_H_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_3G: + pixbuf = applet-wireless_25_U_icon; break; + case MM_MODEM_GSM_NETWORK_MODE_GPRS: + pixbuf = applet-wireless_25_E_icon; break; + default: + pixbuf = applet-wireless_25_icon; + } + } else + pixbuf =