예제 #1
0
 // Insert widget at index, wrapping a ToolItem around it if needed
 void ToolItemize(Gtk.Widget widget, int index)
 {
     Gtk.ToolItem toolItem = widget as Gtk.ToolItem;
     if (toolItem == null)
     {
         toolItem = new Gtk.ToolItem();
         toolItem.Show();
         toolItem.Add(widget);
     }
     toolbar.Insert(toolItem, index);
 }
예제 #2
0
        void Initialize(ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups, bool singleGroupMode)
        {
            this.frontend        = frontend;
            this.singleGroupMode = singleGroupMode;
            IconSize             = Gtk.IconSize.SmallToolbar;
            Orientation          = Gtk.Orientation.Horizontal;
            ToolbarStyle         = Gtk.ToolbarStyle.BothHoriz;

            combo = Gtk.ComboBox.NewText();

            if (!singleGroupMode)
            {
                combo.Changed += OnActiveChanged;

                Gtk.ToolItem comboItem = new Gtk.ToolItem();
                Gtk.HBox     cbox      = new Gtk.HBox();
                cbox.PackStart(new Gtk.Label(Catalog.GetString("Action Group:") + " "), false, false, 3);
                cbox.PackStart(combo, true, true, 3);
                comboItem.Add(cbox);
                comboItem.ShowAll();
                Insert(comboItem, -1);
                internalButtons.Add(comboItem);

                addButton          = new Gtk.ToolButton(Gtk.Stock.Add);
                addButton.Clicked += OnAddGroup;
                Insert(addButton, -1);
                internalButtons.Add(addButton);

                removeButton          = new Gtk.ToolButton(Gtk.Stock.Remove);
                removeButton.Clicked += OnRemoveGroup;
                Insert(removeButton, -1);
                internalButtons.Add(removeButton);

                ActionGroups = actionGroups;

                if (actionGroups != null && actionGroups.Count > 0)
                {
                    combo.Active = 0;
                }
            }
            else
            {
                UpdateActionCommands(null);
            }

            ShowAll();
        }
		void Initialize (ActionGroupDesignerFrontend frontend, Wrapper.ActionGroupCollection actionGroups, bool singleGroupMode)
		{
			this.frontend = frontend;
			this.singleGroupMode = singleGroupMode;
			IconSize = Gtk.IconSize.SmallToolbar;
			Orientation = Gtk.Orientation.Horizontal;
			ToolbarStyle = Gtk.ToolbarStyle.BothHoriz;
			
			combo = Gtk.ComboBox.NewText ();
			
			if (!singleGroupMode) {
				combo.Changed += OnActiveChanged;

				Gtk.ToolItem comboItem = new Gtk.ToolItem ();
				Gtk.HBox cbox = new Gtk.HBox ();
				cbox.PackStart (new Gtk.Label (Catalog.GetString ("Action Group:") + " "), false, false, 3);
				cbox.PackStart (combo, true, true, 3);
				comboItem.Add (cbox);
				comboItem.ShowAll ();
				Insert (comboItem, -1);
				internalButtons.Add (comboItem);
				
				addButton = new Gtk.ToolButton (Gtk.Stock.Add);
				addButton.Clicked += OnAddGroup;
				Insert (addButton, -1);
				internalButtons.Add (addButton);
				
				removeButton = new Gtk.ToolButton (Gtk.Stock.Remove);
				removeButton.Clicked += OnRemoveGroup;
				Insert (removeButton, -1);
				internalButtons.Add (removeButton);
				
				ActionGroups = actionGroups;
				
				if (actionGroups != null && actionGroups.Count > 0)
					combo.Active = 0;
			} else {
				UpdateActionCommands (null);
			}

			ShowAll ();
		}
예제 #4
0
파일: MenuWidget.cs 프로젝트: vith/smuxi
        public MenuWidget(Gtk.Window parent, ChatViewManager chatViewManager)
        {
            if (parent == null) {
                throw new ArgumentNullException("parent");
            }
            if (chatViewManager == null) {
                throw new ArgumentNullException("chatViewManager");
            }

            Parent = parent;
            MainWindow = parent as MainWindow;
            ChatViewManager = chatViewManager;

            Build();

            // Smuxi Menu
            f_QuitAction.IconName = Gtk.Stock.Quit;

            // Chat
            f_JoinChatAction.IconName = Gtk.Stock.Open;
            f_FindGroupChatAction.IconName = Gtk.Stock.Find;
            f_OpenLogAction.IconName = Gtk.Stock.Open;
            f_CloseChatAction.IconName = Gtk.Stock.Close;

            // Engine
            f_AddRemoteEngineAction.IconName = Gtk.Stock.Add;
            f_SwitchRemoteEngineAction.IconName = Gtk.Stock.Refresh;

            // Toolbar
            f_ConnectToolAction.IconName = Gtk.Stock.Network;
            f_OpenLogToolAction.IconName = Gtk.Stock.Open;
            f_FindGroupChatToolAction.IconName = Gtk.Stock.Find;

            f_MenuBar.ShowAll();
            f_MenuBar.NoShowAll = true;
            f_MenuBar.Visible = (bool) Frontend.FrontendConfig["ShowMenuBar"];

            JoinWidget = new JoinWidget();
            JoinWidget.NoShowAll = true;
            JoinWidget.Visible = (bool) Frontend.FrontendConfig["ShowQuickJoin"];
            JoinWidget.Activated += OnJoinWidgetActivated;

            var joinToolItem = new Gtk.ToolItem();
            joinToolItem.Add(JoinWidget);
            f_JoinToolbar.Add(joinToolItem);
            f_JoinToolbar.ShowAll();

            f_ShowMenubarAction.Active = (bool) Frontend.FrontendConfig["ShowMenuBar"];
            f_ShowStatusbarAction.Active = (bool) Frontend.FrontendConfig["ShowStatusBar"];
            f_ShowJoinBarAction.Active = JoinWidget.Visible;

            if (Frontend.IsMacOSX) {
                // Smuxi menu is already shown as app menu
                f_SmuxiAction.Visible = false;
                // About item is already shown in app menu
                f_AboutAction.Visible = false;

                IgeMacMenu.GlobalKeyHandlerEnabled = true;
                IgeMacMenu.MenuBar = f_MenuBar;
                f_ShowMenubarAction.Active = false;

                var appGroup = IgeMacMenu.AddAppMenuGroup();
                appGroup.AddMenuItem(
                    (Gtk.MenuItem) f_AboutAction.CreateMenuItem(),
                    _("About Smuxi")
                );
                var prefItem = (Gtk.MenuItem) f_PreferencesAction.CreateMenuItem();
                // TODO: add cmd+, accelerator
                appGroup.AddMenuItem(prefItem, _("Preferences"));
                IgeMacMenu.QuitMenuItem = (Gtk.MenuItem)
                    f_QuitAction.CreateMenuItem();
            }
        }
예제 #5
0
        public MenuWidget(Gtk.Window parent, ChatViewManager chatViewManager)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (chatViewManager == null)
            {
                throw new ArgumentNullException("chatViewManager");
            }

            Parent          = parent;
            MainWindow      = parent as MainWindow;
            ChatViewManager = chatViewManager;

            Build();

            // Smuxi Menu
            f_QuitAction.IconName = Gtk.Stock.Quit;

            // Chat
            f_JoinChatAction.IconName      = Gtk.Stock.Open;
            f_FindGroupChatAction.IconName = Gtk.Stock.Find;
            f_OpenLogAction.IconName       = Gtk.Stock.Open;
            f_CloseChatAction.IconName     = Gtk.Stock.Close;

            // Engine
            f_AddRemoteEngineAction.IconName    = Gtk.Stock.Add;
            f_SwitchRemoteEngineAction.IconName = Gtk.Stock.Refresh;

            // Toolbar
            f_ConnectToolAction.IconName       = Gtk.Stock.Network;
            f_OpenLogToolAction.IconName       = Gtk.Stock.Open;
            f_FindGroupChatToolAction.IconName = Gtk.Stock.Find;

            // disable the open log buttons initially as they will only be
            // enabled for chats that have a log file in
            // MainWindow.OnNotebookSwitchPage()
            f_OpenLogAction.Sensitive     = false;
            f_OpenLogToolAction.Sensitive = false;

            f_MenuToolbar.ShowAll();
            f_MenuToolbar.NoShowAll = true;
            f_MenuToolbar.Visible   = (bool)Frontend.FrontendConfig["ShowToolBar"];

            f_MenuBar.ShowAll();
            f_MenuBar.NoShowAll = true;
            f_MenuBar.Visible   = (bool)Frontend.FrontendConfig["ShowMenuBar"];

            JoinWidget            = new JoinWidget();
            JoinWidget.NoShowAll  = true;
            JoinWidget.Activated += OnJoinWidgetActivated;

            var joinToolItem = new Gtk.ToolItem();

            joinToolItem.Add(JoinWidget);
            f_JoinToolbar.Add(joinToolItem);
            f_JoinToolbar.ShowAll();
            f_JoinToolbar.NoShowAll = true;
            f_JoinToolbar.Visible   = f_MenuToolbar.Visible;

            f_ShowMenubarAction.Active   = (bool)Frontend.FrontendConfig["ShowMenuBar"];
            f_ShowToolbarAction.Active   = (bool)Frontend.FrontendConfig["ShowToolBar"];
            f_ShowStatusbarAction.Active = (bool)Frontend.FrontendConfig["ShowStatusBar"];

            if (Frontend.IsMacOSX)
            {
                try {
                    IgeMacMenu.GlobalKeyHandlerEnabled = true;
                    IgeMacMenu.MenuBar         = f_MenuBar;
                    f_ShowMenubarAction.Active = false;
                    // no need for the menu bar as have the app menu
                    f_ShowMenubarAction.Visible = false;

                    var appGroup = IgeMacMenu.AddAppMenuGroup();
                    appGroup.AddMenuItem(
                        (Gtk.MenuItem)f_AboutAction.CreateMenuItem(),
                        _("About Smuxi")
                        );
                    var prefItem = (Gtk.MenuItem)f_PreferencesAction.CreateMenuItem();
                    // TODO: add cmd+, accelerator
                    appGroup.AddMenuItem(prefItem, _("Preferences"));
                    IgeMacMenu.QuitMenuItem = (Gtk.MenuItem)
                                              f_QuitAction.CreateMenuItem();

                    // Smuxi menu is already shown as app menu
                    f_SmuxiAction.Visible = false;
                    // About item is already shown in app menu
                    f_AboutAction.Visible = false;
                } catch (EntryPointNotFoundException ex) {
                    f_Logger.Error("Failed to initialize mac menu integration, disabling mac menu integration", ex);
                }
            }
        }
        public CueSheetsSource() : base(AddinManager.CurrentLocalizer.GetString("CueSheets"),
                                        AddinManager.CurrentLocalizer.GetString("CueSheets"),
                                                    //"cuesheets",
                                        sort_order) //,
            //"hod-cuesheets-2013-01-06")
        {
            Hyena.Log.Information("CueSheetsSouce init");

            DbConnection = ServiceManager.DbConnection;
            TM_Provider  = DatabaseTrackInfo.Provider;

            _track_info_db = new CS_TrackInfoDb(DbConnection);

            _sheet  = new CueSheet();
            _sheets = new CueSheetCollection();

            _view = new CueSheetsView(this);

            Properties.Set <ISourceContents> ("Nereid.SourceContents", _view);
            Properties.SetString("Icon.Name", "cueplay");
            Hyena.Log.Information("CueSheets source has been instantiated.");

            Properties.Set <string> ("SearchEntryDescription", Catalog.GetString("Search albums and tracks"));

            try {
                Properties.SetString("GtkActionPath", "/CueSheetsPopup");
                _actions = new CS_Actions(this);
                Hyena.Log.Information(_actions.ToString());
            } catch (System.Exception ex) {
                Hyena.Log.Information(ex.ToString());
            }

            InterfaceActionService action_service = ServiceManager.Get <InterfaceActionService> ();

            try {
                _track_search          = new Gtk.CheckButton("Search Tracks");
                _track_search.Clicked += delegate(object sender, EventArgs args) {
                    this.DoFilter();
                };
                Gtk.Toolbar header_toolbar = (Gtk.Toolbar)action_service.UIManager.GetWidget("/HeaderToolbar");
                int         i, N, k;
                for (i = 0, k = -1, N = header_toolbar.NItems; i < N; i++)
                {
                    Gtk.Widget w = header_toolbar.GetNthItem(i).Child;
                    if (w != null)
                    {
                        if (w.GetType() == typeof(Banshee.Gui.Widgets.ConnectedVolumeButton))
                        {
                            k = i;
                        }
                    }
                }
                if (k >= 0)
                {
                    Hyena.Log.Information("Toolitem itm");
                    Gtk.ToolItem itm = new Gtk.ToolItem();
                    Hyena.Log.Information("Add cbk");
                    itm.Add(_track_search);
                    Hyena.Log.Information("Insert cbk");
                    header_toolbar.Insert(itm, k);
                    itm.Show();
                }
            } catch (System.Exception ex) {
                Hyena.Log.Error(ex.ToString());
            }
            Gtk.Menu viewMenu = (action_service.UIManager.GetWidget("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu;
            _menuItem            = new Gtk.MenuItem(Catalog.GetString("_Change Album View"));
            _menuItem.Activated += delegate {
                _view.ToggleGrid();
            };
            viewMenu.Insert(_menuItem, 2);
            _sep = new Gtk.SeparatorMenuItem();
            viewMenu.Insert(_sep, 3);
        }
        //,
        //"hod-cuesheets-2013-01-06")
        public CueSheetsSource()
            : base(AddinManager.CurrentLocalizer.GetString ("CueSheets"),
                                          AddinManager.CurrentLocalizer.GetString ("CueSheets"),
		                                  //"cuesheets",
		                                  sort_order)
        {
            Hyena.Log.Information ("CueSheetsSouce init");

            DbConnection=ServiceManager.DbConnection;
            TM_Provider=DatabaseTrackInfo.Provider;

            _track_info_db=new CS_TrackInfoDb(DbConnection);

            _sheet=new CueSheet();
            _sheets=new CueSheetCollection();

            _view=new CueSheetsView(this);

            Properties.Set<ISourceContents> ("Nereid.SourceContents", _view);
            Properties.SetString ("Icon.Name", "cueplay");
            Hyena.Log.Information ("CueSheets source has been instantiated.");

            Properties.Set<string> ("SearchEntryDescription", Catalog.GetString ("Search albums and tracks"));

            try {
                Properties.SetString("GtkActionPath","/CueSheetsPopup");
                _actions = new CS_Actions (this);
                Hyena.Log.Information(_actions.ToString());
            } catch (System.Exception ex) {
                Hyena.Log.Information(ex.ToString ());
            }

            InterfaceActionService action_service = ServiceManager.Get<InterfaceActionService> ();
            try {
                _track_search=new Gtk.CheckButton("Search Tracks");
                _track_search.Clicked+=delegate(object sender,EventArgs args) {
                    this.DoFilter();
                };
                Gtk.Toolbar header_toolbar = (Gtk.Toolbar) action_service.UIManager.GetWidget ("/HeaderToolbar");
                int i,N,k;
                for(i=0,k=-1,N=header_toolbar.NItems;i<N;i++) {
                    Gtk.Widget w=header_toolbar.GetNthItem(i).Child;
                    if (w!=null) {
                        if (w.GetType()==typeof(Banshee.Gui.Widgets.ConnectedVolumeButton)) {
                            k=i;
                        }
                    }
                }
                if (k>=0) {
                    Hyena.Log.Information("Toolitem itm");
                    Gtk.ToolItem itm=new Gtk.ToolItem();
                    Hyena.Log.Information ("Add cbk");
                    itm.Add (_track_search);
                    Hyena.Log.Information ("Insert cbk");
                    header_toolbar.Insert (itm,k);
                    itm.Show ();
                }
            } catch (System.Exception ex) {
                Hyena.Log.Error (ex.ToString ());
            }
            Gtk.Menu viewMenu = (action_service.UIManager.GetWidget ("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu;
            _menuItem = new Gtk.MenuItem (Catalog.GetString ("_Change Album View"));
            _menuItem.Activated += delegate {
                _view.ToggleGrid();
            };
            viewMenu.Insert (_menuItem, 2);
            _sep=new Gtk.SeparatorMenuItem();
            viewMenu.Insert (_sep,3);
        }
예제 #8
0
		// Insert widget at index, wrapping a ToolItem around it if needed
		void ToolItemize (Gtk.Widget widget, int index)
		{
			Gtk.ToolItem toolItem = widget as Gtk.ToolItem;
			if (toolItem == null) {
				toolItem = new Gtk.ToolItem ();
				toolItem.Show ();
				toolItem.Add (widget);
			}
			toolbar.Insert (toolItem, index);
		}
예제 #9
0
        public MenuWidget(Gtk.Window parent, ChatViewManager chatViewManager)
        {
            if (parent == null) {
                throw new ArgumentNullException("parent");
            }
            if (chatViewManager == null) {
                throw new ArgumentNullException("chatViewManager");
            }

            Parent = parent;
            MainWindow = parent as MainWindow;
            ChatViewManager = chatViewManager;

            Build();

            if (Frontend.IsMacOSX) {
                // Smuxi menu is already shown as app menu
                f_SmuxiAction.Visible = false;
            }

            // Chat
            f_JoinChatAction.IconName = Gtk.Stock.Open;
            f_FindGroupChatAction.IconName = Gtk.Stock.Find;
            f_OpenLogToolAction.IconName = Gtk.Stock.Open;

            // Engine
            f_AddRemoteEngineAction.IconName = Gtk.Stock.Add;
            f_SwitchRemoteEngineAction.IconName = Gtk.Stock.Refresh;

            // Toolbar
            f_FindGroupChatToolAction.IconName = Gtk.Stock.Find;

            f_MenuBar.ShowAll();
            f_MenuBar.NoShowAll = true;
            f_MenuBar.Visible = (bool) Frontend.FrontendConfig["ShowMenuBar"];

            JoinWidget = new JoinWidget();
            JoinWidget.NoShowAll = true;
            JoinWidget.Visible = (bool) Frontend.FrontendConfig["ShowQuickJoin"];
            JoinWidget.Activated += OnJoinWidgetActivated;

            var joinToolItem = new Gtk.ToolItem();
            joinToolItem.Add(JoinWidget);
            f_JoinToolbar.Add(joinToolItem);
            f_JoinToolbar.ShowAll();

            f_ShowMenubarAction.Active = (bool) Frontend.FrontendConfig["ShowMenuBar"];
            f_ShowStatusbarAction.Active = (bool) Frontend.FrontendConfig["ShowStatusBar"];
            f_ShowJoinBarAction.Active = JoinWidget.Visible;
        }