7
by Johann Prieur
Added an empty Service class to interface the People D-Bus service |
1 |
/* service.vala
|
2 |
*
|
|
3 |
* Copyright (C) 2008 Johann Prieur <johann.prieur@gmail.com>
|
|
4 |
*
|
|
5 |
* This library is free software; you can redistribute it and/or
|
|
6 |
* modify it under the terms of the GNU Lesser General Public
|
|
7 |
* License as published by the Free Software Foundation; either
|
|
8 |
* version 2.1 of the License, or (at your option) any later version.
|
|
9 |
*
|
|
10 |
* This library is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 |
* Lesser General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU Lesser General Public
|
|
16 |
* License along with this library; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
||
21 |
||
22 |
namespace People { |
|
23 |
||
24 |
internal static const string BUS_NAME = "net.launchpad.People"; |
|
8
by Johann Prieur
Added an AddressBook class and implemented Service.request_address_book |
25 |
internal static const string OBJECT_PATH = "net/launchpad/People"; |
7
by Johann Prieur
Added an empty Service class to interface the People D-Bus service |
26 |
|
27 |
public class Service : DBusObject { |
|
28 |
public Service (DBus.Connection? connection = null) { |
|
29 |
if (connection == null) |
|
30 |
this.connection = DBus.Bus.get (DBus.BusType.SESSION); |
|
31 |
else
|
|
32 |
this.connection = connection; |
|
33 |
||
8
by Johann Prieur
Added an AddressBook class and implemented Service.request_address_book |
34 |
this.object = this.connection.get_object (BUS_NAME, OBJECT_PATH); |
35 |
}
|
|
36 |
||
37 |
public AddressBook request_address_book (string address_book_id) { |
|
38 |
string bus_name, object_path; |
|
39 |
||
40 |
try { |
|
41 |
this.object.RequestAddressBook (address_book_id, out bus_name, out object_path); |
|
42 |
} catch (Error e) { |
|
43 |
warning (e.message); |
|
44 |
}
|
|
45 |
||
46 |
return new AddressBook (connection, bus_name, object_path); |
|
7
by Johann Prieur
Added an empty Service class to interface the People D-Bus service |
47 |
}
|
48 |
}
|
|
49 |
||
50 |
}
|