Commit Graph
84 Commits
Author SHA1 Message Date
Hari Rana 312b286e2b utils: Add utility function for creating activate signal and shortcuts
The current way of adding activation shortcuts is cumbersome,
as it is a for-loop pasted in the middle of class initializers.
The utility function addresses this problem by simply allowing us
to declaratively add these shortcuts with minimal effort.

Furthermore, the implementation is also simpler, thanks to the
`gtk_widget_class_add_binding_signal()` wrapper function.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/747>
2026-05-04 10:42:02 +00:00
Hari Rana a84cf3aed9 utils: Add macro for getting default application
This will be needed as a replacement for the removal of the
"context" property on every object.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/702>
2026-03-23 19:29:58 +00:00
Hari Rana 50e048c7e0 utils: Turn number of weekdays into a macro
While "7" may be obvious in the context of calendaring that
it represents the number of week days, it often gives me the
impression of it being a magic number when I'm hyperfocused on certain
parts of the codebase for several consecutive hours. Turning the
number into a macro helps me scan functions much more easily.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/674>
2026-03-08 21:53:40 -04:00
mindonwarp ba3ca061ce event-editor: Add attendees section and details page
UX/UI designed by Philipp Sauberzweig (@PhilippSauberz).

The event editor dialog is now a NavigationView and the participants
details open in a separate page. Group attendees/participants in
AdwPreferencesGroups and bind groups'
ListBox widgets to backing filter models. These are just "views" into a
single GListStore containing all the event attendees.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/671>
2026-01-21 19:37:52 +00:00
99aea45334 utils: Honor "week-start-day" gsetting on startup
This lets users override the "first day of the week" through a
GSetting, instead of being forced to use whatever is defined by
the locale, which often may not be correct for their culture,
language or location.

Currently this would apply only upon (re)starting the app.

Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/160
Co-authored-by: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
Co-authored-by: Titouan Real <titouan.real@gmail.com>
Co-authored-by: Adrien Plazas <aplazas@gnome.org>
2025-12-28 13:02:27 -05:00
Georges Basile Stavracas Neto 67ca9ed20c utils: Watch calendars for read-only change
This should make the list model update itself whenever a calendar
changes between read-only and read-write.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/660>
2025-11-18 12:09:01 -03:00
Alice Mikhaylenko 2a73bbe974 gcal-utils: Fix gtk gettext domain
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/651>
2025-10-19 16:56:23 +04:00
Georges Basile Stavracas Neto d16cc2bc68 utils: Remove get_source_parent_name_color
One less weird function lurking around.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/610>
2025-07-02 18:04:26 +00:00
Federico Mena Quintero ef8c6ff55d utils/source-discoverer: Use temporary variable only when tracing is enabled
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/581>
2025-05-28 18:08:54 +00:00
TitouanReal 33aae54b32 utils: Recognize more services from location URLs 2025-04-21 19:38:30 +00:00
Georges Basile Stavracas Neto fbca670b62 utils: Add DnD target widget
Another utility function.
2025-03-19 19:23:57 -03:00
Georges Basile Stavracas Neto fe16da8ced utils: Add util function for selection widgetry
Will be used by the week grid
2025-03-19 19:23:57 -03:00
Titouan Real 42f891ff42 gui/event-editor: Add time zone selection
Creates a chooser managing a GDateTime. The chooser allows the user
to change the date, the time and the timezone independently.

This replaces the precedent GcalTimeChooserRow widget, because it is
easier to manage the different interactions with the user in a single
widget.

Co-authored-by: Georges Basile Stavracas Neto
<georges.stavracas@gmail.com>
2025-01-31 19:37:26 -03:00
Felipe Anibal 3ce7575479 utils/date-time-utils: change date_time_from_icaltime to use tz offset
Getting the time zone based on the location of the event doesn't work
with virtual time zones, causing the offset to be incorrect on the
import dialog. This changes the function to adjust the time zone of the
GDateTime based on the offset from UTC, which should work for both
virtual and real timezones.

See #1243
2024-11-19 18:10:02 +00:00
Georges Basile Stavracas Neto 004fdb0f3d utils: Shuffle and cleanup some paintable code
- It's only used in GcalShellSearchProvider so move it there.
- GdkTexture implements GIcon so no need to convert to a pixbuf.
2024-10-11 22:55:03 -03:00
Diego Iván M.E 9443520411 utils: Fix double free in gcal_create_writable_calendars_model
gtk_filter_list_model_new expected that the model passed to be
an owned reference, but we were passing an unowned one, causing
a double free after the function is called repeatedly. This
was particularly noticeable in the importer dialog.

Fixes #1282
2024-08-27 13:40:28 +00:00
Hari Rana 8ff3a843b3 utils: Add function to create writable-only calendars lists 2024-08-23 13:46:00 -03:00
Jean-François Fortin Tam 588bec96b6 utils/source-discoverer: Fix HTTP errors interpretation
There can be many reasons why a request is not allowed or authorized.
403 and 405 HTTP error codes do not prompt the visitor for credentials.
Only 401 and 407 responses are credentials prompts.

Only raise a username and password request when facing a 401 or 407.

Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/645
Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/552
2024-08-16 18:47:57 -04:00
Jean-François Fortin Tam 577efdd967 utils/source-discoverer: Add a debug statement
This debug statement would happen before any interpretation of errors,
which is useful in troubleshooting issues related to interpretation.

Related: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/645
2024-08-16 18:47:57 -04:00
Jean-François Fortin Tam 008b914f9e utils/source-discoverer: Set the User-Agent
This avoids some web servers or WAFs doing weird stuff with our requests
which would lead to situations where our web calendar source discovery
would face server errors, redirects, incorrect contents, etc.

Fixes #651

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/290
2024-08-07 12:32:00 -04:00
Georges Basile Stavracas Neto ae03627f0c utils: Port to AdwAlertDialog 2024-07-09 17:09:29 -03:00
Otávio Silva 9433db55a2 utils: Move get_service_name_from_url to utils
This function can be useful in contexts other than the creation of
the meeting row.
2024-07-09 16:14:47 -03:00
Georges Basile Stavracas Neto cbe89a9daa gui/event-editor: Rework calendars menu
Use a GtkListBox and bind from the model. Create rows from the model
items, and bind properties as needed.

The action target is set only when the calendar is writable because
setting an invalid action+target pair makes the row insensitive.

Remove the ancient menu icon hack.
2024-03-01 00:39:42 -03:00
Hari Rana ddb54c8c1c event-editor: Improve event name validation handling
- Fix a bug where clicking the "Add Event" button created an empty title in the event editor dialog.
- Add "error" class when the user writes an invalid event name.
- Add new function to validate event name.

Because the sections are split into files, the event editor will need a signal to check that each section is correct, and each section will have to emit the signal. This will need to be done in a future commit.
2024-02-25 08:55:17 -05:00
Daniel Garcia Moreno 68c921bf60 test: Add event_date_edit_tzid
This new test check that the tz data in the component is set correctly
after editing an event date end.

See https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/170
2023-11-09 20:59:59 +00:00
Daniel Garcia Moreno 6afb5cf3a5 view: Fix daylight saving issue in week view
This patch fixes an issue when creating new events in week view the week
after the daylight saving change.

The problem was in the calc of the selected date, that's done couting
the 30 minutes slots and adding that minutes to the week_start datetime.
When there's a daylight saving change, the real date to select should be
adjusted. This patch adds a new util function to make it easy to add
minutes ignoring the tz so we can make this calc directly with
gcal_date_time_add_floating_minutes.

This also includes a new test file with some checks for the new util
function and spring / autumn changes.

This new function could be used in other places to fix specific issues
that could be caused by the same logic error, calculate a selection or
event position based on GDateTime operations.

Fix https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/482
2023-11-09 13:17:20 +00:00
Georges Basile Stavracas Neto b26f33ea10 utils: Remove 24h utility function
The last user of this function is gone now.
2023-09-23 02:39:39 -03:00
Victoria Lacroix aec45594f9 gcal-utils: Combine GNOME Settings launchers
This refactor combines the functions
gcal_utils_launch_online_accounts_panel and
gcal_utils_launch_datetime_settings_panel into a single function that
takes a panel ID as an argument.
2023-07-15 23:04:51 +00:00
Victoria Lacroix 3526cadcca gcal-window: datetime settings shortcut
Shortcut is added so that time-related system settings can be easily
accessed. See #1023

The code is largely just a copy-paste of the code that opens the
"Online Accounts…" menu.

Fixes #1023
2023-07-15 23:04:51 +00:00
Christopher Davis 9a9cfb5468 gcal-utils: Use AdwMessageDialog
Use the new adaptive AdwMessageDialog widget
where we previously used GtkMessageDialog.
2023-06-17 18:49:19 -03:00
Georges Basile Stavracas Neto 0322bcf54c utils/source-discoverer: Test URI before discovery
This makes sure that we have a valid host set. This check is
copies from Soup's private SOUP_URI_IS_VALID() macro.

Add a test for this behavior.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/794
2023-03-05 11:24:49 -03:00
Georges Basile Stavracas Neto fd7baeb787 utils/source-discoverer: Pass error
An oversight of the GUri port.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/794
2023-03-03 19:50:30 -03:00
Georges Basile Stavracas Neto 2b947e83a6 utils/source-discoverer: Use caldav-stub and caldav
As per suggestion from Milan, use caldav-stub as the parent name,
and caldav as the backend name.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/539
2023-03-03 19:50:30 -03:00
Georges Basile Stavracas Neto 98f6ccdb88 utils/source-discoverer: Set security method
Set the security method of the discovered source into the newly
created source. This should preserve the TLS security method in
these sources.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/40
2023-03-03 19:50:30 -03:00
Georges Basile Stavracas Neto 02c2119c39 utils/source-discoverer: Use g_strcmp0
Cosmetical change.
2023-03-03 19:50:30 -03:00
Felipe Kinoshita 2805b414f8 general: Use gtk_widget_set_visible
A lot of places were using gtk_widget_show/gtk_widget_hide, but those
methods are deprecated since Gtk 4.10.

Let's use gtk_widget_set_visible instead.
2023-03-03 19:14:09 -03:00
Georges Basile Stavracas Neto 80dd2df7c3 utils: Remove obsolete comment 2022-11-21 08:45:09 -03:00
Clément Saccoccio e2adc7de5e source-discoverer: when importing a web iCal, allow an incorrect content type if the header is good 2022-10-24 21:06:18 +02:00
Georges Basile Stavracas Neto 6a5c0229b9 utils: Add boolean flag for showing MOD_ALL
This will be used by next commit to more finely control editing
of recurrent events.
2022-10-17 23:37:13 -03:00
Milan Crha d273b4304f gcal_set_date_time: Avoid possible use-after-free
When the `*dest` and `src` are the same, doing g_date_time_unref()
can free the instance before it's assigned back to the `*dest`.
2022-10-05 15:10:47 +00:00
Milan Crha 0bd11799dc Port to libsoup3 2022-06-22 08:51:30 -03:00
Reynir Björnsson 19b520fa2d source-discoverer: Fail if SoupUri creation fails 2022-06-15 14:10:02 +00:00
nahuelwexd 1de480f102 util: use new GNOME Settings app id 2022-04-07 19:42:50 -03:00
Björn Daase ad7ff65a4d event-editor/schedule-section: Fix localization mix
The gcal_util_translate_time_string function is a plain copy of
gnome-shells shell_util_translate_time_string solving the same problem.

Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/581
2022-02-12 17:43:49 +01:00
Georges Basile Stavracas Neto 69d320f49c event-editor/dialog: Improve calendar selection menu 2022-02-12 13:24:57 -03:00
Georges Basile Stavracas Neto 47a72f8156 event-editor-dialog: Port to new callback-based ask API 2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto ee5acbd493 Reimplement event drag n' drop
Reintroduce the code using GTK4 tooling for in-process DnD.
This is looking much better!
2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto fb504db31f util: Drop unused function 2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto 1cbce60c4a month-view: Port to GTK4 2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto b31b16da17 week-view: Port to GTK4 2022-02-12 13:08:50 -03:00