/*
* e-client.c
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
+ * This library is free software you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
*
*
* Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
* and kill e-client-private.h. Would simplify things. --mbarnes
*/
+/**
+ * SECTION: e-client
+ * @include: libedataserver/libedataserver.h
+ * @short_description: Base class for client handles
+ *
+ * This class provides some base functionality for clients
+ * such as #EBookClient and #ECalClient.
+ **/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <libedataserver/e-data-server-util.h>
-#include "e-gdbus-marshallers.h"
-
#include "e-client.h"
#include "e-client-private.h"
case E_CLIENT_ERROR_REPOSITORY_OFFLINE:
return _("Repository offline");
case E_CLIENT_ERROR_OFFLINE_UNAVAILABLE:
- /* Translators: This means that the EClient does not support offline mode, or
- * it's not set to by a user, thus it is unavailable while user is not connected. */
+ /* Translators: This means that the EClient does not
+ * support offline mode, or it's not set to by a user,
+ * thus it is unavailable while user is not connected. */
return _("Offline unavailable");
case E_CLIENT_ERROR_PERMISSION_DENIED:
return _("Permission denied");
e_client_error_create (EClientError code,
const gchar *custom_msg)
{
- return g_error_new_literal (E_CLIENT_ERROR, code, custom_msg ? custom_msg : e_client_error_to_string (code));
+ if (custom_msg == NULL)
+ custom_msg = e_client_error_to_string (code);
+
+ return g_error_new_literal (E_CLIENT_ERROR, code, custom_msg);
}
static void
class->refresh = client_refresh;
class->refresh_finish = client_refresh_finish;
+ /**
+ * EClient:capabilities:
+ *
+ * The capabilities of this client
+ */
g_object_class_install_property (
object_class,
PROP_CAPABILITIES,
g_param_spec_pointer (
"capabilities",
- NULL,
- NULL,
+ "Capabilities",
+ "The capabilities of this client",
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * EClient:main-context:
+ *
+ * The main loop context in which notifications for
+ * this client will be delivered.
+ */
g_object_class_install_property (
object_class,
PROP_MAIN_CONTEXT,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * EClient:online:
+ *
+ * Whether this client's backing data is online.
+ */
g_object_class_install_property (
object_class,
PROP_ONLINE,
g_param_spec_boolean (
"online",
- NULL,
- NULL,
+ "Online",
+ "Whether this client is online",
FALSE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * EClient:opened:
+ *
+ * Whether this client is open and ready to use.
+ *
+ * Deprecated: 3.8: This property is no longer relevant and
+ * will always be %TRUE after successfully creating any concrete
+ * type of #EClient.
+ */
g_object_class_install_property (
object_class,
PROP_OPENED,
g_param_spec_boolean (
"opened",
- NULL,
- NULL,
+ "Opened",
+ "Whether this client is open and ready to use",
FALSE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * EClient:readonly:
+ *
+ * Whether this client's backing data is readonly.
+ */
g_object_class_install_property (
object_class,
PROP_READONLY,
g_param_spec_boolean (
"readonly",
- NULL,
- NULL,
+ "Read only",
+ "Whether this client's backing data is readonly",
FALSE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
+ /**
+ * EClient:source:
+ *
+ * The #ESource for which this client was created.
+ */
g_object_class_install_property (
object_class,
PROP_SOURCE,
g_param_spec_object (
"source",
- NULL,
- NULL,
+ "Source",
+ "The ESource for which this client was created",
E_TYPE_SOURCE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_SIGNAL_RUN_LAST |
G_SIGNAL_DEPRECATED,
G_STRUCT_OFFSET (EClientClass, opened),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
+ NULL, NULL, NULL,
G_TYPE_NONE, 1,
G_TYPE_ERROR);
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EClientClass, backend_error),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
+ NULL, NULL, NULL,
G_TYPE_NONE, 1,
G_TYPE_STRING);
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EClientClass, backend_died),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[BACKEND_PROPERTY_CHANGED] = g_signal_new (
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EClientClass, backend_property_changed),
- NULL, NULL,
- e_gdbus_marshallers_VOID__STRING_STRING,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING);
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 2,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
}
static void
g_return_val_if_fail (class->retrieve_capabilities_finish != NULL, FALSE);
*capabilities = NULL;
- res = class->retrieve_capabilities_finish (client, result, capabilities, error);
+ res = class->retrieve_capabilities_finish (
+ client, result, capabilities, error);
e_client_set_capabilities (client, res ? *capabilities : NULL);
g_return_val_if_fail (class->retrieve_capabilities_sync != NULL, FALSE);
*capabilities = NULL;
- res = class->retrieve_capabilities_sync (client, capabilities, cancellable, error);
+ res = class->retrieve_capabilities_sync (
+ client, capabilities, cancellable, error);
e_client_set_capabilities (client, res ? *capabilities : NULL);
g_return_if_fail (class != NULL);
g_return_if_fail (class->get_backend_property != NULL);
- class->get_backend_property (client, prop_name, cancellable, callback, user_data);
+ class->get_backend_property (
+ client, prop_name, cancellable, callback, user_data);
}
/**
g_return_if_fail (class != NULL);
g_return_if_fail (class->set_backend_property != NULL);
- class->set_backend_property (client, prop_name, prop_value, cancellable, callback, user_data);
+ class->set_backend_property (
+ client, prop_name, prop_value,
+ cancellable, callback, user_data);
}
/**
/**
* e_client_open:
* @client: an #EClient
- * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist,
+ * otherwise create it first
* @cancellable: a #GCancellable; can be %NULL
* @callback: callback to call when a result is ready
* @user_data: user data for the @callback
/**
* e_client_open_sync:
* @client: an #EClient
- * @only_if_exists: if %TRUE, fail if this book doesn't already exist, otherwise create it first
+ * @only_if_exists: if %TRUE, fail if this book doesn't already exist,
+ * otherwise create it first
* @cancellable: a #GCancellable; can be %NULL
* @error: (out): a #GError to set an error, if any
*
g_free (name);
g_dbus_error_strip_remote_error (dbus_error);
- *client_error = g_error_new_literal (known_errors_domain, known_errors[ii].err_code, dbus_error->message);
+ *client_error = g_error_new_literal (
+ known_errors_domain,
+ known_errors[ii].err_code,
+ dbus_error->message);
g_error_free (dbus_error);
return TRUE;
}
if (g_error_matches (dbus_error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR)) {
g_dbus_error_strip_remote_error (dbus_error);
- *client_error = g_error_new_literal (E_CLIENT_ERROR, E_CLIENT_ERROR_OTHER_ERROR, dbus_error->message);
+ *client_error = g_error_new_literal (
+ E_CLIENT_ERROR,
+ E_CLIENT_ERROR_OTHER_ERROR,
+ dbus_error->message);
g_error_free (dbus_error);
} else {
g_dbus_error_strip_remote_error (dbus_error);