IMDb & MoviePilot plugins: fix settings dialog layout
[cinaest] / src / plugins / imdb-plugin.vala
index 64d8bb3..e5b7976 100644 (file)
@@ -155,6 +155,30 @@ class IMDbPlugin : Plugin {
                content.pack_start (plots, true, true, 0);
                content.pack_start (download, true, true, 0);
 
+                var sizegroup = new Gtk.SizeGroup (SizeGroupMode.HORIZONTAL);
+
+               // User name
+               var hbox = new Gtk.HBox (false, MARGIN_DOUBLE);
+               var label = new Gtk.Label (_("User name"));
+               label.set_alignment (0, 0.5f);
+               sizegroup.add_widget (label);
+               var entry = new Hildon.Entry (SizeType.FINGER_HEIGHT);
+               hbox.pack_start (label, false, false, 0);
+               hbox.pack_start (entry, true, true, 0);
+               content.pack_start (hbox, true, true, 0);
+
+               // Password
+               hbox = new Gtk.HBox (false, MARGIN_DOUBLE);
+               label = new Gtk.Label ("Password");
+               label.set_alignment (0, 0.5f);
+               sizegroup.add_widget (label);
+               entry = new Hildon.Entry (SizeType.FINGER_HEIGHT);
+               hbox.pack_start (label, false, false, 0);
+               hbox.pack_start (entry, true, true, 0);
+               content.pack_start (hbox, true, true, 0);
+
+               dialog.add_button (_("Save"), ResponseType.ACCEPT);
+
                // Connect signals
                plots.toggled.connect (() => {
                        if (download_plots != plots.get_active ())
@@ -184,6 +208,9 @@ class IMDbMovie : Movie {
 }
 
 class IMDBSource : MovieSource {
+       SList<Movie> result;
+       int results_waiting;
+
        public override bool active { get; set construct; }
 
        public IMDBSource () {
@@ -196,7 +223,12 @@ class IMDBSource : MovieSource {
                                             "cinaest", "imdb.db", null));
 
                _get_callback = callback;
+               result = new SList<Movie> ();
+               results_waiting = 0;
                int n = yield sqlite.query (filter, receive_movie, limit, cancellable);
+               if (results_waiting > 0)
+                       _get_callback (result);
+               result = new SList<Movie> ();
                return n;
        }
 
@@ -212,7 +244,12 @@ class IMDBSource : MovieSource {
                } else {
                        movie.secondary = movie.genres.to_string ();
                }
-               _get_callback (movie);
+               result.append (movie);
+               if (++results_waiting >= 10) {
+                       _get_callback (result);
+                       result = new SList<Movie> ();
+                       results_waiting = 0;
+               }
        }
 
        public override void add_movie (Movie movie) {
@@ -229,8 +266,8 @@ class IMDBSource : MovieSource {
                return _("Movies on IMDb");
        }
 
-       public override bool get_editable () {
-               return false;
+       public override SourceFlags get_flags () {
+               return 0;
        }
 }