Remove a call to on_get_app_info() of each ISE. 92/40892/1
authorSungmin Kwak <sungmin.kwak@samsung.com>
Sat, 31 Jan 2015 05:23:46 +0000 (14:23 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Wed, 10 Jun 2015 07:24:10 +0000 (16:24 +0900)
Change-Id: Ib163cba0d58f72eabe1fdb6d0492995d2c6886c8

src/sclconnection-isf.cpp [changed mode: 0644->0755]
src/sclcorecallback.h [changed mode: 0644->0755]
src/sclcoreimpl.cpp [changed mode: 0644->0755]
src/sclcoreimpl.h [changed mode: 0644->0755]
src/sclcoreui-efl.cpp

old mode 100644 (file)
new mode 100755 (executable)
index c338a97..ed39041
@@ -17,7 +17,7 @@
 
 #include "sclconnection-isf.h"
 #include "sclcoreimpl.h"
-
+#include <isf_control.h>
 #include <Elementary.h>
 #include <dlog.h>
 
@@ -530,14 +530,17 @@ sclboolean CSCLConnectionISF::init()
 
     CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
     if (impl) {
-        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
-        if (callback) {
-            SclCoreAppInfo appinfo;
-            callback->on_get_app_info(&appinfo);
-            m_helper_info.uuid = scim::String(appinfo.uuid.c_str());
-            m_helper_info.name = scim::String(appinfo.name.c_str());
-            m_helper_info.option = scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO |
-                scim::SCIM_HELPER_NEED_SPOT_LOCATION_INFO | scim::SCIM_HELPER_AUTO_RESTART;
+        sclchar *uuid = impl->get_uuid();
+        if (uuid) {
+            sclchar *name = NULL;
+            int options = 0;
+            if (isf_control_get_ise_info(uuid, &name, NULL, NULL, &options) == 0) {
+                m_helper_info.uuid = scim::String(uuid);
+                m_helper_info.name = scim::String(name);
+                m_helper_info.option = (scluint)options;
+                if (name)
+                    free(name);
+            }
         }
     }
 
@@ -908,16 +911,17 @@ extern "C"
     bool scim_helper_module_get_helper_info (unsigned int idx, scim::HelperInfo &info) {
         CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
         if (impl) {
-            ISCLCoreEventCallback *callback = impl->get_core_event_callback();
-            if (callback) {
-                SclCoreAppInfo appinfo;
-                callback->on_get_app_info(&appinfo);
-                info.uuid = scim::String(appinfo.uuid.c_str());
-                info.name = scim::String(appinfo.name.c_str());
-                info.option = scim::SCIM_HELPER_STAND_ALONE | scim::SCIM_HELPER_NEED_SCREEN_INFO |
-                    scim::SCIM_HELPER_NEED_SPOT_LOCATION_INFO | scim::SCIM_HELPER_AUTO_RESTART;
-
-                return true;
+            sclchar *uuid = impl->get_uuid();
+            if (uuid) {
+                sclchar *name = NULL;
+                int options = 0;
+                if (isf_control_get_ise_info(uuid, &name, NULL, NULL, &options) == 0) {
+                    info.uuid = scim::String(uuid);
+                    info.name = scim::String(name);
+                    info.option = (scluint)options;
+                    if (name)
+                        free(name);
+                }
             }
         }
         return false;
@@ -926,11 +930,16 @@ extern "C"
     scim::String scim_helper_module_get_helper_language (unsigned int idx) {
         CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
         if (impl) {
-            ISCLCoreEventCallback *callback = impl->get_core_event_callback();
-            if (callback) {
-                SclCoreAppInfo appinfo;
-                callback->on_get_app_info(&appinfo);
-                return scim::String(appinfo.language.c_str());
+            sclchar *uuid = impl->get_uuid();
+            if (uuid) {
+                sclchar *language = NULL;
+                if (isf_control_get_ise_info(uuid, NULL, &language, NULL, NULL) == 0) {
+                    if (language) {
+                        scim::String lang = scim::String(language);
+                        free(language);
+                        return lang;
+                    }
+                }
             }
         }
         return scim::String("");
@@ -940,7 +949,7 @@ extern "C"
         _scim_config = config;
         CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
         if (impl) {
-            impl->on_run(display.c_str());
+            impl->on_run(uuid.c_str(), display.c_str());
         }
     }
 }
old mode 100644 (file)
new mode 100755 (executable)
index 135b608..132bea9
@@ -41,8 +41,6 @@ typedef struct {
 } SclCoreAppInfo;
 
 struct ISCLCoreEventCallback {
-    virtual void on_get_app_info(SclCoreAppInfo *info) {}
-
     virtual void on_init() {}
     virtual void on_run(int argc, char **argv) {}
     virtual void on_exit() {}
old mode 100644 (file)
new mode 100755 (executable)
index 26c24ca..259ea1f
@@ -23,6 +23,7 @@ CSCLCoreImpl::CSCLCoreImpl()
 {
     m_event_callback = NULL;
     m_display = NULL;
+    m_uuid = NULL;
 }
 
 CSCLCoreImpl::~CSCLCoreImpl()
@@ -31,6 +32,10 @@ CSCLCoreImpl::~CSCLCoreImpl()
         free(m_display);
         m_display = NULL;
     }
+    if (m_uuid) {
+        free(m_uuid);
+        m_uuid = NULL;
+    }
 }
 
 CSCLCoreImpl*
@@ -85,6 +90,11 @@ CSCLConnection* CSCLCoreImpl::get_connection()
     return &m_connection;
 }
 
+sclchar* CSCLCoreImpl::get_uuid()
+{
+    return m_uuid;
+}
+
 void CSCLCoreImpl::config_reload()
 {
     m_connection.config_reload();
@@ -230,11 +240,17 @@ void CSCLCoreImpl::get_keyboard_ise(const sclchar *uuid)
     m_connection.get_keyboard_ise(uuid);
 }
 
-void CSCLCoreImpl::on_run(const sclchar *display)
+void CSCLCoreImpl::on_run(const sclchar *uuid, const sclchar *display)
 {
     m_core_ui.init();
     m_connection.init();
 
+    if (m_uuid) {
+        free (m_uuid);
+    }
+
+    m_uuid = strdup(uuid);
+
     if (m_display) {
         free (m_display);
     }
@@ -242,7 +258,7 @@ void CSCLCoreImpl::on_run(const sclchar *display)
     m_display = strdup(display);
 
     if (m_event_callback) {
-        m_event_callback->on_run(1, NULL);
+        m_event_callback->on_run(0, NULL);
     }
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 448f6e2..7f4e61c
@@ -42,7 +42,7 @@ public:
     void init(const sclchar *display);
     void fini();
 
-    void on_run(const sclchar *display);
+    void on_run(const sclchar *uuid, const sclchar *display);
     void run();
 
     void set_core_event_callback(ISCLCoreEventCallback *callback);
@@ -50,6 +50,7 @@ public:
 
     CSCLCoreUI* get_core_ui();
     CSCLConnection* get_connection();
+    sclchar* get_uuid();
 
     void config_reload();
     sclboolean config_read_int(const sclchar *name, sclint &value);
@@ -101,6 +102,7 @@ private:
 
     CSCLConnection m_connection;
     CSCLCoreUI m_core_ui;
+    sclchar *m_uuid;
 };
 
 }
index 4a678b3..4a31eb6 100755 (executable)
@@ -17,7 +17,7 @@
 
 #include "sclcoreui-efl.h"
 #include "sclcoreimpl.h"
-
+#include <isf_control.h>
 #include <Elementary.h>
 #include <dlog.h>
 
@@ -267,11 +267,14 @@ void CSCLCoreUIEFL::run(const sclchar *display)
     std::string name;
     CSCLCoreImpl *impl = CSCLCoreImpl::get_instance();
     if (impl) {
-        ISCLCoreEventCallback *callback = impl->get_core_event_callback();
-        if (callback) {
-            SclCoreAppInfo appinfo;
-            callback->on_get_app_info(&appinfo);
-            name = appinfo.name;
+        sclchar *uuid = impl->get_uuid();
+        if (uuid) {
+            sclchar *label = NULL;
+            if (isf_control_get_ise_info(uuid, &label, NULL, NULL, NULL) == 0) {
+                name = std::string(label);
+                if (label)
+                    free(label);
+            }
         }
 
         argv [0] = const_cast<char *> (name.c_str());