Mercurial > audlegacy
annotate src/audacious/ui_new.c @ 4734:0b96e6982c64
reset slider when we stop the song
author | mf0102 <0102@gmx.at> |
---|---|
date | Thu, 17 Jul 2008 17:35:46 +0200 |
parents | 5c9160f0ff1c |
children | df6cd6f44a4f |
rev | line source |
---|---|
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
1 /* Audacious - Cross-platform multimedia player |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
2 * Copyright (C) 2005-2008 Audacious development team |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
3 * |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
6 * the Free Software Foundation; under version 3 of the License. |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
7 * |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
12 * |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
13 * You should have received a copy of the GNU General Public License |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
14 * along with this program. If not, see <http://www.gnu.org/licenses>. |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
15 * |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
16 * The Audacious team does not consider modular code linking to |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
17 * Audacious or using our public API to be a derived work. |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
18 */ |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
19 |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
20 #include <glib/gi18n.h> |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
21 #include <gtk/gtk.h> |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
22 |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
23 #include "interface.h" |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
24 #include "playback.h" |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
25 #include "playlist.h" |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
26 #include "ui_fileopener.h" |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
27 #include "ui_new.h" |
4728
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
28 #include "ui_playlist_widget.h" |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
29 |
4733
5c9160f0ff1c
Make the default UI suck less by killing the utterly pointless and redundant info bar.
William Pitcock <nenolod@atheme.org>
parents:
4732
diff
changeset
|
30 static GtkWidget *label_time; |
4682 | 31 static GtkWidget *slider; |
4728
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
32 static GtkWidget *treeview; |
4682 | 33 |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
34 static gulong slider_change_handler_id; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
35 static gboolean slider_is_moving = FALSE; |
4682 | 36 static gint update_song_timeout_source = 0; |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
37 |
4674 | 38 static gboolean |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
39 window_delete() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
40 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
41 return FALSE; |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
42 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
43 |
4674 | 44 static void |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
45 window_destroy(GtkWidget *widget, gpointer data) |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
46 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
47 gtk_main_quit(); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
48 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
49 |
4674 | 50 static void |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
51 button_open_pressed() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
52 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
53 run_filebrowser(TRUE); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
54 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
55 |
4674 | 56 static void |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
57 button_add_pressed() |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
58 { |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
59 run_filebrowser(FALSE); |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
60 } |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
61 |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
62 static void |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
63 button_play_pressed() |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
64 { |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
65 if (playlist_get_length(playlist_get_active())) |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
66 playback_initiate(); |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
67 else |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
68 button_open_pressed(); |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
69 } |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
70 |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
71 static void |
4685
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
72 button_pause_pressed() |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
73 { |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
74 playback_pause(); |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
75 } |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
76 |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
77 static void |
4715 | 78 button_stop_pressed() |
79 { | |
80 playback_stop(); | |
81 } | |
82 | |
83 static void | |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
84 button_previous_pressed() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
85 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
86 playlist_prev(playlist_get_active()); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
87 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
88 |
4674 | 89 static void |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
90 button_next_pressed() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
91 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
92 playlist_next(playlist_get_active()); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
93 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
94 |
4674 | 95 static void |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
96 ui_set_song_info(gchar *text, gpointer user_data) |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
97 { |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
98 gint length = playback_get_length(); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
99 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
100 gtk_range_set_range(GTK_RANGE(slider), 0.0, (gdouble)length); |
4715 | 101 gtk_widget_show(label_time); |
4696
851b12bf90d2
Properly escape all appropriate entities.
William Pitcock <nenolod@atheme.org>
parents:
4695
diff
changeset
|
102 |
4728
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
103 ui_playlist_widget_set_current(treeview, playlist_get_position(playlist_get_active())); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
104 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
105 |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
106 static void |
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
107 ui_playlist_update(Playlist *playlist, gpointer user_data) |
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
108 { |
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
109 gchar *text = playlist_get_info_text(playlist); |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
110 ui_set_song_info(text, NULL); |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
111 g_free(text); |
4728
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
112 |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
113 ui_playlist_widget_update(treeview); |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
114 } |
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
115 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
116 static void |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
117 ui_update_time_info(gint time) |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
118 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
119 gchar text[128]; |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
120 gint length = playback_get_length(); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
121 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
122 time /= 1000; |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
123 length /= 1000; |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
124 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
125 g_snprintf(text, sizeof(text)/sizeof(gchar), |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
126 "<tt><b>%d:%.2d/%d:%.2d</b></tt>", |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
127 time / 60, time % 60, |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
128 length / 60, length % 60); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
129 gtk_label_set_markup(GTK_LABEL(label_time), text); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
130 } |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
131 |
4682 | 132 static gboolean |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
133 ui_update_song_info(gpointer hook_data, gpointer user_data) |
4682 | 134 { |
135 if (!playback_get_playing()) | |
4686 | 136 { |
137 gtk_range_set_value(GTK_RANGE(slider), (gdouble)0); | |
4682 | 138 return FALSE; |
4686 | 139 } |
4682 | 140 |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
141 if (slider_is_moving) |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
142 return TRUE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
143 |
4682 | 144 gint time = playback_get_time(); |
145 | |
146 g_signal_handler_block(slider, slider_change_handler_id); | |
147 gtk_range_set_value(GTK_RANGE(slider), (gdouble)time); | |
148 g_signal_handler_unblock(slider, slider_change_handler_id); | |
149 | |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
150 ui_update_time_info(time); |
4694 | 151 |
4682 | 152 return TRUE; |
153 } | |
154 | |
4715 | 155 static void |
156 ui_clear_song_info() | |
157 { | |
158 gtk_widget_hide(label_time); | |
4734 | 159 gtk_range_set_value(GTK_RANGE(slider), 0); |
4715 | 160 } |
161 | |
4682 | 162 static gboolean |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
163 ui_slider_value_changed_cb(GtkRange *range, gpointer user_data) |
4682 | 164 { |
4730
f9b49a8913b7
minimal interface: improve sanity for playback_seek() to make seek times more accurate.
William Pitcock <nenolod@atheme.org>
parents:
4728
diff
changeset
|
165 gint seek_; |
f9b49a8913b7
minimal interface: improve sanity for playback_seek() to make seek times more accurate.
William Pitcock <nenolod@atheme.org>
parents:
4728
diff
changeset
|
166 |
f9b49a8913b7
minimal interface: improve sanity for playback_seek() to make seek times more accurate.
William Pitcock <nenolod@atheme.org>
parents:
4728
diff
changeset
|
167 seek_ = gtk_range_get_value(range) / 1000; |
f9b49a8913b7
minimal interface: improve sanity for playback_seek() to make seek times more accurate.
William Pitcock <nenolod@atheme.org>
parents:
4728
diff
changeset
|
168 |
f9b49a8913b7
minimal interface: improve sanity for playback_seek() to make seek times more accurate.
William Pitcock <nenolod@atheme.org>
parents:
4728
diff
changeset
|
169 /* XXX: work around a horrible bug in playback_seek(), also |
f9b49a8913b7
minimal interface: improve sanity for playback_seek() to make seek times more accurate.
William Pitcock <nenolod@atheme.org>
parents:
4728
diff
changeset
|
170 we should do mseek here. --nenolod */ |
f9b49a8913b7
minimal interface: improve sanity for playback_seek() to make seek times more accurate.
William Pitcock <nenolod@atheme.org>
parents:
4728
diff
changeset
|
171 playback_seek(seek_ != 0 ? seek_ : 1); |
4682 | 172 |
173 return TRUE; | |
174 } | |
175 | |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
176 static gboolean |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
177 ui_slider_change_value_cb(GtkRange *range, GtkScrollType scroll) |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
178 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
179 ui_update_time_info(gtk_range_get_value(range)); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
180 return FALSE; |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
181 } |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
182 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
183 static gboolean |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
184 ui_slider_button_press_cb(GtkWidget *widget, GdkEventButton *event, |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
185 gpointer user_data) |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
186 { |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
187 slider_is_moving = TRUE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
188 return FALSE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
189 } |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
190 |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
191 static gboolean |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
192 ui_slider_button_release_cb(GtkWidget *widget, GdkEventButton *event, |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
193 gpointer user_data) |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
194 { |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
195 slider_is_moving = FALSE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
196 return FALSE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
197 } |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
198 |
4682 | 199 static void |
200 ui_playback_begin(gpointer hook_data, gpointer user_data) | |
201 { | |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
202 ui_update_song_info(NULL, NULL); |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
203 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
204 /* update song info 4 times a second */ |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
205 update_song_timeout_source = |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
206 g_timeout_add(250, (GSourceFunc) ui_update_song_info, NULL); |
4682 | 207 } |
208 | |
209 static void | |
210 ui_playback_stop(gpointer hook_data, gpointer user_data) | |
211 { | |
212 if (update_song_timeout_source) { | |
213 g_source_remove(update_song_timeout_source); | |
214 update_song_timeout_source = 0; | |
215 } | |
4715 | 216 |
217 ui_clear_song_info(); | |
4728
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
218 ui_playlist_widget_set_current(treeview, -1); |
4682 | 219 } |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
220 |
4686 | 221 static void |
222 ui_playback_end(gpointer hook_data, gpointer user_data) | |
223 { | |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
224 ui_update_song_info(NULL, NULL); |
4686 | 225 } |
226 | |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
227 static GtkToolItem * |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
228 gtk_toolbar_button_add(GtkWidget *toolbar, void(*callback)(), |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
229 const gchar *stock_id) |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
230 { |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
231 GtkToolItem *button = gtk_tool_button_new_from_stock(stock_id); |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
232 gtk_toolbar_insert(GTK_TOOLBAR(toolbar), button, -1); |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
233 g_signal_connect(G_OBJECT(button), "clicked", |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
234 G_CALLBACK(callback), NULL); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
235 return button; |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
236 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
237 |
4674 | 238 static GtkWidget * |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
239 gtk_markup_label_new(const gchar *str) |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
240 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
241 GtkWidget *label = gtk_label_new(str); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
242 g_object_set(G_OBJECT(label), "use-markup", TRUE, NULL); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
243 return label; |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
244 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
245 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
246 static void |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
247 ui_hooks_associate() |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
248 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
249 hook_associate("title change", (HookFunction) ui_set_song_info, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
250 hook_associate("playback seek", (HookFunction) ui_update_song_info, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
251 hook_associate("playback begin", (HookFunction) ui_playback_begin, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
252 hook_associate("playback stop", (HookFunction) ui_playback_stop, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
253 hook_associate("playback end", (HookFunction) ui_playback_end, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
254 hook_associate("playlist update", (HookFunction) ui_playlist_update, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
255 } |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
256 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
257 static void |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
258 ui_hooks_disassociate() |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
259 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
260 hook_dissociate("title change", (HookFunction) ui_set_song_info); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
261 hook_dissociate("playback seek", (HookFunction) ui_update_song_info); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
262 hook_dissociate("playback begin", (HookFunction) ui_playback_begin); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
263 hook_dissociate("playback stop", (HookFunction) ui_playback_stop); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
264 hook_dissociate("playback end", (HookFunction) ui_playback_end); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
265 hook_dissociate("playlist update", (HookFunction) ui_playlist_update); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
266 } |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
267 |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
268 static gboolean |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
269 _ui_initialize(void) |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
270 { |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
271 GtkWidget *window; /* the main window */ |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
272 GtkWidget *vbox; /* the main vertical box */ |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
273 GtkWidget *toolbar; /* contains buttons like "open", "next" */ |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
274 |
4694 | 275 GtkWidget *shbox; /* box for slider + time combo --nenolod */ |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
276 |
4728
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
277 GtkWidget *scrollwin; /* widget to hold playlist widget */ |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
278 |
4732
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
279 GtkWidget *paned; |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
280 |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
281 GtkToolItem *button_open, *button_add, |
4715 | 282 *button_play, *button_pause, *button_stop, |
4685
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
283 *button_previous, *button_next; |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
284 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
285 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
4685
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
286 gtk_window_set_default_size(GTK_WINDOW(window), 450, 150); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
287 g_signal_connect(G_OBJECT(window), "delete_event", |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
288 G_CALLBACK(window_delete), NULL); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
289 g_signal_connect(G_OBJECT(window), "destroy", |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
290 G_CALLBACK(window_destroy), NULL); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
291 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
292 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
293 vbox = gtk_vbox_new(FALSE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
294 gtk_container_add(GTK_CONTAINER(window), vbox); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
295 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
296 |
4732
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
297 paned = gtk_hpaned_new(); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
298 gtk_box_pack_start(GTK_BOX(vbox), paned, FALSE, TRUE, 0); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
299 |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
300 toolbar = gtk_toolbar_new(); |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
301 gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
302 button_open = gtk_toolbar_button_add(toolbar, button_open_pressed, |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
303 GTK_STOCK_OPEN); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
304 button_add = gtk_toolbar_button_add(toolbar, button_add_pressed, |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
305 GTK_STOCK_ADD); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
306 button_play = gtk_toolbar_button_add(toolbar, button_play_pressed, |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
307 GTK_STOCK_MEDIA_PLAY); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
308 button_pause = gtk_toolbar_button_add(toolbar, button_pause_pressed, |
4685
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
309 GTK_STOCK_MEDIA_PAUSE); |
4715 | 310 button_stop = gtk_toolbar_button_add(toolbar, button_stop_pressed, |
311 GTK_STOCK_MEDIA_STOP); | |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
312 button_previous = gtk_toolbar_button_add(toolbar, button_previous_pressed, |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
313 GTK_STOCK_MEDIA_PREVIOUS); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
314 button_next = gtk_toolbar_button_add(toolbar, button_next_pressed, |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
315 GTK_STOCK_MEDIA_NEXT); |
4732
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
316 |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
317 gtk_paned_pack1(GTK_PANED(paned), toolbar, TRUE, TRUE); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
318 |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
319 shbox = gtk_hbox_new(FALSE, 0); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
320 gtk_paned_add2(GTK_PANED(paned), shbox); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
321 |
4732
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
322 slider = gtk_hscale_new(NULL); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
323 gtk_scale_set_draw_value(GTK_SCALE(slider), FALSE); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
324 /* TODO: make this configureable */ |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
325 gtk_range_set_update_policy(GTK_RANGE(slider), GTK_UPDATE_DISCONTINUOUS); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
326 gtk_box_pack_start(GTK_BOX(shbox), slider, TRUE, TRUE, 0); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
327 |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
328 label_time = gtk_markup_label_new(NULL); |
65d67970fab7
Move the slider bar to the toolbar, but this is kinda ugly at the moment.
William Pitcock <nenolod@atheme.org>
parents:
4730
diff
changeset
|
329 gtk_box_pack_start(GTK_BOX(shbox), label_time, FALSE, FALSE, 0); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
330 |
4728
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
331 treeview = ui_playlist_widget_new(); |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
332 scrollwin = gtk_scrolled_window_new(NULL, NULL); |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
333 gtk_container_add(GTK_CONTAINER(scrollwin), treeview); |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
334 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwin), |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
335 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
336 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrollwin), |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
337 GTK_SHADOW_IN); |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
338 |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
339 gtk_box_pack_end(GTK_BOX(vbox), scrollwin, TRUE, TRUE, 0); |
ab79ddbdcf42
introduce new playlist widget
Tomasz Mon <desowin@gmail.com>
parents:
4715
diff
changeset
|
340 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
341 ui_hooks_associate(); |
4682 | 342 |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
343 slider_change_handler_id = |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
344 g_signal_connect(slider, "value-changed", |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
345 G_CALLBACK(ui_slider_value_changed_cb), NULL); |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
346 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
347 g_signal_connect(slider, "change-value", |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
348 G_CALLBACK(ui_slider_change_value_cb), NULL); |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
349 g_signal_connect(slider, "button-press-event", |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
350 G_CALLBACK(ui_slider_button_press_cb), NULL); |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
351 g_signal_connect(slider, "button-release-event", |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
352 G_CALLBACK(ui_slider_button_release_cb), NULL); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
353 |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
354 ui_playlist_update(playlist_get_active(), NULL); |
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
355 |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
356 gtk_widget_show_all(window); |
4715 | 357 |
358 ui_clear_song_info(); | |
359 | |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
360 gtk_main(); |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
361 |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
362 return TRUE; |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
363 } |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
364 |
4689
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
365 static gboolean |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
366 _ui_finalize(void) |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
367 { |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
368 ui_hooks_disassociate(); |
4689
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
369 return TRUE; |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
370 } |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
371 |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
372 static Interface default_interface = { |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
373 .id = "default", |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
374 .desc = N_("Default Interface"), |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
375 .init = _ui_initialize, |
4689
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
376 .fini = _ui_finalize, |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
377 }; |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
378 |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
379 Interface * |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
380 ui_populate_default_interface(void) |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
381 { |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
382 interface_register(&default_interface); |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
383 |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
384 return &default_interface; |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
385 } |