[gedit] io-error-info-bar: invalid_character: moved to Tepl



commit ec8d8c717d9066c47a226d614032bf0fc8e53a28
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Mar 24 14:11:28 2020 +0100

    io-error-info-bar: invalid_character: moved to Tepl

 gedit/gedit-io-error-info-bar.c | 36 ------------------------------------
 gedit/gedit-io-error-info-bar.h |  2 --
 gedit/gedit-tab.c               |  4 +++-
 3 files changed, 3 insertions(+), 39 deletions(-)
---
diff --git a/gedit/gedit-io-error-info-bar.c b/gedit/gedit-io-error-info-bar.c
index 91159fa06..1edbe313a 100644
--- a/gedit/gedit-io-error-info-bar.c
+++ b/gedit/gedit-io-error-info-bar.c
@@ -867,40 +867,4 @@ gedit_unrecoverable_saving_error_info_bar_new (GFile        *location,
        return info_bar;
 }
 
-GtkWidget *
-gedit_invalid_character_info_bar_new (GFile *location)
-{
-       TeplInfoBar *info_bar;
-       gchar *uri;
-       gchar *primary_msg;
-       const gchar *secondary_msg;
-
-       g_return_val_if_fail (G_IS_FILE (location), 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 (_("Some invalid characters have been detected while saving “%s”."), 
uri);
-       tepl_info_bar_add_primary_message (info_bar, primary_msg);
-       g_free (uri);
-       g_free (primary_msg);
-
-       secondary_msg = _("If you continue saving this file you can corrupt the document. "
-                         "Save anyway?");
-       tepl_info_bar_add_secondary_message (info_bar, secondary_msg);
-
-       return GTK_WIDGET (info_bar);
-}
-
 /* ex:set ts=8 noet: */
diff --git a/gedit/gedit-io-error-info-bar.h b/gedit/gedit-io-error-info-bar.h
index 287336c45..12780f7ae 100644
--- a/gedit/gedit-io-error-info-bar.h
+++ b/gedit/gedit-io-error-info-bar.h
@@ -45,8 +45,6 @@ GtkWidget     *gedit_externally_modified_saving_error_info_bar_new    (GFile
 GtkWidget      *gedit_unrecoverable_saving_error_info_bar_new          (GFile               *location,
                                                                         const GError        *error);
 
-GtkWidget      *gedit_invalid_character_info_bar_new                   (GFile               *location);
-
 G_END_DECLS
 
 #endif  /* GEDIT_IO_ERROR_INFO_BAR_H  */
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 1ccf50206..eb628a575 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -2324,9 +2324,11 @@ save_cb (GtkSourceFileSaver *saver,
                        /* If we have any invalid char in the document we must warn the user
                         * as it can make the document useless if it is saved.
                         */
-                       info_bar = gedit_invalid_character_info_bar_new (location);
+                       info_bar = GTK_WIDGET (tepl_io_error_info_bar_invalid_characters (location));
                        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 (invalid_character_info_bar_response),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]