#include <config.h>
#include "ev-window-title.h"
#include "ev-utils.h"
#include <string.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
Go to the source code of this file.
#define EV_BACKEND_PDF "PdfDocument" |
#define EV_BACKEND_PS "PSDocument" |
static void document_destroyed_cb |
( |
EvWindowTitle * |
window_title, |
|
|
GObject * |
document |
|
) |
| |
|
static |
Definition at line 194 of file ev-window-title.c.
197 window_title->document = NULL;
198 g_clear_pointer (&window_title->doc_title, g_free);
Definition at line 249 of file ev-window-title.c.
251 if (window_title->document)
252 g_object_weak_unref (G_OBJECT (window_title->document), (GWeakNotify)
document_destroyed_cb, window_title);
253 g_free (window_title->doc_title);
254 g_free (window_title->uri);
255 g_free (window_title);
static void ev_window_title_sanitize_title |
( |
EvWindowTitle * |
window_title, |
|
|
char ** |
title |
|
) |
| |
|
static |
Definition at line 76 of file ev-window-title.c.
80 backend = G_OBJECT_TYPE_NAME (window_title->document);
83 if (g_ascii_strcasecmp (
bad_extensions[i].backend, backend) == 0 &&
88 new_title = g_strndup (*title, strlen(*title) - strlen(
bad_extensions[i].text));
96 if (g_ascii_strcasecmp (
bad_prefixes[i].backend, backend) == 0 &&
101 new_title = g_strdup_printf (
"%s", (*title) + len);
Definition at line 202 of file ev-window-title.c.
205 if (window_title->document == document)
208 if (window_title->document)
209 g_object_weak_unref (G_OBJECT (window_title->document), (GWeakNotify)
document_destroyed_cb, window_title);
210 window_title->document = document;
211 g_object_weak_ref (G_OBJECT (window_title->document), (GWeakNotify)
document_destroyed_cb, window_title);
212 g_clear_pointer (&window_title->doc_title, g_free);
214 if (window_title->document != NULL) {
220 if (doc_title != NULL) {
221 doc_title = g_strstrip (doc_title);
223 if (doc_title[0] !=
'\0' &&
224 g_utf8_validate (doc_title, -1, NULL)) {
225 window_title->doc_title = doc_title;
void ev_window_title_set_uri |
( |
EvWindowTitle * |
window_title, |
|
|
const char * |
uri |
|
) |
| |
Definition at line 236 of file ev-window-title.c.
239 if (g_strcmp0 (uri, window_title->uri) == 0)
242 g_free (window_title->uri);
243 window_title->uri = g_strdup (uri);
static void ev_window_title_update |
( |
EvWindowTitle * |
window_title) | |
|
|
static |
Definition at line 109 of file ev-window-title.c.
111 GtkWindow *
window = GTK_WINDOW (window_title->window);
113 char *title = NULL, *p;
114 char *subtitle = NULL, *title_header = NULL;
117 gtk_header_bar_set_subtitle (toolbar, NULL);
118 gtk_window_set_title (window,
_(
"Recent Documents"));
122 if (window_title->doc_title && window_title->uri) {
123 title = g_strdup (window_title->doc_title);
128 title_header = title;
129 title = g_strdup_printf (
"%s — %s", subtitle, title);
131 for (p = title; *p; ++p) {
136 }
else if (window_title->uri) {
139 title = g_strdup (
_(
"Document Viewer"));
142 switch (window_title->type) {
144 gtk_window_set_title (window, title);
145 if (title_header && subtitle) {
146 gtk_header_bar_set_title (toolbar, title_header);
147 gtk_header_bar_set_subtitle (toolbar, subtitle);
151 gchar *password_title;
153 password_title = g_strdup_printf (
"%s — %s", title,
_(
"Password Required"));
154 gtk_window_set_title (window, password_title);
155 g_free (password_title);
157 gtk_header_bar_set_title (toolbar,
_(
"Password Required"));
158 gtk_header_bar_set_subtitle (toolbar, title);
162 g_assert_not_reached ();
168 g_free (title_header);
static char* get_filename_from_uri |
( |
const char * |
uri) | |
|
|
static |
Definition at line 61 of file ev-window-title.c.
66 filename = g_uri_unescape_string (uri, NULL);
67 basename = g_path_get_basename (filename);