Skip to content

Commit 3262f65

Browse files
committed
Fix zoom jumping at first change after start
1 parent 5985c33 commit 3262f65

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/widgets/window.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,12 @@ impl Window {
165165
let this: Self = glib::Object::new(&[("application", app)]).unwrap();
166166
let imp = this.imp();
167167
imp.config.replace(config);
168+
imp.zoom.borrow_mut().value = 1.0;
168169

170+
this.setup_css_providers();
169171
this.squeezer_changed();
170172
this.setup_settings();
171173
this.setup_zoom_popover_item();
172-
this.setup_css_providers();
173174
this.setup_actions();
174175
this.setup_signals();
175176
this.open_in_new_tab(bookmarks_url().as_str());
@@ -189,7 +190,6 @@ impl Window {
189190
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
190191
);
191192

192-
imp.zoom.borrow_mut().value = 1.0;
193193
gtk::StyleContext::add_provider_for_display(
194194
&gdk::Display::default().unwrap(),
195195
&imp.zoom.borrow().provider,
@@ -324,6 +324,7 @@ impl Window {
324324
let value_btn = gtk::Button::with_label("100%");
325325
value_btn.set_hexpand(true);
326326
self.bind_property("zoom", &value_btn, "label")
327+
.flags(glib::BindingFlags::SYNC_CREATE)
327328
.transform_to(|_, v| {
328329
let zoom: f64 = v.get().unwrap();
329330
Some(format!("{:3}%", (zoom * 100.0) as usize).to_value())

0 commit comments

Comments
 (0)