// src/ready_queue_widget.cc - Copyright 2005, 2006, University // of Padova, dept. of Pure and Applied // Mathematics // // This file is part of SGPEMv2. // // This is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // SGPEMv2 is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with SGPEMv2; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "gettext.h" #include "ready_queue_widget.hh" #include "backend/history.hh" #include "backend/environment.hh" #include "backend/ready_queue.hh" #include "backend/thread.hh" #include #include #include using namespace sgpem; static const Glib::ustring string_start = _("Ready queue: { "); static const Glib::ustring string_end = " }"; static const Glib::ustring separator = " ~ "; ReadyQueueWidget::ReadyQueueWidget(History& history) : Gtk::Label(string_start + string_end), _h(history) { _h.attach(*this); set_use_markup(true); set_justify(Gtk::JUSTIFY_LEFT); set_padding(5, 3); } ReadyQueueWidget::~ReadyQueueWidget() { _h.detach(*this); } void ReadyQueueWidget::update(const History& changed_history) { Glib::ustring text(string_start); const ReadyQueue& rq = changed_history.get_last_environment().get_sorted_queue(); size_t size = rq.size(); for(size_t i = 0; i < size; ++i) text += Glib::Markup::escape_text(rq.get_item_at(i).get_name()) + separator; text += string_end; set_markup(text); }