4343from .files import PortfolioFiles
4444from .menu import PortfolioMenu
4545from .settings import PortfolioSettings
46- from .bookmarks import PortfolioBookmarks
46+ from .bookmarks import PortfolioBookmarks , PortfolioBookmarkButton
4747from .trash import default_trash
4848
4949
@@ -62,7 +62,7 @@ class PortfolioWindow(Adw.ApplicationWindow):
6262 paste = Gtk .Template .Child ()
6363 select_all = Gtk .Template .Child ()
6464 select_none = Gtk .Template .Child ()
65- bookmark = Gtk .Template .Child ()
65+ bookmark_box = Gtk .Template .Child ()
6666 new_folder = Gtk .Template .Child ()
6767 delete_trash = Gtk .Template .Child ()
6868 restore_trash = Gtk .Template .Child ()
@@ -150,7 +150,7 @@ def _setup(self):
150150 self .select_all .connect ("clicked" , self ._on_select_all )
151151 self .select_none .connect ("clicked" , self ._on_select_none )
152152 self .new_folder .connect ("clicked" , self ._on_new_folder )
153- self . bookmark . connect ( "clicked" , self . _on_bookmark_toggle )
153+
154154 self .close_button .connect ("clicked" , self ._on_button_closed )
155155 self .go_top_button .connect ("clicked" , self ._go_to_top )
156156 self .stop_button .connect ("clicked" , self ._on_stop_clicked )
@@ -185,6 +185,10 @@ def _setup(self):
185185 self .files .sort_order = self ._settings .sort_order
186186 self .content_inner_box .append (self .files )
187187 self ._bookmarks = PortfolioBookmarks ()
188+
189+ self ._bookmark_button = PortfolioBookmarkButton (self ._bookmarks )
190+ self .bookmark_box .append (self ._bookmark_button )
191+
188192 places = PortfolioPlaces (self ._bookmarks )
189193 places .connect ("updated" , self ._on_places_updated )
190194 places .connect ("removing" , self ._on_places_removing )
@@ -227,11 +231,8 @@ def _populate(self, directory):
227231 self ._worker .connect ("finished" , self ._on_load_finished )
228232 self ._worker .connect ("failed" , self ._on_load_failed )
229233 self ._worker .start ()
234+ self ._bookmark_button .path = directory
230235
231- if self ._bookmarks .is_bookmarked (directory ):
232- self .bookmark .props .icon_name = "bookmark-filled-symbolic"
233- else :
234- self .bookmark .props .icon_name = "bookmark-outline-symbolic"
235236
236237 def _paste (self , Worker , to_paste ):
237238 directory = self ._history [self ._index ]
@@ -867,14 +868,6 @@ def _on_new_folder(self, button):
867868 directory = self ._history [self ._index ]
868869 self .files .add_new_folder_row (directory )
869870
870- def _on_bookmark_toggle (self , button ):
871- path = self ._history [self ._index ]
872- self ._bookmarks .toggle_bookmark (button , path )
873- if self ._bookmarks .is_bookmarked (path ):
874- self .bookmark .props .icon_name = "bookmark-filled-symbolic"
875- else :
876- self .bookmark .props .icon_name = "bookmark-outline-symbolic"
877-
878871 def _on_restore_trash_clicked (self , button ):
879872 selection = self .files .get_selection ()
880873 paths = [default_trash .get_orig_path (path ) for path , ref in selection ]
0 commit comments