From 117c032d951becd760bf33a532719ec8e3a767fb Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Sun, 20 Sep 2026 07:40:42 -0400 Subject: [PATCH] utils: Prefix every function with `gcal_util_` Part-of: --- src/core/gcal-event.c | 12 +- src/core/gcal-shell-search-provider.c | 2 +- .../calendar-management/gcal-calendars-page.c | 4 +- .../gcal-edit-calendar-page.c | 6 +- .../gcal-new-calendar-page.c | 2 +- src/gui/common/gcal-calendar-row.c | 2 +- src/gui/common/gcal-date-chooser-day.c | 2 +- src/gui/common/gcal-date-chooser.c | 10 +- src/gui/event-editor/gcal-attendee-row.c | 6 +- .../event-editor/gcal-event-editor-dialog.c | 24 ++-- src/gui/event-editor/gcal-organizer-row.c | 4 +- src/gui/event-editor/gcal-reminders-section.c | 8 +- src/gui/event-editor/gcal-summary-section.c | 4 +- src/gui/gcal-calendar-list.c | 2 +- src/gui/gcal-event-popover.c | 2 +- src/gui/gcal-event-widget.c | 4 +- src/gui/gcal-meeting-row.c | 2 +- src/gui/gcal-quick-add-popover.c | 8 +- src/gui/gcal-window.c | 8 +- src/gui/importer/gcal-import-dialog.c | 2 +- src/gui/importer/gcal-import-file-row.c | 2 +- src/gui/views/gcal-month-cell.c | 4 +- src/gui/views/gcal-month-view-row.c | 2 +- src/gui/views/gcal-month-view.c | 14 +-- src/gui/views/gcal-week-grid.c | 12 +- src/gui/views/gcal-week-header.c | 14 +-- src/search/gcal-search-hit-event.c | 2 +- src/utils/gcal-date-time-utils.c | 2 +- src/utils/gcal-source-discoverer.c | 4 +- src/utils/gcal-utils.c | 112 +++++++++--------- src/utils/gcal-utils.h | 48 ++++---- tests/test-event.c | 2 +- tests/test-server.c | 14 +-- tests/test-utils.c | 6 +- 34 files changed, 176 insertions(+), 176 deletions(-) diff --git a/src/core/gcal-event.c b/src/core/gcal-event.c index a5e872a1..798027c3 100644 --- a/src/core/gcal-event.c +++ b/src/core/gcal-event.c @@ -200,7 +200,7 @@ get_timezone_from_ical (GcalEvent *self, /* libical-glib prior to 3.0.12 fails if no return location for is_daylight is passed */ offset = i_cal_timezone_get_utc_offset (zone, itt, &is_daylight); - tzid = format_utc_offset (offset); + tzid = gcal_util_format_utc_offset (offset); tz = g_time_zone_new_identifier (tzid); } @@ -291,7 +291,7 @@ load_alarms (GcalEvent *self) gint trigger_minutes; alarm = e_cal_component_get_alarm (self->component, l->data); - trigger_minutes = get_alarm_trigger_minutes (self, alarm); + trigger_minutes = gcal_util_get_alarm_trigger_minutes (self, alarm); /* We only support a single alarm for a given time */ if (!g_hash_table_contains (self->alarms, GINT_TO_POINTER (trigger_minutes))) @@ -423,7 +423,7 @@ setup_component (GcalEvent *self, gcal_event_set_location (self, location ? location : ""); /* Setup description */ - description = get_desc_from_component (self->component, "\n\n"); + description = gcal_util_get_desc_from_component (self->component, "\n\n"); gcal_event_set_description (self, description); /* Setup UID */ @@ -1198,7 +1198,7 @@ gcal_event_get_alarms (GcalEvent *self) gint trigger_minutes; alarm = e_cal_component_get_alarm (self->component, l->data); - trigger_minutes = get_alarm_trigger_minutes (self, alarm); + trigger_minutes = gcal_util_get_alarm_trigger_minutes (self, alarm); /* We only support a single alarm for a given time */ if (!g_hash_table_contains (tmp, GINT_TO_POINTER (trigger_minutes))) @@ -1271,7 +1271,7 @@ gcal_event_add_alarm (GcalEvent *self, g_return_if_fail (GCAL_IS_EVENT (self)); new_alarm = e_cal_component_alarm_copy (alarm); - minutes = get_alarm_trigger_minutes (self, alarm); + minutes = gcal_util_get_alarm_trigger_minutes (self, alarm); /* Only 1 alarm per relative time */ if (g_hash_table_contains (self->alarms, GINT_TO_POINTER (minutes))) @@ -1706,7 +1706,7 @@ gcal_event_alarms_equal (GcalEvent *event1, { ECalComponentAlarm *aux = i->data; - if (get_alarm_trigger_minutes (event1, alarm) != get_alarm_trigger_minutes (event1, aux)) + if (gcal_util_get_alarm_trigger_minutes (event1, alarm) != gcal_util_get_alarm_trigger_minutes (event1, aux)) continue; other_alarm = aux; diff --git a/src/core/gcal-shell-search-provider.c b/src/core/gcal-shell-search-provider.c index e4d57500..27c9a08e 100644 --- a/src/core/gcal-shell-search-provider.c +++ b/src/core/gcal-shell-search-provider.c @@ -267,7 +267,7 @@ get_result_metas_cb (GcalShellSearchProvider *self, g_variant_builder_add (&builder, "{sv}", "id", g_variant_new_string (uuid)); g_variant_builder_add (&builder, "{sv}", "name", g_variant_new_string (gcal_event_get_summary (event))); - paintable = get_circle_paintable_from_color (gcal_event_get_color (event), 96); + paintable = gcal_util_get_circle_paintable_from_color (gcal_event_get_color (event), 96); texture = paintable_to_texture (paintable); icon_variant = g_icon_serialize (G_ICON (texture)); g_variant_builder_add (&builder, "{sv}", "icon", icon_variant); diff --git a/src/gui/calendar-management/gcal-calendars-page.c b/src/gui/calendar-management/gcal-calendars-page.c index 31c04163..fd889bf2 100644 --- a/src/gui/calendar-management/gcal-calendars-page.c +++ b/src/gui/calendar-management/gcal-calendars-page.c @@ -84,7 +84,7 @@ make_calendar_row (GcalCalendarsPage *self, /* source color icon */ color = gcal_calendar_get_color (calendar); - color_paintable = get_circle_paintable_from_color (color, 24); + color_paintable = gcal_util_get_circle_paintable_from_color (color, 24); icon = GTK_WIDGET (gtk_builder_get_object (builder, "icon")); gtk_image_set_from_paintable (GTK_IMAGE (icon), color_paintable); @@ -248,7 +248,7 @@ on_calendar_color_changed_cb (GcalCalendar *calendar, const GdkRGBA *color; color = gcal_calendar_get_color (calendar); - color_paintable = get_circle_paintable_from_color (color, 24); + color_paintable = gcal_util_get_circle_paintable_from_color (color, 24); gtk_image_set_from_paintable (GTK_IMAGE (icon), color_paintable); } diff --git a/src/gui/calendar-management/gcal-edit-calendar-page.c b/src/gui/calendar-management/gcal-edit-calendar-page.c index 2ecabc06..e47449cf 100644 --- a/src/gui/calendar-management/gcal-edit-calendar-page.c +++ b/src/gui/calendar-management/gcal-edit-calendar-page.c @@ -384,9 +384,9 @@ on_settings_button_clicked_cb (GtkWidget *button, goa = e_source_get_extension (parent, E_SOURCE_EXTENSION_GOA); app = g_application_get_default (); - gcal_utils_launch_gnome_settings (g_application_get_dbus_connection (app), - "online-accounts", - e_source_goa_get_account_id (goa)); + gcal_util_launch_gnome_settings (g_application_get_dbus_connection (app), + "online-accounts", + e_source_goa_get_account_id (goa)); GCAL_EXIT; } diff --git a/src/gui/calendar-management/gcal-new-calendar-page.c b/src/gui/calendar-management/gcal-new-calendar-page.c index ea09bb73..3808b748 100644 --- a/src/gui/calendar-management/gcal-new-calendar-page.c +++ b/src/gui/calendar-management/gcal-new-calendar-page.c @@ -459,7 +459,7 @@ on_web_description_label_link_activated_cb (GtkLabel *label, { GDBusConnection *connection = g_application_get_dbus_connection (g_application_get_default ()); - gcal_utils_launch_gnome_settings (connection, "online-accounts", NULL); + gcal_util_launch_gnome_settings (connection, "online-accounts", NULL); } diff --git a/src/gui/common/gcal-calendar-row.c b/src/gui/common/gcal-calendar-row.c index 5cf3f2a5..bf531837 100644 --- a/src/gui/common/gcal-calendar-row.c +++ b/src/gui/common/gcal-calendar-row.c @@ -56,7 +56,7 @@ paintable_from_gdk_rgb (GBinding *binding, gpointer user_data) { GdkRGBA *rgba = g_value_get_boxed (from_value); - g_value_take_object (to_value, get_circle_paintable_from_color (rgba, 16)); + g_value_take_object (to_value, gcal_util_get_circle_paintable_from_color (rgba, 16)); return TRUE; } diff --git a/src/gui/common/gcal-date-chooser-day.c b/src/gui/common/gcal-date-chooser-day.c index 28d74740..dd762101 100644 --- a/src/gui/common/gcal-date-chooser-day.c +++ b/src/gui/common/gcal-date-chooser-day.c @@ -206,7 +206,7 @@ gcal_date_chooser_day_set_date (GcalDateChooserDay *self, else gtk_widget_remove_css_class (widget, "today"); - if (G_LIKELY (is_workday (weekday))) + if (G_LIKELY (gcal_util_is_workday (weekday))) gtk_widget_remove_css_class (widget, "non-workday"); else gtk_widget_add_css_class (widget, "non-workday"); diff --git a/src/gui/common/gcal-date-chooser.c b/src/gui/common/gcal-date-chooser.c index 0ce86bec..a2582bc3 100644 --- a/src/gui/common/gcal-date-chooser.c +++ b/src/gui/common/gcal-date-chooser.c @@ -393,7 +393,7 @@ format_month (GcalMultiChoice *choice, gint value, gpointer data) { - return g_strdup (gcal_get_month_name (value)); + return g_strdup (gcal_util_get_month_name (value)); } static gchar * @@ -408,9 +408,9 @@ format_month_year (GcalMultiChoice *choice, decode_combined_choice_value (value, &year, &month, NULL); if (g_date_time_get_year (now) == year) - return g_strdup (gcal_get_month_name (month - 1)); + return g_strdup (gcal_util_get_month_name (month - 1)); else - return g_strdup_printf ("%s %d", gcal_get_month_name (month - 1), year); + return g_strdup_printf ("%s %d", gcal_util_get_month_name (month - 1), year); } static void @@ -422,7 +422,7 @@ calendar_init_month_display (GcalDateChooser *self) for (i = 0; i < 12; i++) { - month = gcal_get_month_name (i); + month = gcal_util_get_month_name (i); months[i] = g_strdup (month); } @@ -1083,7 +1083,7 @@ gcal_date_chooser_init (GcalDateChooser *self) self->date = g_date_time_new_now_local (); g_date_time_get_ymd (self->date, &self->this_year, NULL, NULL); - self->week_start = get_first_weekday (); + self->week_start = gcal_util_get_first_weekday (); gtk_widget_init_template (GTK_WIDGET (self)); diff --git a/src/gui/event-editor/gcal-attendee-row.c b/src/gui/event-editor/gcal-attendee-row.c index 8e3dc291..619e098b 100644 --- a/src/gui/event-editor/gcal-attendee-row.c +++ b/src/gui/event-editor/gcal-attendee-row.c @@ -64,7 +64,7 @@ on_copy_email_cb (GSimpleAction *action, GdkClipboard *clipboard = gdk_display_get_clipboard (display); g_autofree const gchar *email = - gcal_get_email_from_mailto_uri (gcal_event_attendee_get_uri (self->attendee)); + gcal_util_get_email_from_mailto_uri (gcal_event_attendee_get_uri (self->attendee)); gdk_clipboard_set_text (clipboard, email); } @@ -90,7 +90,7 @@ setup_row_title_and_subtitle (GcalAttendeeRow *self) /* this is the initial line for both cases */ title = g_string_new (gcal_event_attendee_get_name (self->attendee)); - g_autofree const gchar *delegator_email = gcal_get_email_from_mailto_uri (gcal_event_attendee_get_uri (self->attendee)); + g_autofree const gchar *delegator_email = gcal_util_get_email_from_mailto_uri (gcal_event_attendee_get_uri (self->attendee)); if (gcal_event_attendee_get_part_status (self->attendee) != GCAL_EVENT_ATTENDEE_PART_DELEGATED) { @@ -104,7 +104,7 @@ setup_row_title_and_subtitle (GcalAttendeeRow *self) if (delegator_email) g_string_append_printf (title, " (%s)", delegator_email); - g_autofree const gchar *delegated_to = gcal_get_email_from_mailto_uri (gcal_event_attendee_get_delegated_to (self->attendee)); + g_autofree const gchar *delegated_to = gcal_util_get_email_from_mailto_uri (gcal_event_attendee_get_delegated_to (self->attendee)); subtitle = g_string_new (gettext ("Delegated to: ")); g_string_append (subtitle, delegated_to); } diff --git a/src/gui/event-editor/gcal-event-editor-dialog.c b/src/gui/event-editor/gcal-event-editor-dialog.c index 57002650..1ad1df34 100644 --- a/src/gui/event-editor/gcal-event-editor-dialog.c +++ b/src/gui/event-editor/gcal-event-editor-dialog.c @@ -111,7 +111,7 @@ validate (GcalEventEditorDialog *self) event_name = gcal_event_get_summary (self->edited_event); - gtk_widget_action_set_enabled (GTK_WIDGET (self), "event-editor.save", gcal_is_valid_event_name (event_name)); + gtk_widget_action_set_enabled (GTK_WIDGET (self), "event-editor.save", gcal_util_is_valid_event_name (event_name)); } static void @@ -252,7 +252,7 @@ set_up_context (GcalEventEditorDialog *self) context = gcal_application_get_context (GCAL_DEFAULT_APPLICATION); manager = gcal_context_get_manager (context); - writable_calendars = gcal_create_writable_calendars_model (manager); + writable_calendars = gcal_util_create_writable_calendars_model (manager); self->read_only_calendar_model = g_list_store_new (GCAL_TYPE_CALENDAR); @@ -310,11 +310,11 @@ save_event (GcalEventEditorDialog *self, if (gcal_event_has_recurrence (self->event) && gcal_event_has_recurrence (self->edited_event)) { - gcal_utils_ask_recurrence_modification_type (GTK_WIDGET (self), - self->edited_event, - schedule_equal, - on_ask_recurrence_response_save_cb, - self); + gcal_util_ask_recurrence_modification_type (GTK_WIDGET (self), + self->edited_event, + schedule_equal, + on_ask_recurrence_response_save_cb, + self); GCAL_RETURN (FALSE); } @@ -392,11 +392,11 @@ on_delete_row_activated_cb (AdwButtonRow *button, if (gcal_event_has_recurrence (self->edited_event)) { - gcal_utils_ask_recurrence_modification_type (GTK_WIDGET (self), - self->edited_event, - TRUE, - on_ask_recurrence_response_delete_cb, - self); + gcal_util_ask_recurrence_modification_type (GTK_WIDGET (self), + self->edited_event, + TRUE, + on_ask_recurrence_response_delete_cb, + self); } else { diff --git a/src/gui/event-editor/gcal-organizer-row.c b/src/gui/event-editor/gcal-organizer-row.c index 8ac6374c..a235e20f 100644 --- a/src/gui/event-editor/gcal-organizer-row.c +++ b/src/gui/event-editor/gcal-organizer-row.c @@ -60,7 +60,7 @@ on_copy_email_cb (GSimpleAction *action, GdkClipboard *clipboard = gdk_display_get_clipboard (display); g_autofree const gchar *email = - gcal_get_email_from_mailto_uri (gcal_event_organizer_get_uri (self->organizer)); + gcal_util_get_email_from_mailto_uri (gcal_event_organizer_get_uri (self->organizer)); gdk_clipboard_set_text (clipboard, email); } @@ -88,7 +88,7 @@ generate_subtitle (GcalOrganizerRow *self, if (organizer == NULL) return NULL; - email = gcal_get_email_from_mailto_uri (gcal_event_organizer_get_uri (organizer)); + email = gcal_util_get_email_from_mailto_uri (gcal_event_organizer_get_uri (organizer)); name_with_email = g_strdup_printf ("%s (%s)", gcal_event_organizer_get_name (organizer), email); return g_strdup (name_with_email); diff --git a/src/gui/event-editor/gcal-reminders-section.c b/src/gui/event-editor/gcal-reminders-section.c index 9579df92..e1574973 100644 --- a/src/gui/event-editor/gcal-reminders-section.c +++ b/src/gui/event-editor/gcal-reminders-section.c @@ -191,7 +191,7 @@ setup_alarms (GcalRemindersSection *self, alarm = l->data; /* Make already-added alarm buttons insensitive */ - minutes = get_alarm_trigger_minutes (event, alarm); + minutes = gcal_util_get_alarm_trigger_minutes (event, alarm); for (j = 0; j < G_N_ELEMENTS (minutes_button); j++) { @@ -237,10 +237,10 @@ sort_alarms_func (GtkListBoxRow *a, return -1; alarm_a = gcal_alarm_row_get_alarm (GCAL_ALARM_ROW (a)); - minutes_a = get_alarm_trigger_minutes (event, alarm_a); + minutes_a = gcal_util_get_alarm_trigger_minutes (event, alarm_a); alarm_b = gcal_alarm_row_get_alarm (GCAL_ALARM_ROW (b)); - minutes_b = get_alarm_trigger_minutes (event, alarm_b); + minutes_b = gcal_util_get_alarm_trigger_minutes (event, alarm_b); return minutes_a - minutes_b; } @@ -259,7 +259,7 @@ on_remove_alarm_cb (GcalAlarmRow *alarm_row, event = gcal_event_editor_section_get_event (GCAL_EVENT_EDITOR_SECTION (self)); alarm = gcal_alarm_row_get_alarm (alarm_row); - trigger_minutes = get_alarm_trigger_minutes (event, alarm); + trigger_minutes = gcal_util_get_alarm_trigger_minutes (event, alarm); gcal_event_remove_alarm (event, trigger_minutes); /* Make the button sensitive again */ diff --git a/src/gui/event-editor/gcal-summary-section.c b/src/gui/event-editor/gcal-summary-section.c index b666da79..58a541a1 100644 --- a/src/gui/event-editor/gcal-summary-section.c +++ b/src/gui/event-editor/gcal-summary-section.c @@ -53,9 +53,9 @@ on_summary_entry_text_changed_cb (GcalSummarySection *self) summary = gcal_event_get_summary (event); text = gtk_editable_get_text (GTK_EDITABLE (self->summary_entry)); - should_request_validation = gcal_is_valid_event_name (text) != gcal_is_valid_event_name (summary); + should_request_validation = gcal_util_is_valid_event_name (text) != gcal_util_is_valid_event_name (summary); - if (gcal_is_valid_event_name (text)) + if (gcal_util_is_valid_event_name (text)) gtk_widget_remove_css_class (GTK_WIDGET (self->summary_entry), "error"); else gtk_widget_add_css_class (GTK_WIDGET (self->summary_entry), "error"); diff --git a/src/gui/gcal-calendar-list.c b/src/gui/gcal-calendar-list.c index ca797640..10368acb 100644 --- a/src/gui/gcal-calendar-list.c +++ b/src/gui/gcal-calendar-list.c @@ -47,7 +47,7 @@ paintable_from_gdk_rgb (GBinding *binding, gpointer user_data) { GdkRGBA *rgba = g_value_get_boxed (from_value); - g_value_take_object (to_value, get_circle_paintable_from_color (rgba, 16)); + g_value_take_object (to_value, gcal_util_get_circle_paintable_from_color (rgba, 16)); return TRUE; } diff --git a/src/gui/gcal-event-popover.c b/src/gui/gcal-event-popover.c index 5d229961..997cf177 100644 --- a/src/gui/gcal-event-popover.c +++ b/src/gui/gcal-event-popover.c @@ -491,7 +491,7 @@ setup_description_label (GcalEventPopover *self) g_autofree gchar *meeting_url = NULL; g_autoptr (GString) string = NULL; - gcal_utils_extract_meeting_url (gcal_event_get_description (self->event), &description, &meeting_url); + gcal_util_extract_meeting_url (gcal_event_get_description (self->event), &description, &meeting_url); g_strstrip (description); diff --git a/src/gui/gcal-event-widget.c b/src/gui/gcal-event-widget.c index 05d34f3b..07cf5319 100644 --- a/src/gui/gcal-event-widget.c +++ b/src/gui/gcal-event-widget.c @@ -376,7 +376,7 @@ gcal_event_widget_set_event_tooltip (GcalEventWidget *self, if (error == NULL) { - const gchar *service_name = gcal_get_service_name_from_url (location); + const gchar *service_name = gcal_util_get_service_name_from_url (location); if (service_name) { @@ -717,7 +717,7 @@ gcal_event_widget_class_init (GcalEventWidgetClass *klass) */ g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation"); - signals[ACTIVATE] = gcal_create_activate_signal_and_shortcuts (widget_class, GCAL_TYPE_EVENT_WIDGET); + signals[ACTIVATE] = gcal_util_create_activate_signal_and_shortcuts (widget_class, GCAL_TYPE_EVENT_WIDGET); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-event-widget.ui"); diff --git a/src/gui/gcal-meeting-row.c b/src/gui/gcal-meeting-row.c index c1cb6d05..cab9ab42 100644 --- a/src/gui/gcal-meeting-row.c +++ b/src/gui/gcal-meeting-row.c @@ -64,7 +64,7 @@ setup_meeting (GcalMeetingRow *self) { g_autofree gchar *markup_url = NULL; - const gchar *service_name = gcal_get_service_name_from_url (self->url); + const gchar *service_name = gcal_util_get_service_name_from_url (self->url); if (service_name) gtk_label_set_label (self->title, service_name); diff --git a/src/gui/gcal-quick-add-popover.c b/src/gui/gcal-quick-add-popover.c index 470618f6..e79e81e4 100644 --- a/src/gui/gcal-quick-add-popover.c +++ b/src/gui/gcal-quick-add-popover.c @@ -494,7 +494,7 @@ edit_or_create_event (GcalQuickAddPopover *self, summary = gtk_editable_get_text (GTK_EDITABLE (self->summary_entry)); /* Create an ECalComponent from the data above */ - component = build_component_from_details (summary, date_start, date_end); + component = gcal_util_build_component_from_details (summary, date_start, date_end); event = gcal_event_new (calendar, component, NULL); gcal_event_set_all_day (event, all_day); @@ -520,7 +520,7 @@ summary_entry_text_changed (AdwEntryRow *entry, { gboolean is_valid_event_name; - is_valid_event_name = gcal_is_valid_event_name (gtk_editable_get_text (GTK_EDITABLE (entry))); + is_valid_event_name = gcal_util_is_valid_event_name (gtk_editable_get_text (GTK_EDITABLE (entry))); if (is_valid_event_name) gtk_widget_remove_css_class (GTK_WIDGET (entry), "error"); @@ -534,7 +534,7 @@ static void summary_entry_activated (AdwEntryRow *entry, GcalQuickAddPopover *self) { - if (gcal_is_valid_event_name (gtk_editable_get_text (GTK_EDITABLE (entry)))) + if (gcal_util_is_valid_event_name (gtk_editable_get_text (GTK_EDITABLE (entry)))) edit_or_create_event (self, self->add_button); else edit_or_create_event (self, self->edit_button); @@ -663,7 +663,7 @@ gcal_quick_add_popover_init (GcalQuickAddPopover *self) gtk_widget_init_template (GTK_WIDGET (self)); - self->read_write_calendars_model = gcal_create_writable_calendars_model (manager); + self->read_write_calendars_model = gcal_util_create_writable_calendars_model (manager); bind_model (self); diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c index 61fae4ce..d66affae 100644 --- a/src/gui/gcal-window.c +++ b/src/gui/gcal-window.c @@ -646,7 +646,7 @@ on_window_new_event_cb (GSimpleAction *action, end = g_date_time_add_days (start, 1); manager = gcal_context_get_manager (context); - comp = build_component_from_details ("", start, end); + comp = gcal_util_build_component_from_details ("", start, end); default_calendar = gcal_manager_get_default_calendar (manager); event = gcal_event_new (default_calendar, comp, NULL); @@ -660,7 +660,7 @@ on_window_open_date_time_settings_cb (GSimpleAction *action, { GDBusConnection *connection = g_application_get_dbus_connection (g_application_get_default ()); - gcal_utils_launch_gnome_settings (connection, "datetime", NULL); + gcal_util_launch_gnome_settings (connection, "datetime", NULL); } static void @@ -670,7 +670,7 @@ on_window_open_online_accounts_cb (GSimpleAction *action, { GDBusConnection *connection = g_application_get_dbus_connection (g_application_get_default ()); - gcal_utils_launch_gnome_settings (connection, "online-accounts", NULL); + gcal_util_launch_gnome_settings (connection, "online-accounts", NULL); } static void @@ -907,7 +907,7 @@ create_event_detailed_cb (GcalView *view, manager = gcal_context_get_manager (context); range_start = gcal_range_get_start (range); range_end = gcal_range_get_end (range); - comp = build_component_from_details ("", range_start, range_end); + comp = gcal_util_build_component_from_details ("", range_start, range_end); default_calendar = gcal_manager_get_default_calendar (manager); event = gcal_event_new (default_calendar, comp, NULL); diff --git a/src/gui/importer/gcal-import-dialog.c b/src/gui/importer/gcal-import-dialog.c index f90ccb12..b3ce2f49 100644 --- a/src/gui/importer/gcal-import-dialog.c +++ b/src/gui/importer/gcal-import-dialog.c @@ -107,7 +107,7 @@ setup_calendars (GcalImportDialog *self) GcalManager *manager; manager = gcal_context_get_manager (context); - calendars = gcal_create_writable_calendars_model (manager); + calendars = gcal_util_create_writable_calendars_model (manager); // TODO: sort model diff --git a/src/gui/importer/gcal-import-file-row.c b/src/gui/importer/gcal-import-file-row.c index 2939b725..80b6f799 100644 --- a/src/gui/importer/gcal-import-file-row.c +++ b/src/gui/importer/gcal-import-file-row.c @@ -170,7 +170,7 @@ fill_grid_with_event_data (GcalImportFileRow *self, } } - gcal_utils_extract_meeting_url (i_cal_component_get_description (ical_component), &description, NULL); + gcal_util_extract_meeting_url (i_cal_component_get_description (ical_component), &description, NULL); add_grid_row (self, grid, row++, _("Title"), i_cal_component_get_summary (ical_component)); add_grid_row (self, grid, row++, _("Location"), i_cal_component_get_location (ical_component)); diff --git a/src/gui/views/gcal-month-cell.c b/src/gui/views/gcal-month-cell.c index 908ec103..1e32cbe5 100644 --- a/src/gui/views/gcal-month-cell.c +++ b/src/gui/views/gcal-month-cell.c @@ -96,7 +96,7 @@ update_style_flags (GcalMonthCell *self) gtk_widget_remove_css_class (GTK_WIDGET (self), "today"); weekday = g_date_time_get_day_of_week (self->date); - if (is_workday (weekday)) + if (gcal_util_is_workday (weekday)) gtk_widget_add_css_class (GTK_WIDGET (self), "workday"); else gtk_widget_remove_css_class (GTK_WIDGET (self), "workday"); @@ -280,7 +280,7 @@ gcal_month_cell_class_init (GcalMonthCellClass *klass) 1, GTK_TYPE_WIDGET); - signals[ACTIVATE] = gcal_create_activate_signal_and_shortcuts (widget_class, GCAL_TYPE_MONTH_CELL); + signals[ACTIVATE] = gcal_util_create_activate_signal_and_shortcuts (widget_class, GCAL_TYPE_MONTH_CELL); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/views/gcal-month-cell.ui"); diff --git a/src/gui/views/gcal-month-view-row.c b/src/gui/views/gcal-month-view-row.c index 2bed977d..4ec0aca5 100644 --- a/src/gui/views/gcal-month-view-row.c +++ b/src/gui/views/gcal-month-view-row.c @@ -1405,7 +1405,7 @@ gcal_month_view_row_get_children_by_uuid (GcalMonthViewRow *self, { g_assert (GCAL_IS_MONTH_VIEW_ROW (self)); - return filter_children_by_uid_and_modtype (GTK_WIDGET (self), mod, uuid); + return gcal_util_filter_children_by_uid_and_modtype (GTK_WIDGET (self), mod, uuid); } GtkWidget* diff --git a/src/gui/views/gcal-month-view.c b/src/gui/views/gcal-month-view.c index f6162b1a..243586fb 100644 --- a/src/gui/views/gcal-month-view.c +++ b/src/gui/views/gcal-month-view.c @@ -194,13 +194,13 @@ allocate_overflow_popover (GcalMonthView *self, static inline void update_weekday_labels (GcalMonthView *self) { - const gint first_weekday = get_first_weekday (); + const gint first_weekday = gcal_util_get_first_weekday (); for (gint i = 0; i < N_WEEKDAYS; i++) { g_autofree gchar *weekday_name = NULL; - weekday_name = g_utf8_strup (gcal_get_weekday ((i + first_weekday) % N_WEEKDAYS), -1); + weekday_name = g_utf8_strup (gcal_util_get_weekday ((i + first_weekday) % N_WEEKDAYS), -1); gtk_label_set_label (GTK_LABEL (self->weekday_label[i]), weekday_name); } @@ -1047,11 +1047,11 @@ on_drop_target_drop_cb (GtkDropTarget *drop_target, data->event = g_object_ref (event); data->target_date = g_date_time_ref (target_date); - gcal_utils_ask_recurrence_modification_type (GTK_WIDGET (self), - event, - FALSE, - on_recurrence_response_cb, - data); + gcal_util_ask_recurrence_modification_type (GTK_WIDGET (self), + event, + FALSE, + on_recurrence_response_cb, + data); } else { diff --git a/src/gui/views/gcal-week-grid.c b/src/gui/views/gcal-week-grid.c index 6f4f48e2..6dd6f140 100644 --- a/src/gui/views/gcal-week-grid.c +++ b/src/gui/views/gcal-week-grid.c @@ -767,11 +767,11 @@ on_drop_target_drop_cb (GtkDropTarget *drop_target, data->event = g_object_ref (event); data->drop_cell = cell; - gcal_utils_ask_recurrence_modification_type (GTK_WIDGET (self), - event, - FALSE, - on_ask_recurrence_response_cb, - data); + gcal_util_ask_recurrence_modification_type (GTK_WIDGET (self), + event, + FALSE, + on_ask_recurrence_response_cb, + data); } else { @@ -1278,7 +1278,7 @@ gcal_week_grid_get_children_by_uuid (GcalWeekGrid *self, GCAL_ENTRY; - result = filter_children_by_uid_and_modtype (GTK_WIDGET (self), mod, uid); + result = gcal_util_filter_children_by_uid_and_modtype (GTK_WIDGET (self), mod, uid); GCAL_RETURN (g_steal_pointer (&result)); } diff --git a/src/gui/views/gcal-week-header.c b/src/gui/views/gcal-week-header.c index 1748174c..6b0b8da2 100644 --- a/src/gui/views/gcal-week-header.c +++ b/src/gui/views/gcal-week-header.c @@ -1375,11 +1375,11 @@ on_drop_target_drop_cb (GtkDropTarget *drop_target, data->event = g_object_ref (event); data->drop_cell = cell; - gcal_utils_ask_recurrence_modification_type (GTK_WIDGET (self), - event, - FALSE, - on_ask_recurrence_response_cb, - data); + gcal_util_ask_recurrence_modification_type (GTK_WIDGET (self), + event, + FALSE, + on_ask_recurrence_response_cb, + data); } else { @@ -1762,7 +1762,7 @@ gcal_week_header_init (GcalWeekHeader *self) gtk_widget_set_visible (self->dnd.widget, FALSE); gtk_widget_set_parent (self->dnd.widget, GTK_WIDGET (self)); - self->first_weekday = get_first_weekday (); + self->first_weekday = gcal_util_get_first_weekday (); gtk_widget_init_template (GTK_WIDGET (self)); @@ -1834,7 +1834,7 @@ gcal_week_header_get_children_by_uuid (GcalWeekHeader *self, GCAL_ENTRY; - result = filter_children_by_uid_and_modtype (GTK_WIDGET (self->grid), mod, uuid); + result = gcal_util_filter_children_by_uid_and_modtype (GTK_WIDGET (self->grid), mod, uuid); GCAL_RETURN (g_steal_pointer (&result)); } diff --git a/src/search/gcal-search-hit-event.c b/src/search/gcal-search-hit-event.c index ba099111..13d3a4c6 100644 --- a/src/search/gcal-search-hit-event.c +++ b/src/search/gcal-search-hit-event.c @@ -67,7 +67,7 @@ set_event (GcalSearchHitEvent *self, calendar = gcal_event_get_calendar (self->event); color = gcal_calendar_get_color (calendar); - paintable = get_circle_paintable_from_color (color, 16); + paintable = gcal_util_get_circle_paintable_from_color (color, 16); gcal_search_hit_set_primary_icon (search_hit, paintable); } diff --git a/src/utils/gcal-date-time-utils.c b/src/utils/gcal-date-time-utils.c index 64cc20c7..55ff5778 100644 --- a/src/utils/gcal-date-time-utils.c +++ b/src/utils/gcal-date-time-utils.c @@ -83,7 +83,7 @@ gcal_date_time_get_start_of_week (GDateTime *date) g_assert (date != NULL); - first_weekday = get_first_weekday (); + first_weekday = gcal_util_get_first_weekday (); weekday = g_date_time_get_day_of_week (date) % N_WEEKDAYS; n_days_after_week_start = (N_WEEKDAYS + weekday - first_weekday) % N_WEEKDAYS; diff --git a/src/utils/gcal-source-discoverer.c b/src/utils/gcal-source-discoverer.c index b6627737..f0b383ba 100644 --- a/src/utils/gcal-source-discoverer.c +++ b/src/utils/gcal-source-discoverer.c @@ -83,7 +83,7 @@ create_source_for_uri (DiscovererData *data) /* Display name */ path = g_uri_get_path (guri); basename = g_path_get_basename (path); - display_name = gcal_utils_format_filename_for_display (basename); + display_name = gcal_util_format_filename_for_display (basename); e_source_set_display_name (source, display_name); ext = e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR); @@ -283,7 +283,7 @@ discover_file_in_thread (DiscovererData *data, GCAL_TRACE_MSG ("Creating request for %s", uri_str); #endif - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", guri); g_signal_connect (message, "authenticate", G_CALLBACK (on_soup_message_authenticate_cb), data); diff --git a/src/utils/gcal-utils.c b/src/utils/gcal-utils.c index 7612c4d6..55b6f26b 100644 --- a/src/utils/gcal-utils.c +++ b/src/utils/gcal-utils.c @@ -105,7 +105,7 @@ month_item[12] = #define SCROLL_HARDNESS 10.0 /** - * gcal_get_weekday: + * gcal_util_get_weekday: * @i: the weekday index * * Retrieves the weekday name. @@ -113,13 +113,13 @@ month_item[12] = * Returns: (transfer full): the weekday name */ gchar* -gcal_get_weekday (gint i) +gcal_util_get_weekday (gint i) { return nl_langinfo (ab_day[i]); } /** - * gcal_get_month_name: + * gcal_util_get_month_name: * @i: the month index * * Retrieves the month name. @@ -127,13 +127,13 @@ gcal_get_weekday (gint i) * Returns: (transfer full): the month name */ gchar* -gcal_get_month_name (gint i) +gcal_util_get_month_name (gint i) { return nl_langinfo (month_item[i]); } /** - * get_circle_paintable_from_color: + * gcal_util_get_circle_paintable_from_color: * @color: a #GdkRGBA * @size: the size of the surface * @@ -143,8 +143,8 @@ gcal_get_month_name (gint i) * Returns: (transfer full): a #cairo_surface_t */ GdkPaintable* -get_circle_paintable_from_color (const GdkRGBA *color, - gint size) +gcal_util_get_circle_paintable_from_color (const GdkRGBA *color, + gint size) { g_autoptr (GtkSnapshot) snapshot = NULL; GskRoundedRect rect; @@ -164,7 +164,7 @@ get_circle_paintable_from_color (const GdkRGBA *color, } /** - * get_desc_from_component: + * gcal_util_get_desc_from_component: * @component: an #ECalComponent * @joint_char: the character to use when merging event comments * @@ -176,8 +176,8 @@ get_circle_paintable_from_color (const GdkRGBA *color, * description **/ gchar* -get_desc_from_component (ECalComponent *component, - const gchar *joint_char) +gcal_util_get_desc_from_component (ECalComponent *component, + const gchar *joint_char) { GSList *text_list; GSList *l; @@ -294,7 +294,7 @@ out: } /** - * get_first_weekday: + * gcal_util_get_first_weekday: * * Copied from Clocks, which by itself is * copied from GtkCalendar. @@ -302,7 +302,7 @@ out: * Returns: the first weekday, from 0 to 6 */ gint -get_first_weekday (void) +gcal_util_get_first_weekday (void) { gint week_start; @@ -356,7 +356,7 @@ get_first_weekday (void) } /** - * build_component_from_details: + * gcal_util_build_component_from_details: * @summary: * @initial_date: * @final_date: @@ -366,9 +366,9 @@ get_first_weekday (void) * Returns: (transfer full): an {@link ECalComponent} object **/ ECalComponent* -build_component_from_details (const gchar *summary, - GDateTime *initial_date, - GDateTime *final_date) +gcal_util_build_component_from_details (const gchar *summary, + GDateTime *initial_date, + GDateTime *final_date) { ECalComponent *event = NULL; ECalComponentDateTime *dt = NULL; @@ -433,7 +433,7 @@ build_component_from_details (const gchar *summary, } /** - * format_utc_offset: + * gcal_util_format_utc_offset: * @offset: an UTC offset * * Formats the UTC offset to a string that GTimeZone can @@ -443,7 +443,7 @@ build_component_from_details (const gchar *summary, * offset */ gchar* -format_utc_offset (gint64 offset) +gcal_util_format_utc_offset (gint64 offset) { const char *sign = "+"; gint hours, minutes, seconds; @@ -468,7 +468,7 @@ format_utc_offset (gint64 offset) } /** - * get_alarm_trigger_minutes: + * gcal_util_get_alarm_trigger_minutes: * @event: a #GcalEvent * @alarm: a #ECalComponentAlarm * @@ -479,8 +479,8 @@ format_utc_offset (gint64 offset) * start that @alarm will be triggered. */ gint -get_alarm_trigger_minutes (GcalEvent *event, - ECalComponentAlarm *alarm) +gcal_util_get_alarm_trigger_minutes (GcalEvent *event, + ECalComponentAlarm *alarm) { ECalComponentAlarmTrigger *trigger; ICalDuration *duration; @@ -548,7 +548,7 @@ struct /** - * is_workday: + * gcal_util_is_workday: * @day: a guint representing the day of a week (0…Sunday, 6…Saturday) * * Checks whether @day is workday or not based on the Territory part of Locale. @@ -556,7 +556,7 @@ struct * Returns: %TRUE if @day is a workday, %FALSE otherwise. */ gboolean -is_workday (guint day) +gcal_util_is_workday (guint day) { GcalWeekDay no_work_days; gchar *locale; @@ -592,9 +592,9 @@ is_workday (guint day) } GList* -filter_children_by_uid_and_modtype (GtkWidget *widget, - GcalRecurrenceModType mod, - const gchar *uid) +gcal_util_filter_children_by_uid_and_modtype (GtkWidget *widget, + GcalRecurrenceModType mod, + const gchar *uid) { GtkWidget *child; GcalEvent *event; @@ -692,9 +692,9 @@ create_dbus_proxy (GDBusConnection *connection, } void -gcal_utils_launch_gnome_settings (GDBusConnection *connection, - const gchar *panel_id, - const gchar *action) +gcal_util_launch_gnome_settings (GDBusConnection *connection, + const gchar *panel_id, + const gchar *action) { g_autoptr (GDBusProxy) proxy = NULL; GVariantBuilder builder; @@ -742,7 +742,7 @@ gcal_utils_launch_gnome_settings (GDBusConnection *connection, } gchar* -gcal_utils_format_filename_for_display (const gchar *filename) +gcal_util_format_filename_for_display (const gchar *filename) { /* * Foo_bar-something-cool.ics @@ -765,7 +765,7 @@ gcal_utils_format_filename_for_display (const gchar *filename) } static gboolean -gcal_utils_extract_google_section (const gchar *description, +gcal_util_extract_google_section (const gchar *description, gchar **out_description, gchar **out_meeting_url) { @@ -819,7 +819,7 @@ gcal_utils_extract_google_section (const gchar *description, } static gboolean -gcal_utils_extract_teams_section (const gchar *description, +gcal_util_extract_teams_section (const gchar *description, gchar **out_description, gchar **out_meeting_url) { @@ -876,7 +876,7 @@ gcal_utils_extract_teams_section (const gchar *description, } /** - * gcal_utils_extract_meeting_url: + * gcal_util_extract_meeting_url: * @description: (nullable): a string description * @out_description: (nullable)(transfer full): return location for a parsed description * @out_meeting_url: (nullable)(transfer full): return location for the parsed meeting url @@ -884,12 +884,12 @@ gcal_utils_extract_teams_section (const gchar *description, * Parses @description for meeting URLs. */ void -gcal_utils_extract_meeting_url (const char *description, - char **out_description, - char **out_meeting_url) +gcal_util_extract_meeting_url (const char *description, + char **out_description, + char **out_meeting_url) { - if (!gcal_utils_extract_google_section (description, out_description, out_meeting_url) && - !gcal_utils_extract_teams_section (description, out_description, out_meeting_url)) + if (!gcal_util_extract_google_section (description, out_description, out_meeting_url) && + !gcal_util_extract_teams_section (description, out_description, out_meeting_url)) { if (out_description) *out_description = g_strdup (description); @@ -933,11 +933,11 @@ on_message_dialog_response_cb (GObject *source_object, } void -gcal_utils_ask_recurrence_modification_type (GtkWidget *parent, - GcalEvent *event, - gboolean show_mod_all, - GcalAskRecurrenceCallback callback, - gpointer user_data) +gcal_util_ask_recurrence_modification_type (GtkWidget *parent, + GcalEvent *event, + gboolean show_mod_all, + GcalAskRecurrenceCallback callback, + gpointer user_data) { AskRecurrenceData *data; ECalClient *client; @@ -985,7 +985,7 @@ gcal_utils_ask_recurrence_modification_type (GtkWidget *parent, * Returns: (transfer full): a #GTimeZone */ GTimeZone * -gcal_util_get_app_timezone_or_local () +gcal_util_get_app_timezone_or_local (void) { GcalApplication *application = NULL; GcalContext *context = NULL; @@ -999,7 +999,7 @@ gcal_util_get_app_timezone_or_local () } /** - * gcal_is_valid_event_name: + * gcal_util_is_valid_event_name: * @event_name: the name of the event to check * * Check if the event name is valid @@ -1007,14 +1007,14 @@ gcal_util_get_app_timezone_or_local () * Returns: %TRUE if the name is valid, %FALSE otherwise. */ gboolean -gcal_is_valid_event_name (const gchar *event_name) +gcal_util_is_valid_event_name (const gchar *event_name) { g_autofree gchar *aux = g_strstrip (g_strdup (event_name)); return g_utf8_strlen (aux, -1) > 0; } /** - * gcal_get_service_name_from_url: + * gcal_util_get_service_name_from_url: * @url: the meeting url to get service name from * * Given a meeting service URL, get the service provider name, @@ -1023,7 +1023,7 @@ gcal_is_valid_event_name (const gchar *event_name) * Returns: the service name or NULL */ const gchar * -gcal_get_service_name_from_url (const gchar *url) +gcal_util_get_service_name_from_url (const gchar *url) { struct { const gchar *needle; @@ -1062,14 +1062,14 @@ gcal_get_service_name_from_url (const gchar *url) } /** - * gcal_create_soup_session: + * gcal_util_create_soup_session: * * Creates a new #SoupSession with correct default settings. * * Returns: (transfer full): a new #SoupSession */ SoupSession * -gcal_create_soup_session (void) +gcal_util_create_soup_session (void) { g_autoptr (SoupSession) session = NULL; @@ -1088,7 +1088,7 @@ gcal_create_soup_session (void) } /** - * gcal_create_writable_calendars_model: + * gcal_util_create_writable_calendars_model: * @manager: a #GcalManager * * Retrieves a model with all available read-write #GcalCalendar. @@ -1097,7 +1097,7 @@ gcal_create_soup_session (void) * Returns: (transfer full): a #GListModel with all available read-write #GcalCalendar */ GListModel* -gcal_create_writable_calendars_model (GcalManager *manager) +gcal_util_create_writable_calendars_model (GcalManager *manager) { g_autoptr (GtkFilterListModel) filter_model = NULL; GtkBoolFilter *bool_filter; @@ -1117,7 +1117,7 @@ gcal_create_writable_calendars_model (GcalManager *manager) } /** - * gcal_get_email_from_mailto_uri: + * gcal_util_get_email_from_mailto_uri: * @mailto_uri: the original mailto string. * * Tries to strip the "mailto:" part of the incoming string. @@ -1131,7 +1131,7 @@ gcal_create_writable_calendars_model (GcalManager *manager) * Returns: (transfer full) (nullable): The URI without the "mailto:" part. */ const gchar * -gcal_get_email_from_mailto_uri (const gchar *mailto_uri) +gcal_util_get_email_from_mailto_uri (const gchar *mailto_uri) { if (mailto_uri == NULL) return NULL; @@ -1169,8 +1169,8 @@ gcal_get_email_from_mailto_uri (const gchar *mailto_uri) * Returns: the signal ID */ guint -gcal_create_activate_signal_and_shortcuts (GtkWidgetClass *widget_class, - GType widget_type) +gcal_util_create_activate_signal_and_shortcuts (GtkWidgetClass *widget_class, + GType widget_type) { const guint activate_keyvals[] = { GDK_KEY_space, diff --git a/src/utils/gcal-utils.h b/src/utils/gcal-utils.h index c4846345..4d8e4ff5 100644 --- a/src/utils/gcal-utils.h +++ b/src/utils/gcal-utils.h @@ -53,62 +53,62 @@ typedef void (*GcalAskRecurrenceCallback) (GcalEvent *event, G_DEFINE_AUTOPTR_CLEANUP_FUNC (ICalTime, g_object_unref) -gchar* gcal_get_weekday (gint i); +gchar* gcal_util_get_weekday (gint i); -gchar* gcal_get_month_name (gint i); +gchar* gcal_util_get_month_name (gint i); -GdkPaintable* get_circle_paintable_from_color (const GdkRGBA *color, +GdkPaintable* gcal_util_get_circle_paintable_from_color (const GdkRGBA *color, gint size); -gchar* get_desc_from_component (ECalComponent *component, +gchar* gcal_util_get_desc_from_component (ECalComponent *component, const gchar *joint_char); -gint get_first_weekday (void); +gint gcal_util_get_first_weekday (void); -ECalComponent* build_component_from_details (const gchar *summary, +ECalComponent* gcal_util_build_component_from_details (const gchar *summary, GDateTime *initial_date, GDateTime *final_date); /* code brought from evolution */ -gchar* format_utc_offset (gint64 offset); +gchar* gcal_util_format_utc_offset (gint64 offset); -gint get_alarm_trigger_minutes (GcalEvent *event, +gint gcal_util_get_alarm_trigger_minutes (GcalEvent *event, ECalComponentAlarm *alarm); -gboolean is_workday (guint day); +gboolean gcal_util_is_workday (guint day); -GList* filter_children_by_uid_and_modtype (GtkWidget *widget, - GcalRecurrenceModType mod, - const gchar *uid); +GList* gcal_util_filter_children_by_uid_and_modtype (GtkWidget *widget, + GcalRecurrenceModType mod, + const gchar *uid); -void gcal_utils_launch_gnome_settings (GDBusConnection *connection, +void gcal_util_launch_gnome_settings (GDBusConnection *connection, const gchar *panel_id, const gchar *action); -gchar* gcal_utils_format_filename_for_display (const gchar *filename); +gchar* gcal_util_format_filename_for_display (const gchar *filename); -void gcal_utils_extract_meeting_url (const char *description, +void gcal_util_extract_meeting_url (const char *description, char **out_description, char **out_meeting_url); -void gcal_utils_ask_recurrence_modification_type (GtkWidget *parent, +void gcal_util_ask_recurrence_modification_type (GtkWidget *parent, GcalEvent *event, gboolean show_mod_all, GcalAskRecurrenceCallback callback, gpointer user_data); -GTimeZone * gcal_util_get_app_timezone_or_local (); +GTimeZone * gcal_util_get_app_timezone_or_local (void); -gboolean gcal_is_valid_event_name (const gchar *event_name); +gboolean gcal_util_is_valid_event_name (const gchar *event_name); -const gchar* gcal_get_service_name_from_url (const gchar *url); +const gchar* gcal_util_get_service_name_from_url (const gchar *url); -SoupSession * gcal_create_soup_session (void); +SoupSession * gcal_util_create_soup_session (void); -GListModel * gcal_create_writable_calendars_model (GcalManager *manager); +GListModel * gcal_util_create_writable_calendars_model (GcalManager *manager); -const gchar * gcal_get_email_from_mailto_uri (const gchar *mailto_uri); +const gchar * gcal_util_get_email_from_mailto_uri (const gchar *mailto_uri); -guint gcal_create_activate_signal_and_shortcuts (GtkWidgetClass *widget_class, - GType widget_type); +guint gcal_util_create_activate_signal_and_shortcuts (GtkWidgetClass *widget_class, + GType widget_type); #endif /* __GCAL_UTILS_H__ */ diff --git a/tests/test-event.c b/tests/test-event.c index 848210b3..9dd7340f 100644 --- a/tests/test-event.c +++ b/tests/test-event.c @@ -448,7 +448,7 @@ event_get_attendees (void) g_assert_cmpstr ("MAILTO:jane_doe@host.com", ==, gcal_event_organizer_get_sent_by (organizer)); g_assert_cmpstr ("mailto:alice@example.com", ==, gcal_event_organizer_get_uri (organizer)); - g_autofree const gchar *uri_trimmed = gcal_get_email_from_mailto_uri (gcal_event_organizer_get_uri (organizer)); + g_autofree const gchar *uri_trimmed = gcal_util_get_email_from_mailto_uri (gcal_event_organizer_get_uri (organizer)); g_assert_cmpstr ("alice@example.com", ==, uri_trimmed); } diff --git a/tests/test-server.c b/tests/test-server.c index 949c78c8..d28ad80e 100644 --- a/tests/test-server.c +++ b/tests/test-server.c @@ -105,7 +105,7 @@ server_request_no_auth_empty (void) server = init_server (); uri = gcal_simple_server_get_uri (server); - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", uri); g_signal_connect (message, "authenticate", G_CALLBACK (fail_authenticate_cb), server); @@ -130,7 +130,7 @@ server_request_no_auth_ics (void) uri = gcal_simple_server_get_uri (server); e_util_change_uri_component (&uri, SOUP_URI_PATH, "/public/calendar.ics"); - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", uri); g_signal_connect (message, "authenticate", G_CALLBACK (fail_authenticate_cb), server); @@ -155,7 +155,7 @@ server_request_no_auth_calendar (void) uri = gcal_simple_server_get_uri (server); e_util_change_uri_component (&uri, SOUP_URI_PATH, "/public/lf-calendar"); - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", uri); g_signal_connect (message, "authenticate", G_CALLBACK (fail_authenticate_cb), server); @@ -180,7 +180,7 @@ server_request_auth_empty (void) uri = gcal_simple_server_get_uri (server); e_util_change_uri_component (&uri, SOUP_URI_PATH, "/secret-area"); - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", uri); g_signal_connect (message, "authenticate", G_CALLBACK (authenticate_cb), server); @@ -205,7 +205,7 @@ server_request_auth_calendar (void) uri = gcal_simple_server_get_uri (server); e_util_change_uri_component (&uri, SOUP_URI_PATH, "/secret-area/lf-calendar"); - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", uri); g_signal_connect (message, "authenticate", G_CALLBACK (authenticate_cb), server); @@ -230,7 +230,7 @@ server_request_auth_ics (void) uri = gcal_simple_server_get_uri (server); e_util_change_uri_component (&uri, SOUP_URI_PATH, "/secret-area/calendar.ics"); - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", uri); g_signal_connect (message, "authenticate", G_CALLBACK (authenticate_cb), server); @@ -255,7 +255,7 @@ server_request_auth_wrong (void) uri = gcal_simple_server_get_uri (server); e_util_change_uri_component (&uri, SOUP_URI_PATH, "/secret-area"); - session = gcal_create_soup_session (); + session = gcal_util_create_soup_session (); message = soup_message_new_from_uri ("GET", uri); g_signal_connect (message, "authenticate", G_CALLBACK (wrong_authenticate_cb), server); diff --git a/tests/test-utils.c b/tests/test-utils.c index fb234750..bec3008b 100644 --- a/tests/test-utils.c +++ b/tests/test-utils.c @@ -170,21 +170,21 @@ extract_meeting_url (void) g_autofree char *description = NULL; g_autofree char *meeting_url = NULL; - gcal_utils_extract_meeting_url (GOOGLE_SAMPLE_DESCRIPTION, &description, &meeting_url); + gcal_util_extract_meeting_url (GOOGLE_SAMPLE_DESCRIPTION, &description, &meeting_url); g_assert_cmpstr (description, ==, ""); g_assert_cmpstr (meeting_url, ==, "https://meet.google.com/abc-defg-hij"); g_clear_pointer (&description, g_free); g_clear_pointer (&meeting_url, g_free); - gcal_utils_extract_meeting_url (GOOGLE_SAMPLE_DESCRIPTION_WITH_COMMENT, &description, &meeting_url); + gcal_util_extract_meeting_url (GOOGLE_SAMPLE_DESCRIPTION_WITH_COMMENT, &description, &meeting_url); g_assert_cmpstr (description, ==, "TROLOLO\n"); g_assert_cmpstr (meeting_url, ==, "https://meet.google.com/abc-defg-hij"); g_clear_pointer (&description, g_free); g_clear_pointer (&meeting_url, g_free); - gcal_utils_extract_meeting_url (TEAMS_SAMPLE_DESCRIPTION, &description, &meeting_url); + gcal_util_extract_meeting_url (TEAMS_SAMPLE_DESCRIPTION, &description, &meeting_url); g_assert_cmpstr (description, ==, ""); g_assert_cmpstr (meeting_url, ==, "https://teams.microsoft.com/meet/12345678912345?p=0AbCdEfGjKLm1nOjTj"); }