@@ -646,8 +646,7 @@ const char * osc_plot_get_active_device (OscPlot *plot)
646
646
while (next_iter ) {
647
647
gtk_tree_model_get (model , & iter , ELEMENT_REFERENCE , & dev , DEVICE_ACTIVE , & active , -1 );
648
648
if (active )
649
- return iio_device_get_name (dev ) ?:
650
- iio_device_get_id (dev );
649
+ return get_iio_device_label_or_name (dev );
651
650
next_iter = gtk_tree_model_iter_next (model , & iter );
652
651
}
653
652
@@ -2361,9 +2360,7 @@ static int plot_get_sample_count_for_transform(OscPlot *plot, Transform *transfo
2361
2360
if (!iio_dev )
2362
2361
iio_dev = priv -> current_device ;
2363
2362
2364
- return plot_get_sample_count_of_device (plot ,
2365
- iio_device_get_name (iio_dev ) ?:
2366
- iio_device_get_id (iio_dev ));
2363
+ return plot_get_sample_count_of_device (plot , get_iio_device_label_or_name (iio_dev ));
2367
2364
}
2368
2365
2369
2366
static void notebook_info_set_page_visibility (GtkNotebook * nb , int page , bool visbl )
@@ -2750,7 +2747,7 @@ static void collect_parameters_from_plot(OscPlot *plot)
2750
2747
for (i = 0 ; i < iio_context_get_devices_count (ctx ); i ++ ) {
2751
2748
struct iio_device * dev = iio_context_get_device (ctx , i );
2752
2749
struct extra_dev_info * info = iio_device_get_data (dev );
2753
- const char * dev_name = iio_device_get_name ( dev ) ?: iio_device_get_id (dev );
2750
+ const char * dev_name = get_iio_device_label_or_name (dev );
2754
2751
2755
2752
if (info -> input_device == false)
2756
2753
continue ;
@@ -2998,7 +2995,7 @@ static void device_rx_info_update(OscPlotPrivate *priv)
2998
2995
2999
2996
for (i = 0 ; i < num_devices ; i ++ ) {
3000
2997
struct iio_device * dev = iio_context_get_device (priv -> ctx , i );
3001
- const char * name = iio_device_get_name ( dev ) ?: iio_device_get_id (dev );
2998
+ const char * name = get_iio_device_label_or_name (dev );
3002
2999
struct extra_dev_info * dev_info = iio_device_get_data (dev );
3003
3000
double freq , percent , seconds ;
3004
3001
char freq_prefix , sec_prefix ;
@@ -3479,7 +3476,7 @@ static bool comboboxtext_input_devices_fill(struct iio_context *iio_ctx, GtkComb
3479
3476
if (dev_info -> input_device == false)
3480
3477
continue ;
3481
3478
3482
- name = iio_device_get_name ( dev ) ?: iio_device_get_id (dev );
3479
+ name = get_iio_device_label_or_name (dev );
3483
3480
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (box ), name );
3484
3481
}
3485
3482
@@ -3919,8 +3916,7 @@ static void device_list_treeview_init(OscPlot *plot)
3919
3916
for (i = 0 ; i < iio_context_get_devices_count (ctx ); i ++ ) {
3920
3917
struct iio_device * dev = iio_context_get_device (ctx , i );
3921
3918
struct extra_dev_info * dev_info = iio_device_get_data (dev );
3922
- const char * dev_name = iio_device_get_name (dev ) ?:
3923
- iio_device_get_id (dev );
3919
+ const char * dev_name = get_iio_device_label_or_name (dev );
3924
3920
3925
3921
if (dev_info -> input_device == false)
3926
3922
continue ;
@@ -4029,8 +4025,7 @@ static void saveas_channels_list_fill(OscPlot *plot)
4029
4025
4030
4026
for (i = 0 ; i < num_devices ; i ++ ) {
4031
4027
struct iio_device * dev = iio_context_get_device (priv -> ctx , i );
4032
- const char * name = iio_device_get_name (dev ) ?:
4033
- iio_device_get_id (dev );
4028
+ const char * name = get_iio_device_label_or_name (dev );
4034
4029
struct extra_dev_info * dev_info = iio_device_get_data (dev );
4035
4030
4036
4031
if (dev_info -> input_device == false)
@@ -4722,8 +4717,7 @@ static void save_as(OscPlot *plot, const char *filename, int type)
4722
4717
4723
4718
dev = iio_context_get_device (ctx , d );
4724
4719
dev_info = iio_device_get_data (dev );
4725
- dev_name = iio_device_get_name (dev ) ?:
4726
- iio_device_get_id (dev );
4720
+ dev_name = get_iio_device_label_or_name (dev );
4727
4721
4728
4722
/* Find which channel need to be saved */
4729
4723
save_channels_mask = get_user_saveas_channel_selection (plot , & nb_channels );
@@ -5228,8 +5222,7 @@ static int device_find_by_name(struct iio_context *ctx, const char *name)
5228
5222
5229
5223
for (i = 0 ; i < num_devices ; i ++ ) {
5230
5224
struct iio_device * dev = iio_context_get_device (ctx , i );
5231
- const char * id = iio_device_get_name (dev ) ?:
5232
- iio_device_get_id (dev );
5225
+ const char * id = get_iio_device_label_or_name (dev );
5233
5226
if (!strcmp (id , name ))
5234
5227
return i ;
5235
5228
}
0 commit comments