Skip to content

Commit

Permalink
Fixed creating top-level albums in some cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Luc Paour committed Jun 13, 2003
1 parent ff8ccf4 commit a072eb0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions com/gallery/GalleryRemote/GalleryComm2.java
Expand Up @@ -668,8 +668,11 @@ class NewAlbumTask extends GalleryTask {

void runTask() {
status(su, "Getting album information from " + g.toString());

String parentAlbumName = (parentAlbum == null) ? "" : parentAlbum.getName();

// if the parent is null (top-level album), set the album name to an illegal name so it's set to null
// by Gallery. Using an empty string doesn't work, because then the HTTP parameter is not
// parsed, and the session album is kept the same as before (from the cookie).
String parentAlbumName = (parentAlbum == null) ? "hack_null_albumName" : parentAlbum.getName();

if (GalleryRemote.getInstance().properties.getBooleanProperty(HTML_ESCAPE_CAPTIONS)) {
albumTitle = HTMLEscaper.escape(albumTitle);
Expand Down
9 changes: 8 additions & 1 deletion com/gallery/GalleryRemote/NewAlbumDialog.java
Expand Up @@ -120,7 +120,13 @@ private void jbInit()

album = new JComboBox(albums);
album.setFont( new java.awt.Font( "SansSerif", 0, 11 ) );
album.setSelectedItem(defaultAlbum);

if (defaultAlbum == null) {
album.setSelectedItem(rootAlbum);
} else {
album.setSelectedItem(defaultAlbum);
}

cancel.setText( "Cancel" );
description.setBorder( BorderFactory.createBevelBorder( BevelBorder.LOWERED, Color.white, Color.lightGray, Color.darkGray, Color.gray ) );
description.setLineWrap(true);
Expand Down Expand Up @@ -194,6 +200,7 @@ public void actionPerformed( ActionEvent e ) {

Album selectedAlbum = (Album) album.getSelectedItem();
if (selectedAlbum == rootAlbum) {
Log.log(Log.TRACE, MODULE, "Selected root album");
a.setParentAlbum(null);
} else {
a.setParentAlbum(selectedAlbum);
Expand Down

0 comments on commit a072eb0

Please sign in to comment.