From 32376178d3e2cbefc5fb0372fbfc69b45d7aebac Mon Sep 17 00:00:00 2001 From: fgerlits Date: Fri, 6 May 2005 19:58:49 +0000 Subject: [PATCH] some more prettying: added pango formatting to "now playing" in Master Panel window and fixed broken ZebraTreeView::addCenteredColumn() function. --- .../modules/widgets/src/ZebraTreeView.cxx | 8 ++--- .../gLiveSupport/src/MasterPanelWindow.cxx | 34 ++++++++++++++++++- .../gLiveSupport/src/MasterPanelWindow.h | 15 ++------ 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/livesupport/modules/widgets/src/ZebraTreeView.cxx b/livesupport/modules/widgets/src/ZebraTreeView.cxx index 29f694bf6..f3fa38c71 100644 --- a/livesupport/modules/widgets/src/ZebraTreeView.cxx +++ b/livesupport/modules/widgets/src/ZebraTreeView.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.11 $ + Version : $Revision: 1.12 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/ZebraTreeView.cxx,v $ ------------------------------------------------------------------------------*/ @@ -175,6 +175,9 @@ ZebraTreeView :: appendCenteredColumn( // a standard cell renderer; can be replaced with a ZebraCellRenderer Gtk::CellRendererText* renderer = Gtk::manage(new Gtk::CellRendererText); + // center the text in the column + renderer->property_xalign() = 0.5; + // the constructor packs the renderer into the TreeViewColumn Gtk::TreeViewColumn* viewColumn = Gtk::manage(new Gtk::TreeViewColumn(title, *renderer) ); @@ -182,9 +185,6 @@ ZebraTreeView :: appendCenteredColumn( // and then we associate this renderer with the model column viewColumn->add_attribute(renderer->property_markup(), modelColumn); - // center the text in the column - viewColumn->set_alignment(Gtk::ALIGN_CENTER); - // this cell data function will do the blue-gray zebra stripes viewColumn->set_cell_data_func( *renderer, diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx index 1a781968d..0a5429634 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.29 $ + Version : $Revision: 1.30 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -561,3 +561,35 @@ MasterPanelWindow :: getNextItemToPlay() throw () } } + +/*------------------------------------------------------------------------------ + * Set the "now playing" display. + *----------------------------------------------------------------------------*/ +void +MasterPanelWindow :: setNowPlaying(Ptr::Ref playable) + throw () +{ + Gtk::Label * label = dynamic_cast( + nowPlayingWidget ); + if (playable) { + Ptr::Ref infoString(new Glib::ustring); + + infoString->append(""); + infoString->append(Glib::Markup::escape_text(*playable->getTitle())); + infoString->append(" "); + + // TODO: rewrite this using the Core::Metadata class + + Ptr::Ref + creator = playable->getMetadata("dc:creator"); + if (creator) { + infoString->append(""); + infoString->append(Glib::Markup::escape_text(*creator)); + infoString->append(""); + } + label->set_markup(*infoString); + } else { + label->set_text(""); + } +} + diff --git a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h index eee1fce62..57fd532eb 100644 --- a/livesupport/products/gLiveSupport/src/MasterPanelWindow.h +++ b/livesupport/products/gLiveSupport/src/MasterPanelWindow.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.17 $ + Version : $Revision: 1.18 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -91,7 +91,7 @@ using namespace LiveSupport::Widgets; * * * @author $Author: fgerlits $ - * @version $Revision: 1.17 $ + * @version $Revision: 1.18 $ */ class MasterPanelWindow : public Gtk::Window, public LocalizedObject { @@ -451,16 +451,7 @@ class MasterPanelWindow : public Gtk::Window, public LocalizedObject * Set the "now playing" display. */ void - setNowPlaying(Ptr::Ref playable) throw () - { - Gtk::Label * label = dynamic_cast( - nowPlayingWidget ); - if (playable) { - label->set_text(*playable->getTitle()); - } else { - label->set_text(""); - } - } + setNowPlaying(Ptr::Ref playable) throw (); }; /* ================================================= external data structures */