}
static void
-ev_window_error_message (EvWindow *window, const gchar *msg, GError *error)
+ev_window_error_message (EvWindow *window,
+ GError *error,
+ const gchar *format,
+ ...)
{
GtkWidget *area;
+ va_list args;
+ gchar *msg = NULL;
if (window->priv->message_area)
return;
+ va_start (args, format);
+ msg = g_strdup_vprintf (format, args);
+ va_end (args);
+
area = ev_message_area_new (GTK_MESSAGE_ERROR,
msg,
GTK_STOCK_CLOSE,
GTK_RESPONSE_CANCEL,
NULL);
+ g_free (msg);
+
if (error)
ev_message_area_set_secondary_text (EV_MESSAGE_AREA (area), error->message);
g_signal_connect (area, "response",
}
static void
-ev_window_warning_message (EvWindow *window, const gchar *msg)
+ev_window_warning_message (EvWindow *window,
+ const gchar *format,
+ ...)
{
GtkWidget *area;
+ va_list args;
+ gchar *msg = NULL;
if (window->priv->message_area)
return;
+ va_start (args, format);
+ msg = g_strdup_vprintf (format, args);
+ va_end (args);
+
area = ev_message_area_new (GTK_MESSAGE_WARNING,
msg,
GTK_STOCK_CLOSE,
GTK_RESPONSE_CANCEL,
NULL);
+ g_free (msg);
g_signal_connect (area, "response",
G_CALLBACK (ev_window_message_area_response_cb),
if (ev_page_cache_get_n_pages (ev_window->priv->page_cache) > 0) {
ev_view_set_document (view, document);
} else {
- ev_window_warning_message (ev_window,
+ ev_window_warning_message (ev_window, "%s",
_("The document contains no pages"));
}
ev_window_popup_password_dialog (ev_window);
} else {
- ev_window_error_message (ev_window,
- _("Unable to open document"),
- job->error);
+ ev_window_error_message (ev_window, job->error,
+ "%s", _("Unable to open document"));
ev_window_clear_load_job (ev_window);
}
}
{
ev_view_set_loading (EV_VIEW (ev_window->priv->view), FALSE);
ev_window->priv->in_reload = FALSE;
- ev_window_error_message (ev_window,
- _("Unable to open document"),
- error);
+ ev_window_error_message (ev_window, error,
+ "%s", _("Unable to open document"));
g_free (ev_window->priv->local_uri);
ev_window->priv->local_uri = NULL;
}
new_filename = ev_window_create_tmp_symlink (old_filename, &error);
if (error) {
- ev_window_error_message (window,
- _("Cannot open a copy."),
- error);
-
+ ev_window_error_message (window, error,
+ "%s", _("Cannot open a copy."));
g_error_free (error);
g_free (old_filename);
g_free (new_filename);
EvWindow *window)
{
if (ev_job_is_failed (job)) {
- gchar *msg;
-
- msg = g_strdup_printf (_("The file could not be saved as ā%sā."),
- EV_JOB_SAVE (job)->uri);
- ev_window_error_message (window, msg, job->error);
- g_free (msg);
+ ev_window_error_message (window, job->error,
+ _("The file could not be saved as ā%sā."),
+ EV_JOB_SAVE (job)->uri);
}
ev_window_clear_save_job (window);
GDK_CURRENT_TIME,
&error);
if (error) {
- ev_window_error_message (ev_window,
- _("There was an error displaying help"),
- error);
+ ev_window_error_message (ev_window, error,
+ "%s", _("There was an error displaying help"));
g_error_free (error);
}
}
}
if (ret == FALSE) {
- ev_window_error_message (window,
- _("Unable to open external link"),
- error);
+ ev_window_error_message (window, error,
+ "%s", _("Unable to open external link"));
g_error_free (error);
}
}
}
if (format == NULL) {
- ev_window_error_message (ev_window,
- _("Couldn't find appropriate format to save image"),
- NULL);
+ ev_window_error_message (ev_window, NULL,
+ "%s",
+ _("Couldn't find appropriate format to save image"));
g_free (uri);
gtk_widget_destroy (fc);
g_object_unref (pixbuf);
if (error) {
- ev_window_error_message (ev_window,
- _("The image could not be saved."),
- error);
+ ev_window_error_message (ev_window, error,
+ "%s", _("The image could not be saved."));
g_error_free (error);
g_free (filename);
g_object_unref (target_file);
ev_attachment_open (attachment, screen, GDK_CURRENT_TIME, &error);
if (error) {
- ev_window_error_message (window,
- _("Unable to open attachment"),
- error);
+ ev_window_error_message (window, error,
+ "%s", _("Unable to open attachment"));
g_error_free (error);
}
}
ev_attachment_save (attachment, save_to, &error);
if (error) {
- ev_window_error_message (ev_window,
- _("The attachment could not be saved."),
- error);
+ ev_window_error_message (ev_window, error,
+ "%s", _("The attachment could not be saved."));
g_error_free (error);
g_object_unref (save_to);