2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "ClientInfo.h"
18 #include "UninstallMonitor.h"
22 UninstallMonitor::UninstallMonitor() :
24 __dbusWatcher(DBusType::SYSTEM)
26 __dbusSignalId = __dbusWatcher.watch(NULL,
27 "/org/tizen/pkgmgr_status", "org.tizen.pkgmgr_status", "status", this);
30 UninstallMonitor::~UninstallMonitor()
32 if (__dbusSignalId > 0)
33 __dbusWatcher.unwatch(__dbusSignalId);
36 void UninstallMonitor::onSignal(const char *sender, const char *path, const char *iface, const char *name, GVariant *param)
38 const gchar *reqId = NULL;
39 const gchar *pkgType = NULL;
40 const gchar *pkgId = NULL;
41 const gchar *key = NULL;
42 const gchar *val = NULL;
44 g_variant_get(param, "(&s&s&s&s&s)", &reqId, &pkgType, &pkgId, &key, &val);
45 _D("%s, %s, %s", pkgId, key, val);
47 IF_FAIL_VOID_TAG(pkgId && key && val, _E, "Invalid parameter");
49 if (STR_EQ(key, "start")) {
50 if (STR_EQ(val, "uninstall")) {
58 if (__pkgId.empty() || !STR_EQ(key, "end") || !STR_EQ(val, "ok"))
61 _I("'%s' has been removed", __pkgId.c_str());
63 ClientInfo::purgeClient(__pkgId);