tvkaista-0.964/Makefile tvkaista-0.971/Makefile
18install: tvkaista_gtkui tvkaista_gtkpw18install: tvkaista_gtkui tvkaista_gtkpw
19 sh -n tvkaista.sh && perl -c tvkaista-helper.pl19 sh -n tvkaista.sh && perl -c tvkaista-helper.pl
20 test -d "$$HOME"/.tvkaista || mkdir "$$HOME/".tvkaista20 test -d "$$HOME"/.tvkaista || mkdir "$$HOME/".tvkaista
21 test -d "$$HOME"/.tvkaista/2 || mkdir "$$HOME/".tvkaista/221 test -d "$$HOME"/.tvkaista/3 || mkdir "$$HOME/".tvkaista/3
22 cp tvkaista.sh "$$HOME"/.tvkaista22 cp tvkaista.sh "$$HOME"/.tvkaista
23 cp tvkaista_gtkui "$$HOME"/.tvkaista23 cp tvkaista_gtkui "$$HOME"/.tvkaista
24 cp tvkaista_gtkpw "$$HOME"/.tvkaista24 cp tvkaista_gtkpw "$$HOME"/.tvkaista
48 tar --transform "s|^|tvkaista-$$ver/|" -zcf tvkaista-$$ver.tar.gz \48 tar --transform "s|^|tvkaista-$$ver/|" -zcf tvkaista-$$ver.tar.gz \
49 tvkaista_gtkui.c tvkaista-helper.pl tvkaista.sh \49 tvkaista_gtkui.c tvkaista-helper.pl tvkaista.sh \
50 tvkaista.desktop tvkaista.png logo.pov Makefile gitlog && \50 tvkaista.desktop tvkaista.png logo.pov Makefile gitlog && \
51 echo Created tvkaista-$$ver51 echo Created tvkaista-$$ver.tar.gz
5252
53clean:53clean:
54 rm -f helper.c helper.gz logo.png *~54 rm -f helper.c helper.gz logo.png *~

tvkaista-0.964/gitlog tvkaista-0.971/gitlog
1commit 495967cea795d0323bccacfc7cdbff9555a81799
2Author: Tomi Ollila <too@iki.fi>
3Date: Thu May 7 23:52:21 2009 +0300
4
5 Channel filtering. Message format change (subdir now "3"). Version 0.971
6
7M Makefile
8M tvkaista-helper.pl
9M tvkaista.desktop
10M tvkaista_gtkui.c
11
12commit d3a1016886e1c29177e30a7d4576f9f2cbcfc621
13Author: Tomi Ollila <too@iki.fi>
14Date: Thu May 7 21:23:07 2009 +0300
15
16 some compiler warnings handled.
17
18M tvkaista_gtkui.c
19
20commit 402c0f1c9477a63639d67dae72fc39ff107ddda8
21Author: Tomi Ollila <too@koti.localdomain>
22Date: Thu May 7 19:42:45 2009 +0300
23
24 intial support (list view column header buffon event reading done).
25
26M tvkaista_gtkui.c
27
28commit 81a733ae18cbac52c1778809c196509453d1d8c8
29Author: Tomi Ollila <too@iki.fi>
30Date: Mon May 4 23:49:48 2009 +0300
31
32 Created tvkaista-$$ver.tar.gz
33
34M Makefile
35
1commit 935a04199c509d2a27e52db1ae78b1e44edabff936commit 935a04199c509d2a27e52db1ae78b1e44edabff9
2Author: Tomi Ollila <too@iki.fi>37Author: Tomi Ollila <too@iki.fi>
3Date: Mon May 4 23:08:17 2009 +030038Date: Mon May 4 23:08:17 2009 +0300

tvkaista-0.964/tvkaista-helper.pl tvkaista-0.971/tvkaista-helper.pl
4# Author: Tomi Ollila -- too ät iki piste fi4# Author: Tomi Ollila -- too ät iki piste fi
5#5#
6# Created: Sat Feb 07 21:29:53 EET 2009 too6# Created: Sat Feb 07 21:29:53 EET 2009 too
7# Last modified: Mon 04 May 2009 21:40:38 EEST too7# Last modified: Thu 07 May 2009 23:26:25 EEST too
88
9#PERL_UNICODE=SD perl tvkaista-helper.pl 1 update9#PERL_UNICODE=SD perl tvkaista-helper.pl 1 update
10#or perl -CSD perl tvkaista-helper.pl 1 list10#or perl -CSD perl tvkaista-helper.pl 1 list
22die "Unicode settings not OK\n" unless (${^UNICODE} & 0x1f) == 0x1f;22die "Unicode settings not OK\n" unless (${^UNICODE} & 0x1f) == 0x1f;
2323
24die "Cache directory missing. probably incomplete installation\n"24die "Cache directory missing. probably incomplete installation\n"
25 unless -d 2;25 unless -d 3;
2626
27sub usage()27sub usage()
28{28{
49}49}
50getdatetime;50getdatetime;
5151
52unless (-d "2/logs.$date") {52unless (-d "3/logs.$date") {
53 mkdir "2/logs.$date";53 mkdir "3/logs.$date";
54 unlink '2/today';54 unlink '3/today';
55 symlink "logs.$date", '2/today';55 symlink "logs.$date", '3/today';
56}56}
5757
58my ($username, $password, $b64cred) = ('', '', '');58my ($username, $password, $b64cred) = ('', '', '');
87 print "\n";87 print "\n";
88 system 'stty', 'echo';88 system 'stty', 'echo';
89 }89 }
90 open O, '>', '2/tunnus' or die $!;90 open O, '>', '3/tunnus' or die $!;
91 print O "tunnus = $username\nsalasana = $password\n";91 print O "tunnus = $username\nsalasana = $password\n";
92 close O;92 close O;
93 $b64cred = encode_base64 "$username:$password", '';93 $b64cred = encode_base64 "$username:$password", '';
144my @programs;144my @programs;
145sub fillprograms()145sub fillprograms()
146{146{
147 my ($chnl, $title, $secs, $desc, $id) = ('', '', '');147 my ($chnl, $chnlnr, $title, $secs, $desc, $id) = ('', 0, '', '', '', '');
148 while (<I>) {148 while (<I>) {
149 $title = strdecode $1 if /<title>(.*)<\/title>/;149 $title = strdecode $1 if /<title>(.*)<\/title>/;
150 $secs = secsof $1 if /<pubDate>(.*)<\/pubDate>/;150 $secs = secsof $1 if /<pubDate>(.*)<\/pubDate>/;
153153
154 if ( /<ttl>/ ) {154 if ( /<ttl>/ ) {
155 $desc =~ /channel:\s*(.*)/;155 $desc =~ /channel:\s*(.*)/;
156 $chnl = $1; $chnl =~ tr/ /_/;156 $chnl = $1; $chnl =~ tr/ /_/; $chnlnr++; # XXX hash instead!
157 ($title, $secs, $desc, $id) = ('','','','');157 ($title, $secs, $desc, $id) = ('','','','');
158 next;158 next;
159 }159 }
160160
161 if ( /<\/item>/ ) {161 if ( /<\/item>/ ) {
162 push @programs, [ $secs, $chnl, $title, $desc, $id ] if length $id;162 push @programs, [ $secs, $chnlnr, $chnl, $title, $desc, $id ]
163 if length $id;
163 ($title, $secs, $desc, $id) = ('','','','');164 ($title, $secs, $desc, $id) = ('','','','');
164 }165 }
165 }166 }
167168
168sub update ()169sub update ()
169{170{
170 feedwget "2/today/channels-$time.rss", 'http://www.tvkaista.fi/feed/';171 feedwget "3/today/channels-$time.rss", 'http://www.tvkaista.fi/feed/';
171 return 0 if -z "2/today/channels-$time.rss";172 return 0 if -z "3/today/channels-$time.rss";
172 open I, '<', "2/today/channels-$time.rss" or die $!;173 open I, '<', "3/today/channels-$time.rss" or die $!;
173 my (@channels, $linktail, $c);174 my (@channels, $linktail, $c);
174 while (<I>) { last if /<ttl>/; }175 while (<I>) { last if /<ttl>/; }
175 while (<I>) {176 while (<I>) {
184 push @urls, "http://www.tvkaista.fi/feed/channels/$_/flv.rss"185 push @urls, "http://www.tvkaista.fi/feed/channels/$_/flv.rss"
185 foreach (@channels);186 foreach (@channels);
186187
187 feedwget "2/today/a-$time-now.rss", @urls;188 feedwget "3/today/a-$time-now.rss", @urls;
188189
189 open I, '<', "2/today/a-$time-now.rss" or die $!;190 open I, '<', "3/today/a-$time-now.rss" or die $!;
190 fillprograms;191 fillprograms;
191 close I;192 close I;
192193
194 my @sorted = sort { $a->[0] <=> $b->[0] } @programs;195 my @sorted = sort { $a->[0] <=> $b->[0] } @programs;
195 @programs = ();196 @programs = ();
196 my @di = dateinfo $daysecs;197 my @di = dateinfo $daysecs;
197 my $outputfile = sprintf("2/program_%d-%02d-%02d",198 my $outputfile = sprintf("3/program_%d-%02d-%02d",
198 $di[4] + 1900, $di[3] + 1, $di[2]);199 $di[4] + 1900, $di[3] + 1, $di[2]);
199200
200 open O, '>', $outputfile or die $!;201 open O, '>', $outputfile or die $!;
204 @di = dateinfo $_->[0];205 @di = dateinfo $_->[0];
205 if ($fnd && $di[0] ge "0500") {206 if ($fnd && $di[0] ge "0500") {
206 close O;207 close O;
207 open O, '>', sprintf("2/program_%d-%02d-%02d",208 open O, '>', sprintf("3/program_%d-%02d-%02d",
208 $di[4] + 1900, $di[3] + 1, $di[2]) or die $!;209 $di[4] + 1900, $di[3] + 1, $di[2]) or die $!;
209 $fnd = 0;210 $fnd = 0;
210 $pday = '';211 $pday = '';
216 $fnd = 1 if (length $pday);217 $fnd = 1 if (length $pday);
217 $pday = $di[1];218 $pday = $di[1];
218 }219 }
219 print O "$_->[4] $di[0] $_->[1] $_->[2]\n";220 print O "$_->[5] $di[0] $_->[1] $_->[2] $_->[3]\n";
220 print O "\\ $_->[3]\n" if length $_->[3];221 print O "\\ $_->[4]\n" if length $_->[4];
221 }222 }
222 close O;223 close O;
223224
226 @urls = ();227 @urls = ();
227 @di = dateinfo $daysecs; $di[4] += 1900; $di[3]++;228 @di = dateinfo $daysecs; $di[4] += 1900; $di[3]++;
228229
229 $outputfile = sprintf("2/program_%d-%02d-%02d",$di[4],$di[3],$di[2]);230 $outputfile = sprintf("3/program_%d-%02d-%02d",$di[4],$di[3],$di[2]);
230 my @fst = stat $outputfile;231 my @fst = stat $outputfile;
231 next if (defined $fst[9] &&$fst[9] > $daysecs); # recent enough.232 next if (defined $fst[9] &&$fst[9] > $daysecs); # recent enough.
232233
234 . "/channels/$_/flv.rss" foreach (@channels);235 . "/channels/$_/flv.rss" foreach (@channels);
235236
236 getdatetime;237 getdatetime;
237 feedwget "2/today/a-$di[3]-$di[2]-$time.rss", @urls;238 feedwget "3/today/a-$di[3]-$di[2]-$time.rss", @urls;
238 last WHILE unless -s "2/today/a-$di[3]-$di[2]-$time.rss";239 last WHILE unless -s "3/today/a-$di[3]-$di[2]-$time.rss";
239240
240 open I, '<', "2/today/a-$di[3]-$di[2]-$time.rss" or die $!;241 open I, '<', "3/today/a-$di[3]-$di[2]-$time.rss" or die $!;
241 fillprograms;242 fillprograms;
242 close I;243 close I;
243244
253 qw(Su Ma Ti Ke To Pe La)[$di[1]], $di[2], $di[3] + 1;254 qw(Su Ma Ti Ke To Pe La)[$di[1]], $di[2], $di[3] + 1;
254 $pday = $di[1];255 $pday = $di[1];
255 }256 }
256 print O "$_->[4] $di[0] $_->[1] $_->[2]\n";257 print O "$_->[5] $di[0] $_->[1] $_->[2] $_->[3]\n";
257 print O "\\ $_->[3]\n" if length $_->[3];258 print O "\\ $_->[4]\n" if length $_->[4];
258 }259 }
259 close O;260 close O;
260 }261 }
266{267{
267 mkpw 1 if ($username eq '' or $password eq '');268 mkpw 1 if ($username eq '' or $password eq '');
268 getdatetime;269 getdatetime;
269 recwget "2/today/login-$time.html", 'http://www.tvkaista.fi/netpvr/Login',270 recwget "3/today/login-$time.html", 'http://www.tvkaista.fi/netpvr/Login',
270 '--save-cookies', "2/cookies-$date-$time.txt", '--keep-session-cookies',271 '--save-cookies', "3/cookies-$date-$time.txt", '--keep-session-cookies',
271 '--max-redirect=0',272 '--max-redirect=0',
272 '--post-data',273 '--post-data',
273 "action=login&username=$username&password=$password&rememberme=on";274 "action=login&username=$username&password=$password&rememberme=on";
274 unlink '2/cookies.txt';275 unlink '3/cookies.txt';
275 symlink "cookies-$date-$time.txt", '2/cookies.txt';276 symlink "cookies-$date-$time.txt", '3/cookies.txt';
276277
277 return -z "2/today/login-$time.html";278 return -z "3/today/login-$time.html";
278}279}
279280
280sub getpw ()281sub getpw ()
281{282{
282 if (-f '2/tunnus') {283 if (-f '3/tunnus') {
283 open I, '<', '2/tunnus';284 open I, '<', '3/tunnus';
284 while (<I>) {285 while (<I>) {
285 $username = $1 if /^\s*tunnus\s*=\s*(\S+)/;286 $username = $1 if /^\s*tunnus\s*=\s*(\S+)/;
286 $password = $1 if /^\s*salasana\s*=\s*(\S+)/;287 $password = $1 if /^\s*salasana\s*=\s*(\S+)/;
301 my $tof = "$recdir/$_[0].srt";302 my $tof = "$recdir/$_[0].srt";
302303
303 recwget $tof, "http://www.tvkaista.fi/netpvr/Download/$_[0].srt",304 recwget $tof, "http://www.tvkaista.fi/netpvr/Download/$_[0].srt",
304 '--load-cookies', '2/cookies.txt';305 '--load-cookies', '3/cookies.txt';
305306
306 open I, '<', $tof or return ( $_[0], 0 );307 open I, '<', $tof or return ( $_[0], 0 );
307308
329330
330 getpw;331 getpw;
331332
332 my $pagename = "2/today/play-$time.html";333 my $pagename = "3/today/play-$time.html";
333334
334 my $format = $speeds{$ARGV[3]};335 my $format = $speeds{$ARGV[3]};
335 recwget $pagename,336 recwget $pagename,
336 "http://www.tvkaista.fi/netpvr/VLC?id=$ARGV[2]&format=$format",337 "http://www.tvkaista.fi/netpvr/VLC?id=$ARGV[2]&format=$format",
337 '--load-cookies', '2/cookies.txt';338 '--load-cookies', '3/cookies.txt';
338339
339 open I, '<', $pagename or die "Can not open '$pagename': $!\n";340 open I, '<', $pagename or die "Can not open '$pagename': $!\n";
340 my $url;341 my $url;
347 die "No content found!\n";348 die "No content found!\n";
348 }349 }
349350
350 my ($namepfx, $srtflen) = getsrt($ARGV[2], $ARGV[1]);351 my ($namepfx, $srtflen) = getsrt($ARGV[3], $ARGV[1]);
351 chdir $recdir;352 chdir $recdir;
352353
353 my @list = ( $ARGV[1] );354 my @list = ( $ARGV[1] );
408# "list" (and "update" too)409# "list" (and "update" too)
409select STDOUT;410select STDOUT;
410411
411my @prgfiles = <2/program_*[0-9]>;412my @prgfiles = <3/program_*[0-9]>;
412unlink shift @prgfiles while defined $prgfiles[15];413unlink shift @prgfiles while defined $prgfiles[15];
413foreach (@prgfiles)414foreach (@prgfiles)
414{415{

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

tvkaista-0.964/tvkaista_gtkui.c tvkaista-0.971/tvkaista_gtkui.c
26 * Last modified: su 26. huhtikuuta 2009 18.39.07 too26 * Last modified: su 26. huhtikuuta 2009 18.39.07 too
27 */27 */
2828
29/* thanks to gtk parasite (use internet search engine to find)
30 * for figuring out some stuff. fetch, compile and then
31 * execute 'GTK_MODULES=/path/to/gtpkarasite prog [args]'
32 *
33 * Example execution after gtkparasite build (without install):
34 * GTK_MODULES=`pwd`/src/.libs/libgtkparasite.so tvkaista.sh gui
35 */
36
29#define _GNU_SOURCE 1 // strcasestr() at least (in string.h).37#define _GNU_SOURCE 1 // strcasestr() at least (in string.h).
3038
31#include <gtk/gtk.h>39#include <gtk/gtk.h>
95typedef struct103typedef struct
96{104{
97 int id;105 int id;
106 int16_t channelindex;
98 int txtfileindex;107 int16_t txtfileindex;
99 int txtoffset;108 int txtoffset;
100} PrgInfo;109} PrgInfo;
101110
103#define MAXSEARCHLEN 30112#define MAXSEARCHLEN 30
104struct113struct
105{114{
115 int channelfilter;
116 int16_t maxchannelindex;
106 bool8 dofilter;117 bool8 dotextfiltering;
107 bool8 notidle;118 bool8 notidle;
108 char * path;119 char * path;
109 char compare[MAXSEARCHLEN + 2];120 char compare[MAXSEARCHLEN + 2];
155 return popen(cmdline, "r");166 return popen(cmdline, "r");
156}167}
157168
158bool visible_rows(GtkTreeModel * model, GtkTreeIter * iter, gpointer data)
159{
160 (void)data;
161 if (! G.dofilter)
162 return true;
163
164 gchar * str;
165 gtk_tree_model_get (model, iter, 3, &str, -1);
166 if (!str)
167 return false;
168 gboolean visible = (strcasestr(str, G.compare) != null);
169 g_free(str);
170 return visible;
171}
172
173enum169enum
174{170{
175 COL_DATE = 0,171 COL_DATE = 0,
179 COL_HIDDEN_INDEX,175 COL_HIDDEN_INDEX,
180 NUM_COLS176 NUM_COLS
181};177};
178
179bool visible_rows(GtkTreeModel * model, GtkTreeIter * iter, gpointer data)
180{
181 (void)data;
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}
182203
183bool selected_row(GtkTreeSelection * selection,204bool selected_row(GtkTreeSelection * selection,
184 GtkTreeModel * model, GtkTreePath * path,205 GtkTreeModel * model, GtkTreePath * path,
311 int offset = 0;332 int offset = 0;
312 int indx = 0;333 int indx = 0;
313 int prgdayindex = 0;334 int prgdayindex = 0;
335 int channelindex = 0;
314 char day[10];336 char day[10];
315 char hourmin[8];337 char hourmin[8];
316 char channel[16];338 char channel[16];
318340
319 while (!feof(fh))341 while (!feof(fh))
320 {342 {
321 char * ptrs[4];343 char * ptrs[5];
322 char * p;344 char * p;
323 if (fgets(line, sizeof line, fh) == null)345 if (fgets(line, sizeof line, fh) == null)
324 die("fgets():");346 die("fgets():");
338 prgdayindex, G.prgfile[prgdayindex], day));360 prgdayindex, G.prgfile[prgdayindex], day));
339 continue;361 continue;
340 case 'I':362 case 'I':
341 splitstring(line + 2, ptrs, 4);363 splitstring(line + 2, ptrs, 5);
342 id = atoi(ptrs[0]);364 id = atoi(ptrs[0]);
343 xstrlcpy(hourmin, ptrs[1], sizeof hourmin);365 xstrlcpy(hourmin, ptrs[1], sizeof hourmin);
366 channelindex = atoi(ptrs[2]);
344 if (strcmp(ptrs[2], "Urheilukanava") == 0)367 if (strcmp(ptrs[3], "Urheilukanava") == 0)
345 strcpy(channel, "Urheilukan.");368 strcpy(channel, "Urheilukan.");
346 else369 else
347 xstrlcpy(channel, ptrs[2], sizeof channel);370 xstrlcpy(channel, ptrs[3], sizeof channel);
348 p = channel; while ((p = strchr(p, '_')) != null) *p = ' ';371 p = channel; while ((p = strchr(p, '_')) != null) *p = ' ';
349 xstrlcpy(shortinfo, ptrs[3], sizeof shortinfo);372 xstrlcpy(shortinfo, ptrs[4], sizeof shortinfo);
350 d0(("I | %d | %s | %s | %s\n",373 d0(("I | %d | %s | %s | %s\n",
351 id, hourmin, channel, shortinfo));374 id, hourmin, channel, shortinfo));
352 continue;375 continue;
376 }399 }
377400
378 G.prgbuffers[i][j].id = id;401 G.prgbuffers[i][j].id = id;
402 G.prgbuffers[i][j].channelindex = channelindex;
379 G.prgbuffers[i][j].txtfileindex = prgdayindex;403 G.prgbuffers[i][j].txtfileindex = prgdayindex;
380 G.prgbuffers[i][j].txtoffset = offset;404 G.prgbuffers[i][j].txtoffset = offset;
405
406 if (channelindex > G.maxchannelindex)
407 G.maxchannelindex = channelindex;
381408
382 /*fputs(line, stdout); */409 /*fputs(line, stdout); */
383 gtk_list_store_append(liststore, &iter);410 gtk_list_store_append(liststore, &iter);
394 return false;421 return false;
395}422}
396423
424void day_clicked(int promille)
425{
426 printf("day_clicked(%d) (no action, yet)\n", promille);
427}
428
429void time_clicked(int promille)
430{
431 printf("time_clicked(%d) (no action, yet)\n", promille);
432}
433
434void channel_clicked(int promille)
435{
436 printf("channel_clicked(%d)\n", promille);
437
438 if (promille < 300) {
439 if (G.channelfilter <= 1)
440 G.channelfilter = G.maxchannelindex;
441 else
442 G.channelfilter--;
443 }
444 else if (promille > 600) {
445 if (G.channelfilter == G.maxchannelindex)
446 G.channelfilter = 1;
447 else
448 G.channelfilter++;
449 }
450 else
451 G.channelfilter = 0;
452 gtk_tree_model_filter_refilter(W.listfilter);
453 G.notidle = false;
454}
455
456// ISO C forbids passing argument 4 of 'g_signal_connect_data'
457// between function pointer and 'void *'
458// therefore:
459// (every computer problem can be solved by another level of indirection)
460
461struct colhdr_cb {
462 void (*func)(int);
463} colhdr_cbs[3] = {
464 { day_clicked },
465 { time_clicked },
466 { channel_clicked }
467};
468
469void colhdr_clicked(GtkTreeViewColumn * col, struct colhdr_cb * colhdr_cb)
470{
471 int x, y, w;
472
473 //gtk_tree_view_column_cell_get_size (col, null, &x, &y, &w, &h);
474 w = gtk_tree_view_column_get_width(col);
475 gtk_widget_get_pointer(col->button, &x, &y);
476
477 // printf("pointer: x = %d, y = %d. width: %d, %d/1000\n",x,y,w,x*1000/w);
478
479 colhdr_cb->func(x * 1000 / w);
480
481 //printf("pointer: x = %d, y = %d\n", x, y);
482 //printf("xxx: x = %d, y = %d, w = %d, h = %d\n", x,y,w,h);
483}
397484
398static GtkWidget *485static GtkWidget *
399create_view_and_model (void)486create_view_and_model (void)
406 GtkTreeSelection * selection;493 GtkTreeSelection * selection;
407494
408 int i;495 int i;
409 const char * colname[] = { "päivä", "kello", "kanava", "ohjelma" };496 const char * colname[] = { "<päivä>", "<klo>", "<kanava>", "ohjelma" };
410497
411 view = gtk_tree_view_new();498 view = gtk_tree_view_new();
412499
421 col = gtk_tree_view_column_new();508 col = gtk_tree_view_column_new();
422509
423 gtk_tree_view_column_set_title(col, colname[i]);510 gtk_tree_view_column_set_title(col, colname[i]);
511 if (i < 3) {
512 gtk_tree_view_column_set_clickable(col, true);
513 g_signal_connect(G_OBJECT(col), "clicked",
514 G_CALLBACK(colhdr_clicked),(void*)&colhdr_cbs[i]);
515 }
424516
425 /* pack tree view column into tree view */517 /* pack tree view column into tree view */
426 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);518 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
677 if (G.prgfd[i] >= 0) { close(G.prgfd[i]); G.prgfd[i] = -1; }769 if (G.prgfd[i] >= 0) { close(G.prgfd[i]); G.prgfd[i] = -1; }
678 G.previndx = -1;770 G.previndx = -1;
679 G.compare[0] = '\0';771 G.compare[0] = '\0';
772 G.channelfilter = 0;
773 G.maxchannelindex = 0;
680 G.dofilter = false; // XXX see usage here and elsewhere774 G.dotextfiltering = false; // XXX see usage here and elsewhere
681}775}
682776
683bool reset_signal(void * inprogress_p)777bool reset_signal(void * inprogress_p)
754 //return false;848 //return false;
755 if (strcmp(txt, G.compare) != 0)849 if (strcmp(txt, G.compare) != 0)
756 strcpy(G.compare, txt);850 strcpy(G.compare, txt);
757 G.dofilter = true; // XXX move elsewhere851 G.dotextfiltering = true; // XXX move elsewhere
758 gtk_tree_model_filter_refilter(W.listfilter);852 gtk_tree_model_filter_refilter(W.listfilter);
759 G.notidle = false;853 G.notidle = false;
760 return false;854 return false;
807901
808 //g_signal_connect(e, "insert-at-cursor", entry_changed, null);902 //g_signal_connect(e, "insert-at-cursor", entry_changed, null);
809903
810 gtk_window_set_icon_from_file(W.w, "tvkaista.png", null);904 gtk_window_set_icon_from_file(GTK_WINDOW(W.w), "tvkaista.png", null);
811905
812#if 0906#if 0
813 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);907 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);