3 * Copyright © 2009 Thomas Perl <thp@thpinfo.com>
9 [DBus (name
="org.maemo.garage.feedhandler")]
10 public class FeedHandler
: GLib
.Object
{
11 private MainLoop loop
;
13 public FeedHandler(MainLoop loop
) {
17 [DBus (name
= "mime_open")]
18 public void mime_open(string url
) {
19 Gtk
.Dialog dlg
= new Gtk
.Dialog();
20 dlg
.add_button("Subscribe", Gtk
.ResponseType
.YES
);
21 dlg
.add_button("Cancel", Gtk
.ResponseType
.CLOSE
);
22 dlg
.title
= "feedhandler received a URL";
23 dlg
.vbox
.add(new Gtk
.Label(url
));
27 message("URL received: %s", url
);
32 static int main(string [] args
) {
33 MainLoop loop
= new
MainLoop(null, false);
36 var conn
= DBus
.Bus
.get(DBus
.BusType
.SESSION
);
37 dynamic DBus
.Object bus
= conn
.get_object("org.freedesktop.DBus",
38 "/org/freedesktop/DBus",
39 "org.freedesktop.DBus");
40 uint request_name_result
= bus
.RequestName(
41 "org.maemo.garage.feedhandler", (uint)0);
42 if (request_name_result
== DBus
.RequestNameReply
.PRIMARY_OWNER
) {
43 FeedHandler server
= new
FeedHandler(loop
);
44 conn
.register_object("/org/maemo/garage/feedhandler", server
);
50 stderr
.printf("OOps: %s\n", e
.message
);