[gnome-calendar/wip/cdavis/use-leaflet] window: Use two today buttons instead of moving
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/cdavis/use-leaflet] window: Use two today buttons instead of moving
- Date: Wed, 20 Jul 2022 16:44:43 +0000 (UTC)
commit 9221ba4ba4bead1150c714b72e0342c9be475fb0
Author: Christopher Davis <christopherdavis gnome org>
Date: Wed Jul 20 12:40:58 2022 -0400
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.
src/gui/gcal-window.c | 25 -------------------------
src/gui/gcal-window.ui | 14 ++++++++++++--
2 files changed, 12 insertions(+), 27 deletions(-)
---
diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c
index 5e56bde2..96afef5a 100644
--- a/src/gui/gcal-window.c
+++ b/src/gui/gcal-window.c
@@ -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);
diff --git a/src/gui/gcal-window.ui b/src/gui/gcal-window.ui
index 7130460b..0ef04001 100644
--- a/src/gui/gcal-window.ui
+++ b/src/gui/gcal-window.ui
@@ -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">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]