diff --git a/src/gui/gcal-event-popover.c b/src/gui/gcal-event-popover.c index 60573ea2..aecaaf9f 100644 --- a/src/gui/gcal-event-popover.c +++ b/src/gui/gcal-event-popover.c @@ -31,14 +31,17 @@ struct _GcalEventPopover { GtkPopover parent; + GtkWidget *action_button; GtkLabel *date_time_label; GtkLabel *description_label; - GtkWidget *edit_button; + GtkScrolledWindow *description_scrolled_window; GtkWidget *location_box; GtkLabel *location_label; GtkListBox *meetings_listbox; + GtkBox *meetings_box; GtkLabel *placeholder_label; GtkLabel *summary_label; + GtkImage *read_only_icon; GcalContext *context; GcalEvent *event; @@ -348,6 +351,30 @@ format_single_day (GcalEventPopover *self, g_assert_not_reached (); } +static void +update_decorations (GcalEventPopover *self, + GcalEvent *event) +{ + GcalCalendar *calendar; + gboolean calendar_is_read_only; + + calendar = gcal_event_get_calendar (event); + calendar_is_read_only = gcal_calendar_is_read_only (calendar); + + gtk_widget_set_visible (GTK_WIDGET (self->read_only_icon), calendar_is_read_only); + + if (calendar_is_read_only) + { + gtk_button_set_icon_name (GTK_BUTTON (self->action_button), "info-outline-symbolic"); + gtk_widget_set_tooltip_text (self->action_button, _("View Additional Details")); + } + else + { + gtk_button_set_icon_name (GTK_BUTTON (self->action_button), "edit-symbolic"); + gtk_widget_set_tooltip_text (self->action_button, _("Edit Additional Details")); + } +} + static void update_date_time_label (GcalEventPopover *self) { @@ -407,11 +434,8 @@ update_date_time_label (GcalEventPopover *self) static void update_placeholder_label (GcalEventPopover *self) { - gboolean placeholder_visible = FALSE; - - placeholder_visible |= !gtk_widget_get_visible (GTK_WIDGET (self->location_box)) && - !gtk_widget_get_visible (GTK_WIDGET (self->description_label)); - gtk_widget_set_visible (GTK_WIDGET (self->placeholder_label), placeholder_visible); + gtk_widget_set_visible (GTK_WIDGET (self->placeholder_label), + !gtk_widget_get_visible (GTK_WIDGET (self->description_scrolled_window))); } static void @@ -424,7 +448,7 @@ add_meeting (GcalEventPopover *self, g_signal_connect (row, "join-meeting", G_CALLBACK (on_join_meeting_cb), self); gtk_list_box_append (self->meetings_listbox, row); - gtk_widget_set_visible (GTK_WIDGET (self->meetings_listbox), TRUE); + gtk_widget_set_visible (GTK_WIDGET (self->meetings_box), TRUE); } static void @@ -455,7 +479,8 @@ setup_location_label (GcalEventPopover *self) } gtk_widget_set_visible (self->location_box, - location && g_utf8_strlen (location, -1) > 0); + location && g_utf8_strlen (location, -1) > 0 && + !gtk_widget_get_visible (GTK_WIDGET (self->meetings_box))); gtk_label_set_markup (self->location_label, location); } @@ -479,7 +504,7 @@ setup_description_label (GcalEventPopover *self) g_string_replace (string, " ", " ", 0); gtk_label_set_markup (self->description_label, string->str); - gtk_widget_set_visible (GTK_WIDGET (self->description_label), string->str && *string->str); + gtk_widget_set_visible (GTK_WIDGET (self->description_scrolled_window), string->str && *string->str); } static void @@ -494,8 +519,9 @@ set_event_internal (GcalEventPopover *self, setup_location_label (self); update_placeholder_label (self); update_date_time_label (self); + update_decorations (self, event); - gtk_widget_grab_focus (self->edit_button); + gtk_widget_grab_focus (self->action_button); } @@ -504,8 +530,8 @@ set_event_internal (GcalEventPopover *self, */ static void -on_edit_button_clicked_cb (GtkButton *edit_button, - GcalEventPopover *self) +on_action_button_clicked_cb (GtkButton *action_button, + GcalEventPopover *self) { g_signal_emit (self, signals[EDIT], 0); gtk_popover_popdown (GTK_POPOVER (self)); @@ -575,7 +601,7 @@ gcal_event_popover_map (GtkWidget *widget) if (first_meeting_row) gtk_widget_grab_focus (GTK_WIDGET (first_meeting_row)); else - gtk_widget_grab_focus (self->edit_button); + gtk_widget_grab_focus (self->action_button); } @@ -695,14 +721,17 @@ gcal_event_popover_class_init (GcalEventPopoverClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, date_time_label); gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, description_label); - gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, edit_button); + gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, description_scrolled_window); + gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, action_button); gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, location_box); gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, location_label); + gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, meetings_box); gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, meetings_listbox); gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, placeholder_label); gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, summary_label); + gtk_widget_class_bind_template_child (widget_class, GcalEventPopover, read_only_icon); - gtk_widget_class_bind_template_callback (widget_class, on_edit_button_clicked_cb); + gtk_widget_class_bind_template_callback (widget_class, on_action_button_clicked_cb); } static void diff --git a/src/gui/gcal-event-popover.ui b/src/gui/gcal-event-popover.ui index a837793e..ea8b74d0 100644 --- a/src/gui/gcal-event-popover.ui +++ b/src/gui/gcal-event-popover.ui @@ -1,142 +1,92 @@ diff --git a/src/gui/gcal-meeting-row.c b/src/gui/gcal-meeting-row.c index b06589f2..c1cb6d05 100644 --- a/src/gui/gcal-meeting-row.c +++ b/src/gui/gcal-meeting-row.c @@ -27,14 +27,16 @@ struct _GcalMeetingRow { - AdwActionRow parent_instance; + GtkListBoxRow parent_instance; GtkWidget *join_button; + GtkLabel *title; + GtkLabel *subtitle; gchar *url; }; -G_DEFINE_TYPE (GcalMeetingRow, gcal_meeting_row, ADW_TYPE_ACTION_ROW) +G_DEFINE_TYPE (GcalMeetingRow, gcal_meeting_row, GTK_TYPE_LIST_BOX_ROW) enum { @@ -65,12 +67,12 @@ setup_meeting (GcalMeetingRow *self) const gchar *service_name = gcal_get_service_name_from_url (self->url); if (service_name) - adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), service_name); + gtk_label_set_label (self->title, service_name); else - adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), _("Unknown Service")); + gtk_label_set_label (self->title, _("Unknown Service")); - markup_url = g_strdup_printf ("%s", self->url, self->url); - adw_action_row_set_subtitle (ADW_ACTION_ROW (self), markup_url); + markup_url = g_strdup_printf ("%1$s", self->url); + gtk_label_set_markup (self->subtitle, markup_url); } /* @@ -181,6 +183,8 @@ gcal_meeting_row_class_init (GcalMeetingRowClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-meeting-row.ui"); gtk_widget_class_bind_template_child (widget_class, GcalMeetingRow, join_button); + gtk_widget_class_bind_template_child (widget_class, GcalMeetingRow, title); + gtk_widget_class_bind_template_child (widget_class, GcalMeetingRow, subtitle); gtk_widget_class_bind_template_callback (widget_class, on_join_button_clicked_cb); diff --git a/src/gui/gcal-meeting-row.ui b/src/gui/gcal-meeting-row.ui index b293835a..79bf9938 100644 --- a/src/gui/gcal-meeting-row.ui +++ b/src/gui/gcal-meeting-row.ui @@ -1,22 +1,53 @@ -