[gimp] plug-ins: check GError domain and code, not the message.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: check GError domain and code, not the message.
- Date: Sun, 10 Sep 2017 20:58:57 +0000 (UTC)
commit 0f2002c9489c6617bb28c706abb06c7c5ebfcfcb
Author: Jehan <jehan girinstud io>
Date: Sun Sep 10 22:53:47 2017 +0200
plug-ins: check GError domain and code, not the message.
When there is a well-documented GError domain/code, use these,
especially since messages can be localized (not sure if that is the case
for this one, but theoretically it could) and change over time.
Also remove the "nice-to-have" comment on file-pdf-load since we won't
be changing it now, but leave it on file-pdf-load2 parameters which can
still change before 2.10.
plug-ins/common/file-pdf-load.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/common/file-pdf-load.c b/plug-ins/common/file-pdf-load.c
index 12420c5..22a79d1 100644
--- a/plug-ins/common/file-pdf-load.c
+++ b/plug-ins/common/file-pdf-load.c
@@ -265,12 +265,6 @@ query (void)
{ GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }"
},
{ GIMP_PDB_STRING, "filename", "The name of the file to load" },
{ GIMP_PDB_STRING, "raw-filename", "The name entered" }
- /* XXX: Nice to have API at some point, but needs work
- { GIMP_PDB_INT32, "resolution", "Resolution to rasterize to (dpi)" },
- { GIMP_PDB_INT32, "antialiasing", "Use anti-aliasing" },
- { GIMP_PDB_INT32, "n-pages", "Number of pages to load (0 for all)" },
- { GIMP_PDB_INT32ARRAY,"pages", "The pages to load" }
- */
};
static const GimpParamDef load2_args[] =
@@ -633,7 +627,9 @@ open_document (const gchar *filename,
GtkWidget *label;
label = gtk_label_new (_("PDF is password protected, please input the password:"));
- while (error && strcmp (error->message, "Document is encrypted") == 0)
+ while (error &&
+ error->domain == POPPLER_ERROR &&
+ error->code == POPPLER_ERROR_ENCRYPTED)
{
GtkWidget *vbox;
GtkWidget *dialog;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]