diff --git a/com/gallery/GalleryRemote/GalleryComm2.java b/com/gallery/GalleryRemote/GalleryComm2.java index 37290ac..e1b6315 100644 --- a/com/gallery/GalleryRemote/GalleryComm2.java +++ b/com/gallery/GalleryRemote/GalleryComm2.java @@ -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); diff --git a/com/gallery/GalleryRemote/NewAlbumDialog.java b/com/gallery/GalleryRemote/NewAlbumDialog.java index 7bd0c8a..498cac6 100644 --- a/com/gallery/GalleryRemote/NewAlbumDialog.java +++ b/com/gallery/GalleryRemote/NewAlbumDialog.java @@ -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); @@ -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);