using Hildon;
class IMDbDownloadDialog : Note {
- public IMDbDownloadDialog (Gtk.Window window) {
+ private bool plots;
+
+ public IMDbDownloadDialog (Gtk.Window window, bool _plots) {
transient_parent = window;
+ plots = _plots;
}
construct {
server.Progress += this.on_progress;
server.DescriptionChanged += this.on_description_changed;
- server.download (mirror, IMDbDownloader.MOVIES | IMDbDownloader.GENRES | IMDbDownloader.RATINGS | IMDbDownloader.AKAS);
+ int flags = IMDbDownloader.MOVIES | IMDbDownloader.GENRES | IMDbDownloader.RATINGS | IMDbDownloader.AKAS;
+ if (plots)
+ flags |= IMDbDownloader.PLOTS;
+
+ server.download (mirror, flags);
} catch (DBus.Error e) {
warning ("Failed to invoke IMDb downloader: %s", e.message);
}
note.destroy ();
if (response == ResponseType.OK) {
- download_imdb (window);
+ download_imdb (window, false);
}
}
(void) Config.GETTEXT_PACKAGE;
}
- private void download_imdb (Gtk.Window window) {
+ private void download_imdb (Gtk.Window window, bool plots) {
var picker = new PickerDialog (window);
var selector = new TouchSelector.text ();
string[] mirrors;
picker.destroy();
if (res == ResponseType.OK) {
- var download = new IMDbDownloadDialog (window);
+ var download = new IMDbDownloadDialog (window, plots);
download.run (server, mirror);
download.destroy ();
}
dialog.set_transient_for (window);
dialog.set_title (_("IMDb plugin settings"));
+ bool download_plots;
+ try {
+ var sqlite = new IMDbSqlite (Path.build_filename (Environment.get_user_cache_dir (),
+ "cinaest", "imdb.db", null));
+ download_plots = sqlite.has_plots ();
+ } catch (Error e) {
+ download_plots = false;
+ }
+
+ var plots = new Hildon.CheckButton (SizeType.FINGER_HEIGHT);
+ plots.set_label (_("Download and store movie plots"));
+ plots.set_active (download_plots);
+
string updated;
string filename = Path.build_filename (Environment.get_user_cache_dir(),
"cinaest", "imdb.db", null);
var download = new Hildon.Button.with_text (SizeType.FINGER_HEIGHT, ButtonArrangement.VERTICAL, _("Download"), _("Last update: ") + updated);
VBox content = (VBox) dialog.get_content_area ();
+ content.pack_start (plots, true, true, 0);
content.pack_start (download, true, true, 0);
+ // Connect signals
+ plots.toggled.connect (() => {
+ if (download_plots != plots.get_active ())
+ Hildon.Banner.show_information (window, null, _("Redownload the IMDb for this change to take effect."));
+ });
download.clicked.connect (() => {
- download_imdb (window);
+ download_imdb (window, plots.get_active ());
});
dialog.show_all ();