/** * 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); }