~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to shell/ev-window-title.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2011-04-14 16:20:57 UTC
  • mfrom: (1.6.4 upstream)
  • mto: (1.3.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: james.westby@ubuntu.com-20110414162057-0ofhbd139zs6ev6y
Import upstream version 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 *
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
18
 */
19
19
 
20
20
#include <config.h>
83
83
}
84
84
 
85
85
/* Some docs report titles with confusing extensions (ex. .doc for pdf).
86
 
   Let's show the filename in this case */
 
86
           Erase the confusing extension of the title */
87
87
static void
88
88
ev_window_title_sanitize_title (EvWindowTitle *window_title, char **title) {
89
89
        const gchar *backend;
97
97
                        char *new_title;
98
98
                        char *filename = get_filename_from_uri (window_title->uri);
99
99
 
100
 
                        new_title = g_strdup_printf ("%s (%s)", *title, filename);
 
100
                        new_title = g_strndup (*title, strlen(*title) - strlen(bad_extensions[i].text));
101
101
                        g_free (*title);
102
102
                        *title = new_title;
103
103
 
142
142
        }
143
143
 
144
144
        if (title && window_title->uri) {
 
145
                char *tmp_title;
 
146
                char *filename = get_filename_from_uri (window_title->uri);
 
147
 
145
148
                ev_window_title_sanitize_title (window_title, &title);
 
149
                tmp_title = g_strdup_printf ("%s — %s", filename, title);
 
150
                g_free (title);
 
151
                g_free (filename);
 
152
 
 
153
                title = tmp_title;
146
154
        } else if (window_title->uri) {
147
155
                title = get_filename_from_uri (window_title->uri);
148
156
        } else if (!title) {