Skip to content

Commit

Permalink
Handle own titlebuttons
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Mar 1, 2024
1 parent 5bf3256 commit 5914b7b
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ config_file = configure_file(
configuration: config_data
)

adw_dep = dependency('libadwaita-1', version: '>=1.4')

subdir('data')
subdir('src')
subdir('po')
4 changes: 0 additions & 4 deletions src/Widgets/AppEntry.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ public class Widgets.AppEntry : Gtk.ListBoxRow {
};

var grid = new Gtk.Grid () {
margin_start = 6,
margin_end = 6,
margin_top = 6,
margin_bottom = 6,
column_spacing = 6
};
grid.attach (image, 0, 0, 1, 2);
Expand Down
1 change: 1 addition & 0 deletions src/Widgets/AppSettingsView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class Widgets.AppSettingsView : Switchboard.SettingsPage {
box.append (remember_option);

child = box;
show_end_title_buttons = true;

update_selected_app ();

Expand Down
33 changes: 26 additions & 7 deletions src/Widgets/Sidebar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,20 @@ public class Widgets.Sidebar : Gtk.Box {
hexpand = true
};

var search_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
search_box.add_css_class (Granite.STYLE_CLASS_VIEW);
search_box.append (search_entry);
var search_revealer = new Gtk.Revealer () {
child = search_entry
};

var search_toggle = new Gtk.ToggleButton () {
icon_name = "edit-find-symbolic",
tooltip_text = _("Search Apps")
};

var headerbar = new Adw.HeaderBar () {
show_end_title_buttons = false,
show_title = false
};
headerbar.pack_end (search_toggle);

var app_list = new Gtk.ListBox () {
hexpand = true,
Expand Down Expand Up @@ -65,17 +76,25 @@ public class Widgets.Sidebar : Gtk.Box {
footer.pack_start (do_not_disturb_label);
footer.pack_end (do_not_disturb_switch);

orientation = Gtk.Orientation.VERTICAL;
append (search_box);
append (scrolled_window);
append (footer);
var toolbarview = new Adw.ToolbarView () {
content = scrolled_window,
top_bar_style = FLAT
};
toolbarview.add_top_bar (headerbar);
toolbarview.add_top_bar (search_revealer);
toolbarview.add_bottom_bar (footer);
toolbarview.add_css_class (Granite.STYLE_CLASS_SIDEBAR);

append (toolbarview);

app_list.row_selected.connect (show_row);

search_entry.search_changed.connect (() => {
app_list.invalidate_filter ();
});

search_toggle.bind_property ("active", search_revealer, "reveal-child");

NotificationsPlug.notify_settings.bind (
"do-not-disturb",
app_list,
Expand Down
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ shared_module(
config_file,
plug_resources,
dependencies: [
adw_dep,
dependency('glib-2.0'),
dependency('gio-2.0'),
dependency('gobject-2.0'),
Expand Down

0 comments on commit 5914b7b

Please sign in to comment.