Skip to content

Commit

Permalink
small bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
youpie committed Dec 5, 2024
1 parent cd51f23 commit 7fb1ca6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 12 additions & 5 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,27 +398,34 @@ impl GtkTestWindow {
("Slate".to_string(), win.create_rgba(99, 118, 146)),
]));
win.setup_defaults();

win
}
pub fn setup_defaults(&self) {

pub fn default_sliders(&self) {
let imp = self.imp();
imp.save_button.set_sensitive(false);
imp.x_scale.add_mark(0.0, gtk::PositionType::Top, None);
imp.y_scale.add_mark(0.0, gtk::PositionType::Bottom, None);
imp.y_scale.set_value(9.447);
imp.size.set_value(24.0);
imp.size.add_mark(24.0, gtk::PositionType::Top, None);
imp.y_scale.add_mark(9.447, gtk::PositionType::Bottom, None);
imp.stack.set_visible_child_name("stack_welcome_page");
}

pub fn setup_defaults(&self) {
let imp = self.imp();
imp.save_button.set_sensitive(false);
self.default_sliders();
imp.reset_color.set_visible(false);
self.check_regeneration_needed();
let _ = imp.settings.set_string(
"previous-system-accent-color",
&self.get_accent_color_and_dialog(),
);
imp.reset_color.set_visible(false);
self.load_folder_path_from_settings();
imp.stack.set_visible_child_name("stack_welcome_page");
self.setup_settings();
self.setup_update();
self.load_folder_path_from_settings();
}

pub fn create_rgba(&self, r: u8, g: u8, b: u8) -> gdk::RGBA {
Expand Down
7 changes: 4 additions & 3 deletions src/windows/regeneration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ impl GtkTestWindow {
}
tokio::task::spawn_blocking(move || generated_image.save(file_path)).await??;
}
self.default_sliders();
Ok(())
}

Expand Down Expand Up @@ -193,9 +194,9 @@ impl GtkTestWindow {
imp.x_scale.set_value(properties[2].parse()?);
imp.y_scale.set_value(properties[3].parse()?);
imp.size.set_value(properties[4].parse()?);
imp.monochrome_switch
.set_active(properties[5].parse::<usize>()? != 0);
imp.threshold_scale.set_value(properties[6].parse()?);
// imp.monochrome_switch
// .set_active(properties[5].parse::<usize>()? != 0);
// imp.threshold_scale.set_value(properties[6].parse()?);
// imp.monochrome_color.set_rgba(&self.get_default_color());
imp.monochrome_invert
.set_active(properties[10].parse::<usize>()? != 0);
Expand Down

0 comments on commit 7fb1ca6

Please sign in to comment.