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);
> > > > + CLEAR_ICON(applet->wireless_75_U_icon);
> > > > + CLEAR_ICON(applet->wireless_100_U_icon);
> > > > + CLEAR_ICON(applet->wireless_00_H_icon);
> > > > + CLEAR_ICON(applet->wireless_25_H_icon);
> > > > + CLEAR_ICON(applet->wireless_50_H_icon);
> > > > + CLEAR_ICON(applet->wireless_75_H_icon);
> > > > + CLEAR_ICON(applet->wireless_100_H_icon);
> > > > 
> > > > for (i = 0; i < NUM_CONNECTING_STAGES; i++) {
> > > > for (j = 0; j < NUM_CONNECTING_FRAMES; j++)
> > > > @@ -2021,6 +2027,21 @@
> > > > ICON_LOAD(applet->wireless_50_icon, "nm-signal-50");
> > > > ICON_LOAD(applet->wireless_75_icon, "nm-signal-75");
> > > > ICON_LOAD(applet->wireless_100_icon, "nm-signal-100");
> > > > + ICON_LOAD(applet->wireless_00_E_icon, "nm-signal-00-E");
> > > > + ICON_LOAD(applet->wireless_25_E_icon, "nm-signal-25-E");
> > > > + ICON_LOAD(applet->wireless_50_E_icon, "nm-signal-50-E");
> > > > + ICON_LOAD(applet->wireless_75_E_icon, "nm-signal-75-E");
> > > > + ICON_LOAD(applet->wireless_100_E_icon, "nm-signal-100-E");
> > > > + ICON_LOAD(applet->wireless_00_U_icon, "nm-signal-00-U");
> > > > + ICON_LOAD(applet->wireless_25_U_icon, "nm-signal-25-U");
> > > > + ICON_LOAD(applet->wireless_50_U_icon, "nm-signal-50-U");
> > > > + ICON_LOAD(applet->wireless_75_U_icon, "nm-signal-75-U");
> > > > + ICON_LOAD(applet->wireless_100_U_icon, "nm-signal-100-U");
> > > > + ICON_LOAD(applet->wireless_00_H_icon, "nm-signal-00-H");
> > > > + ICON_LOAD(applet->wireless_25_H_icon, "nm-signal-25-H");
> > > > + ICON_LOAD(applet->wireless_50_H_icon, "nm-signal-50-H");
> > > > + ICON_LOAD(applet->wireless_75_H_icon, "nm-signal-75-H");
> > > > + ICON_LOAD(applet->wireless_100_H_icon, "nm-signal-100-H");
> > > > 
> > > > for (i = 0; i < NUM_CONNECTING_STAGES; i++) {
> > > > for (j = 0; j < NUM_CONNECTING_FRAMES; j++) {
> > > > 
> > > > 
> > > > 
> > > > --- ../foss/network-manager-applet/svn/src/applet.h 2008-10-27
> > > > 04:58:11.000000000 -0700
> > > > +++ ../src/network-manager-applet/src/applet.h 2008-10-24
> > > > 07:04:35.000000000 -0700
> > > > @@ -109,6 +109,21 @@
> > > > GdkPixbuf * wireless_50_icon;
> > > > GdkPixbuf * wireless_75_icon;
> > > > GdkPixbuf * wireless_100_icon;
> > > > + GdkPixbuf * wireless_00_E_icon;
> > > > + GdkPixbuf * wireless_25_E_icon;
> > > > + GdkPixbuf * wireless_50_E_icon;
> > > > + GdkPixbuf * wireless_75_E_icon;
> > > > + GdkPixbuf * wireless_100_E_icon;
> > > > + GdkPixbuf * wireless_00_U_icon;
> > > > + GdkPixbuf * wireless_25_U_icon;
> > > > + GdkPixbuf * wireless_50_U_icon;
> > > > + GdkPixbuf * wireless_75_U_icon;
> > > > + GdkPixbuf * wireless_100_U_icon;
> > > > + GdkPixbuf * wireless_00_H_icon;
> > > > + GdkPixbuf * wireless_25_H_icon;
> > > > + GdkPixbuf * wireless_50_H_icon;
> > > > + GdkPixbuf * wireless_75_H_icon;
> > > > + GdkPixbuf * wireless_100_H_icon;
> > > > #define NUM_CONNECTING_STAGES 3
> > > > #define NUM_CONNECTING_FRAMES 11
> > > > GdkPixbuf * 
> > > > network_connecting_icons[NUM_CONNECTING_STAGES][NUM_CONNECTING_FRAMES];
> > > > @@ -215,4 +230,17 @@
> > > >                                                          NMApplet
> > > > *applet,
> > > > 
> > > > NMActiveConnection **out_active);
> > > > 
> > > > +
> > > > +typedef enum {
> > > > +  MM_MODEM_GSM_NETWORK_MODE_ANY       = 0,
> > > > +  MM_MODEM_GSM_NETWORK_MODE_GPRS      = 1,
> > > > +  MM_MODEM_GSM_NETWORK_MODE_EDGE      = 2,
> > > > +  MM_MODEM_GSM_NETWORK_MODE_3G        = 3,
> > > > +  MM_MODEM_GSM_NETWORK_MODE_HSDPA     = 4,
> > > > +  MM_MODEM_GSM_NETWORK_MODE_PREFER_2G = 5,
> > > > +  MM_MODEM_GSM_NETWORK_MODE_PREFER_3G = 6,
> > > > +
> > > > +    MM_MODEM_GSM_NETWORK_MODE_LAST =
> > > > MM_MODEM_GSM_NETWORK_MODE_PREFER_3G
> > > > +} MMModemGsmNetworkMode;
> > > > +
> > > > #endif
> > > > 
> > > > 
> > > > 
> > > > 
> > > > http://www.nabble.com/file/p20192060/nm-signal-00-E.png
> > > > nm-signal-00-E.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-00-U.png
> > > > nm-signal-00-U.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-00-H.png
> > > > nm-signal-00-H.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-25-E.png
> > > > nm-signal-25-E.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-25-H.png
> > > > nm-signal-25-H.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-25-U.png
> > > > nm-signal-25-U.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-50-E.png
> > > > nm-signal-50-E.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-50-H.png
> > > > nm-signal-50-H.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-50-U.png
> > > > nm-signal-50-U.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-75-E.png
> > > > nm-signal-75-E.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-75-H.png
> > > > nm-signal-75-H.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-75-U.png
> > > > nm-signal-75-U.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-100-E.png
> > > > nm-signal-100-E.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-100-H.png
> > > > nm-signal-100-H.png 
> > > > http://www.nabble.com/file/p20192060/nm-signal-100-U.png
> > > > nm-signal-100-U.png 
> > > > 
> > > > 
> > > > 
> > > 
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]