~unity-team/go-unityscopes/v2

« back to all changes in this revision

Viewing changes to tests/goscope/goscope.go

  • Committer: Xavi Garcia
  • Date: 2015-03-20 11:04:15 UTC
  • mfrom: (55.1.2 v1)
  • Revision ID: xavi.garcia.mena@canonical.com-20150320110415-i9x21a8nzmlwh73o
MergedĀ lp:~xavi-garcia-mena/go-unityscopes/version-check

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
        layout3col := scopes.NewColumnLayout(3)
33
33
 
34
34
        // Single column layout
35
 
        layout1col.AddColumn([]string{"image", "header", "summary", "actions"})
 
35
        layout1col.AddColumn("image", "header", "summary", "actions")
36
36
 
37
37
        // Two column layout
38
 
        layout2col.AddColumn([]string{"image"})
39
 
        layout2col.AddColumn([]string{"header", "summary", "actions"})
 
38
        layout2col.AddColumn("image")
 
39
        layout2col.AddColumn("header", "summary", "actions")
40
40
 
41
41
        // Three cokumn layout
42
 
        layout3col.AddColumn([]string{"image"})
43
 
        layout3col.AddColumn([]string{"header", "summary", "actions"})
44
 
        layout3col.AddColumn([]string{})
 
42
        layout3col.AddColumn("image")
 
43
        layout3col.AddColumn("header", "summary", "actions")
 
44
        layout3col.AddColumn()
45
45
 
46
46
        // Register the layouts we just created
47
 
        reply.RegisterLayout([]*scopes.ColumnLayout{layout1col, layout2col, layout3col})
 
47
        reply.RegisterLayout(layout1col, layout2col, layout3col)
48
48
 
49
49
        header := scopes.NewPreviewWidget("header", "header")
50
50
 
210
210
 
211
211
        return department
212
212
}
213
 
        
214
 
func (s *MyScope) PerformAction(result *scopes.Result, metadata *scopes.ActionMetadata, widgetId, actionId string) (*scopes.ActivationResponse, error) {
215
 
        
216
 
        if (widgetId == "actions" && actionId == "hide")
217
 
    {
218
 
        return ActivationQueryBase::UPtr(new MyActivation(result, meta));
219
 
    }
220
 
    else if (widget_id == "actions" && action_id == "download")
221
 
    {
222
 
        MyActivation* response = new MyActivation(result, meta, ActivationResponse::ShowPreview);
223
 
        response->setExtraData(meta.scope_data());
224
 
        return ActivationQueryBase::UPtr(response);
225
 
    }
226
 
    return ActivationQueryBase::UPtr(new MyActivation(result, meta, ActivationResponse::NotHandled));
227
 
}
228
213
 
229
214
// MAIN ************************************************************************
230
215