Ejemplo n.º 1
0
        public WebBrowserShell (string name, WebView view) : base (2, 4, false)
        {
            this.name = name;
            this.view = view;

            RowSpacing = 5;

            view.LoadStatusChanged += (o, e) => {
                if (view.LoadStatus == OssiferLoadStatus.FirstVisuallyNonEmptyLayout) {
                    UpdateTitle (view.Title);

                    switch (search_clear_on_navigate_state) {
                        case 1:
                            search_clear_on_navigate_state = 2;
                            break;
                        case 2:
                            search_clear_on_navigate_state = 0;
                            search_entry.Query = String.Empty;
                            break;
                    }
                }
            };

            view.Ready += (o, e) => navigation_control.WebView = view;

            navigation_control.GoHomeEvent += (o, e) => view.GoHome ();

            Attach (navigation_control, 0, 1, 0, 1,
                AttachOptions.Shrink,
                AttachOptions.Shrink,
                0, 0);

            title.Xalign = 0.0f;
            title.Xpad = 20;
            title.Ellipsize = Pango.EllipsizeMode.End;

            Attach (title, 1, 2, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink,
                0, 0);

            //search_entry.EmptyMessage = String.Format (Catalog.GetString ("Search the Amazon MP3 Store"));
            search_entry.SetSizeRequest (260, -1);
            // FIXME: dummy option to make the "search" icon show up;
            // we should probably fix this in the SearchEntry, but also
            // add real filter options for searching Amazon MP3 (artist,
            // album, genre, etc.)
            search_entry.AddFilterOption (0, name);
            search_entry.Show ();
            search_entry.Activated += (o, e) => {
                view.GoSearch (search_entry.Query);
                view.HasFocus = true;
                search_clear_on_navigate_state = 1;
            };
            Attach (search_entry, 3, 4, 0, 1,
                AttachOptions.Fill,
                AttachOptions.Shrink,
                0, 0);

            view_scroll.Add (view);
            view_scroll.ShadowType = ShadowType.In;

            Attach (view_scroll, 0, 4, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill,
                0, 0);

            UpdateTitle (String.Format (Catalog.GetString ("Loading {0}..."), name));

            ShowAll ();
        }
Ejemplo n.º 2
0
        public override void Activate()
        {
            if (source_contents == null) {
                var shell = GetWidget ();

                // float isn't supported by gconf apparently
                var zoom_conf = CreateSchema<double> ("webview_zoom", 1f, null, null);
                shell.View.Zoom = (float)zoom_conf.Get ();
                shell.View.ZoomChanged += z => zoom_conf.Set (z);
                view = shell.View;

                Properties.Set<ISourceContents> ("Nereid.SourceContents",
                    source_contents = new WebSourceContents (this, shell));
                Properties.Set<Banshee.Widgets.SearchEntry> ("Nereid.SearchEntry", shell.SearchEntry);

                // Add additional menu item keybindings
                var item = actions.ActionManager.UIManager.GetWidget ("/MainMenu/ViewMenu/ViewMenuAdditions/ZoomIn" + TypeUniqueId);
                item.AddAccelerator ("activate", actions.ActionManager.UIManager.AccelGroup,
                    (uint) Gdk.Key.KP_Add, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible);
                item.AddAccelerator ("activate", actions.ActionManager.UIManager.AccelGroup,
                    (uint) Gdk.Key.equal, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible);

                item = actions.ActionManager.UIManager.GetWidget ("/MainMenu/ViewMenu/ViewMenuAdditions/ZoomOut" + TypeUniqueId);
                item.AddAccelerator ("activate", actions.ActionManager.UIManager.AccelGroup,
                    (uint) Gdk.Key.KP_Subtract, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible);
                item.AddAccelerator ("activate", actions.ActionManager.UIManager.AccelGroup,
                    (uint) Gdk.Key.underscore, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible);
            }

            base.Activate ();
        }
Ejemplo n.º 3
0
        public WebBrowserShell(string name, WebView view)
            : base(2, 3, false)
        {
            this.name = name;
            this.view = view;

            RowSpacing = 5;

            view.LoadStatusChanged += (o, e) => {
                if (view.LoadStatus == OssiferLoadStatus.FirstVisuallyNonEmptyLayout) {
                    UpdateTitle (view.Title);

                    switch (search_clear_on_navigate_state) {
                        case 1:
                            search_clear_on_navigate_state = 2;
                            break;
                        case 2:
                            search_clear_on_navigate_state = 0;
                            search_entry.Query = String.Empty;
                            break;
                    }
                }
            };

            view.Ready += (o, e) => navigation_control.WebView = view;

            navigation_control.GoHomeEvent += (o, e) => view.GoHome ();

            Attach (navigation_control, 0, 1, 0, 1,
                AttachOptions.Shrink,
                AttachOptions.Shrink,
                0, 0);

            title.Xalign = 0.0f;
            title.Xpad = 6;
            title.Ellipsize = Pango.EllipsizeMode.End;

            Attach (title, 1, 2, 0, 1,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Shrink,
                0, 0);

            search_entry.SetSizeRequest (260, -1);
            search_entry.ShowSearchIcon = true;
            search_entry.Show ();
            search_entry.Activated += (o, e) => {
                view.GoSearch (search_entry.Query);
                view.HasFocus = true;
                search_clear_on_navigate_state = 1;
            };
            Attach (search_entry, 2, 3, 0, 1,
                AttachOptions.Fill,
                AttachOptions.Shrink,
                0, 0);

            view_scroll.Add (view);
            view_scroll.ShadowType = ShadowType.In;

            Attach (view_scroll, 0, 3, 1, 2,
                AttachOptions.Expand | AttachOptions.Fill,
                AttachOptions.Expand | AttachOptions.Fill,
                0, 0);

            UpdateTitle (String.Format (Catalog.GetString ("Loading {0}..."), name));

            ShowAll ();
        }