int ret;
static const char query[] =
"INSERT INTO widget_class (classid, update_period, "
- "setup_appid, appid, pkgid) "
- "VALUES (?, ?, ?, ?, ?)";
+ "setup_appid, appid, pkgid, nodisplay) "
+ "VALUES (?, ?, ?, ?, ?, ?)";
GList *tmp;
struct widget_class *wc;
sqlite3_stmt *stmt = NULL;
_bind_text(stmt, idx++, wc->setup_appid);
_bind_text(stmt, idx++, wc->appid);
_bind_text(stmt, idx++, pkgid);
+ sqlite3_bind_int(stmt, idx++, wc->nodisplay);
ret = sqlite3_step(stmt);
if (ret != SQLITE_DONE) {
return appid;
}
-static bool _get_nodisplay(const char *widget_id, uid_t uid)
+static int _get_nodisplay(const char *widget_id, uid_t uid)
{
static const char query[] =
- "SELECT appid FROM widget_class WHERE classid=?";
+ "SELECT nodisplay FROM widget_class WHERE classid=?";
int ret;
sqlite3 *db;
sqlite3_stmt *stmt;
- char *appid;
- pkgmgrinfo_appinfo_h appinfo;
- bool nodisplay;
+ int nodisplay = 0;
db = _open_db(uid);
if (db == NULL) {
set_last_result(WIDGET_ERROR_IO_ERROR);
- return false;
+ return 0;
}
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
_E("prepare error: %s", sqlite3_errmsg(db));
sqlite3_close_v2(db);
set_last_result(WIDGET_ERROR_FAULT);
- return false;
+ return 0;
}
sqlite3_bind_text(stmt, 1, widget_id, -1, SQLITE_STATIC);
/* TODO: which error should be set? */
set_last_result(ret == SQLITE_DONE ? WIDGET_ERROR_NOT_EXIST :
WIDGET_ERROR_FAULT);
- return false;
+ return 0;
}
- _get_column_str(stmt, 0, &appid);
+ _get_column_int(stmt, 0, &nodisplay);
sqlite3_finalize(stmt);
sqlite3_close_v2(db);
- ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &appinfo);
- free(appid);
- if (ret != PMINFO_R_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- return false;
- }
-
- ret = pkgmgrinfo_appinfo_is_nodisplay(appinfo, &nodisplay);
- pkgmgrinfo_appinfo_destroy_appinfo(appinfo);
- if (ret != PMINFO_R_OK) {
- _E("failed to get nodisplay of widget %s", widget_id);
- set_last_result(WIDGET_ERROR_FAULT);
- return false;
- }
-
set_last_result(WIDGET_ERROR_NONE);
return nodisplay;
EAPI int widget_service_get_nodisplay(const char *widget_id)
{
- bool nodisplay;
+ int nodisplay;
if (!_is_widget_feature_enabled()) {
_E("not supported");
if (get_last_result() == WIDGET_ERROR_NOT_EXIST)
nodisplay = _get_nodisplay(widget_id, GLOBALAPP_USER);
- return (int)nodisplay;
+ return nodisplay;
}
/* deprecated, always return need_of_frame as false */