summaryrefslogtreecommitdiff
path: root/src/window-commands.c
diff options
context:
space:
mode:
authorJan-Michael Brummer <jan.brummer@tabos.org>2018-12-27 00:50:06 +0100
committerMichael Catanzaro <mcatanzaro@posteo.net>2018-12-27 16:23:48 +0000
commit52399be9227016babe2a425fdd62a370d0c4298f (patch)
treeeb21ac801808d9ecbcd718ab9d196daf044066e7 /src/window-commands.c
parent7f4ff867a40770b43571d6da3d1178ebab50ca27 (diff)
downloadepiphany-52399be9227016babe2a425fdd62a370d0c4298f.tar.gz
Allow wrap around during tab move
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/399
Diffstat (limited to 'src/window-commands.c')
-rw-r--r--src/window-commands.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/window-commands.c b/src/window-commands.c
index a725d9863..acda6cb5f 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -2251,15 +2251,22 @@ window_cmd_tabs_move_left (GSimpleAction *action,
{
GtkWidget *child;
GtkNotebook *notebook;
- int page;
+ int page, n_pages, to;
notebook = GTK_NOTEBOOK (ephy_window_get_notebook (EPHY_WINDOW (user_data)));
page = gtk_notebook_get_current_page (notebook);
- if (page < 1)
+ n_pages = gtk_notebook_get_n_pages (notebook) - 1;
+
+ if (!n_pages)
return;
+ if (page < 1)
+ to = n_pages;
+ else
+ to = page - 1;
+
child = gtk_notebook_get_nth_page (notebook, page);
- gtk_notebook_reorder_child (notebook, child, page - 1);
+ gtk_notebook_reorder_child (notebook, child, to);
}
void window_cmd_tabs_move_right (GSimpleAction *action,
@@ -2268,16 +2275,22 @@ void window_cmd_tabs_move_right (GSimpleAction *action,
{
GtkWidget *child;
GtkNotebook *notebook;
- int page, n_pages;
+ int page, n_pages, to;
notebook = GTK_NOTEBOOK (ephy_window_get_notebook (EPHY_WINDOW (user_data)));
page = gtk_notebook_get_current_page (notebook);
n_pages = gtk_notebook_get_n_pages (notebook) - 1;
- if (page > n_pages - 1)
+
+ if (!n_pages)
return;
+ if (page > n_pages - 1)
+ to = 0;
+ else
+ to = page + 1;
+
child = gtk_notebook_get_nth_page (notebook, page);
- gtk_notebook_reorder_child (notebook, child, page + 1);
+ gtk_notebook_reorder_child (notebook, child, to);
}
void