diff options
author | Gabriel Brand <gabr.brand@gmail.com> | 2024-05-03 16:22:18 +0200 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-01-02 02:41:43 +0300 |
commit | ce43c2e2634073479a0b1c09a461fedfe4fc3f77 (patch) | |
tree | d92beb9cd31078a6e0c1f4956ebc46f1e7bbf9a4 | |
parent | 987f3d96c087231efb96aefafed688d9944f94ed (diff) | |
download | Furtherance-ce43c2e2634073479a0b1c09a461fedfe4fc3f77.tar.zst |
report: Port AdwWindow to AdwDialog
- Use AdwToolbarView - Use AdwHeaderBar Instead of GtkHeaderBar - Remove unused style class 'report'
-rw-r--r-- | src/application.rs | 3 | ||||
-rw-r--r-- | src/gtk/report.ui | 286 | ||||
-rw-r--r-- | src/ui/report.rs | 10 |
3 files changed, 142 insertions, 157 deletions
diff --git a/src/application.rs b/src/application.rs index d03fe97..661e8f2 100644 --- a/src/application.rs +++ b/src/application.rs @@ -125,7 +125,8 @@ impl FurtheranceApplication { let report_action = gio::SimpleAction::new("report", None); report_action.connect_activate(clone!(@weak self as app => move |_, _| { - FurReport::new().show(); + let window = FurtheranceWindow::default(); + FurReport::new().present(&window); })); self.set_accels_for_action("app.report", &["<primary>R"]); self.add_action(&report_action); diff --git a/src/gtk/report.ui b/src/gtk/report.ui index db4b651..29f0f95 100644 --- a/src/gtk/report.ui +++ b/src/gtk/report.ui @@ -1,34 +1,22 @@ <?xml version="1.0" encoding="UTF-8"?> <interface> - <template class="FurReport" parent="AdwWindow"> - <property name="width-request">450</property> - <property name="height-request">600</property> - <property name="default-width">450</property> - <property name="default-height">600</property> + <template class="FurReport" parent="AdwDialog"> + <property name="content-width">450</property> + <property name="content-height">600</property> <property name="title" translatable="yes">Report</property> - <property name="modal">True</property> - <style> - <class name="report"/> - </style> - <property name="content"> - <object class="GtkBox"> - <property name="orientation">vertical</property> - <child type="overlay"> - <object class="GtkHeaderBar"> - <style> - <class name="hidden"/> - <class name="flat-headerbar"/> - </style> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="orientation">vertical</property> - <property name="spacing">8</property> - <property name="margin-top">10</property> - <child> - <object class="GtkComboBoxText" id="range_combo"> - <property name="halign">center</property> + <property name="child"> + <object class="AdwToolbarView"> + <child type="top"> + <object class="AdwHeaderBar" /> + </child> + <property name="content"> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <property name="spacing">8</property> + <property name="margin-top">10</property> + <child> + <object class="GtkComboBoxText" id="range_combo"> + <property name="halign">center</property> <items> <item translatable="yes" id="this_week_item">This Week</item> <item translatable="yes" id="last_week_item">Last Week</item> @@ -39,131 +27,131 @@ <item translatable="yes" id="year_item">Past year</item> <item translatable="yes" id="date_range_item">Date range</item> </items> - </object> - </child> - <child> - <object class="GtkBox" id="date_range_box"> - <property name="spacing">8</property> - <property name="halign">center</property> - <property name="visible">False</property> - <child> - <object class="GtkBox"> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel"> - <property name="label" translatable="yes">Start</property> - <property name="halign">start</property> - </object> - </child> - <child> - <object class="GtkEntry" id="start_date_entry"> - <property name="placeholder-text" translatable="yes">MM/DD/YYYY</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkBox"> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel"> - <property name="label" translatable="yes">End</property> - <property name="halign">start</property> - </object> - </child> - <child> - <object class="GtkEntry" id="end_date_entry"> - <property name="placeholder-text" translatable="yes">MM/DD/YYYY</property> - </object> - </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkLabel" id="format_error"> - <property name="label" translatable="yes">Use the format MM/DD/YYYY</property> - <property name="visible">False</property> - <style> - <class name="error_message"/> - </style> - </object> - </child> - <child> - <object class="GtkLabel" id="start_end_error"> - <property name="label" translatable="yes">Start date must be before end date</property> - <property name="visible">False</property> - <style> - <class name="error_message"/> - </style> - </object> - </child> - <child> - <object class="GtkBox" id="sort_by_box"> - <property name="spacing">6</property> - <property name="halign">center</property> - <child> - <object class="GtkLabel"> - <property name="label" translatable="yes">Sort by:</property> - </object> - </child> - <child> - <object class="GtkCheckButton" id="sort_by_task"> - <property name="label" translatable="yes">Task</property> - <property name="active">True</property> - <property name="group">sort_by_tag</property> - </object> - </child> - <child> - <object class="GtkCheckButton" id="sort_by_tag"> - <property name="label" translatable="yes">Tag</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkCheckButton" id="filter_check"> - <property name="label" translatable="yes">Filter by task or tags</property> - <property name="halign">center</property> - </object> - </child> - <child> - <object class="GtkBox" id="filter_box"> - <property name="spacing">6</property> - <property name="visible">False</property> - <property name="halign">center</property> - <child> - <object class="GtkComboBoxText" id="filter_combo"> + </object> + </child> + <child> + <object class="GtkBox" id="date_range_box"> + <property name="spacing">8</property> + <property name="halign">center</property> + <property name="visible">False</property> + <child> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">Start</property> + <property name="halign">start</property> + </object> + </child> + <child> + <object class="GtkEntry" id="start_date_entry"> + <property name="placeholder-text" translatable="yes">MM/DD/YYYY</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">End</property> + <property name="halign">start</property> + </object> + </child> + <child> + <object class="GtkEntry" id="end_date_entry"> + <property name="placeholder-text" translatable="yes">MM/DD/YYYY</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkLabel" id="format_error"> + <property name="label" translatable="yes">Use the format MM/DD/YYYY</property> + <property name="visible">False</property> + <style> + <class name="error_message" /> + </style> + </object> + </child> + <child> + <object class="GtkLabel" id="start_end_error"> + <property name="label" translatable="yes">Start date must be before end date</property> + <property name="visible">False</property> + <style> + <class name="error_message" /> + </style> + </object> + </child> + <child> + <object class="GtkBox" id="sort_by_box"> + <property name="spacing">6</property> + <property name="halign">center</property> + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">Sort by:</property> + </object> + </child> + <child> + <object class="GtkCheckButton" id="sort_by_task"> + <property name="label" translatable="yes">Task</property> + <property name="active">True</property> + <property name="group">sort_by_tag</property> + </object> + </child> + <child> + <object class="GtkCheckButton" id="sort_by_tag"> + <property name="label" translatable="yes">Tag</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkCheckButton" id="filter_check"> + <property name="label" translatable="yes">Filter by task or tags</property> + <property name="halign">center</property> + </object> + </child> + <child> + <object class="GtkBox" id="filter_box"> + <property name="spacing">6</property> + <property name="visible">False</property> + <property name="halign">center</property> + <child> + <object class="GtkComboBoxText" id="filter_combo"> <items> <item translatable="yes" id="tasks_item">Tasks</item> <item translatable="yes" id="tags_item">Tags</item> </items> - </object> - </child> - <child> - <object class="GtkEntry" id="filter_entry"> - <property name="placeholder-text" translatable="yes">Task, Task 2</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkButton" id="refresh_btn"> - <property name="label" translatable="yes">Refresh</property> - <property name="halign">center</property> - </object> - </child> - <child> - <object class="GtkScrolledWindow"> - <property name="vexpand">true</property> - <child> - <object class="GtkTreeView" id="results_tree"></object> - </child> - </object> - </child> - </object> - </child> - </object> + </object> + </child> + <child> + <object class="GtkEntry" id="filter_entry"> + <property name="placeholder-text" translatable="yes">Task, Task 2</property> + </object> + </child> + </object> + </child> + <child> + <object class="GtkButton" id="refresh_btn"> + <property name="label" translatable="yes">Refresh</property> + <property name="halign">center</property> + </object> + </child> + <child> + <object class="GtkScrolledWindow"> + <property name="vexpand">true</property> + <child> + <object class="GtkTreeView" id="results_tree"></object> + </child> + </object> + </child> + </object> + </property> + </object> </property> </template> </interface> diff --git a/src/ui/report.rs b/src/ui/report.rs index 998012f..434514e 100644 --- a/src/ui/report.rs +++ b/src/ui/report.rs @@ -68,7 +68,7 @@ mod imp { #[glib::object_subclass] impl ObjectSubclass for FurReport { const NAME: &'static str = "FurReport"; - type ParentType = adw::Window; + type ParentType = adw::Dialog; type Type = super::FurReport; fn class_init(klass: &mut Self::Class) { @@ -90,14 +90,12 @@ mod imp { impl WidgetImpl for FurReport {} - impl WindowImpl for FurReport {} - - impl AdwWindowImpl for FurReport {} + impl AdwDialogImpl for FurReport {} } glib::wrapper! { pub struct FurReport(ObjectSubclass<imp::FurReport>) - @extends gtk::Widget, gtk::Window, adw::Window; + @extends gtk::Widget, adw::Dialog; } impl FurReport { @@ -105,8 +103,6 @@ impl FurReport { let dialog: Self = glib::Object::new::<FurReport>(); let window = FurtheranceWindow::default(); - dialog.set_transient_for(Some(&window)); - let app = FurtheranceApplication::default(); app.add_window(&window); |