@@ -583,7 +583,7 @@ contains |
| 583 | selected_path = c_path(1:path_len) | 583 | selected_path = c_path(1:path_len) |
| 584 | print *, "Selected directory: ", trim(selected_path) | 584 | print *, "Selected directory: ", trim(selected_path) |
| 585 | | 585 | |
| 586 | - ! Update tab scan path (but don't scan yet) | 586 | + ! Update tab scan path |
| 587 | ! Remove trailing slash if present (C code doesn't like it) | 587 | ! Remove trailing slash if present (C code doesn't like it) |
| 588 | if (len_trim(selected_path) > 1 .and. & | 588 | if (len_trim(selected_path) > 1 .and. & |
| 589 | selected_path(len_trim(selected_path):len_trim(selected_path)) == '/') then | 589 | selected_path(len_trim(selected_path):len_trim(selected_path)) == '/') then |
@@ -595,7 +595,9 @@ contains |
| 595 | call set_scan_path(trim(tab%scan_path)) | 595 | call set_scan_path(trim(tab%scan_path)) |
| 596 | call update_path_entry(trim(tab%scan_path)) | 596 | call update_path_entry(trim(tab%scan_path)) |
| 597 | | 597 | |
| 598 | - print *, "Path updated. Click Scan button to scan: ", trim(tab%scan_path) | 598 | + ! Auto-start scan immediately after directory selection |
| | 599 | + call sniffly_update_status("Scanning...") |
| | 600 | + call trigger_rescan(tab%scan_path) |
| 599 | end if | 601 | end if |
| 600 | else | 602 | else |
| 601 | print *, "Directory selection cancelled" | 603 | print *, "Directory selection cancelled" |
@@ -2161,11 +2163,9 @@ contains |
| 2161 | normalized_path = trim(path) | 2163 | normalized_path = trim(path) |
| 2162 | end if | 2164 | end if |
| 2163 | | 2165 | |
| 2164 | - ! Process pending GTK events before starting scan | 2166 | + ! Process pending GTK events once before starting scan (minimal delay) |
| 2165 | context = g_main_context_default() | 2167 | context = g_main_context_default() |
| 2166 | - do i = 1, 10 | 2168 | + do while (g_main_context_iteration(context, 0_c_int) /= 0_c_int) |
| 2167 | - do while (g_main_context_iteration(context, 0_c_int) /= 0_c_int) | | |
| 2168 | - end do | | |
| 2169 | end do | 2169 | end do |
| 2170 | | 2170 | |
| 2171 | print *, "=== ABOUT TO CALL scan_directory ===" | 2171 | print *, "=== ABOUT TO CALL scan_directory ===" |
@@ -2177,10 +2177,8 @@ contains |
| 2177 | call update_cancel_scan_button_state() | 2177 | call update_cancel_scan_button_state() |
| 2178 | call update_history_buttons() | 2178 | call update_history_buttons() |
| 2179 | | 2179 | |
| 2180 | - ! Process events after scan to update UI | 2180 | + ! Process events once after scan to update UI |
| 2181 | - do i = 1, 10 | 2181 | + do while (g_main_context_iteration(context, 0_c_int) /= 0_c_int) |
| 2182 | - do while (g_main_context_iteration(context, 0_c_int) /= 0_c_int) | | |
| 2183 | - end do | | |
| 2184 | end do | 2182 | end do |
| 2185 | | 2183 | |
| 2186 | ! Invalidate layout to force recalculation | 2184 | ! Invalidate layout to force recalculation |