Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Private Member Functions
Silverstone.Manticore.App.ManticoreApp Class Reference

List of all members.

Public Member Functions

 ManticoreApp ()
void Quit ()

Static Public Member Functions

static void Main (string[] args)

Private Member Functions

void SaveSession ()
 Saves the state of opened windows, urls, etc to preferences so that state can be restored when the app is restarted.
bool RestoreSession ()
 Restore Session from preferences if "Restore Session" pref is set.

Detailed Description

Definition at line 51 of file app.cs.


Constructor & Destructor Documentation

Definition at line 53 of file app.cs.

    {
      if (!RestoreSession()) 
        BrowserWindow.OpenBrowser();

      Application.Run();
    }

Here is the call graph for this function:


Member Function Documentation

static void Silverstone.Manticore.App.ManticoreApp.Main ( string[]  args) [inline, static]

Definition at line 132 of file app.cs.

    {
      ServiceManager.mApp = new ManticoreApp();
    }

Definition at line 61 of file app.cs.

    {
      // Save Session
      SaveSession();
      
      // Flush preferences to disk.
      ServiceManager.Preferences.FlushUserPreferences();
      
      Application.Exit();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Restore Session from preferences if "Restore Session" pref is set.

Returns:
Whether or not a session was restored.

Definition at line 106 of file app.cs.

    {
      if (ServiceManager.Preferences.GetIntPref("browser.homepage.mode") == 2) {
        IEnumerator branch = ServiceManager.Preferences.GetBranch("browser.session.windows");
        while (branch.MoveNext()) {
          String pref = branch.Current as String;
          String url = ServiceManager.Preferences.GetStringPref(pref);
          int x = ServiceManager.Preferences.GetIntPref(pref + ".left");
          int y = ServiceManager.Preferences.GetIntPref(pref + ".top");
          int width = ServiceManager.Preferences.GetIntPref(pref + ".width");
          int height = ServiceManager.Preferences.GetIntPref(pref + ".height");
       
          // Create a new browser with the applicable url at the applicable
          // location. 
          BrowserWindow window = BrowserWindow.OpenBrowserWithURL(url);
          window.Location = new Point(x, y);
          window.Size = new Size(width, height);
        }
        // XXX need to reinit session histories. 
        ServiceManager.Preferences.RemoveBranch("browser.session.windows");
        return true;
      }
      return false;
    }

Here is the call graph for this function:

Saves the state of opened windows, urls, etc to preferences so that state can be restored when the app is restarted.

Definition at line 76 of file app.cs.

    {
      if (ServiceManager.Preferences.GetIntPref("browser.homepage.mode") == 2) {
        bool isLastPageOnly = ServiceManager.Preferences.GetIntPref("browser.session.windowmode") == 0;
        WindowMediator wm = ServiceManager.WindowMediator;
        IEnumerator browsers = wm.GetEnumeratorForType("BrowserWindow");
        int count = 0;
        while (browsers.MoveNext()) {
          if (isLastPageOnly && count > 0) {
            // XXX need to |getMostRecentWindow| instead of just taking the first. 
            break;
          }

          BrowserWindow currWindow = browsers.Current as BrowserWindow;
          String pref = "browser.session.windows.";
          pref += currWindow.Type + count++;
          ServiceManager.Preferences.SetStringPref(pref, currWindow.URL);
          ServiceManager.Preferences.SetIntPref(pref + ".left", currWindow.Left);
          ServiceManager.Preferences.SetIntPref(pref + ".top", currWindow.Top);
          ServiceManager.Preferences.SetIntPref(pref + ".width", currWindow.Width);
          ServiceManager.Preferences.SetIntPref(pref + ".height", currWindow.Height);
        }
        // XXX need to save session histories. 
      }
    }

Here is the call graph for this function:


The documentation for this class was generated from the following file: