Make all emit signals synchronous by default. 07/82607/1
authorDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 4 Aug 2016 11:06:20 +0000 (14:06 +0300)
committerDenis Dolzhenko <d.dolzhenko@samsung.com>
Thu, 4 Aug 2016 11:06:20 +0000 (14:06 +0300)
Change-Id: I89a6ee50f9867deff98f147dd38daafcee04972f
Signed-off-by: Denis Dolzhenko <d.dolzhenko@samsung.com>
src/Common/View/inc/View.h
src/Common/View/src/NaviFrameItem.cpp
src/Common/View/src/View.cpp
src/Conversation/Body/View/src/ImagePageViewItem.cpp
src/Conversation/Body/View/src/PageView.cpp
src/Conversation/ConvList/View/src/ConvListViewItem.cpp
src/Conversation/Main/View/src/ConversationLayout.cpp
src/Conversation/Recipients/View/src/ConvRecipientsPanelView.cpp
src/MsgThread/View/src/MsgThreadSearchPanel.cpp
src/Settings/View/src/SettingsListViewItem.cpp

index 24a8df2..56625e8 100644 (file)
@@ -192,8 +192,29 @@ namespace Msg
              * @brief Sends a signal to edje-object.
              * @param[in] emission The signal's name.
              * @param[in] source The signal's source.
+             * @param[in] async true - process an object's message queue in job/timer, false - process immediately.
              */
-            void emitSignal(const char *emission, const char *source);
+            void emitSignal(const char *emission, const char *source, bool async = false);
+
+            /**
+             * @brief Sends a signal to edje-object.
+             * @param[in] obj Target object
+             * @param[in] emission The signal's name.
+             * @param[in] source The signal's source.
+             * @param[in] async true - process the signal postponed, false - process immediately.
+             */
+            static void emitSignal(Evas_Object *obj, const char *emission, const char *source, bool async = false);
+
+            /**
+             * @brief Process all edje signals for object
+             * @param[in] obj Target object
+             */
+            static void processSignal(Evas_Object *obj);
+
+            /**
+             * @brief Process all edje signals for object
+             */
+            void processSignal();
 
             /**
              * @brief Sets user-data associated with specified key-string.
@@ -399,9 +420,14 @@ namespace Msg
         elm_object_domain_part_text_translatable_set(m_pEo, part, domain, translatable);
     }
 
-    inline void View::emitSignal(const char *emission, const char *source)
+    inline void View::emitSignal(const char *emission, const char *source, bool async)
+    {
+        emitSignal(m_pEo, emission, source, async);
+    }
+
+    inline void View::processSignal()
     {
-        elm_object_signal_emit(m_pEo, emission, source);
+        processSignal(m_pEo);
     }
 
     inline void View::setText(const char *text, const char *part)
index e61a8a0..4612721 100644 (file)
@@ -323,11 +323,11 @@ void NaviFrameItem::NaviBar::setButtonColor(NaviButtonId id, NaviColorId titleCo
         switch(titleColor)
         {
             case NaviBlueColorId:
-                elm_object_signal_emit(m_ButtonList[id].button, "button,color,white", "*");
+                emitSignal(m_ButtonList[id].button, "button,color,white", "*");
                 break;
 
             case NaviWhiteColorId:
-                elm_object_signal_emit(m_ButtonList[id].button, "button,color,blue", "*");
+                emitSignal(m_ButtonList[id].button, "button,color,blue", "*");
                 break;
 
             default:
@@ -400,5 +400,5 @@ void NaviFrameItem::NaviBar::hideSearch()
 void NaviFrameItem::NaviBar::setDownButtonState(bool expand)
 {
     const char *sig = expand ? "button,expand" : "button,collapse";
-    elm_object_signal_emit(m_ButtonList[NaviExpandButtonId].button, sig, "*");
+    emitSignal(m_ButtonList[NaviExpandButtonId].button, sig, "*");
 }
index db00d4b..b984fca 100644 (file)
@@ -124,6 +124,19 @@ void View::expand(Evas_Object *obj)
     evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
 }
 
+void View::processSignal(Evas_Object *obj)
+{
+    Evas_Object *edj = elm_layout_edje_get(obj);
+    edje_object_message_signal_process(edj);
+}
+
+void View::emitSignal(Evas_Object *obj, const char *emission, const char *source, bool async)
+{
+    elm_object_signal_emit(obj, emission, source);
+    if(!async)
+        processSignal(obj);
+}
+
 Evas_Object *View::addLayout(Evas_Object *parent, const std::string &edjePath, const std::string &group)
 {
     Evas_Object *layout = elm_layout_add(parent);
index d044b31..73f073a 100644 (file)
@@ -58,7 +58,7 @@ ImagePageViewItem::~ImagePageViewItem()
 
 void ImagePageViewItem::showPlayIcon()
 {
-    elm_object_signal_emit(m_pImageLayout, showPlayIconSig, "");
+    emitSignal(m_pImageLayout, showPlayIconSig, "");
 }
 
 const std::string &ImagePageViewItem::getImagePath() const
@@ -79,7 +79,7 @@ bool ImagePageViewItem::isEmpty() const
 void ImagePageViewItem::highlight(bool value)
 {
     const char *sig = value ? "focused" : "unfocused";
-    elm_object_signal_emit(m_pImageLayout, sig, "*");
+    emitSignal(m_pImageLayout, sig, "*");
 }
 
 std::string ImagePageViewItem::getFileName() const
@@ -152,7 +152,7 @@ Evas_Object *ImagePageViewItem::createImage(Evas_Object *parent)
         iconHeight = (int)ELM_SCALE_SIZE(thumbEqual);
         sig = mediaImageEqualSig;
     }
-    elm_object_signal_emit(getMediaLayout(), sig, "*");
+    emitSignal(getMediaLayout(), sig, "*");
 
     // Create and load icon image:
     Evas_Object *icon = elm_icon_add(parent);
index 7119f8a..f4addfd 100644 (file)
@@ -183,7 +183,7 @@ Evas_Object *PageView::createMainLayout(Evas_Object *parent)
 {
     Evas_Object *layout = elm_layout_add(parent);
     elm_layout_file_set(layout, getEdjPath().c_str(), itemLayoutGroup);
-    elm_object_signal_emit(layout, "show.normal.mode", "*");
+    emitSignal(layout, "show.normal.mode", "*");
     expand(layout);
     evas_object_show(layout);
     return layout;
index 6e26bea..289601d 100644 (file)
@@ -102,7 +102,7 @@ Evas_Object *ConvListViewItem::createButton(bool isEnabled, ConvItemType type)
         [](void *data, Evas *e, Evas_Object *obj, void *event_info)
         {
             if(!elm_object_disabled_get(obj))
-                elm_object_signal_emit(elm_object_content_get(obj), "pressed", "*");
+                View::emitSignal(elm_object_content_get(obj), "pressed", "*");
         },
         this
     );
@@ -113,14 +113,13 @@ Evas_Object *ConvListViewItem::createButton(bool isEnabled, ConvItemType type)
         [](void *data, Evas *e, Evas_Object *obj, void *event_info)
         {
             if(!elm_object_disabled_get(obj))
-                elm_object_signal_emit(elm_object_content_get(obj), "unpressed", "*");
+                View::emitSignal(elm_object_content_get(obj), "unpressed", "*");
         },
         this
     );
 
     elm_object_style_set(button, "transparent");
     Evas_Object *icon =  nullptr;
-    evas_object_show(icon);
 
     if(type == Draft)
     {
index 1ec40c6..7691d38 100644 (file)
@@ -34,7 +34,7 @@ ConversationLayout::~ConversationLayout()
 void ConversationLayout::showContactList(bool value)
 {
     const char *sig = value ? "show.predictsearch" : "hide.predictsearch";
-    elm_object_signal_emit(m_pLayout, sig, "*");
+    emitSignal(m_pLayout, sig, "*");
 }
 
 void ConversationLayout::setRecipientRect(Evas_Object *layout)
index fd3e5c4..8f6d53b 100644 (file)
@@ -125,7 +125,7 @@ void ConvRecipientsPanelView::showMbe(bool show, bool animation)
     else
         sig = show ? "show_to_mbe" : "hide_to_mbe";
 
-    elm_object_signal_emit(m_pLayout, sig, "*");
+    emitSignal(m_pLayout, sig, "*");
 }
 
 void ConvRecipientsPanelView::showEntry(bool show)
@@ -133,7 +133,7 @@ void ConvRecipientsPanelView::showEntry(bool show)
     if(show)
         getEntry();
     const char *sig = show ? "show_entry" : "hide_entry";
-    elm_object_signal_emit(m_pLayout, sig, "*");
+    emitSignal(m_pLayout, sig, "*");
     show ? evas_object_show(m_pEntry) : evas_object_hide(m_pEntry);
 }
 
@@ -192,7 +192,7 @@ Evas_Object *ConvRecipientsPanelView::getEntry()
     evas_object_show(m_pEntry);
     evas_object_size_hint_weight_set(m_pEntry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_size_hint_align_set(m_pEntry, EVAS_HINT_FILL, EVAS_HINT_FILL);
-    elm_object_signal_emit(m_pEntry, "elm,action,hide,search_icon", "");
+    emitSignal(m_pEntry, "elm,action,hide,search_icon", "");
     elm_entry_editable_set(m_pEntry, EINA_TRUE);
     elm_entry_single_line_set(m_pEntry, EINA_TRUE);
     elm_entry_scrollable_set(m_pEntry, EINA_TRUE);
@@ -400,7 +400,7 @@ void ConvRecipientsPanelView::setEditMode(bool isEdit)
 void ConvRecipientsPanelView::showInvalidIcon(bool show)
 {
     const char *sig = show ? "show_invalid_icon" : "hide_invalid_icon";
-    elm_object_signal_emit(m_pLayout, sig, "*");
+    emitSignal(m_pLayout, sig, "*");
 }
 
 void ConvRecipientsPanelView::onEntryChanged(Evas_Object *obj, void *event_info)
index 2daf876..6d75644 100644 (file)
@@ -143,7 +143,7 @@ void MsgThreadSearchPanel::clearEntry()
 void MsgThreadSearchPanel::showClearButton(bool visible)
 {
     const char *sig = visible ? "elm,action,show,button" : "elm,action,hide,button";
-    elm_object_signal_emit(getEo(), sig, "");
+    emitSignal(sig, "");
 }
 
 void MsgThreadSearchPanel::setGuideText(const std::string &text)
index 955ddd2..46de975 100644 (file)
@@ -132,6 +132,7 @@ Evas_Object *SettingsListViewItem::createCheckButton(Evas_Object *parent)
         elm_check_state_pointer_set(check, &m_CheckButtonState);
         evas_object_propagate_events_set(check, EINA_FALSE);
         evas_object_smart_callback_add(check, "changed", SMART_CALLBACK(SettingsListViewItem, onCheckButtonChanged), this);
+        View::processSignal(check);
     }
     return check;
 }