@@ -41,26 +41,25 @@ public class Layouts.FilterPaneRow : Gtk.FlowBoxChild {
4141 add_css_class (" card" );
4242 add_css_class (" filter-pane-row" );
4343
44- title_image = new Gtk .Image ( ) {
44+ title_image = new Gtk .Image .from_icon_name (filter_type . get_icon () ) {
4545 margin_start = 3
4646 };
4747
48- title_label = new Gtk .Label (null ) {
48+ title_label = new Gtk .Label (filter_type . get_name () ) {
4949 hexpand = true ,
5050 halign = Gtk . Align . START ,
51- margin_start = 3
51+ margin_start = 3 ,
52+ css_classes = { " font-bold" },
53+ ellipsize = Pango . EllipsizeMode . END
5254 };
53- title_label. ellipsize = Pango . EllipsizeMode . END ;
54- title_label. add_css_class (" font-bold" );
5555
5656 count_label = new Gtk .Label (null ) {
5757 hexpand = true ,
5858 halign = Gtk . Align . END ,
59- margin_end = 3
59+ margin_end = 3 ,
60+ css_classes = { " font-bold" }
6061 };
6162
62- count_label. add_css_class (" font-bold" );
63-
6463 var count_revealer = new Gtk .Revealer () {
6564 transition_type = Gtk . RevealerTransitionType . CROSSFADE ,
6665 child = count_label
@@ -80,13 +79,11 @@ public class Layouts.FilterPaneRow : Gtk.FlowBoxChild {
8079 main_grid. attach (title_label, 0 , 1 , 2 , 2 );
8180
8281 child = main_grid;
83- build_filter_data ( );
82+ Util . get_default () . set_widget_color (filter_type . get_color (), this );
8483 Services . Settings . get_default (). settings. bind (" show-tasks-count" , count_revealer, " reveal_child" , GLib . SettingsBindFlags . DEFAULT );
8584
8685 var select_gesture = new Gtk .GestureClick ();
87- select_gesture. set_button (1 );
8886 add_controller (select_gesture);
89-
9087 select_gesture. pressed. connect (() = > {
9188 Services . EventBus . get_default (). pane_selected (PaneType . FILTER , filter_type. to_string ());
9289 });
@@ -108,34 +105,6 @@ public class Layouts.FilterPaneRow : Gtk.FlowBoxChild {
108105 });
109106 }
110107
111- private void build_filter_data () {
112- if (filter_type == FilterType . TODAY ) {
113- title_label. label = _(" Today" );
114- title_image. icon_name = " star-outline-thick-symbolic" ;
115- Util . get_default (). set_widget_color (" #33d17a" , this );
116- } else if (filter_type == FilterType . INBOX ) {
117- title_label. label = _(" Inbox" );
118- title_image. icon_name = " mailbox-symbolic" ;
119- Util . get_default (). set_widget_color (" #3584e4" , this );
120- } else if (filter_type == FilterType . SCHEDULED ) {
121- title_label. label = _(" Scheduled" );
122- title_image. icon_name = " month-symbolic" ;
123- Util . get_default (). set_widget_color (" #9141ac" , this );
124- } else if (filter_type == FilterType . PINBOARD ) {
125- title_label. label = _(" Pinboard" );
126- title_image. icon_name = " pin-symbolic" ;
127- Util . get_default (). set_widget_color (" #ed333b" , this );
128- } else if (filter_type == FilterType . LABELS ) {
129- title_label. label = _(" Labels" );
130- title_image. icon_name = " tag-outline-symbolic" ;
131- Util . get_default (). set_widget_color (" #986a44" , this );
132- } else if (filter_type == FilterType . COMPLETED ) {
133- title_label. label = _(" Completed" );
134- title_image. icon_name = " check-round-outline-symbolic" ;
135- Util . get_default (). set_widget_color (" #ff7800" , this );
136- }
137- }
138-
139108 private void update_count_label (int count ) {
140109 count_label. label = count <= 0 ? " " : count. to_string ();
141110 }
@@ -182,8 +151,7 @@ public class Layouts.FilterPaneRow : Gtk.FlowBoxChild {
182151 }
183152
184153 public int item_order () {
185- var views_order = Services . Settings . get_default (). settings. get_strv (" views-order-visible" );
186- return find_index (views_order, filter_type. to_string ());
154+ return find_index (Services . Settings . get_default (). settings. get_strv (" views-order-visible" ), filter_type. to_string ());
187155 }
188156
189157 public bool active () {
0 commit comments