add BUS_METHOD_SEND_ACTION method sending function 49/38449/2
authorSoohye Shin <soohye.shin@samsung.com>
Tue, 21 Apr 2015 02:44:07 +0000 (11:44 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Tue, 21 Apr 2015 05:11:25 +0000 (14:11 +0900)
Change-Id: Ie411b1c099968c5e48a5f924c780b2290374e38c
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
src/ClientBus.cpp
src/ClientBus.h
src/engine.cpp
src/engine/include/EngineBarItem.h
src/engine/src/EngineBarItem.cpp
src/engine/src/EngineDBarItem.cpp

index 0e43b6e..bb112b0 100644 (file)
@@ -183,6 +183,43 @@ void CClientBus::m_Send(void)
                -1, m->cancellable, sm_CbSend, this);
 }
 
+bool CClientBus::m_ActionSend(CAppContentProvider::EMethodActionType type, const char *args)
+{
+       ASSERT(m);
+
+       if (!m->proxy)
+               return false;
+
+       m->cancellable = g_cancellable_new();
+       if (!m->cancellable) {
+               _ERR("cancellable new failed");
+               return false;
+       }
+
+       GVariant *param;
+       GVariantBuilder *builder;
+
+       builder = g_variant_builder_new(G_VARIANT_TYPE_TUPLE);
+       if (!builder) {
+               _ERR("builder new failed");
+               return false;
+       }
+
+       g_variant_builder_add(builder, "s", m->svcid);
+       g_variant_builder_add(builder, "y", type);
+       g_variant_builder_add(builder, "s", args ? args : "");
+
+       param = g_variant_builder_end(builder);
+
+       g_variant_builder_unref(builder);
+
+       g_dbus_proxy_call(m->proxy, BUS_METHOD_SEND_ACTION,
+               param, G_DBUS_CALL_FLAGS_NO_AUTO_START,
+               -1, m->cancellable, sm_CbSend, this);
+
+       return true;
+}
+
 /**
 * Invoked when proxy is ready successfully.
 *
@@ -268,3 +305,10 @@ void CClientBus::SendSvcid(void)
                BUS_INTERFACE, NULL, sm_CbProxy, this);
 }
 
+
+bool CClientBus::SendAction(CAppContentProvider::EMethodActionType type, const char *args)
+{
+       ASSERT(FlagCreate());
+
+       return m_ActionSend(type, args);
+}
index 0f2637c..6d4da49 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stdbool.h>
 #include <cp_config.h>
+#include <app-content-provider.h>
 
 
 class CTimeout {
@@ -54,6 +55,7 @@ private:
        void m_OnSend(GObject *sobj, GAsyncResult *res);
 
        void m_Send(void);
+       bool m_ActionSend(CAppContentProvider::EMethodActionType type, const char *args);
 
 protected:
        virtual void t_OnTimeout(void);
@@ -71,7 +73,11 @@ public:
 
        //! Sends service id to client daemons as creating proxy to bus.
        void SendSvcid(void);
+
+       //! Sends Action to client daemons
+       bool SendAction(CAppContentProvider::EMethodActionType type, const char *args);
+
 };
 
 
-#endif /* __CLIENT_BUS_H__ */
\ No newline at end of file
+#endif /* __CLIENT_BUS_H__ */
index b30bfe0..6f96a7b 100644 (file)
@@ -334,6 +334,7 @@ bool CEngine::_load_bar_items(JsonReader *reader)
                        delete cbus;
                        continue;
                }
+               it->SetCBus(cbus);
                cbus->SendSvcid();
                m->client_buslist = eina_list_append(m->client_buslist,
                                cbus);
index 3b99481..24fb3ad 100644 (file)
@@ -20,7 +20,7 @@
 #include <app-content.h>
 
 #include "Entity.h"
-
+#include "../../ClientBus.h"
 
 class CEngineDBarItem;
 
@@ -55,6 +55,7 @@ public:
        virtual ~CEngineBarItem();
 
        void SetEngine(CEngine *eng);
+       void SetCBus(CClientBus *cbus);
 
        void SetCtntId(int id);
        int  CtntId(void);
@@ -77,7 +78,7 @@ public:
        bool RemoveDBar(int ctnt_id);
 
        bool AddHistory(CAppContent::EType type, const char *id);
-       bool DelHistory(CAppContent::EType type, const char *id);
+       bool DelHistory(const char *id);
        bool DelAllHistory(void);
 
        static CEngineBarItem *Alloc(JsonReader *reader, int idx);
index 4c39f95..49fd650 100644 (file)
 #include <glib.h>
 
 #include <app-content.h>
+#include <app-content-provider.h>
 #include <AppCommon.h>
 
 #include "../../engine.h"
+#include "../../ClientBus.h"
 #include "../include/EngineBarItem.h"
 
 
 struct SEngineBarItem {
        CEngine *eng;
+       CClientBus *cbus;
 
        int r;
        int g;
@@ -57,6 +60,14 @@ CEngineBarItem::~CEngineBarItem()
 }
 
 
+void CEngineBarItem::SetCBus(CClientBus *cbus)
+{
+       ASSERT(m);
+
+       m->cbus = cbus;
+}
+
+
 void CEngineBarItem::SetEngine(CEngine *eng)
 {
        ASSERT(m);
@@ -231,18 +242,18 @@ bool CEngineBarItem::RemoveDBar(int ctnt_id)
        return false;
 }
 
-bool CEngineBarItem::DelHistory(CAppContent::EType type, const char *id)
+bool CEngineBarItem::DelHistory(const char *id)
 {
        ASSERT(m);
 
-       return m->eng->DelHistory(type, id);
+       return m->cbus->SendAction(CAppContentProvider::METHOD_ACTION_HISTORY_DEL, id);
 }
 
 bool CEngineBarItem::DelAllHistory(void)
 {
        ASSERT(m);
 
-       return m->eng->DelAllHistory();
+       return m->cbus->SendAction(CAppContentProvider::METHOD_ACTION_HISTORY_DEL_ALL, NULL);
 }
 
 bool CEngineBarItem::AddHistory(CAppContent::EType type, const char *id)
index 79a2a50..79a248b 100644 (file)
@@ -165,7 +165,7 @@ bool CEngineDBarItem::Del(CEngineDBarItemContent::EType type)
 
                        svcid = bundle_get_val(args, "svcid");
 
-                       if (!m->parent->DelHistory(CAppContent::TYPE_CHANNEL, svcid)) {
+                       if (!m->parent->DelHistory(svcid)) {
                                _ERR("failed to delete history");
                                bundle_free(args);
                                return false;
@@ -173,7 +173,7 @@ bool CEngineDBarItem::Del(CEngineDBarItemContent::EType type)
                        bundle_free(args);
                }
                else {
-                       if (!m->parent->DelHistory(CAppContent::TYPE_APPS, Str(VSTR_ACTOR))) {
+                       if (!m->parent->DelHistory(Str(VSTR_ACTOR))) {
                                _ERR("failed to delete history");
                                return false;
                        }