"need_frame" attribute is added
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 2 Apr 2013 12:33:56 +0000 (12:33 +0000)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 2 Apr 2013 12:33:56 +0000 (12:33 +0000)
For handling the frame decoration of boxes.
If a box set "true" for this need_frame attribute,
The viewer will draw the border for it.

Change-Id: I5b3781e4c6caaa78f8f8d00251d7e3a74104ce09

pkgmgr_livebox/src/service_register.c

index 5e212ae..9ec8a78 100644 (file)
  *
  *
  * client
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * | pkgid | Icon |  Name   | auto_launch | pd_size | content | nodisplay | setup | mouse_event | touch_effect |
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * |   -   |   -  |    -    |      -      |    -    |    -    |     -     |   -   |      -      }       -      |
- * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+
- * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT "default", nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+-------------+
+ * | pkgid | Icon |  Name   | auto_launch | pd_size | content | nodisplay | setup | mouse_event | touch_effect | need_frame  |
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+-------------+
+ * |   -   |   -  |    -    |      -      |    -    |    -    |     -     |   -   |      -      }       -      |      -      |
+ * +-------+------+---------+-------------+---------+---------+-----------+-------+-------------+--------------+-------------+
+ * CREATE TABLE client ( pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT "default", nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, need_frame INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) )
  *
  * = auto_launch = UI-APPID
  * = pd_size = WIDTHxHEIGHT
@@ -171,6 +171,7 @@ struct livebox {
        int nodisplay;
        int mouse_event; /* Mouse event processing option for livebox */
        int touch_effect; /* Touch effect of a livebox */
+       int need_frame; /* Box needs frame which should be cared by viewer */
 
        enum lb_type lb_type;
        xmlChar *lb_src;
@@ -601,7 +602,7 @@ static inline int db_create_client(void)
 
        ddl = "CREATE TABLE client (" \
                "pkgid TEXT PRIMARY KEY NOT NULL, icon TEXT, name TEXT, " \
-               "auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT 'default', nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
+               "auto_launch TEXT, pd_size TEXT, content TEXT DEFAULT 'default', nodisplay INTEGER, setup TEXT, mouse_event INTEGER, touch_effect INTEGER, need_frame INTEGER, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)";
        if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) {
                ErrPrint("Failed to execute the DDL (%s)\n", err);
                return -EIO;
@@ -619,7 +620,7 @@ static inline int db_insert_client(struct livebox *livebox)
        int ret;
        sqlite3_stmt *stmt;
 
-       dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, pd_size, content, nodisplay, setup, mouse_event, touch_effect ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
+       dml = "INSERT INTO client ( pkgid, icon, name, auto_launch, pd_size, content, nodisplay, setup, mouse_event, touch_effect, need_frame ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
        ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL);
        if (ret != SQLITE_OK) {
                DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -696,6 +697,13 @@ static inline int db_insert_client(struct livebox *livebox)
                goto out;
        }
 
+       ret = sqlite3_bind_int(stmt, 11, livebox->need_frame);
+       if (ret != SQLITE_OK) {
+               DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
+               ret = -EIO;
+               goto out;
+       }
+
        ret = 0;
        if (sqlite3_step(stmt) != SQLITE_DONE) {
                DbgPrint("Error: %s\n", sqlite3_errmsg(s_info.handle));
@@ -1730,6 +1738,20 @@ static inline void update_box(struct livebox *livebox, xmlNodePtr node)
                }
        }
 
+       if (!xmlHasProp(node, (const xmlChar *)"need_frame")) {
+               livebox->need_frame = 0;
+       } else {
+               xmlChar *need_frame;
+               need_frame = xmlGetProp(node, (const xmlChar *)"need_frame");
+               if (!need_frame) {
+                       ErrPrint("need_frame is NIL\n");
+                       livebox->need_frame = 0;
+               } else {
+                       livebox->need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true");
+                       xmlFree(need_frame);
+               }
+       }
+
        for (node = node->children; node; node = node->next) {
                if (!xmlStrcasecmp(node->name, (const xmlChar *)"size")) {
                        xmlChar *size;