示例#1
0
文件: Actions.cs 项目: knocte/banshee
        public Actions(HomeSource source)
            : base("InternetArchive")
        {
            Add (
                new ActionEntry ("IaResultPopup", null, null, null, null, (o, a) => {
                    ShowContextMenu ("/IaResultPopup");
                }),
                new ActionEntry ("ViewItemDetails", null, Catalog.GetString ("View Item Details"), null, null, (o, a) => {
                    var item = source.SearchSource.FocusedItem;
                    if (item != null && item.Id != null) {
                        string id = item.Id;
                        var src = new DetailsSource (id, item.Title, item.MediaType);
                        source.AddChildSource (src);
                        Banshee.ServiceStack.ServiceManager.SourceManager.SetActiveSource (src);
                    }
                }),
                new ActionEntry ("OpenItemWebsite", Stock.JumpTo, Catalog.GetString ("Open Webpage"), null, null, (o, a) => {
                    string uri = null;
                    var src = ActiveSource as DetailsSource;
                    if (src != null) {
                        uri = src.Item.Details.WebpageUrl;
                    } else {
                        var item = source.SearchSource.FocusedItem;
                        if (item != null) {
                            uri = item.WebpageUrl;
                        }
                    }

                    if (uri != null) {
                        Banshee.Web.Browser.Open (uri);
                    }
                })
            );

            AddImportant (
                new ActionEntry ("VisitInternetArchive", Stock.JumpTo, Catalog.GetString ("Visit Archive.org"), null, null, (o, a) => {
                    Banshee.Web.Browser.Open ("http://archive.org");
                }),
                new ActionEntry ("SubscribeToIASearch", Stock.Add,
                    Catalog.GetString ("Subscribe"), null,
                    Catalog.GetString ("Subscribe to this search as a podcast"), (o, a) => {
                        var desc = source.SearchSource.SearchDescription;
                        var podcast = new Hyena.Json.JsonObject ();
                        podcast["uri"] = source.SearchSource.Search.RssUrl;
                        podcast["name"] = String.Format (Catalog.GetString ("Internet Archive: {0}"), desc.Name ?? desc.Query);
                        Log.DebugFormat ("InternetArchive: subscribing to search: {0} ({1})", podcast["name"], podcast["uri"]);

                        ServiceManager.Get<DBusCommandService> ().PushArgument ("podcast", podcast.ToString ());
                    }
                )
            );

            AddUiFromFile ("GlobalUI.xml");

            Register ();
        }
示例#2
0
        public HomeView (HomeSource source)
        {
            this.source = source;

            //var sw = new Gtk.ScrolledWindow ();
            //sw.BorderWidth = 4;
            //sw.AddWithViewport (Build ());

            var frame = new Hyena.Widgets.RoundedFrame ();
            frame.Child = Build ();

            PackStart (frame, true, true, 0);
            ShowAll ();
        }
示例#3
0
        public Actions(HomeSource source) : base("InternetArchive")
        {
            Add(
                new ActionEntry("IaResultPopup", null, null, null, null, (o, a) => {
                ShowContextMenu("/IaResultPopup");
            }),
                new ActionEntry("ViewItemDetails", null, Catalog.GetString("View Item Details"), null, null, (o, a) => {
                var item = source.SearchSource.FocusedItem;
                if (item != null && item.Id != null)
                {
                    string id = item.Id;
                    var src   = new DetailsSource(id, item.Title, item.MediaType);
                    source.AddChildSource(src);
                    Banshee.ServiceStack.ServiceManager.SourceManager.SetActiveSource(src);
                }
            }),
                new ActionEntry("OpenItemWebsite", Stock.JumpTo, Catalog.GetString("Open Webpage"), null, null, (o, a) => {
                string uri = null;
                var src    = ActiveSource as DetailsSource;
                if (src != null)
                {
                    uri = src.Item.Details.WebpageUrl;
                }
                else
                {
                    var item = source.SearchSource.FocusedItem;
                    if (item != null)
                    {
                        uri = item.WebpageUrl;
                    }
                }

                if (uri != null)
                {
                    Banshee.Web.Browser.Open(uri);
                }
            })
                );

            AddImportant(
                new ActionEntry("VisitInternetArchive", Stock.JumpTo, Catalog.GetString("Visit Archive.org"), null, null, (o, a) => {
                Banshee.Web.Browser.Open("http://archive.org");
            })
                );

            AddUiFromFile("GlobalUI.xml");

            Register();
        }
示例#4
0
        public HomeView(HomeSource source)
        {
            this.source = source;

            //var sw = new Gtk.ScrolledWindow ();
            //sw.BorderWidth = 4;
            //sw.AddWithViewport (Build ());

            var frame = new Hyena.Widgets.RoundedFrame();

            frame.Child = Build();

            PackStart(frame, true, true, 0);
            ShowAll();
        }
        public Actions (HomeSource source) : base ("InternetArchive")
        {
            Add (
                new ActionEntry ("IaResultPopup", null, null, null, null, (o, a) => {
                    ShowContextMenu ("/IaResultPopup");
                }),
                new ActionEntry ("ViewItemDetails", null, Catalog.GetString ("View Item Details"), null, null, (o, a) => {
                    var item = source.SearchSource.FocusedItem;
                    if (item != null && item.Id != null) {
                        string id = item.Id;
                        var src = new DetailsSource (id, item.Title, item.MediaType);
                        source.AddChildSource (src);
                        Banshee.ServiceStack.ServiceManager.SourceManager.SetActiveSource (src);
                    }
                }),
                new ActionEntry ("OpenItemWebsite", Stock.JumpTo, Catalog.GetString ("Open Webpage"), null, null, (o, a) => {
                    string uri = null;
                    var src = ActiveSource as DetailsSource;
                    if (src != null) {
                        uri = src.Item.Details.WebpageUrl;
                    } else {
                        var item = source.SearchSource.FocusedItem;
                        if (item != null) {
                            uri = item.WebpageUrl;
                        }
                    }

                    if (uri != null) {
                        Banshee.Web.Browser.Open (uri);
                    }
                })
            );

            AddImportant (
                new ActionEntry ("VisitInternetArchive", Stock.JumpTo, Catalog.GetString ("Visit Archive.org"), null, null, (o, a) => {
                    Banshee.Web.Browser.Open ("http://archive.org");
                })
            );

            AddUiFromFile ("GlobalUI.xml");

            Register ();
        }
示例#6
0
 public void ResetSource()
 {
     source = null;
 }
示例#7
0
 public bool SetSource(ISource source)
 {
     this.source = source as HomeSource;
     return(this.source != null);
 }
示例#8
0
 public void ResetSource ()
 {
     source = null;
 }
示例#9
0
 public bool SetSource (ISource source)
 {
     this.source = source as HomeSource;
     return this.source != null;
 }
示例#10
0
        public Actions(HomeSource source) : base("InternetArchive")
        {
            Add(
                new ActionEntry("IaResultPopup", null, null, null, null, (o, a) => {
                ShowContextMenu("/IaResultPopup");
            }),
                new ActionEntry("ViewItemDetails", null, Catalog.GetString("View Item Details"), null, null, (o, a) => {
                var item = source.SearchSource.FocusedItem;
                if (item != null && item.Id != null)
                {
                    string id = item.Id;
                    var src   = new DetailsSource(id, item.Title, item.MediaType);
                    source.AddChildSource(src);
                    Banshee.ServiceStack.ServiceManager.SourceManager.SetActiveSource(src);
                }
            }),
                new ActionEntry("OpenItemWebsite", Stock.JumpTo, Catalog.GetString("Open Webpage"), null, null, (o, a) => {
                string uri = null;
                var src    = ActiveSource as DetailsSource;
                if (src != null)
                {
                    uri = src.Item.Details.WebpageUrl;
                }
                else
                {
                    var item = source.SearchSource.FocusedItem;
                    if (item != null)
                    {
                        uri = item.WebpageUrl;
                    }
                }

                if (uri != null)
                {
                    Banshee.Web.Browser.Open(uri);
                }
            })
                );

            AddImportant(
                new ActionEntry("VisitInternetArchive", Stock.JumpTo, Catalog.GetString("Visit Archive.org"), null, null, (o, a) => {
                Banshee.Web.Browser.Open("http://archive.org");
            }),
                new ActionEntry("SubscribeToIASearch", Stock.Add,
                                Catalog.GetString("Subscribe"), null,
                                Catalog.GetString("Subscribe to this search as a podcast"), (o, a) => {
                var desc        = source.SearchSource.SearchDescription;
                var podcast     = new Hyena.Json.JsonObject();
                podcast["uri"]  = source.SearchSource.Search.RssUrl;
                podcast["name"] = String.Format(Catalog.GetString("Internet Archive: {0}"), desc.Name ?? desc.Query);
                Log.DebugFormat("InternetArchive: subscribing to search: {0} ({1})", podcast["name"], podcast["uri"]);

                ServiceManager.Get <DBusCommandService> ().PushArgument("podcast", podcast.ToString());
            }
                                )
                );

            AddUiFromFile("GlobalUI.xml");

            Register();
        }