fortrangoingonforty/sniffly / da6bc7d

Browse files

add blue accent to open-dir button for empty tabs

Authored by espadonne
SHA
da6bc7d0f8401f58db4ac161282c1d34ab2e6e8b
Parents
54ad479
Tree
c3f679b

1 changed file

StatusFile+-
M src/gui/gtk_app.f90 22 2
src/gui/gtk_app.f90modified
@@ -81,6 +81,9 @@ module gtk_app
81
   type(c_ptr), save :: open_finder_btn_ptr = c_null_ptr
81
   type(c_ptr), save :: open_finder_btn_ptr = c_null_ptr
82
   type(c_ptr), save :: delete_btn_ptr = c_null_ptr
82
   type(c_ptr), save :: delete_btn_ptr = c_null_ptr
83
 
83
 
84
+  ! Open directory button pointer (for pulsing on empty tabs)
85
+  type(c_ptr), save :: open_dir_btn_ptr = c_null_ptr
86
+
84
   ! Drawing area pointer (for redrawing treemap)
87
   ! Drawing area pointer (for redrawing treemap)
85
   type(c_ptr), save :: drawing_area_ptr = c_null_ptr
88
   type(c_ptr), save :: drawing_area_ptr = c_null_ptr
86
 
89
 
@@ -139,6 +142,7 @@ contains
139
     back_btn_ptr = c_null_ptr
142
     back_btn_ptr = c_null_ptr
140
     forward_btn_ptr = c_null_ptr
143
     forward_btn_ptr = c_null_ptr
141
     cancel_scan_btn_ptr = c_null_ptr
144
     cancel_scan_btn_ptr = c_null_ptr
145
+    open_dir_btn_ptr = c_null_ptr
142
   end subroutine sniffly_app_quit
146
   end subroutine sniffly_app_quit
143
 
147
 
144
   ! Set the directory path to scan (call before sniffly_app_run)
148
   ! Set the directory path to scan (call before sniffly_app_run)
@@ -170,6 +174,7 @@ contains
170
     path_entry_ptr = c_null_ptr
174
     path_entry_ptr = c_null_ptr
171
     back_btn_ptr = c_null_ptr
175
     back_btn_ptr = c_null_ptr
172
     forward_btn_ptr = c_null_ptr
176
     forward_btn_ptr = c_null_ptr
177
+    open_dir_btn_ptr = c_null_ptr
173
     main_window_ptr = c_null_ptr
178
     main_window_ptr = c_null_ptr
174
 
179
 
175
     ! Return FALSE (0) to allow the window to close
180
     ! Return FALSE (0) to allow the window to close
@@ -233,6 +238,7 @@ contains
233
 
238
 
234
     ! Create Open Directory button with folder icon
239
     ! Create Open Directory button with folder icon
235
     open_dir_btn = gtk_button_new()
240
     open_dir_btn = gtk_button_new()
241
+    open_dir_btn_ptr = open_dir_btn  ! Store for later access (pulsing on empty tabs)
236
     call gtk_button_set_icon_name(open_dir_btn, "folder-open"//c_null_char)
242
     call gtk_button_set_icon_name(open_dir_btn, "folder-open"//c_null_char)
237
     call gtk_widget_set_tooltip_text(open_dir_btn, "Open Directory (Ctrl+O)"//c_null_char)
243
     call gtk_widget_set_tooltip_text(open_dir_btn, "Open Directory (Ctrl+O)"//c_null_char)
238
     call g_signal_connect(open_dir_btn, "clicked"//c_null_char, &
244
     call g_signal_connect(open_dir_btn, "clicked"//c_null_char, &
@@ -896,12 +902,26 @@ contains
896
     print *, "  Active tab index: ", active_tab_index
902
     print *, "  Active tab index: ", active_tab_index
897
     print *, "  Tab has_data: ", tab%has_data
903
     print *, "  Tab has_data: ", tab%has_data
898
 
904
 
899
-    ! Only update if tab has data
905
+    ! Check if tab has data
900
     if (.not. tab%has_data) then
906
     if (.not. tab%has_data) then
901
-      print *, "  Tab has no data yet - skipping UI update"
907
+      print *, "  Tab has no data yet - showing empty tab UI"
908
+
909
+      ! Add blue suggested-action class to open-dir button to draw attention
910
+      if (c_associated(open_dir_btn_ptr)) then
911
+        call gtk_widget_add_css_class(open_dir_btn_ptr, "suggested-action"//c_null_char)
912
+      end if
913
+
914
+      ! Update status bar to guide user
915
+      call sniffly_update_status("No directory selected - click the folder icon to choose a directory")
916
+
902
       return
917
       return
903
     end if
918
     end if
904
 
919
 
920
+    ! Tab has data - remove suggested-action class from open-dir button
921
+    if (c_associated(open_dir_btn_ptr)) then
922
+      call gtk_widget_remove_css_class(open_dir_btn_ptr, "suggested-action"//c_null_char)
923
+    end if
924
+
905
     ! Get the current view node
925
     ! Get the current view node
906
     current_view => tab%current_view_node
926
     current_view => tab%current_view_node
907
     if (.not. associated(current_view)) then
927
     if (.not. associated(current_view)) then