コード例 #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
        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);
        }
コード例 #3
0
        //,
        //"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);
        }
コード例 #4
0
ファイル: Toolbar.cs プロジェクト: FreeBSD-DotNet/monodevelop
		// 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);
		}