APPLY_RSA
[apps/home/ug-memo-efl.git] / src / ug-select.c
index fdef4b5..1d083cc 100644 (file)
@@ -1,18 +1,20 @@
 /*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  * 
-  * Licensed under the Flora License, Version 1.0 (the "License");
-  * you may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at
-  * 
-  *     http://www.tizenopensource.org/license
-  * 
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
+*
+* Copyright 2012  Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -43,6 +45,8 @@ typedef struct __select_view_t {
     int total;
     Evas_Object *selectioninfo;
     Evas_Object *selectioninfo_layout;
+
+    Eina_Bool is_textonly;
 } select_view_t;
 
 static void memo_data_iterate_cb (memo_data_t *md, void *user_data);
@@ -70,7 +74,7 @@ static void _on_add(void *data, Evas_Object *obj, void *event_info)
     RETIF(data == NULL);
     select_view_t *sv = (select_view_t *)data;
     ug_data_t *ugd = sv->ugd;
-    bundle *b = NULL;
+    service_h service = NULL;
     Elm_Object_Item *it;
     gl_data_t *gld = NULL;
     int c_text = 0;
@@ -78,7 +82,7 @@ static void _on_add(void *data, Evas_Object *obj, void *event_info)
     char path[MEMO_BUFFER_SIZE] = {0};
     memo_data_t *md = NULL;
 
-    b = bundle_create();
+    service_create(&service);
     it = elm_genlist_first_item_get(sv->genlist);
     while (it != NULL) {
         gld = (gl_data_t *)elm_object_item_data_get(it);
@@ -87,12 +91,12 @@ static void _on_add(void *data, Evas_Object *obj, void *event_info)
             if (gld->has_doodle) {
                 c_image++;
                 snprintf(ugd->buf, MEMO_BUFFER_SIZE, "image%d", c_image);
-                snprintf(path, MEMO_BUFFER_SIZE, DOODLEDIR"/%d.png", gld->index);
-                bundle_add(b, ugd->buf, path);
+                snprintf(path, MEMO_BUFFER_SIZE, "/opt/apps/org.tizen.memo/data/doodle/%d.png", gld->index);
+                service_add_extra_data(service, ugd->buf, path);
             } else {
                 c_text++;
                 snprintf(ugd->buf, MEMO_BUFFER_SIZE, "text%d", c_text);
-                bundle_add(b, ugd->buf, md->content);
+                service_add_extra_data(service, ugd->buf, md->content);
             }
         }
         memo_free_data(md);
@@ -100,12 +104,12 @@ static void _on_add(void *data, Evas_Object *obj, void *event_info)
     }
 
     snprintf(ugd->buf, MEMO_BUFFER_SIZE, "%d", c_image);
-    bundle_add(b, "image", ugd->buf);
+    service_add_extra_data(service, "image", ugd->buf);
     snprintf(ugd->buf, MEMO_BUFFER_SIZE, "%d", c_text);
-    bundle_add(b, "text", ugd->buf);
-    ug_send_result(ugd->ug, b);
-    bundle_dump(b);
-    bundle_free(b);
+    service_add_extra_data(service, "text", ugd->buf);
+    ug_send_result(ugd->ug, service);
+    service_dump(service);
+    service_destroy(service);
     memo_unsubscribe_change(_on_data_update);
     ug_destroy_me(ugd->ug);
 }
@@ -166,13 +170,16 @@ static void memo_data_iterate_cb (memo_data_t *md, void *user_data)
     RETIF(gld == NULL);
     memo_gld_init(gld, md, sv, NULL);
     if (md->has_doodle) {
-        elm_genlist_item_append(sv->genlist, &sv->itc_draw,(void *)gld,
-            NULL, ELM_GENLIST_ITEM_NONE, _on_item_select_cb, NULL);
+        if (!sv->is_textonly) {
+            elm_genlist_item_append(sv->genlist, &sv->itc_draw,(void *)gld,
+                NULL, ELM_GENLIST_ITEM_NONE, _on_item_select_cb, NULL);
+            sv->total++;
+        }
     } else {
         elm_genlist_item_append(sv->genlist, &sv->itc,(void *)gld,
             NULL, ELM_GENLIST_ITEM_NONE, _on_item_select_cb, NULL);
+        sv->total++;
     }
-    sv->total++;
 }
 
 static void _create_select_layout(select_view_t *sv)
@@ -204,11 +211,12 @@ static void _create_select_layout(select_view_t *sv)
     elm_object_item_disabled_set(sv->r_btn, EINA_TRUE); /* disable add defaultly */
 }
 
-void *memo_load_select_view(ug_data_t *ugd, bundle *data)
+void *memo_load_select_view(ug_data_t *ugd, service_h service)
 {
     select_view_t *sv = SMALLOC(select_view_t);
     RETVIF(sv == NULL, NULL);
     sv->ugd = ugd;
+    sv->is_textonly = service_key_check(service, "type", "textonly");
 
     /* date update hooker */
     memo_subscribe_change(_on_data_update, sv);