diff options
author | George Lebl <jirka@5z.com> | 2003-07-17 22:34:44 +0000 |
---|---|---|
committer | George Lebl <jirka@src.gnome.org> | 2003-07-17 22:34:44 +0000 |
commit | 9fa7a421b7f45ed4d93b702ec8d7118df7f72d32 (patch) | |
tree | 966245ce02447d7e8b2adc6409d9df3dafc33846 | |
parent | e106472e44e34cbec810eeb6ad5e7e46c362765a (diff) | |
download | nautilus-9fa7a421b7f45ed4d93b702ec8d7118df7f72d32.tar.gz |
when the playing command can't be run, or the file can't be opened don't
Thu Jul 17 15:32:55 2003 George Lebl <jirka@5z.com>
* src/file-manager/fm-icon-view.c (play_file): when the playing
command can't be run, or the file can't be opened don't return
into the parent process from the child and do weird things,
but exit. Also if the fork fails don't set the sound pid to
-1 (and later try to kill it).
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/file-manager/fm-icon-view.c | 20 |
2 files changed, 19 insertions, 9 deletions
@@ -1,3 +1,11 @@ +Thu Jul 17 15:32:55 2003 George Lebl <jirka@5z.com> + + * src/file-manager/fm-icon-view.c (play_file): when the playing + command can't be run, or the file can't be opened don't return + into the parent process from the child and do weird things, + but exit. Also if the fork fails don't set the sound pid to + -1 (and later try to kill it). + 2003-07-09 Johan Dahlin <jdahlin@async.com.br> * src/file-manager/fm-properties-window.c: Add support for total diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index 92285cdcb..d0ff96e29 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -1774,22 +1774,24 @@ play_file (gpointer callback_data) } command_str = g_strdup_printf("play -t %s -", suffix); } + + /* read the file with gnome-vfs, feeding it to the sound player's standard input */ + /* First, open the file. */ + result = gnome_vfs_open (&handle, file_uri, GNOME_VFS_OPEN_READ); + if (result != GNOME_VFS_OK) { + _exit (0); + } /* since the uri could be local or remote, we launch the sound player with popen and feed it * the data by fetching it with gnome_vfs */ sound_process = popen(command_str, "w"); if (sound_process == 0) { - return FALSE; + /* Close the file. */ + result = gnome_vfs_close (handle); + _exit (0); } - /* read the file with gnome-vfs, feeding it to the sound player's standard input */ - /* First, open the file. */ - result = gnome_vfs_open (&handle, file_uri, GNOME_VFS_OPEN_READ); - if (result != GNOME_VFS_OK) { - return FALSE; - } - /* allocate a buffer. */ buffer = g_malloc(READ_CHUNK_SIZE); @@ -1815,7 +1817,7 @@ play_file (gpointer callback_data) g_free(buffer); pclose(sound_process); _exit (0); - } else { + } else if (mp3_pid > (pid_t) 0) { nautilus_sound_register_sound (mp3_pid); } |