Skip to content

Commit

Permalink
fix: some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukinaha committed Apr 1, 2024
1 parent 0c9d69f commit 6805baf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
14 changes: 7 additions & 7 deletions resources/ui/list.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
<property name="halign">center</property>
<property name="halign">start</property>
<property name="margin-top">12</property>
<property name="margin-start">55</property>
</object>
</child>
<child>
<object class="AdwClamp">
<object class="GtkScrolledWindow" id="listscrolled">
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkScrolledWindow" id="listscrolled">
<child>
<object class="GtkGridView" id="listgrid">
</object>
</child>
<object class="GtkGridView" id="listgrid">
<property name="margin-start">40</property>
<property name="margin-end">40</property>
</object>
</child>
</object>
Expand Down
4 changes: 2 additions & 2 deletions resources/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</menu>
<template class="AppWindow" parent="AdwApplicationWindow">
<property name="title" translatable="yes">Login</property>
<property name="width-request">880</property>
<property name="height-request">550</property>
<property name="width-request">1280</property>
<property name="height-request">920</property>
<child>
<object class="AdwBreakpoint">
<condition>max-width: 500sp</condition>
Expand Down
8 changes: 3 additions & 5 deletions src/ui/widgets/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ impl ListPage {
});
imp.listgrid.set_factory(Some(&factory));
imp.listgrid.set_model(Some(&imp.selection));
imp.listgrid.set_min_columns(4);
imp.listgrid.set_max_columns(4);
imp.listgrid.set_min_columns(3);
imp.listgrid.set_max_columns(13);
imp.listgrid.connect_activate(glib::clone!(@weak self as obj => move |gridview, position| {
let model = gridview.model().unwrap();
let item = model.item(position).and_downcast::<glib::BoxedAnyObject>().unwrap();
Expand Down Expand Up @@ -280,7 +280,6 @@ impl ListPage {

pub fn update(&self) {
let scrolled = self.imp().listscrolled.get();
let mut offset = 50;
scrolled.connect_edge_reached(glib::clone!(@weak self as obj => move |_, pos| {
if pos == gtk::PositionType::Bottom {
let spinner = obj.imp().spinner.get();
Expand All @@ -289,7 +288,7 @@ impl ListPage {
let store = obj.imp().selection.model().unwrap().downcast::<gio::ListStore>().unwrap();
let id = obj.imp().id.get().expect("id not set").clone();
let mutex = std::sync::Arc::new(tokio::sync::Mutex::new(()));

let offset = obj.imp().selection.model().unwrap().n_items();
crate::ui::network::runtime().spawn(glib::clone!(@strong sender => async move {
let list_results = crate::ui::network::get_list(id.to_string(),offset.to_string(),mutex).await.unwrap_or_else(|e| {
eprintln!("Error: {}", e);
Expand All @@ -303,7 +302,6 @@ impl ListPage {
let object = glib::BoxedAnyObject::new(result);
store.append(&object);
}
offset += 50;
spinner.set_visible(false);
}
}));
Expand Down

0 comments on commit 6805baf

Please sign in to comment.