diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-01 22:06:47 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-06-01 22:31:55 +0800 |
commit | a02dba5e8cb5d2d41d7dc3d5b45453deca836b82 (patch) | |
tree | 6364e0b6773575bc7b85b86dd7da14edf1bd5067 /calendar | |
parent | c6b96f4e4492552b0a9256140706f7d98bf2bdee (diff) | |
download | gsoc2013-evolution-a02dba5e8cb5d2d41d7dc3d5b45453deca836b82.tar gsoc2013-evolution-a02dba5e8cb5d2d41d7dc3d5b45453deca836b82.tar.gz gsoc2013-evolution-a02dba5e8cb5d2d41d7dc3d5b45453deca836b82.tar.bz2 gsoc2013-evolution-a02dba5e8cb5d2d41d7dc3d5b45453deca836b82.tar.lz gsoc2013-evolution-a02dba5e8cb5d2d41d7dc3d5b45453deca836b82.tar.xz gsoc2013-evolution-a02dba5e8cb5d2d41d7dc3d5b45453deca836b82.tar.zst gsoc2013-evolution-a02dba5e8cb5d2d41d7dc3d5b45453deca836b82.zip |
Add a boolean return to e_cal_model_remove_client().
The function now returns TRUE if the ECalClient was actually removed
from the model, or FALSE if the model did not have the ECalClient.
Use this to avoid an unnecessary gnome_calendar_update_query() call
in cal_shell_view_selector_client_removed().
(cherry picked from commit 2aa759bc58ea8e14dd1d28a9d7f23e2f5f627c3f)
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/e-cal-model.c | 19 | ||||
-rw-r--r-- | calendar/gui/e-cal-model.h | 2 |
2 files changed, 17 insertions, 4 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index b9c4d84f63..a682d393e8 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -3298,21 +3298,34 @@ remove_client (ECalModel *model, /** * e_cal_model_remove_client + * @model: an #ECalModel + * @client: an #ECalClient + * + * Removes @client from @model along with its internal #ECalClientView. + * + * If @model does not have @client then the function does nothing and + * returns %FALSE. + * + * Returns: %TRUE is @client was remove, %FALSE if @model did not have it */ -void +gboolean e_cal_model_remove_client (ECalModel *model, ECalClient *client) { ClientData *client_data; + gboolean removed = FALSE; - g_return_if_fail (E_IS_CAL_MODEL (model)); - g_return_if_fail (E_IS_CAL_CLIENT (client)); + g_return_val_if_fail (E_IS_CAL_MODEL (model), FALSE); + g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE); client_data = cal_model_clients_lookup (model, client); if (client_data != NULL) { remove_client (model, client_data); client_data_unref (client_data); + removed = TRUE; } + + return removed; } /** diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index 19c89a7775..c07a073040 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -249,7 +249,7 @@ void e_cal_model_set_default_client (ECalModel *model, GList * e_cal_model_list_clients (ECalModel *model); gboolean e_cal_model_add_client (ECalModel *model, ECalClient *cal_client); -void e_cal_model_remove_client (ECalModel *model, +gboolean e_cal_model_remove_client (ECalModel *model, ECalClient *cal_client); void e_cal_model_remove_all_clients (ECalModel *model); void e_cal_model_get_time_range (ECalModel *model, |