diff options
author | Matthew Barnes <mbarnes@src.gnome.org> | 2008-11-24 13:14:44 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-11-24 13:14:44 +0800 |
commit | 4f4615a46d5ba518c1e6a0c2412b1edf1e268d99 (patch) | |
tree | 828acaa7b76aa12a490a3238b0ec4a7086b8be16 /calendar/gui/gnome-cal.c | |
parent | 076b7c45131482b87d18963d34d035435491ee8d (diff) | |
download | gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.gz gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.tar.zst gsoc2013-evolution-4f4615a46d5ba518c1e6a0c2412b1edf1e268d99.zip |
Merge revisions 36737:36810 from trunk.
svn path=/branches/kill-bonobo/; revision=36811
Diffstat (limited to 'calendar/gui/gnome-cal.c')
-rw-r--r-- | calendar/gui/gnome-cal.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index ca6fbe9721..a5ff34aa4f 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -179,6 +179,9 @@ struct _GnomeCalendarPrivate { /* We should know which calendar has been used to create object, so store it here before emitting "user_created" signal and make it NULL just after the emit. */ ECal *user_created_cal; + + /* used in update_todo_view, to prevent interleaving when called in separate thread */ + GMutex *todo_update_lock; }; /* Signal IDs */ @@ -738,6 +741,8 @@ update_query_async (struct _date_query_msg *msg) real_sexp = adjust_e_cal_view_sexp (gcal, priv->sexp); if (!real_sexp) { + g_object_unref (msg->gcal); + g_slice_free (struct _date_query_msg, msg); return; /* No time range is set, so don't start a query */ } @@ -1048,18 +1053,30 @@ timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer set_timezone (calendar); } +struct _mupdate_todo_msg { + Message header; + GnomeCalendar *gcal; +}; + static void -update_todo_view (GnomeCalendar *gcal) +update_todo_view_async (struct _mupdate_todo_msg *msg) { + GnomeCalendar *gcal; GnomeCalendarPrivate *priv; ECalModel *model; char *sexp = NULL; + g_return_if_fail (msg != NULL); + + gcal = msg->gcal; priv = gcal->priv; + g_mutex_lock (priv->todo_update_lock); + /* Set the query on the task pad */ if (priv->todo_sexp) { g_free (priv->todo_sexp); + priv->todo_sexp = NULL; } model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo)); @@ -1074,6 +1091,22 @@ update_todo_view (GnomeCalendar *gcal) e_cal_model_set_search_query (model, priv->todo_sexp); } + g_mutex_unlock (priv->todo_update_lock); + + g_object_unref (msg->gcal); + g_slice_free (struct _mupdate_todo_msg, msg); +} + +static void +update_todo_view (GnomeCalendar *gcal) +{ + struct _mupdate_todo_msg *msg; + + msg = g_slice_new0 (struct _mupdate_todo_msg); + msg->header.func = (MessageFunc) update_todo_view_async; + msg->gcal = g_object_ref (gcal); + + message_push ((Message *) msg); } static void @@ -1384,7 +1417,7 @@ setup_widgets (GnomeCalendar *gcal) gtk_widget_show (vbox); gtk_widget_show (sep); - update_todo_view (gcal); + /* update_todo_view (gcal); */ /* Timeout check to hide completed items */ priv->update_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_todo_view_cb, gcal, NULL); @@ -1500,6 +1533,8 @@ gnome_calendar_init (GnomeCalendar *gcal) e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), gcal); + priv->todo_update_lock = g_mutex_new (); + priv->current_view_type = GNOME_CAL_DAY_VIEW; priv->range_selected = FALSE; priv->lview_select_daten_range = TRUE; @@ -1616,6 +1651,8 @@ gnome_calendar_destroy (GtkObject *object) g_signal_handlers_disconnect_by_func (cal_model, G_CALLBACK (view_done_cb), gcal); + g_mutex_free (priv->todo_update_lock); + g_free (priv); gcal->priv = NULL; } |