summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Mardegan <mardy@users.sourceforge.net>2008-03-10 09:33:39 +0000
committerAlberto Mardegan <mardy@users.sourceforge.net>2008-03-10 09:33:39 +0000
commit596f2d9316ece3e8c60fc7404ebfe7a0f477913e (patch)
tree18185c046634982f8feca8360b4bd696b076955c
parent44512f518acc272e72ed4350922a44a429fb60c8 (diff)
* libmissioncontrol/Makefile.am:
Revert unnecessary version bump. * src/mcd-account-manager.[hc]: Register object with DBus. git-svn-id: https://mission-control.svn.sourceforge.net/svnroot/mission-control/trunk@303 d91c8aed-3f2b-0410-a83d-924a1c20a0ba
-rw-r--r--ChangeLog8
-rw-r--r--configure.ac2
-rw-r--r--libmissioncontrol/Makefile.am2
-rw-r--r--src/mcd-account-manager.c71
-rw-r--r--src/mcd-account-manager.h63
5 files changed, 142 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 3adb1adb..1fa0ba7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-03-10 Alberto Mardegan <alberto.mardegan@nokia.com>
+
+ * libmissioncontrol/Makefile.am:
+ Revert unnecessary version bump.
+
+ * src/mcd-account-manager.[hc]:
+ Register object with DBus.
+
2008-03-07 Alberto Mardegan <alberto.mardegan@nokia.com>
* src/Makefile.am, src/mcd-account-manager.h, src/mcd-account.h:
diff --git a/configure.ac b/configure.ac
index a95110c0..c7e48ac7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(telepathy-mission-control, 4.62)
+AC_INIT(telepathy-mission-control, 4.63)
AC_CONFIG_SRCDIR(Makefile.am)
AM_INIT_AUTOMAKE([tar-ustar])
AM_CONFIG_HEADER(config.h)
diff --git a/libmissioncontrol/Makefile.am b/libmissioncontrol/Makefile.am
index f8da5e8b..df7f3c16 100644
--- a/libmissioncontrol/Makefile.am
+++ b/libmissioncontrol/Makefile.am
@@ -80,7 +80,7 @@ libmissioncontrol_client_la_LIBADD = $(GCONF_LIBS) $(GLIB_LIBS) $(DBUS_LIBS) $(T
libmissioncontrol_client_la_LDFLAGS = $(common_ldflags) \
-export-symbols-regex "^(mc_)|(mission_control_)" \
- -version-info 5:0:0
+ -version-info 4:2:5
mission_control_include = \
mission-control-signals-marshal.h \
diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index aff7261d..7f21ecd2 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -42,11 +42,14 @@ G_DEFINE_TYPE_WITH_CODE (McdAccountManager, mcd_account_manager, G_TYPE_OBJECT,
struct _McdAccountManagerPrivate
{
+ /* DBUS connection */
+ TpDBusDaemon *dbus_daemon;
};
enum
{
PROP_0,
+ PROP_DBUS_DAEMON,
};
@@ -56,6 +59,58 @@ account_manager_iface_init (McSvcAccountManagerClass *iface,
{
}
+
+static void
+register_dbus_service (McdAccountManager *account_manager)
+{
+ McdAccountManagerPrivate *priv = account_manager->priv;
+ DBusGConnection *dbus_connection;
+
+ dbus_connection = TP_PROXY (priv->dbus_daemon)->dbus_connection;
+ if (G_LIKELY (dbus_connection))
+ dbus_g_connection_register_g_object (dbus_connection,
+ MC_ACCOUNT_MANAGER_DBUS_OBJECT,
+ G_OBJECT (account_manager));
+}
+
+static void
+set_property (GObject *obj, guint prop_id,
+ const GValue *val, GParamSpec *pspec)
+{
+ McdAccountManagerPrivate *priv = MCD_ACCOUNT_MANAGER_PRIV (obj);
+
+ switch (prop_id)
+ {
+ case PROP_DBUS_DAEMON:
+ if (priv->dbus_daemon)
+ g_object_unref (priv->dbus_daemon);
+ priv->dbus_daemon = TP_DBUS_DAEMON (g_value_dup_object (val));
+ if (priv->dbus_daemon)
+ register_dbus_service (MCD_ACCOUNT_MANAGER (obj));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+get_property (GObject *obj, guint prop_id,
+ GValue *val, GParamSpec *pspec)
+{
+ McdAccountManagerPrivate *priv = MCD_ACCOUNT_MANAGER_PRIV (obj);
+
+ switch (prop_id)
+ {
+ case PROP_DBUS_DAEMON:
+ g_value_set_object (val, priv->dbus_daemon);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
+ break;
+ }
+}
+
static void
_mcd_account_manager_finalize (GObject *object)
{
@@ -76,6 +131,16 @@ mcd_account_manager_class_init (McdAccountManagerClass *klass)
object_class->dispose = _mcd_account_manager_dispose;
object_class->finalize = _mcd_account_manager_finalize;
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
+
+ g_object_class_install_property (object_class, PROP_DBUS_DAEMON,
+ g_param_spec_object ("dbus-daemon",
+ _("DBus daemon"),
+ _("DBus daemon"),
+ TP_TYPE_DBUS_DAEMON,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY));
}
static void
@@ -90,11 +155,13 @@ mcd_account_manager_init (McdAccountManager *account_manager)
}
McdAccountManager *
-mcd_account_manager_new (void)
+mcd_account_manager_new (TpDBusDaemon *dbus_daemon)
{
gpointer *obj;
- obj = g_object_new (MCD_TYPE_ACCOUNT_MANAGER, NULL);
+ obj = g_object_new (MCD_TYPE_ACCOUNT_MANAGER,
+ "dbus-daemon", &dbus_daemon,
+ NULL);
return MCD_ACCOUNT_MANAGER (obj);
}
diff --git a/src/mcd-account-manager.h b/src/mcd-account-manager.h
new file mode 100644
index 00000000..5664ed20
--- /dev/null
+++ b/src/mcd-account-manager.h
@@ -0,0 +1,63 @@
+/*
+ * mcd-account-manager.h - the Telepathy Account D-Bus interface (service side)
+ *
+ * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * 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
+ */
+
+#ifndef __MCD_ACCOUNT_MANAGER_H__
+#define __MCD_ACCOUNT_MANAGER_H__
+
+#include <telepathy-glib/dbus.h>
+/* auto-generated stubs */
+#include "_gen/svc-Account_Manager.h"
+
+G_BEGIN_DECLS
+#define MCD_TYPE_ACCOUNT_MANAGER (mcd_account_manager_get_type ())
+#define MCD_ACCOUNT_MANAGER(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), MCD_TYPE_ACCOUNT_MANAGER, McdAccountManager))
+#define MCD_ACCOUNT_MANAGER_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST((k), MCD_TYPE_ACCOUNT_MANAGER, McdAccountManagerClass))
+#define MCD_IS_ACCOUNT_MANAGER(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), MCD_TYPE_ACCOUNT_MANAGER))
+#define MCD_IS_ACCOUNT_MANAGER_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), MCD_TYPE_ACCOUNT_MANAGER))
+#define MCD_ACCOUNT_MANAGER_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), MCD_TYPE_ACCOUNT_MANAGER, McdAccountManagerClass))
+
+typedef struct _McdAccountManager McdAccountManager;
+typedef struct _McdAccountManagerPrivate McdAccountManagerPrivate;
+typedef struct _McdAccountManagerClass McdAccountManagerClass;
+
+struct _McdAccountManager
+{
+ GObject parent;
+ McdAccountManagerPrivate *priv;
+};
+
+struct _McdAccountManagerClass
+{
+ GObjectClass parent_class;
+};
+
+
+#define MC_ACCOUNT_MANAGER_DBUS_OBJECT "/org/freedesktop/Telepathy/AccountManager"
+
+GType mcd_account_manager_get_type (void);
+McdAccountManager *mcd_account_manager_new (TpDBusDaemon *dbus_daemon);
+
+#endif