Exemple #1
0
        // Plugin initializer
        public override void Initialize(IPlayer player)
        {
            // Initialize gettext
            Catalog.Init("muine", Defines.GNOME_LOCALE_DIR);

            GConf.Client gconf_client = new GConf.Client();
            gconf_client.AddNotify(GConfKeyShowNotifications,
                                   new GConf.NotifyEventHandler(OnShowNotificationsChanged));
            showNotifications = (bool)gconf_client.Get(GConfKeyShowNotifications);

            // Load stock icons
            InitStockIcons();

            // Connect to player
            this.player = player;

            player.SongChangedEvent  += OnSongChangedEvent;
            player.StateChangedEvent += OnStateChangedEvent;

            // Install "Hide Window" menu item
            player.UIManager.AddUi(player.UIManager.NewMergeId(),
                                   "/MenuBar/FileMenu/ExtraFileActions", "ToggleVisibleMenuItem",
                                   "ToggleVisible", UIManagerItemType.Menuitem, false);

            // Build menu
            player.UIManager.AddUiFromResource("TrayIcon.xml");

            // Setup GConf
            gconf_client = new GConf.Client();
            gconf_client.AddNotify(old_behaviour_key, BehaviourNotify);
            try {
                old_mouse_behaviour = (bool)gconf_client.Get(old_behaviour_key);
            } catch {
                old_mouse_behaviour = false;
                gconf_client.Set(old_behaviour_key, false);
            }

            // Maybe prevent 'delete' event from closing window by intercepting it
            player.Window.WidgetEvent += new WidgetEventHandler(OnWindowEvent);

            menu              = (Menu)player.UIManager.GetWidget("/Menu");
            menu.Deactivated += OnMenuDeactivated;

            // Init tooltips -- we init into "not playing" state
            tooltips = new Tooltips();
            tooltips.Disable();

            // init icon
            Init();
        }
Exemple #2
0
        // Handlers :: OnStateChangedEvent
        private void OnStateChangedEvent(bool playing)
        {
            if (playing)
            {
                tooltips.Enable();
            }
            else
            {
                tooltips.Disable();
            }

            this.playing = playing;

            UpdateImage();
        }