Implemented the concept of 'profile'
authorEnrico Zini <enrico@enricozini.org>
Wed, 6 Jan 2010 11:41:31 +0000 (12:41 +0100)
committerEnrico Zini <enrico@enricozini.org>
Wed, 6 Jan 2010 11:41:31 +0000 (12:41 +0100)
src/app.vala
src/app_keyboard.vala
src/app_wm.vala
src/config.vala

index 24a94c2839a204d4e87e44dcceed20b231865add..139151ce4bb731a001eba182a52f9b143bcfcc68 100644 (file)
@@ -148,7 +148,14 @@ public class Zavai : Gtk.Window, zavai.Resource
     {
         set_size_request(300, 500);
         //fullscreen();
     {
         set_size_request(300, 500);
         //fullscreen();
-        show_all();
+        if (zavai.config.profile == "laptop")
+        {
+            visibility = false;
+            zavai.app.ensure_hidden();
+            zavai.ui.wm.raise_icon.update_icon();
+        } else {
+            show_all();
+        }
     }
 
     public void run_script(string command)
     }
 
     public void run_script(string command)
index 7d38b7887de5ac0fee82b2301dbdbc865f655cf5..c70b16f7f7ce814d450ecdb5b65243f648dad854 100644 (file)
@@ -153,9 +153,12 @@ KeyboardIcon icon;
 
 public void init()
 {
 
 public void init()
 {
-    keyboard = new Keyboard();
-    icon = new KeyboardIcon();
-    icon.set_visible(true);
+    if (zavai.config.profile != "laptop")
+    {
+        keyboard = new Keyboard();
+        icon = new KeyboardIcon();
+        icon.set_visible(true);
+    }
 }
 
 }
 }
 
 }
index c24567d9041694cde8db47a2da9c192f493081ff..04120f4352dc8b82a3ea5f70e7432f2c6f8b65c9 100644 (file)
@@ -286,19 +286,22 @@ public class AppShortcut : Object
     }
 }
 
     }
 }
 
-RaiseIcon raise_icon;
-CloseOrBack close_or_back;
-WindowList window_list;
-Launcher launcher;
-AppShortcut app_shortcut;
+public RaiseIcon raise_icon;
+public CloseOrBack close_or_back;
+public WindowList window_list;
+public Launcher launcher;
+public AppShortcut app_shortcut;
 
 public void init()
 {
     raise_icon = new RaiseIcon();
     raise_icon.set_visible(true);
 
 
 public void init()
 {
     raise_icon = new RaiseIcon();
     raise_icon.set_visible(true);
 
-    close_or_back = new CloseOrBack();
-    close_or_back.set_visible(true);
+    if (zavai.config.profile != "laptop")
+    {
+        close_or_back = new CloseOrBack();
+        close_or_back.set_visible(true);
+    }
 
     app_shortcut = new AppShortcut();
 
 
     app_shortcut = new AppShortcut();
 
index 387546e49d9210dc9263b023a5ec6516da8a3a9d..a7be513a3169b494984b2fd6a8c94f7f04c63100 100644 (file)
@@ -56,6 +56,12 @@ public class Config
         get { return get_string("version"); }
         set { set_string("version", value); }
     }
         get { return get_string("version"); }
         set { set_string("version", value); }
     }
+    // "phone" or "laptop"
+    public string profile
+    {
+        get { return get_string("profile"); }
+        set { set_string("profile", value); }
+    }
     public string homedir
     {
         get { return get_string("homedir"); }
     public string homedir
     {
         get { return get_string("homedir"); }
@@ -102,35 +108,24 @@ public class Config
         lua = new Lua.LuaVM();
         lua.open_libs();
 
         lua = new Lua.LuaVM();
         lua.open_libs();
 
-stderr.printf("ZA1\n");
-
         // Set defaults
         version = "0.1";
         // Set defaults
         version = "0.1";
-stderr.printf("ZA2\n");
+        profile = "phone";
         homedir = GLib.Environment.get_home_dir() + "/.zavai";
         homedir = GLib.Environment.get_home_dir() + "/.zavai";
-stderr.printf("ZA3\n");
         icondir = GLib.Environment.get_variable("ZAVAI_ICONDIR");
         icondir = GLib.Environment.get_variable("ZAVAI_ICONDIR");
-stderr.printf("ZA4\n");
         if (icondir == null)
                 icondir = "/usr/share/zavai/icons";
         if (icondir == null)
                 icondir = "/usr/share/zavai/icons";
-stderr.printf("ZA5\n");
         min_button_height = 80;
         min_button_height = 80;
-stderr.printf("ZA6\n");
         gprs_apn = "general.t-mobile.uk";
         gprs_apn = "general.t-mobile.uk";
-stderr.printf("ZA7\n");
         gprs_user = "x";
         gprs_user = "x";
-stderr.printf("ZA8\n");
         gprs_pass = "x";
         gprs_pass = "x";
-stderr.printf("ZA9\n");
         backlight_max = 15;
         backlight_max = 15;
-stderr.printf("ZA10\n");
 
         // Read config
         if (lua.do_file(homedir + "/config"))
         {
             zavai.log.error("Failed to parse " + homedir + "/config: " + lua.to_string(-1));
         }
 
         // Read config
         if (lua.do_file(homedir + "/config"))
         {
             zavai.log.error("Failed to parse " + homedir + "/config: " + lua.to_string(-1));
         }
-stderr.printf("ZA11\n");
     }
 
 /*
     }
 
 /*