mirror of
https://gitlab.com/liyaowhen/youtubecollector-git.git
synced 2026-10-01 01:12:59 +00:00
ui redesign, still wip
This commit is contained in:
+37
-10
@@ -21,7 +21,37 @@ namespace Song {
|
||||
scrollable.hexpand = true;
|
||||
scrollable.hexpand_set = true;
|
||||
|
||||
var action_bar = new MainViewActionBar (main_content);
|
||||
var collapse_button_revealer = new Gtk.Revealer();
|
||||
var collapse_button = new Gtk.Button.from_icon_name ("folder-symbolic");
|
||||
|
||||
collapse_button.valign = Gtk.Align.CENTER;
|
||||
collapse_button_revealer.set_child(collapse_button);
|
||||
collapse_button_revealer.transition_type = Gtk.RevealerTransitionType.SLIDE_RIGHT;
|
||||
var action_bar = new Adw.HeaderBar();
|
||||
action_bar.show_back_button = false;
|
||||
action_bar.title_widget = new YtSearchBar();
|
||||
action_bar.pack_start(collapse_button_revealer);
|
||||
collapse_button.clicked.connect(() => {
|
||||
if(SongController.split_view.get_collapsed ()){
|
||||
SongController.split_view.set_collapsed (false);
|
||||
collapse_button_revealer.set_reveal_child(false);
|
||||
} else {
|
||||
SongController.split_view.set_collapsed(true);
|
||||
action_bar.margin_start = -5;
|
||||
}
|
||||
});
|
||||
|
||||
Timeout.add(1, () => {
|
||||
if (SongController.side_bar != null) {
|
||||
SongController.side_bar.collapsing.connect(() => {
|
||||
collapse_button_revealer.set_reveal_child(true);
|
||||
action_bar.margin_start = 5;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
var controls = new SongControls();
|
||||
|
||||
@@ -38,23 +68,20 @@ namespace Song {
|
||||
}
|
||||
|
||||
public class MainViewActionBar : Gtk.Box {
|
||||
private Gtk.ActionBar action_bar;
|
||||
private MainViewContent main_view;
|
||||
private YtSearchBar yt_search_bar;
|
||||
|
||||
public MainViewActionBar (MainViewContent _main_view) {
|
||||
this.main_view = _main_view;
|
||||
}
|
||||
|
||||
construct {
|
||||
|
||||
|
||||
orientation = Gtk.Orientation.HORIZONTAL;
|
||||
action_bar = new Gtk.ActionBar();
|
||||
|
||||
|
||||
|
||||
|
||||
action_bar.vexpand = true;
|
||||
action_bar.hexpand = true;
|
||||
append(action_bar);
|
||||
hexpand = true;
|
||||
halign = Gtk.Align.FILL;
|
||||
yt_search_bar.hexpand = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Song {
|
||||
public SideBarContent side_bar_content;
|
||||
public SideBarControls side_bar_controls;
|
||||
|
||||
public signal void collapsing();
|
||||
// unify the signals for sidebar and maincontent collapsing in a singleton song controller
|
||||
|
||||
|
||||
public SideBar(Window _window) {
|
||||
@@ -15,9 +17,28 @@ namespace Song {
|
||||
}
|
||||
|
||||
construct {
|
||||
SongController.side_bar = this;
|
||||
|
||||
var toolbar_view = new Adw.ToolbarView();
|
||||
|
||||
var collapse_button = new Gtk.Button.from_icon_name ("folder-open-symbolic");
|
||||
collapse_button.clicked.connect(() => {
|
||||
if(SongController.split_view.get_collapsed ()){
|
||||
SongController.split_view.set_collapsed (false);
|
||||
collapse_button.set_icon_name("folder-open-symbolic");
|
||||
} else {
|
||||
SongController.split_view.set_collapsed(true);
|
||||
collapse_button.set_icon_name("folder-symbolic");
|
||||
}
|
||||
collapsing();
|
||||
});
|
||||
var header_bar = new Adw.HeaderBar();
|
||||
header_bar.margin_top = 5;
|
||||
header_bar.show_title = false;
|
||||
header_bar.show_start_title_buttons = false;
|
||||
header_bar.show_end_title_buttons = false;
|
||||
header_bar.pack_start(collapse_button);
|
||||
|
||||
var scroll_box = new Gtk.ScrolledWindow();
|
||||
scroll_box.hscrollbar_policy = Gtk.PolicyType.NEVER;
|
||||
side_bar_content = new SideBarContent ();
|
||||
@@ -28,6 +49,7 @@ namespace Song {
|
||||
side_bar_controls = new SideBarControls (side_bar_content);
|
||||
side_bar_controls.set_hexpand (true);
|
||||
|
||||
toolbar_view.add_top_bar(header_bar);
|
||||
toolbar_view.set_content(scroll_box);
|
||||
toolbar_view.add_bottom_bar(side_bar_controls);
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Song {
|
||||
public class YtSearchBar : Gtk.Box {
|
||||
|
||||
private Gtk.SearchEntry search_entry = new Gtk.SearchEntry ();
|
||||
private MainViewActionBar container_parent;
|
||||
private Adw.Clamp search_clamp = new Adw.Clamp();
|
||||
|
||||
|
||||
|
||||
construct {
|
||||
var gesture = new Gtk.GestureClick();
|
||||
add_controller(gesture);
|
||||
|
||||
add_css_class ("toolbar");
|
||||
hexpand = true;
|
||||
|
||||
search_entry.hexpand = true;
|
||||
|
||||
search_clamp.set_child(search_entry);
|
||||
append(search_clamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user