diff options
-rw-r--r-- | src/goa-1.0.vapi | 10 | ||||
-rw-r--r-- | src/google-provider.c | 498 |
2 files changed, 508 insertions, 0 deletions
diff --git a/src/goa-1.0.vapi b/src/goa-1.0.vapi new file mode 100644 index 0000000..0f3ac13 --- /dev/null +++ b/src/goa-1.0.vapi @@ -0,0 +1,10 @@ +[CCode (cprefix = "GoaClient", lower_case_cprefix = "goa_client_", cheader_filename = "goa/goa.h")] +class GoaClient { + public async GoaClient (); + public GoaClient.sync (); + public GLib.List<GoaObject> get_accounts (); +} + +[CCode (cprefix = "GoaObject", lower_case_cprefix = "goa_object_", cheader_filename = "goa/goa.h")] +class GoaObject { +} diff --git a/src/google-provider.c b/src/google-provider.c new file mode 100644 index 0000000..494462e --- /dev/null +++ b/src/google-provider.c @@ -0,0 +1,498 @@ +/* google-provider.c generated by valac 0.16.0, the Vala compiler + * generated from google-provider.vala, do not modify */ + +/* + * Zeitgeist + * + * Copyright (C) 2011-2012 Collabora Ltd. + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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. + * + * 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/>. + * + * Authored by Siegfried-A. Gevatter <siegfried.gevatter@collabora.co.uk> + * + */ + +#include <glib.h> +#include <glib-object.h> +#include <stdlib.h> +#include <string.h> +#include <goa/goa.h> + + +#define TYPE_DATA_PROVIDER (data_provider_get_type ()) +#define DATA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_PROVIDER, DataProvider)) +#define DATA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_PROVIDER, DataProviderClass)) +#define IS_DATA_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_PROVIDER)) +#define IS_DATA_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_PROVIDER)) +#define DATA_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_PROVIDER, DataProviderClass)) + +typedef struct _DataProvider DataProvider; +typedef struct _DataProviderClass DataProviderClass; +typedef struct _DataProviderPrivate DataProviderPrivate; + +#define TYPE_DATA_HUB (data_hub_get_type ()) +#define DATA_HUB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DATA_HUB, DataHub)) +#define DATA_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DATA_HUB, DataHubClass)) +#define IS_DATA_HUB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DATA_HUB)) +#define IS_DATA_HUB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DATA_HUB)) +#define DATA_HUB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DATA_HUB, DataHubClass)) + +typedef struct _DataHub DataHub; +typedef struct _DataHubClass DataHubClass; + +#define TYPE_GOOGLE_PROVIDER (google_provider_get_type ()) +#define GOOGLE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GOOGLE_PROVIDER, GoogleProvider)) +#define GOOGLE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GOOGLE_PROVIDER, GoogleProviderClass)) +#define IS_GOOGLE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GOOGLE_PROVIDER)) +#define IS_GOOGLE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GOOGLE_PROVIDER)) +#define GOOGLE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GOOGLE_PROVIDER, GoogleProviderClass)) + +typedef struct _GoogleProvider GoogleProvider; +typedef struct _GoogleProviderClass GoogleProviderClass; +typedef struct _GoogleProviderPrivate GoogleProviderPrivate; +#define _g_free0(var) (var = (g_free (var), NULL)) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _goa_client_unref0(var) ((var == NULL) ? NULL : (var = (goa_client_unref (var), NULL))) +#define _goa_object_unref0(var) ((var == NULL) ? NULL : (var = (goa_object_unref (var), NULL))) +#define __g_list_free__goa_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__goa_object_unref0_ (var), NULL))) + +struct _DataProvider { + GObject parent_instance; + DataProviderPrivate * priv; +}; + +struct _DataProviderClass { + GObjectClass parent_class; + void (*start) (DataProvider* self); + void (*stop) (DataProvider* self); + const gchar* (*get_unique_id) (DataProvider* self); + void (*set_unique_id) (DataProvider* self, const gchar* value); + const gchar* (*get_name) (DataProvider* self); + void (*set_name) (DataProvider* self, const gchar* value); + const gchar* (*get_description) (DataProvider* self); + void (*set_description) (DataProvider* self, const gchar* value); + DataHub* (*get_datahub) (DataProvider* self); + void (*set_datahub) (DataProvider* self, DataHub* value); + gboolean (*get_enabled) (DataProvider* self); + void (*set_enabled) (DataProvider* self, gboolean value); + gboolean (*get_register) (DataProvider* self); + void (*set_register) (DataProvider* self, gboolean value); +}; + +struct _GoogleProvider { + DataProvider parent_instance; + GoogleProviderPrivate * priv; +}; + +struct _GoogleProviderClass { + DataProviderClass parent_class; +}; + +struct _GoogleProviderPrivate { + gchar* _unique_id; + gchar* _name; + gchar* _description; + DataHub* _datahub; + gboolean _enabled; + gboolean _register; + GoaClient* goa_client; +}; + + +static gpointer google_provider_parent_class = NULL; + +GType data_provider_get_type (void) G_GNUC_CONST; +GType data_hub_get_type (void) G_GNUC_CONST; +GType google_provider_get_type (void) G_GNUC_CONST; +#define GOOGLE_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_GOOGLE_PROVIDER, GoogleProviderPrivate)) +enum { + GOOGLE_PROVIDER_DUMMY_PROPERTY, + GOOGLE_PROVIDER_UNIQUE_ID, + GOOGLE_PROVIDER_NAME, + GOOGLE_PROVIDER_DESCRIPTION, + GOOGLE_PROVIDER_DATAHUB, + GOOGLE_PROVIDER_ENABLED, + GOOGLE_PROVIDER_REGISTER +}; +GoogleProvider* google_provider_new (DataHub* datahub, GError** error); +GoogleProvider* google_provider_construct (GType object_type, DataHub* datahub, GError** error); +static void google_provider_real_start (DataProvider* base); +static void _goa_object_unref0_ (gpointer var); +static void _g_list_free__goa_object_unref0_ (GList* self); +static void google_provider_real_stop (DataProvider* base); +static GObject * google_provider_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); +void data_provider_set_last_timestamp (DataProvider* self, gint64 value); +static void google_provider_finalize (GObject* obj); +const gchar* data_provider_get_unique_id (DataProvider* self); +const gchar* data_provider_get_name (DataProvider* self); +const gchar* data_provider_get_description (DataProvider* self); +DataHub* data_provider_get_datahub (DataProvider* self); +gboolean data_provider_get_enabled (DataProvider* self); +gboolean data_provider_get_register (DataProvider* self); +static void _vala_google_provider_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +void data_provider_set_unique_id (DataProvider* self, const gchar* value); +void data_provider_set_name (DataProvider* self, const gchar* value); +void data_provider_set_description (DataProvider* self, const gchar* value); +void data_provider_set_datahub (DataProvider* self, DataHub* value); +void data_provider_set_enabled (DataProvider* self, gboolean value); +void data_provider_set_register (DataProvider* self, gboolean value); +static void _vala_google_provider_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +GoogleProvider* google_provider_construct (GType object_type, DataHub* datahub, GError** error) { + GoogleProvider * self = NULL; + DataHub* _tmp0_; + g_return_val_if_fail (datahub != NULL, NULL); + _tmp0_ = datahub; + self = (GoogleProvider*) g_object_new (object_type, "unique-id", "com.zeitgeist-project,datahub,google", "name", "Google Data-Source", "description", "Logs events from Google services", "datahub", _tmp0_, NULL); + return self; +} + + +GoogleProvider* google_provider_new (DataHub* datahub, GError** error) { + return google_provider_construct (TYPE_GOOGLE_PROVIDER, datahub, error); +} + + +static gpointer _goa_object_ref0 (gpointer self) { + return self ? goa_object_ref (self) : NULL; +} + + +static void _goa_object_unref0_ (gpointer var) { + (var == NULL) ? NULL : (var = (goa_object_unref (var), NULL)); +} + + +static void _g_list_free__goa_object_unref0_ (GList* self) { + g_list_foreach (self, (GFunc) _goa_object_unref0_, NULL); + g_list_free (self); +} + + +static void google_provider_real_start (DataProvider* base) { + GoogleProvider * self; + GoaClient* _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = self->priv->goa_client; + if (_tmp0_ == NULL) { + GoaClient* _tmp1_; + GoaClient* _tmp2_; + GList* _tmp3_ = NULL; + _tmp1_ = goa_client_new_sync (); + _goa_client_unref0 (self->priv->goa_client); + self->priv->goa_client = _tmp1_; + _tmp2_ = self->priv->goa_client; + _tmp3_ = goa_client_get_accounts (_tmp2_); + { + GList* account_collection = NULL; + GList* account_it = NULL; + account_collection = _tmp3_; + for (account_it = account_collection; account_it != NULL; account_it = account_it->next) { + GoaObject* _tmp4_; + GoaObject* account = NULL; + _tmp4_ = _goa_object_ref0 ((GoaObject*) account_it->data); + account = _tmp4_; + { + g_warning ("google-provider.vala:59: HI! FOUND ACCOUNT!"); + _goa_object_unref0 (account); + } + } + __g_list_free__goa_object_unref0_0 (account_collection); + } + } +} + + +static void google_provider_real_stop (DataProvider* base) { + GoogleProvider * self; + self = (GoogleProvider*) base; +} + + +static const gchar* google_provider_real_get_unique_id (DataProvider* base) { + const gchar* result; + GoogleProvider* self; + const gchar* _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = self->priv->_unique_id; + result = _tmp0_; + return result; +} + + +static void google_provider_real_set_unique_id (DataProvider* base, const gchar* value) { + GoogleProvider* self; + const gchar* _tmp0_; + gchar* _tmp1_; + self = (GoogleProvider*) base; + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); + _g_free0 (self->priv->_unique_id); + self->priv->_unique_id = _tmp1_; + g_object_notify ((GObject *) self, "unique-id"); +} + + +static const gchar* google_provider_real_get_name (DataProvider* base) { + const gchar* result; + GoogleProvider* self; + const gchar* _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = self->priv->_name; + result = _tmp0_; + return result; +} + + +static void google_provider_real_set_name (DataProvider* base, const gchar* value) { + GoogleProvider* self; + const gchar* _tmp0_; + gchar* _tmp1_; + self = (GoogleProvider*) base; + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); + _g_free0 (self->priv->_name); + self->priv->_name = _tmp1_; + g_object_notify ((GObject *) self, "name"); +} + + +static const gchar* google_provider_real_get_description (DataProvider* base) { + const gchar* result; + GoogleProvider* self; + const gchar* _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = self->priv->_description; + result = _tmp0_; + return result; +} + + +static void google_provider_real_set_description (DataProvider* base, const gchar* value) { + GoogleProvider* self; + const gchar* _tmp0_; + gchar* _tmp1_; + self = (GoogleProvider*) base; + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); + _g_free0 (self->priv->_description); + self->priv->_description = _tmp1_; + g_object_notify ((GObject *) self, "description"); +} + + +static DataHub* google_provider_real_get_datahub (DataProvider* base) { + DataHub* result; + GoogleProvider* self; + DataHub* _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = self->priv->_datahub; + result = _tmp0_; + return result; +} + + +static gpointer _g_object_ref0 (gpointer self) { + return self ? g_object_ref (self) : NULL; +} + + +static void google_provider_real_set_datahub (DataProvider* base, DataHub* value) { + GoogleProvider* self; + DataHub* _tmp0_; + DataHub* _tmp1_; + self = (GoogleProvider*) base; + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); + _g_object_unref0 (self->priv->_datahub); + self->priv->_datahub = _tmp1_; + g_object_notify ((GObject *) self, "datahub"); +} + + +static gboolean google_provider_real_get_enabled (DataProvider* base) { + gboolean result; + GoogleProvider* self; + gboolean _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = self->priv->_enabled; + result = _tmp0_; + return result; +} + + +static void google_provider_real_set_enabled (DataProvider* base, gboolean value) { + GoogleProvider* self; + gboolean _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = value; + self->priv->_enabled = _tmp0_; + g_object_notify ((GObject *) self, "enabled"); +} + + +static gboolean google_provider_real_get_register (DataProvider* base) { + gboolean result; + GoogleProvider* self; + gboolean _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = self->priv->_register; + result = _tmp0_; + return result; +} + + +static void google_provider_real_set_register (DataProvider* base, gboolean value) { + GoogleProvider* self; + gboolean _tmp0_; + self = (GoogleProvider*) base; + _tmp0_ = value; + self->priv->_register = _tmp0_; + g_object_notify ((GObject *) self, "register"); +} + + +static GObject * google_provider_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { + GObject * obj; + GObjectClass * parent_class; + GoogleProvider * self; + parent_class = G_OBJECT_CLASS (google_provider_parent_class); + obj = parent_class->constructor (type, n_construct_properties, construct_properties); + self = GOOGLE_PROVIDER (obj); + data_provider_set_last_timestamp ((DataProvider*) self, (gint64) 0); + return obj; +} + + +static void google_provider_class_init (GoogleProviderClass * klass) { + google_provider_parent_class = g_type_class_peek_parent (klass); + g_type_class_add_private (klass, sizeof (GoogleProviderPrivate)); + DATA_PROVIDER_CLASS (klass)->start = google_provider_real_start; + DATA_PROVIDER_CLASS (klass)->stop = google_provider_real_stop; + DATA_PROVIDER_CLASS (klass)->get_unique_id = google_provider_real_get_unique_id; + DATA_PROVIDER_CLASS (klass)->set_unique_id = google_provider_real_set_unique_id; + DATA_PROVIDER_CLASS (klass)->get_name = google_provider_real_get_name; + DATA_PROVIDER_CLASS (klass)->set_name = google_provider_real_set_name; + DATA_PROVIDER_CLASS (klass)->get_description = google_provider_real_get_description; + DATA_PROVIDER_CLASS (klass)->set_description = google_provider_real_set_description; + DATA_PROVIDER_CLASS (klass)->get_datahub = google_provider_real_get_datahub; + DATA_PROVIDER_CLASS (klass)->set_datahub = google_provider_real_set_datahub; + DATA_PROVIDER_CLASS (klass)->get_enabled = google_provider_real_get_enabled; + DATA_PROVIDER_CLASS (klass)->set_enabled = google_provider_real_set_enabled; + DATA_PROVIDER_CLASS (klass)->get_register = google_provider_real_get_register; + DATA_PROVIDER_CLASS (klass)->set_register = google_provider_real_set_register; + G_OBJECT_CLASS (klass)->get_property = _vala_google_provider_get_property; + G_OBJECT_CLASS (klass)->set_property = _vala_google_provider_set_property; + G_OBJECT_CLASS (klass)->constructor = google_provider_constructor; + G_OBJECT_CLASS (klass)->finalize = google_provider_finalize; + g_object_class_install_property (G_OBJECT_CLASS (klass), GOOGLE_PROVIDER_UNIQUE_ID, g_param_spec_string ("unique-id", "unique-id", "unique-id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GOOGLE_PROVIDER_NAME, g_param_spec_string ("name", "name", "name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GOOGLE_PROVIDER_DESCRIPTION, g_param_spec_string ("description", "description", "description", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GOOGLE_PROVIDER_DATAHUB, g_param_spec_object ("datahub", "datahub", "datahub", TYPE_DATA_HUB, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GOOGLE_PROVIDER_ENABLED, g_param_spec_boolean ("enabled", "enabled", "enabled", TRUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), GOOGLE_PROVIDER_REGISTER, g_param_spec_boolean ("register", "register", "register", TRUE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT)); +} + + +static void google_provider_instance_init (GoogleProvider * self) { + self->priv = GOOGLE_PROVIDER_GET_PRIVATE (self); + self->priv->_enabled = TRUE; + self->priv->_register = TRUE; +} + + +static void google_provider_finalize (GObject* obj) { + GoogleProvider * self; + self = GOOGLE_PROVIDER (obj); + _g_free0 (self->priv->_unique_id); + _g_free0 (self->priv->_name); + _g_free0 (self->priv->_description); + _g_object_unref0 (self->priv->_datahub); + _goa_client_unref0 (self->priv->goa_client); + G_OBJECT_CLASS (google_provider_parent_class)->finalize (obj); +} + + +GType google_provider_get_type (void) { + static volatile gsize google_provider_type_id__volatile = 0; + if (g_once_init_enter (&google_provider_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (GoogleProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) google_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GoogleProvider), 0, (GInstanceInitFunc) google_provider_instance_init, NULL }; + GType google_provider_type_id; + google_provider_type_id = g_type_register_static (TYPE_DATA_PROVIDER, "GoogleProvider", &g_define_type_info, 0); + g_once_init_leave (&google_provider_type_id__volatile, google_provider_type_id); + } + return google_provider_type_id__volatile; +} + + +static void _vala_google_provider_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + GoogleProvider * self; + self = GOOGLE_PROVIDER (object); + switch (property_id) { + case GOOGLE_PROVIDER_UNIQUE_ID: + g_value_set_string (value, data_provider_get_unique_id ((DataProvider*) self)); + break; + case GOOGLE_PROVIDER_NAME: + g_value_set_string (value, data_provider_get_name ((DataProvider*) self)); + break; + case GOOGLE_PROVIDER_DESCRIPTION: + g_value_set_string (value, data_provider_get_description ((DataProvider*) self)); + break; + case GOOGLE_PROVIDER_DATAHUB: + g_value_set_object (value, data_provider_get_datahub ((DataProvider*) self)); + break; + case GOOGLE_PROVIDER_ENABLED: + g_value_set_boolean (value, data_provider_get_enabled ((DataProvider*) self)); + break; + case GOOGLE_PROVIDER_REGISTER: + g_value_set_boolean (value, data_provider_get_register ((DataProvider*) self)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void _vala_google_provider_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + GoogleProvider * self; + self = GOOGLE_PROVIDER (object); + switch (property_id) { + case GOOGLE_PROVIDER_UNIQUE_ID: + data_provider_set_unique_id ((DataProvider*) self, g_value_get_string (value)); + break; + case GOOGLE_PROVIDER_NAME: + data_provider_set_name ((DataProvider*) self, g_value_get_string (value)); + break; + case GOOGLE_PROVIDER_DESCRIPTION: + data_provider_set_description ((DataProvider*) self, g_value_get_string (value)); + break; + case GOOGLE_PROVIDER_DATAHUB: + data_provider_set_datahub ((DataProvider*) self, g_value_get_object (value)); + break; + case GOOGLE_PROVIDER_ENABLED: + data_provider_set_enabled ((DataProvider*) self, g_value_get_boolean (value)); + break; + case GOOGLE_PROVIDER_REGISTER: + data_provider_set_register ((DataProvider*) self, g_value_get_boolean (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + + |