private void BuildViews () { source_box = new VBox (); views_pane = new HPaned (); PersistentPaneController.Control (views_pane, SourceViewWidth); view_container = new ViewContainer (); source_view = new SourceView (); composite_view = new CompositeTrackSourceContents (); Container source_scroll; if (PlatformDetection.IsMeeGo) { source_scroll = new Gtk.ScrolledWindow () { HscrollbarPolicy = PolicyType.Never, VscrollbarPolicy = PolicyType.Automatic, ShadowType = ShadowType.None }; source_scroll.Add (source_view); var color = new Gdk.Color ((byte)0xe6, (byte)0xe6, (byte)0xe6); Gdk.Colormap.System.AllocColor (ref color, true, true); source_view.ModifyBase (StateType.Normal, color); } else { Hyena.Widgets.ScrolledWindow window; if (ApplicationContext.CommandLine.Contains ("smooth-scroll")) { window = new Hyena.Widgets.SmoothScrolledWindow (); } else { window = new Hyena.Widgets.ScrolledWindow (); } window.AddWithFrame (source_view); source_scroll = window; } composite_view.TrackView.HeaderVisible = false; view_container.Content = composite_view; source_box.PackStart (source_scroll, true, true, 0); source_box.PackStart (new UserJobTileHost (), false, false, 0); UpdateCoverArtDisplay (); source_view.SetSizeRequest (125, -1); view_container.SetSizeRequest (425, -1); views_pane.Pack1 (source_box, false, false); views_pane.Pack2 (view_container, true, false); source_box.ShowAll (); view_container.Show (); views_pane.Show (); primary_vbox.PackStart (views_pane, true, true, 0); }
public MainWindow() { ToolItem spacerItem; FileSearchEntry searchEntry; ToolItem searchEntryItem; Alignment searchEntryBox; object[] attrs= Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), true); AssemblyTitleAttribute attr = (AssemblyTitleAttribute)attrs[0]; AssemblyName asmName = Assembly.GetExecutingAssembly().GetName(); string title = String.Format ("{0} (BETA) {1} (Protocol Version: {2})", attr.Title, asmName.Version, Core.ProtocolVersion); // Create the interface window = new Window (title); window.SetDefaultSize (850, 550); window.DeleteEvent += on_win_delete; window.ConfigureEvent += on_MainWindow_configure_event; window.FocusInEvent += window_FocusInEvent; ((ToggleAction)Runtime.BuiltinActions["ToggleMainToolbar"]).Active = Gui.Settings.ShowToolbar; Runtime.BuiltinActions["ToggleMainToolbar"].Activated += ToggleMainToolbar_Activated; ((ToggleAction)Runtime.BuiltinActions["ToggleMainStatusbar"]).Active = Gui.Settings.ShowStatusBar; Runtime.BuiltinActions["ToggleMainStatusbar"].Activated += ToggleMainStatusbar_Activated; window.AddAccelGroup (Runtime.UIManager.AccelGroup); mainVBox = new VBox (); window.Add (mainVBox); mainVBox.Show (); if (Common.OSName == "Darwin") { MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/OSXAppMenu"); Imendio.MacIntegration.Menu.SetMenuBar(menubar); MenuItem preferencesItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Preferences"); MenuItem aboutItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/About"); IntPtr group = Imendio.MacIntegration.Menu.AddAppMenuGroup(); Imendio.MacIntegration.Menu.AddAppMenuItem(group, aboutItem, "About Meshwork"); group = Imendio.MacIntegration.Menu.AddAppMenuGroup(); Imendio.MacIntegration.Menu.AddAppMenuItem(group, preferencesItem, "Preferences"); MenuItem quitItem = (MenuItem) Runtime.UIManager.GetWidget ("/OSXAppMenu/NetworkMenu/Quit"); Imendio.MacIntegration.Menu.SetQuitMenuItem(quitItem); } else { MenuBar menubar = (MenuBar) Runtime.UIManager.GetWidget ("/MainWindowMenuBar"); mainVBox.PackStart (menubar, false, false, 0); menubar.Show (); } toolbar = (Toolbar) Runtime.UIManager.GetWidget ("/MainWindowToolbar"); toolbar.ToolbarStyle = ToolbarStyle.BothHoriz; toolbar.IconSize = IconSize.LargeToolbar; spacerItem = new ToolItem(); spacerItem.Expand = true; toolbar.Insert(spacerItem, -1); spacerItem.Show(); searchEntry = new FileSearchEntry(); searchEntryBox = new Alignment(0.5f, 0.5f, 0, 0); searchEntryBox.LeftPadding = 4; searchEntryBox.RightPadding = 1; searchEntryBox.Add(searchEntry); searchEntryItem = new ToolItem(); searchEntryItem.Add(searchEntryBox); toolbar.Insert(searchEntryItem, -1); searchEntryItem.ShowAll(); mainVBox.PackStart (toolbar, false, false, 0); mainPaned = new HPaned(); mainPaned.Mapped += delegate (object sender, EventArgs args) { // XXX: Remember the user's last setting instead mainPaned.Position = 190; // Set some colors //infoBoxSeparator.ModifyBg(StateType.Normal, GtkHelper.DarkenColor (mainbar.Style.Background(StateType.Normal), 2)); //infoSwitcherTree.ModifyBase(StateType.Normal, infoSwitcherTree.Style.Base(StateType.Active)); //infoSwitcherTree.ModifyBase(StateType.Active, infoBoxSeparator.Style.Base(StateType.Selected)); }; mainPaned.Show(); mainVBox.PackStart (mainPaned, true, true, 0); // Create page notebook pageNotebook = new Notebook(); pageNotebook.ShowTabs = false; pageNotebook.ShowBorder = false; mainPaned.Pack2(pageNotebook, true, true); pageNotebook.ShowAll(); // Create sidebar sidebar = new MainSidebar(); sidebar.ItemAdded += sidebar_ItemAdded; sidebar.SelectedItemChanged += sidebar_SelectedItemChanged; sidebar.AddBuiltinItems(); mainPaned.Pack1(sidebar, false, false); sidebar.ShowAll(); CreateStatusbar (); // Apply "view" settings toolbar.Visible = Gui.Settings.ShowToolbar; statusBar.Visible = Gui.Settings.ShowStatusBar; // Hook up Core events Core.ShareBuilder.StartedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StartedIndexing)); Core.ShareBuilder.FinishedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_FinishedIndexing)); Core.ShareBuilder.StoppedIndexing += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sb_StoppedIndexing)); Core.ShareBuilder.ErrorIndexing += (ErrorEventHandler)DispatchService.GuiDispatch(new ErrorEventHandler(sb_ErrorIndexing)); Core.ShareHasher.StartedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished)); Core.ShareHasher.FinishedHashingFile += (ShareHasherTaskEventHandler)DispatchService.GuiDispatch(new ShareHasherTaskEventHandler(sh_StartedFinished)); Core.ShareHasher.QueueChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(sh_QueueChanged)); Core.FileSearchManager.SearchAdded += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchAdded)); Core.FileSearchManager.SearchRemoved += (FileSearchEventHandler)DispatchService.GuiDispatch(new FileSearchEventHandler(FileSearchManager_SearchRemoved)); window.Resize (Gui.Settings.WindowSize.Width, Gui.Settings.WindowSize.Height); window.Move (Gui.Settings.WindowPosition.X, Gui.Settings.WindowPosition.Y); SelectedPage = NetworkOverviewPage.Instance; }
protected NoteRecentChanges (NoteManager manager) : base (Catalog.GetString ("Search All Notes")) { this.manager = manager; this.IconName = "tomboy"; this.DefaultWidth = 450; this.DefaultHeight = 400; this.current_matches = new Dictionary<string, int> (); this.Resizable = true; selected_tags = new Dictionary<Tag, Tag> (); AddAccelGroup (Tomboy.ActionManager.UI.AccelGroup); menu_bar = CreateMenuBar (); Gtk.Label label = new Gtk.Label (Catalog.GetString ("_Search:")); label.Xalign = 0.0f; find_combo = Gtk.ComboBoxEntry.NewText (); label.MnemonicWidget = find_combo; find_combo.Changed += OnEntryChanged; find_combo.Entry.ActivatesDefault = false; find_combo.Entry.Activated += OnEntryActivated; find_combo.Entry.FocusInEvent += OnEntryFocusIn; if (previous_searches != null) { foreach (string prev in previous_searches) { find_combo.AppendText (prev); } } clear_search_button = new Gtk.Button (new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu)); clear_search_button.Sensitive = false; clear_search_button.Clicked += ClearSearchClicked; clear_search_button.Show (); Gtk.Table table = new Gtk.Table (1, 3, false); table.Attach (label, 0, 1, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); table.Attach (find_combo, 1, 2, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); table.Attach (clear_search_button, 2, 3, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0); table.ColumnSpacing = 4; table.ShowAll (); Gtk.HBox hbox = new Gtk.HBox (false, 0); hbox.PackStart (table, true, true, 0); hbox.ShowAll (); // Notebooks Pane Gtk.Widget notebooksPane = MakeNotebooksPane (); notebooksPane.Show (); MakeRecentTree (); tree.Show (); status_bar = new Gtk.Statusbar (); status_bar.HasResizeGrip = true; status_bar.Show (); // Update on changes to notes manager.NoteDeleted += OnNotesDeleted; manager.NoteAdded += OnNotesChanged; manager.NoteRenamed += OnNoteRenamed; manager.NoteSaved += OnNoteSaved; // List all the current notes UpdateResults (); matches_window = new Gtk.ScrolledWindow (); matches_window.ShadowType = Gtk.ShadowType.In; matches_window.HscrollbarPolicy = Gtk.PolicyType.Automatic; matches_window.VscrollbarPolicy = Gtk.PolicyType.Automatic; matches_window.Add (tree); matches_window.Show (); hpaned = new Gtk.HPaned (); hpaned.Position = 150; hpaned.Add1 (notebooksPane); hpaned.Add2 (matches_window); hpaned.Show (); RestorePosition (); Gtk.VBox vbox = new Gtk.VBox (false, 8); vbox.BorderWidth = 6; vbox.PackStart (hbox, false, false, 4); vbox.PackStart (hpaned, true, true, 0); vbox.PackStart (status_bar, false, false, 0); vbox.Show (); // Use another VBox to place the MenuBar // right at thetop of the window. content_vbox = new Gtk.VBox (false, 0); #if !MAC content_vbox.PackStart (menu_bar, false, false, 0); #endif content_vbox.PackStart (vbox, true, true, 0); content_vbox.Show (); this.Add (content_vbox); this.DeleteEvent += OnDelete; this.KeyPressEvent += OnKeyPressed; // For Escape // Watch when notes are added to notebooks so the search // results will be updated immediately instead of waiting // until the note's QueueSave () kicks in. Notebooks.NotebookManager.NoteAddedToNotebook += OnNoteAddedToNotebook; Notebooks.NotebookManager.NoteRemovedFromNotebook += OnNoteRemovedFromNotebook; // Set the focus chain for the top-most containers Bug #512175 Gtk.Widget[] vbox_focus = new Gtk.Widget[2]; vbox_focus[0] = hbox; vbox_focus[1] = hpaned; vbox.FocusChain = vbox_focus; // Set focus chain for sub widgits of first top-most container Gtk.Widget[] table_focus = new Gtk.Widget[2]; table_focus[0] = find_combo; table_focus[1] = matches_window; hbox.FocusChain = table_focus; // set focus chain for sub widgits of seconf top-most container Gtk.Widget[] hpaned_focus = new Gtk.Widget[2]; hpaned_focus[0] = matches_window; hpaned_focus[1] = notebooksPane; hpaned.FocusChain = hpaned_focus; // get back to the beginning of the focus chain Gtk.Widget[] scroll_right = new Gtk.Widget[1]; scroll_right[0] = tree; matches_window.FocusChain = scroll_right; Tomboy.ExitingEvent += OnExitingEvent; }
private void BuildViews() { source_box = new VBox (); views_pane = new HPaned (); PersistentPaneController.Control (views_pane, SourceViewWidth); view_container = new ViewContainer (); source_view = new SourceView (); composite_view = new CompositeTrackSourceContents (); Container source_scroll; Hyena.Widgets.ScrolledWindow window; if (ApplicationContext.CommandLine.Contains ("smooth-scroll")) { window = new Hyena.Widgets.SmoothScrolledWindow (); } else { window = new Hyena.Widgets.ScrolledWindow (); } window.AddWithFrame (source_view); source_scroll = window; composite_view.TrackView.HeaderVisible = false; view_container.Content = composite_view; source_box.PackStart (source_scroll, true, true, 0); source_box.PackStart (new UserJobTileHost (), false, false, 0); UpdateCoverArtDisplay (); source_view.SetSizeRequest (125, -1); view_container.SetSizeRequest (425, -1); views_pane.Pack1 (source_box, false, false); views_pane.Pack2 (view_container, true, false); source_box.ShowAll (); view_container.Show (); views_pane.Show (); primary_vbox.PackStart (views_pane, true, true, 0); }