From 7c065014f4b23c0eb50b3662bc5cb14f0a8df746 Mon Sep 17 00:00:00 2001 From: Gabriel Brand Date: Sun, 11 Feb 2024 19:00:41 +0100 Subject: Port to libadwaita 1.4 widgets --- Cargo.toml | 2 +- src/gtk/preferences_window.ui | 157 +++++++++++++----------------------------- src/ui/preferences_window.rs | 43 ++++++------ 3 files changed, 68 insertions(+), 134 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ee28afe..f4d425f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,4 +29,4 @@ version = "0.8.0" [dependencies.adw] package = "libadwaita" version = "0.6.0" -features = ["v1_2"] +features = ["v1_4"] \ No newline at end of file diff --git a/src/gtk/preferences_window.ui b/src/gtk/preferences_window.ui index a1192ac..08f9720 100644 --- a/src/gtk/preferences_window.ui +++ b/src/gtk/preferences_window.ui @@ -10,15 +10,9 @@ Appearance True - + _Dark theme True - dark_theme_switch - - - center - - @@ -34,24 +28,19 @@ True True - + _Minutes to idle Number of minutes before the user is considered idle True - - - center - - - 60 - 1 - 1 - 10 - - - True + + + 60 + 1 + 1 + 10 - + + True @@ -69,24 +58,19 @@ True True - + Interval Start time in minutes True - - - center - - - 999 - 1 - 1 - 15 - - - True + + + 999 + 1 + 1 + 15 - + + True @@ -98,38 +82,27 @@ True True - + Autosave every X _minutes True - - - center - - - 60 - 1 - 1 - 10 - - - True + + + 60 + 1 + 1 + 10 - + + True - + Inclusive total time - True - inclusive_total_switch Today's total time includes the ongoing timer - - - center - - + True @@ -145,15 +118,9 @@ Task List True - + _Delete confirmation True - delete_confirmation_switch - - - center - - @@ -163,64 +130,41 @@ True True - + _Days ago Number of days to display in the list True - - - center - - - 365 - 1 - 1 - 10 - - - True + + + 365 + 1 + 1 + 10 - + + True - + Show daily sums True - show_daily_sums_switch - - - center - - - + _Show seconds - True - show_seconds_switch Tasks list only. Seconds always show on timer - - - center - - + True - + Show tags - True - show_tags_switch Tags are saved, just not shown - - - center - - + True @@ -230,15 +174,9 @@ Task Input True - + _Autocomplete True - autocomplete_switch - - - center - - @@ -282,7 +220,7 @@ center Browse @@ -294,4 +232,3 @@ - diff --git a/src/ui/preferences_window.rs b/src/ui/preferences_window.rs index d3de8de..7d8406b 100644 --- a/src/ui/preferences_window.rs +++ b/src/ui/preferences_window.rs @@ -36,49 +36,47 @@ mod imp { #[template_child] pub appearance_group: TemplateChild, #[template_child] - pub dark_theme_switch: TemplateChild, + pub dark_theme_switch: TemplateChild, #[template_child] pub idle_group: TemplateChild, #[template_child] pub notify_of_idle_expander: TemplateChild, #[template_child] - pub notify_of_idle_spin: TemplateChild, + pub notify_of_idle_spin: TemplateChild, #[template_child] - pub task_list_group: TemplateChild, - #[template_child] - pub limit_tasks_expander: TemplateChild, + pub timer_group: TemplateChild, #[template_child] - pub limit_days_spin: TemplateChild, + pub pomodoro_expander: TemplateChild, #[template_child] - pub delete_confirmation_switch: TemplateChild, + pub pomodoro_spin: TemplateChild, #[template_child] - pub show_seconds_switch: TemplateChild, + pub autosave_expander: TemplateChild, #[template_child] - pub show_daily_sums_switch: TemplateChild, + pub autosave_spin: TemplateChild, #[template_child] - pub show_tags_switch: TemplateChild, + pub inclusive_total_switch: TemplateChild, #[template_child] - pub task_input_group: TemplateChild, + pub task_list_group: TemplateChild, #[template_child] - pub autocomplete_switch: TemplateChild, - + pub delete_confirmation_switch: TemplateChild, #[template_child] - pub timer_group: TemplateChild, + pub limit_tasks_expander: TemplateChild, #[template_child] - pub pomodoro_expander: TemplateChild, + pub limit_days_spin: TemplateChild, #[template_child] - pub pomodoro_spin: TemplateChild, - + pub show_daily_sums_switch: TemplateChild, #[template_child] - pub autosave_expander: TemplateChild, + pub show_seconds_switch: TemplateChild, #[template_child] - pub autosave_spin: TemplateChild, + pub show_tags_switch: TemplateChild, #[template_child] - pub inclusive_total_switch: TemplateChild, + pub task_input_group: TemplateChild, + #[template_child] + pub autocomplete_switch: TemplateChild, #[template_child] pub week_start_combo: TemplateChild, @@ -209,7 +207,7 @@ impl FurPreferencesWindow { window.reset_history_box(); }); - imp.limit_days_spin.connect_value_changed(move |_| { + imp.limit_days_spin.connect_value_notify(move |_| { let window = FurtheranceWindow::default(); window.reset_history_box(); }); @@ -240,7 +238,7 @@ impl FurPreferencesWindow { window.refresh_timer(); }); - imp.pomodoro_spin.connect_value_changed(move |new_val| { + imp.pomodoro_spin.connect_value_notify(move |new_val| { settings_manager::set_int("pomodoro-time", new_val.value() as i32); let window = FurtheranceWindow::default(); window.refresh_timer(); @@ -299,4 +297,3 @@ impl FurPreferencesWindow { })); } } - -- cgit 1.4.1