...
 
Commits (34)
......@@ -2,7 +2,7 @@ image: fedora:26
stages:
- build
before_script:
- dnf install -y gcc meson ninja-build gettext gtk-doc glib2-devel
- dnf install -y gcc meson ninja-build gettext gtk-doc glib2-devel gobject-introspection-devel vala redhat-rpm-config
build-libcloudproviders:
stage: build
script:
......
0.3.0
-----
* Provide Vala bindings (Fernando da Silva)
* Fix dbus server path (Fernando da Silva)
* Use option for includedir (Jan Tojnar)
* Fix crash when using more than one file chooser (Jan Alexander)
0.2.5
-----
* Drop the daemon and do the cloud providers query client side.
* Update the API with proper prefixes as recommended for GObject libraries.
* Convert DBUS functions to properties, to allow notify:: signals.
* Add a flag for conditional install the tests.
0.1.0
-----
- First release of libcloudproviders
* First release of libcloudproviders
......@@ -4,42 +4,7 @@ libcloudproviders is a DBus API that allows cloud storage sync clients to expose
their services. Clients such as file managers and desktop environments can then
provide integrated access to the cloud providers services.
## cloudprovidersd
cloudprovidersd is a daemon which keeps track of existing cloud providers and their accounts.
It provides the `org.freedesktop.CloudProviderManager` DBus object to interact with.
## libcloudprovider
libcloudproviders is a glib based library that makes it easier to implement
a cloud provider server or client.
## Implementing support for sync clients
Any cloud provider clients need to own a DBus name and export a
`org.freedesktop.DBus.ObjectManager` object to it. For each account the cloud
provider needs to export an individual object implementing the
`org.freedesktop.CloudProvider.Account1` interface and register it with the
object manager.
An example implementation using libcloudprovider can be found in
[test/testcloudproviderserver.c](test/testcloudproviderserver.c).
## Implementing support for integrators
Integrators should connect via to the `org.freedesktop.CloudProviderManager` object
and call the GetCloudProviders method on the `org.freedesktop.CloudProvider.Manager1`
interface. That method will return a tuple of the registered cloud providers
bus name and the object path of their object manager.
With the bus name and object path they can query the object manager for a list
of accounts and can then interact with these though the
`org.freedesktop.CloudProvider.Account1` interface.
An example implementation using libcloudprovider can be found in
[test/testcloudproviderclient.c](test/testcloudproviderclient.c).
## API Documentation
See the [API documentation](https://csoriano.gitlab.io/libcloudprovidersweb/) for further details.
See the [API documentation](https://csoriano.gitlab.io/libcloudprovidersweb/) for
further details.
......@@ -3,18 +3,20 @@
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!--
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; either
version 2 of the License, or (at your option) any later version.
This file 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 3 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This file 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.
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/>.
You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: LGPL-3.0-or-later
-->
<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<interface name='org.freedesktop.CloudProviders.Provider'>
......
project ('libcloudproviders', 'c',
version: '0.2.5',
meson_version: '>=0.40.0',
version: '0.3.0',
meson_version: '>=0.42.0',
license: 'LGPL3+',
default_options: [
'c_std=gnu99',
......@@ -46,7 +46,9 @@ libexecdir = get_option ('libexecdir')
bindir = get_option ('bindir')
datadir = get_option ('datadir')
servicedir = join_paths (datadir, 'dbus-1', 'services')
incdir = join_paths (prefix, 'include', 'cloudproviders')
incdir = join_paths (prefix, get_option('includedir'), 'cloudproviders')
girdir= join_paths(datadir, 'gir-1.0')
typelibdir = join_paths(libdir, 'girepository-1.0')
gnome = import('gnome')
......
option('enable-gtk-doc', type: 'boolean', value: false)
option('installed-tests', type: 'boolean', value: false)
option(
'introspection',
type: 'boolean',
value: true,
description: 'Build GObject introspection data for extension library',
)
option(
'vapigen',
type: 'boolean',
value: true,
description: 'Build Vala bindings',
)
\ No newline at end of file
#ifndef CLOUDPROVIDERS_H
#define CLOUDPROVIDERS_H
#define CLOUDPROVIDERS_INSIDE
#include "enums.h"
#include "cloudprovidersaccount.h"
#include "cloudprovidersaccountexporter.h"
#include "cloudproviderscollector.h"
#include "cloudprovidersprovider.h"
#include "cloudprovidersproviderexporter.h"
#undef CLOUDPROVIDERS_INSIDE
#endif // CLOUDPROVIDERS_H
......@@ -18,7 +18,6 @@
*/
#include "cloudprovidersaccount.h"
#include "cloudprovidersaccountpriv.h"
#include "cloudprovidersprovider.h"
#include "cloudproviders-generated.h"
#include "enums.h"
......@@ -243,14 +242,13 @@ cloud_providers_account_set_property (GObject *object,
/**
* cloud_providers_account_new
* @bus_name: DBus bus name
* @object_path: Path to export the DBus object to
* @proxy: DBus proxy
*
* A #CloudProvidersAccount object are used to fetch details about cloud providers from DBus.
* Object are usually fetched from cloud_providers_get_providers() as a list.
*/
CloudProvidersAccount*
cloud_providers_account_new (CloudProvidersDbusAccountProxy *proxy)
cloud_providers_account_new (GDBusProxy *proxy)
{
CloudProvidersAccount *self;
......@@ -376,7 +374,7 @@ cloud_providers_account_init (CloudProvidersAccount *self)
*
* Returns: The name of the cloud provider account
*/
gchar*
const gchar*
cloud_providers_account_get_name (CloudProvidersAccount *self)
{
return self->name;
......@@ -404,7 +402,7 @@ cloud_providers_account_get_status (CloudProvidersAccount *self)
*
* Returns: The status detail description of the cloud provider account
*/
gchar*
const gchar*
cloud_providers_account_get_status_details (CloudProvidersAccount *self)
{
return self->status_details;
......@@ -416,7 +414,7 @@ cloud_providers_account_get_status_details (CloudProvidersAccount *self)
*
* Get the icon of the account
*
* Returns: The icon of the cloud provider account
* Returns: (transfer none) : The icon of the cloud provider account
*/
GIcon*
cloud_providers_account_get_icon (CloudProvidersAccount *self)
......@@ -430,7 +428,7 @@ cloud_providers_account_get_icon (CloudProvidersAccount *self)
*
* Get the menu model exported for the account
*
* Returns: The menu model exported by the cloud provider account
* Returns: (transfer none) : The menu model exported by the cloud provider account
*/
GMenuModel*
cloud_providers_account_get_menu_model (CloudProvidersAccount *self)
......@@ -445,7 +443,7 @@ cloud_providers_account_get_menu_model (CloudProvidersAccount *self)
* Get the action group exported in addition to the #GMenuModel from
* cloud_providers_account_get_menu_model()
*
* Returns: The action group exported by the cloud provider account
* Returns: (transfer none) : The action group exported by the cloud provider account
*/
GActionGroup*
cloud_providers_account_get_action_group (CloudProvidersAccount *self)
......@@ -461,7 +459,7 @@ cloud_providers_account_get_action_group (CloudProvidersAccount *self)
*
* Returns: The directory path of the cloud provider account
*/
gchar *
const gchar *
cloud_providers_account_get_path (CloudProvidersAccount *self)
{
return self->path;
......
......@@ -43,20 +43,22 @@ typedef enum {
} CloudProvidersAccountStatus;
#define CLOUD_PROVIDERS_TYPE_ACCOUNT (cloud_providers_account_get_type())
G_DECLARE_FINAL_TYPE (CloudProvidersAccount, cloud_providers_account, CLOUD_PROVIDERS, ACCOUNT, GObject);
G_DECLARE_FINAL_TYPE (CloudProvidersAccount, cloud_providers_account, CLOUD_PROVIDERS, ACCOUNT, GObject)
struct _CloudProvidersAccountClass
{
GObjectClass parent_class;
};
gchar* cloud_providers_account_get_name (CloudProvidersAccount *self);
CloudProvidersAccount *cloud_providers_account_new (GDBusProxy *proxy);
const gchar* cloud_providers_account_get_name (CloudProvidersAccount *self);
CloudProvidersAccountStatus cloud_providers_account_get_status (CloudProvidersAccount *self);
gchar* cloud_providers_account_get_status_details (CloudProvidersAccount *self);
const gchar* cloud_providers_account_get_status_details (CloudProvidersAccount *self);
GIcon *cloud_providers_account_get_icon (CloudProvidersAccount *self);
GMenuModel *cloud_providers_account_get_menu_model (CloudProvidersAccount *self);
GActionGroup* cloud_providers_account_get_action_group (CloudProvidersAccount *self);
gchar *cloud_providers_account_get_path (CloudProvidersAccount *self);
const gchar *cloud_providers_account_get_path (CloudProvidersAccount *self);
G_END_DECLS
......
......@@ -88,7 +88,6 @@ export_menu_model (CloudProvidersAccountExporter *self)
}
}
#if 0
static void
unexport_menu_model (CloudProvidersAccountExporter *self)
{
......@@ -97,7 +96,6 @@ unexport_menu_model (CloudProvidersAccountExporter *self)
g_dbus_connection_unexport_menu_model(self->bus, self->menu_model_export_id);
}
}
#endif
static void
export_action_group(CloudProvidersAccountExporter *self)
......@@ -114,14 +112,6 @@ export_action_group(CloudProvidersAccountExporter *self)
}
}
#if 0
/**
* cloud_providers_account_exporter_unexport_action_group:
* @self: The cloud provider
* @account_name: The name of the account
*
* Unexport the GActionGroup exported by cloud_providers_account_exporter_export_action_group
*/
static void
unexport_action_group(CloudProvidersAccountExporter *self)
{
......@@ -130,7 +120,6 @@ unexport_action_group(CloudProvidersAccountExporter *self)
g_dbus_connection_unexport_action_group(self->bus, self->action_group_export_id);
}
}
#endif
gchar *
cloud_providers_account_exporter_get_object_path (CloudProvidersAccountExporter *self)
......@@ -407,7 +396,8 @@ static void
cloud_providers_account_exporter_finalize (GObject *object)
{
CloudProvidersAccountExporter *self = (CloudProvidersAccountExporter *)object;
unexport_menu_model (self);
unexport_action_group (self);
g_free (self->bus_name);
g_object_unref (self->skeleton);
......
......@@ -25,7 +25,7 @@
G_BEGIN_DECLS
#define CLOUD_PROVIDERS_TYPE_ACCOUNT_EXPORTER (cloud_providers_account_exporter_get_type())
G_DECLARE_FINAL_TYPE (CloudProvidersAccountExporter, cloud_providers_account_exporter, CLOUD_PROVIDERS, ACCOUNT_EXPORTER, GObject);
G_DECLARE_FINAL_TYPE (CloudProvidersAccountExporter, cloud_providers_account_exporter, CLOUD_PROVIDERS, ACCOUNT_EXPORTER, GObject)
typedef struct _CloudProvidersProviderExporter CloudProvidersProviderExporter;
......
/* cloudprovidersaccountpriv.h
*
* Copyright (C) 2017 Carlos Soriano <csoriano@gnome.org>
*
* This file 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 3 of the
* License, or (at your option) any later version.
*
* This file 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLOUD_PROVIDERS_ACCOUNT_PRIV_H
#define CLOUD_PROVIDERS_ACCOUNT_PRIV_H
#include <gio/gio.h>
#include "cloudprovidersaccount.h"
#include "cloudproviders-generated.h"
G_BEGIN_DECLS
CloudProvidersAccount*
cloud_providers_account_new (CloudProvidersDbusAccountProxy *proxy);
G_END_DECLS
#endif
......@@ -140,7 +140,7 @@ cloud_providers_collector_init (CloudProvidersCollector *self)
/**
* cloud_providers_collector_get_providers
* @self: A CloudProvidersCollector
* Returns: (transfer none): A GList* of #CloudProvidersAccount objects.
* Returns: (element-type CloudProviders.Provider) (transfer none): A GList* of #CloudProvidersProvider objects.
*/
GList*
cloud_providers_collector_get_providers (CloudProvidersCollector *self)
......@@ -319,12 +319,8 @@ cloud_providers_collector_dup_singleton (void)
self->cancellable,
on_bus_acquired,
self);
return self;
}
else
{
return g_object_ref (self);
}
return g_object_ref (self);
}
......@@ -25,7 +25,7 @@
G_BEGIN_DECLS
#define CLOUD_PROVIDERS_TYPE_COLLECTOR (cloud_providers_collector_get_type())
G_DECLARE_FINAL_TYPE (CloudProvidersCollector, cloud_providers_collector, CLOUD_PROVIDERS, COLLECTOR, GObject);
G_DECLARE_FINAL_TYPE (CloudProvidersCollector, cloud_providers_collector, CLOUD_PROVIDERS, COLLECTOR, GObject)
struct _CloudProvidersCollectorClass
{
......
......@@ -20,7 +20,6 @@
#include "cloudprovidersprovider.h"
#include "cloudprovidersaccount.h"
#include "cloudprovidersaccountpriv.h"
#include "cloudproviders-generated.h"
struct _CloudProvidersProvider
......@@ -392,6 +391,11 @@ cloud_providers_provider_get_name (CloudProvidersProvider *self)
return self->name;
}
/**
* cloud_providers_provider_get_accounts
* @self: A CloudProvidersProvider
* Returns: (element-type CloudProviders.Account) (transfer none): A GList* of #CloudProvidersProvider objects.
*/
GList*
cloud_providers_provider_get_accounts (CloudProvidersProvider *self)
{
......
......@@ -107,7 +107,7 @@ unexport_account(CloudProvidersProviderExporter *self,
CloudProvidersDbusAccount *account_skeleton;
account_skeleton = cloud_providers_account_exporter_get_skeleton (account);
object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (account_skeleton));
object_path = g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (account_skeleton));
g_dbus_object_manager_server_unexport (self->manager, object_path);
}
......
......@@ -25,7 +25,7 @@
G_BEGIN_DECLS
#define CLOUD_PROVIDERS_TYPE_PROVIDER_EXPORTER (cloud_providers_provider_exporter_get_type())
G_DECLARE_FINAL_TYPE (CloudProvidersProviderExporter, cloud_providers_provider_exporter, CLOUD_PROVIDERS, PROVIDER_EXPORTER, GObject);
G_DECLARE_FINAL_TYPE (CloudProvidersProviderExporter, cloud_providers_provider_exporter, CLOUD_PROVIDERS, PROVIDER_EXPORTER, GObject)
struct _CloudProvidersProviderExporterClass
{
......
libcloudproviders_deps = [glib, gio, gio_unix]
libcloudproviders_headers = [
'cloudproviders.h',
'cloudproviderscollector.h',
'cloudprovidersaccount.h',
'cloudprovidersaccountexporter.h',
......@@ -50,11 +51,34 @@ pkg.generate(
description : 'Cloud providers DBus API library.'
)
libcloudproviders_dep = declare_dependency (
link_with: libcloudproviders,
dependencies: libcloudproviders_deps,
include_directories: include_directories('.')
)
if get_option('introspection')
libcloudproviders_gir = gnome.generate_gir(
libcloudproviders,
sources: libcloudproviders_headers + libcloudproviders_sources,
nsversion: meson.project_version(),
dependencies: libcloudproviders_deps,
namespace: 'CloudProviders',
symbol_prefix: 'cloud_providers',
link_with: libcloudproviders,
includes: [ 'GLib-2.0', 'Gio-2.0' ],
install: true,
install_dir_gir: girdir,
install_dir_typelib: typelibdir,
extra_args: [ '--c-include=cloudproviders/cloudproviders.h', '--quiet' ]
)
endif
if get_option('vapigen')
libcloudproviders_vapi = gnome.generate_vapi(
'cloudproviders',
sources: libcloudproviders_gir[0],
packages: ['gio-2.0'],
install: true,
)
endif
\ No newline at end of file
[D-BUS Service]
Name=org.freedesktop.CloudProviders.ServerExample
Exec=@bindir@/testcloudprovidersclient
Exec=@bindir@/testcloudprovidersserver