Add "Destroy" D-Bus signal to server for debug.

This commit is contained in:
Daiki Ueno
2011-03-03 16:36:10 +09:00
parent a7f81c3cfb
commit 09c95b20da
5 changed files with 55 additions and 1 deletions

View File

@ -22,6 +22,8 @@
#include "server-server.h"
#include "server-context.h"
#define I_(string) g_intern_static_string (string)
enum {
PROP_0,
PROP_OBJECT_PATH,
@ -29,6 +31,13 @@ enum {
PROP_LAST
};
enum {
DESTROYED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0, };
static const gchar introspection_xml[] =
"<node>"
" <interface name='com.redhat.Eekboard.Server'>"
@ -43,6 +52,7 @@ static const gchar introspection_xml[] =
" <method name='DestroyContext'>"
" <arg direction='in' type='s' name='object_path'/>"
" </method>"
" <method name='Destroy'/>"
/* signals */
" </interface>"
"</node>";
@ -147,6 +157,16 @@ server_server_dispose (GObject *object)
G_OBJECT_CLASS (server_server_parent_class)->dispose (object);
}
static void
server_server_finalize (GObject *object)
{
ServerServer *server = SERVER_SERVER(object);
g_free (server->object_path);
G_OBJECT_CLASS (server_server_parent_class)->dispose (object);
}
static void
server_server_constructed (GObject *object)
{
@ -174,6 +194,18 @@ server_server_class_init (ServerServerClass *klass)
gobject_class->constructed = server_server_constructed;
gobject_class->set_property = server_server_set_property;
gobject_class->dispose = server_server_dispose;
gobject_class->finalize = server_server_finalize;
signals[DESTROYED] =
g_signal_new (I_("destroyed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
0,
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
pspec = g_param_spec_string ("object-path",
"Object-path",
@ -360,6 +392,12 @@ handle_method_call (GDBusConnection *connection,
return;
}
if (g_strcmp0 (method_name, "Destroy") == 0) {
g_signal_emit_by_name (server, "destroyed", NULL);
g_dbus_method_invocation_return_value (invocation, NULL);
return;
}
g_return_if_reached ();
}