Move func "settings_(get|set)_show_bar_by_default" to Rust

This commit is contained in:
Alex Kotov 2022-09-08 23:22:22 +04:00
parent 68bd1f214b
commit 05513d3435
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
3 changed files with 20 additions and 11 deletions

View file

@ -112,3 +112,13 @@ unsafe extern "C" fn settings_set_respect_resize_hints_in_floating_layout(
.unwrap()
.respect_resize_hints_in_floating_layout_set(value);
}
#[no_mangle]
unsafe extern "C" fn settings_get_show_bar_by_default() -> bool {
SETTINGS.unwrap().show_bar_by_default()
}
#[no_mangle]
unsafe extern "C" fn settings_set_show_bar_by_default(value: bool) {
SETTINGS.unwrap().show_bar_by_default_set(value);
}

View file

@ -5,7 +5,6 @@
static SettingsForSingleWindow border_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
static SettingsForSingleWindow gap_for_single_window = SETTINGS_FOR_SINGLE_WINDOW_NOBODY_IS_FULLSCREEN;
static UnitKind master_area_factor_per_unit = UNIT_MONITOR;
static bool show_bar_by_default = true;
static UnitKind show_bar_per_unit = UNIT_MONITOR;
static unsigned int snap_distance = 32;
static bool swallow_floating = false;
@ -43,16 +42,6 @@ void settings_set_master_area_factor_per_unit(const UnitKind new_master_area_fac
// TODO: notify WM to rearrange clients
}
bool settings_get_show_bar_by_default()
{
return show_bar_by_default;
}
void settings_set_show_bar_by_default(const bool new_show_bar_by_default)
{
show_bar_by_default = new_show_bar_by_default;
}
UnitKind settings_get_show_bar_per_unit()
{
return show_bar_per_unit;

View file

@ -13,6 +13,7 @@ pub struct Settings {
gap_size: c_int,
max_clients_in_master: Option<c_int>,
respect_resize_hints_in_floating_layout: bool,
show_bar_by_default: bool,
}
impl Default for Settings {
@ -27,6 +28,7 @@ impl Default for Settings {
gap_size: 10,
max_clients_in_master: None,
respect_resize_hints_in_floating_layout: false,
show_bar_by_default: true,
}
}
}
@ -110,4 +112,12 @@ impl Settings {
pub fn respect_resize_hints_in_floating_layout_set(&mut self, value: bool) {
self.respect_resize_hints_in_floating_layout = value;
}
pub fn show_bar_by_default(&self) -> bool {
self.show_bar_by_default
}
pub fn show_bar_by_default_set(&mut self, value: bool) {
self.show_bar_by_default = value;
}
}