예제 #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();
        }
예제 #5
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 ();
        }
예제 #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();
        }