[gedit] io-error-info-bar: fix fixme in no_backup_saving_error
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] io-error-info-bar: fix fixme in no_backup_saving_error
- Date: Tue, 24 Mar 2020 08:40:58 +0000 (UTC)
commit ca582d2c7d994f2b33b88f294cda69d264f7d2c9
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Mar 24 08:50:57 2020 +0100
io-error-info-bar: fix fixme in no_backup_saving_error
Reasons to believe that the 'else' block was dead code, impossible to
reach:
- The GError param must match G_IO_ERROR_CANT_CREATE_BACKUP, and that's
when we ask explicitly to create a backup.
- Searching all uses of GEDIT_SETTINGS_CREATE_BACKUP_COPY (or its
equivalent string), it's used only in GeditTab, and GeditTab has
conditional code for the auto-save. When it's an automatic save, we
don't ask to create a backup file (see the comment in gedit-tab.c
function get_initial_save_flags()).
- There is only one call site of
gedit_no_backup_saving_error_info_bar_new(), in GeditTab, where we ask
explicitly or not to create a backup file.
In any case, even if the 'else' block was possible to reach, "backup
file" instead of "temporary backup file" is OK too, it's good enough.
To disambiguate the two cases (if there are actually several cases), a
later commit will add the full error->message to the infobar. That way
the user will have all the infos.
gedit/gedit-io-error-info-bar.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
---
diff --git a/gedit/gedit-io-error-info-bar.c b/gedit/gedit-io-error-info-bar.c
index 0cd2d6f9e..fb7bf1fea 100644
--- a/gedit/gedit-io-error-info-bar.c
+++ b/gedit/gedit-io-error-info-bar.c
@@ -26,7 +26,6 @@
#include <glib/gi18n.h>
#include <tepl/tepl.h>
#include "gedit-encodings-combo-box.h"
-#include "gedit-settings.h"
#define MAX_URI_IN_DIALOG_LENGTH 50
@@ -744,8 +743,6 @@ gedit_no_backup_saving_error_info_bar_new (GFile *location,
const GError *error)
{
TeplInfoBar *info_bar;
- GSettings *editor_settings;
- gboolean create_backup_copy;
gchar *uri;
gchar *primary_msg;
const gchar *secondary_msg;
@@ -767,22 +764,7 @@ gedit_no_backup_saving_error_info_bar_new (GFile *location,
gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
uri = g_file_get_parse_name (location);
-
- editor_settings = g_settings_new ("org.gnome.gedit.preferences.editor");
- create_backup_copy = g_settings_get_boolean (editor_settings,
- GEDIT_SETTINGS_CREATE_BACKUP_COPY);
- g_object_unref (editor_settings);
-
- /* FIXME: review this messages */
- if (create_backup_copy)
- {
- primary_msg = g_strdup_printf (_("Could not create a backup file while saving “%s”"), uri);
- }
- else
- {
- primary_msg = g_strdup_printf (_("Could not create a temporary backup file while saving
“%s”"), uri);
- }
-
+ primary_msg = g_strdup_printf (_("Could not create a backup file while saving “%s”"), uri);
tepl_info_bar_add_primary_message (info_bar, primary_msg);
g_free (uri);
g_free (primary_msg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]