~kyrofa/junk/pay-service-2

« back to all changes in this revision

Viewing changes to service/purchase-ual.cpp

  • Committer: CI bot
  • Author(s): Ted Gould
  • Date: 2014-06-18 18:47:04 UTC
  • mfrom: (8.1.10 devel)
  • Revision ID: ps-jenkins@lists.canonical.com-20140618184704-roe2dx6dwvvw37km
Fixes from integration work to make the pay demo come together. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    typedef std::shared_ptr<Item> Ptr;
32
32
 
33
33
    UalItem (std::string& in_appid, std::string& in_itemid) :
34
 
        appid(in_appid), itemid(in_itemid), loop(nullptr), status(Item::ERROR)
 
34
        appid(in_appid),
 
35
        itemid(in_itemid),
 
36
        loop(nullptr),
 
37
        status(Item::ERROR)
35
38
    {
36
39
        /* TODO: ui_appid needs to be grabbed from the click hook */
37
 
        ui_appid = "gedit";
 
40
        gchar* appidc = ubuntu_app_launch_triplet_to_app_id("com.canonical.payui",
 
41
                                                            nullptr,
 
42
                                                            nullptr);
 
43
        if (appidc != nullptr)
 
44
        {
 
45
            ui_appid = appidc;
 
46
            g_free(appidc);
 
47
        }
38
48
    }
39
49
 
40
50
    ~UalItem ()
79
89
            /* Building a URL so that we can pass this information today without
80
90
               using trusted helpers and setting environment vars */
81
91
            /* TODO: Use trusted helpers */
82
 
            std::string purchase_url = "purchase:///";
83
 
            purchase_url += appid;
84
 
            purchase_url += "/";
 
92
            std::string purchase_url = "purchase://";
 
93
 
 
94
            if (appid != "click-scope")
 
95
            {
 
96
                purchase_url += appid;
 
97
                purchase_url += "/";
 
98
            }
 
99
 
85
100
            purchase_url += itemid;
86
101
            const gchar* urls[2] = {0};
87
102
            urls[0] = purchase_url.c_str();