From 388b0603f3db32f316c2453c68692d26709fd589 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Tue, 22 May 2012 12:20:31 +0900 Subject: [PATCH] Add renew method for fault recovering. Master will send "renew" event to re-create normal livebox instances. Change-Id: I76adf33ec1c8ae317454abc0f9e5aa772ce45de8 --- src/dbus.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/dbus.c b/src/dbus.c index 25b4609..537566e 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -73,6 +73,20 @@ static struct info { " " " " " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " " " " " " " @@ -292,6 +306,45 @@ static void method_resume(GDBusMethodInvocation *inv, GVariant *param) livebox_resume_all(); } +static void method_renew(GDBusMethodInvocation *inv, GVariant *param) +{ + const char *pkgname; + const char *filename; + const char *content; + const char *cluster; + const char *category; + int timeout; + int has_livebox_script; + double period; + int ret; + int w; + int h; + int lw; + int lh; + double priority; + int pinup; + + g_variant_get(param, "(&s&s&siid&s&siii)", &pkgname, &filename, + &content, &timeout, &has_livebox_script, + &period, &cluster, &category, &pinup, &w, &h); + + ret = livebox_create(pkgname, filename, content, timeout, has_livebox_script, period, cluster, category, &lw, &lh, &priority, pinup, 1); + if (ret == 0) { + if (lw != w || lh != h) { + int tmp; + tmp = livebox_resize(pkgname, filename, w, h); + /* Ignore return value */ + DbgPrint("Resize returns %d\n", tmp); + } + } + + param = g_variant_new("(i)", ret); + if (!param) + ErrPrint("Failed to create param\n"); + + g_dbus_method_invocation_return_value(inv, param); +} + static void method_new(GDBusMethodInvocation *inv, GVariant *param) { const char *pkgname; @@ -356,6 +409,10 @@ static void method_handler(GDBusConnection *conn, .method = method_resize, }, { + .name = "renew", + .method = method_renew, + }, + { .name = "new", .method = method_new, }, -- 2.7.4