Change the design of the overview page to reduce white space. Prepare everything to switch the stack page by button presses at the overview page.

main
Zwarf 2023-07-19 10:47:25 +02:00
rodzic 1770546f53
commit 1111e7115a
3 zmienionych plików z 87 dodań i 254 usunięć

Wyświetl plik

@ -39,6 +39,10 @@ struct _PicplannerOverview
GtkWidget *switch_moon;
GtkWidget *switch_milky_way;
GtkWidget *switch_to_sun_stack;
GtkWidget *switch_to_moon_stack;
GtkWidget *switch_to_milky_way_stack;
GtkWidget *label_sun_rise;
GtkWidget *label_sun_set;
GtkWidget *label_moon_rise;
@ -82,6 +86,20 @@ struct _PicplannerOverview
G_DEFINE_TYPE (PicplannerOverview, picplanner_overview, GTK_TYPE_BOX)
/*
* Catch all signals from the buttons and emit a signal which can be used by
* picplanner-window to change the stack page.
*/
void
change_stack_page (GtkButton *self,
gpointer user_data)
{
}
static gboolean
input_rebounce_reset_signal (gpointer user_data)
{
@ -745,6 +763,15 @@ picplanner_overview_init (PicplannerOverview *overview)
G_CALLBACK (shumate_map_metric_imperial_scale),
overview);
/*
* Register the button presses to switch the few
*/
g_signal_connect (G_OBJECT (overview->switch_to_sun_stack),
"clicked",
G_CALLBACK (change_stack_page),
overview);
/*
* Initialisation of values needed to detect when a user input ends
@ -769,6 +796,9 @@ picplanner_overview_class_init (PicplannerOverviewClass *class)
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, switch_sun);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, switch_moon);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, switch_milky_way);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, switch_to_sun_stack);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, switch_to_moon_stack);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, switch_to_milky_way_stack);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, label_sun_rise);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, label_sun_set);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), PicplannerOverview, label_moon_rise);

Wyświetl plik

@ -40,199 +40,28 @@
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesGroup">
<property name="title">Sun</property>
<property name="header-suffix">sun_switch_button</property>
<child>
<object class="AdwPreferencesRow">
<property name="hexpand">true</property>
<property name="halign">fill</property>
<property name="vexpand">true</property>
<property name="valign">fill</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="hexpand">true</property>
<property name="halign">fill</property>
<property name="vexpand">true</property>
<property name="valign">fill</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label">Information1</property>
<property name="margin-bottom">5</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label">Information1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkImage">
<property name="hexpand">true</property>
<property name="halign">end</property>
<property name="icon_name">go-next-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title">Moon</property>
<property name="header-suffix">moon_switch_button</property>
<child>
<object class="AdwPreferencesRow">
<property name="hexpand">true</property>
<property name="halign">fill</property>
<property name="vexpand">true</property>
<property name="valign">fill</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="hexpand">true</property>
<property name="halign">fill</property>
<property name="vexpand">true</property>
<property name="valign">fill</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label">Information1</property>
<property name="margin-bottom">5</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label">Information1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkImage">
<property name="hexpand">true</property>
<property name="halign">end</property>
<property name="icon_name">go-next-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title">Milky Way</property>
<property name="header-suffix">milky_way_switch_button</property>
<child>
<object class="AdwPreferencesRow">
<property name="hexpand">true</property>
<property name="halign">fill</property>
<property name="vexpand">true</property>
<property name="valign">fill</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="hexpand">true</property>
<property name="halign">fill</property>
<property name="vexpand">true</property>
<property name="valign">fill</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label">Information1</property>
<property name="margin-bottom">5</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="label">Information1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkImage">
<property name="hexpand">true</property>
<property name="halign">end</property>
<property name="icon_name">go-next-symbolic</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="visible">false</property>
<property name="visible">true</property>
<child>
<object class="AdwPreferencesRow">
<property name="activatable">false</property>
<child>
<object class="GtkGrid">
<property name="hexpand">false</property>
<property name="halign">center</property>
<property name="column-homogeneous">false</property>
<property name="hexpand">true</property>
<property name="halign">fill</property>
<property name="column-spacing">12</property>
<property name="row-spacing">10</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="margin-top">8</property>
<property name="margin-bottom">8</property>
<child>
<object class="GtkCheckButton" id="switch_sun">
<property name="active">true</property>
<property name="tooltip-text">Show sun</property>
<layout>
<property name="column">0</property>
<property name="row">1</property>
@ -242,6 +71,7 @@
<child>
<object class="GtkCheckButton" id="switch_moon">
<property name="active">true</property>
<property name="tooltip-text">Show moon</property>
<layout>
<property name="column">0</property>
<property name="row">2</property>
@ -251,6 +81,7 @@
<child>
<object class="GtkCheckButton" id="switch_milky_way">
<property name="active">true</property>
<property name="tooltip-text">Show milky way</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>
@ -258,9 +89,10 @@
</object>
</child>
<child>
<object class="GtkButton">
<object class="GtkButton" id="switch_to_sun_stack">
<property name="label" translatable="yes">Sun</property>
<property name="halign">start</property>
<property name="halign">fill</property>
<property name="hexpand">true</property>
<layout>
<property name="column">1</property>
<property name="row">1</property>
@ -268,35 +100,33 @@
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkButton" id="switch_to_moon_stack">
<property name="label" translatable="yes">Moon</property>
<property name="halign">start</property>
<property name="halign">fill</property>
<property name="hexpand">true</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
</layout>
<attributes>
<attribute name="weight" value="ultrabold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkButton" id="switch_to_milky_way_stack">
<property name="label" translatable="yes">Milky Way</property>
<property name="halign">start</property>
<property name="halign">fill</property>
<property name="hexpand">true</property>
<layout>
<property name="column">1</property>
<property name="row">3</property>
</layout>
<attributes>
<attribute name="weight" value="ultrabold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon-name">daytime-sunrise-symbolic</property>
<property name="pixel-size">24</property>
<property name="hexpand">true</property>
<property name="tooltip-text">Rise</property>
<layout>
<property name="column">2</property>
<property name="row">0</property>
@ -307,6 +137,8 @@
<object class="GtkImage">
<property name="icon-name">daytime-sunset-symbolic</property>
<property name="pixel-size">24</property>
<property name="hexpand">true</property>
<property name="tooltip-text">Set</property>
<layout>
<property name="column">3</property>
<property name="row">0</property>
@ -372,6 +204,8 @@
<object class="GtkImage">
<property name="icon-name">elevation-symbolic</property>
<property name="icon-size">GTK_ICON_SIZE_LARGE</property>
<property name="hexpand">true</property>
<property name="tooltip-text">Elevation</property>
<layout>
<property name="column">4</property>
<property name="row">0</property>
@ -382,6 +216,8 @@
<object class="GtkImage">
<property name="icon-name">azimuth-symbolic</property>
<property name="icon-size">GTK_ICON_SIZE_LARGE</property>
<property name="hexpand">true</property>
<property name="tooltip-text">Azimuth</property>
<layout>
<property name="column">5</property>
<property name="row">0</property>

Wyświetl plik

@ -44,12 +44,6 @@
<object class="TimePicker" id="time_picker">
</object>
</property>
<child>
<object class="GtkToggleButton" id="reveal_btn_start">
<property name="icon-name">view-sidebar-start-symbolic</property>
<property name="active" bind-source="flap" bind-property="reveal-flap" bind-flags="sync-create|bidirectional"/>
</object>
</child>
<child type="start">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">edit-find-symbolic</property>
@ -187,63 +181,36 @@
</child>
<child>
<object class="AdwFlap" id="flap">
<property name="vexpand">True</property>
<property name="modal">True</property>
<property name="swipe-to-open">True</property>
<property name="swipe-to-close">True</property>
<property name="flap">
<object class="GtkBox">
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<style>
<class name="background"/>
</style>
<child>
<object class="GtkStackSidebar">
<property name="vexpand">True</property>
<property name="stack">stack</property>
<property name="width-request">200</property>
</object>
</child>
<object class="GtkStack" id="stack">
<property name="width-request">360</property>
<child>
<object class="GtkStackPage" id="overview_page">
<property name="title" translatable="yes">Overview</property>
<property name="icon-name">emoji-recent-symbolic</property>
<property name="child">overview_box</property>
</object>
</property>
<property name="separator">
<object class="GtkSeparator"/>
</property>
<property name="content">
<object class="GtkStack" id="stack">
<property name="width-request">360</property>
<child>
<object class="GtkStackPage" id="overview_page">
<property name="title" translatable="yes">Overview</property>
<property name="icon-name">emoji-recent-symbolic</property>
<property name="child">overview_box</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="title" translatable="yes">Sun</property>
<property name="icon-name">weather-clear-symbolic</property>
<property name="child">sun_box</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="title" translatable="yes">Moon</property>
<property name="icon-name">weather-clear-night-symbolic</property>
<property name="child">moon_box</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="title" translatable="yes">Milky Way</property>
<property name="icon-name">milky-way-symbolic</property>
<property name="child">milky_way_box</property>
</object>
</child>
</child>
<child>
<object class="GtkStackPage">
<property name="title" translatable="yes">Sun</property>
<property name="icon-name">weather-clear-symbolic</property>
<property name="child">sun_box</property>
</object>
</property>
</child>
<child>
<object class="GtkStackPage">
<property name="title" translatable="yes">Moon</property>
<property name="icon-name">weather-clear-night-symbolic</property>
<property name="child">moon_box</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="title" translatable="yes">Milky Way</property>
<property name="icon-name">milky-way-symbolic</property>
<property name="child">milky_way_box</property>
</object>
</child>
</object>
</child>