[Galago-commits] r2807 - in trunk/galago-daemon: . src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Mon May 22 01:26:27 PDT 2006
Author: chipx86
Date: 2006-05-22 01:26:21 -0700 (Mon, 22 May 2006)
New Revision: 2807
Modified:
trunk/galago-daemon/ChangeLog
trunk/galago-daemon/configure.ac
trunk/galago-daemon/src/meta-service.c
trunk/galago-daemon/src/meta-service.h
trunk/galago-daemon/src/service.c
Log:
Add some very basic handlers for Service.RegisterStatus and Service.GetRegisteredStatuses messages.
Modified: trunk/galago-daemon/ChangeLog
===================================================================
--- trunk/galago-daemon/ChangeLog 2006-05-21 21:53:28 UTC (rev 2806)
+++ trunk/galago-daemon/ChangeLog 2006-05-22 08:26:21 UTC (rev 2807)
@@ -1,3 +1,12 @@
+Mon May 22 01:25:54 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/meta-service.c:
+ * src/meta-service.h:
+ * src/service.c:
+ * configure.ac:
+ - Add some very basic handlers for Service.RegisterStatus and
+ Service.GetRegisteredStatuses messages.
+
==================== 0.5.0 ====================
Thu Apr 20 17:47:40 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
Modified: trunk/galago-daemon/configure.ac
===================================================================
--- trunk/galago-daemon/configure.ac 2006-05-21 21:53:28 UTC (rev 2806)
+++ trunk/galago-daemon/configure.ac 2006-05-22 08:26:21 UTC (rev 2807)
@@ -3,7 +3,7 @@
dnl ################################################################
dnl # Initialize autoconf
dnl ################################################################
-AC_INIT(galago-daemon, 0.5.0, chipx86 at chipx86.com)
+AC_INIT(galago-daemon, 0.5.0.90, chipx86 at chipx86.com)
AC_PREREQ(2.50)
AC_CONFIG_SRCDIR(config.h.in)
AC_COPYRIGHT([Copyright 2004-2006 Christian Hammond])
@@ -14,7 +14,7 @@
GALAGOD_MAJOR_VERSION=0
GALAGOD_MINOR_VERSION=5
GALAGOD_MICRO_VERSION=0
-GALAGOD_DEVEL_VERSION=0
+GALAGOD_DEVEL_VERSION=90
GALAGOD_VERSION=$GALAGOD_MAJOR_VERSION.$GALAGOD_MINOR_VERSION.$GALAGOD_MICRO_VERSION
Modified: trunk/galago-daemon/src/meta-service.c
===================================================================
--- trunk/galago-daemon/src/meta-service.c 2006-05-21 21:53:28 UTC (rev 2806)
+++ trunk/galago-daemon/src/meta-service.c 2006-05-22 08:26:21 UTC (rev 2807)
@@ -66,6 +66,13 @@
(GalagoService *)meta_service->services->data);
}
+ if (meta_service->registered_statuses != NULL)
+ {
+ g_list_foreach(meta_service->registered_statuses,
+ (GFunc)g_object_unref, NULL);
+ g_list_free(meta_service->registered_statuses);
+ }
+
galagod_services_remove_meta_service(meta_service);
galagod_service_remove_filter(meta_service->service);
galagod_account_list_destroy(meta_service->account_list);
@@ -128,3 +135,25 @@
galagod_account_list_remove_with_service(meta_service->account_list,
service);
}
+
+void
+galagod_meta_service_register_status(GalagodMetaService *meta_service,
+ GalagoStatus *status)
+{
+ g_return_if_fail(meta_service != NULL);
+ g_return_if_fail(status != NULL);
+ g_return_if_fail(GALAGO_IS_STATUS(status));
+
+ /* TODO: Check for dups */
+ meta_service->registered_statuses =
+ g_list_append(meta_service->registered_statuses, status);
+}
+
+GList *
+galagod_meta_service_get_registered_statuses(
+ const GalagodMetaService *meta_service)
+{
+ g_return_val_if_fail(meta_service != NULL, NULL);
+
+ return meta_service->registered_statuses;
+}
Modified: trunk/galago-daemon/src/meta-service.h
===================================================================
--- trunk/galago-daemon/src/meta-service.h 2006-05-21 21:53:28 UTC (rev 2806)
+++ trunk/galago-daemon/src/meta-service.h 2006-05-22 08:26:21 UTC (rev 2807)
@@ -31,6 +31,7 @@
GalagoService *service;
GList *services;
+ GList *registered_statuses;
GalagodAccountList *account_list;
};
@@ -56,4 +57,9 @@
void galagod_meta_service_remove_service(GalagodMetaService *meta_service,
GalagoService *service);
+void galagod_meta_service_register_status(GalagodMetaService *meta_service,
+ GalagoStatus *status);
+GList *galagod_meta_service_get_registered_statuses(
+ const GalagodMetaService *meta_service);
+
#endif /* _GALAGOD_META_SERVICE_H_ */
Modified: trunk/galago-daemon/src/service.c
===================================================================
--- trunk/galago-daemon/src/service.c 2006-05-21 21:53:28 UTC (rev 2806)
+++ trunk/galago-daemon/src/service.c 2006-05-22 08:26:21 UTC (rev 2807)
@@ -24,6 +24,58 @@
#include "utils.h"
static DBusHandlerResult
+service_register_status(DBusConnection *dbus_conn, DBusMessage *message,
+ GalagodCoCo *coco, GalagoService *service)
+{
+ GalagodMetaService *meta_service;
+ GalagoStatus *status;
+ DBusMessageIter iter;
+
+ meta_service = GALAGOD_META_SERVICE(service);
+
+ dbus_message_iter_init(message, &iter);;
+ status = galago_dbus_message_iter_get_object(&iter, GALAGO_TYPE_STATUS);
+
+ galagod_meta_service_register_status(meta_service, status);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
+service_get_registered_statuses(DBusConnection *dbus_conn,
+ DBusMessage *message,
+ GalagodCoCo *coco, GalagoService *service)
+{
+ GalagodMetaService *meta_service;
+ DBusMessage *reply;
+ DBusMessageIter iter, array_iter;
+ GList *l;
+
+ meta_service = GALAGOD_META_SERVICE(service);
+
+ reply = dbus_message_new_method_return(message);
+ dbus_message_iter_init_append(reply, &iter);
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
+ galago_object_type_get_dbus_signature(GALAGO_TYPE_STATUS),
+ &array_iter);
+
+ for (l = galagod_meta_service_get_registered_statuses(meta_service);
+ l != NULL;
+ l = l->next)
+ {
+ galago_dbus_message_iter_append_object(&array_iter,
+ GALAGO_OBJECT(l->data));
+ }
+
+ dbus_message_iter_close_container(&iter, &array_iter);
+
+ dbus_connection_send(dbus_conn, reply, NULL);
+ dbus_message_unref(reply);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static DBusHandlerResult
service_add_account(DBusConnection *dbus_conn, DBusMessage *message,
GalagodCoCo *coco, GalagoService *service)
{
@@ -197,11 +249,13 @@
static const GalagodCommand commands[] =
{
- GALAGOD_COMMAND("AddAccount", service_add_account),
- GALAGOD_COMMAND("RemoveAccount", service_remove_account),
- GALAGOD_COMMAND("GetAccount", service_get_account),
- GALAGOD_COMMAND("GetAccounts", service_get_accounts),
- GALAGOD_COMMAND("GetAccountsCount", service_get_accounts_count),
+ GALAGOD_COMMAND("RegisterStatus", service_register_status),
+ GALAGOD_COMMAND("GetRegisteredStatuses", service_get_registered_statuses),
+ GALAGOD_COMMAND("AddAccount", service_add_account),
+ GALAGOD_COMMAND("RemoveAccount", service_remove_account),
+ GALAGOD_COMMAND("GetAccount", service_get_account),
+ GALAGOD_COMMAND("GetAccounts", service_get_accounts),
+ GALAGOD_COMMAND("GetAccountsCount", service_get_accounts_count),
GALAGOD_COMMAND_LAST
};
More information about the galago-commits
mailing list