Example #1
0
 /**
  * Initialize
  *
  */
 public function init()
 {
     $this->window->set_default_size(320, 140);
     // Message
     $this->label = $this->widget('label');
     // Icon
     $this->icon = $this->widget('icon');
     $loader = new GTKPixmapLoader($this->window->window, dirname(__FILE__));
     try {
         $this->pixmaps = $loader->load(array('information', 'warning', 'question', 'error'));
     } catch (IOException $e) {
         $this->cat->error($e->getStackTrace());
         // Well, we'll be without icons, then
     }
     // Action area
     $this->actionarea = $this->window->action_area;
 }
Example #2
0
 /**
  * Initialize application
  *
  */
 public function init()
 {
     $this->window->set_default_size(400, 420);
     // File list
     $this->files = $this->widget('clist_files');
     $this->files->set_row_height(26);
     $this->files->set_sort_column(1);
     // Sort by type
     $this->connect($this->files, 'select_row', 'onEntrySelected');
     // Location
     $this->location = $this->widget('entry_location');
     // Combo
     $this->combo = $this->widget('combo_dir');
     // Buttons
     foreach (array('ok' => 'onClose', 'cancel' => 'onClose', 'up' => 'onUpDirClicked', 'home' => 'onHomeClicked', 'refresh' => 'onRefreshClicked', 'next' => 'onPNClicked', 'prev' => 'onPNClicked') as $n => $callback) {
         $this->buttons[$n] = $this->connect($this->widget('button_' . $n), 'clicked', $callback);
     }
     // Favorites
     $this->favorites = $this->widget('bar_favorites');
     $this->favorites->set_button_relief(GTK_RELIEF_NONE);
     $view = $this->widget('view_favorites');
     $style = Gtk::widget_get_default_style();
     $style->base[GTK_STATE_NORMAL] = $style->mid[GTK_STATE_NORMAL];
     $view->set_style($style);
     GTKWidgetUtil::connectChildren($this->widget('bar_favorites'), array(':clicked' => array($this, 'onFavoriteClicked')));
     // History
     $this->history = array();
     $this->history_offset = 0;
     // Load pixmaps
     $this->pixmaps = array();
     $if = new Folder(dirname(__FILE__) . '/icons/');
     $loader = new GTKPixmapLoader($this->window->window, $if->uri);
     try {
         while ($entry = $if->getEntry()) {
             if ('.xpm' != substr($entry, -4)) {
                 continue;
             }
             $entry = substr($entry, 0, -4);
             $this->pixmaps = array_merge($this->pixmaps, $loader->load($entry));
         }
         $if->close();
     } catch (IOException $e) {
         $this->cat->error($e);
         // Fall through, this is not critical
     }
     // Read files
     $this->setDirectory($this->dir);
 }