blob: 4b13a85dc3c0565c3d68a933d3cd52fe55a75738 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/*
* Copyright (C) 2011 Alexander Larsson <alexl@redhat.com>
*
* 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, see <http://www.gnu.org/licenses/>.
*/
using Gee;
using Gtk;
using Folks;
[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-setup-window.ui")]
public class Contacts.SetupWindow : Gtk.ApplicationWindow {
[GtkChild]
private Grid content;
[GtkChild]
private Button setup_done_button;
private AccountsList setup_accounts_list;
/**
* Fired after the user has succesfully performed the setup proess.
*/
public signal void setup_done (Edsf.PersonaStore selected_address_book);
public SetupWindow (App app, Store store) {
Object (application: app);
this.setup_accounts_list = new AccountsList (store);
this.setup_accounts_list.hexpand = true;
this.setup_accounts_list.halign = Align.CENTER;
this.setup_accounts_list.show ();
this.content.add (this.setup_accounts_list);
// Listen for changes
store.eds_persona_store_changed.connect ( () => {
this.setup_accounts_list.update_contents (false);
});
ulong id2 = 0;
id2 = this.setup_accounts_list.account_selected.connect (() => {
this.setup_done_button.set_sensitive (true);
this.setup_accounts_list.disconnect (id2);
});
fill_accounts_list (store);
this.setup_done_button.clicked.connect (() => {
var selected_store = this.setup_accounts_list.selected_store as Edsf.PersonaStore;
setup_done (selected_store);
});
}
private void fill_accounts_list (Store store) {
if (store.is_prepared) {
this.setup_accounts_list.update_contents (false);
return;
}
store.prepared.connect ( () => {
this.setup_accounts_list.update_contents (false);
});
}
}
|