예제 #1
0
        public WebSource(string name, int order, string id)
            : base(name, name, order, id)
        {
            TypeUniqueId = id;
            Properties.Set<bool> ("Nereid.SourceContents.HeaderVisible", false);

            actions = new BansheeActionGroup (id);
            actions.Add (
                new ActionEntry ("ZoomIn"  + id, Stock.ZoomIn,  null, "<control>plus", null, (o, a) => view.ZoomIn ()),
                new ActionEntry ("ZoomOut" + id, Stock.ZoomOut, null, "<control>minus", null, (o, a) => view.ZoomOut ()),
                new ActionEntry ("Zoom100" + id, Stock.Zoom100, null, "<control>0", null, (o, a) => view.Zoom = 1f)
            );

            Properties.Set<string> ("ActiveSourceUIString", String.Format (@"
                <ui>
                  <menubar name=""MainMenu"" action=""MainMenuAction"">
                    <menu name=""ViewMenu"" action=""ViewMenuAction"">
                      <placeholder name=""ViewMenuAdditions"">
                        <separator/>
                        <menuitem action=""ZoomIn{0}""/>
                        <menuitem action=""ZoomOut{0}""/>
                        <menuitem action=""Zoom100{0}""/>
                        <separator/>
                      </placeholder>
                    </menu>
                  </menubar>
                </ui>", TypeUniqueId
            ));

            Properties.Set<BansheeActionGroup> ("ActiveSourceActions", actions);
        }
        private void OnActiveSourceChangedGui()
        {
            if (active_source_uiid > 0)
            {
                ui_manager.RemoveUi(active_source_uiid);
                active_source_uiid = 0;
            }

            if (active_source_actions != null)
            {
                RemoveActionGroup(active_source_actions.Name);
                active_source_actions = null;
            }

            Source active_source = ServiceManager.SourceManager.ActiveSource;

            if (active_source == null)
            {
                return;
            }

            bool propagate = active_source.GetInheritedProperty <bool> ("ActiveSourceUIResourcePropagate");

            active_source_actions = active_source.GetProperty <BansheeActionGroup> ("ActiveSourceActions", propagate);
            if (active_source_actions != null)
            {
                AddActionGroup(active_source_actions);
            }

            Assembly assembly =
                active_source.GetProperty <Assembly> ("ActiveSourceUIResource.Assembly", propagate) ??
                Assembly.GetAssembly(active_source.GetType());

            active_source_uiid = AddUiFromFile(active_source.GetProperty <string> ("ActiveSourceUIResource", propagate), assembly);
        }
예제 #3
0
        public NowPlayingSource()
            : base("now-playing", Catalog.GetString ("Now Playing"), 10, "now-playing")
        {
            Properties.SetString ("Icon.Name", "applications-multimedia");
            Properties.Set<bool> ("Nereid.SourceContents.HeaderVisible", false);
            Properties.SetString ("ActiveSourceUIResource", "ActiveSourceUI.xml");

            var simplified_conf = CreateSchema<bool> ("simplified_mode");

            var actions = new BansheeActionGroup ("NowPlaying");
            actions.AddImportant (new ToggleActionEntry ("SimplifyNowPlaying", null, Catalog.GetString ("Simplify"),
                "F9", Catalog.GetString ("Hide/Show the source list, menu, toolbar, and status bar"),
                delegate {
                    bool simple = !Properties.Get<bool> ("Nereid.SimpleUI");
                    Properties.Set<bool> ("Nereid.SimpleUI", simple);
                    (actions["SimplifyNowPlaying"] as ToggleAction).Active = simple;
                    simplified_conf.Set (simple);
                }, simplified_conf.Get ())
            );
            Properties.Set<bool> ("Nereid.SimpleUI", simplified_conf.Get ());
            Properties.Set<BansheeActionGroup> ("ActiveSourceActions", actions);

            ServiceManager.SourceManager.AddSource (this);

            ServiceManager.PlaybackController.Transition += OnPlaybackControllerTransition;
            ServiceManager.PlaybackController.TrackStarted += OnPlaybackControllerTrackStarted;
            ServiceManager.PlayerEngine.ConnectEvent (OnTrackInfoUpdated, PlayerEvent.TrackInfoUpdated);
            ServiceManager.PlayerEngine.ConnectEvent (OnCreateVideoWindow, PlayerEvent.PrepareVideoWindow);
        }
예제 #4
0
        private void OnActiveSourceChangedGui()
        {
            foreach (uint ui_id in active_source_uis)
            {
                if (ui_id != 0)
                {
                    UIManager.RemoveUi(ui_id);
                }
            }
            active_source_uis.Clear();

            if (active_source_actions != null)
            {
                RemoveActionGroup(active_source_actions.Name);
                active_source_actions = null;
            }

            Source active_source = ServiceManager.SourceManager.ActiveSource;

            if (active_source == null)
            {
                return;
            }

            bool propagate = active_source.GetInheritedProperty <bool> ("ActiveSourceUIResourcePropagate");

            active_source_actions = active_source.GetProperty <BansheeActionGroup> ("ActiveSourceActions", propagate);
            if (active_source_actions != null)
            {
                AddActionGroup(active_source_actions);
            }

            Assembly assembly = active_source.GetProperty <Assembly> ("ActiveSourceUIResource.Assembly", propagate) ??
                                Assembly.GetAssembly(active_source.GetType());

            active_source_uis.Add(AddUiFromFile(active_source.GetProperty <string> ("ActiveSourceUIResource", propagate), assembly));

            var ui_str = active_source.GetProperty <string> ("ActiveSourceUIString", propagate);

            if (ui_str != null)
            {
                active_source_uis.Add(UIManager.AddUiFromString(ui_str));
            }

            UIManager.EnsureUpdate();
        }
        public DuplicateSongDetectorSource()
            : base(AddinManager.CurrentLocalizer.GetString ("Duplicate Song Detector"), AddinManager.CurrentLocalizer.GetString ("Duplicate Song Detector"), sort_order, "extension-unique-id")
        {
            Properties.SetStringList ("Icon.Name", "search", "gtk-search");
            Properties.Set<Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new SongDuplicateView ());
            Properties.SetString ("ActiveSourceUIResource", "ActiveUI.xml");
            Properties.SetString ("UnmapSourceActionLabel", AddinManager.CurrentLocalizer.GetString ("Close"));
            Properties.SetString ("UnmapSourceActionIconName", "gtk-close");

            var actions = new BansheeActionGroup ("duplicate-source");
            actions.AddImportant (
                new Gtk.ActionEntry ("onStartDetecting", Gtk.Stock.Refresh, AddinManager.CurrentLocalizer.GetString ("Refresh"), null, null, (o, a) => {
                    SongDuplicateView.ReloadWindow ();
                })
            );
            actions.Register ();
        }
예제 #6
0
        public FixSource () : base (Catalog.GetString ("Metadata Fixer"), Catalog.GetString ("Metadata Fixer"), -1)
        {
            TypeUniqueId = "fixes";

            var header_widget = new HBox () { Spacing = 6 };

            header_widget.PackStart (new Label (Catalog.GetString ("Problem Type:")), false, false, 0);

            var combo = new Banshee.Widgets.DictionaryComboBox<Solver> ();
            foreach (var solver in problem_model.Solvers) {
                combo.Add (solver.Name, solver);
            }
            combo.Changed += (o, a) => {
                problem_model.Solver = combo.ActiveValue;
                SetStatus (problem_model.Solver.Description, false, false, "gtk-info");
            };
            combo.Active = 0;

            var apply_button = new Hyena.Widgets.ImageButton (Catalog.GetString ("Apply Selected Fixes"), "gtk-apply");
            apply_button.Clicked += (o, a) => problem_model.Fix ();
            problem_model.Reloaded += (o, a) => apply_button.Sensitive = problem_model.SelectedCount > 0;

            header_widget.PackStart (combo, false, false, 0);
            header_widget.PackStart (apply_button, false, false, 0);
            header_widget.ShowAll ();

            Properties.SetStringList ("Icon.Name", "search", "gtk-search");
            Properties.SetString ("ActiveSourceUIResource", "ActiveUI.xml");
            Properties.SetString ("GtkActionPath", "/FixSourcePopup");
            Properties.Set<Gtk.Widget> ("Nereid.SourceContents.HeaderWidget", header_widget);
            Properties.Set<Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new View (problem_model));
            Properties.SetString ("UnmapSourceActionLabel", Catalog.GetString ("Close"));
            Properties.SetString ("UnmapSourceActionIconName", "gtk-close");

            var actions = new BansheeActionGroup ("fix-source");
            actions.AddImportant (
                new ActionEntry ("RefreshProblems", Stock.Refresh, Catalog.GetString ("Refresh"), null, null, (o, a) => {
                    problem_model.Refresh ();
                })
            );
            actions.Register ();

            problem_model.Reload ();
        }
예제 #7
0
 public FolderSyncSource () : base (AddinManager.CurrentLocalizer.GetString ("FolderSync"),
                                    AddinManager.CurrentLocalizer.GetString ("FolderSync"),
                                    sort_order, "extension-unique-id")
 {
     Properties.SetStringList ("Icon.Name", "refresh", "gtk-refresh");
     Properties.Set<ISourceContents> ("Nereid.SourceContents", Controller);
     Properties.SetString ("ActiveSourceUIResource", "ActiveUI.xml");
     Properties.SetString ("UnmapSourceActionLabel", AddinManager.CurrentLocalizer.GetString ("Close"));
     Properties.SetString ("UnmapSourceActionIconName", "gtk-close");
     var actions = new BansheeActionGroup ("directory-sync");
     actions.AddImportant (
         new Gtk.ActionEntry ("StopSyncing", Gtk.Stock.Stop, AddinManager.CurrentLocalizer.GetString ("Stop"), null, null,
             (o, a) => {
         if (Controller != null)
             Controller.StopSync ();
         })
     );
     actions.Register ();
 }
예제 #8
0
        private BookmarkUI()
        {
            action_service = ServiceManager.Get <InterfaceActionService> ();

            actions = new BansheeActionGroup("Bookmarks");

            actions.Add(new ActionEntry [] {
                new ActionEntry("BookmarksAction", null,
                                Catalog.GetString("_Bookmarks"), null,
                                null, null),
                new ActionEntry("BookmarksAddAction", Stock.Add,
                                Catalog.GetString("_Add Bookmark"), "<control>D",
                                Catalog.GetString("Bookmark the Position in the Current Track"),
                                HandleNewBookmark)
            });

            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;

            bookmark_menu           = bookmark_item.Submenu as Menu;
            bookmark_item.Selected += HandleMenuShown;

            remove_item           = new ImageMenuItem(Catalog.GetString("_Remove Bookmark"));
            remove_item.Sensitive = false;
            remove_item.Image     = new Image(Stock.Remove, IconSize.Menu);

            remove_item.Submenu = remove_menu = new Menu();
            bookmark_menu.Append(remove_item);

            actions["BookmarksAction"].Activated += (o, a) => {
                if (!loaded)
                {
                    LoadBookmarks();
                    loaded = true;
                }
            };
        }
예제 #9
0
        private BookmarkUI ()
        {
            action_service = ServiceManager.Get<InterfaceActionService> ();

            actions = new BansheeActionGroup ("Bookmarks");

            actions.Add (new ActionEntry [] {
                new ActionEntry ("BookmarksAction", null,
                                  Catalog.GetString ("_Bookmarks"), null,
                                  null, null),
                new ActionEntry ("BookmarksAddAction", Stock.Add,
                                  Catalog.GetString ("_Add Bookmark"), "<control>D",
                                  Catalog.GetString ("Bookmark the Position in the Current Track"),
                                  HandleNewBookmark)
            });

            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;

            bookmark_menu = bookmark_item.Submenu as Menu;
            bookmark_item.Selected += HandleMenuShown;

            remove_item = new ImageMenuItem (Catalog.GetString ("_Remove Bookmark"));
            remove_item.Sensitive = false;
            remove_item.Image = new Image (Stock.Remove, IconSize.Menu);

            remove_item.Submenu = remove_menu = new Menu ();
            bookmark_menu.Append (remove_item);

            actions["BookmarksAction"].Activated += (o, a) => {
                if (!loaded) {
                    LoadBookmarks ();
                    loaded = true;
                }
            };
        }
예제 #10
0
        private void Initialize()
        {
            interface_action_service.GlobalActions.Add (new ActionEntry [] {
                new ActionEntry ("CloseAction", Stock.Close,
                    Catalog.GetString ("_Close"), "<Control>W",
                    Catalog.GetString ("Close"), CloseWindow)
            });

            actions = new BansheeActionGroup (interface_action_service, "NotificationArea");
            actions.Add (new ToggleActionEntry [] {
                new ToggleActionEntry ("ToggleNotificationsAction", null,
                    Catalog.GetString ("_Show Notifications"), null,
                    Catalog.GetString ("Show notifications when item changes"), ToggleNotifications, ShowNotifications)
            });

            interface_action_service.AddActionGroup (actions);
            ui_manager_id = (int)interface_action_service.UIManager.AddUiFromResource ("NotificationAreaMenu.xml");

            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
               PlayerEvent.StartOfStream |
               PlayerEvent.EndOfStream |
               PlayerEvent.TrackInfoUpdated |
               PlayerEvent.StateChange);

            // Forcefully load this
            show_notifications = ShowNotifications;

            artwork_manager_service = ServiceManager.Get<ArtworkManager> ();
        }
예제 #11
0
        public void Dispose()
        {
            if (disposed) {
                return;
            }

            if (current_nf != null) {
                try {
                    current_nf.Close ();
                } catch {}
            }

            if (notif_area != null) {
                notif_area.Dispose ();
                notif_area = null;
            }

            ServiceManager.PlayerEngine.DisconnectEvent (OnPlayerEvent);

            elements_service.PrimaryWindowClose = null;

            Gtk.Action close_action = interface_action_service.GlobalActions["CloseAction"];
            if (close_action != null) {
                interface_action_service.GlobalActions.Remove (close_action);
            }

            if (ui_manager_id >= 0) {
                interface_action_service.RemoveActionGroup ("NotificationArea");
                interface_action_service.UIManager.RemoveUi ((uint)ui_manager_id);
                ui_manager_id = -1;
            }

            actions = null;
            elements_service = null;
            interface_action_service = null;

            disposed = true;
        }
예제 #12
0
 public void Dispose()
 {
     actions.Dispose();
     actions  = null;
     instance = null;
 }
예제 #13
0
 public void Dispose ()
 {
     actions.Dispose ();
     actions = null;
     instance = null;
 }
예제 #14
0
        private void Initialize ()
        {
            interface_action_service.GlobalActions.Add (new ActionEntry [] {
                new ActionEntry ("CloseAction", Stock.Close,
                    AddinManager.CurrentLocalizer.GetString ("_Close"), "<Control>W",
                    AddinManager.CurrentLocalizer.GetString ("Close"), CloseWindow)
            });

            actions = new BansheeActionGroup (interface_action_service, "AppIndicator");
            actions.Add (new ToggleActionEntry [] {
                new ToggleActionEntry ("ShowHideAction", null,
                    AddinManager.CurrentLocalizer.GetString ("_Show Banshee"), null,
                    AddinManager.CurrentLocalizer.GetString ("Show the Banshee main window"), ToggleShowHide, PrimaryWindowVisible)
            });

            interface_action_service.AddActionGroup (actions);
            ui_manager_id = (int)interface_action_service.UIManager.AddUiFromResource ("AppIndicatorMenu.xml");

            ServiceManager.PlayerEngine.ConnectEvent (OnPlayerEvent,
               PlayerEvent.StartOfStream |
               PlayerEvent.EndOfStream |
               PlayerEvent.TrackInfoUpdated |
               PlayerEvent.StateChange);

            artwork_manager_service = ServiceManager.Get<ArtworkManager> ();
            artwork_manager_service.AddCachedSize (icon_size);

            // Forcefully load this
            show_notifications = ShowNotifications;

            DrawAppIndicator ();
        }
예제 #15
0
        private void OnActiveSourceChangedGui ()
        {
            foreach (uint ui_id in active_source_uis) {
                if (ui_id != 0) {
                    UIManager.RemoveUi (ui_id);
                }
            }
            active_source_uis.Clear ();

            if (active_source_actions != null) {
                RemoveActionGroup (active_source_actions.Name);
                active_source_actions = null;
            }

            Source active_source = ServiceManager.SourceManager.ActiveSource;
            if (active_source == null) {
                return;
            }

            bool propagate = active_source.GetInheritedProperty<bool> ("ActiveSourceUIResourcePropagate");

            active_source_actions = active_source.GetProperty<BansheeActionGroup> ("ActiveSourceActions", propagate);
            if (active_source_actions != null) {
                AddActionGroup (active_source_actions);
            }

            Assembly assembly = active_source.GetProperty<Assembly> ("ActiveSourceUIResource.Assembly", propagate) ??
                Assembly.GetAssembly (active_source.GetType ());
            active_source_uis.Add (AddUiFromFile (active_source.GetProperty<string> ("ActiveSourceUIResource", propagate), assembly));

            var ui_str = active_source.GetProperty<string> ("ActiveSourceUIString", propagate);
            if (ui_str != null) {
                active_source_uis.Add (UIManager.AddUiFromString (ui_str));
            }

            UIManager.EnsureUpdate ();
        }