diff options
author | Gabriel Brand <gabr.brand@gmail.com> | 2024-05-14 13:19:33 +0200 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-01-02 02:41:43 +0300 |
commit | 8478475d9353aa895c216005cd1b731d8e657d53 (patch) | |
tree | ead557c749950d343602e8c71619ec0442eb1ff9 | |
parent | fbf38c69c68b92a73d1f833f32957a074a5a8cb5 (diff) | |
download | Furtherance-8478475d9353aa895c216005cd1b731d8e657d53.tar.zst |
CSV Export Dialog: Move export button below preferences
- Remove AdwClamp
-rw-r--r-- | src/gtk/csv_export_dialog.ui | 152 | ||||
-rw-r--r-- | src/ui/window.rs | 19 |
2 files changed, 74 insertions, 97 deletions
diff --git a/src/gtk/csv_export_dialog.ui b/src/gtk/csv_export_dialog.ui index 7e37882..7fed989 100644 --- a/src/gtk/csv_export_dialog.ui +++ b/src/gtk/csv_export_dialog.ui @@ -2,109 +2,93 @@ <interface> <object class="AdwDialog" id="csv_export_dialog"> <property name="title" translatable="yes">Export as CSV</property> + <property name="content-width">450</property> <property name="child"> <object class="AdwToolbarView"> <child type="top"> - <object class="AdwHeaderBar"> - <property name="show-start-title-buttons">false</property> - <property name="show-end-title-buttons">false</property> - <child type="start"> - <object class="GtkButton" id="cancel_button"> - <property name="label" translatable="yes">_Cancel</property> - <property name="use_underline">true</property> - </object> - </child> - <child type="end"> - <object class="GtkButton" id="export_button"> - <property name="label" translatable="yes">_Export</property> - <property name="use_underline">true</property> - <property name="sensitive">false</property> - <style> - <class name="suggested-action" /> - </style> - </object> - </child> - </object> + <object class="AdwHeaderBar" /> </child> <property name="content"> - <object class="AdwClamp"> - <property name="maximum-size">800</property> - <property name="tightening-threshold">600</property> - <property name="hexpand">true</property> - <property name="vexpand">false</property> - <property name="valign">fill</property> - <property name="halign">fill</property> + <object class="GtkBox"> + <property name="orientation">vertical</property> + <property name="spacing">24</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> <child> <object class="GtkBox"> - <property name="orientation">vertical</property> - <property name="spacing">24</property> - <property name="margin-start">12</property> - <property name="margin-end">12</property> - <property name="margin-top">12</property> - <property name="margin-bottom">12</property> + <property name="orientation">horizontal</property> + <property name="spacing">12</property> <child> - <object class="GtkBox"> - <property name="orientation">horizontal</property> - <property name="spacing">12</property> - <child> - <object class="GtkLabel" id="selected_file_label"> - <property translatable="yes" name="label"> - No File Selected - </property> - <property name="hexpand">true</property> - <property name="halign">start</property> - <property name="ellipsize">start</property> - <style> - <class name="dim-label" /> - </style> - </object> - </child> - <child> - <object class="GtkButton" id="filechooser_button"> - <property name="icon-name">folder-open-symbolic</property> - <property name="tooltip-text" translatable="yes">Select File</property> - </object> - </child> + <object class="GtkLabel" id="selected_file_label"> + <property translatable="yes" name="label"> - No File Selected - </property> + <property name="hexpand">true</property> + <property name="halign">start</property> + <property name="ellipsize">start</property> + <style> + <class name="dim-label" /> + </style> + </object> + </child> + <child> + <object class="GtkButton" id="filechooser_button"> + <property name="icon-name">folder-open-symbolic</property> + <property name="tooltip-text" translatable="yes">Select File</property> </object> </child> + </object> + </child> + <child> + <object class="AdwPreferencesGroup"> + <property name="title" translatable="yes">Export Preferences</property> + <property name="halign">fill</property> <child> - <object class="AdwPreferencesGroup"> - <property name="title" translatable="yes">Export Preferences</property> - <property name="halign">fill</property> - <child> - <object class="AdwComboRow" id="tasksort_row"> - <property name="title" translatable="yes">Sort _By</property> - <property name="use_underline">true</property> - <property name="model"> - <object class="GtkStringList"> - <items> - <item translatable="yes">Start Time</item> - <item translatable="yes">Stop Time</item> - <item translatable="yes">Task Name</item> - </items> - </object> - </property> + <object class="AdwComboRow" id="tasksort_row"> + <property name="title" translatable="yes">Sort _By</property> + <property name="use_underline">true</property> + <property name="model"> + <object class="GtkStringList"> + <items> + <item translatable="yes">Start Time</item> + <item translatable="yes">Stop Time</item> + <item translatable="yes">Task Name</item> + </items> </object> - </child> - <child> - <object class="AdwComboRow" id="sortorder_row"> - <property name="title" translatable="yes">Sort _Order</property> - <property name="use_underline">true</property> - <property name="model"> - <object class="GtkStringList"> - <items> - <item translatable="yes">Ascending</item> - <item translatable="yes">Descending</item> - </items> - </object> - </property> + </property> + </object> + </child> + <child> + <object class="AdwComboRow" id="sortorder_row"> + <property name="title" translatable="yes">Sort _Order</property> + <property name="use_underline">true</property> + <property name="model"> + <object class="GtkStringList"> + <items> + <item translatable="yes">Ascending</item> + <item translatable="yes">Descending</item> + </items> </object> - </child> + </property> </object> </child> </object> </child> + <child> + <object class="GtkButton" id="export_button"> + <property name="label" translatable="yes">_Export</property> + <property name="use_underline">true</property> + <property name="halign">center</property> + <property name="sensitive">false</property> + <style> + <class name="suggested-action" /> + <class name="pill" /> + </style> + </object> + </child> </object> </property> </object> </property> </object> -</interface> +</interface> \ No newline at end of file diff --git a/src/ui/window.rs b/src/ui/window.rs index 9b49ed6..bf23729 100644 --- a/src/ui/window.rs +++ b/src/ui/window.rs @@ -911,20 +911,17 @@ impl FurtheranceWindow { pub fn open_csv_export_dialog(&self) { let builder = gtk::Builder::from_resource("/com/lakoliu/Furtherance/gtk/csv_export_dialog.ui"); let dialog = builder.object::<adw::Dialog>("csv_export_dialog").unwrap(); - let tasksort_row = builder - .object::<adw::ComboRow>("tasksort_row") - .unwrap(); - let sortorder_row = builder - .object::<adw::ComboRow>("sortorder_row") + let selected_file_label = builder + .object::<gtk::Label>("selected_file_label") .unwrap(); let filechooser_button = builder .object::<gtk::Button>("filechooser_button") .unwrap(); - let selected_file_label = builder - .object::<gtk::Label>("selected_file_label") + let tasksort_row = builder + .object::<adw::ComboRow>("tasksort_row") .unwrap(); - let cancel_button = builder - .object::<gtk::Button>("cancel_button") + let sortorder_row = builder + .object::<adw::ComboRow>("sortorder_row") .unwrap(); let export_button = builder .object::<gtk::Button>("export_button") @@ -965,10 +962,6 @@ impl FurtheranceWindow { }), ); - cancel_button.connect_clicked(clone!(@weak dialog => move |_| { - dialog.close(); - })); - export_button.connect_clicked(clone!(@weak self as window, @weak dialog, @weak filechooser, @weak tasksort_row, @weak sortorder_row => move |_| { let sort = TaskSort::try_from(tasksort_row.selected()).unwrap_or_default(); let order = SortOrder::try_from(sortorder_row.selected()).unwrap_or_default(); |