aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-notebook.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ephy-notebook.c')
-rw-r--r--src/ephy-notebook.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 22465ad43..5614ca707 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -396,7 +396,6 @@ static void
update_tabs_visibility (EphyNotebook *nb,
gboolean before_inserting)
{
- EphyNotebookPrivate *priv = nb->priv;
EphyEmbedShellMode mode;
gboolean show_tabs;
guint num;
@@ -777,3 +776,66 @@ ephy_notebook_remove (GtkContainer *container,
update_tabs_visibility (notebook, FALSE);
}
+
+/**
+ * ephy_notebook_next_page:
+ * @notebook: an #EphyNotebook
+ *
+ * Advances to the next page in the @notebook. Note that unlike
+ * gtk_notebook_next_page() this method will wrap around if
+ * #GtkSettings:gtk-keynav-wrap-around is set.
+ **/
+void
+ephy_notebook_next_page (EphyNotebook *notebook)
+{
+ gint current_page, n_pages;
+
+ g_return_if_fail (EPHY_IS_NOTEBOOK (notebook));
+
+ current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
+ n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook));
+
+ if (current_page < n_pages - 1)
+ gtk_notebook_next_page (GTK_NOTEBOOK (notebook));
+ else {
+ gboolean wrap_around;
+
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (notebook)),
+ "gtk-keynav-wrap-around", &wrap_around,
+ NULL);
+
+ if (wrap_around)
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), 0);
+ }
+}
+
+/**
+ * ephy_notebook_prev_page:
+ * @notebook: an #EphyNotebook
+ *
+ * Advances to the previous page in the @notebook. Note that unlike
+ * gtk_notebook_next_page() this method will wrap around if
+ * #GtkSettings:gtk-keynav-wrap-around is set.
+ **/
+void
+ephy_notebook_prev_page (EphyNotebook *notebook)
+{
+ gint current_page;
+
+ g_return_if_fail (EPHY_IS_NOTEBOOK (notebook));
+
+ current_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
+
+ if (current_page > 0)
+ gtk_notebook_prev_page (GTK_NOTEBOOK (notebook));
+ else {
+ gboolean wrap_around;
+
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (notebook)),
+ "gtk-keynav-wrap-around", &wrap_around,
+ NULL);
+
+ if (wrap_around)
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), -1);
+ }
+}