Skip to content

Commit

Permalink
Fix the "continuous display" of tooltips in the collection view
Browse files Browse the repository at this point in the history
(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.
  • Loading branch information
Laurent Monin committed Apr 8, 2008
1 parent bddcf78 commit e975cd7
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/collect-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#define THUMB_BORDER_PADDING 2

#define COLLECT_TABLE_TIP_DELAY 500
#define COLLECT_TABLE_TIP_DELAY_PATH (COLLECT_TABLE_TIP_DELAY * 1.7)


enum {
Expand Down Expand Up @@ -448,7 +449,7 @@ static void tip_show(CollectTable *ct)
gtk_window_set_resizable(GTK_WINDOW(ct->tip_window), FALSE);
gtk_container_set_border_width(GTK_CONTAINER(ct->tip_window), 2);

label = gtk_label_new(ct->tip_info->fd->name);
label = gtk_label_new(ct->show_text ? ct->tip_info->fd->path : ct->tip_info->fd->name);

g_object_set_data(G_OBJECT(ct->tip_window), "tip_label", label);
gtk_container_add(GTK_CONTAINER(ct->tip_window), label);
Expand Down Expand Up @@ -489,10 +490,7 @@ static void tip_schedule(CollectTable *ct)
ct->tip_delay_id = -1;
}

if (!ct->show_text)
{
ct->tip_delay_id = g_timeout_add(COLLECT_TABLE_TIP_DELAY, tip_schedule_cb, ct);
}
ct->tip_delay_id = g_timeout_add(ct->show_text ? COLLECT_TABLE_TIP_DELAY_PATH : COLLECT_TABLE_TIP_DELAY, tip_schedule_cb, ct);
}

static void tip_unschedule(CollectTable *ct)
Expand All @@ -505,6 +503,8 @@ static void tip_unschedule(CollectTable *ct)

static void tip_update(CollectTable *ct, CollectInfo *info)
{
tip_schedule(ct);

if (ct->tip_window)
{
gint x, y;
Expand All @@ -520,19 +520,13 @@ static void tip_update(CollectTable *ct, CollectInfo *info)

if (!ct->tip_info)
{
tip_hide(ct);
tip_schedule(ct);
return;
}

label = g_object_get_data(G_OBJECT(ct->tip_window), "tip_label");
gtk_label_set_text(GTK_LABEL(label), ct->tip_info->fd->name);
gtk_label_set_text(GTK_LABEL(label), ct->show_text ? ct->tip_info->fd->path : ct->tip_info->fd->name);
}
}
else
{
tip_schedule(ct);
}
}

/*
Expand Down

0 comments on commit e975cd7

Please sign in to comment.