some more prettying: added pango formatting to "now playing" in Master Panel window and fixed broken ZebraTreeView::addCenteredColumn() function.

This commit is contained in:
fgerlits 2005-05-06 19:58:49 +00:00
parent d56c8131fd
commit 32376178d3
3 changed files with 40 additions and 17 deletions

View file

@ -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,

View file

@ -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<Playable>::Ref playable)
throw ()
{
Gtk::Label * label = dynamic_cast<Gtk::Label *>(
nowPlayingWidget );
if (playable) {
Ptr<Glib::ustring>::Ref infoString(new Glib::ustring);
infoString->append("<span size=\"larger\" weight=\"bold\">");
infoString->append(Glib::Markup::escape_text(*playable->getTitle()));
infoString->append("</span> ");
// TODO: rewrite this using the Core::Metadata class
Ptr<Glib::ustring>::Ref
creator = playable->getMetadata("dc:creator");
if (creator) {
infoString->append("<span size=\"larger\" weight=\"bold\">");
infoString->append(Glib::Markup::escape_text(*creator));
infoString->append("</span>");
}
label->set_markup(*infoString);
} else {
label->set_text("");
}
}

View file

@ -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;
* </code></pre>
*
* @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<Playable>::Ref playable) throw ()
{
Gtk::Label * label = dynamic_cast<Gtk::Label *>(
nowPlayingWidget );
if (playable) {
label->set_text(*playable->getTitle());
} else {
label->set_text("");
}
}
setNowPlaying(Ptr<Playable>::Ref playable) throw ();
};
/* ================================================= external data structures */