PEAR_Frontend_Gtk2
[ class tree: PEAR_Frontend_Gtk2 ] [ index: PEAR_Frontend_Gtk2 ] [ all elements ]

Source for file Gtk2.php

Documentation is available at Gtk2.php

  1. <?php
  2. require_once 'PEAR/Config.php';
  3. require_once 'PEAR/Frontend.php';
  4.  
  5. require_once 'PEAR/Frontend/Gtk2/About.php';
  6. require_once 'PEAR/Frontend/Gtk2/Channels.php';
  7. require_once 'PEAR/Frontend/Gtk2/Config.php';
  8. require_once 'PEAR/Frontend/Gtk2/Packages.php';
  9. require_once 'PEAR/Frontend/Gtk2/Installation.php';
  10.  
  11. /**
  12. *   Graphical frontend for PEAR, based on PHP-Gtk2
  13. *
  14. *   TODO:
  15. *   - Package categories aren't updated/extendet if there is an error at startup loading/packages are refreshed and a new category is required
  16. *   - channel discovery
  17. *   - Drop package file onto install button -> install it
  18. *   - Warn if the package list is older than 5 days
  19. *   - upgrade-all menu option
  20. *   - Filter by upgradeable/installed/installable/all packages
  21. *   - Install pecl packages - error messages aren't shown
  22. *
  23. *   Don't know how to do:
  24. *   - installation dialog showing has to be updated correctly
  25. *   - Installation: shrink window if expander is collapsed
  26. *
  27. *   Done:
  28. *   - better installation ok icon
  29. *   - Window icon - shows the php icon on windows currently
  30. *   - When no internet connection on startup, no categories are loaded and no local packages are shown
  31. *   - When no pear cache directory exists, the check warning is shown - pear cache directory is created now
  32. *   - uninstall: pear/liveuser is required by installed package "pear/Event_Dispatcher"
  33. *   - use menu options (deps, nodeps)
  34. *   - refresh online info (clear cache or so)
  35. *   - offline mode
  36. *   - save and load settings
  37. *   - scroll text in installation
  38. *
  39. *   @author Christian Weiske <cweiske@php.net>
  40. */
  41. class PEAR_Frontend_Gtk2 extends PEAR_Frontend
  42. {
  43.     /**
  44.     *   The widgets which shall be loaded from the glade
  45.     *   file into the $arWidgets array
  46.     *   @var array 
  47.     */
  48.     protected static $arRequestedWidgets = array(
  49.         'dlgInstaller''lstCategories''lstPackages''txtPackageInfo',
  50.         'cmbChannel''imgChannelLogo''lblSelectedCategory''hboxCategoryInfo',
  51.         'btnInstall','btnUninstall','lblBtnInstall','evboxSelectedCategory','expPackageInfo',
  52.  
  53.         'mnuOptDepsNo','mnuOptDepsReq','mnuOptDepsAll','mnuOptDepNothing',
  54.         'mnuOffline','mnuQuit','mnuAbout','mnuUpdateOnline','mnuUpdateLocal',
  55.  
  56.         'dlgProgress''lblDescription''imgProgress''lblProgress''progBar'
  57.     );
  58.  
  59.     protected $nProgressImage = 1;
  60.  
  61.     /**
  62.     *   Array with images used for the progress animation
  63.     */
  64.     protected $arAnimationImages = array();
  65.  
  66.     /**
  67.     *   Requested widgets are loaded from glade into this array.
  68.     *   So this is an associative array with all required widgets
  69.     *   from the glade file: name => widget object
  70.     *   @var array 
  71.     */
  72.     protected $arWidgets;
  73.  
  74.     /**
  75.     *   The PEAR_Frontend_Gtk2_Installation object to use
  76.     *   @var PEAR_Frontend_Gtk2_Installation 
  77.     */
  78.     protected $installer = null;
  79.  
  80.     protected $selectedPackage          = null;
  81.     protected $strSelectedCategoryName  = null;
  82.     protected $strSelectedCategoryKey   = null;
  83.  
  84.     /**
  85.     *   The package information class instance
  86.     *   @var PEAR_Frontend_Gtk2_Packages 
  87.     */
  88.     protected $packages = null;
  89.  
  90.     const CATEGORY_ALL      = 12345678;
  91.     const CATEGORY_SELECTED = 12345679;
  92.  
  93.  
  94.  
  95.     /**
  96.     *   Special categories which are added to the
  97.     *   channel categories
  98.     *   @var array 
  99.     */
  100.     protected static $arSpecialCategories = array(
  101.         PEAR_Frontend_Gtk2::CATEGORY_ALL      => '*All packages',
  102. //        PEAR_Frontend_Gtk2::CATEGORY_SELECTED => '*Selected for install'
  103.     );
  104.  
  105.  
  106.     public function __construct()
  107.     {
  108.         $this->loadConfig();
  109.         $this->buildDialog();
  110.         PEAR_Frontend_Gtk2_Config::loadConfig();
  111.         PEAR_Frontend_Gtk2_Config::loadCurrentConfigIntoGui($this);
  112.  
  113.         //After all has been initiated, load the data
  114.         PEAR_Frontend_Gtk2_Channels::loadChannels(
  115.             $this->arWidgets['cmbChannel'],
  116.             $this->config,
  117.             PEAR_Frontend_Gtk2_Config::$strDefaultChannel
  118.         );
  119.     }//public function __construct()
  120.  
  121.  
  122.  
  123.     function loadConfig()
  124.     {
  125.         $this->config   = PEAR_Config::singleton();
  126.         $this->packages = new PEAR_Frontend_Gtk2_Packages($this->config);
  127.     }//function loadConfig()
  128.  
  129.  
  130.  
  131.     public function quitApp()
  132.     {
  133.         PEAR_Frontend_Gtk2_Config::loadConfigurationFromGui($this);
  134.         PEAR_Frontend_Gtk2_Config::saveConfig();
  135.         Gtk::main_quit();
  136.     }//public function quitApp()
  137.  
  138.  
  139.  
  140.     /**
  141.     *   load the glade file, load the widgets, connect the signals
  142.     */
  143.     protected function buildDialog()
  144.     {
  145.         $this->glade = new GladeXML(dirname(__FILE__'/Gtk2/installer.glade');
  146.         foreach (self::$arRequestedWidgets as $strWidgetName{
  147.             $this->arWidgets[$strWidgetName$this->glade->get_widget($strWidgetName);
  148.         }
  149.  
  150.         $this->arWidgets['dlgInstaller']->connect_simple('destroy'array($this'quitApp'));
  151.         $strIcon = dirname(__FILE__'/Gtk2/runicon.png';
  152.         if (file_exists($strIcon)) {
  153.             $this->arWidgets['dlgInstaller']->set_icon_from_file($strIcon);
  154.         }
  155.  
  156.         $this->arWidgets['lblSelectedCategory']->set_use_markup(true);
  157.  
  158.         $this->arWidgets['cmbChannel']->connect('changed'array($this'selectChannel'));
  159.  
  160.         $this->arWidgets['lstCategories']->set_model(new GtkListStore(Gtk::TYPE_STRINGGtk::TYPE_STRING));
  161.         $cell_renderer = new GtkCellRendererText();
  162.         $column = new GtkTreeViewColumn('test'$cell_renderer"text"0);
  163.         $this->arWidgets['lstCategories']->append_column($column);
  164.  
  165.         $this->arWidgets['btnInstall']  ->connect_simple('clicked'array($this'installPackage')true);
  166.         $this->arWidgets['btnUninstall']->connect_simple('clicked'array($this'installPackage')false);
  167.  
  168.         $this->arWidgets['dlgProgress']->connect('delete-event'array($this'deleteProgressWindow'));
  169.  
  170.         //Menu entries
  171.         $this->arWidgets['mnuQuit']         ->connect_simple('activate'array($this'quitApp'));
  172.         $this->arWidgets['mnuAbout']        ->connect_simple('activate'array('PEAR_Frontend_Gtk2_About''showMe'));
  173.         $this->arWidgets['mnuUpdateLocal']  ->connect_simple('activate'array($this'refreshLocalPackages'));
  174.         $this->arWidgets['mnuUpdateOnline'->connect_simple('activate'array($this'refreshOnlinePackages'));
  175.  
  176.  
  177.         //that's channel name and array key of the packages
  178.         $this->arWidgets['lstPackages']->set_model(new GtkListStore(Gtk::TYPE_STRINGGtk::TYPE_STRINGGtk::TYPE_STRINGGtk::TYPE_STRINGGtk::TYPE_PHP_VALUE));
  179.         $cell_renderer = new GtkCellRendererText();
  180.  
  181.         $colName = new GtkTreeViewColumn('Package'$cell_renderer"text"0);
  182.         $colName->set_resizable(true);
  183.         $colName->set_sort_column_id(0);
  184.         $this->arWidgets['lstPackages']->append_column($colName);
  185.  
  186.         $colInstalled = new GtkTreeViewColumn('Installed'$cell_renderer"text"1);
  187.         $colInstalled->set_resizable(true);
  188.         $colInstalled->set_sort_column_id(1);
  189.         $this->arWidgets['lstPackages']->append_column($colInstalled);
  190.  
  191.         $colNew = new GtkTreeViewColumn('New version'$cell_renderer"text"2);
  192.         $colNew->set_resizable(true);
  193.         $colNew->set_sort_column_id(2);
  194.         $this->arWidgets['lstPackages']->append_column($colNew);
  195.  
  196.         $colSummary = new GtkTreeViewColumn('Summary'$cell_renderer"text"3);
  197.         $colSummary->set_resizable(true);
  198.         $colSummary->set_sort_column_id(3);
  199.         $this->arWidgets['lstPackages']->append_column($colSummary);
  200.  
  201.         $selCategories $this->arWidgets['lstCategories']->get_selection();
  202.         $selCategories->set_mode(Gtk::SELECTION_SINGLE);
  203.         $selCategories->connect('changed'array($this'selectCategory'));
  204.  
  205.         $selPackages $this->arWidgets['lstPackages']->get_selection();
  206.         $selPackages->set_mode(Gtk::SELECTION_SINGLE);
  207.         $selPackages->connect('changed'array($this'selectPackage'));
  208.  
  209.         for ($nA = 1; $nA <= 3; $nA++{
  210.             $this->arAnimationImages[= GdkPixbuf::new_from_file(dirname(__FILE__'/Gtk2/pixmaps/progress/load-anim-' $nA '.png');
  211.         }
  212.         $this->nProgressImage = 0;
  213.  
  214.         $this->loadInstaller();
  215.     }//protected function buildDialog()
  216.  
  217.  
  218.  
  219.     protected function loadInstaller()
  220.     {
  221.         $this->installer = new PEAR_Frontend_Gtk2_Installation($this->arWidgets['dlgInstaller']$this->glade);
  222.     }//protected function loadInstaller()
  223.  
  224.  
  225.  
  226.     /**
  227.     *   A channel has been selected from the channel combo box
  228.     *
  229.     *   Has to be public as it is a callback function
  230.     *
  231.     *   @param GtkComboBox  $cmbChannel     The channel selection combo box
  232.     *   @param boolean      $bSecondTime    If the function is being run a second time (because the first run had a problem) - used to detect infinite loops.
  233.     */
  234.     public function selectChannel($cmbChannel$bSecondTime = false)
  235.     {
  236.         $strChannel $cmbChannel->get_active_text();
  237.  
  238.         $this->setChannelStyles($strChannel);
  239.  
  240.         $model $this->arWidgets['lstCategories']->get_model();
  241.         $model->clear();
  242.         $this->arWidgets['lstPackages']->get_model()->clear();
  243.  
  244.         //Channel categories
  245.         $this->packages->setActiveChannel($strChannel);
  246.  
  247.         if (!$this->packages->packagesLoaded()) {
  248.             //show the progress dialog before it gets loaded with the first callback
  249.             $this->showProgressDialog(true);
  250.         }
  251.  
  252.         try {
  253.             $arCategories $this->packages->getCategories(array($this'packagesCallback')$this->getWorkOffline());
  254.         catch (Exception $e{
  255.             $this->hideProgressDialog();
  256.             $dialog = new GtkMessageDialog(
  257.                 $this->arWidgets['dlgInstaller'],
  258.                 0,
  259.                 Gtk::MESSAGE_ERROR,
  260.                 Gtk::BUTTONS_OK,
  261.                 'Can\'t list the categories:' "\r\n"
  262.                 . $e->getCode(': ' $e->getMessage()
  263.                 . "\r\n\r\nMake sure you have an internet connection."
  264.             );
  265.             $dialog->set_transient_for($this->arWidgets['dlgInstaller']);
  266.             $dialog->set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
  267.             $dialog->run();
  268.             $dialog->destroy();
  269.  
  270.             if (!$bSecondTime{
  271.                 //The exception code seem to vary on every run - so I can't check for a certain code.
  272.                 //But as we still can load the local packages, we can work offline.
  273.                 $this->setWorkOffline(true);
  274.                 $this->selectChannel($cmbChanneltrue);
  275.                 return;
  276.             else {
  277.                 //no chance to do a fix - do nothing
  278.                 return;
  279.             }
  280.         }
  281.  
  282.         $arCategories $this->appendSpecialCategories(
  283.             $arCategories
  284.         );
  285.  
  286.         foreach ($arCategories as $key => $strCategory{
  287.             $model->set($model->append()0$strCategory1$key);
  288.         }
  289.  
  290.         //Clear packages
  291.         $this->arWidgets['lstPackages']->get_model()->clear();
  292.         $this->arWidgets['lstCategories']->get_selection()->select_path('0');
  293.  
  294.         $this->hideProgressDialog();
  295.     }//public function selectChannel($cmbChannel, $bSecondTime = false)
  296.  
  297.  
  298.  
  299.     protected function setChannelStyles($strChannel)
  300.     {
  301.         //Logo
  302.         $strIcon dirname(__FILE__'/Gtk2/pixmaps/' $strChannel '.png';
  303.         if (!file_exists($strIcon)) {
  304.             $strIcon dirname(__FILE__'/Gtk2/pixmaps/default.png';
  305.         }
  306.         if (file_exists($strIcon)) {
  307.             $this->arWidgets['imgChannelLogo']->set_from_file($strIcon);
  308.         }
  309.  
  310.         //Colors
  311.         $strColorChannel $strChannel;
  312.         if (!isset(PEAR_Frontend_Gtk2_Config::$arChannels[$strColorChannel])) {
  313.             $strColorChannel 'default';
  314.         }
  315.         $colBg = GdkColor::parse(PEAR_Frontend_Gtk2_Config::$arChannels[$strColorChannel]['background-color']);
  316.         $colFg = GdkColor::parse(PEAR_Frontend_Gtk2_Config::$arChannels[$strColorChannel]['color']);
  317.  
  318.         $this->arWidgets['evboxSelectedCategory']->modify_bg(Gtk::STATE_NORMAL$colBg);
  319.         $this->arWidgets['lblSelectedCategory']->modify_fg(Gtk::STATE_NORMAL$colFg);
  320.     }//protected function setChannelStyles($strChannel)
  321.  
  322.  
  323.  
  324.     /**
  325.     *   Appends defined special categories to the given
  326.     *   list
  327.     *
  328.     *   @param  array   Array of categories
  329.     *   @return array   Array of categories with special ones
  330.     */
  331.     function appendSpecialCategories($arCategories)
  332.     {
  333.         foreach (PEAR_Frontend_Gtk2::$arSpecialCategories as $key => $value{
  334.             $arCategories[$key$value;
  335.         }
  336.         return $arCategories;
  337.     }//function appendSpecialCategories($arCategories)
  338.  
  339.  
  340.  
  341.     /**
  342.     *   A category has been selected
  343.     */
  344.     function selectCategory($selection)
  345.     {
  346.         list($model$iter$selection->get_selected();
  347.         if ($iter === null{
  348.             $this->arWidgets['lblSelectedCategory']->set_text('No category selected');
  349.             return;
  350.         }
  351.  
  352.         $this->strSelectedCategoryName  $model->get_value($iter0);
  353.         $this->strSelectedCategoryKey   $model->get_value($iter1);
  354.         $this->arWidgets['lblSelectedCategory']->set_markup('<b>' $this->strSelectedCategoryName '</b>');
  355.  
  356.         if ($this->strSelectedCategoryKey == self::CATEGORY_ALL{
  357.             $this->strSelectedCategoryName = null;
  358.         }
  359.         $this->showPackageList($this->strSelectedCategoryName);
  360.     }//function selectCategory($selection)
  361.  
  362.  
  363.  
  364.     /**
  365.     *   Fill the package list for the given category
  366.     */
  367.     protected function showPackageList($strCategory)
  368.     {
  369.         //Show packages
  370.         $model $this->arWidgets['lstPackages']->get_model();
  371.         $model->clear();
  372.         $arPackages $this->packages->getPackages($strCategory);
  373.         if (count($arPackages> 0{
  374.             foreach ($arPackages as $key => $package{
  375.                 $model->set(
  376.                     $model->append(),
  377.                     0$package->getName(),
  378.                     1$package->getInstalledVersion(),
  379.                     2$package->getLatestVersion(),
  380.                     3$package->getSummary(),
  381.                     4$package
  382.                 );
  383.             }
  384.         }
  385.     }//protected function showPackageList($strCategory)
  386.  
  387.  
  388.  
  389.     /**
  390.     *   Update the package list model entries for the given packages.
  391.     *   Useful after installing/uninstalling a package
  392.     *
  393.     *   @param array    $arPackages     Array of packages which model entry shall be updated
  394.     */
  395.     protected function updatePackageList($arPackages)
  396.     {
  397.         $model $this->arWidgets['lstPackages']->get_model();
  398.         $iter  $model->get_iter_first();
  399.         while ($iter !== null{
  400.             $package $model->get_value($iter4);
  401.             if (in_array($package$arPackages)) {
  402.                 $model->set(
  403.                     $iter,
  404.                     0$package->getName(),
  405.                     1$package->getInstalledVersion(),
  406.                     2$package->getLatestVersion(),
  407.                     3$package->getSummary(),
  408.                     4$package
  409.                 );
  410.             }
  411.             $iter $model->iter_next($iter);
  412.         }
  413.     }//protected function updatePackageList($arPackages)
  414.  
  415.  
  416.  
  417.     /**
  418.     *   Callback for the package loading functions
  419.     */
  420.     function packagesCallback($nPackageCount$nCurrentPackage)
  421.     {
  422.         $dlgProgress $this->arWidgets['dlgProgress'];
  423.         if ($nPackageCount === true{
  424.             //we're done
  425.             $this->hideProgressDialog();
  426.             return;
  427.         }
  428.         $this->showProgressDialog();
  429.         $this->arWidgets['lblProgress']->set_text($nCurrentPackage ' / ' $nPackageCount);
  430.         $this->arWidgets['progBar']->set_fraction(1/$nPackageCount $nCurrentPackage);
  431.  
  432.         $this->nProgressImage++;
  433.         if (!isset($this->arAnimationImages[$this->nProgressImage])) {
  434.             $this->nProgressImage = 0;
  435.         }
  436.         //TODO: hold the images in memory
  437.         $this->arWidgets['imgProgress']->set_from_pixbuf($this->arAnimationImages[$this->nProgressImage]);
  438.         while (Gtk::events_pending()) Gtk::main_iteration();}
  439.     }//function packagesCallback($nPackageCount, $nCurrentPackage)
  440.  
  441.  
  442.  
  443.     public function selectPackage($selection)
  444.     {
  445.         list($model$iter$selection->get_selected();
  446.         if ($iter === null{
  447.             $strDescription '';
  448.             $this->setSelectedPackage(null);
  449.             $this->arWidgets['btnUninstall']->hide();
  450.             $this->arWidgets['btnInstall']  ->set_sensitive(false);
  451.         else {
  452.             $package $model->get_value($iter4);
  453.             $this->setSelectedPackage($package);
  454.             $strDescription $package->getDescription();
  455.             $this->ableInstallButtons($package);
  456.             if ($package->getInstalledVersion(=== null || $package->getInstalledVersion(== ''{
  457.                 $this->arWidgets['lblBtnInstall']->set_label('Inst_all package');
  458.             else {
  459.                 $this->arWidgets['lblBtnInstall']->set_label('Upgr_ade package');
  460.             }
  461.         }
  462.  
  463.         $this->arWidgets['txtPackageInfo']->get_buffer()->set_text($strDescription);
  464.     }//public function selectPackage($selection)
  465.  
  466.  
  467.  
  468.     /**
  469.     *   Enables or disables the install buttons depending
  470.     *   on the installation status of $package
  471.     *
  472.     *   @param PEAR_Frontend_Gtk2_Package $package  The package to check
  473.     */
  474.     protected function ableInstallButtons($package)
  475.     {
  476.         if ($package === null{
  477.             return;
  478.         }
  479.  
  480.         $this->arWidgets['btnInstall']->set_sensitive(
  481.             $package->getLatestVersion(!== null
  482.             && $package->getLatestVersion(!== ''
  483.         );
  484.  
  485.         if ($package->getInstalledVersion(== ''{
  486.             $this->arWidgets['btnUninstall']->hide();
  487.             $this->arWidgets['btnUninstall']->set_sensitive(false);
  488.         else {
  489.             $this->arWidgets['btnUninstall']->show();
  490.             $this->arWidgets['btnUninstall']->set_sensitive(true);
  491.         }
  492.     }//protected function ableInstallButtons($package)
  493.  
  494.  
  495.  
  496.     protected function updateInstallButtons()
  497.     {
  498.         $selection $this->arWidgets['lstPackages']->get_selection();
  499.         list($model$iter$selection->get_selected();
  500.         $package $model->get_value($iter4);
  501.         $this->ableInstallButtons($package);
  502.     }//protected function updateInstallButtons()
  503.  
  504.  
  505.  
  506.     protected function getSelectedPackage()
  507.     {
  508.         return $this->selectedPackage;
  509.     }//protected function getSelectedPackage()
  510.  
  511.  
  512.  
  513.     protected function setSelectedPackage($package)
  514.     {
  515.         $this->selectedPackage $package;
  516.     }//protected function setSelectedPackage($package)
  517.  
  518.  
  519.  
  520.     /**
  521.     *   Installs (or uninstalls) the selected package
  522.     *
  523.     *   @param boolean $bInstall    True if the package shall be installed, false if it shall be uninstalled
  524.     */
  525.     function installPackage($bInstall = true)
  526.     {
  527.         $strChannel $this->packages->getActiveChannel();
  528.         $package $this->getSelectedPackage();
  529.         if ($package === null{
  530.             $dialog = new GtkMessageDialog(
  531.                 $this->arWidgets['dlgInstaller']0Gtk::MESSAGE_ERRORGtk::BUTTONS_OK,
  532.                 'You have to select a package before you can install it.'
  533.             );
  534.             $dialog->run();
  535.             $dialog->destroy();
  536.             return;
  537.         }
  538.  
  539.         //get changes done in gui into config
  540.         PEAR_Frontend_Gtk2_Config::loadConfigurationFromGui($this);
  541.  
  542.         $this->installer->installPackage(
  543.             $strChannel,
  544.             $package->getName(),
  545.             $package->getLatestVersion(),
  546.             $bInstall,
  547.             PEAR_Frontend_Gtk2_Config::$strDepOptions
  548.         );
  549.  
  550.         $package->refreshLocalInfo();
  551.         $this->updatePackageList(array($package));
  552.         $this->updateInstallButtons();
  553.     }//function installPackage($bInstall = true)
  554.  
  555.  
  556.  
  557.     /**
  558.     *   Shows the progress dialog if that hasn't already been done
  559.     *
  560.     *   @param boolean  $bInitWithZero  If the dialog's labels should be initialized (if the dialog has been hidden)
  561.     */
  562.     protected function showProgressDialog($bInitWithZero = false)
  563.     {
  564.         $dlgProgress $this->arWidgets['dlgProgress'];
  565.         if ($dlgProgress->window === null || !$dlgProgress->window->is_visible()) {
  566.             //show it
  567.             $dlgProgress->modify_bg(Gtk::STATE_NORMALGdkColor::parse('#FFFFFF'));
  568.             $dlgProgress->set_transient_for($this->arWidgets['dlgInstaller']);
  569.             $dlgProgress->set_position(Gtk::WIN_POS_CENTER_ON_PARENT);
  570.  
  571.             if ($bInitWithZero{
  572.                 $this->arWidgets['lblProgress']->set_text('');
  573.                 $this->arWidgets['progBar']->set_fraction(0);
  574.             }
  575.  
  576.             $dlgProgress->show_now();
  577.             while (Gtk::events_pending()) Gtk::main_iteration();}
  578.         }
  579.     }//protected function showProgressDialog($bInitWithZero = false)
  580.  
  581.  
  582.  
  583.     /**
  584.     *   Hides the progress dialog
  585.     */
  586.     protected function hideProgressDialog()
  587.     {
  588.         $this->arWidgets['dlgProgress']->hide();
  589.         while (Gtk::events_pending()) Gtk::main_iteration();}
  590.     }//protected function hideProgressDialog()
  591.  
  592.  
  593.  
  594.     /**
  595.     *   The user may not close the progress window by hand
  596.     */
  597.     public function deleteProgressWindow()
  598.     {
  599.         return true;
  600.     }//public function deleteProgressWindow()
  601.  
  602.  
  603.  
  604.     /**
  605.     *   Check if the user wants to work offline
  606.     *   @return boolean     True, if the offline setting is active (work offline), false if working online
  607.     */
  608.     protected function getWorkOffline()
  609.     {
  610.         return $this->arWidgets['mnuOffline']->get_active();
  611.     }//protected function getWorkOffline()
  612.  
  613.  
  614.  
  615.     /**
  616.     *   Set the offline setting
  617.     *   @param boolean $bOffline    If the user wants to work offline (true) or not (false)
  618.     */
  619.     protected function setWorkOffline($bOffline)
  620.     {
  621.         return $this->arWidgets['mnuOffline']->set_active($bOffline);
  622.     }//protected function setWorkOffline($bOffline)
  623.  
  624.  
  625.  
  626.     public function getWidget($strWidget)
  627.     {
  628.         return $this->arWidgets[$strWidget];
  629.     }//public function getWidget($strWidget)
  630.  
  631.  
  632.  
  633.     /**
  634.     *   Reload local package information and update the list.
  635.     */
  636.     public function refreshLocalPackages()
  637.     {
  638.         $this->packages->refreshLocalPackages();
  639.         $this->showPackageList($this->strSelectedCategoryName);
  640.     }//public function refreshLocalPackages()
  641.  
  642.  
  643.  
  644.     /**
  645.     *   Reload the online package list and package information,
  646.     *   and update the list here.
  647.     */
  648.     public function refreshOnlinePackages()
  649.     {
  650.         $this->packages->refreshRemotePackages(nullarray($this'packagesCallback'));
  651.         $this->showPackageList($this->strSelectedCategoryName);
  652.     }//public function refreshOnlinePackages()
  653.  
  654. }//class PEAR_Frontend_Gtk2
  655. ?>

Documentation generated on Mon, 11 Mar 2019 14:31:38 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.