calendars-page: Port Add Calendar button to AdwButtonRow

This commit is contained in:
Alice Mikhaylenko
2024-05-01 13:47:16 +00:00
committed by Georges Basile Stavracas Neto
parent 0228df3bc9
commit eb8ee25f6a
2 changed files with 49 additions and 44 deletions
@@ -258,8 +258,8 @@ on_listbox_row_activated_cb (GtkListBox *listbox,
}
static void
on_new_calendar_button_clicked_cb (GtkButton *button,
GcalCalendarsPage *self)
on_new_calendar_row_activated_cb (AdwButtonRow *button,
GcalCalendarsPage *self)
{
GcalCalendarManagementPage *page = GCAL_CALENDAR_MANAGEMENT_PAGE (self);
@@ -463,7 +463,7 @@ gcal_calendars_page_class_init (GcalCalendarsPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GcalCalendarsPage, toast_overlay);
gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated_cb);
gtk_widget_class_bind_template_callback (widget_class, on_new_calendar_button_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, on_new_calendar_row_activated_cb);
}
static void
@@ -25,18 +25,55 @@
<object class="AdwClamp">
<property name="child">
<object class="GtkListBox" id="listbox">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<property name="margin-top">24</property>
<property name="margin-bottom">24</property>
<property name="margin-start">24</property>
<property name="margin-end">24</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="valign">start</property>
<property name="selection-mode">none</property>
<signal name="row-activated" handler="on_listbox_row_activated_cb" object="GcalCalendarsPage" swapped="no" />
<style>
<class name="calendars-list"/>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBox" id="listbox">
<property name="selection-mode">none</property>
<signal name="row-activated" handler="on_listbox_row_activated_cb" object="GcalCalendarsPage" swapped="no" />
<style>
<class name="calendars-list"/>
<class name="boxed-list"/>
</style>
</object>
</child>
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<child>
<object class="AdwButtonRow">
<property name="title" translatable="yes">_Add Calendar</property>
<property name="use-underline">true</property>
<property name="end-icon-name">go-next-symbolic</property>
<signal name="activated" handler="on_new_calendar_row_activated_cb" object="GcalCalendarsPage" swapped="no" />
<style>
<class name="suggested-action"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Ctrl&gt;n</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
</object>
</child>
<style>
<class name="boxed-list-separate"/>
</style>
</object>
</child>
</object>
</property>
@@ -47,38 +84,6 @@
</object>
</property>
<child type="bottom">
<object class="GtkBox">
<property name="hexpand">true</property>
<property name="halign">center</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">_Add Calendar…</property>
<property name="use-underline">true</property>
<signal name="clicked" handler="on_new_calendar_button_clicked_cb" object="GcalCalendarsPage" swapped="no" />
<style>
<class name="pill"/>
<class name="suggested-action"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Ctrl&gt;n</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>