[epiphany/wip/exalm/gtk4-cleanups-2: 16/24] window-commands: Stop using gtk_dialog_run() for check-form-and-reload
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/gtk4-cleanups-2: 16/24] window-commands: Stop using gtk_dialog_run() for check-form-and-reload
- Date: Tue, 30 Nov 2021 20:23:48 +0000 (UTC)
commit 94e6484debfd92e3d2c5f6994e1c97946a063086
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
Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1035>
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 ec50c3316..20b77e879 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1158,6 +1158,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,
@@ -1167,7 +1184,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) {
@@ -1186,18 +1202,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]