evince r3220 - in trunk: . shell
- From: nshmyrev svn gnome org
- To: svn-commits-list gnome org
- Subject: evince r3220 - in trunk: . shell
- Date: Mon, 13 Oct 2008 20:54:15 +0000 (UTC)
Author: nshmyrev
Date: Mon Oct 13 20:54:15 2008
New Revision: 3220
URL: http://svn.gnome.org/viewvc/evince?rev=3220&view=rev
Log:
2008-10-14 Nickolay V. Shmyrev <nshmyrev yandex ru>
* shell/ev-window-title.c (ev_window_title_sanitize_title):
Removes bad prefixes from window title. Patch by
Robin Sonefors <ozamosi blinkenlights se> fixes bug #534684.
Modified:
trunk/ChangeLog
trunk/shell/ev-window-title.c
Modified: trunk/shell/ev-window-title.c
==============================================================================
--- trunk/shell/ev-window-title.c (original)
+++ trunk/shell/ev-window-title.c Mon Oct 13 20:54:15 2008
@@ -21,6 +21,7 @@
#include "ev-window-title.h"
#include "ev-backends-manager.h"
+#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
@@ -31,8 +32,8 @@
typedef struct
{
const gchar *backend;
- const gchar *ext;
-} BadExtensionEntry;
+ const gchar *text;
+} BadTitleEntry;
struct _EvWindowTitle
{
@@ -42,7 +43,7 @@
char *uri;
};
-static const BadExtensionEntry bad_extensions[] = {
+static const BadTitleEntry bad_extensions[] = {
{ EV_BACKEND_PS, ".dvi" },
{ EV_BACKEND_PDF, ".doc" },
{ EV_BACKEND_PDF, ".dvi" },
@@ -50,6 +51,11 @@
{ EV_BACKEND_PDF, ".rtf" }
};
+static const BadTitleEntry bad_prefixes[] = {
+ { EV_BACKEND_PDF, "Microsoft Word - " },
+ { EV_BACKEND_PDF, "Microsoft PowerPoint - " }
+};
+
EvWindowTitle *
ev_window_title_new (EvWindow *window)
{
@@ -78,7 +84,7 @@
/* Some docs report titles with confusing extensions (ex. .doc for pdf).
Let's show the filename in this case */
static void
-ev_window_title_sanitize_extension (EvWindowTitle *window_title, char **title) {
+ev_window_title_sanitize_title (EvWindowTitle *window_title, char **title) {
const gchar *backend;
int i;
@@ -86,7 +92,7 @@
for (i = 0; i < G_N_ELEMENTS (bad_extensions); i++) {
if (g_ascii_strcasecmp (bad_extensions[i].backend, backend) == 0 &&
- g_str_has_suffix (*title, bad_extensions[i].ext)) {
+ g_str_has_suffix (*title, bad_extensions[i].text)) {
char *new_title;
char *filename = get_filename_from_uri (window_title->uri);
@@ -97,6 +103,17 @@
g_free (filename);
}
}
+ for (i = 0; i < G_N_ELEMENTS (bad_prefixes); i++) {
+ if (g_ascii_strcasecmp (bad_prefixes[i].backend, backend) == 0 &&
+ g_str_has_prefix (*title, bad_prefixes[i].text)) {
+ char *new_title;
+ int len = strlen(bad_prefixes[i].text);
+
+ new_title = g_strdup_printf ("%s", (*title) + len);
+ g_free (*title);
+ *title = new_title;
+ }
+ }
}
static void
@@ -125,7 +142,7 @@
}
if (title && window_title->uri) {
- ev_window_title_sanitize_extension (window_title, &title);
+ ev_window_title_sanitize_title (window_title, &title);
} else if (window_title->uri) {
title = get_filename_from_uri (window_title->uri);
} else if (!title) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]