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
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
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
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
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
29 -#define ALSA_PCM_NEW_HW_PARAMS_API
30 -#include <alsa/asoundlib.h>
33 #include "callbacks.h"
38 -GtkWidget *this, *contentview, *btnsay, *statusbar, *progressbar;
39 +GtkWidget *this, *contentview, *statusbar, *progressbar;
42 GtkTextBuffer *textbuffer;
48 -int file_exists (char* file_name)
51 - struct dirent* entry;
54 - dir = opendir (PACKAGE_DATA_DIR "/gidic/voices");
57 - while ((entry = readdir(dir)) != NULL)
59 - if (strcmp(entry->d_name, file_name) == 0)
68 - msg_box("Can not open Data directory SOUND_DATA_DIR");
75 -int play_sound (char *fname)
81 - snd_pcm_hw_params_t *params;
83 - snd_pcm_uframes_t frames;
88 - rc = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
91 - g_sprintf (buffer, N_("Unable to open pcm device: %s"), snd_strerror(rc));
97 - snd_pcm_hw_params_alloca(¶ms);
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);
107 - g_sprintf (buffer, N_("Unable to set hw parameters: %s"), snd_strerror(rc));
111 - full_path = g_strconcat (PACKAGE_DATA_DIR "/gidic/voices/",fname,NULL);
112 - fh = fopen (full_path,"r");
115 - g_sprintf (buffer, N_("Can not play: %s"), fname);
119 - snd_pcm_hw_params_get_period_size(params, &frames, &dir);
121 - buffer = (char *) malloc(size);
122 - while ((szfread = fread (buffer, 1, size, fh)) > 0)
124 - rc = snd_pcm_writei(handle, buffer, frames);
127 - msg_box ("Underrun occurred");
128 - snd_pcm_prepare(handle);
132 - g_sprintf (buffer, N_("Error from writei: %s"), snd_strerror(rc));
135 - else if (rc != (int)frames)
137 - g_sprintf (buffer, N_("short write, write %d frames"), rc);
142 - snd_pcm_drain(handle);
143 - snd_pcm_close(handle);
150 on_mainwindow_show (GtkWidget *widget,
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");
160 - gtk_widget_hide (btnsay);
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);
182 - msg_box("Can not 'Say'. File does not exists.");
189 on_findbutton_clicked (GtkButton *button,
195 strentry = g_strconcat (findstr,".wav",NULL);
196 - if (file_exists(strentry)==1)
197 - gtk_widget_show (btnsay);
199 - gtk_widget_hide (btnsay);
201 sprintf (buffer,"Done. %d %s found.",found,(found > 1 ? "words" : "word"));
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
209 -on_btnsay_clicked (GtkToolButton *toolbutton,
210 - gpointer user_data);
213 on_findbutton_clicked (GtkButton *button,
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
219 GtkWidget *tmp_image;
223 GtkWidget *contentvbox;
224 GtkWidget *searchhbox;
225 GtkWidget *searchlabel;
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);
238 g_signal_connect ((gpointer) btnidn, "toggled",
239 G_CALLBACK (on_btnidn_toggled),
241 - g_signal_connect ((gpointer) btnsay, "clicked",
242 - G_CALLBACK (on_btnsay_clicked),
244 g_signal_connect ((gpointer) findbutton, "clicked",
245 G_CALLBACK (on_findbutton_clicked),
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");