Google plugin: report D-Bus errors
authorPhilipp Zabel <philipp.zabel@gmail.com>
Thu, 8 Jul 2010 19:47:32 +0000 (21:47 +0200)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Wed, 14 Jul 2010 21:34:09 +0000 (23:34 +0200)
src/plugins/google-plugin.vala

index abc0ef3..600c407 100644 (file)
@@ -210,21 +210,27 @@ class GoogleSource : MovieSource {
 
        SourceFunc get_movies_callback;
        public override async int get_movies (MovieFilter filter, MovieSource.ReceiveMovieFunction _callback, int limit, Cancellable? cancellable) {
-               var conn = DBus.Bus.get (DBus.BusType.SESSION);
-               string search_path;
-
-               dynamic DBus.Object server = conn.get_object ("org.maemo.cinaest.GoogleShowtimes",
-                                                             "/org/maemo/cinaest/googleshowtimes",
-                                                             "org.maemo.cinaest.MovieService");
-               server.NewSearch (out search_path);
-
-               search = conn.get_object ("org.maemo.cinaest.GoogleShowtimes",
-                                         search_path,
-                                         "org.maemo.cinaest.MovieSearch");
-
-               callback = _callback;
-               search.MoviesFound += on_movies_found;
-               search.start (filter.title);
+               try {
+                       string search_path;
+                       dynamic DBus.Object server;
+                       var conn = DBus.Bus.get (DBus.BusType.SESSION);
+
+                       server = conn.get_object ("org.maemo.cinaest.GoogleShowtimes",
+                                                 "/org/maemo/cinaest/googleshowtimes",
+                                                 "org.maemo.cinaest.MovieService");
+                       server.NewSearch (out search_path);
+
+                       search = conn.get_object ("org.maemo.cinaest.GoogleShowtimes",
+                                                 search_path,
+                                                 "org.maemo.cinaest.MovieSearch");
+
+                       callback = _callback;
+                       search.MoviesFound.connect (on_movies_found);
+                       search.start (filter.title);
+               } catch (Error e1) {
+                       Banner.show_information (null, null, e1.message);
+                       return 0;
+               }
 
                get_movies_callback = get_movies.callback;
                if (cancellable != null)