コード例 #1
0
        private void CloseWindow(object o, EventArgs args)
        {
            try {
                if (NotifyOnCloseSchema.Get())
                {
                    Gdk.Pixbuf image = IconThemeUtils.LoadIcon(48, Banshee.ServiceStack.Application.IconName);
                    if (image != null)
                    {
                        image = image.ScaleSimple(icon_size, icon_size, Gdk.InterpType.Bilinear);
                    }

                    Notification nf = new Notification(
                        Catalog.GetString("Still Running"),
                        Catalog.GetString("Banshee was closed to the notification area. " +
                                          "Use the <i>Quit</i> option to end your session."),
                        image, notif_area.Widget);
                    nf.Urgency = Urgency.Low;
                    nf.Timeout = 4500;
                    nf.Show();

                    NotifyOnCloseSchema.Set(false);
                }
            } catch {
            }

            elements_service.PrimaryWindow.SetVisible(false);
        }
コード例 #2
0
        private void InnerUpdate()
        {
            if (source == null || source.CurrentMessage == null || source.CurrentMessage.IsHidden)
            {
                Hide();
                return;
            }

            Message         = source.CurrentMessage.Text;
            Pixbuf          = null;
            ShowCloseButton = source.CurrentMessage.CanClose;
            Spinning        = source.CurrentMessage.IsSpinning;

            Pixbuf = source.CurrentMessage.IconNames == null ? null :
                     IconThemeUtils.LoadIcon(22, source.CurrentMessage.IconNames);

            ClearButtons();

            if (source.CurrentMessage.Actions != null)
            {
                foreach (MessageAction action in source.CurrentMessage.Actions)
                {
                    Button button = new ActionButton(action);
                    button.UseStock = action.IsStock;
                    AddButton(button);
                }
            }

            Show();
        }
コード例 #3
0
ファイル: UserJobTile.cs プロジェクト: SyaskiMasyaski/banshee
        private void UpdateIcons()
        {
            icon_names = job.IconNames;

            if (icon_pixbuf != null)
            {
                icon_pixbuf.Dispose();
                icon_pixbuf = null;
            }

            if (icon_names == null || icon_names.Length == 0)
            {
                icon.Hide();
                return;
            }

            icon_pixbuf = IconThemeUtils.LoadIcon(22, icon_names);
            if (icon_pixbuf != null)
            {
                icon.Pixbuf = icon_pixbuf;
                icon.Show();
                return;
            }

            icon_pixbuf = new Gdk.Pixbuf(icon_names[0]);
            if (icon_pixbuf != null)
            {
                Gdk.Pixbuf scaled = icon_pixbuf.ScaleSimple(22, 22, Gdk.InterpType.Bilinear);
                icon_pixbuf.Dispose();
                icon.Pixbuf = scaled;
                icon.Show();
            }
        }
コード例 #4
0
        public void AddPage(BaseContextPage page)
        {
            Hyena.Log.DebugFormat("Adding context page {0}", page.Id);

            // TODO delay adding the page.Widget until the page is first activated,
            // that way we don't even create those objects unless used
            var frame = new Hyena.Widgets.RoundedFrame();

            frame.Add(page.Widget);
            frame.Show();

            // TODO implement DnD?

            /*if (page is ITrackContextPage) {
             *  Gtk.Drag.DestSet (frame, DestDefaults.Highlight | DestDefaults.Motion,
             *                    new TargetEntry [] { Banshee.Gui.DragDrop.DragDropTarget.UriList },
             *                    Gdk.DragAction.Default);
             *  frame.DragDataReceived += delegate(object o, DragDataReceivedArgs args) {
             *  };
             * }*/

            page.Widget.Show();
            notebook.AppendPage(frame, null);
            pane_pages[page] = frame;

            // Setup the tab-like button that switches the notebook to this page
            var tab_image     = new Image(IconThemeUtils.LoadIcon(22, page.IconNames));
            var toggle_button = new RadioButton(radio_group)
            {
                Child         = tab_image,
                DrawIndicator = false,
                Relief        = ReliefStyle.None
            };

            TooltipSetter.Set(tooltip_host, toggle_button, page.Name);
            toggle_button.Clicked += (s, e) => {
                if (pane_pages.ContainsKey(page))
                {
                    if (page.State == ContextState.Loaded)
                    {
                        notebook.CurrentPage = notebook.PageNum(pane_pages[page]);
                    }
                    SetActivePage(page);
                }
            };
            toggle_button.ShowAll();
            vbox.PackStart(toggle_button, false, false, 0);
            pane_tabs[page] = toggle_button;

            pages.Add(page);

            if (initialized && pages.Count == 1)
            {
                SetActivePage(page);
                toggle_button.Active = true;
            }

            UpdateVisibility();
        }
		// ----------------------------------------------- //
		
		// FIXME: Ok, this is a real hack, it has half-support for buying multiple songs
		// but doenst really allow it yet. Will overwrite the song with the last one downloaded.
		protected virtual void ThreadWorker()
		{
			user_event = new ActiveUserEvent (String.Format (Catalog.GetString ("Purchasing {0} - {1}"), track.Artist, track.Title));
			
			user_event.CanCancel = false;
			user_event.Icon = IconThemeUtils.LoadIcon("document-save", 22); // FIXME: Get a nice icon
			
			user_event.Header = Catalog.GetString ("Purchasing");
			user_event.Message = String.Format ("{0} - {1}", track.Artist, track.Title);

			ArrayList songs = new ArrayList ();
			try {
				songs = plugin.Store.Buy (track.Data);
			} catch (Exception ex) {
				// FIXME: Error handling correct?
				user_event.Dispose ();
				HigMessageDialog.RunHigMessageDialog (null,
								      0,
								      MessageType.Error,
								      ButtonsType.Ok,
								      "Purchase Error",
								      String.Format ("There was an error while performing the purchase: {0}", ex.Message)); 				
				return;
			}

			Hashtable song, meta;

			for (int i = 0; i < songs.Count; i++) {
				song = (Hashtable) songs[i];
				meta = song[ "metaData" ] != null ? (Hashtable)song ["metaData"] : song;
				
				user_event.Header = String.Format (Catalog.GetString ("Downloading {0} of {1}"), i+1, songs.Count);
				user_event.Message = String.Format (Catalog.GetString ("{0} - {1}"), track.Artist, track.Title);

				try {
					byte [] buffer = plugin.Store.DownloadSong (song, new FairStore.Progress (ProgressUpdate));
					
					FileStream fs = new FileStream (MusicStorePlugin.GetLibraryPathForTrack (track), FileMode.CreateNew);
	                    		BinaryWriter bw = new BinaryWriter (fs);
                    			bw.Write (buffer);
                    			bw.Close ();
                    			fs.Close ();
				} catch (Exception ex) {
					// FIXME: Error handling correct?
					user_event.Dispose ();
					HigMessageDialog.RunHigMessageDialog (null,
									      0,
									      MessageType.Error,
									      ButtonsType.Ok,
									      "Download Error",
									      String.Format ("There was an error while performing the download: {0}", ex.Message)); 
					return;
				}
			}
			user_event.Dispose ();
		}
コード例 #6
0
ファイル: BookCover.cs プロジェクト: thoja21/banshee-1
        public void LoadImage(TrackMediaAttributes attr, string artwork_id)
        {
            if (Pixbuf != null)
            {
                Pixbuf.Dispose();
            }

            Pixbuf = ServiceManager.Get <ArtworkManager> ().LookupScalePixbuf(artwork_id, HeightRequest)
                     ?? IconThemeUtils.LoadIcon("audiobook", HeightRequest);
        }
コード例 #7
0
 protected Cairo.ImageSurface GetDefaultSurface()
 {
     Cairo.ImageSurface surface = new Cairo.ImageSurface(Cairo.Format.ARGB32, CoverManager.TextureSize, CoverManager.TextureSize);
     Cairo.Context      context = new Cairo.Context(surface);
     Gdk.CairoHelper.SetSourcePixbuf(context, IconThemeUtils.LoadIcon(CoverManager.TextureSize, "media-optical", "browser-album-cover"), 0, 0);
     context.Paint();
     //((IDisposable) context.Target).Dispose();
     ((IDisposable)context).Dispose();
     return(surface);
 }
コード例 #8
0
        protected override void LoadPixbufs()
        {
            base.LoadPixbufs();

            // Downloading
            Pixbufs[base.PixbufCount + 0] = IconThemeUtils.LoadIcon(PixbufSize, "document-save", "go-bottom");

            // Downloaded
            //Pixbufs[base.PixbufCount + 1] = IconThemeUtils.LoadIcon (PixbufSize, "podcast-new");
        }
コード例 #9
0
        public RecommendationPane(ContextPage contextPage) : base()
        {
            this.context_page    = contextPage;
            main_box             = this;
            main_box.BorderWidth = 5;

            artist_box = new TitledList(Catalog.GetString("Recommended Artists"));
            artist_box.ShowAll();
            similar_artists_view    = new TileView(2);
            similar_artists_view_sw = new Gtk.ScrolledWindow();
            similar_artists_view_sw.SetPolicy(PolicyType.Never, PolicyType.Automatic);
            similar_artists_view_sw.Add(similar_artists_view);
            similar_artists_view_sw.ShowAll();
            artist_box.PackStart(similar_artists_view_sw, true, true, 0);

            album_box = new TitledList(null);
            album_box.TitleWidthChars = 25;
            album_box.SizeAllocated  += OnSideSizeAllocated;
            album_list = new VBox();
            album_box.PackStart(album_list, false, false, 0);

            track_box = new TitledList(null);
            track_box.SizeAllocated  += OnSideSizeAllocated;
            track_box.TitleWidthChars = 25;
            track_list = new VBox();
            track_box.PackStart(track_list, true, true, 0);

            no_artists_pane           = new MessagePane();
            no_artists_pane.NoShowAll = true;
            no_artists_pane.Visible   = false;
            string no_results_message;

            if (!ApplicationContext.Debugging)
            {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-sad", Stock.DialogError);
                no_results_message         = Catalog.GetString("No similar artists found");
            }
            else
            {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource("no-results.png");
                no_results_message         = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText(no_results_message));
            artist_box.PackEnd(no_artists_pane, true, true, 0);

            main_box.PackStart(artist_box, true, true, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(album_box, false, false, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(track_box, false, false, 5);

            no_artists_pane.Hide();
        }
コード例 #10
0
        static PodcastPixbufs()
        {
            new_podcast_icon = Gdk.Pixbuf.LoadFromResource("banshee-new.png");

            podcast_icon_16 = Gdk.Pixbuf.LoadFromResource("podcast-icon-16.png");
            podcast_icon_22 = Gdk.Pixbuf.LoadFromResource("podcast-icon-22.png");
            podcast_icon_48 = Gdk.Pixbuf.LoadFromResource("podcast-icon-48.png");

            activity_column_icon = IconThemeUtils.LoadIcon(16, "audio-volume-high", "blue-speaker");
            download_column_icon = Gdk.Pixbuf.LoadFromResource("document-save-as-16.png");
        }
コード例 #11
0
 private void SetSource(TreeIter iter, Source source)
 {
     Gdk.Pixbuf icon = source.Icon;
     if (icon == null)
     {
         icon = IconThemeUtils.LoadIcon(22, "source-library");
     }
     SetValue(iter, 0, icon);
     SetValue(iter, 1, source.Name);
     SetValue(iter, 2, source);
 }
コード例 #12
0
 private static void CreateUserEventProxy(object o, EventArgs args)
 {
     if (userEvent == null)
     {
         userEvent                  = new ActiveUserEvent(Catalog.GetString("Download"));
         userEvent.Icon             = IconThemeUtils.LoadIcon(Stock.Network, 22);
         userEvent.Header           = Catalog.GetString("Downloading Files");
         userEvent.Message          = Catalog.GetString("Initializing downloads");
         userEvent.CancelRequested += OnUserEventCancelRequestedHandler;
         cancel_requested           = false;
     }
 }
コード例 #13
0
        protected override void LoadPixbufs()
        {
            base.LoadPixbufs();

            // Downloading
            Pixbufs[base.PixbufCount + 0]     = IconThemeUtils.LoadIcon(PixbufSize, "document-save", "go-bottom");
            StatusNames[base.PixbufCount + 0] = Catalog.GetString("Downloading");

            // Podcast is Downloaded
            Pixbufs[base.PixbufCount + 1]     = IconThemeUtils.LoadIcon(PixbufSize, "podcast-new");
            StatusNames[base.PixbufCount + 1] = Catalog.GetString("New");
        }
コード例 #14
0
        protected void SetupViewport()
        {
            Stage.Color = new Clutter.Color(0x00, 0x00, 0x00, 0xff);
            cover_manager.SetRotation(RotateAxis.X, viewportAngleX, Stage.Width / 2, Stage.Height / 2, 0);
            Stage.Add(cover_manager);

            cover_manager.EmptyActor.SetToPb(
                IconThemeUtils.LoadIcon(cover_manager.TextureSize, "gtk-stop", "clutterflow-large.png")
                );
            CoverManager.DoubleClickTime = (uint)Gtk.Settings.GetForScreen(this.Screen).DoubleClickTime;
            cover_manager.LowerBottom();
            cover_manager.Show();
        }
コード例 #15
0
ファイル: CoverArtBrush.cs プロジェクト: sundermann/cubano
        private void LoadMissingImages()
        {
            if (missing_audio_surface == null)
            {
                missing_audio_surface = new PixbufImageSurface(IconThemeUtils.LoadIcon(
                                                                   missing_artwork_size, "audio-x-generic"), true);
            }

            if (missing_video_surface == null)
            {
                missing_video_surface = new PixbufImageSurface(IconThemeUtils.LoadIcon(
                                                                   missing_artwork_size, "video-x-generic"), true);
            }
        }
コード例 #16
0
        public UnsupportedDatabaseView(IpodSource source) : base(source)
        {
            this.source = source;

            pane              = new MessagePane();
            pane.HeaderIcon   = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError);
            pane.ArrowIcon    = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward);
            pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                                              GLib.Markup.EscapeText(Catalog.GetString("Unable to read your iPod")));

            AddPaneItems();

            Add(pane);
            ShowAll();
        }
コード例 #17
0
        private void LoadPixbufs()
        {
            if (pixbufs == null)
            {
                pixbufs = new Gdk.Pixbuf[attributes.Length];
            }

            for (int i = 0; i < attributes.Length - 1; i++)
            {
                pixbufs[i] = IconThemeUtils.LoadIcon(ICON_SIZE, String.Format("creative-commons-{0}", attributes[i]));
            }

            // HACK to enable 'publicdomain' to work
            pixbufs[attributes.Length - 1] = pixbufs[attributes.Length - 2];
        }
コード例 #18
0
        public ColumnCellArtistCover(bool smallImagesUsed) : base(null, true)
        {
            use_small_images    = smallImagesUsed;
            artwork_initialized = false;

            image_size = use_small_images ? small_image_size : normal_image_size;

            default_cover_image
                = PixbufImageSurface.Create(IconThemeUtils.LoadIcon(image_size, "media-optical", "browser-album-cover"));

            column_controller = new ColumnController();
            var current_layout = new Column("Artist", this, 1.0);

            column_controller.Add(current_layout);

            ServiceManager.SourceManager.ActiveSourceChanged += HandleActiveSourceChanged;
        }
コード例 #19
0
        public static Gdk.Pixbuf ResolveIcon(Source source, int size, string @namespace)
        {
            string name_property = @namespace == null
                ? "Icon.Name"
                : String.Format("{0}.Icon.Name", @namespace);

            string pixbuf_property = @namespace == null
                ? String.Format("Icon.Pixbuf_{0}", size)
                : String.Format("{0}.Icon.Pixbuf_{1}", @namespace, size);

            Gdk.Pixbuf icon = source.Properties.Get <Gdk.Pixbuf> (pixbuf_property);

            if (icon != null)
            {
                return(icon);
            }

            Type     icon_type = source.Properties.GetType(name_property);
            Assembly asm       = source.Properties.Get <Assembly> ("ResourceAssembly");

            if (icon_type == typeof(string))
            {
                icon = IconThemeUtils.LoadIcon(asm, size, source.Properties.Get <string> (name_property));
            }
            else if (icon_type == typeof(string []))
            {
                icon = IconThemeUtils.LoadIcon(asm, size, source.Properties.Get <string[]> (name_property));
            }

            if (icon == null)
            {
                icon = Banshee.Gui.IconThemeUtils.LoadIcon(size, "image-missing");
            }

            if (icon != null)
            {
                source.Properties.Set <Gdk.Pixbuf> (pixbuf_property, icon);
            }

            return(icon);
        }
コード例 #20
0
        public DaapErrorView(DaapSource source, DaapErrorType failure) : base()
        {
            //AppPaintable = true;
            //BorderWidth = 10;

            this.source  = source;
            this.failure = failure;

            pane              = new MessagePane();
            pane.HeaderIcon   = IconThemeUtils.LoadIcon(48, "face-surprise", Stock.DialogError);
            pane.ArrowIcon    = IconThemeUtils.LoadIcon(24, "go-next", Stock.GoForward);
            pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                                              GLib.Markup.EscapeText((failure == DaapErrorType.UserDisconnect
                    ? Catalog.GetString("Disconnected from music share")
                    : Catalog.GetString("Unable to connect to music share"))));

            AddPaneItems();
            pane.Show();

            Add(pane);
        }
コード例 #21
0
        protected virtual void LoadPixbufs()
        {
            if (pixbufs != null && pixbufs.Length > 0)
            {
                for (int i = 0; i < pixbufs.Length; i++)
                {
                    if (pixbufs[i] != null)
                    {
                        pixbufs[i].Dispose();
                        pixbufs[i] = null;
                    }
                }
            }

            if (pixbufs == null)
            {
                pixbufs = new Gdk.Pixbuf[PixbufCount];
            }

            pixbufs[(int)Icon.Playing]   = IconThemeUtils.LoadIcon(PixbufSize, "media-playback-start");
            pixbufs[(int)Icon.Paused]    = IconThemeUtils.LoadIcon(PixbufSize, "media-playback-pause");
            pixbufs[(int)Icon.Error]     = IconThemeUtils.LoadIcon(PixbufSize, "emblem-unreadable", "dialog-error");
            pixbufs[(int)Icon.Protected] = IconThemeUtils.LoadIcon(PixbufSize, "emblem-readonly", "dialog-error");
            pixbufs[(int)Icon.External]  = IconThemeUtils.LoadIcon(PixbufSize, "x-office-document");

            if (status_names == null)
            {
                status_names = new string[PixbufCount];
                for (int i = 0; i < PixbufCount; i++)
                {
                    status_names[i] = "";
                }
            }

            status_names[(int)Icon.Playing]   = Catalog.GetString("Playing");
            status_names[(int)Icon.Paused]    = Catalog.GetString("Paused");
            status_names[(int)Icon.Error]     = Catalog.GetString("Error");
            status_names[(int)Icon.Protected] = Catalog.GetString("Protected");
            status_names[(int)Icon.External]  = Catalog.GetString("External Document");
        }
コード例 #22
0
        private void CreateTabButtonBox()
        {
            vbox = new VBox();

            HBox hbox = new HBox();
            var  max  = new Button(new Image(IconThemeUtils.LoadIcon("context-pane-maximize", 7)));

            max.Clicked += (o, a) => { large = !large; expand_handler(large); };
            TooltipSetter.Set(tooltip_host, max, Catalog.GetString("Make the context pane larger or smaller"));

            var close = new Button(new Image(IconThemeUtils.LoadIcon("context-pane-close", 7)));

            close.Clicked += (o, a) => ShowAction.Activate();
            TooltipSetter.Set(tooltip_host, close, Catalog.GetString("Hide context pane"));

            max.Relief = close.Relief = ReliefStyle.None;
            hbox.PackStart(max, false, false, 0);
            hbox.PackStart(close, false, false, 0);
            vbox.PackStart(hbox, false, false, 0);

            PackStart(vbox, false, false, 6);
            vbox.ShowAll();
        }
コード例 #23
0
ファイル: ImportDialog.cs プロジェクト: thoja21/banshee-1
 private Gdk.Pixbuf GetIcon(IImportSource source)
 {
     return(IconThemeUtils.LoadIcon(22, source.IconNames));
 }
コード例 #24
0
        private void ShowTrackNotification()
        {
            // This has to happen before the next if, otherwise the last_* members aren't set correctly.
            if (current_track == null || (notify_last_title == current_track.DisplayTrackTitle &&
                                          notify_last_artist == current_track.DisplayArtistName))
            {
                return;
            }

            notify_last_title  = current_track.DisplayTrackTitle;
            notify_last_artist = current_track.DisplayArtistName;

            if (!show_notifications)
            {
                return;
            }

            foreach (var window in elements_service.ContentWindows)
            {
                if (window.HasToplevelFocus)
                {
                    return;
                }
            }

            bool is_notification_daemon = false;

            try {
                var name = Notifications.Global.ServerInformation.Name;
                is_notification_daemon = name == "notification-daemon" || name == "Notification Daemon";
            } catch {
                // This will be reached if no notification daemon is running
                return;
            }

            string message = GetByFrom(
                current_track.ArtistName, current_track.DisplayArtistName,
                current_track.AlbumTitle, current_track.DisplayAlbumTitle);

            if (artwork_manager_service == null)
            {
                artwork_manager_service = ServiceManager.Get <ArtworkManager> ();
            }

            Gdk.Pixbuf image = null;

            if (artwork_manager_service != null)
            {
                image = is_notification_daemon
                    ? artwork_manager_service.LookupScalePixbuf(current_track.ArtworkId, 42)
                    : artwork_manager_service.LookupPixbuf(current_track.ArtworkId);
            }

            if (image == null)
            {
                image = IconThemeUtils.LoadIcon(48, "audio-x-generic");
                if (image != null)
                {
                    image.ScaleSimple(42, 42, Gdk.InterpType.Bilinear);
                }
            }

            try {
                if (current_nf == null)
                {
                    current_nf = new Notification(current_track.DisplayTrackTitle,
                                                  message, image, notif_area.Widget);
                }
                else
                {
                    current_nf.Summary = current_track.DisplayTrackTitle;
                    current_nf.Body    = message;
                    current_nf.Icon    = image;
                    current_nf.AttachToWidget(notif_area.Widget);
                }
                current_nf.Urgency = Urgency.Low;
                current_nf.Timeout = 4500;
                if (!current_track.IsLive && ActionsSupported && interface_action_service.PlaybackActions["NextAction"].Sensitive)
                {
                    current_nf.AddAction("skip-song", Catalog.GetString("Skip this item"), OnSongSkipped);
                }
                current_nf.Show();
            } catch (Exception e) {
                Hyena.Log.Warning(Catalog.GetString("Cannot show notification"), e.Message, false);
            }
        }
コード例 #25
0
        private void CreateWidget()
        {
            ShadowType = ShadowType.In;

            EventBox event_box = new EventBox();

            event_box.ModifyBg(StateType.Normal, Style.Base(StateType.Normal));

            main_box             = new HBox();
            main_box.BorderWidth = 5;

            similar_box = new VBox(false, 3);
            tracks_box  = new VBox(false, 3);
            albums_box  = new VBox(false, 3);

            Label similar_header = new Label();

            similar_header.Xalign    = 0;
            similar_header.Ellipsize = Pango.EllipsizeMode.End;
            similar_header.Markup    = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(
                                                         Catalog.GetString("Recommended Artists")));
            similar_box.PackStart(similar_header, false, false, 0);

            tracks_header            = new Label();
            tracks_header.Xalign     = 0;
            tracks_header.WidthChars = 25;
            tracks_header.Ellipsize  = Pango.EllipsizeMode.End;
            tracks_box.PackStart(tracks_header, false, false, 0);

            albums_header            = new Label();
            albums_header.Xalign     = 0;
            albums_header.WidthChars = 25;
            albums_header.Ellipsize  = Pango.EllipsizeMode.End;
            albums_box.PackStart(albums_header, false, false, 0);

            similar_artists_view = new TileView(2);
            similar_artists_view.ModifyBg(StateType.Normal, Style.Base(StateType.Normal));
            similar_artists_view_sw = new ScrolledWindow();
            similar_artists_view_sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            similar_artists_view_sw.Add(similar_artists_view);
            similar_artists_view_sw.ShowAll();
            similar_box.PackEnd(similar_artists_view_sw, true, true, 0);

            no_artists_pane = new MessagePane();
            string no_results_message;

            if (!Globals.ArgumentQueue.Contains("debug"))
            {
                no_artists_pane.HeaderIcon = IconThemeUtils.LoadIcon(48, "face-sad", Stock.DialogError);
                no_results_message         = Catalog.GetString("No similar artists found");
            }
            else
            {
                no_artists_pane.HeaderIcon = Gdk.Pixbuf.LoadFromResource("no-results.png");
                no_results_message         = "No one likes your music, fool!";
            }

            no_artists_pane.HeaderMarkup = String.Format("<big><b>{0}</b></big>",
                                                         GLib.Markup.EscapeText(no_results_message));
            similar_box.PackEnd(no_artists_pane, true, true, 0);

            tracks_items_box = new VBox(false, 0);
            tracks_box.PackEnd(tracks_items_box, true, true, 0);

            albums_items_box = new VBox(false, 0);
            albums_box.PackEnd(albums_items_box, true, true, 0);

            main_box.PackStart(similar_box, true, true, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(tracks_box, false, false, 5);
            main_box.PackStart(new VSeparator(), false, false, 0);
            main_box.PackStart(albums_box, false, false, 5);

            event_box.Add(main_box);
            Add(event_box);
        }
        private void BuildWindow()
        {
            DefaultWidth = 475;

            BorderWidth       = 6;
            VBox.Spacing      = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            HBox box = new HBox();

            box.BorderWidth = 6;
            box.Spacing     = 12;

            Image image = new Image(IconThemeUtils.LoadIcon(48, "podcast"));

            image.Yalign = 0.0f;

            box.PackStart(image, false, true, 0);

            VBox contentBox = new VBox();

            contentBox.Spacing = 12;

            Label header = new Label();

            header.Markup = String.Format(
                "<big><b>{0}</b></big>",
                GLib.Markup.EscapeText(Catalog.GetString("Subscribe to New Podcast"))
                );

            header.Justify = Justification.Left;
            header.SetAlignment(0.0f, 0.0f);

            var message = new WrapLabel()
            {
                Markup = Catalog.GetString(
                    "Please enter the URL of the podcast to which you would like to subscribe."
                    ),
                Wrap = true
            };

            url_entry = new Entry();
            url_entry.ActivatesDefault = true;

            // If the user has copied some text to the clipboard that starts with http, set
            // our url entry to it and select it
            Clipboard clipboard = Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));

            if (clipboard != null)
            {
                string pasted = clipboard.WaitForText();
                if (!String.IsNullOrEmpty(pasted))
                {
                    if (pasted.StartsWith("http"))
                    {
                        url_entry.Text = pasted.Trim();
                        url_entry.SelectRegion(0, url_entry.Text.Length);
                    }
                }
            }

            contentBox.PackStart(header, true, true, 0);
            contentBox.PackStart(message, true, true, 0);

            var url_box = new HBox()
            {
                Spacing = 12
            };

            url_box.PackStart(new Label(Catalog.GetString("URL:")), false, false, 0);
            url_box.PackStart(url_entry, true, true, 0);
            contentBox.PackStart(url_box, false, false, 0);

            var options_label = new Label()
            {
                Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString("Subscription Options"))),
                Xalign = 0f
            };

            download_check = new CheckButton(Catalog.GetString("Download new episodes"));
            archive_check  = new CheckButton(Catalog.GetString("Archive all episodes except the newest one"));
            var options_box = new VBox()
            {
                Spacing = 3
            };

            options_box.PackStart(options_label, false, false, 0);
            options_box.PackStart(new Gtk.Alignment(0f, 0f, 0f, 0f)
            {
                LeftPadding = 12, Child = download_check
            }, false, false, 0);
            options_box.PackStart(new Gtk.Alignment(0f, 0f, 0f, 0f)
            {
                LeftPadding = 12, Child = archive_check
            }, false, false, 0);
            contentBox.PackStart(options_box, false, false, 0);

            box.PackStart(contentBox, true, true, 0);

            AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
            AddButton(Catalog.GetString("Subscribe"), ResponseType.Ok, true);

            box.ShowAll();
            VBox.Add(box);
        }
コード例 #27
0
        private void AddPaneItems()
        {
            if (info_link_clicked)
            {
                bool file_exists = System.IO.File.Exists(Paths.Combine(
                                                             source.IpodDevice.ControlPath, "iTunes", "iTunesDB"));

                if (file_exists)
                {
                    pane.Append(Catalog.GetString(
                                    "You have used this iPod with a version of iTunes that saves a " +
                                    "version of the song database for your iPod that is too new " +
                                    "for Banshee to recognize.\n\n" +

                                    "Banshee can rebuild your database, but some settings might be lost. " +
                                    "Using Banshee and iTunes with the same iPod is not recommended."
                                    ));

                    LinkLabel link = new LinkLabel();
                    link.Xalign = 0.0f;
                    link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                                                                                         "Learn more about Banshee's iPod support")));

                    link.Clicked += delegate { Banshee.Web.Browser.Open("http://banshee-project.org/IpodAndItunes"); };

                    link.Show();
                    pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
                }
                else
                {
                    pane.Append(Catalog.GetString(
                                    "An iPod database could not be found on this device.\n\n" +
                                    "Banshee can build a new database for you."
                                    ));
                }
            }
            else
            {
                LinkLabel link = new LinkLabel();
                link.Xalign = 0.0f;
                link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                                                                                     "What is the reason for this?")));

                link.Clicked += delegate {
                    info_link_clicked = true;
                    pane.Clear();
                    AddPaneItems();
                };

                link.Show();
                pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
            }

            if (source.IpodDevice.VolumeInfo.IsMountedReadOnly)
            {
                pane.Append(Catalog.GetString("Your iPod is mounted read only. Banshee can not restore your iPod."),
                            true, IconThemeUtils.LoadIcon(48, "dialog-error"));
                return;
            }

            LinkLabel rebuild_link = new LinkLabel();

            rebuild_link.Xalign = 0.0f;
            rebuild_link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                                                                                         "Rebuild iPod Database...")));
            rebuild_link.Clicked += OnRebuildDatabase;
            rebuild_link.Show();
            pane.Append(rebuild_link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
        }
コード例 #28
0
        private void InitComponents()
        {
            Resizable      = true;
            HeightRequest  = 425;
            WidthRequest   = 410;
            WindowPosition = WindowPosition.Center;
            Icon           = IconThemeUtils.LoadIcon("banshee", 16);

            var vbox = new VBox()
            {
                Spacing     = 6,
                BorderWidth = 12
            };

            track_info_display = new ClassicTrackInfoDisplay();
            vbox.PackStart(track_info_display, false, false, 0);

            lyrics_browser = new LyricsBrowser();

            lyrics_pane = new ScrolledWindow();
            lyrics_pane.Add(lyrics_browser);

            var frame = new Frame();

            frame.Add(lyrics_pane);

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

            var button_box = new HButtonBox()
            {
                Spacing     = 6,
                BorderWidth = 1,
                LayoutStyle = ButtonBoxStyle.End
            };

            var copy_button = new Button("gtk-copy")
            {
                TooltipText = AddinManager.CurrentLocalizer.GetString("Copy lyrics to clipboard")
            };
            var close_button = new Button("gtk-close");

            refresh_button = new Button("gtk-refresh");
            save_button    = new Button("gtk-save");

            button_box.PackStart(copy_button, false, false, 0);
            button_box.PackStart(refresh_button, false, false, 0);
            button_box.PackStart(save_button, false, false, 0);
            button_box.PackStart(close_button, false, false, 0);

            vbox.PackStart(button_box, false, false, 0);

            Add(vbox);
            if (Child != null)
            {
                Child.ShowAll();
            }

            text_view          = new TextView();
            text_view.WrapMode = WrapMode.Word;

            Hide();

            KeyPressEvent += OnKeyPressed;
            DeleteEvent   += delegate(object o, DeleteEventArgs args) {
                OnClose(this, null);
                args.RetVal = true;
            };

            refresh_button.Clicked += OnRefresh;
            save_button.Clicked    += OnSaveLyrics;
            close_button.Clicked   += OnClose;
            copy_button.Clicked    += OnCopy;

            lyrics_browser.AddLinkClicked       += ManuallyAddLyrics;
            LyricsManager.Instance.LoadStarted  += lyrics_browser.OnLoading;
            LyricsManager.Instance.LoadFinished += lyrics_browser.LoadString;
            SwitchTo(HTML_MODE);
        }
コード例 #29
0
        private void AddPaneItems()
        {
            if (info_link_clicked)
            {
                LinkLabel link = new LinkLabel();
                link.Xalign = 0.0f;
                link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                                                                                     "Back")));

                link.Clicked += delegate(object o, EventArgs args) {
                    info_link_clicked = false;
                    pane.Clear();
                    AddPaneItems();
                };

                link.Show();
                pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true,
                            IconThemeUtils.LoadIcon(24, "go-previous", Stock.GoBack));

                pane.Append(Catalog.GetString(
                                "iTunes\u00ae 7 introduced new compatibility issues and currently only " +
                                "works with other iTunes\u00ae 7 clients.\n\n" +
                                "No third-party clients can connect to iTunes\u00ae music shares anymore. " +
                                "This is an intentional limitation by Apple in iTunes\u00ae 7 and newer, we apologize for " +
                                "the unfortunate inconvenience."
                                ));
            }
            else
            {
                if (failure != DaapErrorType.UserDisconnect)
                {
                    Label header_label = new Label();
                    header_label.Markup = String.Format("<b>{0}</b>", GLib.Markup.EscapeText(Catalog.GetString(
                                                                                                 "Common reasons for connection failures:")));
                    header_label.Xalign = 0.0f;
                    header_label.Show();

                    pane.Append(header_label, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, false);

                    pane.Append(Catalog.GetString("The provided login credentials are invalid"));
                    pane.Append(Catalog.GetString("The login process was canceled"));
                    pane.Append(Catalog.GetString("Too many users are connected to this share"));
                }
                else
                {
                    pane.Append(Catalog.GetString("You are no longer connected to this music share"));
                }

                if (failure == DaapErrorType.UserDisconnect || failure == DaapErrorType.InvalidAuthentication)
                {
                    Button button = new Button(Catalog.GetString("Try connecting again"));
                    button.Clicked += delegate { source.Activate(); };

                    HBox bbox = new HBox();
                    bbox.PackStart(button, false, false, 0);
                    bbox.ShowAll();

                    pane.Append(bbox, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, false);
                    return;
                }

                LinkLabel link = new LinkLabel();
                link.Xalign = 0.0f;
                link.Markup = String.Format("<u>{0}</u>", GLib.Markup.EscapeText(Catalog.GetString(
                                                                                     "The music share is hosted by iTunes\u00ae 7 or newer")));

                link.Clicked += delegate(object o, EventArgs args) {
                    info_link_clicked = true;
                    pane.Clear();
                    AddPaneItems();
                };

                link.Show();
                pane.Append(link, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, true);
            }
        }
コード例 #30
0
        private void BuildWindow()
        {
            DefaultWidth = 475;

            BorderWidth       = 6;
            VBox.Spacing      = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            HBox box = new HBox();

            box.BorderWidth = 6;
            box.Spacing     = 12;

            Image image = new Image(IconThemeUtils.LoadIcon(48, "podcast"));

            image.Yalign = 0.0f;

            box.PackStart(image, false, true, 0);

            VBox contentBox = new VBox();

            contentBox.Spacing = 12;

            Label header = new Label();

            header.Markup = String.Format(
                "<big><b>{0}</b></big>",
                GLib.Markup.EscapeText(Catalog.GetString("Subscribe to New Podcast"))
                );

            header.Justify = Justification.Left;
            header.SetAlignment(0.0f, 0.0f);

            WrapLabel message = new WrapLabel();

            message.Markup = Catalog.GetString(
                "Please enter the URL of the podcast to which you would like to subscribe."
                );

            message.Wrap = true;

            VBox sync_vbox = new VBox();

            VBox expander_children = new VBox();

            //expander_children.BorderWidth = 6;
            expander_children.Spacing = 6;

            Label sync_text = new Label(
                Catalog.GetString("When new episodes are available:  ")
                );

            sync_text.SetAlignment(0.0f, 0.0f);
            sync_text.Justify = Justification.Left;

            syncCombo = new SyncPreferenceComboBox();

            expander_children.PackStart(sync_text, true, true, 0);
            expander_children.PackStart(syncCombo, true, true, 0);

            sync_vbox.Add(expander_children);

            url_entry = new Entry();
            url_entry.ActivatesDefault = true;

            // If the user has copied some text to the clipboard that starts with http, set
            // our url entry to it and select it
            Clipboard clipboard = Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", false));

            if (clipboard != null)
            {
                string pasted = clipboard.WaitForText();
                if (!String.IsNullOrEmpty(pasted))
                {
                    if (pasted.StartsWith("http"))
                    {
                        url_entry.Text = pasted.Trim();
                        url_entry.SelectRegion(0, url_entry.Text.Length);
                    }
                }
            }

            Table table = new Table(1, 2, false);

            table.RowSpacing    = 6;
            table.ColumnSpacing = 12;

            table.Attach(
                new Label(Catalog.GetString("URL:")), 0, 1, 0, 1,
                AttachOptions.Shrink, AttachOptions.Shrink, 0, 0
                );

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

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

            contentBox.PackStart(header, true, true, 0);
            contentBox.PackStart(message, true, true, 0);

            contentBox.PackStart(table, true, true, 0);

            box.PackStart(contentBox, true, true, 0);

            AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
            AddButton(Catalog.GetString("Subscribe"), ResponseType.Ok, true);

            box.ShowAll();
            VBox.Add(box);
        }