ECalClient: Handle set_backend_property() requests directly.
authorMatthew Barnes <mbarnes@redhat.com>
Sat, 26 Jan 2013 13:42:01 +0000 (08:42 -0500)
committerMatthew Barnes <mbarnes@redhat.com>
Sat, 26 Jan 2013 13:42:01 +0000 (08:42 -0500)
Neither ECalBackend itself nor any known ECalBackend subclass allows
clients to set backend properties, so forego the D-Bus message and fail
immediately on the client side with an E_CLIENT_ERROR_NOT_SUPPORTED.

calendar/libecal/e-cal-client.c

index 7346b5f..13cc31c 100644 (file)
@@ -744,34 +744,6 @@ cal_client_get_backend_property_sync (EClient *client,
        return res;
 }
 
-static void
-cal_client_set_backend_property (EClient *client,
-                                 const gchar *prop_name,
-                                 const gchar *prop_value,
-                                 GCancellable *cancellable,
-                                 GAsyncReadyCallback callback,
-                                 gpointer user_data)
-{
-       gchar **prop_name_value;
-
-       prop_name_value = e_gdbus_cal_encode_set_backend_property (prop_name, prop_value);
-
-       e_client_proxy_call_strv (
-               client, (const gchar * const *) prop_name_value, cancellable, callback, user_data, cal_client_set_backend_property,
-               e_gdbus_cal_call_set_backend_property,
-               e_gdbus_cal_call_set_backend_property_finish, NULL, NULL, NULL, NULL);
-
-       g_strfreev (prop_name_value);
-}
-
-static gboolean
-cal_client_set_backend_property_finish (EClient *client,
-                                        GAsyncResult *result,
-                                        GError **error)
-{
-       return e_client_proxy_call_finish_void (client, result, error, cal_client_set_backend_property);
-}
-
 static gboolean
 cal_client_set_backend_property_sync (EClient *client,
                                       const gchar *prop_name,
@@ -779,24 +751,13 @@ cal_client_set_backend_property_sync (EClient *client,
                                       GCancellable *cancellable,
                                       GError **error)
 {
-       ECalClient *cal_client;
-       gboolean res;
-       gchar **prop_name_value;
-
-       g_return_val_if_fail (E_IS_CAL_CLIENT (client), FALSE);
-
-       cal_client = E_CAL_CLIENT (client);
+       g_set_error (
+               error, E_CLIENT_ERROR,
+               E_CLIENT_ERROR_NOT_SUPPORTED,
+               _("Cannot change value of calendar property '%s'"),
+               prop_name);
 
-       if (cal_client->priv->dbus_proxy == NULL) {
-               set_proxy_gone_error (error);
-               return FALSE;
-       }
-
-       prop_name_value = e_gdbus_cal_encode_set_backend_property (prop_name, prop_value);
-       res = e_client_proxy_call_sync_strv__void (client, (const gchar * const *) prop_name_value, cancellable, error, e_gdbus_cal_call_set_backend_property_sync);
-       g_strfreev (prop_name_value);
-
-       return res;
+       return FALSE;
 }
 
 static void
@@ -1040,8 +1001,6 @@ e_cal_client_class_init (ECalClientClass *class)
        client_class->get_backend_property              = cal_client_get_backend_property;
        client_class->get_backend_property_finish       = cal_client_get_backend_property_finish;
        client_class->get_backend_property_sync         = cal_client_get_backend_property_sync;
-       client_class->set_backend_property              = cal_client_set_backend_property;
-       client_class->set_backend_property_finish       = cal_client_set_backend_property_finish;
        client_class->set_backend_property_sync         = cal_client_set_backend_property_sync;
        client_class->open                              = cal_client_open;
        client_class->open_finish                       = cal_client_open_finish;