tvkaista-0.971/Makefile tvkaista-0.975/Makefile
55
6all: tvkaista_gtkui tvkaista_gtkpw6all: tvkaista_gtkui tvkaista_gtkpw
77
8tvkaista_gtkui: tvkaista_gtkui.c tvkaista.desktop8tvkaista_gtkui: tvkaista_gtkui.c tvkaista.desktop custom-list.o
9 sh $<
10
11custom-list.o: custom-list.c custom-list.h
9 sh $<12 sh $<
1013
11tvkaista_gtkpw: tvkaista_gtkpw.c14tvkaista_gtkpw: tvkaista_gtkpw.c
47 ver=`sed -n 's/Version=//p' tvkaista.desktop`; \50 ver=`sed -n 's/Version=//p' tvkaista.desktop`; \
48 tar --transform "s|^|tvkaista-$$ver/|" -zcf tvkaista-$$ver.tar.gz \51 tar --transform "s|^|tvkaista-$$ver/|" -zcf tvkaista-$$ver.tar.gz \
49 tvkaista_gtkui.c tvkaista-helper.pl tvkaista.sh \52 tvkaista_gtkui.c tvkaista-helper.pl tvkaista.sh \
53 custom-list.c custom-list.o \
50 tvkaista.desktop tvkaista.png logo.pov Makefile gitlog && \54 tvkaista.desktop tvkaista.png logo.pov Makefile gitlog && \
51 echo Created tvkaista-$$ver.tar.gz55 echo Created tvkaista-$$ver.tar.gz
5256
53clean:57clean:
54 rm -f helper.c helper.gz logo.png *~58 rm -f custom-list.o logo.png *~
5559
56distclean: clean60distclean: clean
57 rm -f tvkaista_gtkui tvkaista_gtk61 rm -f tvkaista_gtkui tvkaista_gtkpw
5862

Only in tvkaista-0.975: custom-list.c

Only in tvkaista-0.975: custom-list.o

tvkaista-0.971/gitlog tvkaista-0.975/gitlog
1commit fe3f97aa2d12406bc34be7815f4bb26b9b64276d
2Author: Tomi Ollila <too@iki.fi>
3Date: Fri May 22 23:10:08 2009 +0300
4
5 Nyt käytetään CustomList:ia GtkList*:i(e)n sijaan. versio 0.975
6
7M Makefile
8M custom-list.c
9M custom-list.h
10M tvkaista.desktop
11M tvkaista_gtkui.c
12
13commit aed71bb581b402f3d33a85cb75ecfc9993958938
14Author: Tomi Ollila <too@iki.fi>
15Date: Fri May 22 19:22:09 2009 +0300
16
17 g|gu|gui)
18
19M tvkaista.sh
20
21commit a88c241ec139c7c575b197a5cce7a59035cac315
22Author: Tomi Ollila <too@iki.fi>
23Date: Mon May 11 22:05:24 2009 +0300
24
25 Lisätty custom -listakoodi Gtk 2.0 Tree View Tutorialista -- muokkausta vaille
26
27M Makefile
28A custom-list.c
29A custom-list.h
30
31commit 3de1f1222377d6f9b7151aceb392672e8c2ce2f3
32Author: Tomi Ollila <too@iki.fi>
33Date: Mon May 11 11:08:23 2009 +0300
34
35 change -I to -isystem in pkg-config output
36
37M tvkaista_gtkpw.c
38M tvkaista_gtkui.c
39
40commit d43440aaccf0fd7e33289f881234c296f0d5af71
41Author: Tomi Ollila <too@iki.fi>
42Date: Fri May 8 20:15:12 2009 +0300
43
44 yksi pclose(). ehka nopeampi selauspaivitys
45
46M tvkaista_gtkui.c
47
1commit 495967cea795d0323bccacfc7cdbff9555a8179948commit 495967cea795d0323bccacfc7cdbff9555a81799
2Author: Tomi Ollila <too@iki.fi>49Author: Tomi Ollila <too@iki.fi>
3Date: Thu May 7 23:52:21 2009 +030050Date: Thu May 7 23:52:21 2009 +0300

tvkaista-0.971/tvkaista.desktop tvkaista-0.975/tvkaista.desktop
1[Desktop Entry]1[Desktop Entry]
2Encoding=UTF-82Encoding=UTF-8
3Version=0.9713Version=0.975
4Name=tv kaista4Name=tv kaista
5Comment=gui-kilentti tvkaistalle5Comment=gui-kilentti tvkaistalle
6GenericName=tvkaista-kilentti6GenericName=tvkaista-kilentti

tvkaista-0.971/tvkaista.sh tvkaista-0.975/tvkaista.sh
9# All rights reserved9# All rights reserved
10#10#
11# Created: Sat Jan 30 18:41:21 EET 2009 too11# Created: Sat Jan 30 18:41:21 EET 2009 too
12# Last modified: Wed 29 Apr 2009 20:14:37 EEST too12# Last modified: Fri 22 May 2009 19:20:22 EEST too
1313
14LANG=fi_FI.utf8 LC_ALL=fi_FI.utf8; export LANG LC_ALL14LANG=fi_FI.utf8 LC_ALL=fi_FI.utf8; export LANG LC_ALL
15LESS= LESSCHARSET=utf-8; export LESS LESSCHARSET15LESS= LESSCHARSET=utf-8; export LESS LESSCHARSET
113 exec ./tvkaista_gtkui113 exec ./tvkaista_gtkui
114}114}
115115
116case $1 in gui) cmd_gui ;; esac116case $1 in g|gu|gui) cmd_gui ;; esac
117die "currently only 'gui' accepted"117die "currently only 'gui' accepted"
118118
119# ad hoc hack #1119# ad hoc hack #1

tvkaista-0.971/tvkaista_gtkui.c tvkaista-0.975/tvkaista_gtkui.c
4WARN="-Wall -Wno-long-long -Wstrict-prototypes -pedantic"4WARN="-Wall -Wno-long-long -Wstrict-prototypes -pedantic"
5WARN="$WARN -Wcast-align -Wpointer-arith " # -Wfloat-equal #-Werror5WARN="$WARN -Wcast-align -Wpointer-arith " # -Wfloat-equal #-Werror
6WARN="$WARN -W -Wwrite-strings -Wcast-qual -Wshadow" # -Wconversion6WARN="$WARN -W -Wwrite-strings -Wcast-qual -Wshadow" # -Wconversion
7FLAGS=`pkg-config --cflags --libs gtk+-2.0`7FLAGS=`pkg-config --cflags --libs gtk+-2.0 | sed 's/-I/-isystem '/g`
8ver=`sed -n 's/Version=//p' tvkaista.desktop`8ver=`sed -n 's/Version=//p' tvkaista.desktop`
9OPTS="$WARN $FLAGS -DVERSION=$ver"9OPTS="$WARN $FLAGS -DVERSION=$ver" # -DCDATE=\"`date`\""
10case $1 in '') set x -ggdb
10case $1 in '') set x -O2 ### set x -ggdb11#case $1 in '') set x -O2 ### set x -ggdb
11 shift ;; esac;12 shift ;; esac;
12set -x; ${CC:-gcc} -std=gnu99 $OPTS "$@" -o "$TRG" "$0" -DCDATE="\"`date`\""13set -x; ${CC:-gcc} -std=gnu99 $OPTS "$@" -o "$TRG" "$0" custom-list.o
13exit $?14exit $?
1415
15 */16 */
5051
51#include <errno.h>52#include <errno.h>
5253
54#include "custom-list.h"
55
53#define null ((void*)0)56#define null ((void*)0)
5457
55enum { false = 0, true = 1 } bool;58enum { false = 0, true = 1 } bool;
100}103}
101#endif104#endif
102105
103typedef struct
104{
105 int id;
106 int16_t channelindex;
107 int16_t txtfileindex;
108 int txtoffset;
109} PrgInfo;
110
111
112#define MAXSEARCHLEN 30106#define MAXSEARCHLEN 30
113struct107struct
114{108{
115 int channelfilter;109 int channelfilter;
116 int16_t maxchannelindex;110 int16_t maxchannelindex;
117 bool8 dotextfiltering;
118 bool8 notidle;111 bool8 notidle;
119 char * path;112 char * path;
120 char compare[MAXSEARCHLEN + 2];113 char compare[MAXSEARCHLEN + 2];
121 // max 32 for now (14 is current maximum in tvkaista).114 // max 32 for now (14 is current maximum in tvkaista).
122 char prgfile[32][sizeof "2/program_2009-mm-dd"];115 char prgfile[32][sizeof "3/program_2009-mm-dd"];
123 int prgfd[32];116 int prgfd[32];
124 PrgInfo * prgbuffers[100]; // up to 100 000 programs.117 int indx;
125 int previndx;118 int prevabsindx;
126} G;119} G;
127120
128/* widgets in separate structure, for code readability */121/* widgets in separate structure, for code readability */
132 GtkWidget * scb; /* speed combo box */125 GtkWidget * scb; /* speed combo box */
133 GtkWidget * pcb; /* player combo box */126 GtkWidget * pcb; /* player combo box */
134 GtkTextBuffer * txtbuffer; /* detailed program text */127 GtkTextBuffer * txtbuffer; /* detailed program text */
135 GtkTreeModelFilter * listfilter;128 GtkWidget * listview;
129 CustomList * listmodel;
136} W;130} W;
137131
138// XXX make better later...132// XXX make better later...
142{136{
143 memset(&G, 0, sizeof G);137 memset(&G, 0, sizeof G);
144 memset(&W, 0, sizeof W);138 memset(&W, 0, sizeof W);
145 G.previndx = -1;139 G.indx = G.prevabsindx = -1;
146 for (unsigned int i = 0; i < sizeof G.prgfd / sizeof G.prgfd[0]; i++)140 for (unsigned int i = 0; i < sizeof G.prgfd / sizeof G.prgfd[0]; i++)
147 G.prgfd[i] = -1;141 G.prgfd[i] = -1;
148}142}
166 return popen(cmdline, "r");160 return popen(cmdline, "r");
167}161}
168162
169enum163void refilter_model(void)
170{164{
171 COL_DATE = 0,165 //g_object_ref(W.listfilter); // there will be 1 reference always...
172 COL_TIME,166 gtk_tree_view_set_model(GTK_TREE_VIEW(W.listview), null);
173 COL_CHANNEL,167#if 1
174 COL_PROGRAM,168 struct timeval st, et;
175 COL_HIDDEN_INDEX,169 gettimeofday(&st, null);
176 NUM_COLS170#endif
177};171 custom_list_filter(W.listmodel, G.channelfilter, G.compare);
172#if 1
173 gettimeofday(&et, null);
174 printf("%.3f\n", (float)(et.tv_sec - st.tv_sec) * 1000
175 + (float)(et.tv_usec - st.tv_usec) / 1000);
176#endif
178177
179bool visible_rows(GtkTreeModel * model, GtkTreeIter * iter, gpointer data)178 gtk_tree_view_set_model(GTK_TREE_VIEW(W.listview),
180{179 GTK_TREE_MODEL(W.listmodel));
181 (void)data;180 //g_object_unref(W.listfilter); // there will be 1 reference always...
182
183 if (G.channelfilter) {
184 int indx;
185 gtk_tree_model_get (model, iter, COL_HIDDEN_INDEX, &indx, -1);
186 int i = indx / 1000, j = indx % 1000;
187 PrgInfo * prginfo = &G.prgbuffers[i][j];
188 if (G.channelfilter != prginfo->channelindex)
189 return false;
190 }
191
192 if (! G.dotextfiltering)
193 return true;
194
195 gchar * str;
196 gtk_tree_model_get (model, iter, COL_PROGRAM, &str, -1);
197 if (!str)
198 return false;
199 gboolean visible = (strcasestr(str, G.compare) != null);
200 g_free(str);
201 return visible;
202}181}
182
183// after filter make unselected -- and G.indx == -1
203184
204bool selected_row(GtkTreeSelection * selection,185bool selected_row(GtkTreeSelection * selection,
205 GtkTreeModel * model, GtkTreePath * path,186 GtkTreeModel * model, GtkTreePath * path,
220 GtkTreeIter iter;201 GtkTreeIter iter;
221 if (gtk_tree_model_get_iter(model, &iter, path))202 if (gtk_tree_model_get_iter(model, &iter, path))
222 {203 {
223 int indx;204 int indx = GPOINTER_TO_INT(iter.user_data);
224 gtk_tree_model_get(model, &iter, COL_HIDDEN_INDEX, &indx, -1);205 CustomRecord * record = custom_list_get_record(W.listmodel, indx);
206 if (record == null)
207 die("XXXX\n");
208 int absindx = record->absolute_position;
225 d0(("going to be selected %d %d\n", indx, G.previndx));209 d0(("going to be selected %d %d\n", absindx, G.prevabsindx));
226 if (indx != G.previndx) {210 if (absindx != G.prevabsindx) {
227 G.previndx = indx;211 G.indx = indx;
228 int i = indx / 1000, j = indx % 1000;212 G.prevabsindx = absindx;
229 PrgInfo * prginfo = &G.prgbuffers[i][j];
230 if (prginfo->txtoffset == 0) {213 if (record->txtoffset == 0) {
231 gtk_text_buffer_set_text(W.txtbuffer, "Ei ohjelmatietoja.", -1);214 gtk_text_buffer_set_text(W.txtbuffer, "Ei ohjelmatietoja.", -1);
232 return true;215 return true;
233 }216 }
234 int fd = G.prgfd[prginfo->txtfileindex];217 int fd = G.prgfd[record->txtfileindex];
235 if (fd < 0) {218 if (fd < 0) {
236 fd = open(G.prgfile[prginfo->txtfileindex], O_RDONLY);219 fd = open(G.prgfile[record->txtfileindex], O_RDONLY);
237 if (fd < 0)220 if (fd < 0)
238 die("fd %d\n", fd); // XXX221 die("fd %d\n", fd); // XXX
239 G.prgfd[prginfo->txtfileindex] = fd;222 G.prgfd[record->txtfileindex] = fd;
240 }223 }
241 lseek(fd, prginfo->txtoffset, SEEK_SET);224 lseek(fd, record->txtoffset, SEEK_SET);
242 char buf[1024], *p;225 char buf[1024], *p;
243 int l = read(fd, buf, sizeof buf - 1); // XXX226 int l = read(fd, buf, sizeof buf - 1); // XXX
244 if (l > 0)227 if (l > 0)
250 *p = '\0';233 *p = '\0';
251 d0(("i %d j %d id %d tfi %d to %d tf %s fd %d : %x %x %x\n",234 d0(("i %d j %d id %d tfi %d to %d tf %s fd %d : %x %x %x\n",
252 i, j, prginfo->id,235 i, j, prginfo->id,
253 prginfo->txtfileindex, prginfo->txtoffset,236 record->txtfileindex, record->txtoffset,
254 G.prgfile[prginfo->txtfileindex], fd, buf[0], buf[1], buf[2]));237 G.prgfile[record->txtfileindex], fd, buf[0], buf[1], buf[2]));
255 gtk_text_buffer_set_text(W.txtbuffer, buf, -1);238 gtk_text_buffer_set_text(W.txtbuffer, buf, -1);
256 //write(2, buf, strlen(buf));239 //write(2, buf, strlen(buf));
257 }240 }
292 dest[n - 1] = '\0';275 dest[n - 1] = '\0';
293}276}
294277
295/* copied and edited
296 http://scentric.net/tutorial/sec-treeview-col-example.htm */
297
298static GtkTreeModel * create_model(void)
299{
300 W.listfilter = GTK_TREE_MODEL_FILTER(
301 gtk_tree_model_filter_new(
302 GTK_TREE_MODEL(gtk_list_store_new(NUM_COLS,
303 G_TYPE_STRING, G_TYPE_STRING,
304 G_TYPE_STRING, G_TYPE_STRING,
305 G_TYPE_UINT)), 0));
306#if 0
307 liststore = gtk_list_store_new(NUM_COLS,
308 G_TYPE_STRING, G_TYPE_STRING,
309 G_TYPE_STRING, G_TYPE_STRING);
310#endif
311
312 gtk_tree_model_filter_set_visible_func(W.listfilter, visible_rows,
313 null, null);
314 return GTK_TREE_MODEL(W.listfilter);
315}
316
317void clear_store(void)
318{
319 GtkListStore * liststore
320 = GTK_LIST_STORE(gtk_tree_model_filter_get_model(W.listfilter));
321 gtk_list_store_clear(liststore);
322}
323
324int fill_store(FILE * fh)278int fill_store(FILE * fh)
325{279{
326 GtkListStore * liststore
327 = GTK_LIST_STORE(gtk_tree_model_filter_get_model(W.listfilter));
328 GtkTreeIter iter;
329 char line[1024];280 char line[1024];
330281
331 int id = -1;282 int id = -1;
332 int offset = 0;283 int offset = 0;
333 int indx = 0;
334 int prgdayindex = 0;284 int prgdayindex = 0;
335 int channelindex = 0;285 int channelindex = 0;
336 char day[10];286 char day[10];
379 case 'X':329 case 'X':
380 break;330 break;
381 case 'Q':331 case 'Q':
332 custom_list_full(W.listmodel, G.channelfilter, G.compare);
382 return true;333 return true;
383 default:334 default:
384 fprintf(stderr, "Unknown line: '%s'\n", line);335 fprintf(stderr, "Unknown line: '%s'\n", line);
388 if (id < 0)339 if (id < 0)
389 continue;340 continue;
390341
391 int i = indx / 1000;
392 int j = indx % 1000;
393 if (j == 0) {
394 if (i == sizeof G.prgbuffers / sizeof G.prgbuffers[0])
395 die("i = %d\n", sizeof G.prgbuffers / sizeof G.prgbuffers[0]);
396 G.prgbuffers[i] = malloc(1000 * sizeof (PrgInfo));
397 if (G.prgbuffers[i] == null)
398 die("G.prgbuffers[%d] == null\n", i);
399 }
400
401 G.prgbuffers[i][j].id = id;
402 G.prgbuffers[i][j].channelindex = channelindex;
403 G.prgbuffers[i][j].txtfileindex = prgdayindex;
404 G.prgbuffers[i][j].txtoffset = offset;
405
406 if (channelindex > G.maxchannelindex)342 if (channelindex > G.maxchannelindex)
407 G.maxchannelindex = channelindex;343 G.maxchannelindex = channelindex;
408344
409 /*fputs(line, stdout); */345 custom_list_append(W.listmodel,
410 gtk_list_store_append(liststore, &iter);346 day, hourmin, channel, shortinfo,
411 gtk_list_store_set(liststore, &iter,347 id, channelindex, prgdayindex, offset);
412 COL_DATE, day,
413 COL_TIME, hourmin,
414 COL_CHANNEL, channel,
415 COL_PROGRAM, shortinfo,
416 COL_HIDDEN_INDEX, indx++,
417 -1);
418 id = -1;348 id = -1;
419 offset = 0;349 offset = 0;
420 }350 }
351 custom_list_full(W.listmodel, G.channelfilter, G.compare);
421 return false;352 return false;
422}353}
423354
433364
434void channel_clicked(int promille)365void channel_clicked(int promille)
435{366{
367#if 0
436 printf("channel_clicked(%d)\n", promille);368 printf("channel_clicked(%d) %d %d\n", promille,
437 369 G.channelfilter, G.maxchannelindex);
370#endif
438 if (promille < 300) {371 if (promille < 300) {
439 if (G.channelfilter <= 1)372 if (G.channelfilter <= 1)
440 G.channelfilter = G.maxchannelindex;373 G.channelfilter = G.maxchannelindex;
449 }382 }
450 else383 else
451 G.channelfilter = 0;384 G.channelfilter = 0;
452 gtk_tree_model_filter_refilter(W.listfilter);385 refilter_model();
453 G.notidle = false;386 G.notidle = false;
454}387}
455388
488 GtkTreeViewColumn * col;421 GtkTreeViewColumn * col;
489 GtkCellRenderer * renderer;422 GtkCellRenderer * renderer;
490 GtkWidget * view;423 GtkWidget * view;
491 GtkTreeModel * model;
492 //GtkRequisition sizereq;
493 GtkTreeSelection * selection;424 GtkTreeSelection * selection;
494425
495 int i;426 int i;
497428
498 view = gtk_tree_view_new();429 view = gtk_tree_view_new();
499430
500 //sizereq.width = 600;
501 //sizereq.height = 400;
502
503 //gtk_widget_size_request(view, &sizereq);
504 gtk_widget_set_size_request(view, 768, 512);431 gtk_widget_set_size_request(view, 768, 512);
505432
506 for (i = 0; i < 4; i++)433 for (i = 0; i < 4; i++)
533 age_cell_data_func, NULL, NULL);460 age_cell_data_func, NULL, NULL);
534#endif461#endif
535462
536 model = create_model();463 W.listmodel = CUSTOM_LIST(custom_list_new());
537464
538 FILE * fh = runhelper("list");465 FILE * fh = runhelper("list");
539 if (fh == null)466 if (fh == null)
541 fill_store(fh);468 fill_store(fh);
542 pclose(fh);469 pclose(fh);
543470
544 gtk_tree_view_set_model(GTK_TREE_VIEW(view), model);471 gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(W.listmodel));
545472
473 //* never deleted ! */
546 g_object_unref(model); /* destroy model automatically with view */474 //g_object_unref(W.listmodel); /* destroy model automatically with view */
547475
548 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));476 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
549 gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);477 gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
550478
551 gtk_tree_selection_set_select_function(selection, selected_row, null,null);479 gtk_tree_selection_set_select_function(selection, selected_row, null,null);
552480
553 return view;481 return (W.listview = view);
554}482}
555483
556/* -----------------------------------------------------------------------484/* -----------------------------------------------------------------------
572{500{
573 GtkWidget * window;501 GtkWidget * window;
574502
575 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);503 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
576 gtk_window_set_title(GTK_WINDOW(window), title);504 gtk_window_set_title(GTK_WINDOW(window), title);
577505
578 g_signal_connect(G_OBJECT(window), "delete_event",506 g_signal_connect(G_OBJECT(window), "delete_event",
581 g_signal_connect(G_OBJECT(window), "destroy",509 g_signal_connect(G_OBJECT(window), "destroy",
582 G_CALLBACK(delete_cb), ...);510 G_CALLBACK(delete_cb), ...);
583#endif511#endif
584 gtk_container_set_border_width (GTK_CONTAINER (window), borderwidth);512 gtk_container_set_border_width(GTK_CONTAINER (window), borderwidth);
585513
586 gtk_container_add(GTK_CONTAINER(window), child);514 gtk_container_add(GTK_CONTAINER(window), child);
587 gtk_window_set_resizable(GTK_WINDOW(window), resizable);515 gtk_window_set_resizable(GTK_WINDOW(window), resizable);
762690
763void clean_data(void)691void clean_data(void)
764{692{
765 clear_store();693 custom_list_clear(W.listmodel);
766 for (unsigned int i = 0; G.prgbuffers[i]; i++) {
767 free(G.prgbuffers[i]); G.prgbuffers[i] = null; }
768 for (unsigned int i = 0; i < sizeof G.prgfd / sizeof G.prgfd[0]; i++)694 for (unsigned int i = 0; i < sizeof G.prgfd / sizeof G.prgfd[0]; i++)
769 if (G.prgfd[i] >= 0) { close(G.prgfd[i]); G.prgfd[i] = -1; }695 if (G.prgfd[i] >= 0) { close(G.prgfd[i]); G.prgfd[i] = -1; }
770 G.previndx = -1;696 G.indx = G.prevabsindx = -1;
771 G.compare[0] = '\0';697 G.compare[0] = '\0';
772 G.channelfilter = 0;698 G.channelfilter = 0;
773 G.maxchannelindex = 0;699 G.maxchannelindex = 0;
774 G.dotextfiltering = false; // XXX see usage here and elsewhere
775}700}
776701
777bool reset_signal(void * inprogress_p)702bool reset_signal(void * inprogress_p)
785 static int inprogress = false;710 static int inprogress = false;
786 (void)uu;711 (void)uu;
787712
788 if (inprogress)713 if (inprogress) // XXX what if reset_signal() never called ??
789 return;714 return;
790715
716 gtk_tree_view_set_model(GTK_TREE_VIEW(W.listview), null);
791 FILE * fh = runhelper("update");717 FILE * fh = runhelper("update");
792 clean_data();718 clean_data();
793 if (fill_store(fh)) {719 if (fill_store(fh)) {
795 g_idle_add(reset_signal, &inprogress);721 g_idle_add(reset_signal, &inprogress);
796 }722 }
797 pclose(fh);723 pclose(fh);
724 gtk_tree_view_set_model(GTK_TREE_VIEW(W.listview),
725 GTK_TREE_MODEL(W.listmodel));
798}726}
799727
800void handle_program(const char * tool)728void handle_program(const char * tool)
808 }736 }
809 d0(("noppeus %s\n", speeds[speed]));737 d0(("noppeus %s\n", speeds[speed]));
810738
811 if (G.previndx < 0) {739 if (G.indx < 0) {
812 ModalMessageDialog("TV-ohjelmaa ei valittu");740 ModalMessageDialog("TV-ohjelmaa ei valittu");
813 return;741 return;
814 }742 }
815743
816 int i = G.previndx / 1000;744 pclose(runhelper("play %s %d %s", tool,
817 int j = G.previndx % 1000;745 custom_list_get_id(W.listmodel, G.indx),
818 746 speeds[speed]));
819 runhelper("play %s %d %s", tool, G.prgbuffers[i][j].id, speeds[speed]);
820}747}
821748
822void play_pressed(void * uu)749void play_pressed(void * uu)
848 //return false;775 //return false;
849 if (strcmp(txt, G.compare) != 0)776 if (strcmp(txt, G.compare) != 0)
850 strcpy(G.compare, txt);777 strcpy(G.compare, txt);
851 G.dotextfiltering = true; // XXX move elsewhere778
852 gtk_tree_model_filter_refilter(W.listfilter);779 refilter_model();
780
853 G.notidle = false;781 G.notidle = false;
854 return false;782 return false;
855}783}