[banshee] [GtkElementService] Add content window APIs
- From: Aaron Bockover <abock src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee] [GtkElementService] Add content window APIs
- Date: Sun, 11 Oct 2009 17:05:37 +0000 (UTC)
commit 7a6fbd0e692c7be0d157a66d4c47a6f1428af1dc
Author: Aaron Bockover <abockover novell com>
Date: Sun Oct 11 12:57:24 2009 -0400
[GtkElementService] Add content window APIs
Three new APIs that allow extensions/clients to register arbitrary
content windows. A content window is a window that immerses the
user in media content (e.g. the Moblin media panel).
Provides RegisterContentWindow, UnregisterContentWindow, and
an enumerable ContentWindows property.
Patch the NotificationAreaService to iterate over ContentWindows
instead of just checking the PrimaryWindow for toplevel focus
to determine if it is appropriate to show a notification.
.../Banshee.Gui/GtkElementsService.cs | 34 ++++++++++++++++++++
.../NotificationAreaService.cs | 8 ++++-
2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkElementsService.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkElementsService.cs
index 855a3f4..503bc2a 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/GtkElementsService.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/GtkElementsService.cs
@@ -111,6 +111,40 @@ namespace Banshee.Gui
}
}
+ private List<Window> content_windows;
+ public IEnumerable<Window> ContentWindows {
+ get {
+ if (PrimaryWindow != null) {
+ yield return PrimaryWindow;
+ }
+
+ if (content_windows != null) {
+ foreach (var window in content_windows) {
+ yield return window;
+ }
+ }
+ }
+ }
+
+ public void RegisterContentWindow (Window window)
+ {
+ if (content_windows == null) {
+ content_windows = new List<Window> ();
+ }
+
+ content_windows.Add (window);
+ }
+
+ public void UnregisterContentWindow (Window window)
+ {
+ if (content_windows != null) {
+ content_windows.Remove (window);
+ if (content_windows.Count == 0) {
+ content_windows = null;
+ }
+ }
+ }
+
public PrimaryWindowCloseHandler PrimaryWindowClose {
get { return primary_window_close_handler; }
set { primary_window_close_handler = value; }
diff --git a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
index 60be5d5..05eb469 100644
--- a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
+++ b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
@@ -410,10 +410,16 @@ namespace Banshee.NotificationArea
notify_last_title = current_track.DisplayTrackTitle;
notify_last_artist = current_track.DisplayArtistName;
- if (!show_notifications || elements_service.PrimaryWindow.HasToplevelFocus) {
+ if (!show_notifications) {
return;
}
+ foreach (var window in elements_service.ContentWindows) {
+ if (window.HasToplevelFocus) {
+ return;
+ }
+ }
+
bool is_notification_daemon = false;
try {
var name = Notifications.Global.ServerInformation.Name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]