[epiphany/wip/exalm/gtk4-cleanups-2: 19/27] window-commands: Stop using gtk_dialog_run() for check-form-and-reload
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/gtk4-cleanups-2: 19/27] window-commands: Stop using gtk_dialog_run() for check-form-and-reload
- Date: Tue, 30 Nov 2021 15:11:09 +0000 (UTC)
commit b3bc37672162fdb16f2af910e27c7f443b85a103
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Tue Nov 30 16:50:16 2021 +0500
window-commands: Stop using gtk_dialog_run() for check-form-and-reload
src/window-commands.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 3d0bad164..80aa350e8 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1160,6 +1160,23 @@ window_cmd_stop (GSimpleAction *action,
webkit_web_view_stop_loading (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
}
+static void
+check_tab_has_modified_forms_confirm_cb (GtkDialog *dialog,
+ GtkResponseType response,
+ EphyEmbed *embed)
+{
+ WebKitWebView *view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+
+ if (response == GTK_RESPONSE_ACCEPT) {
+ gtk_widget_grab_focus (GTK_WIDGET (embed));
+ webkit_web_view_reload (view);
+ }
+
+ g_object_unref (embed);
+}
+
static void
check_tab_has_modified_forms_and_reload_cb (EphyWebView *view,
GAsyncResult *result,
@@ -1169,7 +1186,6 @@ check_tab_has_modified_forms_and_reload_cb (EphyWebView *view,
GtkWidget *dialog;
GtkWidget *button;
gboolean has_modified_forms;
- int response = GTK_RESPONSE_ACCEPT;
has_modified_forms = ephy_web_view_has_modified_forms_finish (view, result, NULL);
if (has_modified_forms) {
@@ -1188,18 +1204,18 @@ check_tab_has_modified_forms_and_reload_cb (EphyWebView *view,
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (window)),
GTK_WINDOW (dialog));
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- }
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (check_tab_has_modified_forms_confirm_cb), embed);
- if (response == GTK_RESPONSE_ACCEPT) {
- WebKitWebView *view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+ gtk_window_present (GTK_WINDOW (dialog));
- gtk_widget_grab_focus (GTK_WIDGET (embed));
- webkit_web_view_reload (view);
+ return;
}
+ gtk_widget_grab_focus (GTK_WIDGET (embed));
+ webkit_web_view_reload (WEBKIT_WEB_VIEW (view));
+
g_object_unref (embed);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]