Add orientation change support
authorph5 <ph5@monster.localdomain>
Fri, 1 Jan 2010 23:23:51 +0000 (00:23 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Sat, 2 Jan 2010 23:23:27 +0000 (00:23 +0100)
src/main.vala

index b681fc2..0b9f0eb 100644 (file)
@@ -21,6 +21,7 @@ using Hildon;
 public class CinaestProgram : Hildon.Program {
        SourceListWindow window;
        public static List<Plugin> plugins;
+       private Orientation orientation;
 
        construct {
                Environment.set_application_name ("Cinæst");
@@ -28,9 +29,20 @@ public class CinaestProgram : Hildon.Program {
                window = new SourceListWindow ();
                window.destroy.connect (Gtk.main_quit);
 
+               orientation = new Orientation ();
+               orientation.changed.connect (on_orientation_changed);
+
                add_window (window);
        }
 
+       private void on_orientation_changed () {
+               if (orientation.portrait) {
+                       Hildon.gtk_window_set_portrait_flags (window, PortraitFlags.REQUEST);
+               } else {
+                       Hildon.gtk_window_set_portrait_flags (window, PortraitFlags.SUPPORT);
+               }
+       }
+
        public void register_plugins (Osso.Context context) {
                string plugin_path = Config.PKGLIBDIR;
                try {