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



commit a8a4724fc68b48c03115d0bfb1d641f52f62e496
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Tue Mar 24 13:52:09 2020 +0100

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

 gedit/gedit-io-error-info-bar.c | 31 -------------------------------
 gedit/gedit-io-error-info-bar.h |  3 ---
 gedit/gedit-tab.c               |  7 ++++---
 3 files changed, 4 insertions(+), 37 deletions(-)
---
diff --git a/gedit/gedit-io-error-info-bar.c b/gedit/gedit-io-error-info-bar.c
index cff267972..91159fa06 100644
--- a/gedit/gedit-io-error-info-bar.c
+++ b/gedit/gedit-io-error-info-bar.c
@@ -867,37 +867,6 @@ gedit_unrecoverable_saving_error_info_bar_new (GFile        *location,
        return info_bar;
 }
 
-GtkWidget *
-gedit_externally_modified_info_bar_new (GFile    *location,
-                                       gboolean  document_modified)
-{
-       TeplInfoBar *info_bar;
-       gchar *uri;
-       gchar *primary_msg;
-       const gchar *button_text;
-
-       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);
-
-       uri = g_file_get_parse_name (location);
-       primary_msg = g_strdup_printf (_("The file “%s” changed on disk."), uri);
-       tepl_info_bar_add_primary_message (info_bar, primary_msg);
-       g_free (uri);
-       g_free (primary_msg);
-
-       button_text = document_modified ? _("Drop Changes and _Reload") : _("_Reload");
-       gtk_info_bar_add_button (GTK_INFO_BAR (info_bar),
-                                button_text,
-                                GTK_RESPONSE_OK);
-
-       gtk_info_bar_set_show_close_button (GTK_INFO_BAR (info_bar), TRUE);
-       gtk_info_bar_set_message_type (GTK_INFO_BAR (info_bar), GTK_MESSAGE_WARNING);
-
-       return GTK_WIDGET (info_bar);
-}
-
 GtkWidget *
 gedit_invalid_character_info_bar_new (GFile *location)
 {
diff --git a/gedit/gedit-io-error-info-bar.h b/gedit/gedit-io-error-info-bar.h
index 4e8c15aca..287336c45 100644
--- a/gedit/gedit-io-error-info-bar.h
+++ b/gedit/gedit-io-error-info-bar.h
@@ -45,9 +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_externally_modified_info_bar_new                 (GFile               *location,
-                                                                        gboolean             
document_modified);
-
 GtkWidget      *gedit_invalid_character_info_bar_new                   (GFile               *location);
 
 G_END_DECLS
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index b6c75c907..1ccf50206 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1227,7 +1227,7 @@ externally_modified_notification_info_bar_response (GtkWidget *info_bar,
 static void
 display_externally_modified_notification (GeditTab *tab)
 {
-       GtkWidget *info_bar;
+       TeplInfoBar *info_bar;
        GeditDocument *doc;
        GtkSourceFile *file;
        GFile *location;
@@ -1241,9 +1241,10 @@ display_externally_modified_notification (GeditTab *tab)
        g_return_if_fail (location != NULL);
 
        document_modified = gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc));
-       info_bar = gedit_externally_modified_info_bar_new (location, document_modified);
+       info_bar = tepl_io_error_info_bar_externally_modified (location, document_modified);
+       tepl_info_bar_set_buttons_orientation (info_bar, GTK_ORIENTATION_HORIZONTAL);
 
-       set_info_bar (tab, info_bar, GTK_RESPONSE_OK);
+       set_info_bar (tab, GTK_WIDGET (info_bar), GTK_RESPONSE_OK);
 
        g_signal_connect (info_bar,
                          "response",


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