Esempio n. 1
0
        public HeaderFilters(SearchSource source)
        {
            this.source     = source;
            source.Updated += (o, a) => {
                var s = source.SearchDescription;
                if (s != null)
                {
                    var iter = s.MediaType == null ? all_iter : mediatypes[s.MediaType];
                    media_type_combo.SetActiveIter(iter);
                    sort_combo.Active  = Math.Max(Array.IndexOf(sorts, s.Sort), 0);
                    search_entry.Query = s.Query ?? "";
                }
            };

            Spacing = 6;

            PackStart(new Label()
            {
                Visible = true
            }, true, true, 0);
            BuildMediaTypeCombo();
            BuildSortCombo();
            BuildSearchEntry();
            BuildSearchButton();
        }
Esempio n. 2
0
        public void SetSearch(SearchDescription search)
        {
            if (search_source == null)
            {
                search_source = new SearchSource();
                AddChildSource(search_source);
            }

            SearchSource.SetSearch(search);
        }
Esempio n. 3
0
        public bool SetSource(ISource source)
        {
            this.source = source as SearchSource;

            if (this.source != null)
            {
                list_view.SetModel(this.source.Model);
                return(true);
            }

            return(false);
        }
Esempio n. 4
0
        public SearchView(SearchSource source)
        {
            this.source = source;

            list_view = new ResultListView();
            var controller = new PersistentColumnController("InternetArchive");

            list_view.ColumnController = controller;
            AddColumns();
            controller.Load();

            list_view.RowActivated += (o, a) => {
                ServiceManager.Get <InterfaceActionService> ()["InternetArchive.ViewItemDetails"].Activate();
            };

            list_view.SetModel(source.Model);

            // Packing
            var sw = new Gtk.ScrolledWindow();

            sw.Child = list_view;

            var    last_hid_more = DateTime.MinValue;
            string more_text     = Catalog.GetString("Fetch more results from the Internet Archive?");

            list_view.Vadjustment.ValueChanged += (o, a) => {
                var adj = list_view.Vadjustment;
                if ((DateTime.Now - last_hid_more).TotalSeconds > 2 && adj.Value >= adj.Upper - adj.PageSize)
                {
                    if (source.TotalResults > source.Model.Count)
                    {
                        source.SetStatus(more_text, true, false, "gtk-question");
                        source.CurrentMessage.AddAction(new MessageAction(Catalog.GetString("Fetch More"), delegate { source.FetchMore(); }));
                    }
                }
            };

            source.MessageNotify += (o, a) => {
                if (source.CurrentMessage != null && source.CurrentMessage.Text == more_text && source.CurrentMessage.IsHidden)
                {
                    last_hid_more = DateTime.Now;
                }
            };

            PackStart(sw, true, true, 0);
            ShowAll();
        }
Esempio n. 5
0
        public HeaderFilters (SearchSource source)
        {
            this.source = source;
            source.Updated += (o, a) => {
                var s = source.SearchDescription;
                if (s != null) {
                    var iter = s.MediaType == null ? all_iter : mediatypes[s.MediaType];
                    media_type_combo.SetActiveIter (iter);
                    sort_combo.Active = Math.Max (Array.IndexOf (sorts, s.Sort), 0);
                    search_entry.Query = s.Query ?? "";
                }
            };

            Spacing = 6;

            BuildMediaTypeCombo ();
            BuildSortCombo ();
            BuildSearchEntry ();
            BuildSearchButton ();
        }
Esempio n. 6
0
        public void SetSearch(SearchDescription search)
        {
            if (search_source == null) {
                search_source = new SearchSource ();
                AddChildSource (search_source);
            }

            SearchSource.SetSearch (search);
        }
Esempio n. 7
0
 public void ResetSource()
 {
     list_view.SetModel(null);
     source = null;
 }