Skip to content

Commit 3c39e97

Browse files
committed
Show container view on listview activate
1 parent 61adf6e commit 3c39e97

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/widgets/window.rs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ impl DistroShelfWindow {
141141
.imp()
142142
.content_state_stack
143143
.set_visible_child_name("content");
144-
this_clone.imp().split_view.set_show_content(true);
145144
} else {
146145
this_clone
147146
.imp()
@@ -301,6 +300,22 @@ impl DistroShelfWindow {
301300
factory.connect_setup(|_factory, item| {
302301
let list_item = item.downcast_ref::<gtk::ListItem>().unwrap();
303302
let sidebar_row = SidebarRow::new(&Container::default());
303+
304+
let click = gtk::GestureClick::new();
305+
click.connect_released(clone!(
306+
#[weak]
307+
list_item,
308+
#[weak]
309+
sidebar_row,
310+
move |_, _, _, _| {
311+
let _ = sidebar_row.activate_action(
312+
"list.activate-item",
313+
Some(&glib::Variant::from(list_item.position())),
314+
);
315+
}
316+
));
317+
sidebar_row.add_controller(click);
318+
304319
list_item.set_child(Some(&sidebar_row));
305320
});
306321

@@ -319,6 +334,13 @@ impl DistroShelfWindow {
319334

320335
imp.sidebar_list_view.set_factory(Some(&factory));
321336
imp.sidebar_list_view.set_model(Some(&selection_model));
337+
imp.sidebar_list_view.connect_activate(clone!(
338+
#[weak(rename_to = this)]
339+
self,
340+
move |_, _| {
341+
this.imp().split_view.set_show_content(true);
342+
}
343+
));
322344
let this = self.clone();
323345
self.root_store()
324346
.containers()

0 commit comments

Comments
 (0)