293
287
label_destroyed (gpointer data, GObject *label_ptr)
295
SpeedInfo *info = data;
289
LabelInfo *info = data;
296
291
/* Remove the notify handler from the device */
297
292
if (info->device) {
299
294
g_signal_handler_disconnect (info->device, info->id);
300
295
/* destroy our info data */
301
296
g_object_weak_unref (G_OBJECT (info->device), device_destroyed, info);
302
memset (info, 0, sizeof (SpeedInfo));
297
memset (info, 0, sizeof (LabelInfo));
303
label_info_new (NMDevice *device,
305
const char *notify_prop,
310
info = g_malloc0 (sizeof (LabelInfo));
311
info->device = device;
313
info->id = g_signal_connect (device, notify_prop, callback, label);
314
g_object_weak_ref (G_OBJECT (label), label_destroyed, info);
315
g_object_weak_ref (G_OBJECT (device), device_destroyed, info);
308
319
bitrate_changed_cb (GObject *device, GParamSpec *pspec, gpointer user_data)
310
321
GtkWidget *speed_label = GTK_WIDGET (user_data);
334
wimax_cinr_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
336
GtkWidget *label = GTK_WIDGET (user_data);
340
cinr = nm_device_wimax_get_cinr (NM_DEVICE_WIMAX (device));
342
str = g_strdup_printf (_("%d dB"), cinr);
344
gtk_label_set_text (GTK_LABEL (label), str ? str : C_("WiMAX CINR", "unknown"));
349
wimax_bsid_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
351
GtkWidget *label = GTK_WIDGET (user_data);
352
const char *str = NULL;
354
str = nm_device_wimax_get_bsid (NM_DEVICE_WIMAX (device));
356
str = C_("WiMAX Base Station ID", "unknown");
357
gtk_label_set_text (GTK_LABEL (label), str);
323
361
info_dialog_add_page (GtkNotebook *notebook,
324
362
NMConnection *connection,
325
363
gboolean is_default,
351
389
iface = nm_device_get_iface (device);
352
if (NM_IS_DEVICE_ETHERNET (device))
390
if (NM_IS_DEVICE_ETHERNET (device)) {
353
391
str = g_strdup_printf (_("Ethernet (%s)"), iface);
354
else if (NM_IS_DEVICE_WIFI (device))
392
show_security = TRUE;
393
} else if (NM_IS_DEVICE_WIFI (device)) {
355
394
str = g_strdup_printf (_("802.11 WiFi (%s)"), iface);
356
else if (NM_IS_GSM_DEVICE (device))
357
str = g_strdup_printf (_("GSM (%s)"), iface);
358
else if (NM_IS_CDMA_DEVICE (device))
359
str = g_strdup_printf (_("CDMA (%s)"), iface);
395
show_security = TRUE;
396
} else if (NM_IS_DEVICE_MODEM (device)) {
397
NMDeviceModemCapabilities caps;
399
caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
400
if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS)
401
str = g_strdup_printf (_("GSM (%s)"), iface);
402
else if (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)
403
str = g_strdup_printf (_("CDMA (%s)"), iface);
405
str = g_strdup_printf (_("Mobile Broadband (%s)"), iface);
406
} else if (NM_IS_DEVICE_WIMAX (device))
407
str = g_strdup_printf (_("WiMAX (%s)"), iface);
361
409
str = g_strdup (iface);
379
427
str = g_strdup (nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (device)));
380
428
else if (NM_IS_DEVICE_WIFI (device))
381
429
str = g_strdup (nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (device)));
430
else if (NM_IS_DEVICE_WIMAX (device))
431
str = g_strdup (nm_device_wimax_get_hw_address (NM_DEVICE_WIMAX (device)));
383
433
gtk_table_attach (table, create_info_label (_("Hardware Address:"), FALSE),
384
434
0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
405
455
/* Wireless speed in Kb/s */
406
456
speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (device)) / 1000;
408
/* Listen for wifi speed changes */
409
info = g_malloc0 (sizeof (SpeedInfo));
410
info->device = device;
411
info->label = speed_label;
412
info->id = g_signal_connect (device,
413
"notify::" NM_DEVICE_WIFI_BITRATE,
414
G_CALLBACK (bitrate_changed_cb),
417
g_object_weak_ref (G_OBJECT(speed_label), label_destroyed, info);
418
g_object_weak_ref (G_OBJECT(device), device_destroyed, info);
458
label_info_new (device,
460
"notify::" NM_DEVICE_WIFI_BITRATE,
461
G_CALLBACK (bitrate_changed_cb));
434
gtk_table_attach (table, create_info_label (_("Security:"), FALSE),
435
0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
436
gtk_table_attach (table, create_info_label_security (connection),
437
1, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
478
sec_label = create_info_label_security (connection);
480
gtk_table_attach (table, create_info_label (_("Security:"), FALSE),
481
0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
482
gtk_table_attach (table, sec_label,
483
1, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
488
if (NM_IS_DEVICE_WIMAX (device)) {
489
GtkWidget *bsid_label, *cinr_label;
492
cinr_label = create_info_label ("", TRUE);
493
gtk_table_attach (table, create_info_label (_("CINR:"), FALSE),
494
0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
495
gtk_table_attach (table, cinr_label,
496
1, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
497
label_info_new (device,
499
"notify::" NM_DEVICE_WIMAX_CINR,
500
G_CALLBACK (wimax_cinr_changed_cb));
501
wimax_cinr_changed_cb (device, NULL, cinr_label);
504
/* Base Station ID */
505
bsid_label = create_info_label ("", TRUE);
506
gtk_table_attach (table, create_info_label (_("BSID:"), FALSE),
507
0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
508
gtk_table_attach (table, bsid_label,
509
1, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
510
label_info_new (device,
512
"notify::" NM_DEVICE_WIMAX_BSID,
513
G_CALLBACK (wimax_bsid_changed_cb));
514
wimax_bsid_changed_cb (device, NULL, bsid_label);
441
519
gtk_table_attach (table, gtk_label_new (""), 0, 2, row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
769
845
gtk_box_pack_start (vbox, w, TRUE, TRUE, 0);
771
dev_str = g_strdup_printf ("<b>%s</b>", utils_get_device_description (device));
772
w = gtk_label_new (NULL);
773
gtk_label_set_markup (GTK_LABEL (w), dev_str);
775
gtk_box_pack_start (vbox, w, TRUE, TRUE, 0);
777
847
w = gtk_alignment_new (0.5, 0.5, 0, 1.0);
778
848
gtk_box_pack_start (vbox, w, TRUE, TRUE, 0);
1141
1211
builder = g_object_get_data (G_OBJECT (dialog), "builder");
1142
1212
g_return_if_fail (builder != NULL);
1144
spinner = nma_bling_spinner_new ();
1214
spinner = gtk_spinner_new ();
1145
1215
g_return_if_fail (spinner != NULL);
1146
1216
g_object_set_data (G_OBJECT (dialog), "spinner", spinner);
1148
1218
align = GTK_WIDGET (gtk_builder_get_object (builder, "spinner_alignment"));
1149
1219
gtk_container_add (GTK_CONTAINER (align), spinner);
1150
nma_bling_spinner_start (NMA_BLING_SPINNER (spinner));
1220
gtk_spinner_start (GTK_SPINNER (spinner));
1152
1222
widget = GTK_WIDGET (gtk_builder_get_object (builder, "progress_label"));
1153
1223
gtk_label_set_text (GTK_LABEL (widget), text);