| tvkaista-0.981/tvkaista_gtkui.c | | tvkaista-0.982/tvkaista_gtkui.c |
| 55 | | 55 | |
| 56 | #include "custom-list.h" | 56 | #include "custom-list.h" |
| 57 | | 57 | |
| 58 | #define null ((void*)0) | | |
| 59 | | | |
| 60 | enum { false = 0, true = 1 } bool; | | |
| 61 | #define bool int // hmm | | |
| 62 | #define bool8 char | | |
| 63 | | | |
| 64 | #if (__GNUC__ >= 4) | 58 | #if (__GNUC__ >= 4) |
| 65 | #define GCCATTR_SENTINEL __attribute__ ((sentinel)) | 59 | #define GCCATTR_SENTINEL __attribute__ ((sentinel)) |
| 66 | #else | 60 | #else |
| 125 | int refindx; | 119 | int refindx; |
| 126 | char daytime[8]; | 120 | char daytime[8]; |
| 127 | bool (*childexit_cb)(void); | 121 | bool (*childexit_cb)(void); |
| | 122 | /* favorites window */ |
| | 123 | bool8 fav_open; |
| | 124 | int8_t fav_window; |
| | 125 | char * fav_text; |
| 128 | } G; | 126 | } G; |
| 129 | | 127 | |
| 130 | /* widgets in separate structure, for code readability */ | 128 | /* widgets in separate structure, for code readability */ |
| 133 | GtkWidget * w; /* main toplevel window */ | 131 | GtkWidget * w; /* main toplevel window */ |
| 134 | GtkWidget * scb; /* speed combo box */ | 132 | GtkWidget * scb; /* speed combo box */ |
| 135 | GtkWidget * pcb; /* player combo box */ | 133 | GtkWidget * pcb; /* player combo box */ |
| | 134 | GtkWidget * fcb; /* favorites combo box */ |
| | 135 | GtkWidget * ste; /* search text entry */ |
| 136 | GtkTextBuffer * txtbuffer; /* detailed program text */ | 136 | GtkTextBuffer * txtbuffer; /* detailed program text */ |
| 137 | GtkWidget * listview; | 137 | GtkWidget * listview; |
| 138 | CustomList * listmodel; | 138 | CustomList * listmodel; |
| | 139 | // favorites widgets |
| | 140 | GtkWindow * fw; |
| | 141 | GtkTextBuffer * ftxtbuf; |
| 139 | } W; | 142 | } W; |
| 140 | | 143 | |
| 141 | // XXX make better later... | 144 | // XXX make better later... |
| 288 | g_idle_add(idle_set_refindx, null); | 291 | g_idle_add(idle_set_refindx, null); |
| 289 | } | 292 | } |
| 290 | | 293 | |
| | 294 | static bool filter_nofilter(CustomRecord * record, void * data) |
| | 295 | { |
| | 296 | (void)record; (void)data; |
| | 297 | return true; |
| | 298 | } |
| | 299 | |
| | 300 | static bool filter_by_search(CustomRecord * record, void * data) |
| | 301 | { |
| | 302 | (void)data; |
| | 303 | if (G.channelfilter && G.channelfilter != record->channelindex) |
| | 304 | return false; |
| | 305 | // XXX deliver G.compare as data, null if empty -- later. |
| | 306 | if (strcasestr(record->program, G.compare) == null) |
| | 307 | return false; |
| | 308 | return true; |
| | 309 | } |
| | 310 | |
| | 311 | typedef struct { |
| | 312 | const char * str; |
| | 313 | int len; |
| | 314 | } LStr; |
| | 315 | |
| | 316 | static bool filter_by_favorites(CustomRecord * record, void * data) |
| | 317 | { |
| | 318 | LStr * lines = (LStr *)data; |
| | 319 | if (G.channelfilter && G.channelfilter != record->channelindex) |
| | 320 | return false; |
| | 321 | int plen = strlen(record->program); |
| | 322 | int i; |
| | 323 | for (i = 0; lines[i].str; i++) |
| | 324 | { |
| | 325 | // memmem is GNU extension, although easy to implement on need. |
| | 326 | if (memmem(record->program, plen, lines[i].str, lines[i].len)) |
| | 327 | return true; |
| | 328 | } |
| | 329 | return false; |
| | 330 | } |
| | 331 | |
| | 332 | |
| | 333 | void do_filtering(void) |
| | 334 | { |
| | 335 | if (G.fav_window == 0) { |
| | 336 | custom_list_filter(W.listmodel, filter_by_search, null); |
| | 337 | return; |
| | 338 | } |
| | 339 | if (G.fav_text == null) { |
| | 340 | custom_list_filter(W.listmodel, filter_nofilter, null); |
| | 341 | return; |
| | 342 | } |
| | 343 | |
| | 344 | LStr lines[128]; |
| | 345 | int i = 0; |
| | 346 | char * p = G.fav_text; |
| | 347 | |
| | 348 | while (1) { |
| | 349 | char * q = p; |
| | 350 | // ignore whitespace-only lines |
| | 351 | while (isspace(*q)) { |
| | 352 | if (*q == '\n') |
| | 353 | p = q + 1; |
| | 354 | q++; |
| | 355 | } |
| | 356 | // last line only whitespace |
| | 357 | if (*q == '\0') |
| | 358 | break; |
| | 359 | while (*q != '\n' && *q != '\0') |
| | 360 | q++; |
| | 361 | if (q == '\0') { |
| | 362 | if (p != q) { |
| | 363 | lines[i].str = p; |
| | 364 | lines[i].len = q - p; |
| | 365 | i++; |
| | 366 | } |
| | 367 | break; |
| | 368 | } |
| | 369 | if (p == q) { |
| | 370 | p++; |
| | 371 | continue; |
| | 372 | } |
| | 373 | lines[i].str = p; |
| | 374 | lines[i].len = q - p; |
| | 375 | i++; |
| | 376 | if (i == (sizeof lines / sizeof lines[0]) - 1) |
| | 377 | break; |
| | 378 | p = q + 1; |
| | 379 | } |
| | 380 | lines[i].str = null; |
| | 381 | |
| | 382 | if (i) |
| | 383 | custom_list_filter(W.listmodel, filter_by_favorites, &lines); |
| | 384 | else |
| | 385 | custom_list_filter(W.listmodel, filter_nofilter, null); |
| | 386 | } |
| | 387 | |
| 291 | void refilter_model(void) | 388 | void refilter_model(void) |
| 292 | { | 389 | { |
| 293 | int f, l; | 390 | int f, l; |
| 304 | struct timeval st, et; | 401 | struct timeval st, et; |
| 305 | gettimeofday(&st, null); | 402 | gettimeofday(&st, null); |
| 306 | #endif | 403 | #endif |
| 307 | custom_list_filter(W.listmodel, G.channelfilter, G.compare); | 404 | do_filtering(); |
| 308 | #if DBG0 | 405 | #if DBG0 |
| 309 | gettimeofday(&et, null); | 406 | gettimeofday(&et, null); |
| 310 | printf("filter time: %.3f\n", (float)(et.tv_sec - st.tv_sec) * 1000 | 407 | printf("filter time: %.3f\n", (float)(et.tv_sec - st.tv_sec) * 1000 |
| 469 | case 'X': | 566 | case 'X': |
| 470 | break; | 567 | break; |
| 471 | case 'Q': | 568 | case 'Q': |
| 472 | custom_list_full(W.listmodel, G.channelfilter, G.compare); | 569 | custom_list_full(W.listmodel); |
| | 570 | do_filtering(); |
| 473 | return true; | 571 | return true; |
| 474 | default: | 572 | default: |
| 475 | fprintf(stderr, "Unknown line: '%s'\n", line); | 573 | fprintf(stderr, "Unknown line: '%s'\n", line); |
| 488 | id = -1; | 586 | id = -1; |
| 489 | offset = 0; | 587 | offset = 0; |
| 490 | } | 588 | } |
| 491 | custom_list_full(W.listmodel, G.channelfilter, G.compare); | 589 | custom_list_full(W.listmodel); |
| | 590 | do_filtering(); |
| 492 | return false; | 591 | return false; |
| 493 | } | 592 | } |
| 494 | | 593 | |
| 583 | else | 682 | else |
| 584 | G.channelfilter = 0; | 683 | G.channelfilter = 0; |
| 585 | refilter_model(); | 684 | refilter_model(); |
| 586 | G.notidle = false; | | |
| 587 | } | 685 | } |
| 588 | | 686 | |
| 589 | // ISO C forbids passing argument 4 of 'g_signal_connect_data' | 687 | // ISO C forbids passing argument 4 of 'g_signal_connect_data' |
| 845 | return w; | 943 | return w; |
| 846 | } | 944 | } |
| 847 | | 945 | |
| 848 | GtkWidget * aTextView(GtkTextBuffer * child) | 946 | GtkWidget * aTextView(GtkTextBuffer * child, bool editable) |
| 849 | { | 947 | { |
| 850 | GtkWidget * textview | 948 | GtkWidget * textview |
| 851 | = gtk_text_view_new_with_buffer(GTK_TEXT_BUFFER(child)); | 949 | = gtk_text_view_new_with_buffer(GTK_TEXT_BUFFER(child)); |
| 854 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 3); | 952 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(textview), 3); |
| 855 | gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(textview), 2); | 953 | gtk_text_view_set_pixels_above_lines(GTK_TEXT_VIEW(textview), 2); |
| 856 | gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(textview), 2); | 954 | gtk_text_view_set_pixels_below_lines(GTK_TEXT_VIEW(textview), 2); |
| 857 | gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), false); | 955 | gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), editable); |
| 858 | gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_CHAR); | 956 | gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD); |
| 859 | /* gtk_widget_set_size_request(textview, 500, 250); */ | 957 | /* gtk_widget_set_size_request(textview, 500, 250); */ |
| 860 | | 958 | |
| 861 | return textview; | 959 | return textview; |
| 887 | | 985 | |
| 888 | const char * speeds[] = { "300k", "1M", "2M", "8M" }; | 986 | const char * speeds[] = { "300k", "1M", "2M", "8M" }; |
| 889 | const char nspeeds = sizeof speeds / sizeof speeds[0]; | 987 | const char nspeeds = sizeof speeds / sizeof speeds[0]; |
| | 988 | |
| | 989 | const char * favorites[] = { "haku", "oma1", "oma2", "oma3", "oma4" }; |
| | 990 | const char nfavorites = sizeof favorites / sizeof favorites[0]; |
| | 991 | |
| 890 | | 992 | |
| 891 | /* XXX combine with init_G */ | 993 | /* XXX combine with init_G */ |
| 892 | void clean_data(void) | 994 | void clean_data(void) |
| 1004 | | 1106 | |
| 1005 | bool entry_key_pressed(GtkEntry * e) | 1107 | bool entry_key_pressed(GtkEntry * e) |
| 1006 | { | 1108 | { |
| 1007 | if (! G.notidle) { | 1109 | if (! G.notidle && G.fav_window == 0) { |
| 1008 | G.notidle = true; | 1110 | G.notidle = true; |
| 1009 | g_idle_add(entry_changed, e); | 1111 | g_idle_add(entry_changed, e); |
| 1010 | } | 1112 | } |
| 1011 | return false; | 1113 | return false; |
| 1012 | } | 1114 | } |
| 1013 | | 1115 | |
| | 1116 | char * xmalloc(int len) |
| | 1117 | { |
| | 1118 | char * buf = (char *)malloc(len); |
| | 1119 | if (buf == null) |
| | 1120 | die("Out of Memory!"); |
| | 1121 | return buf; |
| | 1122 | } |
| | 1123 | |
| | 1124 | /* ********************** text read/write ******************* */ |
| | 1125 | |
| | 1126 | char * read_textfile(const char * filename) |
| | 1127 | { |
| | 1128 | int fd = open(filename, O_RDONLY); |
| | 1129 | if (fd < 0) { |
| | 1130 | char * txtbuf = xmalloc(1); |
| | 1131 | txtbuf[0] = 0; |
| | 1132 | return txtbuf; |
| | 1133 | } |
| | 1134 | struct stat st; |
| | 1135 | if (fstat(fd, &st) < 0) |
| | 1136 | die("fstat() failed:"); |
| | 1137 | if (st.st_size > 1024) |
| | 1138 | st.st_size = 1024; // XXX |
| | 1139 | char * textbuf = xmalloc(st.st_size + 1); |
| | 1140 | if (read(fd, textbuf, st.st_size) != st.st_size) |
| | 1141 | die("read could not read full buf:"); // XXX but should be safe |
| | 1142 | textbuf[st.st_size] = '\0'; |
| | 1143 | close(fd); |
| | 1144 | return textbuf; |
| | 1145 | } |
| | 1146 | |
| | 1147 | void write_textfile(const char * filename, const char * text) |
| | 1148 | { |
| | 1149 | int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0644); |
| | 1150 | int l = strlen(text) - 1; |
| | 1151 | while (l >= 0 && isspace(text[l])) |
| | 1152 | l--; |
| | 1153 | if (l < 0) { |
| | 1154 | unlink(filename); |
| | 1155 | return; |
| | 1156 | } |
| | 1157 | l++; |
| | 1158 | if (fd < 0) |
| | 1159 | die("open() failed:"); |
| | 1160 | if (write(fd, text, l) != l) |
| | 1161 | die("write() failed:"); |
| | 1162 | close(fd); |
| | 1163 | } |
| | 1164 | |
| | 1165 | char * textbuffer_get_text(GtkTextBuffer * tb) |
| | 1166 | { |
| | 1167 | GtkTextIter start, end; |
| | 1168 | |
| | 1169 | gtk_text_buffer_get_start_iter(tb, &start); |
| | 1170 | gtk_text_buffer_get_end_iter(tb, &end); |
| | 1171 | |
| | 1172 | return gtk_text_buffer_get_text(tb, &start, &end, false); |
| | 1173 | } |
| | 1174 | |
| | 1175 | /* ********************** favorites window code ******************* */ |
| | 1176 | |
| | 1177 | char * favorites_filename(int i) |
| | 1178 | { |
| | 1179 | static char filename[20]; |
| | 1180 | sprintf(filename, "suosikit.%d", i); |
| | 1181 | return filename; |
| | 1182 | } |
| | 1183 | |
| | 1184 | void save_fav_content(void) |
| | 1185 | { |
| | 1186 | if (G.fav_window == 0) |
| | 1187 | return; |
| | 1188 | |
| | 1189 | char * fw_text = textbuffer_get_text(W.ftxtbuf); |
| | 1190 | |
| | 1191 | if (fw_text == null) { |
| | 1192 | write_textfile(favorites_filename(G.fav_window), ""); |
| | 1193 | return; |
| | 1194 | } |
| | 1195 | if (G.fav_text == null || strcmp(fw_text, G.fav_text) != 0) { |
| | 1196 | write_textfile(favorites_filename(G.fav_window), fw_text); |
| | 1197 | free(G.fav_text); |
| | 1198 | G.fav_text = fw_text; |
| | 1199 | } |
| | 1200 | else |
| | 1201 | free(fw_text); |
| | 1202 | } |
| | 1203 | |
| | 1204 | |
| | 1205 | bool do_hide_fav_window(void) |
| | 1206 | { |
| | 1207 | save_fav_content(); |
| | 1208 | gtk_widget_hide(GTK_WIDGET(W.fw)); |
| | 1209 | G.fav_open = false; |
| | 1210 | } |
| | 1211 | |
| | 1212 | // event_... or ..._cb or... and rename above ? |
| | 1213 | bool hide_fav_window(void * w, void * e, void * d) |
| | 1214 | { |
| | 1215 | (void)w; (void)e; (void)d; |
| | 1216 | do_hide_fav_window(); |
| | 1217 | refilter_model(); |
| | 1218 | return true; |
| | 1219 | } |
| | 1220 | |
| | 1221 | |
| | 1222 | bool shown_set_winpos(void) |
| | 1223 | { |
| | 1224 | gint tx, ty; |
| | 1225 | gdk_window_get_position(W.w->window, &tx, &ty); |
| | 1226 | //gint ex, ey; |
| | 1227 | //gdk_window_get_position(W.ste->window, &ex, &ey); |
| | 1228 | |
| | 1229 | gint fx, fy, fh, fw; |
| | 1230 | fx = W.fcb->allocation.x; |
| | 1231 | fy = W.fcb->allocation.y; |
| | 1232 | fw = W.fcb->allocation.width; |
| | 1233 | fh = W.fcb->allocation.height; |
| | 1234 | |
| | 1235 | //printf("%d %d - %d %d - %d %d %d %d\n", tx, ty, ex, ey, fx, fy, fw, fh); |
| | 1236 | |
| | 1237 | //gtk_window_set_position(GTK_WINDOW(W.fw), GTK_WIN_POS_MOUSE); |
| | 1238 | //gdk_window_move(GTK_WIDGET(W.fw)->window, tx + fx, ty + fy + fh + 5); |
| | 1239 | gtk_window_move(W.fw, tx + fx, ty + fy + fh + 5); |
| | 1240 | return false; |
| | 1241 | } |
| | 1242 | |
| | 1243 | void show_fav_window(int indx, bool do_show) |
| | 1244 | { |
| | 1245 | char * text = read_textfile(favorites_filename(indx)); |
| | 1246 | gtk_text_buffer_set_text(W.ftxtbuf, text, -1); |
| | 1247 | free(G.fav_text); |
| | 1248 | G.fav_text = text; |
| | 1249 | |
| | 1250 | // always open favorites window if content empty |
| | 1251 | if ( (text[0] == '\0' || do_show) && ! G.fav_open) { |
| | 1252 | gtk_widget_show_all(GTK_WIDGET(W.fw)); |
| | 1253 | //shown_set_winpos(); |
| | 1254 | G.fav_open = true; |
| | 1255 | } |
| | 1256 | } |
| | 1257 | |
| | 1258 | #if 0 |
| | 1259 | void favorites_changed(GtkComboBox * cb) |
| | 1260 | { |
| | 1261 | write(1, "goo\n", 4); |
| | 1262 | } |
| | 1263 | #endif |
| | 1264 | |
| | 1265 | /* |
| | 1266 | "popdown" differs from "changed" so that same selection if notified too. |
| | 1267 | */ |
| | 1268 | bool favorites_popdown(GtkComboBox * cb /*, GdkEvent * e*/) |
| | 1269 | { |
| | 1270 | static bool prev_shown = false; |
| | 1271 | bool popup_shown; |
| | 1272 | |
| | 1273 | g_object_get(G_OBJECT(cb), "popup-shown", &popup_shown, null); |
| | 1274 | //printf("popdown: event type %d, popup_shown %d\n", e->type, popup_shown); |
| | 1275 | |
| | 1276 | if (popup_shown == false && prev_shown) { |
| | 1277 | gint indx = gtk_combo_box_get_active(GTK_COMBO_BOX(cb)); |
| | 1278 | //printf("index: %d\n", indx); |
| | 1279 | if (indx == 0) { |
| | 1280 | // back to search... |
| | 1281 | if (G.fav_window != 0) { |
| | 1282 | do_hide_fav_window(); |
| | 1283 | gtk_entry_set_visibility(GTK_ENTRY(W.ste), true); |
| | 1284 | } |
| | 1285 | } |
| | 1286 | else { |
| | 1287 | if (G.fav_window == 0) { |
| | 1288 | gtk_entry_set_visibility(GTK_ENTRY(W.ste), false); |
| | 1289 | } |
| | 1290 | else |
| | 1291 | save_fav_content(); |
| | 1292 | show_fav_window(indx, indx == G.fav_window); |
| | 1293 | } |
| | 1294 | G.fav_window = indx; |
| | 1295 | refilter_model(); |
| | 1296 | } |
| | 1297 | prev_shown = popup_shown; |
| | 1298 | return false; |
| | 1299 | } |
| | 1300 | |
| | 1301 | bool main_quit(void * w, void * e, void * d) |
| | 1302 | { |
| | 1303 | (void)w; (void)e; (void)d; |
| | 1304 | do_hide_fav_window(); |
| | 1305 | gtk_main_quit(); |
| | 1306 | return true; |
| | 1307 | } |
| | 1308 | |
| 1014 | #define __S(x) __STRING(x) | 1309 | #define __S(x) __STRING(x) |
| 1015 | | 1310 | |
| 1016 | void gui(void) | 1311 | void gui(void) |
| 1017 | { | 1312 | { |
| 1018 | GtkWidget * e; | 1313 | W.fw = aWindow("Suosikit", |
| | 1314 | hide_fav_window, null, 2, true, false, |
| | 1315 | aTextView(W.ftxtbuf = aTextBuffer(), true)); |
| | 1316 | |
| | 1317 | gtk_window_set_default_size(GTK_WINDOW(W.fw), 100, 20); |
| | 1318 | //gtk_window_set_position(GTK_WINDOW(W.fw), GTK_WIN_POS_MOUSE); |
| | 1319 | //gtk_widget_show_all(W.fw); |
| | 1320 | g_signal_connect(G_OBJECT(W.fw), "show", shown_set_winpos, null); |
| | 1321 | //gtk_widget_realize(GTK_WIDGET(W.fw)); |
| 1019 | | 1322 | |
| 1020 | W.w = aWindow("tv kaista " __S(VERSION), | 1323 | W.w = aWindow("tv kaista " __S(VERSION), |
| 1021 | (gboolean(*)(void *,void *,void *))gtk_main_quit, null, | | |
| 1022 | 2, true, true, | 1324 | main_quit, null, 2, true, true, |
| 1023 | aVBox(/* <- homogeneous spacing */ false, 2, | 1325 | aVBox(/* <- homogeneous spacing */ false, 2, |
| 1024 | aHBox(/* <- homogeneous spacing */ false, 2, | 1326 | aHBox(/* <- homogeneous spacing */ false, 2, |
| 1025 | aButton("päivitä", update_pressed, null), | 1327 | aButton("päivitä", update_pressed, null), |
| 1032 | /* ^^ expand fill padding */ false, true, 2, | 1334 | /* ^^ expand fill padding */ false, true, 2, |
| 1033 | W.pcb = aTextComboBox(players, nplayers, 2), | 1335 | W.pcb = aTextComboBox(players, nplayers, 2), |
| 1034 | /* ^^ expand fill padding */ false, true, 2, | 1336 | /* ^^ expand fill padding */ false, true, 2, |
| 1035 | aLabel("haku"), | 1337 | //aLabel("haku"), |
| | 1338 | W.fcb = aTextComboBox(favorites, nfavorites, 0), |
| 1036 | /* ^^ expand fill padding */ false, true, 2, | 1339 | /* ^^ expand fill padding */ false, true, 2, |
| 1037 | e = anEntry("", 10, MAXSEARCHLEN), | 1340 | W.ste = anEntry("", 10, MAXSEARCHLEN), |
| 1038 | /* ^^ expand fill padding */ true, true, 2, | 1341 | /* ^^ expand fill padding */ true, true, 2, |
| 1039 | null), | 1342 | null), |
| 1040 | /* ^^ expand fill padding */ false, true, 2, | 1343 | /* ^^ expand fill padding */ false, true, 2, |
| 1041 | aScrolledWindow(create_view_and_model()), | 1344 | aScrolledWindow(create_view_and_model()), |
| 1042 | /* ^^ expand fill padding */ true, true, 2, | 1345 | /* ^^ expand fill padding */ true, true, 2, |
| 1043 | aTextView(W.txtbuffer = aTextBuffer()), | 1346 | aTextView(W.txtbuffer = aTextBuffer(), false), |
| 1044 | /* ^^ expand fill padding */ true, true, 2, | 1347 | /* ^^ expand fill padding */ true, true, 2, |
| 1045 | null)); | 1348 | null)); |
| 1046 | | 1349 | |
| 1047 | gtk_signal_connect(GTK_OBJECT(e), "key-press-event", | 1350 | g_signal_connect(G_OBJECT(W.ste), "key-press-event", |
| 1048 | GTK_SIGNAL_FUNC(entry_key_pressed), null); | 1351 | G_CALLBACK(entry_key_pressed), null); |
| | 1352 | |
| | 1353 | #if 0 // "changed" does not cover choosing the same... |
| | 1354 | g_signal_connect(G_OBJECT(W.fcb), "changed", |
| | 1355 | G_CALLBACK(favorites_changed), null); |
| | 1356 | #endif |
| | 1357 | |
| | 1358 | /* no help, no window probably... use event-after then */ |
| | 1359 | //gtk_widget_add_events(W.fcb, GDK_KEY_RELEASE_MASK); |
| | 1360 | //gtk_widget_add_events(W.fcb, GDK_ALL_EVENTS_MASK); |
| | 1361 | |
| | 1362 | //gtk_signal_connect(GTK_OBJECT(W.fcb), "notify::popup-shown", |
| | 1363 | g_signal_connect(G_OBJECT(W.fcb), "event-after", |
| | 1364 | G_CALLBACK(favorites_popdown), null); |
| 1049 | | 1365 | |
| 1050 | //g_signal_connect(e, "insert-at-cursor", entry_changed, null); | 1366 | //g_signal_connect(e, "insert-at-cursor", entry_changed, null); |
| 1051 | | 1367 | |
| 1052 | gtk_window_set_icon_from_file(GTK_WINDOW(W.w), "tvkaista.png", null); | 1368 | gtk_window_set_icon_from_file(GTK_WINDOW(W.w), "tvkaista.png", null); |
| 1053 | | | |
| 1054 | #if 0 | | |
| 1055 | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | | |
| 1056 | | | |
| 1057 | gtk_window_set_default_size(GTK_WINDOW(window), 600, 400); | | |
| 1058 | g_signal_connect(window, "delete_event", gtk_main_quit, NULL); /* dirty */ | | |
| 1059 | | | |
| 1060 | view = create_view_and_model(); | | |
| 1061 | | | |
| 1062 | sw = gtk_scrolled_window_new(null, null); | | |
| 1063 | | | |
| 1064 | /* gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), view); */ | | |
| 1065 | gtk_container_add(GTK_CONTAINER(sw), view); | | |
| 1066 | | | |
| 1067 | gtk_container_add(GTK_CONTAINER(window), sw); | | |
| 1068 | #endif | | |
| 1069 | // gtk_widget_show_all(W.w); | | |
| 1070 | } | 1369 | } |
| 1071 | | 1370 | |
| 1072 | const char intro[] = "\n" | 1371 | const char intro[] = "\n" |
| 1083 | "<kanava> -\"painike\" palauttaa kaikki kanavat näkyviin keskialueen\n" | 1382 | "<kanava> -\"painike\" palauttaa kaikki kanavat näkyviin keskialueen\n" |
| 1084 | "napsautuksella.\n" | 1383 | "napsautuksella.\n" |
| 1085 | "\n" | 1384 | "\n" |
| | 1385 | "Hauissa on mahdollista tallentaa suosikkilistoja. Suosikkilistaikkuna\n" |
| | 1386 | "aukeaa mikäli se on tyhjä tai sama suosikkilista valitaan valikosta.\n" |
| | 1387 | "\n" |
| 1086 | "Tallenteiden sijaintipaikka on $HOME/.tvkaista/tallenteet/.\n" | 1388 | "Tallenteiden sijaintipaikka on $HOME/.tvkaista/tallenteet/.\n" |
| 1087 | "\n"; | 1389 | "\n"; |
| 1088 | | 1390 | |