Revision
81
Author
emsmith
Date
2006-12-29 00:10:47 -0800 (Fri, 29 Dec 2006)

Log Message

Callicore Desktop becomes Callicore

Modified Paths

Added Paths

Removed Paths

Diff

Copied: branches (from rev 32, desktop/branches) ( => )


Copied: tags (from rev 32, desktop/tags)

Copied: trunk (from rev 65, desktop/trunk) ( => )


Copied: trunk/cc_icons (from rev 80, desktop/trunk/cc_icons)

Copied: trunk/docs (from rev 80, desktop/trunk/docs) ( => )


Copied: trunk/lib (from rev 80, desktop/trunk/lib)

Modified: trunk/lib/cc.class.php (80 => 81)


--- desktop/trunk/lib/cc.class.php	2006-12-27 17:16:09 UTC (rev 80)
+++ trunk/lib/cc.class.php	2006-12-29 08:10:47 UTC (rev 81)
@@ -104,6 +104,10 @@
 		}
 		$have = get_loaded_extensions();
 		$needed = array('standard', 'pcre', 'date', 'PDO', 'pdo_sqlite', 'php-gtk');
+		if (stristr(PHP_OS, 'win32'))
+		{
+			$needed[] = 'com';
+		}
 		$diff = array_diff($needed, $have);
 		if (!empty($diff))
 		{

Modified: trunk/lib/config.class.php (80 => 81)


--- desktop/trunk/lib/config.class.php	2006-12-27 17:16:09 UTC (rev 80)
+++ trunk/lib/config.class.php	2006-12-29 08:10:47 UTC (rev 81)
@@ -21,8 +21,7 @@
 /**
  * CC_Config - reads in an ini file to get configuration settings
  *
- * Writes out to file when a configuration option is changed
- * right now the whole file is rewritten - that may change in the future
+ * Writes out to file on destruct
  */
 class CC_Config
 {
@@ -58,15 +57,8 @@
 	 *
 	 * @return void
 	 */
-	public function __construct()
+	protected function __construct()
 	{
-		if (!is_null(self::$singleton))
-		{
-			throw new CC_Exception(
-			'%1$s is a singleton class - use %1$s::instance() to retrieve the current object',
-			'CC_Config');
-		}
-		self::$singleton = $this;
 
 		$this->program = CC::$program;
 		$folders = CC_Folders::instance();
@@ -78,7 +70,6 @@
 		else
 		{
 			$this->data = array();
-			$this->write();
 		}
 		return;
 	}
@@ -125,7 +116,6 @@
 	protected function __set($name, $value)
 	{
 		$this->data[$name] = $value;
-		$this->write();
 		return;
 	}
 
@@ -140,18 +130,17 @@
 	protected function __unset($name)
 	{
 		unset ($this->data[$name]);
-		$this->write();
 		return;
 	}
 
 	/**
-	 * public function write
+	 * protected function __destruct
 	 *
 	 * actually writes the file out
 	 *
 	 * @return void
 	 */
-	protected function write()
+	protected function __destruct()
 	{
 		$string = CC::i18n(';Preferences and Configuration for Callicore ') . $this->program
 			. EOL . CC::i18n('; Saved ') . date('Y-m-d H:i:s') . EOL . EOL;
@@ -203,9 +192,5 @@
 	 *
 	 * @return void
 	 */
-	public function __clone()
-	{
-		throw new CC_Exception('Cannot clone singleton object %s', 'CC_Config');
-		return;
-	}
+	protected function __clone() {}
 }
\ No newline at end of file

Deleted: trunk/lib/folders.class.php (80 => 81)


--- desktop/trunk/lib/folders.class.php	2006-12-27 17:16:09 UTC (rev 80)
+++ trunk/lib/folders.class.php	2006-12-29 08:10:47 UTC (rev 81)
@@ -1,424 +0,0 @@
-<?php
-/**
- * folders.class.php - handles looking up special folders 
- *
- * singleton instance that looks up the location of preferences, appdata, documents,
- * home, and temp directories, also handles OS specific file opening
- *
- * This is released under the GPL, see docs/gpl.txt for details
- *
- * @author       Elizabeth Smith <emsmith@callicore.net>
- * @copyright    Elizabeth Smith (c)2006
- * @link         http://callicore.net/desktop
- * @license      http://www.opensource.org/licenses/gpl-license.php GPL
- * @version      $Id$
- * @since        Php 5.1.0
- * @package      callicore
- * @subpackage   desktop
- * @category     lib
- * @filesource
- */
-
-/**
- * CC_Folders - detects "special folders" locations per OS
- *
- * all locations are cached for now
- */
-class CC_Folders
-{
-	/**
-	 * @const LINUX OS
-	 */
-	const LINUX = 1;
-
-	/**
-	 * @const UNIX OS
-	 */
-	const UNIX = 2;
-
-	/**
-	 * @const WIN32 OS
-	 */
-	const WIN32 = 3;
-
-	/**
-	 * @const WINNT OS
-	 */
-	const WINNT = 4;
-
-	/**
-	 * @const MAC OS
-	 */
-	const MAC = 5;
-
-	/**
-	 * @const GNOME Desktop
-	 */
-	const GNOME = 6;
-
-	/**
-	 * @const KDE Desktop
-	 */
-	const KDE = 7;
-
-	/**
-	 * @const unknown Desktop/OS
-	 */
-	const UNKNOWN = 8;
-
-	/**
-	 * singleton instance for this class
-	 * @var $singleton instanceof Characters
-	 */
-	static protected $singleton;
-
-	/**
-	 * one of the OS constants
-	 * @var $os int
-	 */
-	protected $os;
-
-	/**
-	 * one of the desktop constants
-	 * @var $desktop int
-	 */
-	protected $desktop;
-
-	/**
-	 * location of temporary directory
-	 * @var $temp string
-	 */
-	protected $temp;
-
-	/**
-	 * "home" location on *nix and profile directory on windows
-	 * @var $profile string
-	 */
-	protected $profile;
-
-	/**
-	 * location of My Documents (Documents folder on most *nix varieties)
-	 * @var $documents string
-	 */
-	protected $documents;
-
-	/**
-	 * application data location (with callicore subdir tacked on)
-	 * @var $appdata string
-	 */
-	protected $appdata;
-
-	/**
-	 * protected function __construct
-	 *
-	 * Uses PHP_OS to get a "general" OS name and tries to figure out the
-	 * current desktop system
-	 *
-	 * @return void
-	 */
-	protected function __construct()
-	{
-		if (stristr(PHP_OS, 'winnt'))
-		{
-			$this->os = self::WINNT;
-		}
-		elseif (stristr(PHP_OS, 'win32'))
-		{
-			$this->os = self::WIN32;
-		}
-		elseif (stristr(PHP_OS, 'darwin') || stristr(PHP_OS, 'mac'))
-		{
-			$this->os = self::MAC;
-		}
-		elseif (stristr(PHP_OS, 'linux'))
-		{
-			$this->os = self::LINUX;
-		}
-		elseif (stristr(PHP_OS, 'freebsd') || stristr(PHP_OS, 'aix') || stristr(PHP_OS, 'unix'))
-		{
-			$this->os = self::UNIX;
-		}
-		else
-		{
-			$this->os = self::UNKNOWN;
-		}
-		if ((isset($_ENV['KDE_FULL_SESSION']) && $_ENV['KDE_FULL_SESSION'] == 'true') ||
-			(isset($_ENV['KDE_MULTIHEAD']) && $_ENV['KDE_MULTIHEAD'] == 'true'))
-		{
-			$this->desktop = self::KDE;
-		}
-		elseif (isset($_ENV['GNOME_DESKTOP_SESSION_ID']) || isset($_ENV['GNOME_KEYRING_SOCKET']))
-		{
-			$this->desktop = self::GNOME;
-		}
-		else
-		{
-			$this->desktop = self::UNKNOWN;
-		}
-		return;
-	}
-
-	/**
-	 * public function get_appdata
-	 *
-	 * finds appdata dependent on env variables and OS, adds callicore specific
-	 * dir if needed
-	 *
-	 * @return void
-	 */
-	public function get_appdata()
-	{
-		if (is_null($this->appdata))
-		{
-			// check environment variables for appdata
-			if (isset($_ENV['APPDATA']))
-			{
-				$this->appdata = $_ENV['APPDATA'] . DS . 'Callicore' . DS;
-			}
-			// if win doesn't have appdata, we force the issue in the user profile
-			elseif ($this->os == self::WIN32 || $this->os == self::WINNT)
-			{
-				$path = $this->get_profile() . 'Application Data' . DS;
-				if (!file_exists($path))
-				{
-					mkdir($path);
-				}
-				$this->appdata = $path . 'Callicore' . DS;
-			}
-			// darwin puts things in $HOME/Library/Application Support/Callicore/
-			elseif ($this->os == self::MAC)
-			{
-				$this->appdata = $this->get_profile() . 'Library/Application Support/Callicore' . DS;
-			}
-			// most *nix want ~/.callicore
-			else
-			{
-				$this->appdata = $this->get_profile() . '.callicore' . DS;
-			}
-			if (!file_exists($this->appdata))
-			{
-				mkdir($this->appdata);
-			}
-		}
-		return $this->appdata;
-	}
-
-	/**
-	 * public function get_profile
-	 *
-	 * finds windows user profile and *nix users "home" location
-	 *
-	 * @return void
-	 */
-	public function get_profile()
-	{
-		if (is_null($this->profile))
-		{
-			if ($this->os == self::WINNT || $this->os == self::WIN32)
-			{
-				$env = $_ENV + $_SERVER;
-				if (isset($env['USERPROFILE']))
-				{
-					$this->profile = $env['USERPROFILE'] . DS;
-				}
-				elseif (isset($env['HOMEPATH']) && isset($env['HOMEDRIVE']))
-				{
-					$this->profile = $env['HOMEPATH'] . $env['HOMEDRIVE'] . DS;
-				}
-				elseif (isset($env['USERNAME']) && file_exists('C:\Documents and Settings\\' . $env['USERNAME']))
-				{
-					$this->profile = 'C:\Documents and Settings\\' . $env['USERNAME'] . DS;
-				}
-				else
-				{
-					$this->profile = CC::$dir;
-				}
-			}
-			else
-			{
-				if (isset($_ENV['HOME']))
-				{
-					$this->profile = $_ENV['HOME'] . DS;
-				}
-				elseif ($this->os == self::MAC && isset($_ENV['USER']) &&
-					file_exists('/Users/' . $_ENV['USER']))
-				{
-					$this->profile = '/Users/' . $_ENV['USER'] . DS;
-				}
-				elseif (isset($_ENV['USER']) &&
-					file_exists('/home/' . $_ENV['USER']))
-				{
-					$this->profile = '/home/' . $_ENV['USER'] . DS;
-				}
-				else
-				{
-					$this->profile = CC::$dir;
-				}
-			}
-		}
-		return $this->profile;
-	}
-
-	/**
-	 * public function get_documents
-	 *
-	 * finds documents folder dependent on env variables and OS
-	 *
-	 * @return void
-	 */
-	public function get_documents()
-	{
-		// we always use wscript and com on windows because we want "my documents"
-		if (is_null($this->documents))
-		{
-			if ($this->os == self::WINNT || $this->os == self::WIN32)
-			{
-				$shell = new COM('WScript.Shell');
-				$this->documents = $shell->SpecialFolders('MyDocuments');
-				unset ($shell);
-			}
-			else
-			{
-				$home = $this->get_profile();
-				if (file_exists($home . 'Documents'))
-				{
-					$this->documents = $home . 'Documents' . DS;
-				}
-				else
-				{
-					$this->documents = $home;
-				}
-			}
-		}
-		return $this->documents;
-	}
-
-	/**
-	 * public function get_temp
-	 *
-	 * finds temp directory using best guesses per OS
-	 *
-	 * @return string
-	 */
-	public function get_temp()
-	{
-		if(function_exists('sys_get_temp_dir'))
-		{
-			return sys_get_temp_dir();
-		}
-		if (is_null($this->temp))
-		{
-			$env = $_SERVER + $_ENV;
-			if (isset($env['TEMP']) && file_exists($env['TEMP']) && is_dir($env['TEMP']))
-			{
-				$this->temp = $env['TEMP'];
-			}
-			elseif (isset($env['TMP']) && file_exists($env['TMP']) && is_dir($env['TMP']))
-			{
-				$this->temp = $env['TMP'];
-			}
-			elseif (isset($env['TMPDIR']) && file_exists($env['TMPDIR']) && is_dir($env['TMPDIR']))
-			{
-				$this->temp = $env['TMPDIR'];
-			}
-			elseif (file_exists('/tmp/') && is_dir('/tmp/'))
-			{
-				$this->temp = '/tmp/';
-			}
-			else
-			{
-				$temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
-				if($temp_file)
-				{
-					$this->temp = realpath(dirname($temp_file));
-					unlink($temp_file);
-				}
-				else
-				{
-					$this->temp = $this->get_profile();
-				}
-			}
-		}
-		return $this->temp;
-	}
-
-	/**
-	 * public function open_file
-	 *
-	 * creates command string and pipes it to exec to open a file with an external
-	 * app dependent on OS and desktop Windows uses com to avoid the extra dos window
-	 *
-	 * @param string $file file to open
-	 * @return bool
-	 */
-	public function open_file($file)
-	{
-		if ($this->os == self::LINUX || $this->os == self::UNIX)
-		{
-			// try to use desktop launch standard
-			if (isset($_ENV['DESKTOP_LAUNCH']))
-			{
-				$file = $_ENV['DESKTOP_LAUNCH'] . '"' . $file . '"';
-			}
-			elseif ($this->desktop == self::KDE)
-			{
-				$file = 'kfmclient exec "' . $file . '"';
-			}
-			elseif ($this->desktop == self::GNOME)
-			{
-				$file = 'gnome-open "' . $file . '"';
-			}
-			return exec($file);
-		}
-		elseif ($this->os == self::WINNT)
-		{
-			$shell = new COM('WScript.Shell');
-			$return = $shell->Run('cmd /c start "" "' . $file . '"', 0, false);
-			unset ($shell);
-			return (bool) $return;
-		}
-		elseif ($this->os == self::WIN32)
-		{
-			$shell = new COM('WScript.Shell');
-			$return = $shell->Run('command /c start "" "' . $file . '"', 0, false);
-			unset ($shell);
-			return (bool) $return;
-		}
-		elseif ($this->os == self::MAC)
-		{
-			$file = 'open "' . $file . '"';
-			return exec($file);
-		}
-		else
-		{
-			return false;
-		}
-		return;
-	}
-
-	/**
-	 * static public function instance
-	 *
-	 * this is how items can access the main window instance
-	 *
-	 * @return object instanceof CC_Writer
-	 */
-	static public function instance()
-	{
-		if (is_null(self::$singleton))
-		{
-			self::$singleton = new CC_Folders();
-		}
-		return self::$singleton;
-	}
-
-	/**
-	 * protected function __clone()
-	 *
-	 * disable cloning of a singleton
-	 *
-	 * @return void
-	 */
-	protected function __clone() {}
-
-}
\ No newline at end of file

Copied: trunk/lib/os.class.php (from rev 73, desktop/trunk/lib/folders.class.php) (73 => 81)


--- desktop/trunk/lib/folders.class.php	2006-12-12 22:03:38 UTC (rev 73)
+++ trunk/lib/os.class.php	2006-12-29 08:10:47 UTC (rev 81)
@@ -0,0 +1,326 @@
+<?php
+/**
+ * os.class.php - finds locations and handles launch and run according to os
+ *
+ * singleton instance that looks up the location of preferences, appdata, documents,
+ * home, and temp directories, also handles OS specific launching of files and
+ * running scripts
+ *
+ * This is released under the GPL, see docs/gpl.txt for details
+ *
+ * @author       Elizabeth Smith <emsmith@callicore.net>
+ * @copyright    Elizabeth Smith (c)2006
+ * @link         http://callicore.net/desktop
+ * @license      http://www.opensource.org/licenses/gpl-license.php GPL
+ * @version      $Id$
+ * @since        Php 5.1.0
+ * @package      callicore
+ * @subpackage   desktop
+ * @category     lib
+ * @filesource
+ */
+
+/**
+ * CC_Os- detects "special folders" locations per OS
+ *
+ * locations are not cached because of their volitility in windows - stupidos
+ */
+class CC_Os
+{
+
+	/**
+	 * singleton instance for this class
+	 * @var $singleton instanceof Characters
+	 */
+	static protected $singleton;
+
+	/**
+	 * protected function __construct
+	 *
+	 * Uses PHP_OS to get a "general" OS name and tries to figure out the
+	 * current desktop system
+	 *
+	 * @return void
+	 */
+	protected function __construct()
+	{
+		if (stristr(PHP_OS, 'winnt'))
+		{
+			$this->os = self::WINNT;
+		}
+		elseif (stristr(PHP_OS, 'win32'))
+		{
+			$this->os = self::WIN32;
+		}
+		elseif (stristr(PHP_OS, 'darwin') || stristr(PHP_OS, 'mac'))
+		{
+			$this->os = self::MAC;
+		}
+		elseif (stristr(PHP_OS, 'linux'))
+		{
+			$this->os = self::LINUX;
+		}
+		elseif (stristr(PHP_OS, 'freebsd') || stristr(PHP_OS, 'aix') || stristr(PHP_OS, 'unix'))
+		{
+			$this->os = self::UNIX;
+		}
+		else
+		{
+			$this->os = self::UNKNOWN;
+		}
+		if ((isset($_ENV['KDE_FULL_SESSION']) && $_ENV['KDE_FULL_SESSION'] == 'true') ||
+			(isset($_ENV['KDE_MULTIHEAD']) && $_ENV['KDE_MULTIHEAD'] == 'true'))
+		{
+			$this->desktop = self::KDE;
+		}
+		elseif (isset($_ENV['GNOME_DESKTOP_SESSION_ID']) || isset($_ENV['GNOME_KEYRING_SOCKET']))
+		{
+			$this->desktop = self::GNOME;
+		}
+		else
+		{
+			$this->desktop = self::UNKNOWN;
+		}
+		return;
+	}
+
+	/**
+	 * public function get_temp
+	 *
+	 * finds temp directory using best guesses per OS
+	 *
+	 * @return string
+	 */
+	public function get_temp()
+	{
+		if(function_exists('sys_get_temp_dir'))
+		{
+			return sys_get_temp_dir();
+		}
+		$env = $_SERVER + $_ENV;
+		$list = array('TMP', 'TEMP', 'TMPDIR');
+		foreach($list as $item)
+		{
+			if (isset($env[$item]) && file_exists($env['$item']) && is_dir($env['$item']))
+			{
+				return $env['$item'];
+			}
+		}
+		if (file_exists('/tmp/') && is_dir('/tmp/'))
+		{
+			return '/tmp/';
+		}
+		$temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
+		if($temp_file)
+		{
+			$temp = realpath(dirname($temp_file));
+			unlink($temp_file);
+			return $temp;
+		}
+		else
+		{
+			return $this->get_profile();
+		}
+	}
+
+	/**
+	 * public function get_profile
+	 *
+	 * finds windows user profile and *nix users "home" location
+	 *
+	 * @return void
+	 */
+	public function get_profile()
+	{
+		if (stristr(PHP_OS, 'win32'))
+		{
+			$env = $_ENV + $_SERVER;
+			if (isset($env['USERPROFILE']))
+			{
+				return $env['USERPROFILE'] . DS;
+			}
+			elseif (isset($env['HOMEPATH']) && isset($env['HOMEDRIVE']))
+			{
+				return $env['HOMEPATH'] . $env['HOMEDRIVE'] . DS;
+			}
+			elseif (isset($env['USERNAME']) && file_exists('C:\Documents and Settings\\' . $env['USERNAME']))
+			{
+				return 'C:\Documents and Settings\\' . $env['USERNAME'] . DS;
+			}
+			else
+			{
+				return CC::$dir;
+			}
+		}
+		else
+		{
+			if (isset($_ENV['HOME']))
+			{
+				return $_ENV['HOME'] . DS;
+			}
+			elseif ($this->os == self::MAC && isset($_ENV['USER']) &&
+				file_exists('/Users/' . $_ENV['USER']))
+			{
+				return '/Users/' . $_ENV['USER'] . DS;
+			}
+			elseif (isset($_ENV['USER']) &&
+				file_exists('/home/' . $_ENV['USER']))
+			{
+				return '/home/' . $_ENV['USER'] . DS;
+			}
+			else
+			{
+				return CC::$dir;
+			}
+		}
+	}
+
+	/**
+	 * public function get_appdata
+	 *
+	 * finds appdata dependent on env variables and OS, adds callicore specific
+	 * dir if needed
+	 *
+	 * @return void
+	 */
+	public function get_appdata()
+	{
+		// if win doesn't have appdata, we force the issue in the user profile
+		if (stristr(PHP_OS, 'win32'))
+		{
+			$path = $this->get_profile() . 'Application Data' . DS . 'Callicore' . DS;
+		}
+		// darwin puts things in $HOME/Library/Application Support/Callicore/
+		elseif (stristr(PHP_OS, 'darwin') || stristr(PHP_OS, 'mac'))
+		{
+			$path = $this->get_profile() . 'Library/Application Support/Callicore' . DS;
+		}
+		// check environment variables for appdata - usually *nix
+		elseif (isset($_ENV['APPDATA']))
+		{
+			$path = $_ENV['APPDATA'] . DS . '.callicore' . DS;
+		}
+		// most *nix want ~/.callicore
+		else
+		{
+			$path = $this->get_profile() . '.callicore' . DS;
+		}
+		if (!file_exists($path))
+		{
+			mkdir($path);
+		}
+		return $path;
+	}
+
+	/**
+	 * public function get_documents
+	 *
+	 * finds documents folder dependent on env variables and OS
+	 *
+	 * @return void
+	 */
+	public function get_documents()
+	{
+		// we always use wscript and com on windows because we want "my documents"
+		if (stristr(PHP_OS, 'win32'))
+		{
+			$shell = new COM('WScript.Shell');
+			$documents = $shell->SpecialFolders('MyDocuments');
+			unset ($shell);
+			return $documents;
+		}
+		else
+		{
+			$home = $this->get_profile();
+			if (file_exists($home . 'Documents'))
+			{
+				return $home . 'Documents' . DS;
+			}
+			else
+			{
+				return $home;
+			}
+		}
+	}
+
+
+	/**
+	 * public function launch
+	 *
+	 * creates command string and pipes it to exec to open a file with an external
+	 * app dependent on OS and desktop Windows uses com to avoid the extra dos window
+	 *
+	 * @param string $file file to open
+	 * @return bool
+	 */
+	public function launch($file)
+	{
+		if ($this->os == self::LINUX || $this->os == self::UNIX)
+		{
+			// try to use desktop launch standard
+			if (isset($_ENV['DESKTOP_LAUNCH']))
+			{
+				$file = $_ENV['DESKTOP_LAUNCH'] . '"' . $file . '"';
+			}
+			elseif ($this->desktop == self::KDE)
+			{
+				$file = 'kfmclient exec "' . $file . '"';
+			}
+			elseif ($this->desktop == self::GNOME)
+			{
+				$file = 'gnome-open "' . $file . '"';
+			}
+			return exec($file);
+		}
+		elseif ($this->os == self::WINNT)
+		{
+			$shell = new COM('WScript.Shell');
+			$return = $shell->Run('cmd /c start "" "' . $file . '"', 0, false);
+			unset ($shell);
+			return (bool) $return;
+		}
+		elseif ($this->os == self::WIN32)
+		{
+			$shell = new COM('WScript.Shell');
+			$return = $shell->Run('command /c start "" "' . $file . '"', 0, false);
+			unset ($shell);
+			return (bool) $return;
+		}
+		elseif ($this->os == self::MAC)
+		{
+			$file = 'open "' . $file . '"';
+			return exec($file);
+		}
+		else
+		{
+			return false;
+		}
+		return;
+	}
+
+	/**
+	 * static public function instance
+	 *
+	 * this is how items can access the main window instance
+	 *
+	 * @return object instanceof CC_Writer
+	 */
+	static public function instance()
+	{
+		if (is_null(self::$singleton))
+		{
+			self::$singleton = new CC_Folders();
+		}
+		return self::$singleton;
+	}
+
+	/**
+	 * protected function __clone()
+	 *
+	 * disable cloning of a singleton
+	 *
+	 * @return void
+	 */
+	protected function __clone() {}
+
+}
\ No newline at end of file

Modified: trunk/lib/toolbar.class.php (80 => 81)


--- desktop/trunk/lib/toolbar.class.php	2006-12-27 17:16:09 UTC (rev 80)
+++ trunk/lib/toolbar.class.php	2006-12-29 08:10:47 UTC (rev 81)
@@ -295,17 +295,30 @@
 		if ($default)
 		{
 			$this->current = $toolitems = $this->default;
+			foreach($this->get_children() as $button)
+			{
+				$this->remove($button);
+			}
 		}
 		else
 		{
 			$this->current = $toolitems = isset($config->{$this->name . '_toolbar_items'}) ? $config->{$this->name . '_toolbar_items'} : $this->default;
 		}
 
+		if(empty($toolitems))
+		{
+			$this->current = $toolitems = $this->default;
+		}
+
 		// populate toolbar
 		foreach ($toolitems as $item)
 		{
-			if ($item === 'separator')
+			if (empty($item))
 			{
+				break;
+			}
+			elseif ($item === 'separator')
+			{
 				$item = new GtkSeparatorToolItem();
 			}
 			elseif ($item === 'space')
@@ -355,6 +368,8 @@
 			. 'Remove items by dragging them from the toolbar into this window.' . "\n"
 			. 'Reorder toolbar items by dragging them to their new position.'));
 		$window->vbox->pack_start($label, FALSE, FALSE);
+		$window->action_area->add($button = new GtkButton(CC::i18n('_Reset to Default')));
+		$button->connect_simple('clicked', array($this, 'on_reset_toolbar'));
 		$button = $window->add_button(Gtk::STOCK_CLOSE, Gtk::RESPONSE_CLOSE);
 		$button->connect_simple('clicked', array($window, 'destroy'));
 
@@ -546,6 +561,19 @@
 		return;
 	}
 
+	/**
+	 * public function on_reset_toolbar
+	 *
+	 * creates and runs a dialog to customize the toolbar
+	 *
+	 * @return void
+	 */
+	public function on_reset_toolbar()
+	{
+		$this->build_toolbar(true);
+		return;
+	}
+
 	//----------------------------------------------------------------
 	//             Drag Callbacks
 	//----------------------------------------------------------------

Copied: trunk/locale (from rev 80, desktop/trunk/locale) ( => )


Deleted: trunk/php_xpstyle.ico
===================================================================
(Binary files differ)

Copied: trunk/php_xpstyle.ico (from rev 80, desktop/trunk/php_xpstyle.ico) ( => )


Copied: trunk/programs (from rev 80, desktop/trunk/programs)

Deleted: trunk/run.php (65 => 81)


--- desktop/trunk/run.php	2006-12-10 21:49:34 UTC (rev 65)
+++ trunk/run.php	2006-12-29 08:10:47 UTC (rev 81)
@@ -1,40 +0,0 @@
-#!/usr/bin/php
-<?php
-/**
- * run.php - this is a simple script to run callicore
- *
- * this can be run via the shebang line on *nix systems - windows users can either
- * associate the file extension with the php cli or create a shortcut
- * C:\WINDOWS\system32\cmd.exe /k "C:\Program Files\php-gtk\php.exe"  run.php (for dos window)
- * or "C:\Program Files\php-gtk\php-win.exe" run.php (your php cli locations may vary)
- * you should pass an arg that is the name of the callicore program you want to run
- * e.g. run.php writer
- *
- * You do not have to use this script to run a callicore program, you can write
- * your own, just use CC::run('name of program'); to start callicore
- *
- * This is released under the GPL, see docs/gpl.txt for details
- *
- * @author       Elizabeth Smith <emsmith@callicore.net>
- * @copyright    Elizabeth Smith (c)2006
- * @link         http://callicore.net/desktop
- * @license      http://www.opensource.org/licenses/gpl-license.php GPL
- * @version      $Id$
- * @since        Php 5.2.0
- * @package      callicore
- * @subpackage   desktop
- * @category     bin
- * @filesource
- */
-
-include (dirname(__FILE__) . '/lib/cc.class.php');
-
-// This particular script checks argv for a program name
-if (isset($argv) && isset($argv[1]))
-{
-	$program = (string) $argv[1];
-}
-
-CC::run($program);
-Gtk::main();
-?>
\ No newline at end of file

Copied: trunk/run.php (from rev 80, desktop/trunk/run.php) ( => )


Copied: trunk/stock_icons (from rev 80, desktop/trunk/stock_icons)