summaryrefslogtreecommitdiff
path: root/media-sound/aylet/files/aylet-0.5-gtk.patch
blob: ddd701d1df7e5c95bbb12789b9ac294154d56c07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
--- a/Makefile
+++ b/Makefile
@@ -2,12 +2,12 @@
 
 # You need an ANSI C compiler. gcc is probably best.
 #
-CC=gcc
+CC?=gcc
 
 # Compiler options (and sound driver) to use. This one is for Linux,
 # and other OSS-using systems.
 #
-CFLAGS=-O -Wall -DDRIVER_OSS
+CFLAGS+=-Wall -DDRIVER_OSS
 
 # for OpenBSD, uncomment this:
 #CFLAGS=-O -Wall -DDRIVER_OPENBSD
@@ -39,14 +39,29 @@
 
 all: aylet xaylet
 
+
+# GTK+1.2 stuff: "make all" or "make gtk1"
+GTKCONFIG=gtk-config
+GTKFLAGS=-UGTK2
+gtk1: all
+
+# GTK+2 stuff: "make gtk2"
+gtk2: GTKCONFIG:=$(PKG_CONFIG) gtk+-2.0
+gtk2: GTKFLAGS:=-DGTK2 $(shell \
+			 $(GTKCONFIG) --modversion | \
+			 awk 'BEGIN { FS="." } \
+			      1 { if ($$1 > 2 || ($$1 == 2 && $$2 >= 6)) \
+				  { print "-DGTK2_6" } }')
+gtk2: all
+
 aylet: $(OBJS)
-	$(CC) -o aylet $(OBJS) $(CURSES_LIB)
+	$(CC) $(LDFLAGS) $(CFLAGS) -o aylet $(OBJS) $(CURSES_LIB)
 
 xaylet: $(XOBJS)
-	$(CC) -o xaylet $(XOBJS) `gtk-config --libs`
+	$(CC) $(LDFLAGS) $(CFLAGS) -o xaylet $(XOBJS) $(shell $(GTKCONFIG) --libs)
 
 uigtk.o: uigtk.c
-	$(CC) $(CFLAGS) `gtk-config --cflags` -c uigtk.c -o uigtk.o
+	$(CC) $(CFLAGS) $(GTKFLAGS) $(shell $(GTKCONFIG) --cflags) -c uigtk.c -o uigtk.o
 
 installdirs:
 	/bin/sh ./mkinstalldirs $(BINDIR) $(XBINDIR) $(MANDIR)
--- a/ui.c
+++ b/ui.c
@@ -5,7 +5,9 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <stdlib.h>
 #include <sys/types.h>
 #include <signal.h>
 #include <curses.h>
@@ -188,8 +190,8 @@
   {
   need_update=0;
   draw_frame();
-  draw_status(ay_filenames[ay_file],aydata.miscstr,aydata.authorstr,
-              ay_track+1,aydata.tracks[ay_track].namestr);
+  draw_status(ay_filenames[ay_file],(char *)aydata.miscstr, (char *)aydata.authorstr,
+              ay_track+1, (char *)aydata.tracks[ay_track].namestr);
   }
 
 /* update time display */
--- a/uigtk.c
+++ b/uigtk.c
@@ -14,11 +14,13 @@
 #include "ui.h"
 
 /* button pixmaps */
+#ifndef GTK2_6
 #include "button1.xpm"
 #include "button2.xpm"
 #include "button3.xpm"
 #include "button4.xpm"
 #include "button5.xpm"
+#endif
 
 
 static GtkWidget *window,*vbox,*detailstbl,*detaillabel[5];
@@ -107,6 +109,11 @@
 GdkBitmap *bitmap,*mask;
 int tbl_row,width;
 
+#ifdef GTK2
+#define gtk_accel_group_get_default() accel
+  GtkAccelGroup *accel;
+#endif
+
 window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_signal_connect(GTK_OBJECT(window),"destroy",
                    GTK_SIGNAL_FUNC(cb_doquit),NULL);
@@ -116,6 +123,11 @@
 gtk_window_set_title(GTK_WINDOW(window),"xaylet");
 gtk_window_set_policy(GTK_WINDOW(window),FALSE,TRUE,FALSE);	/* XXX? */
 
+#ifdef GTK2
+  accel = gtk_accel_group_new ();
+  gtk_window_add_accel_group (GTK_WINDOW (window), accel);
+#endif
+
 /* main vbox */
 vbox=gtk_vbox_new(FALSE,0);
 gtk_container_add(GTK_CONTAINER(window),vbox);
@@ -194,7 +206,11 @@
 DO_TBL_RIGHT(statustbl,1, 1,2,"");
 label_for_time=label;
 
+#ifdef GTK2
+  highspeed_widget = gtk_check_button_new_with_mnemonic ("_High speed");
+#else
 highspeed_widget=gtk_check_button_new_with_label("High-speed");
+#endif
 /* don't allow focus, looks too weird and we have shortcut */
 GTK_WIDGET_UNSET_FLAGS(highspeed_widget,GTK_CAN_FOCUS);
 gtk_table_attach_defaults(GTK_TABLE(statustbl),highspeed_widget, 2,4, 0,2);
@@ -227,6 +243,21 @@
 gtk_container_set_border_width(GTK_CONTAINER(buttontbl),5);
 gtk_widget_show(buttontbl);
 
+#ifdef GTK2_6 /* >= GTK+ 2.6 */
+#define ADD_PIXMAP_TO_BUTTON(button,xpm,stock) \
+  pixmap = gtk_image_new_from_stock (GTK_STOCK_MEDIA_##stock, \
+				     GTK_ICON_SIZE_BUTTON); \
+  gtk_container_add (GTK_CONTAINER ((button)), pixmap); \
+  gtk_widget_show (pixmap)
+#else /* < GTK+ 2.6 */
+#define ADD_PIXMAP_TO_BUTTON(button,xpm,stock) \
+  bitmap=gdk_pixmap_create_from_xpm_d(window->window,&mask,	\
+                                      &(window->style->black),	\
+                                      (xpm));			\
+  pixmap=gtk_pixmap_new(bitmap,mask);				\
+  gtk_container_add(GTK_CONTAINER(button),pixmap);		\
+  gtk_widget_show(pixmap)
+#endif
 
 hbox=gtk_hbox_new(TRUE,5);
 gtk_table_attach_defaults(GTK_TABLE(buttontbl),hbox, 0,4, 0,1);
@@ -236,16 +267,8 @@
 /* XXX this seems to be needed here, but is it ok? */
 gtk_widget_realize(window);
 
-#define ADD_PIXMAP_TO_BUTTON(button,xpm) \
-  bitmap=gdk_pixmap_create_from_xpm_d(window->window,&mask,	\
-                                      &(window->style->black),	\
-                                      (xpm));			\
-  pixmap=gtk_pixmap_new(bitmap,mask);				\
-  gtk_container_add(GTK_CONTAINER(button),pixmap);		\
-  gtk_widget_show(pixmap)
-
 button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button1);
+ADD_PIXMAP_TO_BUTTON(button,button1,PREVIOUS);
 gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_prev_track),NULL);
@@ -256,7 +279,7 @@
 gtk_widget_show(button);
 
 button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button2);
+ADD_PIXMAP_TO_BUTTON(button,button2,PLAY);
 gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_play),NULL);
@@ -266,7 +289,7 @@
 gtk_widget_show(button);
 
 button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button3);
+ADD_PIXMAP_TO_BUTTON(button,button3,PAUSE);
 gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_pause),NULL);
@@ -276,7 +299,7 @@
 gtk_widget_show(button);
 
 button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button4);
+ADD_PIXMAP_TO_BUTTON(button,button4,STOP);
 gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_stop),NULL);
@@ -286,7 +309,7 @@
 gtk_widget_show(button);
 
 button=gtk_button_new();
-ADD_PIXMAP_TO_BUTTON(button,button5);
+ADD_PIXMAP_TO_BUTTON(button,button5,NEXT);
 gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_next_track),NULL);
@@ -295,7 +318,11 @@
 GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FOCUS);
 gtk_widget_show(button);
 
+#ifdef GTK2
+  button = gtk_button_new_with_mnemonic ("_Restart");
+#else
 button=gtk_button_new_with_label("Restart");
+#endif
 gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,0);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_restart),NULL);
@@ -304,17 +331,24 @@
 GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FOCUS);
 gtk_widget_show(button);
 
-
 /* second row, these go straight on the table */
 /* backspace/delete/space are dealt with by keypress() */
+#ifdef GTK2
+  button = gtk_button_new_with_mnemonic ("_Previous file");
+#else
 button=gtk_button_new_with_label("Prev File");
+#endif
 gtk_table_attach_defaults(GTK_TABLE(buttontbl),button, 1,2, 1,2);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_prev_file),NULL);
 GTK_WIDGET_UNSET_FLAGS(button,GTK_CAN_FOCUS);
 gtk_widget_show(button);
 
+#ifdef GTK2
+  button = gtk_button_new_with_mnemonic("_Next file");
+#else
 button=gtk_button_new_with_label("Next File");
+#endif
 gtk_table_attach_defaults(GTK_TABLE(buttontbl),button, 2,3, 1,2);
 gtk_signal_connect(GTK_OBJECT(button),"clicked",
                    GTK_SIGNAL_FUNC(cb_button_next_file),NULL);
@@ -386,8 +420,8 @@
 if(need_update)
   {
   need_update=0;
-  ui_draw_status(ay_filenames[ay_file],aydata.miscstr,aydata.authorstr,
-                 ay_track+1,aydata.tracks[ay_track].namestr);
+  ui_draw_status(ay_filenames[ay_file], (char *)aydata.miscstr, (char *)aydata.authorstr,
+                 ay_track+1, (char *)aydata.tracks[ay_track].namestr);
   }
 
 /* update time display */