window: Use two today buttons instead of moving

This fixes an issue that caused flickering as the window
approached a size where it could fold.
This commit is contained in:
Christopher Davis
2022-08-12 03:00:08 +00:00
committed by Georges Basile Stavracas Neto
parent 04ead5fe85
commit a53787457e
2 changed files with 12 additions and 27 deletions
-25
View File
@@ -110,7 +110,6 @@ struct _GcalWindow
/* header_bar widets */
GtkWidget *calendars_button;
GtkWidget *menu_button;
GtkWidget *today_button;
GtkWidget *views_switcher;
GcalEventEditorDialog *event_editor;
@@ -653,26 +652,6 @@ event_activated (GcalView *view,
gcal_event_widget_show_preview (event_widget, event_preview_cb, user_data);
}
static void
on_folded_notify_cb (AdwLeaflet *leaflet,
GParamSpec *pspec,
GcalWindow *self)
{
if (adw_leaflet_get_folded (leaflet))
{
gtk_header_bar_remove (GTK_HEADER_BAR (self->header_bar), self->today_button);
gtk_action_bar_pack_start (GTK_ACTION_BAR (self->action_bar), self->today_button);
}
else
{
gtk_action_bar_remove (GTK_ACTION_BAR (self->action_bar), self->today_button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (self->header_bar), self->today_button);
}
}
static void
on_toast_dismissed_cb (AdwToast *toast,
GcalWindow *self)
@@ -1050,7 +1029,6 @@ gcal_window_class_init (GcalWindowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GcalWindow, action_bar);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, quick_add_popover);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, calendar_management_dialog);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, today_button);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, overlay);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_stack);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_switcher);
@@ -1059,9 +1037,6 @@ gcal_window_class_init (GcalWindowClass *klass)
gtk_widget_class_bind_template_callback (widget_class, view_changed);
/* Layout related */
gtk_widget_class_bind_template_callback (widget_class, on_folded_notify_cb);
/* Event creation related */
gtk_widget_class_bind_template_callback (widget_class, edit_event);
gtk_widget_class_bind_template_callback (widget_class, create_event_detailed_cb);
+12 -2
View File
@@ -100,7 +100,6 @@
<child>
<object class="AdwLeaflet" id="leaflet">
<property name="homogeneous">False</property>
<signal name="notify::folded" handler="on_folded_notify_cb" object="GcalWindow" swapped="no"/>
<child>
<object class="GtkBox">
<property name="hexpand">False</property>
@@ -147,6 +146,17 @@
<child>
<object class="GtkActionBar" id="action_bar">
<property name="revealed" bind-source="leaflet" bind-property="folded" bind-flags="sync-create"/>
<child type="start">
<object class="GtkButton">
<property name="action-name">win.today</property>
<property name="child">
<object class="AdwButtonContent">
<property name="label" translatable="yes">Today</property>
<property name="icon-name">calendar-today-symbolic</property>
</object>
</property>
</object>
</child>
<child type="end">
<object class="GcalToolbarEnd"/>
</child>
@@ -169,7 +179,7 @@
<object class="GtkHeaderBar" id="header_bar">
<property name="show-title-buttons">True</property>
<child>
<object class="GtkButton" id="today_button">
<object class="GtkButton">
<property name="action-name">win.today</property>
<property name="child">
<object class="AdwButtonContent">