3
* Copyright (C) 2007, 2008 Bruno coudoin
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, see <http://www.gnu.org/licenses/>.
21
* run GCompris with --sugarBundleId a --sugarActivityId a
22
* dbus-send --dest='org.laptop.Activitya'
23
* /org/laptop/Activity/a org.laptop.Activity.SetActive boolean:true
28
#include "gc-marshal.h"
31
#include <dbus/dbus-glib.h>
32
#include <glib-object.h>
33
#include <dbus/dbus.h>
34
#define SUPPORT_OR_RETURN(rv) {}
36
#define SUPPORT_OR_RETURN(rv) { return rv; }
39
#define _ACTIVITY_SERVICE_NAME "org.laptop.Activity"
40
#define _ACTIVITY_SERVICE_PATH "/org/laptop/Activity"
41
#define _ACTIVITY_INTERFACE "org.laptop.Activity"
44
void _SetActive(DBusGProxy *proxy, gint active, void *dummy)
46
printf("_SetActive %d\n", active);
56
gc_dbus_init(gchar *sugarActivityId)
61
DBusGConnection *connection;
67
if (!g_thread_supported ()) g_thread_init (NULL);
69
dbus_g_thread_init ();
72
connection = dbus_g_bus_get (DBUS_BUS_SESSION,
74
if (connection == NULL)
76
g_printerr ("Failed to open connection to bus: %s\n",
82
gchar *service_name = g_strdup_printf("%s%s",
83
_ACTIVITY_SERVICE_NAME,
85
gchar *object_path = g_strdup_printf("%s/%s",
86
_ACTIVITY_SERVICE_PATH,
89
dbus_g_object_register_marshaller (gc_marshal_VOID__BOOLEAN,
90
G_TYPE_NONE, G_TYPE_BOOLEAN, G_TYPE_INVALID);
92
proxy = dbus_g_proxy_new_for_name (connection,
97
dbus_g_proxy_add_signal(proxy, "SetActive", G_TYPE_BOOLEAN, G_TYPE_INVALID);
98
dbus_g_proxy_connect_signal(proxy, "SetActive",
99
G_CALLBACK(_SetActive), NULL, NULL);