I#2417 - Calendar: Use meeting's timezone in the comp editor Schedule tab
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2417
This commit is contained in:
@ -921,6 +921,7 @@ e_comp_editor_event_constructed (GObject *object)
|
||||
ECompEditorPropertyPart *part;
|
||||
ECompEditorPropertyPart *summary;
|
||||
EFocusTracker *focus_tracker;
|
||||
EMeetingStore *meeting_store;
|
||||
GtkWidget *widget;
|
||||
|
||||
G_OBJECT_CLASS (e_comp_editor_event_parent_class)->constructed (object);
|
||||
@ -934,6 +935,8 @@ e_comp_editor_event_constructed (GObject *object)
|
||||
NULL, FALSE, 2);
|
||||
event_editor->priv->page_general = page;
|
||||
|
||||
meeting_store = e_comp_editor_page_general_get_meeting_store (E_COMP_EDITOR_PAGE_GENERAL (event_editor->priv->page_general));
|
||||
|
||||
part = e_comp_editor_property_part_summary_new (focus_tracker);
|
||||
e_comp_editor_page_add_property_part (page, part, 0, 2, 3, 1);
|
||||
summary = part;
|
||||
@ -994,6 +997,11 @@ e_comp_editor_event_constructed (GObject *object)
|
||||
event_editor->priv->description = part;
|
||||
|
||||
widget = e_comp_editor_property_part_get_edit_widget (event_editor->priv->timezone);
|
||||
|
||||
e_binding_bind_property (widget, "timezone",
|
||||
meeting_store, "timezone",
|
||||
G_BINDING_SYNC_CREATE);
|
||||
|
||||
e_comp_editor_property_part_datetime_attach_timezone_entry (
|
||||
E_COMP_EDITOR_PROPERTY_PART_DATETIME (event_editor->priv->dtstart),
|
||||
E_TIMEZONE_ENTRY (widget));
|
||||
@ -1035,9 +1043,7 @@ e_comp_editor_event_constructed (GObject *object)
|
||||
page = e_comp_editor_page_attachments_new (comp_editor);
|
||||
e_comp_editor_add_page (comp_editor, C_("ECompEditorPage", "Attachments"), page);
|
||||
|
||||
page = e_comp_editor_page_schedule_new (comp_editor,
|
||||
e_comp_editor_page_general_get_meeting_store (
|
||||
E_COMP_EDITOR_PAGE_GENERAL (event_editor->priv->page_general)));
|
||||
page = e_comp_editor_page_schedule_new (comp_editor, meeting_store);
|
||||
e_binding_bind_property (
|
||||
event_editor->priv->page_general, "show-attendees",
|
||||
page, "visible",
|
||||
|
||||
@ -46,6 +46,7 @@
|
||||
struct _EMeetingTimeSelectorPrivate {
|
||||
gboolean use_24_hour_format;
|
||||
gulong notify_free_busy_template_id;
|
||||
gulong notify_timezone_id;
|
||||
};
|
||||
|
||||
/* An array of hour strings for 24 hour time, "0:00" .. "23:00". */
|
||||
@ -185,7 +186,7 @@ static void row_inserted_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter
|
||||
static void row_changed_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
|
||||
static void row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data);
|
||||
|
||||
static void free_busy_template_changed_cb (EMeetingTimeSelector *mts);
|
||||
static void free_busy_schedule_refresh_cb (EMeetingTimeSelector *mts);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (
|
||||
EMeetingTimeSelector, e_meeting_time_selector, GTK_TYPE_TABLE,
|
||||
@ -240,6 +241,7 @@ meeting_time_selector_dispose (GObject *object)
|
||||
mts->model, G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, mts);
|
||||
e_signal_disconnect_notify_handler (mts->model, &mts->priv->notify_free_busy_template_id);
|
||||
e_signal_disconnect_notify_handler (mts->model, &mts->priv->notify_timezone_id);
|
||||
|
||||
g_object_unref (mts->model);
|
||||
mts->model = NULL;
|
||||
@ -394,7 +396,10 @@ e_meeting_time_selector_construct (EMeetingTimeSelector *mts,
|
||||
|
||||
mts->priv->notify_free_busy_template_id = e_signal_connect_notify_swapped (
|
||||
mts->model, "notify::free-busy-template",
|
||||
G_CALLBACK (free_busy_template_changed_cb), mts);
|
||||
G_CALLBACK (free_busy_schedule_refresh_cb), mts);
|
||||
mts->priv->notify_timezone_id = e_signal_connect_notify_swapped (
|
||||
mts->model, "notify::timezone",
|
||||
G_CALLBACK (free_busy_schedule_refresh_cb), mts);
|
||||
|
||||
g_signal_connect (
|
||||
mts->model, "row_inserted",
|
||||
@ -3192,7 +3197,7 @@ row_deleted_cb (GtkTreeModel *model,
|
||||
gtk_widget_queue_draw (mts->display_main);
|
||||
}
|
||||
|
||||
#define REFRESH_PAUSE 5
|
||||
#define REFRESH_PAUSE 2
|
||||
|
||||
static gboolean
|
||||
free_busy_timeout_refresh (gpointer data)
|
||||
@ -3208,9 +3213,9 @@ free_busy_timeout_refresh (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
free_busy_template_changed_cb (EMeetingTimeSelector *mts)
|
||||
free_busy_schedule_refresh_cb (EMeetingTimeSelector *mts)
|
||||
{
|
||||
/* Wait REFRESH_PAUSE before refreshing, using the latest uri value */
|
||||
/* Wait REFRESH_PAUSE before refreshing, using the latest uri value or timezone */
|
||||
if (mts->fb_refresh_not != 0)
|
||||
g_source_remove (mts->fb_refresh_not);
|
||||
|
||||
|
||||
@ -34,35 +34,6 @@ G_DEFINE_DYNAMIC_TYPE (
|
||||
e_settings_meeting_store,
|
||||
E_TYPE_EXTENSION)
|
||||
|
||||
static gboolean
|
||||
settings_map_string_to_icaltimezone (GValue *value,
|
||||
GVariant *variant,
|
||||
gpointer user_data)
|
||||
{
|
||||
GSettings *settings;
|
||||
const gchar *location = NULL;
|
||||
ICalTimezone *timezone = NULL;
|
||||
|
||||
settings = e_util_ref_settings ("org.gnome.evolution.calendar");
|
||||
|
||||
if (g_settings_get_boolean (settings, "use-system-timezone"))
|
||||
timezone = e_cal_util_get_system_timezone ();
|
||||
else
|
||||
location = g_variant_get_string (variant, NULL);
|
||||
|
||||
if (location != NULL && *location != '\0')
|
||||
timezone = i_cal_timezone_get_builtin_timezone (location);
|
||||
|
||||
if (timezone == NULL)
|
||||
timezone = i_cal_timezone_get_utc_timezone ();
|
||||
|
||||
g_value_set_object (value, timezone);
|
||||
|
||||
g_object_unref (settings);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
settings_meeting_store_constructed (GObject *object)
|
||||
{
|
||||
@ -90,13 +61,9 @@ settings_meeting_store_constructed (GObject *object)
|
||||
extensible, "free-busy-template",
|
||||
G_SETTINGS_BIND_GET);
|
||||
|
||||
g_settings_bind_with_mapping (
|
||||
settings, "timezone",
|
||||
extensible, "timezone",
|
||||
G_SETTINGS_BIND_GET,
|
||||
settings_map_string_to_icaltimezone,
|
||||
NULL, /* one-way binding */
|
||||
NULL, (GDestroyNotify) NULL);
|
||||
/* Do not bind the timezone property, the EMeetingStore
|
||||
user is supposed to update it as needed (like from the GUI,
|
||||
instead of the settings). */
|
||||
|
||||
g_object_unref (settings);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user