[banshee] [Nereid] Allow customizing the src title widget
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Nereid] Allow customizing the src title widget
- Date: Sat, 15 May 2010 20:17:44 +0000 (UTC)
commit 7839092494cfecc4c4f37bbb85a96c3f79b22251
Author: Gabriel Burt <gabriel burt gmail com>
Date: Sat May 15 13:16:15 2010 -0700
[Nereid] Allow customizing the src title widget
src/Clients/Nereid/Nereid/PlayerInterface.cs | 2 +
src/Clients/Nereid/Nereid/ViewContainer.cs | 37 +++++++++++++++++++++----
2 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/src/Clients/Nereid/Nereid/PlayerInterface.cs b/src/Clients/Nereid/Nereid/PlayerInterface.cs
index 74b4a23..aef883e 100644
--- a/src/Clients/Nereid/Nereid/PlayerInterface.cs
+++ b/src/Clients/Nereid/Nereid/PlayerInterface.cs
@@ -525,6 +525,8 @@ namespace Nereid
view_container.Header.Visible = source.Properties.Contains ("Nereid.SourceContents.HeaderVisible") ?
source.Properties.Get<bool> ("Nereid.SourceContents.HeaderVisible") : true;
+ view_container.SetTitleWidget (source.Properties.Get<Widget> ("Nereid.SourceContents.TitleWidget"));
+
Widget header_widget = null;
if (source.Properties.Contains ("Nereid.SourceContents.HeaderWidget")) {
header_widget = source.Properties.Get<Widget> ("Nereid.SourceContents.HeaderWidget");
diff --git a/src/Clients/Nereid/Nereid/ViewContainer.cs b/src/Clients/Nereid/Nereid/ViewContainer.cs
index efe388a..c162f4b 100644
--- a/src/Clients/Nereid/Nereid/ViewContainer.cs
+++ b/src/Clients/Nereid/Nereid/ViewContainer.cs
@@ -41,14 +41,16 @@ using Banshee.ServiceStack;
namespace Nereid
{
-
public class ViewContainer : VBox
{
private SearchEntry search_entry;
private HBox header;
private Alignment header_align;
private EventBox header_box;
+
+ private EventBox default_title_box;
private Label title_label;
+ private HBox custom_title_box;
private Banshee.ContextPane.ContextPane context_pane;
private VBox footer;
@@ -73,19 +75,19 @@ namespace Nereid
header = new HBox ();
footer = new VBox ();
- EventBox title_box = new EventBox ();
+ default_title_box = new EventBox ();
title_label = new Label ();
title_label.Xalign = 0.0f;
title_label.Ellipsize = Pango.EllipsizeMode.End;
- title_box.Add (title_label);
+ default_title_box.Add (title_label);
// Show the source context menu when the title is right clicked
- title_box.PopupMenu += delegate {
+ default_title_box.PopupMenu += delegate {
ServiceManager.Get<InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate ();
};
- title_box.ButtonPressEvent += delegate (object o, ButtonPressEventArgs press) {
+ default_title_box.ButtonPressEvent += delegate (object o, ButtonPressEventArgs press) {
if (press.Event.Button == 3) {
ServiceManager.Get<InterfaceActionService> ().SourceActions ["SourceContextMenuAction"].Activate ();
}
@@ -93,9 +95,12 @@ namespace Nereid
header_box = new EventBox ();
+ custom_title_box = new HBox () { Visible = false };
+
BuildSearchEntry ();
- header.PackStart (title_box, true, true, 0);
+ header.PackStart (default_title_box, true, true, 0);
+ header.PackStart (custom_title_box, true, true, 0);
header.PackStart (header_box, false, false, 0);
header.PackStart (search_entry, false, false, 0);
@@ -237,6 +242,26 @@ namespace Nereid
get { return search_entry; }
}
+ public void SetTitleWidget (Widget widget)
+ {
+ var child = custom_title_box.Children.Length == 0 ? null : custom_title_box.Children[0];
+ if (widget == child) {
+ return;
+ }
+
+ if (child != null) {
+ custom_title_box.Remove (child);
+ }
+
+ if (widget != null) {
+ widget.Show ();
+ custom_title_box.PackStart (widget, false, false, 0);
+ }
+
+ custom_title_box.Visible = widget != null;
+ default_title_box.Visible = widget == null;
+ }
+
public ISourceContents Content {
get { return content; }
set {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]