cvs: pear /PEAR_Frontend_Gtk/Gtk Packages.php

From: Date: Sun, 02 Jun 2002 14:18:31 +0000
Subject: cvs: pear /PEAR_Frontend_Gtk/Gtk Packages.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4370@lists.php.net to get a copy of this message
alan_k Sun Jun 2 10:18:31 2002 EDT Modified files: /pear/PEAR_Frontend_Gtk/Gtk Packages.php Log: More documentation on new Package Management code Index: pear/PEAR_Frontend_Gtk/Gtk/Packages.php diff -u pear/PEAR_Frontend_Gtk/Gtk/Packages.php:1.8 pear/PEAR_Frontend_Gtk/Gtk/Packages.php:1.9 --- pear/PEAR_Frontend_Gtk/Gtk/Packages.php:1.8 Sun Jun 2 09:29:25 2002 +++ pear/PEAR_Frontend_Gtk/Gtk/Packages.php Sun Jun 2 10:18:31 2002 @@ -16,7 +16,7 @@ | Author: Alan Knowles <alan@akbkhome.com> | +----------------------------------------------------------------------+ - $Id: Packages.php,v 1.8 2002/06/02 13:29:25 alan_k Exp $ + $Id: Packages.php,v 1.9 2002/06/02 14:18:31 alan_k Exp $ */ require('PEAR/Frontend/Gtk/PackageData.php'); /** @@ -328,7 +328,10 @@ - + /* + * Load the local packages into this->_localPackageCache + * + */ function loadLocalPackages () { $reg = new PEAR_Registry($this->ui->config->get('php_dir')); $installed = $reg->packageInfo(); @@ -339,7 +342,10 @@ $this->_localPackagesCache[$package->name] = $package; } } - + /* + * Load the remote packages into this->_remotePackageCache + * + */ function loadRemotePackages () { $r = new PEAR_Remote($this->ui->config); $remote = $r->call('package.listAll', true); @@ -353,7 +359,10 @@ $this->_remotemotePackageCache[] = $package; } } - + /* + * Add local and remote together and store in this->packages + * Not: remembers installation status. + */ function mergePackages () { // builds a mreged package list // start with remote list. $newpackages = array(); @@ -374,16 +383,24 @@ $newpackages[$name]->QueueInstall = $package->QueueInstall; $newpackages[$name]->QueueRemove = $package->QueueRemove; } + ksort($newpackages); $this->packages = $newpackages; } + /* + * Reset the Queues on all objects + */ function resetQueue() { foreach(array_keys($this->packages) as $packagename) { $this->packages[$packagename]->QueueInstall = FALSE; $this->packages[$packagename]->QueueRemove = FALSE; } } - + /* + * Get the List of packages to install + * + *@return array array of PackageData objects + */ function &getInstallQueue() { $ret = array(); foreach(array_keys($this->packages) as $packagename) { @@ -392,7 +409,11 @@ } return $ret; } - + /* + * Get the Packages to Remove. + * + *@return array array of PackageData objects + */ function &getRemoveQueue() { $ret = array(); foreach(array_keys($this->packages) as $packagename) { @@ -402,6 +423,62 @@ return $ret; } + /* + * Nodes in a CTreeNodes + * + * @var array of Category Nodes + * + */ + var $_categoryNodes = array(); + + /* + * Load the package list into the clist. + * + *@return array array of PackageData objects + */ + function loadPackageList() { + //while(gtk::events_pending()) gtk::main_iteration(); + $this->widget->clear(); + $this->widget->freeze(); + + foreach (array_keys($this->packages) as $packagename) { + $package = &$this->packages[$packagename]; + $parent = $this->_getCategoryNode($package); + $package->CreateNode($this->widget,$parent); + } + $this->widget->thaw(); + + } + /* + * Load the package list into the clist. + * + *@return array array of PackageData objects + */ + function &_getCategoryNode(&$package) { + $ret = NULL; + if ($package->category == $package->name) + return $ret; + + if (@$this->_categoryNodes[$package->category]) + return $this->_categoryNodes[$package->category]; + + if (@$this->packages[$package->category]) + return $this->packages[$package->category]->cTreeNode; + + + $this->_CategoryNodes[$package->category] = $this->widget->insert_node( + NULL, NULL, //parent, sibling + array($package->category, '','','','',''),5, + $this->ui->_pixmaps['folder_closed.xpm'][0], + $this->ui->_pixmaps['folder_closed.xpm'][1], + $this->ui->_pixmaps['folder_open.xpm'][0], + $this->ui->_pixmaps['folder_open.xpm'][1], + false,true + ); + + return $this->_categoryNodes[$package->category]; + + } }

« previous php.pear.cvs (#4370) next »