finished sound preview task by superimposing an icon to indicate

finished sound preview task by superimposing an icon to indicate
	previewing, and terminating the preview better by killing the
	entire process group.
This commit is contained in:
Andy Hertzfeld 2000-05-31 05:28:31 +00:00
parent b3fecee345
commit f77a4a0ca3
6 changed files with 76 additions and 5 deletions

View file

@ -1,3 +1,13 @@
2000-05-30 Andy Hertzfeld <andy@eazel.com>
* icons/Makefile.am:
* icons/audio.png:
new icon for audio preview feedback; I'm sure Susan will want to improve this.
* libnautilus-extensions/nautilus-icon-canvas-item.c: (map_pixbuf):
finished off audio preview task 259 by showing an image to indicate previewing audio.
* src/file-manager/fm-icon-view.c: (play_file), (preview_sound):
fixed problem with aborting sound previews by calling setsid() and killing the entire group
2000-05-30 John Sullivan <sullivan@eazel.com>
* src/file-manager/fm-directory-view.c:

View file

@ -5,6 +5,7 @@ SUBDIRS = eazel
icondir = $(datadir)/pixmaps/nautilus
icon_DATA =\
audio.png \
About_Image.png \
backgrounds.png \
colors.png \

BIN
icons/audio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

View file

@ -63,13 +63,15 @@ struct NautilusIconCanvasItemDetails {
int text_width;
int text_height;
/* preview state */
int is_active;
/* Highlight state. */
guint is_highlighted_for_selection : 1;
guint is_highlighted_as_keyboard_focus: 1;
guint is_highlighted_for_drop : 1;
guint show_stretch_handles : 1;
guint is_prelit : 1;
guint is_active : 1;
gboolean is_renaming;
};
@ -1018,11 +1020,38 @@ draw_pixbuf_aa (GdkPixbuf *pixbuf, GnomeCanvasBuf *buf, double affine[6], int x_
static GdkPixbuf *
map_pixbuf(NautilusIconCanvasItem *icon_item)
{
GdkPixbuf *temp_pixbuf, *old_pixbuf;
GnomeCanvas *canvas;
char *audio_filename;
GdkPixbuf *temp_pixbuf, *old_pixbuf, *audio_pixbuf;
temp_pixbuf = icon_item->details->pixbuf;
canvas = GNOME_CANVAS_ITEM(icon_item)->canvas;
if (icon_item->details->is_prelit) {
temp_pixbuf = nautilus_create_spotlight_pixbuf (icon_item->details->pixbuf);
/* if the icon is currently being previewed, superimpose an image to indicate that */
/* audio is the only kind of previewing right now, so this code isn't as general as it could be */
if (icon_item->details->is_active == 1) {
/* load the audio symbol */
audio_filename = gnome_pixmap_file ("nautilus/audio.png");
audio_pixbuf = gdk_pixbuf_new_from_file(audio_filename);
/* composite it onto the icon */
if (audio_pixbuf) {
gdk_pixbuf_composite (audio_pixbuf,
temp_pixbuf,
0, 0,
gdk_pixbuf_get_width(temp_pixbuf), gdk_pixbuf_get_height(temp_pixbuf),
0, 4,
canvas->pixels_per_unit, canvas->pixels_per_unit,
GDK_INTERP_BILINEAR, 0xFF);
gdk_pixbuf_unref(audio_pixbuf);
}
g_free(audio_filename);
}
}
if (icon_item->details->is_highlighted_for_selection || icon_item->details->is_highlighted_for_drop) {

View file

@ -63,13 +63,15 @@ struct NautilusIconCanvasItemDetails {
int text_width;
int text_height;
/* preview state */
int is_active;
/* Highlight state. */
guint is_highlighted_for_selection : 1;
guint is_highlighted_as_keyboard_focus: 1;
guint is_highlighted_for_drop : 1;
guint show_stretch_handles : 1;
guint is_prelit : 1;
guint is_active : 1;
gboolean is_renaming;
};
@ -1018,11 +1020,38 @@ draw_pixbuf_aa (GdkPixbuf *pixbuf, GnomeCanvasBuf *buf, double affine[6], int x_
static GdkPixbuf *
map_pixbuf(NautilusIconCanvasItem *icon_item)
{
GdkPixbuf *temp_pixbuf, *old_pixbuf;
GnomeCanvas *canvas;
char *audio_filename;
GdkPixbuf *temp_pixbuf, *old_pixbuf, *audio_pixbuf;
temp_pixbuf = icon_item->details->pixbuf;
canvas = GNOME_CANVAS_ITEM(icon_item)->canvas;
if (icon_item->details->is_prelit) {
temp_pixbuf = nautilus_create_spotlight_pixbuf (icon_item->details->pixbuf);
/* if the icon is currently being previewed, superimpose an image to indicate that */
/* audio is the only kind of previewing right now, so this code isn't as general as it could be */
if (icon_item->details->is_active == 1) {
/* load the audio symbol */
audio_filename = gnome_pixmap_file ("nautilus/audio.png");
audio_pixbuf = gdk_pixbuf_new_from_file(audio_filename);
/* composite it onto the icon */
if (audio_pixbuf) {
gdk_pixbuf_composite (audio_pixbuf,
temp_pixbuf,
0, 0,
gdk_pixbuf_get_width(temp_pixbuf), gdk_pixbuf_get_height(temp_pixbuf),
0, 4,
canvas->pixels_per_unit, canvas->pixels_per_unit,
GDK_INTERP_BILINEAR, 0xFF);
gdk_pixbuf_unref(audio_pixbuf);
}
g_free(audio_filename);
}
}
if (icon_item->details->is_highlighted_for_selection || icon_item->details->is_highlighted_for_drop) {

View file

@ -1118,6 +1118,8 @@ static gint play_file(NautilusFile *file)
mp3_pid = fork ();
if (mp3_pid == (pid_t) 0) {
/* set the group (session) id to this process for future killing */
setsid();
execlp (player, player, file_uri + 7, NULL);
_exit (0);
}
@ -1142,7 +1144,7 @@ preview_sound(NautilusFile *file, gboolean start_flag)
} else {
if (mp3_pid) {
kill (mp3_pid, SIGTERM);
kill (-mp3_pid, SIGTERM);
mp3_pid = 0;
}
if (timeout >= 0) {