event-editor/attendees-section: Inherit AdwPreferencesGroup
This is a prerequisite to make GcalEventEditorSection require inheriting AdwPreferencesGroup. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/781>
This commit is contained in:
@@ -1,33 +1,20 @@
|
||||
using Gtk 4.0;
|
||||
using Adw 1;
|
||||
|
||||
template $GcalAttendeesSection: Gtk.Box {
|
||||
orientation: vertical;
|
||||
hexpand: true;
|
||||
valign: start;
|
||||
template $GcalAttendeesSection: Adw.PreferencesGroup {
|
||||
$GcalOrganizerRow organizer_row {
|
||||
organizer: bind template.organizer;
|
||||
}
|
||||
|
||||
ListBox listbox {
|
||||
halign: fill;
|
||||
valign: fill;
|
||||
selection-mode: none;
|
||||
$GcalAttendeeSummaryRow summary_row {
|
||||
title: _("Participants");
|
||||
attendees: bind template.attendees;
|
||||
filter-flags: GCAL_EVENT_ATTENDEE_TYPE_FILTER_PERSON;
|
||||
}
|
||||
|
||||
styles [
|
||||
"boxed-list",
|
||||
]
|
||||
|
||||
$GcalOrganizerRow organizer_row {
|
||||
organizer: bind template.organizer;
|
||||
}
|
||||
|
||||
$GcalAttendeeSummaryRow summary_row {
|
||||
title: _("Participants");
|
||||
attendees: bind template.attendees;
|
||||
filter-flags: GCAL_EVENT_ATTENDEE_TYPE_FILTER_PERSON;
|
||||
}
|
||||
|
||||
$GcalAttendeeSummaryRow {
|
||||
title: _("Resources");
|
||||
attendees: bind template.attendees;
|
||||
filter-flags: GCAL_EVENT_ATTENDEE_TYPE_FILTER_RESOURCE;
|
||||
}
|
||||
$GcalAttendeeSummaryRow {
|
||||
title: _("Resources");
|
||||
attendees: bind template.attendees;
|
||||
filter-flags: GCAL_EVENT_ATTENDEE_TYPE_FILTER_RESOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
struct _GcalAttendeesSection
|
||||
{
|
||||
GtkBox parent_instance;
|
||||
AdwPreferencesGroup parent_instance;
|
||||
|
||||
GcalEvent *event;
|
||||
GcalEventOrganizer *organizer;
|
||||
@@ -44,7 +44,7 @@ struct _GcalAttendeesSection
|
||||
|
||||
static void gcal_event_editor_section_init_iface (GcalEventEditorSectionInterface *iface);
|
||||
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GcalAttendeesSection, gcal_attendees_section, GTK_TYPE_BOX,
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GcalAttendeesSection, gcal_attendees_section, ADW_TYPE_PREFERENCES_GROUP,
|
||||
G_IMPLEMENT_INTERFACE (GCAL_TYPE_EVENT_EDITOR_SECTION, gcal_event_editor_section_init_iface))
|
||||
|
||||
enum
|
||||
|
||||
@@ -18,12 +18,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
#include <adwaita.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GCAL_TYPE_ATTENDEES_SECTION (gcal_attendees_section_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GcalAttendeesSection, gcal_attendees_section, GCAL, ATTENDEES_SECTION, GtkBox)
|
||||
G_DECLARE_FINAL_TYPE (GcalAttendeesSection, gcal_attendees_section, GCAL, ATTENDEES_SECTION, AdwPreferencesGroup)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -55,10 +55,8 @@ template $GcalEventEditorDialog: Adw.Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
Adw.PreferencesGroup participants_group {
|
||||
$GcalAttendeesSection attendees_section {
|
||||
sensitive: bind template.writable;
|
||||
}
|
||||
$GcalAttendeesSection attendees_section {
|
||||
sensitive: bind template.writable;
|
||||
}
|
||||
|
||||
$GcalRemindersSection reminders_section {
|
||||
|
||||
@@ -64,7 +64,6 @@ struct _GcalEventEditorDialog
|
||||
GtkWidget *source_label;
|
||||
GcalEventEditorSection *summary_section;
|
||||
GcalEventEditorSection *attendees_section;
|
||||
GtkWidget *participants_group;
|
||||
GtkWidget *nav_view;
|
||||
GtkWidget *main_page;
|
||||
GtkWidget *attendee_details_page;
|
||||
@@ -591,7 +590,6 @@ gcal_event_editor_dialog_class_init (GcalEventEditorDialogClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, schedule_section);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, summary_section);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, attendees_section);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, participants_group);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, nav_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, main_page);
|
||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, attendee_details_page);
|
||||
@@ -691,7 +689,7 @@ gcal_event_editor_dialog_set_event (GcalEventEditorDialog *self,
|
||||
|
||||
set_writable (self, !gcal_calendar_is_read_only (calendar));
|
||||
gboolean has_participants = gcal_event_get_organizer (self->event) != NULL;
|
||||
gtk_widget_set_visible (GTK_WIDGET (self->participants_group), has_participants);
|
||||
gtk_widget_set_visible (GTK_WIDGET (self->attendees_section), has_participants);
|
||||
|
||||
gtk_widget_set_visible (self->cancel_button, self->writable);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user