Logo Search packages:      
Sourcecode: zeitgeist-datahub version File versions  Download package

data-provider.c

/* data-provider.c generated by valac 0.11.5.3-984e-dirty, the Vala compiler
 * generated from data-provider.vala, do not modify */

/*
 * Zeitgeist
 *
 * Copyright (C) 2010 Michal Hruby <michal.mhr@gmail.com>
 *
 * 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 Michal Hruby <michal.mhr@gmail.com>
 *
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <zeitgeist.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;

00054 struct _DataProvider {
      GObject parent_instance;
      DataProviderPrivate * priv;
};

00059 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);
};

00077 struct _DataProviderPrivate {
      gint64 _last_timestamp;
};


static gpointer data_provider_parent_class = NULL;

GType data_provider_get_type (void) G_GNUC_CONST;
GType data_hub_get_type (void) G_GNUC_CONST;
#define DATA_PROVIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DATA_PROVIDER, DataProviderPrivate))
enum  {
      DATA_PROVIDER_DUMMY_PROPERTY,
      DATA_PROVIDER_UNIQUE_ID,
      DATA_PROVIDER_NAME,
      DATA_PROVIDER_DESCRIPTION,
      DATA_PROVIDER_DATAHUB,
      DATA_PROVIDER_ENABLED,
      DATA_PROVIDER_REGISTER,
      DATA_PROVIDER_LAST_TIMESTAMP
};
void data_provider_start (DataProvider* self);
static void data_provider_real_start (DataProvider* self);
void data_provider_stop (DataProvider* self);
static void data_provider_real_stop (DataProvider* self);
DataProvider* data_provider_construct (GType object_type);
const gchar* data_provider_get_unique_id (DataProvider* self);
void data_provider_set_unique_id (DataProvider* self, const gchar* value);
const gchar* data_provider_get_name (DataProvider* self);
void data_provider_set_name (DataProvider* self, const gchar* value);
const gchar* data_provider_get_description (DataProvider* self);
void data_provider_set_description (DataProvider* self, const gchar* value);
DataHub* data_provider_get_datahub (DataProvider* self);
void data_provider_set_datahub (DataProvider* self, DataHub* value);
gboolean data_provider_get_enabled (DataProvider* self);
void data_provider_set_enabled (DataProvider* self, gboolean value);
gboolean data_provider_get_register (DataProvider* self);
void data_provider_set_register (DataProvider* self, gboolean value);
gint64 data_provider_get_last_timestamp (DataProvider* self);
void data_provider_set_last_timestamp (DataProvider* self, gint64 value);
static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void data_provider_finalize (GObject* obj);
static void _vala_data_provider_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_data_provider_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


static void data_provider_real_start (DataProvider* self) {
      g_return_if_fail (self != NULL);
}


void data_provider_start (DataProvider* self) {
      DATA_PROVIDER_GET_CLASS (self)->start (self);
}


static void data_provider_real_stop (DataProvider* self) {
      g_return_if_fail (self != NULL);
}


void data_provider_stop (DataProvider* self) {
      DATA_PROVIDER_GET_CLASS (self)->stop (self);
}


DataProvider* data_provider_construct (GType object_type) {
      DataProvider * self = NULL;
      self = (DataProvider*) g_object_new (object_type, NULL);
      return self;
}


const gchar* data_provider_get_unique_id (DataProvider* self) {
      return DATA_PROVIDER_GET_CLASS (self)->get_unique_id (self);
}


void data_provider_set_unique_id (DataProvider* self, const gchar* value) {
      DATA_PROVIDER_GET_CLASS (self)->set_unique_id (self, value);
}


const gchar* data_provider_get_name (DataProvider* self) {
      return DATA_PROVIDER_GET_CLASS (self)->get_name (self);
}


void data_provider_set_name (DataProvider* self, const gchar* value) {
      DATA_PROVIDER_GET_CLASS (self)->set_name (self, value);
}


const gchar* data_provider_get_description (DataProvider* self) {
      return DATA_PROVIDER_GET_CLASS (self)->get_description (self);
}


void data_provider_set_description (DataProvider* self, const gchar* value) {
      DATA_PROVIDER_GET_CLASS (self)->set_description (self, value);
}


DataHub* data_provider_get_datahub (DataProvider* self) {
      return DATA_PROVIDER_GET_CLASS (self)->get_datahub (self);
}


void data_provider_set_datahub (DataProvider* self, DataHub* value) {
      DATA_PROVIDER_GET_CLASS (self)->set_datahub (self, value);
}


gboolean data_provider_get_enabled (DataProvider* self) {
      return DATA_PROVIDER_GET_CLASS (self)->get_enabled (self);
}


void data_provider_set_enabled (DataProvider* self, gboolean value) {
      DATA_PROVIDER_GET_CLASS (self)->set_enabled (self, value);
}


gboolean data_provider_get_register (DataProvider* self) {
      return DATA_PROVIDER_GET_CLASS (self)->get_register (self);
}


void data_provider_set_register (DataProvider* self, gboolean value) {
      DATA_PROVIDER_GET_CLASS (self)->set_register (self, value);
}


gint64 data_provider_get_last_timestamp (DataProvider* self) {
      gint64 result;
      g_return_val_if_fail (self != NULL, 0LL);
      result = self->priv->_last_timestamp;
      return result;
}


void data_provider_set_last_timestamp (DataProvider* self, gint64 value) {
      g_return_if_fail (self != NULL);
      self->priv->_last_timestamp = value;
      g_object_notify ((GObject *) self, "last-timestamp");
}


static void g_cclosure_user_marshal_VOID__BOXED (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
      typedef void (*GMarshalFunc_VOID__BOXED) (gpointer data1, gpointer arg_1, gpointer data2);
      register GMarshalFunc_VOID__BOXED callback;
      register GCClosure * cc;
      register gpointer data1, data2;
      cc = (GCClosure *) closure;
      g_return_if_fail (n_param_values == 2);
      if (G_CCLOSURE_SWAP_DATA (closure)) {
            data1 = closure->data;
            data2 = param_values->data[0].v_pointer;
      } else {
            data1 = param_values->data[0].v_pointer;
            data2 = closure->data;
      }
      callback = (GMarshalFunc_VOID__BOXED) (marshal_data ? marshal_data : cc->callback);
      callback (data1, g_value_get_boxed (param_values + 1), data2);
}


static void data_provider_class_init (DataProviderClass * klass) {
      data_provider_parent_class = g_type_class_peek_parent (klass);
      g_type_class_add_private (klass, sizeof (DataProviderPrivate));
      DATA_PROVIDER_CLASS (klass)->start = data_provider_real_start;
      DATA_PROVIDER_CLASS (klass)->stop = data_provider_real_stop;
      G_OBJECT_CLASS (klass)->get_property = _vala_data_provider_get_property;
      G_OBJECT_CLASS (klass)->set_property = _vala_data_provider_set_property;
      G_OBJECT_CLASS (klass)->finalize = data_provider_finalize;
      g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_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), DATA_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), DATA_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), DATA_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), DATA_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), DATA_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));
      g_object_class_install_property (G_OBJECT_CLASS (klass), DATA_PROVIDER_LAST_TIMESTAMP, g_param_spec_int64 ("last-timestamp", "last-timestamp", "last-timestamp", G_MININT64, G_MAXINT64, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
      g_signal_new ("items_available", TYPE_DATA_PROVIDER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, 1, G_TYPE_PTR_ARRAY);
}


static void data_provider_instance_init (DataProvider * self) {
      self->priv = DATA_PROVIDER_GET_PRIVATE (self);
}


static void data_provider_finalize (GObject* obj) {
      DataProvider * self;
      self = DATA_PROVIDER (obj);
      G_OBJECT_CLASS (data_provider_parent_class)->finalize (obj);
}


GType data_provider_get_type (void) {
      static volatile gsize data_provider_type_id__volatile = 0;
      if (g_once_init_enter (&data_provider_type_id__volatile)) {
            static const GTypeInfo g_define_type_info = { sizeof (DataProviderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) data_provider_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DataProvider), 0, (GInstanceInitFunc) data_provider_instance_init, NULL };
            GType data_provider_type_id;
            data_provider_type_id = g_type_register_static (G_TYPE_OBJECT, "DataProvider", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
            g_once_init_leave (&data_provider_type_id__volatile, data_provider_type_id);
      }
      return data_provider_type_id__volatile;
}


static void _vala_data_provider_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
      DataProvider * self;
      self = DATA_PROVIDER (object);
      switch (property_id) {
            case DATA_PROVIDER_LAST_TIMESTAMP:
            g_value_set_int64 (value, data_provider_get_last_timestamp (self));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}


static void _vala_data_provider_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
      DataProvider * self;
      self = DATA_PROVIDER (object);
      switch (property_id) {
            case DATA_PROVIDER_LAST_TIMESTAMP:
            data_provider_set_last_timestamp (self, g_value_get_int64 (value));
            break;
            default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
            break;
      }
}




Generated by  Doxygen 1.6.0   Back to index