diff options
Diffstat (limited to 'calendar/gui/e-meeting-time-sel.c')
-rw-r--r-- | calendar/gui/e-meeting-time-sel.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 0ae13bf07f..5f92ab6a63 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -207,6 +207,9 @@ 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 (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data); + G_DEFINE_TYPE (EMeetingTimeSelector, e_meeting_time_selector, GTK_TYPE_TABLE); static void @@ -252,6 +255,12 @@ e_meeting_time_selector_init (EMeetingTimeSelector * mts) mts->dragging_position = E_MEETING_TIME_SELECTOR_POS_NONE; mts->list_view = NULL; + + mts->fb_uri_not = + calendar_config_add_notification_free_busy_template ((GConfClientNotifyFunc) free_busy_template_changed_cb, + mts); + + mts->fb_refresh_not = 0; } @@ -825,6 +834,12 @@ e_meeting_time_selector_destroy (GtkObject *object) mts->display_top = NULL; mts->display_main = NULL; + + calendar_config_remove_notification (mts->fb_uri_not); + + if (mts->fb_refresh_not != 0) { + g_source_remove (mts->fb_refresh_not); + } if (GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy) (*GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy)(object); @@ -2877,3 +2892,42 @@ row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data) gtk_widget_queue_draw (mts->display_main); } + +#define REFRESH_PAUSE 5000 + +static gboolean +free_busy_timeout_refresh (gpointer data) +{ + char *fb_uri; + + EMeetingTimeSelector *mts = E_MEETING_TIME_SELECTOR (data); + + fb_uri = calendar_config_get_free_busy_template (); + e_meeting_store_set_fb_uri (mts->model, fb_uri); + g_free (fb_uri); + + /* Update all free/busy info, so we use the new template uri */ + e_meeting_time_selector_refresh_free_busy (mts, 0, TRUE); + + mts->fb_refresh_not = 0; + + return FALSE; +} + +static void +free_busy_template_changed_cb (GConfClient *client, + guint cnxn_id, + GConfEntry *entry, + gpointer data) +{ + EMeetingTimeSelector *mts = E_MEETING_TIME_SELECTOR (data); + + /* Wait REFRESH_PAUSE before refreshing, using the latest uri value */ + if (mts->fb_refresh_not != 0) { + g_source_remove (mts->fb_refresh_not); + } + + mts->fb_refresh_not = g_timeout_add (REFRESH_PAUSE, + free_busy_timeout_refresh, + data); +} |