diff options
author | José Aliste <[email protected]> | 2010-12-14 13:16:45 +0000 |
---|---|---|
committer | infirit <[email protected]> | 2014-02-18 20:42:49 +0100 |
commit | 892184c3ad66498a22e762022813b9fe27252eb7 (patch) | |
tree | 3074a4007fb5e5505e81b9fb0de7a7d1fb277724 /shell | |
parent | b59cfdcb451b8412895bbc741bb051929edfe76c (diff) | |
download | atril-892184c3ad66498a22e762022813b9fe27252eb7.tar.bz2 atril-892184c3ad66498a22e762022813b9fe27252eb7.tar.xz |
shell: Show "filename (title)" in the window title.
Based on a patch by Wouter Bolsterlee.
Fixes bug #386292
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ev-window-title.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/shell/ev-window-title.c b/shell/ev-window-title.c index 612dae5e..7a61d962 100644 --- a/shell/ev-window-title.c +++ b/shell/ev-window-title.c @@ -83,7 +83,7 @@ get_filename_from_uri (const char *uri) } /* Some docs report titles with confusing extensions (ex. .doc for pdf). - Let's show the filename in this case */ + Erase the confusing extension of the title */ static void ev_window_title_sanitize_title (EvWindowTitle *window_title, char **title) { const gchar *backend; @@ -97,7 +97,7 @@ ev_window_title_sanitize_title (EvWindowTitle *window_title, char **title) { char *new_title; char *filename = get_filename_from_uri (window_title->uri); - new_title = g_strdup_printf ("%s (%s)", *title, filename); + new_title = g_strndup (*title, strlen(*title) - strlen(bad_extensions[i].text)); g_free (*title); *title = new_title; @@ -142,7 +142,14 @@ ev_window_title_update (EvWindowTitle *window_title) } if (title && window_title->uri) { + char *tmp_title = title; + char *filename = get_filename_from_uri (window_title->uri); + ev_window_title_sanitize_title (window_title, &title); + title = g_strdup_printf ("%s — %s", filename, title); + + g_free (tmp_title); + g_free (filename); } else if (window_title->uri) { title = get_filename_from_uri (window_title->uri); } else if (!title) { |