[gnome-builder/wip/gtk4-port] libide/webkit: add go_back/go_forward API
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port] libide/webkit: add go_back/go_forward API
- Date: Fri, 3 Jun 2022 22:26:15 +0000 (UTC)
commit 52599959c0e5c7370e6ec62823ff2c9767e739a6
Author: Christian Hergert <chergert redhat com>
Date: Fri Jun 3 15:24:35 2022 -0700
libide/webkit: add go_back/go_forward API
src/libide/webkit/ide-webkit-page.c | 42 +++++++++++++++++++++++++++++++++++++
src/libide/webkit/ide-webkit-page.h | 4 ++++
2 files changed, 46 insertions(+)
---
diff --git a/src/libide/webkit/ide-webkit-page.c b/src/libide/webkit/ide-webkit-page.c
index 4bdbd7234..2537ee1ca 100644
--- a/src/libide/webkit/ide-webkit-page.c
+++ b/src/libide/webkit/ide-webkit-page.c
@@ -290,3 +290,45 @@ ide_webkit_page_focus_address (IdeWebkitPage *self)
return gtk_widget_grab_focus (GTK_WIDGET (priv->url_bar));
}
+
+void
+ide_webkit_page_go_back (IdeWebkitPage *self)
+{
+ IdeWebkitPagePrivate *priv = ide_webkit_page_get_instance_private (self);
+ WebKitBackForwardList *list;
+ WebKitBackForwardListItem *item;
+
+ IDE_ENTRY;
+
+ g_return_if_fail (IDE_IS_WEBKIT_PAGE (self));
+
+ list = webkit_web_view_get_back_forward_list (priv->web_view);
+ item = webkit_back_forward_list_get_back_item (list);
+
+ g_return_if_fail (item != NULL);
+
+ webkit_web_view_go_to_back_forward_list_item (priv->web_view, item);
+
+ IDE_EXIT;
+}
+
+void
+ide_webkit_page_go_forward (IdeWebkitPage *self)
+{
+ IdeWebkitPagePrivate *priv = ide_webkit_page_get_instance_private (self);
+ WebKitBackForwardList *list;
+ WebKitBackForwardListItem *item;
+
+ IDE_ENTRY;
+
+ g_return_if_fail (IDE_IS_WEBKIT_PAGE (self));
+
+ list = webkit_web_view_get_back_forward_list (priv->web_view);
+ item = webkit_back_forward_list_get_forward_item (list);
+
+ g_return_if_fail (item != NULL);
+
+ webkit_web_view_go_to_back_forward_list_item (priv->web_view, item);
+
+ IDE_EXIT;
+}
diff --git a/src/libide/webkit/ide-webkit-page.h b/src/libide/webkit/ide-webkit-page.h
index dff09275e..0e73c86ff 100644
--- a/src/libide/webkit/ide-webkit-page.h
+++ b/src/libide/webkit/ide-webkit-page.h
@@ -46,5 +46,9 @@ gboolean ide_webkit_page_get_show_toolbar (IdeWebkitPage *self);
IDE_AVAILABLE_IN_ALL
void ide_webkit_page_set_show_toolbar (IdeWebkitPage *self,
gboolean show_toolbar);
+IDE_AVAILABLE_IN_ALL
+void ide_webkit_page_go_back (IdeWebkitPage *self);
+IDE_AVAILABLE_IN_ALL
+void ide_webkit_page_go_forward (IdeWebkitPage *self);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]