[gedit] io-error-info-bar: no_back_saving_error moved to Tepl
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] io-error-info-bar: no_back_saving_error moved to Tepl
- Date: Tue, 24 Mar 2020 09:58:18 +0000 (UTC)
commit 321eccdd75ca9df923045dbde83c1125bc5a08a4
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Mar 24 10:44:43 2020 +0100
io-error-info-bar: no_back_saving_error moved to Tepl
gedit/gedit-io-error-info-bar.c | 48 -----------------------------------------
gedit/gedit-io-error-info-bar.h | 3 ---
gedit/gedit-tab.c | 12 ++++++-----
3 files changed, 7 insertions(+), 56 deletions(-)
---
diff --git a/gedit/gedit-io-error-info-bar.c b/gedit/gedit-io-error-info-bar.c
index ef9849ef5..4c111dfad 100644
--- a/gedit/gedit-io-error-info-bar.c
+++ b/gedit/gedit-io-error-info-bar.c
@@ -738,54 +738,6 @@ gedit_externally_modified_saving_error_info_bar_new (GFile *location,
return info_bar;
}
-GtkWidget *
-gedit_no_backup_saving_error_info_bar_new (GFile *location,
- const GError *error)
-{
- TeplInfoBar *info_bar;
- gchar *uri;
- gchar *primary_msg;
- const gchar *secondary_msg;
-
- g_return_val_if_fail (G_IS_FILE (location), NULL);
- g_return_val_if_fail (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANT_CREATE_BACKUP), NULL);
-
- info_bar = tepl_info_bar_new ();
- tepl_info_bar_set_buttons_orientation (info_bar, GTK_ORIENTATION_HORIZONTAL);
-
- gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
- _("S_ave Anyway"),
- GTK_RESPONSE_YES);
-
- gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
- _("_Don’t Save"),
- GTK_RESPONSE_CANCEL);
-
- gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
-
- uri = g_file_get_parse_name (location);
- 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);
-
- secondary_msg = _("Could not back up the old copy of the file before saving the new one. "
- "You can ignore this warning and save the file anyway, but if an error "
- "occurs while saving, you could lose the old copy of the file. Save anyway?");
- tepl_info_bar_add_secondary_message (info_bar, secondary_msg);
-
- if (error->message != NULL)
- {
- gchar *error_msg;
-
- error_msg = g_strdup_printf (_("Error message: %s"), error->message);
- tepl_info_bar_add_secondary_message (info_bar, error_msg);
- g_free (error_msg);
- }
-
- return GTK_WIDGET (info_bar);
-}
-
GtkWidget *
gedit_unrecoverable_saving_error_info_bar_new (GFile *location,
const GError *error)
diff --git a/gedit/gedit-io-error-info-bar.h b/gedit/gedit-io-error-info-bar.h
index 6d887eef3..4e8c15aca 100644
--- a/gedit/gedit-io-error-info-bar.h
+++ b/gedit/gedit-io-error-info-bar.h
@@ -42,9 +42,6 @@ const GtkSourceEncoding
GtkWidget *gedit_externally_modified_saving_error_info_bar_new (GFile *location,
const GError *error);
-GtkWidget *gedit_no_backup_saving_error_info_bar_new (GFile *location,
- const GError *error);
-
GtkWidget *gedit_unrecoverable_saving_error_info_bar_new (GFile *location,
const GError *error);
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 7fc6fa217..df2552cdc 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1119,9 +1119,9 @@ invalid_character_info_bar_response (GtkWidget *info_bar,
}
static void
-no_backup_error_info_bar_response (GtkWidget *info_bar,
- gint response_id,
- GTask *saving_task)
+cant_create_backup_error_info_bar_response (GtkWidget *info_bar,
+ gint response_id,
+ GTask *saving_task)
{
if (response_id == GTK_RESPONSE_YES)
{
@@ -2307,12 +2307,14 @@ save_cb (GtkSourceFileSaver *saver,
error->code == G_IO_ERROR_CANT_CREATE_BACKUP)
{
/* This error is recoverable */
- info_bar = gedit_no_backup_saving_error_info_bar_new (location, error);
+ info_bar = GTK_WIDGET (tepl_io_error_info_bar_cant_create_backup (location, error));
g_return_if_fail (info_bar != NULL);
+ tepl_info_bar_set_buttons_orientation (TEPL_INFO_BAR (info_bar),
GTK_ORIENTATION_HORIZONTAL);
+
g_signal_connect (info_bar,
"response",
- G_CALLBACK (no_backup_error_info_bar_response),
+ G_CALLBACK (cant_create_backup_error_info_bar_response),
saving_task);
}
else if (error->domain == GTK_SOURCE_FILE_SAVER_ERROR &&
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]