@@ -2,24 +2,26 @@ using Granite.Widgets;
22
33namespace BookmarkManager {
44public class HeaderBar : Gtk .HeaderBar {
5+
6+ static HeaderBar ? instance;
57
68 StackManager stackManager = StackManager.get_instance ();
7- BookmarkListManager bookmarkListManager = BookmarkListManager .get_instance ();
9+ ListBox listBox = ListBox .get_instance ();
810 public Gtk . SearchEntry searchEntry = new Gtk .SearchEntry ();
9- Gtk . Button return_button = new Gtk .Button ();
11+ public Gtk . Button return_button = new Gtk .Button ();
1012 Gtk . Button add_button = new Gtk .Button .from_icon_name (" document-new" , Gtk . IconSize . LARGE_TOOLBAR );
1113 Gtk . MenuButton menu_button = new Gtk .MenuButton ();
1214
13- public HeaderBar (){
14-
15+ HeaderBar () {
1516 Granite . Widgets . Utils . set_color_primary (this , Constants . BRAND_COLOR );
1617
1718 searchEntry. set_placeholder_text(" Search Bookmarks" );
1819 searchEntry. set_tooltip_text(" Search for bookmarks" );
20+ searchEntry. sensitive = true ;
1921 searchEntry. search_changed. connect (() = > {
2022 showReturnButton(false );
2123 showAddButton(true );
22- bookmarkListManager . getList() . getBookmarks(searchEntry. text);
24+ listBox . getBookmarks(searchEntry. text);
2325 });
2426
2527 generateAddButton();
@@ -50,6 +52,13 @@ public class HeaderBar : Gtk.HeaderBar {
5052 this . pack_end (menu_button);
5153 this . pack_end (searchEntry);
5254 }
55+
56+ public static HeaderBar get_instance () {
57+ if (instance == null ) {
58+ instance = new HeaderBar ();
59+ }
60+ return instance;
61+ }
5362
5463 private void generateMenuButton (){
5564 menu_button. has_tooltip = true ;
@@ -75,7 +84,7 @@ public class HeaderBar : Gtk.HeaderBar {
7584 showReturnButton(false );
7685 showAddButton(true );
7786 stackManager. getStack(). visible_child_name = " list-view" ;
78- bookmarkListManager . getList() . getBookmarks(" " );
87+ listBox . getBookmarks(" " );
7988 });
8089 }
8190
0 commit comments