]> uap-core.de Git - note.git/commitdiff
small simplification main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 17 Aug 2026 18:54:05 +0000 (20:54 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 17 Aug 2026 18:54:05 +0000 (20:54 +0200)
ui-rs/src/ui/button.rs
ui-rs/src/ui/container.rs
ui-rs/src/ui/list.rs
ui-rs/src/ui/text.rs
ui-rs/src/ui/window.rs

index ded533bb70a5e468190b4682473a4d726892b111..5338f3fa833b0ad6d91d0048723065a7fa243846 100644 (file)
@@ -424,7 +424,7 @@ impl<'a, T> ToggleBuilder<'a, T> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_toggle_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_toggle_args_set_fill(self.args, fill as c_int);
         }
         self
     }
@@ -620,7 +620,7 @@ impl<'a, T> LinkButtonBuilder<'a, T> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_linkbutton_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_linkbutton_args_set_fill(self.args, fill as c_int);
         }
         self
     }
index 83ec79b64db2a8167df3a6409c4ae6dd9aa27a61..c4b9ee889e330e8c73e371d0af5f3e509c101e1a 100644 (file)
@@ -309,42 +309,42 @@ impl<'a, T> ContainerBuilder<'a, T> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_container_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_container_args_set_fill(self.args, fill as c_int);
         }
         self
     }
 
     pub fn hexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_container_args_set_hexpand(self.args, if value { 1 } else { 0 });
+            ui_container_args_set_hexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn vexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_container_args_set_vexpand(self.args, if value { 1 } else { 0 });
+            ui_container_args_set_vexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn hfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_container_args_set_hfill(self.args, if value { 1 } else { 0 });
+            ui_container_args_set_hfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn vfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_container_args_set_vfill(self.args, if value { 1 } else { 0 });
+            ui_container_args_set_vfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn override_defaults(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_container_args_set_override_defaults(self.args, if value { 1 } else { 0 });
+            ui_container_args_set_override_defaults(self.args, value as c_int);
         }
         self
     }
@@ -559,42 +559,42 @@ impl<'a, T> FrameBuilder<'a, T> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_frame_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_frame_args_set_fill(self.args, fill as c_int);
         }
         self
     }
 
     pub fn hexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_frame_args_set_hexpand(self.args, if value { 1 } else { 0 });
+            ui_frame_args_set_hexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn vexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_frame_args_set_vexpand(self.args, if value { 1 } else { 0 });
+            ui_frame_args_set_vexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn hfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_frame_args_set_hfill(self.args, if value { 1 } else { 0 });
+            ui_frame_args_set_hfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn vfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_frame_args_set_vfill(self.args, if value { 1 } else { 0 });
+            ui_frame_args_set_vfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn override_defaults(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_frame_args_set_override_defaults(self.args, if value { 1 } else { 0 });
+            ui_frame_args_set_override_defaults(self.args, value as c_int);
         }
         self
     }
@@ -695,7 +695,7 @@ impl<'a, T> FrameBuilder<'a, T> {
 
     pub fn expanded(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_frame_args_set_expanded(self.args, if value { 1 } else { 0 });
+            ui_frame_args_set_expanded(self.args, value as c_int);
         }
         self
     }
@@ -787,42 +787,42 @@ impl<'a, T> SplitPaneBuilder<'a, T> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_splitpane_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_splitpane_args_set_fill(self.args, fill as c_int);
         }
         self
     }
 
     pub fn hexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_splitpane_args_set_hexpand(self.args, if value { 1 } else { 0 });
+            ui_splitpane_args_set_hexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn vexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_splitpane_args_set_vexpand(self.args, if value { 1 } else { 0 });
+            ui_splitpane_args_set_vexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn hfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_splitpane_args_set_hfill(self.args, if value { 1 } else { 0 });
+            ui_splitpane_args_set_hfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn vfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_splitpane_args_set_vfill(self.args, if value { 1 } else { 0 });
+            ui_splitpane_args_set_vfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn override_defaults(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_splitpane_args_set_override_defaults(self.args, if value { 1 } else { 0 });
+            ui_splitpane_args_set_override_defaults(self.args, value as c_int);
         }
         self
     }
@@ -1138,42 +1138,42 @@ impl<'a, T> TabViewBuilder<'a, T> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_tabview_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_tabview_args_set_fill(self.args, fill as c_int);
         }
         self
     }
 
     pub fn hexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_tabview_args_set_hexpand(self.args, if value { 1 } else { 0 });
+            ui_tabview_args_set_hexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn vexpand(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_tabview_args_set_vexpand(self.args, if value { 1 } else { 0 });
+            ui_tabview_args_set_vexpand(self.args, value as c_int);
         }
         self
     }
 
     pub fn hfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_tabview_args_set_hfill(self.args, if value { 1 } else { 0 });
+            ui_tabview_args_set_hfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn vfill(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_tabview_args_set_vfill(self.args, if value { 1 } else { 0 });
+            ui_tabview_args_set_vfill(self.args, value as c_int);
         }
         self
     }
 
     pub fn override_defaults(&mut self, value: bool) -> &mut Self {
         unsafe {
-            ui_tabview_args_set_override_defaults(self.args, if value { 1 } else { 0 });
+            ui_tabview_args_set_override_defaults(self.args, value as c_int);
         }
         self
     }
index bbb7c2982d418591945e32754a2220531baacfc8..8e3555e9f320e4425c5dc867a90816f18c2155d2 100644 (file)
@@ -430,7 +430,7 @@ impl<'a, T, E> TableViewBuilder<'a, T, E> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_list_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_list_args_set_fill(self.args, fill as c_int);
         }
         self
     }
@@ -657,7 +657,7 @@ impl<'a, T, E> SourceListBuilder<'a, T, E> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_sourcelist_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_sourcelist_args_set_fill(self.args, fill as c_int);
         }
         self
     }
index ca67ffcb7bce05f53e70e7c487966c1d1211538b..2d3212021d2f13bc99729fc8fc7ffc7b575badad 100644 (file)
@@ -464,7 +464,7 @@ impl<'a, T> TextFieldBuilder<'a, T> {
 
     pub fn fill(&mut self, fill: bool) -> &mut Self {
         unsafe {
-            ui_textfield_args_set_fill(self.args, if fill { 1 } else { 0 });
+            ui_textfield_args_set_fill(self.args, fill as c_int);
         }
         self
     }
index 8606175736ddee773876bb215fd5dbbb96dc1ff6..9d22925b7e056797a2715485e06f1953bcb7b94b 100644 (file)
@@ -346,21 +346,21 @@ impl<T: UiModel + UiActions> DialogWindowBuilder<T> {
 
     pub fn modal(&mut self, val: bool) -> &mut Self {
         unsafe {
-            ui_dialogwindow_args_set_modal(self.args, if val { 1 } else { 2 });
+            ui_dialogwindow_args_set_modal(self.args, val as c_int);
         }
         self
     }
 
     pub fn titlebar_buttons(&mut self, val: bool) -> &mut Self {
         unsafe {
-            ui_dialogwindow_args_set_titlebar_buttons(self.args, if val { 1 } else { 2 });
+            ui_dialogwindow_args_set_titlebar_buttons(self.args, val as c_int);
         }
         self
     }
 
     pub fn show_closebutton(&mut self, val: bool) -> &mut Self {
         unsafe {
-            ui_dialogwindow_args_set_show_closebutton(self.args, if val { 1 } else { 2 });
+            ui_dialogwindow_args_set_show_closebutton(self.args, val as c_int);
         }
         self
     }