コード例 #1
0
 private void OnActivePageStateChanged(ContextState state)
 {
     if (state == ContextState.NotLoaded)
     {
         notebook.CurrentPage = notebook.PageNum(no_active);
     }
     else if (state == ContextState.Loading)
     {
         notebook.CurrentPage = notebook.PageNum(loading);
     }
     else if (state == ContextState.Loaded)
     {
         notebook.CurrentPage = notebook.PageNum(pane_pages[active_page]);
     }
 }
コード例 #2
0
        private void OnActivePageStateChanged(ContextState state)
        {
            if (active_page == null || !pane_pages.ContainsKey(active_page))
            {
                return;
            }

            if (state == ContextState.NotLoaded)
            {
                notebook.CurrentPage = notebook.PageNum(no_active);
            }
            else if (state == ContextState.Loading)
            {
                notebook.CurrentPage = notebook.PageNum(loading);
            }
            else if (state == ContextState.Loaded)
            {
                notebook.CurrentPage = notebook.PageNum(pane_pages[active_page]);
            }
        }
コード例 #3
0
        static void OpenWindow(ProjectItemInfo item)
        {
            Gtk.Widget page = (Gtk.Widget)openWindows [item];
            if (page != null)
            {
                page.Show();
                WidgetNotebook.Page = WidgetNotebook.PageNum(page);
            }
            else
            {
                DesignerView view = new DesignerView(Project, item);

                // Tab label

                HBox tabLabel = new HBox();
                tabLabel.PackStart(new Gtk.Image(item.Component.Type.Icon), true, true, 0);
                tabLabel.PackStart(new Label(item.Name), true, true, 3);
                Button b = new Button(new Gtk.Image("gtk-close", IconSize.Menu));
                b.Relief       = Gtk.ReliefStyle.None;
                b.WidthRequest = b.HeightRequest = 24;

                b.Clicked += delegate(object s, EventArgs a) {
                    view.Hide();
                    WidgetNotebook.QueueResize();
                };

                tabLabel.PackStart(b, false, false, 0);
                tabLabel.ShowAll();

                // Notebook page

                int p = WidgetNotebook.AppendPage(view, tabLabel);
                view.ShowAll();
                openWindows [item]  = view;
                WidgetNotebook.Page = p;
            }
        }
コード例 #4
0
 public bool HasPage(Gtk.Widget page)
 {
     return(notebook.PageNum(page) != -1);
 }
コード例 #5
0
        private void Query(bool grab_focus)
        {
            if (timeout_id != 0)
            {
                GLib.Source.Remove(timeout_id);
                timeout_id = 0;
            }

            string query = query_text = entry.Text;

            if (String.IsNullOrEmpty(query))
            {
                return;
            }

            SetWindowTitle(query);
            ShowInformation(null);

            if (QueryEvent != null)
            {
                QueryEvent(query);
            }

            view.Clear();
            view.Scope        = ScopeType.Everything;
            view.SortType     = sort;
            pages.CurrentPage = pages.PageNum(panes);

            this.grab_focus = grab_focus;

            try {
                // Clean up our previous query, if any exists.
                DetachQuery();

                TotalMatches = 0;

                current_query             = new Query();
                current_query.QueryDomain = domain;

                current_query.AddText(query);
                current_query.HitsAddedEvent      += OnHitsAdded;
                current_query.HitsSubtractedEvent += OnHitsSubtracted;
                current_query.FinishedEvent       += OnFinished;

                // Don't search documentation by default
                if (!search.DocsEnabled)
                {
                    QueryPart_Property part = new QueryPart_Property();
                    part.Logic = QueryPartLogic.Prohibited;
                    part.Type  = PropertyType.Keyword;
                    part.Key   = "beagle:Source";
                    part.Value = "documentation";
                    current_query.AddPart(part);
                }

                // set scope from scope list
                ScopeMapping mapping = scope_mappings [scope_list.Active];
                if (!String.IsNullOrEmpty(mapping.query_mapping))
                {
                    current_query.AddText(mapping.query_mapping);
                }

                current_query.SendAsync();

                spinner.Start();
            } catch (Beagle.ResponseMessageException) {
                pages.CurrentPage = pages.PageNum(startdaemon);
            } catch (Exception e) {
                Console.WriteLine("Querying the Beagle daemon failed: {0}", e.Message);
            }
        }
コード例 #6
0
        public SearchWindow(ISearch search) : base(WindowType.Toplevel)
        {
            this.search = search;

            base.Title         = Catalog.GetString("Desktop Search");
            base.Icon          = WidgetFu.LoadThemeIcon("system-search", 16);
            base.DefaultWidth  = 700;
            base.DefaultHeight = 550;
            base.DeleteEvent  += OnWindowDelete;

            VBox vbox = new VBox();

            vbox.Spacing = 3;

            uim = new UIManager(this);
            uim.DomainChanged += OnDomainChanged;
            uim.SortChanged   += OnSortChanged;
            uim.ToggleDetails += OnToggleDetails;
            uim.ShowQuickTips += OnShowQuickTips;
            uim.ShowIndexInfo += OnShowIndexInfo;
            uim.StartDaemon   += OnStartDaemon;
            uim.StopDaemon    += OnStopDaemon;
            vbox.PackStart(uim.MenuBar, false, false, 0);

            HBox hbox = new HBox(false, 6);

            Label label = new Label(Catalog.GetString("_Find in:"));

            hbox.PackStart(label, false, false, 0);

            scope_list = ComboBox.NewText();
            foreach (ScopeMapping mapping in scope_mappings)
            {
                scope_list.AppendText(mapping.label);
            }
            scope_list.Active = 0;

            scope_list.Changed += new EventHandler(delegate(object o, EventArgs args) {
                ComboBox combo = o as ComboBox;
                if (o == null)
                {
                    return;
                }
                int active = combo.Active;
                Log.Debug("Scope changed: {0} maps to '{1}'", combo.ActiveText, scope_mappings [active].query_mapping);
                Query(true);
            });
            hbox.PackStart(scope_list, false, false, 0);

            entry            = new Entry();
            entry.Activated += OnEntryActivated;
            hbox.PackStart(entry, true, true, 0);

            label.MnemonicWidget  = entry;
            uim.FocusSearchEntry += delegate() { entry.GrabFocus(); };

            // The auto search after timeout feauture is now optional
            // and can be disabled.

            if (Conf.BeagleSearch.GetOption(Conf.Names.BeagleSearchAutoSearch, true))
            {
                entry.Changed    += OnEntryResetTimeout;
                entry.MoveCursor += OnEntryResetTimeout;
            }

            button = new Gtk.Button();
            Gtk.HBox  button_hbox = new Gtk.HBox(false, 2);
            Gtk.Image icon        = new Gtk.Image(Gtk.Stock.Find, Gtk.IconSize.Button);
            button_hbox.PackStart(icon, false, false, 0);
            label = new Gtk.Label(Catalog.GetString("Find Now"));
            button_hbox.PackStart(label, false, false, 0);
            button.Add(button_hbox);
            button.Clicked += OnButtonClicked;

            Gtk.VBox buttonVBox = new Gtk.VBox(false, 0);
            buttonVBox.PackStart(button, true, false, 0);
            hbox.PackStart(buttonVBox, false, false, 0);

            spinner = new Spinner();
            hbox.PackStart(spinner, false, false, 0);

            HBox padding_hbox = new HBox();

            padding_hbox.PackStart(hbox, true, true, 9);
            vbox.PackStart(padding_hbox, false, true, 6);

            VBox view_box = new VBox(false, 3);

            vbox.PackStart(view_box, true, true, 0);

            HBox na_padding = new HBox();

            view_box.PackStart(na_padding, false, true, 0);

            notification_area = new NotificationArea();
            na_padding.PackStart(notification_area, true, true, 3);

            pages             = new Gtk.Notebook();
            pages.ShowTabs    = false;
            pages.ShowBorder  = false;
            pages.BorderWidth = 3;
            view_box.PackStart(pages, true, true, 0);

            quicktips = new Pages.QuickTips();
            quicktips.Show();
            pages.Add(quicktips);

            indexinfo = new Pages.IndexInfo();
            indexinfo.Show();
            pages.Add(indexinfo);

            rootuser = new Pages.RootUser();
            rootuser.Show();
            pages.Add(rootuser);

            startdaemon = new Pages.StartDaemon();
            startdaemon.DaemonStarted += OnDaemonStarted;
            startdaemon.Show();
            pages.Add(startdaemon);

            panes = new Beagle.Search.Panes();
            panes.Show();
            pages.Add(panes);

            view = new GroupView();
            view.TileSelected += ShowInformation;
            panes.MainContents = view;

            this.statusbar = new Gtk.Statusbar();
            vbox.PackEnd(this.statusbar, false, false, 0);

            Add(vbox);

            tips = new Gtk.Tooltips();
            tips.SetTip(entry, Catalog.GetString("Type in search terms"), "");
            tips.SetTip(button, Catalog.GetString("Start searching"), "");
            tips.Enable();

            if (Environment.UserName == "root" && !Conf.Daemon.GetOption(Conf.Names.AllowRoot, false))
            {
                pages.CurrentPage = pages.PageNum(rootuser);
                entry.Sensitive   = button.Sensitive = uim.Sensitive = false;
            }
            else
            {
                pages.CurrentPage = pages.PageNum(quicktips);
            }

            entry.GrabFocus();
            StartCheckingIndexingStatus();
        }
コード例 #7
0
		public SearchWindow (ISearch search) : base (WindowType.Toplevel)
		{
			this.search = search;

			base.Title = Catalog.GetString ("Desktop Search");
			base.Icon = WidgetFu.LoadThemeIcon ("system-search", 16);
			base.DefaultWidth = 700;
			base.DefaultHeight = 550;
			base.DeleteEvent += OnWindowDelete;
			
			VBox vbox = new VBox ();
			vbox.Spacing = 3;

			uim = new UIManager (this);
			uim.DomainChanged += OnDomainChanged;
			uim.SortChanged += OnSortChanged;
			uim.ToggleDetails += OnToggleDetails;
			uim.ShowQuickTips += OnShowQuickTips;
			uim.ShowIndexInfo += OnShowIndexInfo;
			uim.StartDaemon += OnStartDaemon;
			uim.StopDaemon += OnStopDaemon;
			vbox.PackStart (uim.MenuBar, false, false, 0);

			HBox hbox = new HBox (false, 6);
			
			Label label = new Label (Catalog.GetString ("_Find in:"));
			hbox.PackStart (label, false, false, 0);
			
			scope_list = ComboBox.NewText ();
			foreach (ScopeMapping mapping in scope_mappings)
				scope_list.AppendText (mapping.label);
			scope_list.Active = 0;

			scope_list.Changed += new EventHandler (delegate (object o, EventArgs args) {
									ComboBox combo = o as ComboBox;
									if (o == null)
										return;
									int active = combo.Active;
									Log.Debug ("Scope changed: {0} maps to '{1}'", combo.ActiveText, scope_mappings [active].query_mapping);
									Query (true);
								});
			hbox.PackStart (scope_list, false, false, 0);

			entry = new Entry ();
			entry.Activated += OnEntryActivated;
			hbox.PackStart (entry, true, true, 0);

			label.MnemonicWidget = entry;
			uim.FocusSearchEntry += delegate () { entry.GrabFocus (); };

			// The auto search after timeout feauture is now optional
			// and can be disabled.

			if (Conf.BeagleSearch.GetOption (Conf.Names.BeagleSearchAutoSearch, true)) {
				entry.Changed += OnEntryResetTimeout;
				entry.MoveCursor += OnEntryResetTimeout;
			}

			button = new Gtk.Button ();
			Gtk.HBox button_hbox = new Gtk.HBox (false, 2);
			Gtk.Image icon = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Button);
			button_hbox.PackStart (icon, false, false, 0);
			label = new Gtk.Label (Catalog.GetString ("Find Now"));
			button_hbox.PackStart (label, false, false, 0);
			button.Add (button_hbox);
			button.Clicked += OnButtonClicked;

			Gtk.VBox buttonVBox = new Gtk.VBox (false, 0);
			buttonVBox.PackStart (button, true, false, 0);
			hbox.PackStart (buttonVBox, false, false, 0);

			spinner = new Spinner ();
			hbox.PackStart (spinner, false, false, 0);

			HBox padding_hbox = new HBox ();
			padding_hbox.PackStart (hbox, true, true, 9);
			vbox.PackStart (padding_hbox, false, true, 6);

			VBox view_box = new VBox (false, 3);
			vbox.PackStart (view_box, true, true, 0);

			HBox na_padding = new HBox ();
			view_box.PackStart (na_padding, false, true, 0);

			notification_area = new NotificationArea ();
			na_padding.PackStart (notification_area, true, true, 3);

			pages = new Gtk.Notebook ();
			pages.ShowTabs = false;
			pages.ShowBorder = false;
			pages.BorderWidth = 3;
			view_box.PackStart (pages, true, true, 0);

			quicktips = new Pages.QuickTips ();
			quicktips.Show ();
			pages.Add (quicktips);

			indexinfo = new Pages.IndexInfo ();
			indexinfo.Show ();
			pages.Add (indexinfo);

			rootuser = new Pages.RootUser ();
			rootuser.Show ();
			pages.Add (rootuser);

			startdaemon = new Pages.StartDaemon ();
			startdaemon.DaemonStarted += OnDaemonStarted;
			startdaemon.Show ();
			pages.Add (startdaemon);

			panes = new Beagle.Search.Panes ();
			panes.Show ();
			pages.Add (panes);

			view = new GroupView ();
			view.TileSelected += ShowInformation;
			panes.MainContents = view;

			this.statusbar = new Gtk.Statusbar ();
			vbox.PackEnd (this.statusbar, false, false, 0);
			
			Add (vbox);

			tips = new Gtk.Tooltips ();
			tips.SetTip (entry, Catalog.GetString ("Type in search terms"), "");
			tips.SetTip (button, Catalog.GetString ("Start searching"), "");
			tips.Enable ();

			if (Environment.UserName == "root" && !Conf.Daemon.GetOption (Conf.Names.AllowRoot, false)) {
				pages.CurrentPage = pages.PageNum (rootuser);
				entry.Sensitive = button.Sensitive = uim.Sensitive = false;
			} else {
				pages.CurrentPage = pages.PageNum (quicktips);
			}

			entry.GrabFocus ();
			StartCheckingIndexingStatus ();
		}