Skip to content

Commit

Permalink
Merge pull request #837 from marhkb/feat/panels/improved-adaptability
Browse files Browse the repository at this point in the history
Feat/panels/improved adaptability
  • Loading branch information
marhkb authored Oct 11, 2024
2 parents fde1c46 + b7f9f87 commit 17eadb5
Show file tree
Hide file tree
Showing 10 changed files with 1,236 additions and 1,182 deletions.
1 change: 1 addition & 0 deletions data/com.github.marhkb.Pods.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<ul>
<li>The search entry to a toggle button in the headerbar. (#830)</li>
<li>Search is now possible in the connection chooser page. (#830)</li>
<li>The control elements of the header bar are now moved to a lower bar if space becomes too tight. (#837)</li>
</ul>
</description>
</release>
Expand Down
6 changes: 5 additions & 1 deletion src/view/client_view.ui
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<child>
<object class="AdwBreakpoint">
<condition>min-width: 600sp</condition>
<condition>min-width: 668sp</condition>
<setter object="navigation_split_view" property="collapsed">False</setter>
</object>
</child>
Expand Down Expand Up @@ -256,6 +256,7 @@
<property name="name">containers</property>
<property name="child">
<object class="PdsContainersPanel" id="containers_panel">
<property name="collapsed" bind-source="navigation_split_view" bind-property="collapsed" bind-flags="sync-create"/>
<binding name="container-list">
<lookup name="container-list" type="Client">
<lookup name="client">PdsClientView</lookup>
Expand All @@ -271,6 +272,7 @@
<property name="name">pods</property>
<property name="child">
<object class="PdsPodsPanel" id="pods_panel">
<property name="collapsed" bind-source="navigation_split_view" bind-property="collapsed" bind-flags="sync-create"/>
<binding name="pod-list">
<lookup name="pod-list" type="Client">
<lookup name="client">PdsClientView</lookup>
Expand All @@ -286,6 +288,7 @@
<property name="name">images</property>
<property name="child">
<object class="PdsImagesPanel" id="images_panel">
<property name="collapsed" bind-source="navigation_split_view" bind-property="collapsed" bind-flags="sync-create"/>
<binding name="image-list">
<lookup name="image-list" type="Client">
<lookup name="client">PdsClientView</lookup>
Expand All @@ -301,6 +304,7 @@
<property name="name">volumes</property>
<property name="child">
<object class="PdsVolumesPanel" id="volumes_panel">
<property name="collapsed" bind-source="navigation_split_view" bind-property="collapsed" bind-flags="sync-create"/>
<binding name="volume-list">
<lookup name="volume-list" type="Client">
<lookup name="client">PdsClientView</lookup>
Expand Down
31 changes: 29 additions & 2 deletions src/view/containers_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ mod imp {
#[property(get, set = Self::set_container_list, nullable)]
pub(super) container_list: glib::WeakRef<model::ContainerList>,
#[property(get, set)]
pub(super) collapsed: Cell<bool>,
#[property(get, set)]
pub(super) show_only_running_containers: Cell<bool>,
#[template_child]
pub(super) main_stack: TemplateChild<gtk::Stack>,
#[template_child]
pub(super) toolbar_view: TemplateChild<adw::ToolbarView>,
#[template_child]
pub(super) header_stack: TemplateChild<gtk::Stack>,
#[template_child]
pub(super) window_title: TemplateChild<adw::WindowTitle>,
Expand All @@ -76,6 +80,8 @@ mod imp {
pub(super) filter_stack: TemplateChild<gtk::Stack>,
#[template_child]
pub(super) flow_box: TemplateChild<gtk::FlowBox>,
#[template_child]
pub(super) overhang_action_bar: TemplateChild<gtk::ActionBar>,
}

#[glib::object_subclass]
Expand Down Expand Up @@ -187,6 +193,7 @@ mod imp {
let not_selection_mode_expr = selection_mode_expr.chain_closure::<bool>(closure!(
|_: Self::Type, selection_mode: bool| { !selection_mode }
));
let collapsed_expr = Self::Type::this_expression("collapsed");

gtk::ClosureExpression::new::<Option<String>>(
[
Expand Down Expand Up @@ -261,6 +268,28 @@ mod imp {

not_selection_mode_expr.bind(&self.search_bar.get(), "visible", Some(obj));

gtk::ClosureExpression::new::<bool>(
[
collapsed_expr.upcast_ref(),
not_selection_mode_expr.upcast_ref(),
],
closure!(|_: Self::Type, collapsed: bool, not_selection_mode: bool| {
collapsed && not_selection_mode
}),
)
.bind(&self.overhang_action_bar.get(), "revealed", Some(obj));

gtk::ClosureExpression::new::<bool>(
[
collapsed_expr.upcast_ref(),
selection_mode_expr.upcast_ref(),
],
closure!(|_: Self::Type, collapsed: bool, selection_mode: bool| {
collapsed || selection_mode
}),
)
.bind(&self.toolbar_view.get(), "reveal-bottom-bars", Some(obj));

let search_filter = gtk::CustomFilter::new(clone!(
#[weak]
obj,
Expand Down Expand Up @@ -351,8 +380,6 @@ mod imp {
fn on_notify_search_mode_enabled(&self) {
if self.search_bar.is_search_mode() {
self.search_entry.grab_focus();
} else {
self.search_entry.set_text("");
}
}

Expand Down
Loading

0 comments on commit 17eadb5

Please sign in to comment.