/
Settings.vala
62 lines (52 loc) · 1.96 KB
/
Settings.vala
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Copyright (c) 2011-2016 Felipe Escoto (https://github.com/Philip-Scott/Notes-up)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Authored by: Felipe Escoto <felescoto95@hotmail.com>
*/
public class Spice.Services.Settings : Granite.Services.Settings {
private static Settings? instance = null;
public int pos_x { get; set; }
public int pos_y { get; set; }
public int window_width { get; set; }
public int window_height { get; set; }
public string last_fetch { get; set; }
public string[] last_files { get; set; }
public string controler_config { get; set; }
public static Settings get_instance () {
if (instance == null) {
instance = new Settings ();
}
return instance;
}
private Settings () {
base ("com.github.philip-scott.spice-up");
}
public void add_file (string file) {
var current_files = last_files;
Gee.List<string> existing_files = new Gee.ArrayList<string> ();
existing_files.add_all_array (current_files);
if (file in current_files) {
existing_files.remove (file);
}
existing_files.insert (0, file);
if (existing_files.size > 50) {
existing_files = existing_files.slice (0, 10);
}
last_files = existing_files.to_array ();
}
}