[banshee] [Bookmarks] Fix UI not getting loaded (bgo#632715)
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] [Bookmarks] Fix UI not getting loaded (bgo#632715)
- Date: Wed, 20 Oct 2010 17:12:34 +0000 (UTC)
commit 4736806dd9ff727f7dfbac077d85c36713220dec
Author: Gabriel Burt <gabriel burt gmail com>
Date: Wed Oct 20 12:03:50 2010 -0500
[Bookmarks] Fix UI not getting loaded (bgo#632715)
.../Banshee.ThickClient/Banshee.Gui/BookmarkUI.cs | 25 +++++++++++--------
.../Banshee.Gui/BookmarksService.cs | 4 +-
src/Core/Banshee.ThickClient/Makefile.am | 1 +
3 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarkUI.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarkUI.cs
index d071147..c7944fd 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarkUI.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarkUI.cs
@@ -59,15 +59,15 @@ namespace Banshee.Gui
private Dictionary<MenuItem, Bookmark> bookmark_map = new Dictionary<MenuItem, Bookmark> ();
private InterfaceActionService action_service;
- private ActionGroup actions;
- private uint ui_manager_id;
+ private BansheeActionGroup actions;
private bool loaded;
private static BookmarkUI instance = null;
public static BookmarkUI Instance {
get {
- if (instance == null)
+ if (instance == null) {
instance = new BookmarkUI ();
+ }
return instance;
}
}
@@ -80,7 +80,7 @@ namespace Banshee.Gui
{
action_service = ServiceManager.Get<InterfaceActionService> ();
- actions = new ActionGroup ("Bookmarks");
+ actions = new BansheeActionGroup ("Bookmarks");
actions.Add (new ActionEntry [] {
new ActionEntry ("BookmarksAction", null,
@@ -92,8 +92,9 @@ namespace Banshee.Gui
HandleNewBookmark)
});
- action_service.UIManager.InsertActionGroup (actions, 0);
- ui_manager_id = action_service.UIManager.AddUiFromResource ("BookmarksMenu.xml");
+ actions.AddUiFromFile ("BookmarksMenu.xml");
+ actions.Register ();
+
bookmark_item = action_service.UIManager.GetWidget ("/MainMenu/ToolsMenu/Bookmarks") as ImageMenuItem;
new_item = action_service.UIManager.GetWidget ("/MainMenu/ToolsMenu/Bookmarks/Add") as ImageMenuItem;
@@ -140,7 +141,12 @@ namespace Banshee.Gui
separator = new SeparatorMenuItem ();
foreach (var bookmark in Bookmark.Provider.FetchAllMatching ("Type IS NULL")) {
- AddBookmark (bookmark);
+ if (bookmark.Track != null) {
+ AddBookmark (bookmark);
+ } else {
+ Hyena.Log.DebugFormat ("Removing bookmark that points to missing track ({0})", bookmark.Position);
+ bookmark.Remove ();
+ }
}
bookmark_item.ShowAll ();
@@ -161,7 +167,6 @@ namespace Banshee.Gui
ImageMenuItem select_item = new ImageMenuItem (bookmark.Name.Replace ("_", "__"));
select_item.Image = new Image (Stock.JumpTo, IconSize.Menu);
select_item.Activated += delegate {
- Console.WriteLine ("item delegate, main thread? {0}", ThreadAssist.InMainThread);
bookmark.JumpTo ();
};
bookmark_menu.Append (select_item);
@@ -201,10 +206,8 @@ namespace Banshee.Gui
public void Dispose ()
{
- action_service.UIManager.RemoveUi (ui_manager_id);
- action_service.UIManager.RemoveActionGroup (actions);
+ actions.Dispose ();
actions = null;
-
instance = null;
}
}
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarksService.cs b/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarksService.cs
index e28f42b..4c93461 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarksService.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui/BookmarksService.cs
@@ -43,7 +43,7 @@ using Banshee.ServiceStack;
namespace Banshee.Gui
{
- public class BookmarksService : IExtensionService, IDisposable
+ public class BookmarksService : IInitializeService, IDisposable
{
private BookmarkUI ui;
@@ -51,7 +51,7 @@ namespace Banshee.Gui
{
}
- void IExtensionService.Initialize ()
+ void IInitializeService.Initialize ()
{
ui = BookmarkUI.Instance;
}
diff --git a/src/Core/Banshee.ThickClient/Makefile.am b/src/Core/Banshee.ThickClient/Makefile.am
index 1f1b999..f3a702a 100644
--- a/src/Core/Banshee.ThickClient/Makefile.am
+++ b/src/Core/Banshee.ThickClient/Makefile.am
@@ -165,6 +165,7 @@ SOURCES = \
RESOURCES = \
Banshee.ThickClient.addin.xml \
+ Resources/BookmarksMenu.xml \
Resources/banshee-logo.png \
Resources/browser-album-cover.png \
Resources/context-pane-close.png \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]