diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-08-18 22:34:41 +0800 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-08-18 23:56:28 +0800 |
commit | 381d68e40a9ead2b8217c4f4da856c972d5d3228 (patch) | |
tree | 2aeb13166477a6691a4c3878fee38d88296e5f2f /libempathy | |
parent | 5586d8a26f0491766976471829dccabddce20a1a (diff) | |
download | gsoc2013-empathy-381d68e40a9ead2b8217c4f4da856c972d5d3228.tar gsoc2013-empathy-381d68e40a9ead2b8217c4f4da856c972d5d3228.tar.gz gsoc2013-empathy-381d68e40a9ead2b8217c4f4da856c972d5d3228.tar.bz2 gsoc2013-empathy-381d68e40a9ead2b8217c4f4da856c972d5d3228.tar.lz gsoc2013-empathy-381d68e40a9ead2b8217c4f4da856c972d5d3228.tar.xz gsoc2013-empathy-381d68e40a9ead2b8217c4f4da856c972d5d3228.tar.zst gsoc2013-empathy-381d68e40a9ead2b8217c4f4da856c972d5d3228.zip |
empathy-connectivity: add initial stubs
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/Makefile.am | 2 | ||||
-rw-r--r-- | libempathy/empathy-connectivity.c | 129 | ||||
-rw-r--r-- | libempathy/empathy-connectivity.h | 65 |
3 files changed, 196 insertions, 0 deletions
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 27671543a..7600ee5d4 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -31,6 +31,7 @@ libempathy_la_SOURCES = \ empathy-chatroom-manager.c \ empathy-call-factory.c \ empathy-call-handler.c \ + empathy-connectivity.c \ empathy-contact.c \ empathy-contact-groups.c \ empathy-contact-list.c \ @@ -82,6 +83,7 @@ libempathy_headers = \ empathy-chatroom-manager.h \ empathy-call-factory.h \ empathy-call-handler.h \ + empathy-connectivity.h \ empathy-contact.h \ empathy-contact-groups.h \ empathy-contact-list.h \ diff --git a/libempathy/empathy-connectivity.c b/libempathy/empathy-connectivity.c new file mode 100644 index 000000000..264b58d06 --- /dev/null +++ b/libempathy/empathy-connectivity.c @@ -0,0 +1,129 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * 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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk> + */ + +#include "config.h" + +#define DEBUG_FLAG EMPATHY_DEBUG_OTHER +#include <libempathy/empathy-debug.h> + +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyConnectivity) + +typedef struct { + gboolean dispose_run; +} EmpathyConnectivityPriv; + +enum { + STATE_CHANGE, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL]; +static EmpathyConnectivity *connectivity_singleton = NULL; + +G_DEFINE_TYPE (EmpathyConnectivity, empathy_connectivity, G_TYPE_OBJECT); + +static void +empathy_connectivity_init (EmpathyConnectivity *connectivity) +{ + EmpathyConnectivityPriv *priv; + + priv = G_TYPE_INSTANCE_GET_PRIVATE (connectivity, + EMPATHY_TYPE_CONNECTIVITY, EmpathyConnectivityPriv); + + connectivity->priv = priv; + priv->dispose_run = FALSE; +} + +static void +connectivity_finalize (GObject *object) +{ + EmpathyConnectivity *manager = EMPATHY_CONNECTIVITY (obj); + EmpathyConnectivityPriv *priv = GET_PRIV (manager); + + G_OBJECT_CLASS (empathy_connectivity_parent_class)->finalize (obj); +} + +static void +connectivity_dispose (GObject *object) +{ + EmpathyConnectivity *manager = EMPATHY_CONNECTIVITY (obj); + EmpathyConnectivityPriv *priv = GET_PRIV (manager); + + if (priv->dispose_run) + return; + + priv->dispose_run = TRUE; + + G_OBJECT_CLASS (empathy_connectivity_parent_class)->dispose (obj); +} + +static GObject * +connectivity_constructor (GType type, + guint n_construct_params, + GObjectConstructParam *construct_params) +{ + GObject *retval; + + if (!manager_singleton) + { + retval = G_OBJECT_CLASS (empathy_connectivity_parent_class)->constructor + (type, n_construct_params, construct_params); + + manager_singleton = EMPATHY_CONNECTIVITY (retval); + g_object_add_weak_pointer (retval, (gpointer) &manager_singleton); + } + else + { + retval = g_object_ref (manager_singleton); + } + + return retval; +} + +static void +empathy_connectivity_class_init (EmpathyConnectivityClass *klass) +{ + GObjectClass *oclass = G_OBJECT_CLASS (klass); + + oclass->finalize = connectivity_finalize; + oclass->dispose = connectivity_dispose; + oclass->constructor = connectivity_constructor; + + signals[STATE_CHANGE] = + g_signal_new ("state-change", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, /* TODO */ + G_TYPE_NONE, + 0, NULL); + + g_type_class_add_private (oclass, sizeof (EmpathyConnectivityPriv)); +} + +/* public methods */ + +EmpathyConnectivity * +empathy_connectivity_dup_singleton (void) +{ + return g_object_new (EMPATHY_TYPE_CONNECTIVITY, NULL); +} diff --git a/libempathy/empathy-connectivity.h b/libempathy/empathy-connectivity.h new file mode 100644 index 000000000..391c6597f --- /dev/null +++ b/libempathy/empathy-connectivity.h @@ -0,0 +1,65 @@ +/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ +/* + * Copyright (C) 2009 Collabora Ltd. + * + * 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.1 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Authors: Jonny Lamb <jonny.lamb@collabora.co.uk> + */ + +#ifndef __EMPATHY_CONNECTIVITY_H__ +#define __EMPATHY_CONNECTIVITY_H__ + +#include <glib-object.h> + +G_BEGIN_DECLS + +#define EMPATHY_TYPE_CONNECTIVITY (empathy_connectivity_get_type ()) +#define EMPATHY_CONNECTIVITY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONNECTIVITY, \ + EmpathyConnectivity)) +#define EMPATHY_CONNECTIVITY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONNECTIVITY, \ + EmpathyConnectivityClass)) +#define EMPATHY_IS_CONNECTIVITY(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONNECTIVITY)) +#define EMPATHY_IS_CONNECTIVITY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONNECTIVITY)) +#define EMPATHY_CONNECTIVITY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONNECTIVITY, \ + EmpathyConnectivityClass)) + +typedef struct _EmpathyConnectivity EmpathyConnectivity; +typedef struct _EmpathyConnectivityClass EmpathyConnectivityClass; + +struct _EmpathyConnectivity { + GObject parent; + gpointer priv; +}; + +struct _EmpathyConnectivityClass { + GObjectClass parent_class; +}; + +GType empathy_connectivity_get_type (void); + +/* public methods */ + +EmpathyConnectivity * empathy_connectivity_dup_singleton (void); + +G_END_DECLS + +#endif /* __EMPATHY_CONNECTIVITY_H__ */ + |