diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-01-30 03:02:53 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-01-30 22:02:11 +0800 |
commit | ab794abcd3fa23969a1f8b04d0236838f721180a (patch) | |
tree | 1e70c65ac5dba3294df2754a89a939b864cf6bcf /calendar | |
parent | 8d85229f8fc9ff0e27b1f7790f61605c04337d7b (diff) | |
download | gsoc2013-evolution-ab794abcd3fa23969a1f8b04d0236838f721180a.tar gsoc2013-evolution-ab794abcd3fa23969a1f8b04d0236838f721180a.tar.gz gsoc2013-evolution-ab794abcd3fa23969a1f8b04d0236838f721180a.tar.bz2 gsoc2013-evolution-ab794abcd3fa23969a1f8b04d0236838f721180a.tar.lz gsoc2013-evolution-ab794abcd3fa23969a1f8b04d0236838f721180a.tar.xz gsoc2013-evolution-ab794abcd3fa23969a1f8b04d0236838f721180a.tar.zst gsoc2013-evolution-ab794abcd3fa23969a1f8b04d0236838f721180a.zip |
Improve sidebar and ECalModel interaction.
Restores the "default client" behavior from 2.28, so that "Click to Add"
task and memo fields work properly.
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/e-cal-model.c | 48 |
1 files changed, 36 insertions, 12 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 58ca63e1cf..7533e56ece 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -127,6 +127,7 @@ static void remove_client (ECalModel *model, ECalModelClient *client_data); enum { PROP_0, + PROP_DEFAULT_CLIENT, PROP_SHELL_SETTINGS, PROP_TIMEZONE, PROP_USE_24_HOUR_FORMAT, @@ -165,6 +166,12 @@ cal_model_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_DEFAULT_CLIENT: + e_cal_model_set_default_client ( + E_CAL_MODEL (object), + g_value_get_object (value)); + return; + case PROP_SHELL_SETTINGS: cal_model_set_shell_settings ( E_CAL_MODEL (object), @@ -200,6 +207,13 @@ cal_model_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_DEFAULT_CLIENT: + g_value_set_object ( + value, + e_cal_model_get_default_client ( + E_CAL_MODEL (object))); + return; + case PROP_SHELL_SETTINGS: g_value_set_object ( value, @@ -357,6 +371,16 @@ e_cal_model_class_init (ECalModelClass *class) g_object_class_install_property ( object_class, + PROP_DEFAULT_CLIENT, + g_param_spec_object ( + "default-client", + _("Default Client"), + NULL, + E_TYPE_CAL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, PROP_SHELL_SETTINGS, g_param_spec_object ( "shell-settings", @@ -1516,10 +1540,10 @@ e_cal_model_set_default_client (ECalModel *model, ECal *client) ECalModelPrivate *priv; ECalModelClient *client_data; - g_return_if_fail (model != NULL); g_return_if_fail (E_IS_CAL_MODEL (model)); - g_return_if_fail (client != NULL); - g_return_if_fail (E_IS_CAL (client)); + + if (client != NULL) + g_return_if_fail (E_IS_CAL (client)); priv = model->priv; @@ -1533,11 +1557,16 @@ e_cal_model_set_default_client (ECalModel *model, ECal *client) } } - /* Make sure its in the model */ - client_data = add_new_client (model, client, FALSE); + if (client != NULL) { + /* Make sure its in the model */ + client_data = add_new_client (model, client, FALSE); - /* Store the default client */ - priv->default_client = client_data->client; + /* Store the default client */ + priv->default_client = client_data->client; + } else + priv->default_client = NULL; + + g_object_notify (G_OBJECT (model), "default-client"); } GList * @@ -2147,11 +2176,6 @@ add_new_client (ECalModel *model, ECal *client, gboolean do_query) /* Look to see if we already have this client */ client_data = find_client_data (model, client); if (client_data) { - if (do_query && client_data->client == priv->default_client) { - g_warning ("%s: %s: You shouldn't request a query on a default client", G_STRLOC, G_STRFUNC); - return client_data; - } - if (client_data->do_query) return client_data; else |