From 90d2b262a3c0a81ff4f6a2c4ab17c505fa1918c9 Mon Sep 17 00:00:00 2001 From: Titouan Real Date: Fri, 8 Nov 2024 18:57:12 +0100 Subject: [PATCH 1/5] Add GcalCalendarComboRow & GcalCalendarComboRowItem --- src/gui/gcal-calendar-combo-row-item.c | 189 +++++++++++++++++ src/gui/gcal-calendar-combo-row-item.h | 33 +++ src/gui/gcal-calendar-combo-row-item.ui | 32 +++ src/gui/gcal-calendar-combo-row.c | 262 ++++++++++++++++++++++++ src/gui/gcal-calendar-combo-row.h | 38 ++++ src/gui/gcal-calendar-combo-row.ui | 16 ++ src/gui/gui.gresource.xml | 2 + src/gui/meson.build | 2 + 8 files changed, 574 insertions(+) create mode 100644 src/gui/gcal-calendar-combo-row-item.c create mode 100644 src/gui/gcal-calendar-combo-row-item.h create mode 100644 src/gui/gcal-calendar-combo-row-item.ui create mode 100644 src/gui/gcal-calendar-combo-row.c create mode 100644 src/gui/gcal-calendar-combo-row.h create mode 100644 src/gui/gcal-calendar-combo-row.ui diff --git a/src/gui/gcal-calendar-combo-row-item.c b/src/gui/gcal-calendar-combo-row-item.c new file mode 100644 index 000000000..2dd52b4b4 --- /dev/null +++ b/src/gui/gcal-calendar-combo-row-item.c @@ -0,0 +1,189 @@ +/* gcal-calendar-combo-row-item.c + * + * Copyright 2024 Diego Iván M.E + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define G_LOG_DOMAIN "GcalCalendarComboRowItem" + +#include "config.h" +#include "gcal-calendar-combo-row-item.h" +#include "gcal-debug.h" +#include "gcal-utils.h" + +#include + +struct _GcalCalendarComboRowItem +{ + AdwActionRow parent; + + GtkImage *color_image; + GtkImage *visibility_image; + GcalCalendar *calendar; +}; + +G_DEFINE_TYPE (GcalCalendarComboRowItem, gcal_calendar_combo_row_item, ADW_TYPE_PREFERENCES_ROW) + +enum +{ + PROP_0, + PROP_CALENDAR, + N_PROPS, +}; + +static GParamSpec *properties [N_PROPS] = { NULL, }; + +static gboolean +paintable_from_gdk_rgb (GBinding *binding, + const GValue *from_value, + GValue *to_value, + gpointer user_data) +{ + GdkRGBA *rgba = g_value_get_boxed (from_value); + g_value_take_object (to_value, get_circle_paintable_from_color (rgba, 16)); + return TRUE; +} + +static void +updated_visibility_cb (GcalCalendarComboRowItem *self) +{ + g_autofree gchar *accessible_description = NULL; + + GCAL_ENTRY; + gtk_widget_set_visible (GTK_WIDGET (self->visibility_image), !gcal_calendar_get_visible (self->calendar)); + + if (!gcal_calendar_get_visible (self->calendar)) + accessible_description = g_strdup (_("This calendar is hidden")); + + gtk_accessible_update_property (GTK_ACCESSIBLE (self), + GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, accessible_description, -1); + GCAL_EXIT; +} + +static void +set_calendar (GcalCalendarComboRowItem *self, + GcalCalendar *calendar) +{ + g_return_if_fail (GCAL_IS_CALENDAR (calendar)); + g_set_object (&self->calendar, calendar); + + g_object_bind_property_full (self->calendar, "color", + self->color_image, "paintable", + G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, + paintable_from_gdk_rgb, + NULL, + NULL, + NULL); + g_signal_connect_object (self->calendar, + "notify::visible", (GCallback) updated_visibility_cb, + self, G_CONNECT_SWAPPED); + + g_object_bind_property (calendar, "name", self, "title", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); + + updated_visibility_cb (self); +} + +/* + * GObject overrides + */ + +static void +gcal_calendar_combo_row_item_finalize (GObject *object) +{ + GcalCalendarComboRowItem *self = (GcalCalendarComboRowItem *)object; + + g_clear_object (&self->calendar); + + G_OBJECT_CLASS (gcal_calendar_combo_row_item_parent_class)->finalize (object); +} + +static void +gcal_calendar_combo_row_item_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GcalCalendarComboRowItem *self = GCAL_CALENDAR_COMBO_ROW_ITEM (object); + + switch (prop_id) + { + case PROP_CALENDAR: + g_value_set_object (value, self->calendar); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gcal_calendar_combo_row_item_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GcalCalendarComboRowItem *self = GCAL_CALENDAR_COMBO_ROW_ITEM (object); + + switch (prop_id) + { + case PROP_CALENDAR: + g_assert (self->calendar == NULL); + set_calendar (self, g_value_get_object (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gcal_calendar_combo_row_item_class_init (GcalCalendarComboRowItemClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->finalize = gcal_calendar_combo_row_item_finalize; + object_class->get_property = gcal_calendar_combo_row_item_get_property; + object_class->set_property = gcal_calendar_combo_row_item_set_property; + + properties[PROP_CALENDAR] = g_param_spec_object ("calendar", + "Calendar", + "Calendar", + GCAL_TYPE_CALENDAR, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, N_PROPS, properties); + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-calendar-combo-row-item.ui"); + + gtk_widget_class_bind_template_child (widget_class, GcalCalendarComboRowItem, color_image); + gtk_widget_class_bind_template_child (widget_class, GcalCalendarComboRowItem, visibility_image); +} + +static void +gcal_calendar_combo_row_item_init (GcalCalendarComboRowItem *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); +} + +GtkWidget* +gcal_calendar_combo_row_item_new (GcalCalendar *calendar) +{ + return g_object_new (GCAL_TYPE_CALENDAR_COMBO_ROW_ITEM, + "calendar", calendar, + NULL); +} diff --git a/src/gui/gcal-calendar-combo-row-item.h b/src/gui/gcal-calendar-combo-row-item.h new file mode 100644 index 000000000..bf7ccf1e9 --- /dev/null +++ b/src/gui/gcal-calendar-combo-row-item.h @@ -0,0 +1,33 @@ +/* gcal-calendar-combo-row-item.h + * + * Copyright 2024 Diego Iván M.E + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include +#include "gcal-calendar.h" +G_BEGIN_DECLS + +#define GCAL_TYPE_CALENDAR_COMBO_ROW_ITEM (gcal_calendar_combo_row_item_get_type()) + +G_DECLARE_FINAL_TYPE (GcalCalendarComboRowItem, gcal_calendar_combo_row_item, GCAL, CALENDAR_COMBO_ROW_ITEM, AdwPreferencesRow) + +GtkWidget* gcal_calendar_combo_row_item_new (GcalCalendar *calendar); + +G_END_DECLS diff --git a/src/gui/gcal-calendar-combo-row-item.ui b/src/gui/gcal-calendar-combo-row-item.ui new file mode 100644 index 000000000..7499529dc --- /dev/null +++ b/src/gui/gcal-calendar-combo-row-item.ui @@ -0,0 +1,32 @@ + + + + diff --git a/src/gui/gcal-calendar-combo-row.c b/src/gui/gcal-calendar-combo-row.c new file mode 100644 index 000000000..61d65f14d --- /dev/null +++ b/src/gui/gcal-calendar-combo-row.c @@ -0,0 +1,262 @@ +/* gcal-calendar-combo-row.c + * + * Copyright (C) 2024 Titouan Real + * + * gnome-calendar is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gnome-calendar is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#define G_LOG_DOMAIN "GcalCalendarComboRow" + +#include "gcal-calendar-combo-row.h" +#include "gcal-calendar-combo-row-item.h" + +#include +#include +#include +#include + +struct _GcalCalendarComboRow +{ + AdwComboRow parent; +}; + +G_DEFINE_TYPE (GcalCalendarComboRow, gcal_calendar_combo_row, ADW_TYPE_COMBO_ROW); + +enum +{ + PROP_0, + PROP_CALENDAR, + N_PROPS +}; + +static GParamSpec* properties[N_PROPS] = { NULL, }; + + +/* + * Callbacks + */ + +static void +on_calendar_selected_cb (AdwComboRow *row, + GParamSpec *pspec, + GtkListItem *item) +{ + GtkWidget *checkmark = g_object_get_data (G_OBJECT (item), "checkmark"); + + if (adw_combo_row_get_selected_item (row) == gtk_list_item_get_item (item)) + gtk_widget_set_opacity (checkmark, 1); + else + gtk_widget_set_opacity (checkmark, 0); +} + +static void +calendar_item_setup_cb (GtkSignalListItemFactory *factory, + GtkListItem *item) +{ + GtkWidget *box, *checkmark; + + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + + checkmark = g_object_new (GTK_TYPE_IMAGE, + "accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION, + "icon-name", "object-select-symbolic", + NULL); + gtk_box_append (GTK_BOX (box), checkmark); + + g_object_set_data (G_OBJECT (item), "box", box); + g_object_set_data (G_OBJECT (item), "checkmark", checkmark); + + gtk_list_item_set_child (item, box); +} + +static void +calendar_item_bind_cb (GtkSignalListItemFactory *factory, + GtkListItem *item, + GcalCalendarComboRow *self) +{ + AdwComboRow *row = ADW_COMBO_ROW (self); + GtkWidget *box, *calendar_row, *checkmark; + GcalCalendar *data; + GtkWidget *popup; + + data = gtk_list_item_get_item (item); + + box = g_object_get_data (G_OBJECT (item), "box"); + checkmark = g_object_get_data (G_OBJECT (item), "checkmark"); + + calendar_row = gcal_calendar_combo_row_item_new (data); + + gtk_box_insert_child_after (GTK_BOX (box), calendar_row, NULL); + + popup = gtk_widget_get_ancestor (box, GTK_TYPE_POPOVER); + if (popup && gtk_widget_is_ancestor (popup, GTK_WIDGET (row))) + { + gtk_box_set_spacing (GTK_BOX (box), 0); + gtk_widget_set_visible (checkmark, TRUE); + g_signal_connect (row, "notify::selected-item", G_CALLBACK (on_calendar_selected_cb), item); + on_calendar_selected_cb (row, NULL, item); + } + else + { + gtk_box_set_spacing (GTK_BOX (box), 6); + gtk_widget_set_visible (checkmark, FALSE); + } + +} + +static void +calendar_item_unbind_cb (GtkSignalListItemFactory *factory, + GtkListItem *item, + GcalCalendarComboRow *self) +{ + AdwComboRow *row = ADW_COMBO_ROW (self); + + g_signal_handlers_disconnect_by_func (row, on_calendar_selected_cb, item); +} + + +/* + * GObject overrides + */ + +static void +gcal_calendar_combo_row_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GcalCalendarComboRow *self = GCAL_CALENDAR_COMBO_ROW (object); + + switch (prop_id) + { + case PROP_CALENDAR: + g_value_set_object (value, GCAL_CALENDAR (adw_combo_row_get_selected_item (ADW_COMBO_ROW (self)))); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gcal_calendar_combo_row_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GcalCalendarComboRow *self = GCAL_CALENDAR_COMBO_ROW (object); + + switch (prop_id) + { + case PROP_CALENDAR: + gcal_calendar_combo_row_set_calendar (self, g_value_get_object (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + } +} + +static void +gcal_calendar_combo_row_class_init (GcalCalendarComboRowClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = gcal_calendar_combo_row_get_property; + object_class->set_property = gcal_calendar_combo_row_set_property; + + /** + * GcalCalendarComboRow::calendar: + * + * The selected calendar of the combo row. + */ + properties[PROP_CALENDAR] = g_param_spec_object ("calendar", + "Calendar of the combo row", + "The selected calendar from the combo row", + GCAL_TYPE_CALENDAR, + G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, N_PROPS, properties); + + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-calendar-combo-row.ui"); + + gtk_widget_class_bind_template_callback (widget_class, calendar_item_setup_cb); + gtk_widget_class_bind_template_callback (widget_class, calendar_item_bind_cb); + gtk_widget_class_bind_template_callback (widget_class, calendar_item_unbind_cb); +} + +static void +gcal_calendar_combo_row_init (GcalCalendarComboRow *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); +} + +/** + * gcal_calendar_combo_row_new: + * + * Creates a new `CalendarComboRow`. + * + * Returns: the newly created `CalendarComboRow` + */ +GtkWidget* +gcal_calendar_combo_row_new (void) +{ + return g_object_new (GCAL_TYPE_CALENDAR_COMBO_ROW, NULL); +} + +/** + * gcal_calendar_combo_row_set_calendar: + * @self: a #GcalCalendarComboRow + * @calendar: a valid #GcalCalendar + * + * Sets the selected calendar. + */ +void +gcal_calendar_combo_row_set_calendar (GcalCalendarComboRow *self, + GcalCalendar *calendar) +{ + GListModel *model; + + g_return_if_fail (GCAL_IS_CALENDAR_COMBO_ROW (self)); + + model = adw_combo_row_get_model (ADW_COMBO_ROW (self)); + + if (model == NULL) + return; + + for (guint i = 0; i < g_list_model_get_n_items (model); i++) + { + if (g_list_model_get_item (model, i) == calendar) + adw_combo_row_set_selected (ADW_COMBO_ROW (self), i); + } + + g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CALENDAR]); +} + +/** + * gcal_calendar_combo_row_get_calendar: + * @self: a #GcalCalendarComboRow + * + * Gets the selected calendar. + * + * Returns: (nullable) (transfer none): The selected calendar + */ +GcalCalendar* +gcal_calendar_combo_row_get_calendar (GcalCalendarComboRow *self) +{ + g_return_val_if_fail (GCAL_IS_CALENDAR_COMBO_ROW (self), NULL); + + return adw_combo_row_get_selected_item (ADW_COMBO_ROW (self)); +} diff --git a/src/gui/gcal-calendar-combo-row.h b/src/gui/gcal-calendar-combo-row.h new file mode 100644 index 000000000..79cb272c5 --- /dev/null +++ b/src/gui/gcal-calendar-combo-row.h @@ -0,0 +1,38 @@ +/* gcal-calendar-combo-row.h + * + * Copyright (C) 2024 Titouan Real + * + * gnome-calendar is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * gnome-calendar is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#pragma once + +#include + +#include "gcal-calendar.h" + +G_BEGIN_DECLS + +#define GCAL_TYPE_CALENDAR_COMBO_ROW (gcal_calendar_combo_row_get_type ()) + +G_DECLARE_FINAL_TYPE (GcalCalendarComboRow, gcal_calendar_combo_row, GCAL, CALENDAR_COMBO_ROW, AdwComboRow) + +GtkWidget* gcal_calendar_combo_row_new (void); + +GcalCalendar* gcal_calendar_combo_row_get_calendar (GcalCalendarComboRow *self); + +void gcal_calendar_combo_row_set_calendar (GcalCalendarComboRow *self, + GcalCalendar *calendar); + +G_END_DECLS diff --git a/src/gui/gcal-calendar-combo-row.ui b/src/gui/gcal-calendar-combo-row.ui new file mode 100644 index 000000000..5794f443a --- /dev/null +++ b/src/gui/gcal-calendar-combo-row.ui @@ -0,0 +1,16 @@ + + + + diff --git a/src/gui/gui.gresource.xml b/src/gui/gui.gresource.xml index 1abfeff80..1eb6437c8 100644 --- a/src/gui/gui.gresource.xml +++ b/src/gui/gui.gresource.xml @@ -2,6 +2,8 @@ gcal-calendar-button.ui + gcal-calendar-combo-row.ui + gcal-calendar-combo-row-item.ui gcal-event-popover.ui gcal-event-widget.ui gcal-meeting-row.ui diff --git a/src/gui/meson.build b/src/gui/meson.build index 55599ef39..9cb5cc0cd 100644 --- a/src/gui/meson.build +++ b/src/gui/meson.build @@ -16,6 +16,8 @@ built_sources += gnome.compile_resources( sources += files( 'gcal-application.c', 'gcal-calendar-button.c', + 'gcal-calendar-combo-row.c', + 'gcal-calendar-combo-row-item.c', 'gcal-drop-overlay.c', 'gcal-event-popover.c', 'gcal-event-widget.c', -- GitLab From 3ca07464a29708d3675059584cca3d6e484be7db Mon Sep 17 00:00:00 2001 From: Titouan Real Date: Fri, 8 Nov 2024 18:58:02 +0100 Subject: [PATCH 2/5] Make GcalImportDialog use GcalCalendarComboRow --- src/gui/importer/gcal-import-dialog.c | 182 ++++--------------------- src/gui/importer/gcal-import-dialog.ui | 11 +- 2 files changed, 27 insertions(+), 166 deletions(-) diff --git a/src/gui/importer/gcal-import-dialog.c b/src/gui/importer/gcal-import-dialog.c index dcd826756..10d2903fd 100644 --- a/src/gui/importer/gcal-import-dialog.c +++ b/src/gui/importer/gcal-import-dialog.c @@ -23,6 +23,7 @@ #include "gcal-import-dialog.h" #include "config.h" +#include "gcal-calendar-combo-row.h" #include "gcal-debug.h" #include "gcal-import-file-row.h" #include "gcal-utils.h" @@ -39,25 +40,24 @@ typedef struct struct _GcalImportDialog { - AdwDialog parent; - - GtkBox *calendars_box; - GtkWidget *cancel_button; - AdwComboRow *calendar_combo_row; - AdwPreferencesGroup *files_group; - AdwHeaderBar *headerbar; - GtkWidget *import_button; - GtkWidget *placeholder_spinner; - GtkSizeGroup *title_sizegroup; - AdwToastOverlay *toast_overlay; - - GList *rows; - GcalCalendar *selected_calendar; - - GCancellable *cancellable; - GcalContext *context; - gint n_events; - gint n_files; + AdwDialog parent; + + GcalCalendarComboRow *calendar_combo_row; + GtkBox *calendars_box; + GtkWidget *cancel_button; + AdwPreferencesGroup *files_group; + AdwHeaderBar *headerbar; + GtkWidget *import_button; + GtkWidget *placeholder_spinner; + GtkSizeGroup *title_sizegroup; + AdwToastOverlay *toast_overlay; + + GList *rows; + + GCancellable *cancellable; + GcalContext *context; + gint n_events; + gint n_files; }; @@ -95,42 +95,19 @@ import_data_free (gpointer data) g_free (import_data); } -static gboolean -find_calendar (GListModel *model, - GcalCalendar *calendar, - guint *out_position) -{ - g_assert (out_position != NULL); - g_assert (G_IS_LIST_MODEL (model)); - g_assert (GCAL_IS_CALENDAR (calendar)); - - for (guint i = 0; i < g_list_model_get_n_items (model); i++) - { - GcalCalendar *aux = g_list_model_get_item (model, i); - g_assert (GCAL_IS_CALENDAR (aux)); - if (aux == calendar) - { - *out_position = i; - return TRUE; - } - } - return FALSE; -} - static void update_default_calendar (GcalImportDialog *self) { g_autoptr (GListModel) calendars = NULL; GcalCalendar *default_calendar; GcalManager *manager; - guint position; manager = gcal_context_get_manager (self->context); calendars = gcal_create_writable_calendars_model (manager); default_calendar = gcal_manager_get_default_calendar (manager); - if (default_calendar && find_calendar (calendars, default_calendar, &position)) - adw_combo_row_set_selected (self->calendar_combo_row, position); + if (default_calendar) + gcal_calendar_combo_row_set_calendar (self->calendar_combo_row, default_calendar); } static void @@ -146,7 +123,7 @@ setup_calendars (GcalImportDialog *self) // TODO: sort model - adw_combo_row_set_model (self->calendar_combo_row, calendars); + adw_combo_row_set_model (ADW_COMBO_ROW (self->calendar_combo_row), calendars); update_default_calendar (self); g_signal_connect_object (manager, "notify::default-calendar", G_CALLBACK (update_default_calendar), self, G_CONNECT_SWAPPED); @@ -246,112 +223,6 @@ on_events_created_cb (GObject *source_object, GCAL_EXIT; } -static void -on_calendar_combo_row_selected_item_changed_cb (AdwComboRow *combo_row, - GParamSpec *pspec, - GcalImportDialog *self) -{ - GCAL_ENTRY; - - self->selected_calendar = adw_combo_row_get_selected_item (combo_row); - - GCAL_EXIT; -} - -static void -on_combo_row_signal_factory_setup_cb (GtkSignalListItemFactory *factory, - GtkListItem *item, - GcalImportDialog *self) -{ - GtkWidget *label; - GtkWidget *color_icon; - GtkWidget *visibility_status_icon; - GtkWidget *grid; - - grid = gtk_grid_new (); - gtk_grid_set_column_spacing (GTK_GRID (grid), 6); - - color_icon = gtk_image_new (); - gtk_widget_add_css_class (color_icon, "calendar-color-image"); - g_object_set_data (G_OBJECT (grid), "color_icon", color_icon); - gtk_grid_attach (GTK_GRID (grid), color_icon, 0, 0, 1, 2); - - label = gtk_label_new (NULL); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - g_object_set_data (G_OBJECT (grid), "title", label); - gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1); - - label = gtk_label_new (NULL); - gtk_label_set_xalign (GTK_LABEL (label), 0.0); - gtk_widget_add_css_class (label, "caption"); - gtk_widget_add_css_class (label, "dim-label"); - g_object_set_data (G_OBJECT (grid), "subtitle", label); - gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1); - - visibility_status_icon = gtk_image_new (); - - g_object_set_data (G_OBJECT (grid), "visibility_status_icon", visibility_status_icon); - gtk_widget_set_hexpand (visibility_status_icon, TRUE); - gtk_widget_set_halign (visibility_status_icon, GTK_ALIGN_END); - gtk_grid_attach (GTK_GRID (grid), visibility_status_icon, 2, 0, 1, 2); - - gtk_list_item_set_child (item, grid); -} - -static void -on_combo_row_signal_factory_bind_cb (GtkSignalListItemFactory *factory, - GtkListItem *item, - GcalImportDialog *self) -{ - g_autoptr (GdkPaintable) color_paintable = NULL; - g_autofree gchar *parent_name = NULL; - GcalCalendar *calendar; - GtkWidget *label; - GtkWidget *color_icon_widget; - GtkWidget *grid; - - calendar = gtk_list_item_get_item (item); - - grid = gtk_list_item_get_child (item); - - color_icon_widget = g_object_get_data (G_OBJECT (grid), "color_icon"); - color_paintable = get_circle_paintable_from_color (gcal_calendar_get_color (calendar), 16); - gtk_image_set_from_paintable (GTK_IMAGE (color_icon_widget), color_paintable); - - /* Show indicator icons for calendars that are not shown in the views */ - if (!gcal_calendar_get_visible (calendar)) - { - g_autofree gchar *accessible_description = NULL; - g_autoptr (GIcon) visibility_icon = NULL; - GtkWidget *visibility_status_icon_widget; - - visibility_icon = g_themed_icon_new ("eye-not-looking-symbolic"); - visibility_status_icon_widget = g_object_get_data (G_OBJECT (grid), "visibility_status_icon"); - gtk_image_set_from_gicon (GTK_IMAGE (visibility_status_icon_widget), visibility_icon); - - accessible_description = g_strdup (_("This calendar is hidden")); - gtk_accessible_update_property (GTK_ACCESSIBLE (visibility_status_icon_widget), - GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, accessible_description, -1); - } - - label = g_object_get_data (G_OBJECT (grid), "title"); - gtk_label_set_label (GTK_LABEL (label), gcal_calendar_get_name (calendar)); - - /* Get a colored version of the calendar source's name, to use as a subtitle */ - get_source_parent_name_color (gcal_context_get_manager (self->context), - gcal_calendar_get_source (calendar), - &parent_name, - NULL); - - label = g_object_get_data (G_OBJECT (grid), "subtitle"); - gtk_label_set_label (GTK_LABEL (label), parent_name); - - if (gtk_widget_get_ancestor (grid, GTK_TYPE_POPOVER) != NULL) - gtk_widget_set_size_request (grid, 250, -1); - else - gtk_widget_set_size_request (grid, -1, -1); -} - static void import_data_thread (GTask *task, gpointer source_object, @@ -402,7 +273,7 @@ on_import_button_clicked_cb (GtkButton *button, GCAL_ENTRY; - g_assert (self->selected_calendar != NULL); + g_assert (gcal_calendar_combo_row_get_calendar (self->calendar_combo_row) != NULL); slist = NULL; for (l = self->rows; l; l = l->next) @@ -440,7 +311,7 @@ on_import_button_clicked_cb (GtkButton *button, gtk_widget_set_sensitive (GTK_WIDGET (self), FALSE); - client = gcal_calendar_get_client (self->selected_calendar); + client = gcal_calendar_get_client (gcal_calendar_combo_row_get_calendar (self->calendar_combo_row)); import_data = g_new0 (ImportData, 1); import_data->client = g_object_ref (client); @@ -552,6 +423,8 @@ gcal_import_dialog_class_init (GcalImportDialogClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + g_type_ensure (GCAL_TYPE_CALENDAR_COMBO_ROW); + object_class->constructed = gcal_import_dialog_constructed; object_class->finalize = gcal_import_dialog_finalize; object_class->get_property = gcal_import_dialog_get_property; @@ -582,10 +455,7 @@ gcal_import_dialog_class_init (GcalImportDialogClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalImportDialog, title_sizegroup); gtk_widget_class_bind_template_child (widget_class, GcalImportDialog, toast_overlay); - gtk_widget_class_bind_template_callback (widget_class, on_calendar_combo_row_selected_item_changed_cb); gtk_widget_class_bind_template_callback (widget_class, on_import_button_clicked_cb); - gtk_widget_class_bind_template_callback (widget_class, on_combo_row_signal_factory_bind_cb); - gtk_widget_class_bind_template_callback (widget_class, on_combo_row_signal_factory_setup_cb); } static void diff --git a/src/gui/importer/gcal-import-dialog.ui b/src/gui/importer/gcal-import-dialog.ui index 909d6cc57..779f702cf 100644 --- a/src/gui/importer/gcal-import-dialog.ui +++ b/src/gui/importer/gcal-import-dialog.ui @@ -56,23 +56,14 @@ - - True + C_alendar True - - - - - - - - -- GitLab From 923cb668dabff8d162f7f650f1637ca75fd83e2d Mon Sep 17 00:00:00 2001 From: Titouan Real Date: Fri, 8 Nov 2024 18:58:43 +0100 Subject: [PATCH 3/5] Make GcalEventEditor use GcalCalendarComboRow --- .../event-editor/gcal-event-editor-dialog.c | 129 +++--------------- .../event-editor/gcal-event-editor-dialog.ui | 95 ++----------- 2 files changed, 35 insertions(+), 189 deletions(-) diff --git a/src/gui/event-editor/gcal-event-editor-dialog.c b/src/gui/event-editor/gcal-event-editor-dialog.c index 550776f56..218cdee2c 100644 --- a/src/gui/event-editor/gcal-event-editor-dialog.c +++ b/src/gui/event-editor/gcal-event-editor-dialog.c @@ -20,7 +20,7 @@ #define G_LOG_DOMAIN "GcalEventEditorDialog" #include "gcal-alarm-row.h" -#include "gcal-calendar-row.h" +#include "gcal-calendar-combo-row.h" #include "gcal-context.h" #include "gcal-debug.h" #include "gcal-event-editor-dialog.h" @@ -51,31 +51,26 @@ struct _GcalEventEditorDialog { AdwDialog parent; - GtkListBox *calendars_listbox; - GtkWidget *cancel_button; - GtkWidget *delete_group; - GtkWidget *done_button; - GcalEventEditorSection *notes_section; - GcalEventEditorSection *reminders_section; - GcalEventEditorSection *schedule_section; - GtkWidget *sources_button; - GtkWidget *source_image; - GtkWidget *source_label; - GtkWidget *subtitle_label; - GcalEventEditorSection *summary_section; - GtkWidget *titlebar; - GtkWidget *title_label; + GcalCalendarComboRow *calendar_combo_row; + GtkWidget *cancel_button; + GtkWidget *delete_group; + GtkWidget *done_button; + GcalEventEditorSection *notes_section; + GcalEventEditorSection *reminders_section; + GcalEventEditorSection *schedule_section; + GtkWidget *source_label; + GcalEventEditorSection *summary_section; + GtkWidget *titlebar; + GtkWidget *title_label; GcalEventEditorSection *sections[4]; GMenu *sources_menu; - GSimpleActionGroup *action_group; GcalContext *context; GcalEvent *event; - GcalCalendar *selected_calendar; GBinding *event_title_binding; @@ -199,13 +194,6 @@ apply_event_properties_to_template_event (GcalEvent *template_event, } } -static GtkWidget * -create_row_func (gpointer data, - gpointer user_data) -{ - return gcal_calendar_row_new ((GcalCalendar *) data); -} - static void setup_context (GcalEventEditorDialog *self) { @@ -217,7 +205,7 @@ setup_context (GcalEventEditorDialog *self) manager = gcal_context_get_manager (self->context); calendars = gcal_create_writable_calendars_model (manager); - gtk_list_box_bind_model (self->calendars_listbox, calendars, create_row_func, self, NULL); + adw_combo_row_set_model ( ADW_COMBO_ROW (self->calendar_combo_row), calendars); GCAL_EXIT; } @@ -227,51 +215,6 @@ setup_context (GcalEventEditorDialog *self) * Callbacks */ -static void -on_calendar_selected_action_cb (GSimpleAction *action, - GVariant *value, - gpointer user_data) -{ - g_autoptr (GList) list = NULL; - GcalEventEditorDialog *self; - GcalManager *manager; - GList *aux; - const gchar *uid; - - GCAL_ENTRY; - - self = GCAL_EVENT_EDITOR_DIALOG (user_data); - manager = gcal_context_get_manager (self->context); - list = gcal_manager_get_calendars (manager); - - /* retrieve selected calendar uid */ - g_variant_get (value, "&s", &uid); - - /* search for any source with the given UID */ - for (aux = list; aux != NULL; aux = aux->next) - { - GcalCalendar *calendar = GCAL_CALENDAR (aux->data); - - if (g_strcmp0 (gcal_calendar_get_id (calendar), uid) == 0) - { - g_autoptr (GdkPaintable) paintable = NULL; - const GdkRGBA *color; - - /* retrieve color */ - color = gcal_calendar_get_color (calendar); - paintable = get_circle_paintable_from_color (color, 16); - gtk_image_set_from_paintable (GTK_IMAGE (self->source_image), paintable); - - self->selected_calendar = calendar; - - gtk_label_set_label (GTK_LABEL (self->subtitle_label), gcal_calendar_get_name (calendar)); - break; - } - } - - GCAL_EXIT; -} - static void on_cancel_button_clicked_cb (GtkButton *button, GcalEventEditorDialog *self) @@ -412,7 +355,7 @@ on_done_button_clicked_cb (GtkButton *button, if (gcal_calendar_is_read_only (calendar)) GCAL_GOTO (out); - selected_calendar = g_steal_pointer (&self->selected_calendar); + selected_calendar = gcal_calendar_combo_row_get_calendar (self->calendar_combo_row); calendar_changed = selected_calendar && calendar != selected_calendar; can_show_mod_all = TRUE; if (!self->event_is_new) @@ -498,7 +441,6 @@ gcal_event_editor_dialog_finalize (GObject *object) self = GCAL_EVENT_EDITOR_DIALOG (object); - g_clear_object (&self->action_group); g_clear_object (&self->context); g_clear_object (&self->event); @@ -566,6 +508,7 @@ gcal_event_editor_dialog_class_init (GcalEventEditorDialogClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + g_type_ensure (GCAL_TYPE_CALENDAR_COMBO_ROW); g_type_ensure (GCAL_TYPE_NOTES_SECTION); g_type_ensure (GCAL_TYPE_REMINDERS_SECTION); g_type_ensure (GCAL_TYPE_SCHEDULE_SECTION); @@ -621,16 +564,13 @@ gcal_event_editor_dialog_class_init (GcalEventEditorDialogClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/event-editor/gcal-event-editor-dialog.ui"); - gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, calendars_listbox); + gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, calendar_combo_row); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, cancel_button); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, delete_group); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, done_button); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, notes_section); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, reminders_section); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, schedule_section); - gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, sources_button); - gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, source_image); - gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, subtitle_label); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, summary_section); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, titlebar); gtk_widget_class_bind_template_child (widget_class, GcalEventEditorDialog, title_label); @@ -645,23 +585,8 @@ gcal_event_editor_dialog_class_init (GcalEventEditorDialogClass *klass) static void gcal_event_editor_dialog_init (GcalEventEditorDialog *self) { - const GActionEntry action_entries[] = { - { "select-calendar", on_calendar_selected_action_cb, "s" }, - }; gint i = 0; - /* Actions */ - self->action_group = g_simple_action_group_new (); - g_action_map_add_action_entries (G_ACTION_MAP (self->action_group), - action_entries, - G_N_ELEMENTS (action_entries), - self); - - gtk_widget_insert_action_group (GTK_WIDGET (self), - "event-editor-dialog", - G_ACTION_GROUP (self->action_group)); - - gtk_widget_init_template (GTK_WIDGET (self)); self->sections[i++] = self->notes_section; @@ -724,25 +649,13 @@ gcal_event_editor_dialog_set_event (GcalEventEditorDialog *self, if (self->sources_menu != NULL) g_menu_remove_all (self->sources_menu); - /* dialog titlebar's title & subtitle */ - paintable = get_circle_paintable_from_color (gcal_event_get_color (cloned_event), 10); - gtk_image_set_from_paintable (GTK_IMAGE (self->source_image), paintable); - - g_clear_pointer (&self->event_title_binding, g_binding_unbind); - self->event_title_binding = g_object_bind_property (cloned_event, - "summary", - self->title_label, - "label", - G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); - g_object_add_weak_pointer (G_OBJECT (self->event_title_binding), - (gpointer*) &self->event_title_binding); - - /* change title when event name is empty */ - if (!gcal_is_valid_event_name (gtk_label_get_label (GTK_LABEL (self->title_label)))) + /* dialog titlebar's title */ + if (new_event) gtk_label_set_label (GTK_LABEL (self->title_label), _("New Event")); + else + gtk_label_set_label (GTK_LABEL (self->title_label), _("Edit Event")); - gtk_label_set_label (GTK_LABEL (self->subtitle_label), gcal_calendar_get_name (calendar)); - self->selected_calendar = calendar; + gcal_calendar_combo_row_set_calendar (self->calendar_combo_row, calendar); /* recurrence_changed */ self->recurrence_changed = FALSE; diff --git a/src/gui/event-editor/gcal-event-editor-dialog.ui b/src/gui/event-editor/gcal-event-editor-dialog.ui index a1056f72f..f069a05cb 100644 --- a/src/gui/event-editor/gcal-event-editor-dialog.ui +++ b/src/gui/event-editor/gcal-event-editor-dialog.ui @@ -17,81 +17,12 @@ - - - - - - - True - 250 - 600 - never - - - none - - - - - - - - Select Calendar + + middle + 40 - - - 6 - - - vertical - center - - - middle - 40 - - - - - - horizontal - center - - - - - - - - - - - - - - - - - - pan-down-symbolic - - - - @@ -130,6 +61,16 @@ + + + + + + + + + + @@ -196,14 +137,6 @@ - - - - - vertical - - - -- GitLab From aca797d19293dfd5aa167bbfa89df9e3483f517b Mon Sep 17 00:00:00 2001 From: Titouan Real Date: Fri, 8 Nov 2024 18:59:24 +0100 Subject: [PATCH 4/5] Remove GcalCalendarRow --- .../event-editor/event-editor.gresource.xml | 1 - src/gui/event-editor/gcal-calendar-row.c | 192 ------------------ src/gui/event-editor/gcal-calendar-row.h | 33 --- src/gui/event-editor/gcal-calendar-row.ui | 32 --- src/gui/event-editor/meson.build | 1 - 5 files changed, 259 deletions(-) delete mode 100644 src/gui/event-editor/gcal-calendar-row.c delete mode 100644 src/gui/event-editor/gcal-calendar-row.h delete mode 100644 src/gui/event-editor/gcal-calendar-row.ui diff --git a/src/gui/event-editor/event-editor.gresource.xml b/src/gui/event-editor/event-editor.gresource.xml index c875c9e2d..38165c51f 100644 --- a/src/gui/event-editor/event-editor.gresource.xml +++ b/src/gui/event-editor/event-editor.gresource.xml @@ -2,7 +2,6 @@ gcal-alarm-row.ui - gcal-calendar-row.ui gcal-date-chooser.ui gcal-date-chooser-day.ui gcal-date-selector.ui diff --git a/src/gui/event-editor/gcal-calendar-row.c b/src/gui/event-editor/gcal-calendar-row.c deleted file mode 100644 index 2dcb57bcb..000000000 --- a/src/gui/event-editor/gcal-calendar-row.c +++ /dev/null @@ -1,192 +0,0 @@ -/* gcal-calendar-row.c - * - * Copyright 2024 Diego Iván M.E - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -#define G_LOG_DOMAIN "GcalCalendarRow" - -#include "config.h" -#include "gcal-calendar-row.h" -#include "gcal-debug.h" -#include "gcal-utils.h" - -#include - -struct _GcalCalendarRow -{ - AdwActionRow parent; - - GtkImage *color_image; - GtkImage *visibility_image; - GcalCalendar *calendar; -}; - -G_DEFINE_TYPE (GcalCalendarRow, gcal_calendar_row, ADW_TYPE_PREFERENCES_ROW) - -enum -{ - PROP_0, - PROP_CALENDAR, - N_PROPS, -}; - -static GParamSpec *properties [N_PROPS] = { NULL, }; - -static gboolean -paintable_from_gdk_rgb (GBinding *binding, - const GValue *from_value, - GValue *to_value, - gpointer user_data) -{ - GdkRGBA *rgba = g_value_get_boxed (from_value); - g_value_take_object (to_value, get_circle_paintable_from_color (rgba, 16)); - return TRUE; -} - -static void -updated_visibility_cb (GcalCalendarRow *self) -{ - g_autofree gchar *accessible_description = NULL; - - GCAL_ENTRY; - gtk_widget_set_visible (GTK_WIDGET (self->visibility_image), !gcal_calendar_get_visible (self->calendar)); - - if (!gcal_calendar_get_visible (self->calendar)) - accessible_description = g_strdup (_("This calendar is hidden")); - - gtk_accessible_update_property (GTK_ACCESSIBLE (self), - GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, accessible_description, -1); - GCAL_EXIT; -} - -static void -set_calendar (GcalCalendarRow *self, - GcalCalendar *calendar) -{ - g_return_if_fail (GCAL_IS_CALENDAR (calendar)); - g_set_object (&self->calendar, calendar); - - g_object_bind_property_full (self->calendar, "color", - self->color_image, "paintable", - G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE, - paintable_from_gdk_rgb, - NULL, - NULL, - NULL); - g_signal_connect_object (self->calendar, - "notify::visible", (GCallback) updated_visibility_cb, - self, G_CONNECT_SWAPPED); - - g_object_bind_property (calendar, "name", self, "title", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); - - gtk_actionable_set_action_name (GTK_ACTIONABLE (self), "event-editor-dialog.select-calendar"); - gtk_actionable_set_action_target (GTK_ACTIONABLE (self), "s", gcal_calendar_get_id (calendar)); - - updated_visibility_cb (self); -} - -/* - * GObject overrides - */ - -static void -gcal_calendar_row_finalize (GObject *object) -{ - GcalCalendarRow *self = (GcalCalendarRow *)object; - - g_clear_object (&self->calendar); - - G_OBJECT_CLASS (gcal_calendar_row_parent_class)->finalize (object); -} - -static void -gcal_calendar_row_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GcalCalendarRow *self = GCAL_CALENDAR_ROW (object); - - switch (prop_id) - { - case PROP_CALENDAR: - g_value_set_object (value, self->calendar); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -gcal_calendar_row_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GcalCalendarRow *self = GCAL_CALENDAR_ROW (object); - - switch (prop_id) - { - case PROP_CALENDAR: - g_assert (self->calendar == NULL); - set_calendar (self, g_value_get_object (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -gcal_calendar_row_class_init (GcalCalendarRowClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->finalize = gcal_calendar_row_finalize; - object_class->get_property = gcal_calendar_row_get_property; - object_class->set_property = gcal_calendar_row_set_property; - - properties[PROP_CALENDAR] = g_param_spec_object ("calendar", - "Calendar", - "Calendar", - GCAL_TYPE_CALENDAR, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); - - g_object_class_install_properties (object_class, N_PROPS, properties); - - gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/event-editor/gcal-calendar-row.ui"); - - gtk_widget_class_bind_template_child (widget_class, GcalCalendarRow, color_image); - gtk_widget_class_bind_template_child (widget_class, GcalCalendarRow, visibility_image); -} - -static void -gcal_calendar_row_init (GcalCalendarRow *self) -{ - gtk_widget_init_template (GTK_WIDGET (self)); -} - -GtkWidget* -gcal_calendar_row_new(GcalCalendar *calendar) -{ - return g_object_new (GCAL_TYPE_CALENDAR_ROW, - "calendar", calendar, - NULL); -} diff --git a/src/gui/event-editor/gcal-calendar-row.h b/src/gui/event-editor/gcal-calendar-row.h deleted file mode 100644 index cbbc1c88d..000000000 --- a/src/gui/event-editor/gcal-calendar-row.h +++ /dev/null @@ -1,33 +0,0 @@ -/* gcal-calendar-row.h - * - * Copyright 2024 Diego Iván M.E - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -#pragma once - -#include -#include "gcal-calendar.h" -G_BEGIN_DECLS - -#define GCAL_TYPE_CALENDAR_ROW (gcal_calendar_row_get_type()) - -G_DECLARE_FINAL_TYPE (GcalCalendarRow, gcal_calendar_row, GCAL, CALENDAR_ROW, AdwPreferencesRow) - -GtkWidget* gcal_calendar_row_new (GcalCalendar *calendar); - -G_END_DECLS diff --git a/src/gui/event-editor/gcal-calendar-row.ui b/src/gui/event-editor/gcal-calendar-row.ui deleted file mode 100644 index 97d3e3472..000000000 --- a/src/gui/event-editor/gcal-calendar-row.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - - diff --git a/src/gui/event-editor/meson.build b/src/gui/event-editor/meson.build index 857b9ef17..1c9707ff7 100644 --- a/src/gui/event-editor/meson.build +++ b/src/gui/event-editor/meson.build @@ -8,7 +8,6 @@ built_sources += gnome.compile_resources( sources += files( 'gcal-alarm-row.c', - 'gcal-calendar-row.c', 'gcal-date-chooser.c', 'gcal-date-chooser-day.c', 'gcal-date-selector.c', -- GitLab From 82e756c293628b0035ad14f3f96c154797d0c13e Mon Sep 17 00:00:00 2001 From: Titouan Real Date: Fri, 8 Nov 2024 19:07:43 +0100 Subject: [PATCH 5/5] Update `po/POTFILES.in` --- po/POTFILES.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index a8f27d112..2a157792f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -15,7 +15,6 @@ src/gui/calendar-management/gcal-new-calendar-page.c src/gui/calendar-management/gcal-new-calendar-page.ui src/gui/event-editor/gcal-alarm-row.c src/gui/event-editor/gcal-alarm-row.ui -src/gui/event-editor/gcal-calendar-row.c src/gui/event-editor/gcal-date-chooser.c src/gui/event-editor/gcal-event-editor-dialog.c src/gui/event-editor/gcal-event-editor-dialog.ui @@ -27,6 +26,8 @@ src/gui/event-editor/gcal-summary-section.ui src/gui/event-editor/gcal-time-selector.ui src/gui/gcal-application.c src/gui/gcal-calendar-button.ui +src/gui/gcal-calendar-combo-row.ui +src/gui/gcal-calendar-combo-row-item.c src/gui/gcal-event-popover.c src/gui/gcal-event-popover.ui src/gui/gcal-event-widget.c -- GitLab