From 9ec9a52f007056d95555c5f9f18d81bb280104a8 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 16 Oct 2024 15:48:40 +0200
Subject: [PATCH] browser.py: Update topbar design.

---
 browser.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/browser.py b/browser.py
index 92bd4c1..dd83eca 100755
--- a/browser.py
+++ b/browser.py
@@ -962,7 +962,7 @@ class MainWindow(Gtk.Window):
     """Image browser app top-level window."""
     metadata: Gtk.TextBuffer
     prev_key: list
-    counter: Gtk.Label
+    topbar: Gtk.Label
 
     def __init__(self, app, **kwargs):
         super().__init__(**kwargs)
@@ -970,9 +970,9 @@ class MainWindow(Gtk.Window):
 
         def init_navbar():
             navbar = Gtk.Box(orientation=OR_H)
-            self.counter = Gtk.Label()
-            navbar.append(self.counter)
             _add_button(navbar, 'sidebar', lambda _: self.toggle_side_box())
+            self.topbar = Gtk.Label()
+            navbar.append(self.topbar)
             return navbar
 
         def init_metadata_box():
@@ -1084,7 +1084,7 @@ class MainWindow(Gtk.Window):
         self.gallery.on_resize(self.get_width() - side_box_width)
 
     def update_metadata_on_gallery_selection(self):
-        """Update .metadata about individual file, .counter on its idx/total"""
+        """Update .metadata about individual file, .topbar also on idx/total"""
         self.metadata.set_text('')
         selected_item = self.gallery.selected_item
         if selected_item:
@@ -1097,7 +1097,10 @@ class MainWindow(Gtk.Window):
                         '\n'.join([title, bookmarked] + params_strs))
         total = len([s for s in self.gallery.slots
                      if isinstance(s.item, (DirItem, ImgItem))])
-        self.counter.set_text(f' {self.gallery.selected_idx + 1} of {total} ')
+        n_selected = self.gallery.selected_idx + 1
+        txt = f' {n_selected} of {total} – <b>{selected_item.full_path}</b>'
+        self.topbar.set_text(txt)
+        self.topbar.set_use_markup(True)
 
     def handle_keypress(self, keyval):
         """Handle keys if not in Gtk.Entry, return True if key handling done"""
-- 
2.30.2