4 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include "popup-common.h"
22 #define DBUS_RESOURCED_WATCHDOG_PATH "/Org/Tizen/ResourceD/Process"
23 #define DBUS_RESOURCED_WATCHDOG_IFACE "org.tizen.resourced.process"
24 #define DBUS_RESOURCED_WATCHDOG_SIGNAL "WatchdogResult"
26 #define APP_NAME "_APP_NAME_"
28 enum button_selected {
33 static int watchdog_get_content(const struct popup_ops *ops, char *content, unsigned int len)
36 struct object_ops *obj;
42 ret = get_object_by_ops(ops, &obj);
44 _E("Failed to get object (%d)", ret);
48 name = (char *)bundle_get_val(obj->b, APP_NAME);
50 _E("Failed to get app name");
54 text = _("IDS_ST_BODY_PS_IS_NOT_RESPONDING_CLOSE_PS_Q");
56 snprintf(content, len, text, name, name);
61 static void send_result_dbus_signal(int result)
67 snprintf(buf, sizeof(buf), "%d", result);
69 ret = broadcast_dbus_signal(DBUS_RESOURCED_WATCHDOG_PATH,
70 DBUS_RESOURCED_WATCHDOG_IFACE,
71 DBUS_RESOURCED_WATCHDOG_SIGNAL,
74 _E("FAIL: broadcast_dbus_signal(%d)", ret);
77 static void watchdog_wait(const struct popup_ops *ops)
79 _I("Wait is selected");
81 unload_simple_popup(ops);
83 send_result_dbus_signal(WATCHDOG_WAIT);
85 terminate_if_no_popup();
88 static void watchdog_ok(const struct popup_ops *ops)
92 unload_simple_popup(ops);
94 send_result_dbus_signal(WATCHDOG_OK);
96 terminate_if_no_popup();
99 static const struct popup_ops watchdog_ops = {
101 .show = load_simple_popup,
102 .title = "IDS_CLD_HEADER_NO_RESPONSE",
103 .get_content = watchdog_get_content,
104 .left_text = "IDS_CST_OPT_WAIT",
105 .left = watchdog_wait,
106 .right_text = "IDS_COM_SK_OK",
107 .right = watchdog_ok,
110 /* Constructor to register watchdog button */
111 static __attribute__ ((constructor)) void watchdog_register_popup(void)
113 register_popup(&watchdog_ops);