Mercurial > audlegacy
annotate src/audacious/genevent.c @ 3123:f1c756f39e6c trunk audacious-1.4.0-DR1
Invoke "Plugins are not derived work" clause provided by GPL3.
author | William Pitcock <nenolod@atheme-project.org> |
---|---|
date | Fri, 20 Jul 2007 09:09:58 -0500 |
parents | 3b6d316f8b09 |
children |
rev | line source |
---|---|
2313 | 1 /* Audacious - Cross-platform multimedia platform. |
2 * Copyright (C) 2005-2007 Audacious development team. | |
3 * | |
4 * Based on BMP: | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2003 XMMS development team. | |
9 * | |
10 * This program is free software; you can redistribute it and/or modify | |
11 * it under the terms of the GNU General Public License as published by | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3042
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
2313 | 13 * |
14 * This program is distributed in the hope that it will be useful, | |
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 * GNU General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
3042
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
2313 | 24 */ |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 # include "config.h" | |
28 #endif | |
29 | |
30 #include "main.h" | |
31 | |
32 #include <glib.h> | |
33 #include <glib/gi18n.h> | |
34 #include <glib/gprintf.h> | |
35 #include <gdk/gdk.h> | |
36 #include <stdlib.h> | |
37 #include <string.h> | |
38 #include <getopt.h> | |
39 #include <ctype.h> | |
40 #include <time.h> | |
41 | |
42 #include <unistd.h> | |
43 #include <errno.h> | |
44 #include <sys/types.h> | |
45 #include <sys/stat.h> | |
46 #include <signal.h> | |
47 | |
48 #include "dnd.h" | |
49 #include "effect.h" | |
50 #include "general.h" | |
51 #include "hints.h" | |
52 #include "input.h" | |
53 #include "logger.h" | |
54 #include "output.h" | |
55 #include "playback.h" | |
56 #include "playlist.h" | |
2420 | 57 #include "pluginenum.h" |
58 #include "ui_main.h" | |
2313 | 59 #include "ui_playlist.h" |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2717
diff
changeset
|
60 #include "ui_skinned_textbox.h" |
3001
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2954
diff
changeset
|
61 #include "ui_skinned_number.h" |
3042
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3001
diff
changeset
|
62 #include "ui_skinned_horizontal_slider.h" |
2313 | 63 #include "util.h" |
64 #include "visualization.h" | |
2420 | 65 #include "vfs.h" |
2313 | 66 |
67 gboolean ev_waiting = FALSE; | |
68 | |
69 static gboolean | |
70 idle_func_change_song(gboolean waiting) | |
71 { | |
72 static GTimer *pause_timer = NULL; | |
73 | |
74 if (!pause_timer) | |
75 pause_timer = g_timer_new(); | |
76 | |
77 if (cfg.pause_between_songs) { | |
78 gint timeleft; | |
79 | |
80 if (!waiting) { | |
81 g_timer_start(pause_timer); | |
82 waiting = TRUE; | |
83 } | |
84 | |
85 timeleft = cfg.pause_between_songs_time - | |
86 (gint) g_timer_elapsed(pause_timer, NULL); | |
87 | |
88 if (mainwin_10min_num != NULL) { | |
3001
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2954
diff
changeset
|
89 ui_skinned_number_set_number(mainwin_10min_num, timeleft / 600); |
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2954
diff
changeset
|
90 ui_skinned_number_set_number(mainwin_min_num, (timeleft / 60) % 10); |
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2954
diff
changeset
|
91 ui_skinned_number_set_number(mainwin_10sec_num, (timeleft / 10) % 6); |
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2954
diff
changeset
|
92 ui_skinned_number_set_number(mainwin_sec_num, timeleft % 10); |
2313 | 93 } |
94 | |
3042
01ae56759d15
mainwin_sposition is now UiSkinnedHorizontalSlider
Tomasz Mon <desowin@gmail.com>
parents:
3001
diff
changeset
|
95 if (mainwin_sposition != NULL && !UI_SKINNED_HORIZONTAL_SLIDER(mainwin_sposition)->pressed) { |
2954
cfb04f784a84
user g_strdup_printf instead of fixed-size gchar array
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
96 gchar *time_str; |
2313 | 97 |
2954
cfb04f784a84
user g_strdup_printf instead of fixed-size gchar array
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
98 time_str = g_strdup_printf("%2.2d", timeleft / 60); |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2717
diff
changeset
|
99 ui_skinned_textbox_set_text(mainwin_stime_min, time_str); |
3001
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2954
diff
changeset
|
100 g_free(time_str); |
2313 | 101 |
2954
cfb04f784a84
user g_strdup_printf instead of fixed-size gchar array
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
102 time_str = g_strdup_printf("%2.2d", timeleft % 60); |
2942
1a59a0ced6a8
make scrolling stop for second when it reaches end, replace remaining mainwin TextBox with UiSkinnedTextbox
Tomasz Mon <desowin@gmail.com>
parents:
2717
diff
changeset
|
103 ui_skinned_textbox_set_text(mainwin_stime_sec, time_str); |
3001
6d4b7b739232
fully implement UiSkinnedNumber, number.c no longer needed
Tomasz Mon <desowin@gmail.com>
parents:
2954
diff
changeset
|
104 g_free(time_str); |
2313 | 105 } |
106 | |
107 playlistwin_set_time(timeleft * 1000, 0, TIMER_ELAPSED); | |
108 } | |
109 | |
110 if (!cfg.pause_between_songs || | |
111 g_timer_elapsed(pause_timer, NULL) >= cfg.pause_between_songs_time) | |
112 { | |
113 Playlist *playlist = playlist_get_active(); | |
114 | |
115 GDK_THREADS_ENTER(); | |
116 playlist_eof_reached(playlist); | |
117 GDK_THREADS_LEAVE(); | |
118 | |
119 waiting = FALSE; | |
120 } | |
121 | |
122 return waiting; | |
123 } | |
124 | |
125 gint | |
126 audcore_generic_events(void) | |
127 { | |
128 gint time = 0; | |
129 | |
130 if (playback_get_playing()) { | |
131 time = playback_get_time(); | |
132 | |
133 switch (time) { | |
134 case -1: | |
135 /* no song playing */ | |
136 ev_waiting = idle_func_change_song(ev_waiting); | |
137 break; | |
138 | |
139 default: | |
140 ev_waiting = FALSE; | |
141 } | |
142 } | |
143 | |
144 return time; | |
145 } | |
146 |