Ejemplo n.º 1
0
        //FIXME move all this in a standalone class
        void HandleSlideshow(string tagname)
        {
            Tag tag;

            FSpot.Widgets.SlideShow slideshow = null;

            if (!string.IsNullOrEmpty(tagname))
            {
                tag = Database.Tags.GetTagByName(tagname);
            }
            else
            {
                tag = Database.Tags.GetTagById(Preferences.Get <int> (Preferences.SCREENSAVER_TAG));
            }

            IPhoto[] photos;
            if (tag != null)
            {
                photos = ObsoletePhotoQueries.Query(new Tag[] { tag });
            }
            else if (Preferences.Get <int> (Preferences.SCREENSAVER_TAG) == 0)
            {
                photos = ObsoletePhotoQueries.Query(new Tag [] {});
            }
            else
            {
                photos = new IPhoto [0];
            }

            // Minimum delay 1 second; default is 4s
            var delay = Math.Max(1.0, Preferences.Get <double> (Preferences.SCREENSAVER_DELAY));

            var window = new XScreenSaverSlide();

            window.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            window.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            if (photos.Length > 0)
            {
                Array.Sort(photos, new IPhotoComparer.RandomSort());
                slideshow = new FSpot.Widgets.SlideShow(new BrowsablePointer(new PhotoList(photos), 0), (uint)(delay * 1000), true);
                window.Add(slideshow);
            }
            else
            {
                Gtk.HBox outer = new Gtk.HBox();
                Gtk.HBox hbox  = new Gtk.HBox();
                Gtk.VBox vbox  = new Gtk.VBox();

                outer.PackStart(new Gtk.Label(string.Empty));
                outer.PackStart(vbox, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));
                vbox.PackStart(hbox, false, false, 0);
                hbox.PackStart(new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
                               false, false, 0);
                outer.PackStart(new Gtk.Label(string.Empty));

                string msg;
                string long_msg;

                if (tag != null)
                {
                    msg      = string.Format(Catalog.GetString("No photos matching {0} found"), tag.Name);
                    long_msg = string.Format(Catalog.GetString("The tag \"{0}\" is not applied to any photos. Try adding\n" +
                                                               "the tag to some photos or selecting a different tag in the\n" +
                                                               "F-Spot preference dialog."), tag.Name);
                }
                else
                {
                    msg      = Catalog.GetString("Search returned no results");
                    long_msg = Catalog.GetString("The tag F-Spot is looking for does not exist. Try\n" +
                                                 "selecting a different tag in the F-Spot preference\n" +
                                                 "dialog.");
                }

                Gtk.Label label = new Gtk.Label(msg);
                hbox.PackStart(label, false, false, 0);

                Gtk.Label long_label = new Gtk.Label(long_msg);
                long_label.Markup = string.Format("<small>{0}</small>", long_msg);

                vbox.PackStart(long_label, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));

                window.Add(outer);
                label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
                long_label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                long_label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
            }
            window.ShowAll();

            Register(window);
            GLib.Idle.Add(delegate {
                if (slideshow != null)
                {
                    slideshow.Start();
                }
                return(false);
            });
        }
Ejemplo n.º 2
0
        //FIXME move all this in a standalone class
        void HandleSlideshow(string tagname)
        {
            Tag tag;
            FSpot.Widgets.SlideShow slideshow = null;

            if (!String.IsNullOrEmpty (tagname))
                tag = Database.Tags.GetTagByName (tagname);
            else
                tag = Database.Tags.GetTagById (Preferences.Get<int> (Preferences.SCREENSAVER_TAG));

            IPhoto[] photos;
            if (tag != null)
                photos = Database.Photos.Query (new Tag[] {tag});
            else if (Preferences.Get<int> (Preferences.SCREENSAVER_TAG) == 0)
                photos = Database.Photos.Query (new Tag [] {});
            else
                photos = new IPhoto [0];

            // Minimum delay 1 second; default is 4s
            var delay = Math.Max (1.0, Preferences.Get<double> (Preferences.SCREENSAVER_DELAY));

            var window = new XScreenSaverSlide ();
            window.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
            window.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));

            if (photos.Length > 0) {
                Array.Sort (photos, new IPhotoComparer.RandomSort ());
                slideshow = new FSpot.Widgets.SlideShow (new BrowsablePointer (new PhotoList (photos), 0), (uint)(delay * 1000), true);
                slideshow.Transition = new FSpot.Transitions.DissolveTransition ();
                window.Add (slideshow);
            } else {
                Gtk.HBox outer = new Gtk.HBox ();
                Gtk.HBox hbox = new Gtk.HBox ();
                Gtk.VBox vbox = new Gtk.VBox ();

                outer.PackStart (new Gtk.Label (String.Empty));
                outer.PackStart (vbox, false, false, 0);
                vbox.PackStart (new Gtk.Label (String.Empty));
                vbox.PackStart (hbox, false, false, 0);
                hbox.PackStart (new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
                        false, false, 0);
                outer.PackStart (new Gtk.Label (String.Empty));

                string msg;
                string long_msg;

                if (tag != null) {
                    msg = String.Format (Catalog.GetString ("No photos matching {0} found"), tag.Name);
                    long_msg = String.Format (Catalog.GetString ("The tag \"{0}\" is not applied to any photos. Try adding\n" +
                                             "the tag to some photos or selecting a different tag in the\n" +
                                             "F-Spot preference dialog."), tag.Name);
                } else {
                    msg = Catalog.GetString ("Search returned no results");
                    long_msg = Catalog.GetString ("The tag F-Spot is looking for does not exist. Try\n" +
                                      "selecting a different tag in the F-Spot preference\n" +
                                      "dialog.");
                }

                Gtk.Label label = new Gtk.Label (msg);
                hbox.PackStart (label, false, false, 0);

                Gtk.Label long_label = new Gtk.Label (long_msg);
                long_label.Markup  = String.Format ("<small>{0}</small>", long_msg);

                vbox.PackStart (long_label, false, false, 0);
                vbox.PackStart (new Gtk.Label (String.Empty));

                window.Add (outer);
                label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
                label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));
                long_label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
                long_label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));
            }
            window.ShowAll ();

            Register (window);
            GLib.Idle.Add (delegate {
                if (slideshow != null)
                    slideshow.Start ();
                return false;
            });
        }
Ejemplo n.º 3
0
        //FIXME move all this in a standalone class
        void HandleSlideshow(string tagname)
        {
            Tag tag;

            Widgets.SlideShow slideshow = null;

            if (!string.IsNullOrEmpty(tagname))
            {
                tag = Database.Tags.GetTagByName(tagname);
            }
            else
            {
                tag = Database.Tags.GetTagById(Preferences.Get <int> (Preferences.SCREENSAVER_TAG));
            }

            IPhoto[] photos;
            if (tag != null)
            {
                photos = ObsoletePhotoQueries.Query(new Tag[] { tag });
            }
            else if (Preferences.Get <int> (Preferences.SCREENSAVER_TAG) == 0)
            {
                photos = ObsoletePhotoQueries.Query(new Tag[] { });
            }
            else
            {
                photos = new IPhoto[0];
            }

            // Minimum delay 1 second; default is 4s
            var delay = Math.Max(1.0, Preferences.Get <double> (Preferences.SCREENSAVER_DELAY));

            var window = new XScreenSaverSlide();

            window.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            window.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            if (photos.Length > 0)
            {
                Array.Sort(photos, new IPhotoComparer.RandomSort());
                slideshow = new Widgets.SlideShow(new BrowsablePointer(new PhotoList(photos), 0), (uint)(delay * 1000), true);
                window.Add(slideshow);
            }
            else
            {
                var outer = new Gtk.HBox();
                var hbox  = new Gtk.HBox();
                var vbox  = new Gtk.VBox();

                outer.PackStart(new Gtk.Label(string.Empty));
                outer.PackStart(vbox, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));
                vbox.PackStart(hbox, false, false, 0);
                hbox.PackStart(new Gtk.Image(Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
                               false, false, 0);
                outer.PackStart(new Gtk.Label(string.Empty));

                string msg;
                string long_msg;

                if (tag != null)
                {
                    msg      = Strings.NoPhotosMatchingXFound(tag.Name);
                    long_msg = Strings.TheTagXIsNotAppliedToAnyPhotosLongMsg(tag.Name);
                }
                else
                {
                    msg      = Strings.SearchReturnedNoResults;
                    long_msg = Strings.TheTagFSpotIsLookingForDoesNotExistTryLongMsg;
                }

                var label = new Gtk.Label(msg);
                hbox.PackStart(label, false, false, 0);

                var long_label = new Gtk.Label(long_msg)
                {
                    Markup = $"<small>{long_msg}</small>"
                };

                vbox.PackStart(long_label, false, false, 0);
                vbox.PackStart(new Gtk.Label(string.Empty));

                window.Add(outer);
                label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
                long_label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
                long_label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
            }
            window.ShowAll();

            Register(window);
            GLib.Idle.Add(delegate {
                if (slideshow != null)
                {
                    slideshow.Start();
                }
                return(false);
            });
        }