Shotwell 0.10.1 Released

Yorba has released version 0.10.1 of Shotwell, an update to our digital photo organizer. This is a bug fix release; we recommend all users update.

Changelog:

  • Fixes “Hide Photos Already Imported”
  • Multiple editing bugs fixed
  • Resolves crash when two or more cameras have the same name
  • Documentation now includes saved searches
  • Piwigo bugs fixed
  • Translation updates

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Binaries for Ubuntu Natty and Maverick are available at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

A few of my favorite Vala things: enums

Working with Vala for over two years now, I’ve come to admire more and more of its language features.  Some of them were quite surprising when I discovered them, making me wonder why exactly they were implemented this way or that.  Once I dug through the learning curve, I came to understand and appreciate their power.  One of those language features is enum.

Enumerated types, of course, have been around for quite a while.  In many languages they’re little more than auto-generated constant int’s (<cough> C </cough>) while in others they have more type safety and correctness surrounding them (such as Java’s approach, which takes enums to the extreme).  Vala takes an interesting middle ground in this field.

On one hand, enums in Vala are much like C’s enums; they can be treated as ints, plain as day, and convert back and forth with amazing ease:

enum Suit {
 SPADE,
 HEART,
 DIAMOND,
 CLUB
}

void main() {
 Suit suit = Suit.SPADE;
 int i = suit;

 stdout.printf("suit=%d i=%dn", suit, i);
}

Personally, I’d prefer it if at least a cast was required, but that’s a nit.

What’s useful about enums is that Vala provides an automatic to_string() method for them, just like int, but with a twist:

stdout.printf("suit=%s i=%sn", suit.to_string(), i.to_string());

Produces:

suit=SUIT_SPADE i=0

Very handy for debugging! Unfortunately, SUIT_SPADE is not such a great text label for your soon-to-be-famous GTK+ War! card game. It turns out you can override the to_string() method by providing your own:

enum Suit {
    SPADE,
    HEART,
    DIAMOND,
    CLUB;

    public string to_string() {
        switch (this) {
            case SPADE:
                return "Spade";

            case HEART:
                return "Heart";

            case DIAMOND:
                return "Diamond";

            case CLUB:
                return "Club";

            default:
                assert_not_reached();
        }
    }
}

Note some important things here:

  • The semicolon must be used to end the list of enumerated values;
  • although you’re “overriding” Vala’s built-in to_string() method, you don’t use the override keyword (unlike Java, enums are not a class nor derived from one);
  • use assert_not_reached() (or some debugging/logging action) in the default case, as Vala allows for transparent casting of bare ints to enums.

That said, this is pretty slick now.  enum now looks more like it’s object-oriented brethren than a third cousin twice-removed.  And Vala goes all the way with this, allowing any number of methods (member and static) be added to an enumeration:

enum Suit {
    SPADE,
    HEART,
    DIAMOND,
    CLUB;

    public string to_string() {
        switch (this) {
            case SPADE:
                return "Spade";

            case HEART:
                return "Heart";

            case DIAMOND:
                return "Diamond";

            case CLUB:
                return "Club";

            default:
                assert_not_reached();
        }
    }

    public bool is_higher_than(Suit suit) {
        return this < suit;
    }

    public static Suit[] all() {
        return { SPADE, HEART, DIAMOND, CLUB };
     }
}

void main() {
     stdout.printf("%s > %s?  %s.n", Suit.SPADE.to_string(),
        Suit.HEART.to_string(),
        Suit.SPADE.is_higher_than(Suit.HEART).to_string());

    foreach (Suit suit in Suit.all())
        stdout.printf("%sn", suit.to_string());
}

Produces:

Spade > Heart?  true.
Spade
Heart
Diamond
Club

By riding this middle ground (enums really just ints under the covers, but extensible with methods) Vala offers some of the power and flexibility that a Java-like language has while still producing C code compatible with other languages (useful when building a library).  In fact, the automatic to_string() method works even with enums from non-Vala libraries (i.e. GLib, GTK, etc.); valac generates the function for you (that is, the library doesn’t have to supply one, although if it does, you can patch it in via its VAPI).

The above code sample points to the other item I would throw on the enum wishlist: either an automatic method (like to_string()) that returns an array of all enumerated values, or simply make the type name iterable:

    foreach (Suit suit in Suit)
        stdout.printf("%sn", suit.to_string());

I realize this looks wrong in so many ways, but so does switch(this) when you first encounter it. Whatever the syntax, iterating over all the values of an enumerated type is a common task, and manually maintaining an array (as in the above example) is error-prone.

Addendum: Eric ran into a bug with enums and to_string() that’s worth mentioning: if you call an implicit (i.e. auto-generated) to_string() from within an enum method, you currently have to use this, that is, this.to_string().  The bug is reported here.

Update: There is an outstanding Vala ticket for allowing foreach to iterate over all enums.  A patch was recently submitted, so it’s possible this will be coming soon.

Shotwell 0.10 Released

Yorba has released version 0.10 of Shotwell, our digital photo organizer.  This release includes the following changes:

  • Dynamic view of photo library through saved search feature
  • Automatic database backup
  • Adjust date/time for videos
  • Added Valadate testing framework
  • Shotwell video thumbnailer eliminates Totem dependency
  • Crop tool is now more flexible
  • Filenames no longer used as titles on Facebook and Picasa uploads
  • Translation corrections
  • Many bug fixes
Creating a search

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Binaries of both packages for Ubuntu Natty and Maverick are available at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

Shotwell 0.9.3 Released

Yorba has released version 0.9.3 of Shotwell, an update to our digital photo organizer. This is a bug fix release; we recommend all users update.

Changelog:

  • Resolves issue where setting the desktop background didn’t work in Gnome3
  • Mimics are now deleted when a RAW photo is removed
  • Event dates are now only shown once in the Event view
  • Fixes a number of translation issues

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Binaries of both packages for Ubuntu Maverick are available at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

Shotwell 0.9.2 Released

Yorba has released version 0.9.2 of Shotwell, an update to our digital photo
organizer. This is a bug fix release that fixes a translation issue and several critical publishing bugs. We recommend all users update.

Changelog:

  • Resolves translation issue where shotwell.mo is installed in wrong location
  • Fixes issue where cancelling Flickr upload can crash Shotwell
  • Fixes issue where creating a Picasa Web album with an ampersand in the name crashes Shotwell
  • Resolves bug where selecting “Publish” in single photo mode publishes the entire library instead of the selected photo
  • Async I/O in publishing operations is now stopped when the user cancels the operation
  • Issue fixed on Fedora where the text was cut off in publishing dialog
  • Fixes issue with ratings filter where it didn’t function when the search bar was hidden

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Binaries of both packages for Ubuntu Maverick are available at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

Shotwell 0.9.1 Released

Yorba has released version 0.9.1 of Shotwell, our digital photo organizer. This release fixes numerous issues, including several critical publishing bugs. We recommend all users update.

Changelog:

  • Fixes many crashes and other issues in publishing plugins. 
  • Fixes issues where paths and filenames are not displayed correctly after a
    failed import. 
  • Fixed issue where text search in event and camera import pages was a string
    match instead of a keyword match. 
  • For enhanced compatibility with GNOME 3, the desktop name of the Shotwell
    application has changed from “Shotwell Photo Manager” to simply “Shotwell”. 
  • Shotwell now provides a configure script option to set the name of the system
    library directory to either lib or lib64. 
  • Enhanced visibility of red-eye reticle.
  • Fixed issue where the Adjust palette could be positioned partially off-screen
  • Plugins now respect –debug switch in configure script.
  • The event containing undated photos could be incorrectly labeled “(null)” in
    the events directory page.

Download a source tarball from the Shotwell home page at:
http://www.yorba.org/shotwell/

Binaries of both packages for Ubuntu Maverick are available at Yorba’s Launchpad PPA:
https://launchpad.net/~yorba/+archive/ppa

JIm Nelson's blog + archives from Yorba Foundation's original blog