giomodule-priv.h \
gioscheduler.c \
giostream.c \
+ gkdbus.c \
+ gkdbusclient.c \
+ gkdbusconnection.c \
gloadableicon.c \
gmount.c \
gmemoryinputstream.c \
giomodule.h \
gioscheduler.h \
giostream.h \
+ gkdbus.h \
+ gkdbusclient.h \
+ gkdbusconnection.h \
gloadableicon.h \
gmount.h \
gmemoryinputstream.h \
#include "gioenumtypes.h"
#include "gnetworkaddress.h"
#include "gsocketclient.h"
+#include "gkdbusclient.h"
#include "giostream.h"
#include "gasyncresult.h"
#include "gsimpleasyncresult.h"
if (connectable != NULL)
{
- GSocketClient *client;
- GSocketConnection *connection;
-
- g_assert (ret == NULL);
- client = g_socket_client_new ();
- connection = g_socket_client_connect (client,
- connectable,
- cancellable,
- error);
- g_object_unref (connectable);
- g_object_unref (client);
- if (connection == NULL)
- goto out;
-
- //TODO
- /*
if (g_strcmp0 (transport_name, "kdbus") == 0)
{
GKdbusClient *client;
GKdbusConnection *connection;
+
+ const gchar *path;
+ path = g_hash_table_lookup (key_value_pairs, "path");
g_assert (ret == NULL);
client = g_kdbus_client_new ();
connection = g_kdbus_client_connect (client,
- connectable,
+ path,
cancellable,
error);
+ g_object_unref (connectable);
+ g_object_unref (client);
+ if (connection == NULL)
+ goto out;
+
+ ret = G_IO_STREAM (connection);
}
- */
+ else
+ {
+ GSocketClient *client;
+ GSocketConnection *connection;
- ret = G_IO_STREAM (connection);
+ g_assert (ret == NULL);
+ client = g_socket_client_new ();
+ connection = g_socket_client_connect (client,
+ connectable,
+ cancellable,
+ error);
+ g_object_unref (connectable);
+ g_object_unref (client);
+ if (connection == NULL)
+ goto out;
+
+ ret = G_IO_STREAM (connection);
+ }
if (nonce_file != NULL)
{
typedef struct _GVolumeMonitor GVolumeMonitor;
/**
+ * GKdbus:
+ *
+ * A lowlevel kdbus object.
+ *
+ **/
+
+typedef struct _GKdbus GKdbus;
+
+/**
+ * GKdbusClient:
+ *
+ * A helper class for kdbus clients to make connections.
+ *
+ **/
+
+typedef struct _GKdbusClient GKdbusClient;
+
+/**
+ * GKdbusConnection:
+ *
+ * A kdbus connection GIOStream object.
+ *
+ **/
+typedef struct _GKdbusConnection GKdbusConnection;
+
+/**
* GAsyncReadyCallback:
* @source_object: the object the asynchronous operation was started with.
* @res: a #GAsyncResult.
--- /dev/null
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2013 Samsung
+ *
+ * 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 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
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Michal Eljasiewicz <m.eljasiewic@samsung.com>
+ * Authors: Lukasz Skalski <l.skalski@partner.samsung.com>
+ */
+
+#include "config.h"
+
+#include "gkdbus.h"
+#include "glib-unix.h"
+
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef HAVE_SYS_FILIO_H
+# include <sys/filio.h>
+#endif
+
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+#include "gcancellable.h"
+#include "gioenumtypes.h"
+#include "ginitable.h"
+#include "gioerror.h"
+#include "gioenums.h"
+#include "gioerror.h"
+#include "glibintl.h"
+
+/**
+ * SECTION:gkdbus
+ * @short_description: Low-level kdbus object
+ * @include: gio/gio.h
+ * @see_also: #GInitable, <link linkend="gio-gnetworking.h">gnetworking.h</link>
+ *
+ */
+
+static void g_kdbus_initable_iface_init (GInitableIface *iface);
+static gboolean g_kdbus_initable_init (GInitable *initable,
+ GCancellable *cancellable,
+ GError **error);
+
+G_DEFINE_TYPE_WITH_CODE (GKdbus, g_kdbus, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
+ g_kdbus_initable_iface_init));
+
+struct _GKdbusPrivate
+{
+ gchar *path;
+ gint fd;
+ guint closed : 1;
+ guint inited : 1;
+};
+
+// TODO:
+static void
+g_kdbus_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ //GKdbus *kdbus = G_KDBUS (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+// TODO:
+static void
+g_kdbus_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ //GKdbus *kdbus = G_KDBUS (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+// TODO:
+static void
+g_kdbus_finalize (GObject *object)
+{
+ //GKdbus *kdbus = G_KDBUS (object);
+
+ // TODO: Posprzatac po obiekcie
+
+}
+
+static void
+g_kdbus_class_init (GKdbusClass *klass)
+{
+ GObjectClass *gobject_class G_GNUC_UNUSED = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GKdbusPrivate));
+
+ gobject_class->finalize = g_kdbus_finalize;
+ gobject_class->set_property = g_kdbus_set_property;
+ gobject_class->get_property = g_kdbus_get_property;
+}
+
+static void
+g_kdbus_initable_iface_init (GInitableIface *iface)
+{
+ iface->init = g_kdbus_initable_init;
+}
+
+static void
+g_kdbus_init (GKdbus *kdbus)
+{
+ kdbus->priv = G_TYPE_INSTANCE_GET_PRIVATE (kdbus, G_TYPE_KDBUS, GKdbusPrivate);
+ kdbus->priv->fd = -1;
+ kdbus->priv->path = NULL;
+}
+
+static gboolean
+g_kdbus_initable_init (GInitable *initable,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GKdbus *kdbus;
+
+ g_return_val_if_fail (G_IS_KDBUS (initable), FALSE);
+
+ kdbus = G_KDBUS (initable);
+
+ if (cancellable != NULL)
+ {
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("Cancellable initialization not supported"));
+ return FALSE;
+ }
+
+ kdbus->priv->inited = TRUE;
+
+ return TRUE;
+}
+
+/**
+ * g_kdbus_get_fd:
+ * @kdbus: a #GKdbus.
+ *
+ * Returns: the file descriptor of the kdbus.
+ */
+gint
+g_kdbus_get_fd (GKdbus *kdbus)
+{
+ g_return_val_if_fail (G_IS_KDBUS (kdbus), FALSE);
+
+ return kdbus->priv->fd;
+}
+
+/**
+ * g_kdbus_connect:
+ * @kdbus: a #Gkdbus.
+ */
+gboolean
+g_kdbus_open (GKdbus *kdbus,
+ const gchar *address,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (G_IS_KDBUS (kdbus), FALSE);
+
+ kdbus->priv->fd = open(address, O_RDWR|O_CLOEXEC|O_NONBLOCK);
+
+ return TRUE;
+}
+
+/**
+ * g_kdbus_close:
+ * @kdbus: a #GKdbus
+ * @error: #GError for error reporting, or %NULL to ignore.
+ *
+ */
+gboolean
+g_kdbus_close (GKdbus *kdbus,
+ GError **error)
+{
+ // TODO
+ return TRUE;
+}
+
+/**
+ * g_kdbus_is_closed:
+ * @kdbus: a #GKdbus
+ *
+ * Checks whether a kdbus is closed.
+ *
+ * Returns: %TRUE if kdbus is closed, %FALSE otherwise
+ */
+gboolean
+g_kdbus_is_closed (GKdbus *kdbus)
+{
+ g_return_val_if_fail (G_IS_KDBUS (kdbus), FALSE);
+
+ return kdbus->priv->closed;
+}
+
+
+
+
+/***************************************************************************************************************
+ * g_kdbus_receive:
+ * @kdbus: a #GKdbus
+ */
+/*gssize
+g_kdbus_receive (GKdbus *kdbus,
+ gchar *buffer,
+ gsize size,
+ GCancellable *cancellable,
+ GError **error)
+{
+ // TODO
+}*/
+
+/**
+ * g_kdbus_send:
+ * @kdbus: a #GKdbus
+ */
+/*gssize
+g_kdbus_send (GKdbus *kdbus,
+ const gchar *buffer,
+ gsize size,
+ GCancellable *cancellable,
+ GError **error)
+{
+ // TODO
+}*/
+
+/**
+ * g_kdbus_send_message:
+ * @kdbus: a #GKdbus
+ */
+/*gssize
+g_kdbus_send_message (Gkdbus *kdbus,
+ GkdbusAddress *address,
+ GOutputVector *vectors,
+ gint num_vectors,
+ GkdbusControlMessage **messages,
+ gint num_messages,
+ gint flags,
+ GCancellable *cancellable,
+ GError **error)
+{
+ //TODO
+}*/
+
+
+/**
+ * g_kdbus_receive_message:
+ * @kdbus: a #Gkdbus
+ */
+/*gssize
+g_kdbus_receive_message (Gkdbus *kdbus,
+ GkdbusAddress **address,
+ GInputVector *vectors,
+ gint num_vectors,
+ GkdbusControlMessage ***messages,
+ gint *num_messages,
+ gint *flags,
+ GCancellable *cancellable,
+ GError **error)
+{
+ //TODO
+}*/
--- /dev/null
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2013 Samsung
+ *
+ * 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 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
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Michal Eljasiewicz <m.eljasiewic@samsung.com>
+ * Authors: Lukasz Skalski <l.skalski@partner.samsung.com>
+ */
+
+#ifndef __G_KDBUS_H__
+#define __G_KDBUS_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_KDBUS (g_kdbus_get_type ())
+#define G_KDBUS(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_KDBUS, GKdbus))
+#define G_KDBUS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_KDBUS, GKdbusClass))
+#define G_IS_KDBUS(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_KDBUS))
+#define G_IS_KDBUS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_KDBUS))
+#define G_KDBUS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_KDBUS, GKdbusClass))
+
+typedef struct _GKdbusPrivate GKdbusPrivate;
+typedef struct _GKdbusClass GKdbusClass;
+
+struct _GKdbusClass
+{
+ GObjectClass parent_class;
+
+ /*< private >*/
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+ void (*_g_reserved7) (void);
+ void (*_g_reserved8) (void);
+ void (*_g_reserved9) (void);
+ void (*_g_reserved10) (void);
+};
+
+struct _GKdbus
+{
+ GObject parent_instance;
+ GKdbusPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_kdbus_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gint g_kdbus_get_fd (GKdbus *kdbus);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_kdbus_open (GKdbus *kdbus,
+ const gchar *address,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_kdbus_close (GKdbus *kdbus,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_kdbus_is_closed (GKdbus *kdbus);
+
+G_END_DECLS
+
+#endif /* __G_KDBUS_H__ */
--- /dev/null
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2013 Samsung
+ *
+ * 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 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
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Lukasz Skalski <l.skalski@partner.samsung.com>
+ * Authors: Michal Eljasiewicz <m.eljasiewic@samsung.com>
+ */
+
+#include "config.h"
+#include "gkdbusclient.h"
+#include <gio/gkdbusconnection.h>
+
+G_DEFINE_TYPE (GKdbusClient, g_kdbus_client, G_TYPE_OBJECT);
+
+struct _GKdbusClientPrivate
+{
+ GHashTable *app_proxies;
+};
+
+
+// TODO
+static void
+g_kdbus_client_init (GKdbusClient *client)
+{
+ client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client,
+ G_TYPE_KDBUS_CLIENT,
+ GKdbusClientPrivate);
+ client->priv->app_proxies = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
+}
+
+// TODO
+GKdbusClient *
+g_kdbus_client_new (void)
+{
+ return g_object_new (G_TYPE_KDBUS_CLIENT, NULL);
+}
+
+// TODO
+static void
+g_kdbus_client_finalize (GObject *object)
+{
+ GKdbusClient *client = G_KDBUS_CLIENT (object);
+
+ g_hash_table_unref (client->priv->app_proxies);
+}
+
+// TODO
+static void
+g_kdbus_client_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ //GKdbusClient *client = G_KDBUS_CLIENT (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+// TODO
+static void
+g_kdbus_client_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ //GKdbusClient *client = G_KDBUS_CLIENT (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+// TODO
+static void
+g_kdbus_client_class_init (GKdbusClientClass *class)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+
+ g_type_class_add_private (class, sizeof (GKdbusClientPrivate));
+
+ gobject_class->finalize = g_kdbus_client_finalize;
+ gobject_class->set_property = g_kdbus_client_set_property;
+ gobject_class->get_property = g_kdbus_client_get_property;
+}
+
+// TODO
+GKdbusConnection *
+g_kdbus_client_connect (GKdbusClient *client,
+ const gchar *address,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GIOStream *connection = NULL;
+ GError *last_error;
+ last_error = NULL;
+
+ while (connection == NULL)
+ {
+
+ if (g_cancellable_is_cancelled (cancellable))
+ {
+ g_clear_error (error);
+ g_cancellable_set_error_if_cancelled (cancellable, error);
+ break;
+ }
+
+ connection = g_object_new(G_TYPE_KDBUS_CONNECTION,NULL);
+ if (g_kdbus_connection_connect (G_KDBUS_CONNECTION (connection),
+ address, cancellable, &last_error))
+ {
+ //g_print("It works :)\n");
+ }
+ else
+ {
+ g_object_unref (connection);
+ connection = NULL;
+ }
+ }
+ return G_KDBUS_CONNECTION (connection);
+}
+
--- /dev/null
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2013 Samsung
+ *
+ * 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 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
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Lukasz Skalski <l.skalski@partner.samsung.com>
+ * Authors: Michal Eljasiewicz <m.eljasiewic@samsung.com>
+ */
+
+#ifndef __G_KDBUS_CLIENT_H__
+#define __G_KDBUS_CLIENT_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+#include <gio/giotypes.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_KDBUS_CLIENT (g_kdbus_client_get_type ())
+#define G_KDBUS_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_KDBUS_CLIENT, GKdbusClient))
+#define G_KDBUS_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_KDBUS_CLIENT, GKdbusClientClass))
+#define G_IS_KDBUS_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_KDBUS_CLIENT))
+#define G_IS_KDBUS_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_KDBUS_CLIENT))
+#define G_KDBUS_CLIENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_KDBUS_CLIENT, GKdbusClientClass))
+
+typedef struct _GKdbusClientPrivate GKdbusClientPrivate;
+typedef struct _GKdbusClientClass GKdbusClientClass;
+
+struct _GKdbusClientClass
+{
+ GObjectClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+};
+
+struct _GKdbusClient
+{
+ GObject parent_instance;
+ GKdbusClientPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_kdbus_client_get_type (void) G_GNUC_CONST;
+
+GLIB_AVAILABLE_IN_ALL
+GKdbusClient *g_kdbus_client_new (void);
+
+
+GLIB_AVAILABLE_IN_ALL
+GKdbusConnection * g_kdbus_client_connect (GKdbusClient *client,
+ const gchar *address,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_KDBUS_CLIENT_H___ */
--- /dev/null
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2013 Samsung
+ *
+ * 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 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
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Michal Eljasiewicz <m.eljasiewic@samsung.com>
+ * Authors: Lukasz Skalski <l.skalski@partner.samsung.com>
+ */
+
+#include <fcntl.h>
+#include "config.h"
+
+#include "gkdbusconnection.h"
+
+#include <gio/gtask.h>
+#include "gunixconnection.h"
+
+
+/**
+ * SECTION:gkdbusconnection
+ * @short_description: A kdbus connection
+ * @include: gio/gio.h
+ * @see_also: #GIOStream, #GKdbusClient
+ *
+ * #GKdbusConnection is a #GIOStream for a connected kdbus bus.
+ */
+
+G_DEFINE_TYPE (GKdbusConnection, g_kdbus_connection, G_TYPE_IO_STREAM);
+
+struct _GKdbusConnectionPrivate
+{
+ GKdbus *kdbus;
+ gboolean in_dispose;
+};
+
+// TODO
+gboolean
+g_kdbus_connection_connect (GKdbusConnection *connection,
+ const gchar *address,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_return_val_if_fail (G_IS_KDBUS_CONNECTION (connection), FALSE);
+
+ return g_kdbus_open (connection->priv->kdbus, address,
+ cancellable, error);
+}
+
+// TODO
+gboolean
+g_kdbus_connection_is_connected (GKdbusConnection *connection)
+{
+ return (!g_kdbus_is_closed (connection->priv->kdbus));
+}
+
+// TODO
+static void
+g_kdbus_connection_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ //GKdbusConnection *connection = G_KDBUS_CONNECTION (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+// TODO
+static void
+g_kdbus_connection_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ //GKdbusConnection *connection = G_KDBUS_CONNECTION (object);
+
+ switch (prop_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+// TODO
+static void
+g_kdbus_connection_dispose (GObject *object)
+{
+ GKdbusConnection *connection = G_KDBUS_CONNECTION (object);
+
+ connection->priv->in_dispose = TRUE;
+
+ G_OBJECT_CLASS (g_kdbus_connection_parent_class)
+ ->dispose (object);
+
+ connection->priv->in_dispose = FALSE;
+}
+
+// TODO
+static void
+g_kdbus_connection_finalize (GObject *object)
+{
+ //GKdbusConnection *connection = G_KDBUS_CONNECTION (object);
+
+ G_OBJECT_CLASS (g_kdbus_connection_parent_class)
+ ->finalize (object);
+}
+
+// TODO
+gboolean
+g_kdbus_connection_close (GIOStream *stream,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GKdbusConnection *connection = G_KDBUS_CONNECTION (stream);
+
+ if (connection->priv->in_dispose)
+ return TRUE;
+
+ return g_kdbus_close (connection->priv->kdbus, error);
+ return TRUE;
+}
+
+// TODO:
+static void
+g_kdbus_connection_class_init (GKdbusConnectionClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (GKdbusConnectionPrivate));
+
+ gobject_class->set_property = g_kdbus_connection_set_property;
+ gobject_class->get_property = g_kdbus_connection_get_property;
+ gobject_class->finalize = g_kdbus_connection_finalize;
+ gobject_class->dispose = g_kdbus_connection_dispose;
+}
+
+// TODO
+static void
+g_kdbus_connection_init (GKdbusConnection *connection)
+{
+ //connection->kdbus = g_object_new(G_TYPE_KDBUS,NULL);
+ connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection,
+ G_TYPE_KDBUS_CONNECTION,
+ GKdbusConnectionPrivate);
+}
+
+/**
+ * g_kdbus_connection_get_kdbus:
+ * @connection: a #GKdbusConnection
+ *
+ * Gets the underlying #GKdbus object of the connection.
+ *
+ * Returns: (transfer none): a #GSocketAddress or %NULL on error.
+ *
+ */
+GKdbus *
+g_kdbus_connection_get_kdbus (GKdbusConnection *connection)
+{
+ g_return_val_if_fail (G_IS_KDBUS_CONNECTION (connection), NULL);
+
+ return connection->priv->kdbus;
+}
+
+
--- /dev/null
+/* GIO - GLib Input, Output and Streaming Library
+ *
+ * Copyright © 2013 Samsung
+ *
+ * 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 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
+ * 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, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Michal Eljasiewicz <m.eljasiewic@samsung.com>
+ * Authors: Lukasz Skalski <l.skalski@partner.samsung.com>
+ */
+
+#ifndef __G_KDBUS_CONNECTION_H__
+#define __G_KDBUS_CONNECTION_H__
+
+#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
+#error "Only <gio/gio.h> can be included directly."
+#endif
+
+#include <glib-object.h>
+#include <gio/gkdbus.h>
+#include <gio/giostream.h>
+
+G_BEGIN_DECLS
+
+#define G_TYPE_KDBUS_CONNECTION (g_kdbus_connection_get_type ())
+#define G_KDBUS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
+ G_TYPE_KDBUS_CONNECTION, GKdbusConnection))
+#define G_KDBUS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
+ G_TYPE_KDBUS_CONNECTION, GKdbusConnectionClass))
+#define G_IS_KDBUS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
+ G_TYPE_KDBUS_CONNECTION))
+#define G_IS_KDBUS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+ G_TYPE_KDBUS_CONNECTION))
+#define G_KDBUS_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
+ G_TYPE_KDBUS_CONNECTION, GKdbusConnectionClass))
+
+typedef struct _GKdbusConnectionPrivate GKdbusConnectionPrivate;
+typedef struct _GKdbusConnectionClass GKdbusConnectionClass;
+
+struct _GKdbusConnectionClass
+{
+ GIOStreamClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_g_reserved1) (void);
+ void (*_g_reserved2) (void);
+ void (*_g_reserved3) (void);
+ void (*_g_reserved4) (void);
+ void (*_g_reserved5) (void);
+ void (*_g_reserved6) (void);
+};
+
+struct _GKdbusConnection
+{
+ GIOStream parent_instance;
+ GKdbusConnectionPrivate *priv;
+};
+
+GLIB_AVAILABLE_IN_ALL
+GType g_kdbus_connection_get_type (void) G_GNUC_CONST;
+GLIB_AVAILABLE_IN_ALL
+gboolean g_kdbus_connection_is_connected (GKdbusConnection *connection);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_kdbus_connection_connect (GKdbusConnection *connection,
+ const gchar *address,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+gboolean g_kdbus_connection_close (GIOStream *stream,
+ GCancellable *cancellable,
+ GError **error);
+GLIB_AVAILABLE_IN_ALL
+GKdbus *g_kdbus_connection_get_kdbus (GKdbusConnection *connection);
+
+G_END_DECLS
+
+#endif /* __G_KDBUS_CONNECTION_H__ */