Mercurial > audlegacy
annotate src/audacious/genevent.c @ 2962:ba45ef731cf1 trunk
don't call ui_skinned_textbox_paint() directly, use gtk_widget_queue_draw() instead; fix ui_skinned_textbox_expose()
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Mon, 02 Jul 2007 09:35:37 +0200 |
parents | cfb04f784a84 |
children | 6d4b7b739232 |
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 | |
12 * the Free Software Foundation; under version 2 of the License. | |
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 | |
20 * along with this program; if not, write to the Free Software | |
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 # include "config.h" | |
26 #endif | |
27 | |
28 #include "main.h" | |
29 | |
30 #include <glib.h> | |
31 #include <glib/gi18n.h> | |
32 #include <glib/gprintf.h> | |
33 #include <gdk/gdk.h> | |
34 #include <stdlib.h> | |
35 #include <string.h> | |
36 #include <getopt.h> | |
37 #include <ctype.h> | |
38 #include <time.h> | |
39 | |
40 #include <unistd.h> | |
41 #include <errno.h> | |
42 #include <sys/types.h> | |
43 #include <sys/stat.h> | |
44 #include <signal.h> | |
45 | |
46 #include "dnd.h" | |
47 #include "effect.h" | |
48 #include "general.h" | |
49 #include "hints.h" | |
50 #include "input.h" | |
51 #include "logger.h" | |
52 #include "output.h" | |
53 #include "playback.h" | |
54 #include "playlist.h" | |
2420 | 55 #include "pluginenum.h" |
56 #include "ui_main.h" | |
2313 | 57 #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
|
58 #include "ui_skinned_textbox.h" |
2313 | 59 #include "util.h" |
60 #include "visualization.h" | |
2420 | 61 #include "vfs.h" |
2313 | 62 |
63 gboolean ev_waiting = FALSE; | |
64 | |
65 static gboolean | |
66 idle_func_change_song(gboolean waiting) | |
67 { | |
68 static GTimer *pause_timer = NULL; | |
69 | |
70 if (!pause_timer) | |
71 pause_timer = g_timer_new(); | |
72 | |
73 if (cfg.pause_between_songs) { | |
74 gint timeleft; | |
75 | |
76 if (!waiting) { | |
77 g_timer_start(pause_timer); | |
78 waiting = TRUE; | |
79 } | |
80 | |
81 timeleft = cfg.pause_between_songs_time - | |
82 (gint) g_timer_elapsed(pause_timer, NULL); | |
83 | |
84 if (mainwin_10min_num != NULL) { | |
85 number_set_number(mainwin_10min_num, timeleft / 600); | |
86 number_set_number(mainwin_min_num, (timeleft / 60) % 10); | |
87 number_set_number(mainwin_10sec_num, (timeleft / 10) % 6); | |
88 number_set_number(mainwin_sec_num, timeleft % 10); | |
89 } | |
90 | |
91 if (mainwin_sposition != NULL && !mainwin_sposition->hs_pressed) { | |
2954
cfb04f784a84
user g_strdup_printf instead of fixed-size gchar array
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
92 gchar *time_str; |
2313 | 93 |
2954
cfb04f784a84
user g_strdup_printf instead of fixed-size gchar array
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
94 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
|
95 ui_skinned_textbox_set_text(mainwin_stime_min, time_str); |
2313 | 96 |
2954
cfb04f784a84
user g_strdup_printf instead of fixed-size gchar array
Tomasz Mon <desowin@gmail.com>
parents:
2942
diff
changeset
|
97 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
|
98 ui_skinned_textbox_set_text(mainwin_stime_sec, time_str); |
2313 | 99 } |
100 | |
101 playlistwin_set_time(timeleft * 1000, 0, TIMER_ELAPSED); | |
102 } | |
103 | |
104 if (!cfg.pause_between_songs || | |
105 g_timer_elapsed(pause_timer, NULL) >= cfg.pause_between_songs_time) | |
106 { | |
107 Playlist *playlist = playlist_get_active(); | |
108 | |
109 GDK_THREADS_ENTER(); | |
110 playlist_eof_reached(playlist); | |
111 GDK_THREADS_LEAVE(); | |
112 | |
113 waiting = FALSE; | |
114 } | |
115 | |
116 return waiting; | |
117 } | |
118 | |
119 gint | |
120 audcore_generic_events(void) | |
121 { | |
122 gint time = 0; | |
123 | |
124 if (playback_get_playing()) { | |
125 time = playback_get_time(); | |
126 | |
127 switch (time) { | |
128 case -1: | |
129 /* no song playing */ | |
130 ev_waiting = idle_func_change_song(ev_waiting); | |
131 break; | |
132 | |
133 default: | |
134 ev_waiting = FALSE; | |
135 } | |
136 } | |
137 | |
138 return time; | |
139 } | |
140 |