Mercurial > audlegacy
annotate src/audacious/ui_new.c @ 4712:6584bba8de63
I don't think those files belong to legacy ui...
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Tue, 08 Jul 2008 16:36:50 +0200 |
parents | cfc8d1e0c78b |
children | 08ec4e638c2d |
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" |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
28 |
4694 | 29 static GtkWidget *label_prev, *label_current, *label_next, *label_time; |
4682 | 30 static GtkWidget *slider; |
31 | |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
32 static gulong slider_change_handler_id; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
33 static gboolean slider_is_moving = FALSE; |
4682 | 34 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
|
35 |
4674 | 36 static gboolean |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
37 window_delete() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
38 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
39 return FALSE; |
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 |
4674 | 42 static void |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
43 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
|
44 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
45 gtk_main_quit(); |
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 |
4674 | 48 static void |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
49 button_open_pressed() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
50 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
51 run_filebrowser(TRUE); |
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 |
4674 | 54 static void |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
55 button_add_pressed() |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
56 { |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
57 run_filebrowser(FALSE); |
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 |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
60 static void |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
61 button_play_pressed() |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
62 { |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
63 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
|
64 playback_initiate(); |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
65 else |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
66 button_open_pressed(); |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
67 } |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
68 |
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
69 static void |
4685
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
70 button_pause_pressed() |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
71 { |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
72 playback_pause(); |
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 |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
75 static void |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
76 button_previous_pressed() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
77 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
78 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
|
79 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
80 |
4674 | 81 static void |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
82 button_next_pressed() |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
83 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
84 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
|
85 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
86 |
4674 | 87 static void |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
88 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
|
89 { |
4696
851b12bf90d2
Properly escape all appropriate entities.
William Pitcock <nenolod@atheme.org>
parents:
4695
diff
changeset
|
90 gchar *esc_title = g_markup_escape_text(text, -1); |
851b12bf90d2
Properly escape all appropriate entities.
William Pitcock <nenolod@atheme.org>
parents:
4695
diff
changeset
|
91 gchar *title = g_strdup_printf("<big>%s</big>", esc_title); |
851b12bf90d2
Properly escape all appropriate entities.
William Pitcock <nenolod@atheme.org>
parents:
4695
diff
changeset
|
92 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
93 gint length = playback_get_length(); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
94 |
4696
851b12bf90d2
Properly escape all appropriate entities.
William Pitcock <nenolod@atheme.org>
parents:
4695
diff
changeset
|
95 gtk_label_set_markup(GTK_LABEL(label_current), title); |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
96 gtk_range_set_range(GTK_RANGE(slider), 0.0, (gdouble)length); |
4696
851b12bf90d2
Properly escape all appropriate entities.
William Pitcock <nenolod@atheme.org>
parents:
4695
diff
changeset
|
97 |
851b12bf90d2
Properly escape all appropriate entities.
William Pitcock <nenolod@atheme.org>
parents:
4695
diff
changeset
|
98 g_free(esc_title); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
99 g_free(title); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
100 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
101 |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
102 static void |
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
103 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
|
104 { |
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
105 gchar *text = playlist_get_info_text(playlist); |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
106 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
|
107 g_free(text); |
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 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
110 static void |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
111 ui_update_time_info(gint time) |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
112 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
113 gchar text[128]; |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
114 gint length = playback_get_length(); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
115 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
116 time /= 1000; |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
117 length /= 1000; |
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 g_snprintf(text, sizeof(text)/sizeof(gchar), |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
120 "<tt><b>%d:%.2d/%d:%.2d</b></tt>", |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
121 time / 60, time % 60, |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
122 length / 60, length % 60); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
123 gtk_label_set_markup(GTK_LABEL(label_time), text); |
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 |
4682 | 126 static gboolean |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
127 ui_update_song_info(gpointer hook_data, gpointer user_data) |
4682 | 128 { |
129 if (!playback_get_playing()) | |
4686 | 130 { |
131 gtk_range_set_value(GTK_RANGE(slider), (gdouble)0); | |
4682 | 132 return FALSE; |
4686 | 133 } |
4682 | 134 |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
135 if (slider_is_moving) |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
136 return TRUE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
137 |
4682 | 138 gint time = playback_get_time(); |
139 | |
140 g_signal_handler_block(slider, slider_change_handler_id); | |
141 gtk_range_set_value(GTK_RANGE(slider), (gdouble)time); | |
142 g_signal_handler_unblock(slider, slider_change_handler_id); | |
143 | |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
144 ui_update_time_info(time); |
4694 | 145 |
4682 | 146 return TRUE; |
147 } | |
148 | |
149 static gboolean | |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
150 ui_slider_value_changed_cb(GtkRange *range, gpointer user_data) |
4682 | 151 { |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
152 /* we are not allowed to do a playback_seek() with values < 1, therefore |
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
153 * we add 1 to be on the safe side --mf0102 */ |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
154 playback_seek(gtk_range_get_value(range)/1000 + 1); |
4682 | 155 |
156 return TRUE; | |
157 } | |
158 | |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
159 static gboolean |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
160 ui_slider_change_value_cb(GtkRange *range, GtkScrollType scroll) |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
161 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
162 ui_update_time_info(gtk_range_get_value(range)); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
163 return FALSE; |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
164 } |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
165 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
166 static gboolean |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
167 ui_slider_button_press_cb(GtkWidget *widget, GdkEventButton *event, |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
168 gpointer user_data) |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
169 { |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
170 slider_is_moving = TRUE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
171 return FALSE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
172 } |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
173 |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
174 static gboolean |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
175 ui_slider_button_release_cb(GtkWidget *widget, GdkEventButton *event, |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
176 gpointer user_data) |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
177 { |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
178 slider_is_moving = FALSE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
179 return FALSE; |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
180 } |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
181 |
4682 | 182 static void |
183 ui_playback_begin(gpointer hook_data, gpointer user_data) | |
184 { | |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
185 ui_update_song_info(NULL, NULL); |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
186 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
187 /* 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
|
188 update_song_timeout_source = |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
189 g_timeout_add(250, (GSourceFunc) ui_update_song_info, NULL); |
4682 | 190 } |
191 | |
192 static void | |
193 ui_playback_stop(gpointer hook_data, gpointer user_data) | |
194 { | |
195 if (update_song_timeout_source) { | |
196 g_source_remove(update_song_timeout_source); | |
197 update_song_timeout_source = 0; | |
198 } | |
199 } | |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
200 |
4686 | 201 static void |
202 ui_playback_end(gpointer hook_data, gpointer user_data) | |
203 { | |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
204 ui_update_song_info(NULL, NULL); |
4686 | 205 } |
206 | |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
207 static GtkToolItem * |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
208 gtk_toolbar_button_add(GtkWidget *toolbar, void(*callback)(), |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
209 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
|
210 { |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 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
|
215 return button; |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
216 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
217 |
4674 | 218 static GtkWidget * |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
219 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
|
220 { |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
221 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
|
222 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
|
223 return label; |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
224 } |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
225 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
226 static void |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
227 ui_hooks_associate() |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
228 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
229 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
|
230 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
|
231 hook_associate("playback begin", (HookFunction) ui_playback_begin, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
232 hook_associate("playback stop", (HookFunction) ui_playback_stop, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
233 hook_associate("playback end", (HookFunction) ui_playback_end, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
234 hook_associate("playlist update", (HookFunction) ui_playlist_update, NULL); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
235 } |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
236 |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
237 static void |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
238 ui_hooks_disassociate() |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
239 { |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
240 hook_dissociate("title change", (HookFunction) ui_set_song_info); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
241 hook_dissociate("playback seek", (HookFunction) ui_update_song_info); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
242 hook_dissociate("playback begin", (HookFunction) ui_playback_begin); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
243 hook_dissociate("playback stop", (HookFunction) ui_playback_stop); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
244 hook_dissociate("playback end", (HookFunction) ui_playback_end); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
245 hook_dissociate("playlist update", (HookFunction) ui_playlist_update); |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
246 } |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
247 |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
248 static gboolean |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
249 _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
|
250 { |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
251 GtkWidget *window; /* the main window */ |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
252 GtkWidget *vbox; /* the main vertical box */ |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
253 GtkWidget *toolbar; /* contains buttons like "open", "next" */ |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
254 GtkWidget *pcnbox; /* box containing information about previous, |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
255 current and next track */ |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
256 |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
257 GtkWidget *chbox; /* box containing album art and information |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
258 about current track */ |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
259 GtkWidget *cvbox; /* box containing information about current track |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
260 and some control elements like position bar */ |
4694 | 261 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
|
262 |
4680
8becf76f2906
add pbutton_add and button_play; display only button image
Tomasz Mon <desowin@gmail.com>
parents:
4674
diff
changeset
|
263 GtkToolItem *button_open, *button_add, |
4685
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
264 *button_play, *button_pause, |
06028c2c9068
make a "pause" button and increase default window size
mf0102 <0102@gmx.at>
parents:
4684
diff
changeset
|
265 *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
|
266 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
267 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
|
268 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
|
269 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
|
270 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
|
271 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
|
272 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
|
273 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
274 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
275 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
|
276 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
|
277 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
278 |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
279 toolbar = gtk_toolbar_new(); |
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
280 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
|
281 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
|
282 GTK_STOCK_OPEN); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
283 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
|
284 GTK_STOCK_ADD); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
285 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
|
286 GTK_STOCK_MEDIA_PLAY); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
287 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
|
288 GTK_STOCK_MEDIA_PAUSE); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
289 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
|
290 GTK_STOCK_MEDIA_PREVIOUS); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
291 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
|
292 GTK_STOCK_MEDIA_NEXT); |
4697
3b4400ab7397
fixing a warning and doing some renaming, indentation etc.
mf0102 <0102@gmx.at>
parents:
4696
diff
changeset
|
293 gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, TRUE, 0); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
294 |
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 pcnbox = 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
|
297 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
298 chbox = gtk_hbox_new(FALSE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
299 cvbox = 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
|
300 label_current = gtk_markup_label_new("<big>Current: ?</big>"); |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
301 gtk_misc_set_alignment(GTK_MISC(label_current), 0.0, 0.5); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
302 gtk_box_pack_start(GTK_BOX(cvbox), label_current, TRUE, TRUE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
303 gtk_box_pack_start(GTK_BOX(chbox), cvbox, TRUE, TRUE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
304 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
305 label_prev = gtk_markup_label_new("<small>Previous: ?</small>"); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
306 label_next = gtk_markup_label_new("<small>Next: ?</small>"); |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
307 gtk_misc_set_alignment(GTK_MISC(label_prev), 0.0, 0.5); |
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
308 gtk_misc_set_alignment(GTK_MISC(label_next), 1.0, 0.5); |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
309 gtk_box_pack_start(GTK_BOX(pcnbox), label_prev, TRUE, TRUE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
310 gtk_box_pack_start(GTK_BOX(pcnbox), chbox, TRUE, TRUE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
311 gtk_box_pack_start(GTK_BOX(pcnbox), label_next, TRUE, TRUE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
312 |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
313 gtk_box_pack_start(GTK_BOX(vbox), pcnbox, TRUE, TRUE, 0); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
314 |
4694 | 315 shbox = gtk_hbox_new(FALSE, 0); |
316 gtk_box_pack_end(GTK_BOX(cvbox), shbox, TRUE, TRUE, 0); | |
317 | |
4682 | 318 slider = gtk_hscale_new(NULL); |
319 gtk_scale_set_draw_value(GTK_SCALE(slider), FALSE); | |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
320 /* TODO: make this configureable */ |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
321 gtk_range_set_update_policy(GTK_RANGE(slider), GTK_UPDATE_DISCONTINUOUS); |
4694 | 322 gtk_box_pack_start(GTK_BOX(shbox), slider, TRUE, TRUE, 0); |
323 | |
324 label_time = gtk_markup_label_new("<tt><b>0:00/0:00</b></tt>"); | |
325 gtk_box_pack_start(GTK_BOX(shbox), label_time, FALSE, FALSE, 0); | |
4682 | 326 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
327 ui_hooks_associate(); |
4682 | 328 |
4683
86e2ba287242
improve the position slider's behavior a bit and do some indentation
mf0102 <0102@gmx.at>
parents:
4682
diff
changeset
|
329 slider_change_handler_id = |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
330 g_signal_connect(slider, "value-changed", |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
331 G_CALLBACK(ui_slider_value_changed_cb), NULL); |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
332 |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
333 g_signal_connect(slider, "change-value", |
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
334 G_CALLBACK(ui_slider_change_value_cb), NULL); |
4687
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
335 g_signal_connect(slider, "button-press-event", |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
336 G_CALLBACK(ui_slider_button_press_cb), NULL); |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
337 g_signal_connect(slider, "button-release-event", |
9e70ca57b5dd
small adjustments to slider
Tomasz Mon <desowin@gmail.com>
parents:
4686
diff
changeset
|
338 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
|
339 |
4688
b3e2ea3f9297
display what would be played if user presses play button
Tomasz Mon <desowin@gmail.com>
parents:
4687
diff
changeset
|
340 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
|
341 |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
342 gtk_widget_show_all(window); |
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
343 gtk_main(); |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
344 |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
345 return TRUE; |
4664
46c02b5589c2
commited initial version of new UI, which can be tested via "audacious -H"
mf0102 <0102@gmx.at>
parents:
diff
changeset
|
346 } |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
347 |
4689
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
348 static gboolean |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
349 _ui_finalize(void) |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
350 { |
4698
cfc8d1e0c78b
- update time info during slider movement
mf0102 <0102@gmx.at>
parents:
4697
diff
changeset
|
351 ui_hooks_disassociate(); |
4689
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
352 return TRUE; |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
353 } |
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
354 |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
355 static Interface default_interface = { |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
356 .id = "default", |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
357 .desc = N_("Default Interface"), |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
358 .init = _ui_initialize, |
4689
a5707f571100
dissociate hooks at _ui_finalize
Tomasz Mon <desowin@gmail.com>
parents:
4688
diff
changeset
|
359 .fini = _ui_finalize, |
4667
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
360 }; |
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 Interface * |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
363 ui_populate_default_interface(void) |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
364 { |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
365 interface_register(&default_interface); |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
366 |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
367 return &default_interface; |
2079f04c19e2
Use new Interface API.
William Pitcock <nenolod@atheme.org>
parents:
4664
diff
changeset
|
368 } |