blob: cb9071bd0f04dca503bf3005ad5c3ef1c38b8c6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
const Endless = imports.gi.Endless;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Lang = imports.lang;
// Local libraries
const CategoryModel = imports.wikipedia.models.category_model;
const Utils = imports.wikipedia.utils;
const DomainWikiModel = new Lang.Class({
Name: "DomainWikiModel",
Extends: GObject.Object,
//params should have the image-uri for the app's image, and the application name.
_init: function(params) {
this.parent(params);
},
setLinkedArticles:function(articles){
this._linked_articles = articles;
},
getLinkedArticles:function(){
return this._linked_articles;
},
//categories should be a list of category models, already populated with article models.
addCategories: function(categories){
this._categories = categories;
},
getArticlesForCategoryIndex: function(index){
let category = this.getCategories()[index];
return category.getArticles();
},
getCategories: function() {
return this._categories;
}
});
|