updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / gidic / gidic_disable_sound.patch
blob0d8bed0cad9b594ba67a35efc75894fed545afa2
1 --- Makefile.am 2006-08-09 21:16:06.000000000 +0700
2 +++ ../../gidic-1.0/Makefile.am 2007-04-16 02:46:50.000000000 +0700
3 @@ -22,8 +22,6 @@
4 fi
5 $(INSTALL_DATA) gidic.db $(DESTDIR)$(pkgdatadir)
6 $(INSTALL_DATA) COPYING $(DESTDIR)$(pkgdatadir)
7 - $(INSTALL_DATA) gidic.desktop /usr/share/applications
8 - $(INSTALL_DATA) $(srcdir)/pixmaps/gidic-icon48.png /usr/share/pixmaps/gidic.png
10 dist-hook:
11 if test -d pixmaps; then \
12 --- Makefile.in 2006-08-09 21:16:31.000000000 +0700
13 +++ ../../gidic-1.0/Makefile.in 2007-04-16 02:47:49.000000000 +0700
14 @@ -613,8 +613,6 @@
16 $(INSTALL_DATA) gidic.db $(DESTDIR)$(pkgdatadir)
17 $(INSTALL_DATA) COPYING $(DESTDIR)$(pkgdatadir)
18 - $(INSTALL_DATA) gidic.desktop /usr/share/applications
19 - $(INSTALL_DATA) $(srcdir)/pixmaps/gidic-icon48.png /usr/share/pixmaps/gidic.png
21 dist-hook:
22 if test -d pixmaps; then \
23 --- src/callbacks.c 2006-08-04 19:10:23.000000000 +0700
24 +++ ../../gidic-1.0/src/callbacks.c 2007-04-15 22:35:46.000000000 +0700
25 @@ -3,8 +3,6 @@
26 #endif
28 #include <gtk/gtk.h>
29 -#define ALSA_PCM_NEW_HW_PARAMS_API
30 -#include <alsa/asoundlib.h>
31 #include <stdio.h>
32 #include <dirent.h>
33 #include "callbacks.h"
34 @@ -12,7 +10,7 @@
35 #include "support.h"
38 -GtkWidget *this, *contentview, *btnsay, *statusbar, *progressbar;
39 +GtkWidget *this, *contentview, *statusbar, *progressbar;
40 FILE *dic_fh;
42 GtkTextBuffer *textbuffer;
43 @@ -65,108 +63,6 @@
44 return return_val;
48 -int file_exists (char* file_name)
50 - DIR *dir;
51 - struct dirent* entry;
52 - int retval = 0;
54 - dir = opendir (PACKAGE_DATA_DIR "/gidic/voices");
55 - if (dir != NULL)
56 - {
57 - while ((entry = readdir(dir)) != NULL)
58 - {
59 - if (strcmp(entry->d_name, file_name) == 0)
60 - {
61 - retval = 1;
62 - break;
63 - }
64 - }
65 - }
66 - else
67 - {
68 - msg_box("Can not open Data directory SOUND_DATA_DIR");
69 - }
70 - closedir(dir);
71 - return retval;
75 -int play_sound (char *fname)
77 - FILE *fh;
78 - long loops;
79 - int rc, size, dir;
80 - snd_pcm_t *handle;
81 - snd_pcm_hw_params_t *params;
82 - unsigned int val;
83 - snd_pcm_uframes_t frames;
84 - char *buffer;
85 - char *full_path;
86 - long szfread;
88 - rc = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
89 - if (rc < 0)
90 - {
91 - g_sprintf (buffer, N_("Unable to open pcm device: %s"), snd_strerror(rc));
92 - msg_box (buffer);
93 - return 1;
94 - }
95 - val = 44100;
96 - frames = 32;
97 - snd_pcm_hw_params_alloca(&params);
98 - snd_pcm_hw_params_any(handle, params);
99 - snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
100 - snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S16_LE);
101 - snd_pcm_hw_params_set_channels(handle, params, 2);
102 - snd_pcm_hw_params_set_rate_near(handle, params, &val, &dir);
103 - snd_pcm_hw_params_set_period_size_near(handle, params, &frames, &dir);
104 - rc = snd_pcm_hw_params(handle, params);
105 - if (rc < 0)
107 - g_sprintf (buffer, N_("Unable to set hw parameters: %s"), snd_strerror(rc));
108 - msg_box (buffer);
109 - return 1;
111 - full_path = g_strconcat (PACKAGE_DATA_DIR "/gidic/voices/",fname,NULL);
112 - fh = fopen (full_path,"r");
113 - if (fh == NULL)
115 - g_sprintf (buffer, N_("Can not play: %s"), fname);
116 - msg_box (buffer);
117 - return 1;
119 - snd_pcm_hw_params_get_period_size(params, &frames, &dir);
120 - size = frames * 4;
121 - buffer = (char *) malloc(size);
122 - while ((szfread = fread (buffer, 1, size, fh)) > 0)
124 - rc = snd_pcm_writei(handle, buffer, frames);
125 - if (rc == -EPIPE)
127 - msg_box ("Underrun occurred");
128 - snd_pcm_prepare(handle);
130 - else if (rc < 0)
132 - g_sprintf (buffer, N_("Error from writei: %s"), snd_strerror(rc));
133 - msg_box (buffer);
135 - else if (rc != (int)frames)
137 - g_sprintf (buffer, N_("short write, write %d frames"), rc);
138 - msg_box (buffer);
141 - fclose (fh);
142 - snd_pcm_drain(handle);
143 - snd_pcm_close(handle);
144 - free(buffer);
145 - return 0;
149 void
150 on_mainwindow_show (GtkWidget *widget,
151 gpointer user_data)
152 @@ -175,11 +71,9 @@
153 gtk_widget_set_usize (this,400,450);
154 contentview = lookup_widget (this,"contentview");
155 clipboard = gtk_clipboard_get (atom);
156 - btnsay = lookup_widget (this,"btnsay");
157 statusbar = lookup_widget (this,"statusbar");
158 progressbar = lookup_widget (this,"progressbar");
159 init_looknfeel ();
160 - gtk_widget_hide (btnsay);
161 open_datadb (NULL);
162 smode=0;
163 return;
164 @@ -390,27 +284,6 @@
167 void
168 -on_btnsay_clicked (GtkToolButton *toolbutton,
169 - gpointer user_data)
171 - GtkWidget* searchtext;
172 - gchar *selected_text;
174 - searchtext = lookup_widget(this,"searchentry");
175 - selected_text = (gchar*)gtk_entry_get_text(GTK_ENTRY(searchtext));
176 - if (strlen(selected_text) > 1)
178 - selected_text = g_strconcat (selected_text, ".wav", NULL);
179 - if (file_exists (selected_text)==1)
180 - play_sound (selected_text);
181 - else
182 - msg_box("Can not 'Say'. File does not exists.");
184 - return;
188 -void
189 on_findbutton_clicked (GtkButton *button,
190 gpointer user_data)
192 @@ -480,10 +353,6 @@
195 strentry = g_strconcat (findstr,".wav",NULL);
196 - if (file_exists(strentry)==1)
197 - gtk_widget_show (btnsay);
198 - else
199 - gtk_widget_hide (btnsay);
200 if (found >= 1)
201 sprintf (buffer,"Done. %d %s found.",found,(found > 1 ? "words" : "word"));
202 else
203 --- src/callbacks.h 2006-08-02 18:55:51.000000000 +0700
204 +++ ../../gidic-1.0/src/callbacks.h 2007-04-15 22:36:31.000000000 +0700
205 @@ -76,10 +76,6 @@
206 gpointer user_data);
208 void
209 -on_btnsay_clicked (GtkToolButton *toolbutton,
210 - gpointer user_data);
212 -void
213 on_findbutton_clicked (GtkButton *button,
214 gpointer user_data);
216 --- src/interface.c 2006-08-02 18:09:14.000000000 +0700
217 +++ ../../gidic-1.0/src/interface.c 2007-04-15 22:21:39.000000000 +0700
218 @@ -61,7 +61,6 @@
219 GtkWidget *tmp_image;
220 GtkWidget *btngbr;
221 GtkWidget *btnidn;
222 - GtkWidget *btnsay;
223 GtkWidget *contentvbox;
224 GtkWidget *searchhbox;
225 GtkWidget *searchlabel;
226 @@ -204,10 +203,6 @@
227 gtk_radio_tool_button_set_group (GTK_RADIO_TOOL_BUTTON (btnidn), btngbr_group);
228 btngbr_group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (btnidn));
230 - btnsay = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-media-play");
231 - gtk_widget_show (btnsay);
232 - gtk_container_add (GTK_CONTAINER (toolbar), btnsay);
234 contentvbox = gtk_vbox_new (FALSE, 4);
235 gtk_widget_show (contentvbox);
236 gtk_box_pack_start (GTK_BOX (vbox), contentvbox, TRUE, TRUE, 2);
237 @@ -298,9 +293,6 @@
238 g_signal_connect ((gpointer) btnidn, "toggled",
239 G_CALLBACK (on_btnidn_toggled),
240 NULL);
241 - g_signal_connect ((gpointer) btnsay, "clicked",
242 - G_CALLBACK (on_btnsay_clicked),
243 - NULL);
244 g_signal_connect ((gpointer) findbutton, "clicked",
245 G_CALLBACK (on_findbutton_clicked),
246 NULL);
247 @@ -333,7 +325,6 @@
248 GLADE_HOOKUP_OBJECT (mainwindow, btnseparator, "btnseparator");
249 GLADE_HOOKUP_OBJECT (mainwindow, btngbr, "btngbr");
250 GLADE_HOOKUP_OBJECT (mainwindow, btnidn, "btnidn");
251 - GLADE_HOOKUP_OBJECT (mainwindow, btnsay, "btnsay");
252 GLADE_HOOKUP_OBJECT (mainwindow, contentvbox, "contentvbox");
253 GLADE_HOOKUP_OBJECT (mainwindow, searchhbox, "searchhbox");
254 GLADE_HOOKUP_OBJECT (mainwindow, searchlabel, "searchlabel");