Mercurial > geeqie.yaz
comparison src/collect-table.c @ 274:2710d14f6a28
Fix the "continuous display" of tooltips in the collection view
(before the tooltip delay occured once, then changing icon to icon never hide the
tooltip again, now the tip is displayed shortly after the cursor moved on the icon,
but disappears when moving cursor to another icon).
Display the full path to the file when Show filename text is on (before nothing
was displayed).
When Show filename text is off, behavior is unchanged, the (short) filename is
displayed.
author | zas_ |
---|---|
date | Tue, 08 Apr 2008 21:33:29 +0000 |
parents | f6e307c7bad6 |
children | 9995c5fb202a |
comparison
equal
deleted
inserted
replaced
273:e0e2c2b72c5a | 274:2710d14f6a28 |
---|---|
44 | 44 |
45 #define COLLECT_TABLE_MAX_COLUMNS 32 | 45 #define COLLECT_TABLE_MAX_COLUMNS 32 |
46 #define THUMB_BORDER_PADDING 2 | 46 #define THUMB_BORDER_PADDING 2 |
47 | 47 |
48 #define COLLECT_TABLE_TIP_DELAY 500 | 48 #define COLLECT_TABLE_TIP_DELAY 500 |
49 #define COLLECT_TABLE_TIP_DELAY_PATH (COLLECT_TABLE_TIP_DELAY * 1.7) | |
49 | 50 |
50 | 51 |
51 enum { | 52 enum { |
52 CTABLE_COLUMN_POINTER = 0, | 53 CTABLE_COLUMN_POINTER = 0, |
53 CTABLE_COLUMN_COUNT | 54 CTABLE_COLUMN_COUNT |
446 | 447 |
447 ct->tip_window = gtk_window_new(GTK_WINDOW_POPUP); | 448 ct->tip_window = gtk_window_new(GTK_WINDOW_POPUP); |
448 gtk_window_set_resizable(GTK_WINDOW(ct->tip_window), FALSE); | 449 gtk_window_set_resizable(GTK_WINDOW(ct->tip_window), FALSE); |
449 gtk_container_set_border_width(GTK_CONTAINER(ct->tip_window), 2); | 450 gtk_container_set_border_width(GTK_CONTAINER(ct->tip_window), 2); |
450 | 451 |
451 label = gtk_label_new(ct->tip_info->fd->name); | 452 label = gtk_label_new(ct->show_text ? ct->tip_info->fd->path : ct->tip_info->fd->name); |
452 | 453 |
453 g_object_set_data(G_OBJECT(ct->tip_window), "tip_label", label); | 454 g_object_set_data(G_OBJECT(ct->tip_window), "tip_label", label); |
454 gtk_container_add(GTK_CONTAINER(ct->tip_window), label); | 455 gtk_container_add(GTK_CONTAINER(ct->tip_window), label); |
455 gtk_widget_show(label); | 456 gtk_widget_show(label); |
456 | 457 |
487 { | 488 { |
488 g_source_remove(ct->tip_delay_id); | 489 g_source_remove(ct->tip_delay_id); |
489 ct->tip_delay_id = -1; | 490 ct->tip_delay_id = -1; |
490 } | 491 } |
491 | 492 |
492 if (!ct->show_text) | 493 ct->tip_delay_id = g_timeout_add(ct->show_text ? COLLECT_TABLE_TIP_DELAY_PATH : COLLECT_TABLE_TIP_DELAY, tip_schedule_cb, ct); |
493 { | |
494 ct->tip_delay_id = g_timeout_add(COLLECT_TABLE_TIP_DELAY, tip_schedule_cb, ct); | |
495 } | |
496 } | 494 } |
497 | 495 |
498 static void tip_unschedule(CollectTable *ct) | 496 static void tip_unschedule(CollectTable *ct) |
499 { | 497 { |
500 tip_hide(ct); | 498 tip_hide(ct); |
503 ct->tip_delay_id = -1; | 501 ct->tip_delay_id = -1; |
504 } | 502 } |
505 | 503 |
506 static void tip_update(CollectTable *ct, CollectInfo *info) | 504 static void tip_update(CollectTable *ct, CollectInfo *info) |
507 { | 505 { |
506 tip_schedule(ct); | |
507 | |
508 if (ct->tip_window) | 508 if (ct->tip_window) |
509 { | 509 { |
510 gint x, y; | 510 gint x, y; |
511 | 511 |
512 gdk_window_get_pointer(NULL, &x, &y, NULL); | 512 gdk_window_get_pointer(NULL, &x, &y, NULL); |
518 | 518 |
519 ct->tip_info = info; | 519 ct->tip_info = info; |
520 | 520 |
521 if (!ct->tip_info) | 521 if (!ct->tip_info) |
522 { | 522 { |
523 tip_hide(ct); | |
524 tip_schedule(ct); | |
525 return; | 523 return; |
526 } | 524 } |
527 | 525 |
528 label = g_object_get_data(G_OBJECT(ct->tip_window), "tip_label"); | 526 label = g_object_get_data(G_OBJECT(ct->tip_window), "tip_label"); |
529 gtk_label_set_text(GTK_LABEL(label), ct->tip_info->fd->name); | 527 gtk_label_set_text(GTK_LABEL(label), ct->show_text ? ct->tip_info->fd->path : ct->tip_info->fd->name); |
530 } | 528 } |
531 } | |
532 else | |
533 { | |
534 tip_schedule(ct); | |
535 } | 529 } |
536 } | 530 } |
537 | 531 |
538 /* | 532 /* |
539 *------------------------------------------------------------------- | 533 *------------------------------------------------------------------- |