@ -90,6 +90,11 @@ void yon_source_update(source_window *window){
void on_source_add ( GtkWidget * , source_window * window ) {
const char * path = gtk_widget_get_visible ( window - > PathEntry ) ? gtk_entry_get_text ( GTK_ENTRY ( window - > PathEntry ) ) : gtk_combo_box_text_get_active_text ( GTK_COMBO_BOX_TEXT ( window - > DeviceCombo ) ) ;
if ( yon_char_is_empty ( path ) ) {
yon_ubl_status_box_spawn ( GTK_CONTAINER ( window - > StatusBox ) , EMPTY_IMPORTANT_LABEL , 5 , BACKGROUND_IMAGE_FAIL_TYPE ) ;
yon_ubl_status_highlight_incorrect ( gtk_widget_get_visible ( window - > PathEntry ) ? window - > PathEntry : window - > DeviceCombo ) ;
return ;
}
if ( ! yon_dictionary_get ( & window - > sources , ( char * ) path ) ) {
yon_dictionary_add_or_create_if_exists_with_data ( window - > sources , yon_char_new ( path ) , NULL ) ;
gtk_entry_set_text ( GTK_ENTRY ( window - > PathEntry ) , " " ) ;
@ -170,6 +175,11 @@ void on_source_accept(GtkWidget *,source_window *window){
} break ;
case 1 : {
char * cur = ( char * ) gtk_entry_get_text ( GTK_ENTRY ( element - > PathEntry ) ) ;
if ( yon_char_is_empty ( cur ) ) {
yon_ubl_status_box_spawn ( GTK_CONTAINER ( window - > StatusBox ) , EMPTY_IMPORTANT_LABEL , 5 , BACKGROUND_IMAGE_FAIL_TYPE ) ;
yon_ubl_status_highlight_incorrect ( element - > PathEntry ) ;
return ;
}
if ( yon_char_check_element ( sources_list , cur , " , " ) ) {
yon_ubl_status_box_spawn ( GTK_CONTAINER ( window - > StatusBox ) , VALUE_REPEAT_LABEL , 5 , BACKGROUND_IMAGE_FAIL_TYPE ) ;
yon_ubl_status_highlight_incorrect ( element - > DeviceCombo ) ;
@ -200,22 +210,22 @@ void on_source_accept(GtkWidget *,source_window *window){
int size ;
config_str paths = NULL ;
dictionary * dict ;
if ( ! window - > sources ) return ;
for_dictionaries ( dict , window - > sources ) {
if ( yon_char_parsed_check_exist ( paths , size , dict - > key ) > - 1 ) {
yon_ubl_status_box_spawn ( GTK_CONTAINER ( window - > StatusBox ) , VALUE_REPEAT_LABEL , 5 , BACKGROUND_IMAGE_FAIL_TYPE ) ;
if ( window - > sources ) {
for_dictionaries ( dict , window - > sources ) {
if ( yon_char_parsed_check_exist ( paths , size , dict - > key ) > - 1 ) {
yon_ubl_status_box_spawn ( GTK_CONTAINER ( window - > StatusBox ) , VALUE_REPEAT_LABEL , 5 , BACKGROUND_IMAGE_FAIL_TYPE ) ;
return ;
}
yon_char_parsed_add_or_create_if_exists ( paths , & size , dict - > key ) ;
}
if ( ! size ) {
yon_ubl_status_box_spawn ( GTK_CONTAINER ( window - > StatusBox ) , EMPTY_IMPORTANT_LABEL , 5 , BACKGROUND_IMAGE_FAIL_TYPE ) ;
yon_ubl_status_highlight_incorrect ( window - > PathEntry ) ;
return ;
}
yon_char_parsed_add_or_create_if_exists ( paths , & size , dict - > key ) ;
}
if ( ! size ) {
yon_ubl_status_box_spawn ( GTK_CONTAINER ( window - > StatusBox ) , EMPTY_IMPORTANT_LABEL , 5 , BACKGROUND_IMAGE_FAIL_TYPE ) ;
yon_ubl_status_highlight_incorrect ( window - > PathEntry ) ;
return ;
}
char * parameter_string = yon_char_parsed_to_string ( paths , ( int ) size , " , " ) ;
free ( parameter_string ) ;
on_subwindow_close ( window - > Window ) ;
if ( ! yon_char_is_empty ( parameter_string ) ) free ( parameter_string ) ;
if ( ! main_config . configure_mode ) {
int size ;
@ -229,6 +239,7 @@ void on_source_accept(GtkWidget *,source_window *window){
}
}
yon_dictionary_free_all ( window - > sources , NULL ) ;
on_subwindow_close ( window - > Window ) ;
free ( window ) ;
}