@@ -39,7 +39,7 @@ module gtk_app |
| 39 | 39 | public :: sniffly_app_run, sniffly_app_quit, sniffly_set_scan_path, & |
| 40 | 40 | sniffly_update_status, sniffly_show_error, breadcrumb_callback, & |
| 41 | 41 | sniffly_update_progress, sniffly_show_progress, sniffly_hide_progress, & |
| 42 | | - sniffly_update_status_bar_stats, get_forward_path |
| 42 | + sniffly_update_status_bar_stats, get_forward_path, update_ui_for_active_tab |
| 43 | 43 | |
| 44 | 44 | ! Application constants |
| 45 | 45 | character(len=*), parameter :: APP_ID = "org.fortrangoingonforty.sniffly" |
@@ -222,6 +222,10 @@ contains |
| 222 | 222 | end if |
| 223 | 223 | print *, "Created initial tab ", first_tab_index, " for: ", trim(scan_path) |
| 224 | 224 | |
| 225 | + ! TEMPORARY: Create a second tab for testing tab switching |
| 226 | + first_tab_index = create_tab(get_home_directory()) |
| 227 | + print *, "Created second tab for testing: ", trim(get_home_directory()) |
| 228 | + |
| 225 | 229 | ! Create main vertical box (toolbar + treemap) |
| 226 | 230 | main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0_c_int) |
| 227 | 231 | |
@@ -869,6 +873,58 @@ contains |
| 869 | 873 | call gtk_widget_set_sensitive(open_finder_btn_ptr, 1_c_int) |
| 870 | 874 | end subroutine update_selection_buttons |
| 871 | 875 | |
| 876 | + ! Update UI to reflect the active tab's state (called when switching tabs) |
| 877 | + subroutine update_ui_for_active_tab() |
| 878 | + use gtk, only: gtk_widget_queue_draw |
| 879 | + use types, only: file_node |
| 880 | + type(tab_state), pointer :: tab |
| 881 | + type(file_node), pointer :: current_view |
| 882 | + |
| 883 | + print *, "=== UPDATE_UI_FOR_ACTIVE_TAB ===" |
| 884 | + |
| 885 | + ! Get active tab |
| 886 | + tab => get_active_tab() |
| 887 | + if (.not. associated(tab)) then |
| 888 | + print *, "ERROR: No active tab" |
| 889 | + return |
| 890 | + end if |
| 891 | + |
| 892 | + print *, " Active tab index: ", active_tab_index |
| 893 | + print *, " Tab has_data: ", tab%has_data |
| 894 | + |
| 895 | + ! Only update if tab has data |
| 896 | + if (.not. tab%has_data) then |
| 897 | + print *, " Tab has no data yet - skipping UI update" |
| 898 | + return |
| 899 | + end if |
| 900 | + |
| 901 | + ! Get the current view node |
| 902 | + current_view => tab%current_view_node |
| 903 | + if (.not. associated(current_view)) then |
| 904 | + print *, "ERROR: Tab has_data=true but current_view_node not associated" |
| 905 | + return |
| 906 | + end if |
| 907 | + |
| 908 | + print *, " Updating breadcrumb for: ", trim(current_view%path) |
| 909 | + |
| 910 | + ! Update breadcrumb cache |
| 911 | + call update_breadcrumb_cache(trim(current_view%path)) |
| 912 | + |
| 913 | + ! Trigger treemap redraw |
| 914 | + if (c_associated(drawing_area_ptr)) then |
| 915 | + call gtk_widget_queue_draw(drawing_area_ptr) |
| 916 | + print *, " Triggered treemap redraw" |
| 917 | + end if |
| 918 | + |
| 919 | + ! Update navigation buttons |
| 920 | + call update_history_buttons() |
| 921 | + |
| 922 | + ! Update path entry |
| 923 | + call update_path_entry(trim(current_view%path)) |
| 924 | + |
| 925 | + print *, "=== UI UPDATE COMPLETE ===" |
| 926 | + end subroutine update_ui_for_active_tab |
| 927 | + |
| 872 | 928 | ! Helper: Add path to navigation history |
| 873 | 929 | subroutine add_to_history(path) |
| 874 | 930 | character(len=*), intent(in) :: path |