diff --git a/source/ubinstall-gtk-bootloader.c b/source/ubinstall-gtk-bootloader.c index 395e6af..0ce552e 100644 --- a/source/ubinstall-gtk-bootloader.c +++ b/source/ubinstall-gtk-bootloader.c @@ -280,11 +280,10 @@ yon_menu_window *yon_menu_window_open(GtkWidget *, main_window *widgets){ gtk_window_get_position(GTK_WINDOW(widgets->MainWindow),&x,&y); gtk_window_move(GTK_WINDOW(window->MenuWindow),window->button_pos_x-width,window->button_pos_y); gtk_widget_show(window->MenuWindow); - GdkGrabStatus status = GDK_GRAB_SUCCESS; - // GdkGrabStatus status = gdk_seat_grab(gdk_display_get_default_seat(gdk_display_get_default()),gtk_widget_get_window(window->MenuWindow),GDK_SEAT_CAPABILITY_POINTER,TRUE,NULL,NULL,NULL,NULL); + GdkGrabStatus status = gdk_seat_grab(gdk_display_get_default_seat(gdk_display_get_default()),gtk_widget_get_window(window->MenuWindow),GDK_SEAT_CAPABILITY_POINTER,TRUE,NULL,NULL,NULL,NULL); if (status != GDK_GRAB_SUCCESS) { window->seat_grab=0; - // gtk_grab_add(window->MenuWindow); + gtk_grab_add(window->MenuWindow); } else { window->seat_grab=1; } diff --git a/source/ubinstall-gtk-source.c b/source/ubinstall-gtk-source.c index eeb1957..17cb9ad 100644 --- a/source/ubinstall-gtk-source.c +++ b/source/ubinstall-gtk-source.c @@ -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); }