diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2008-04-17 04:05:14 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2008-04-17 04:05:14 +0000 |
commit | 51baf7769acfe295b86bc7dc5ff39b922481b0e6 (patch) | |
tree | 412118fbe47e591ad2f7fe3feec905a421022982 /gtk | |
parent | ebe83ebcb39bf99e2bb7027654a039c5fa19c0a6 (diff) |
cut filenames in the middle (not just at the start) and add tooltips for it
svn path=/trunk/; revision=25093
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/main_welcome.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gtk/main_welcome.c b/gtk/main_welcome.c index 970a00c74c..e9f352d433 100644 --- a/gtk/main_welcome.c +++ b/gtk/main_welcome.c @@ -265,15 +265,18 @@ welcome_filename_link_new(const gchar *filename, GtkWidget **label) const unsigned int max = 60; int err; struct stat stat_buf; + GtkTooltips *tooltips; + + tooltips = gtk_tooltips_new(); /* filename */ str = g_string_new(filename); /* cut max filename length */ - if(str->len > max) { - g_string_erase(str, 0, str->len-max /*cut*/); - g_string_prepend(str, "... "); + if( (str->len > max) && (str->len-(max) > 5) ) { + g_string_erase(str, 20, str->len-(max+5)); + g_string_insert(str, 20, " ... "); } /* add file size */ @@ -303,6 +306,7 @@ welcome_filename_link_new(const gchar *filename, GtkWidget **label) /* event box */ eb = gtk_event_box_new(); gtk_container_add(GTK_CONTAINER(eb), w); + gtk_tooltips_set_tip(tooltips, eb, filename, ""); g_signal_connect(eb, "enter-notify-event", G_CALLBACK(welcome_item_enter_cb), w); g_signal_connect(eb, "leave-notify-event", G_CALLBACK(welcome_item_leave_cb), w); |