+ private void on_orientation_changed (Gdk.Screen screen) {
+ if (CinaestProgram.orientation.portrait == portrait_mode)
+ return;
+
+ portrait_mode = CinaestProgram.orientation.portrait;
+
+ // Reduced padding in portrait mode to fit 3 posters in width
+ int padding = portrait_mode ? MARGIN_DEFAULT : MARGIN_DOUBLE;
+ alignment.left_padding = padding;
+
+ // Make space for the pannable area's scroll position indicator
+ if (count > movies_per_screen ())
+ padding -= MARGIN_DEFAULT;
+ alignment.right_padding = padding;
+ }
+
+ private void on_search_finished (int movies) {
+ int padding = portrait_mode ? MARGIN_DEFAULT : MARGIN_DOUBLE;
+
+ // Make space for the pannable area's scroll position indicator
+ if (count > movies_per_screen ())
+ padding -= MARGIN_DEFAULT;
+ alignment.right_padding = padding;
+
+ if (count == 1 && auto_open_movie_window) {
+ TreeIter iter;
+ if (store.get_iter_first (out iter)) {
+ Movie movie;
+ store.get (iter, MovieListStore.Columns.MOVIE, out movie);
+ on_movie_activated (movie);
+ }
+ }
+ }
+
+ private int movies_per_screen () {
+ if (portrait_mode) {
+ // 3x3 full posters or 10 full list items,
+ // 10 full list items in list mode without search bar
+ return (search_bar_visible || movie_list.poster_mode) ? 9 : 10;
+ } else {
+ if (search_bar_visible) {
+ // 5x1 full posters or 5 list items
+ return 5;
+ } else {
+ // 5x2 posters or 6 list items
+ return movie_list.poster_mode ? 10 : 6;
+ }
+ }
+ }
+