[gedit] app: don't print warning if the print settings file is empty
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] app: don't print warning if the print settings file is empty
- Date: Sun, 7 Jun 2015 09:57:47 +0000 (UTC)
commit 19f59cac303407555e3a21ff69011d04fcf4b428
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Jun 7 11:50:06 2015 +0200
app: don't print warning if the print settings file is empty
Steps to reproduce:
1. remove printing config files in ~/.config/gedit/
2. start gedit
3. launch the print dialog
4. click on cancel
5. close gedit -> ~/.config/gedit/gedit-print-settings is empty
6. start gedit again, and launch the print dialog
gedit/gedit-app.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index c01de28..a079df5 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -1378,13 +1378,17 @@ load_print_settings (GeditApp *app)
filename = get_print_settings_file ();
priv->print_settings = gtk_print_settings_new_from_file (filename, &error);
- if (error)
+ if (error != NULL)
{
- /* Ignore file not found error */
- if (error->domain != G_FILE_ERROR ||
- error->code != G_FILE_ERROR_NOENT)
+ /* - Ignore file not found error.
+ * - Ignore empty file error, i.e. group not found. This happens
+ * when we click on cancel in the print dialog, when using the
+ * printing for the first time in gedit.
+ */
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
+ !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND))
{
- g_warning ("%s", error->message);
+ g_warning ("Load print settings error: %s", error->message);
}
g_error_free (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]