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 Gtk 4.0;
|
||||||
|
using Adw 1;
|
||||||
|
|
||||||
template $GcalAttendeesSection: Gtk.Box {
|
template $GcalAttendeesSection: Adw.PreferencesGroup {
|
||||||
orientation: vertical;
|
$GcalOrganizerRow organizer_row {
|
||||||
hexpand: true;
|
organizer: bind template.organizer;
|
||||||
valign: start;
|
}
|
||||||
|
|
||||||
ListBox listbox {
|
$GcalAttendeeSummaryRow summary_row {
|
||||||
halign: fill;
|
title: _("Participants");
|
||||||
valign: fill;
|
attendees: bind template.attendees;
|
||||||
selection-mode: none;
|
filter-flags: GCAL_EVENT_ATTENDEE_TYPE_FILTER_PERSON;
|
||||||
|
}
|
||||||
|
|
||||||
styles [
|
$GcalAttendeeSummaryRow {
|
||||||
"boxed-list",
|
title: _("Resources");
|
||||||
]
|
attendees: bind template.attendees;
|
||||||
|
filter-flags: GCAL_EVENT_ATTENDEE_TYPE_FILTER_RESOURCE;
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
struct _GcalAttendeesSection
|
struct _GcalAttendeesSection
|
||||||
{
|
{
|
||||||
GtkBox parent_instance;
|
AdwPreferencesGroup parent_instance;
|
||||||
|
|
||||||
GcalEvent *event;
|
GcalEvent *event;
|
||||||
GcalEventOrganizer *organizer;
|
GcalEventOrganizer *organizer;
|
||||||
@@ -44,7 +44,7 @@ struct _GcalAttendeesSection
|
|||||||
|
|
||||||
static void gcal_event_editor_section_init_iface (GcalEventEditorSectionInterface *iface);
|
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))
|
G_IMPLEMENT_INTERFACE (GCAL_TYPE_EVENT_EDITOR_SECTION, gcal_event_editor_section_init_iface))
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|||||||
@@ -18,12 +18,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <adwaita.h>
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GCAL_TYPE_ATTENDEES_SECTION (gcal_attendees_section_get_type ())
|
#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
|
G_END_DECLS
|
||||||
|
|||||||
@@ -55,10 +55,8 @@ template $GcalEventEditorDialog: Adw.Dialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Adw.PreferencesGroup participants_group {
|
$GcalAttendeesSection attendees_section {
|
||||||
$GcalAttendeesSection attendees_section {
|
sensitive: bind template.writable;
|
||||||
sensitive: bind template.writable;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$GcalRemindersSection reminders_section {
|
$GcalRemindersSection reminders_section {
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ struct _GcalEventEditorDialog
|
|||||||
GtkWidget *source_label;
|
GtkWidget *source_label;
|
||||||
GcalEventEditorSection *summary_section;
|
GcalEventEditorSection *summary_section;
|
||||||
GcalEventEditorSection *attendees_section;
|
GcalEventEditorSection *attendees_section;
|
||||||
GtkWidget *participants_group;
|
|
||||||
GtkWidget *nav_view;
|
GtkWidget *nav_view;
|
||||||
GtkWidget *main_page;
|
GtkWidget *main_page;
|
||||||
GtkWidget *attendee_details_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, schedule_section);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, summary_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, 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, nav_view);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, main_page);
|
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, main_page);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, attendee_details_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));
|
set_writable (self, !gcal_calendar_is_read_only (calendar));
|
||||||
gboolean has_participants = gcal_event_get_organizer (self->event) != NULL;
|
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);
|
gtk_widget_set_visible (self->cancel_button, self->writable);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user