1 /*
2  * pluma-documents-commands.c
3  * This file is part of pluma
4  *
5  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
6  * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
7  * Copyright (C) 2002-2005 Paolo Maggi
8  * Copyright (C) 2012-2021 MATE Developers
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor,
23  * Boston, MA 02110-1301, USA.
24  */
25 
26 /*
27  * Modified by the pluma Team, 1998-2005. See the AUTHORS file for a
28  * list of people on the pluma Team.
29  * See the ChangeLog files for a list of changes.
30  *
31  * $Id$
32  */
33 
34 #ifdef HAVE_CONFIG_H
35 #include <config.h>
36 #endif
37 
38 #include <gtk/gtk.h>
39 
40 #include "pluma-commands.h"
41 #include "pluma-window.h"
42 #include "pluma-notebook.h"
43 #include "pluma-debug.h"
44 
45 void
_pluma_cmd_documents_previous_document(GtkAction * action,PlumaWindow * window)46 _pluma_cmd_documents_previous_document (GtkAction   *action,
47 				       PlumaWindow *window)
48 {
49 	GtkNotebook *notebook;
50 
51 	pluma_debug (DEBUG_COMMANDS);
52 
53 	notebook = GTK_NOTEBOOK (_pluma_window_get_notebook (window));
54 	gtk_notebook_prev_page (notebook);
55 }
56 
57 void
_pluma_cmd_documents_next_document(GtkAction * action,PlumaWindow * window)58 _pluma_cmd_documents_next_document (GtkAction   *action,
59 				   PlumaWindow *window)
60 {
61 	GtkNotebook *notebook;
62 
63 	pluma_debug (DEBUG_COMMANDS);
64 
65 	notebook = GTK_NOTEBOOK (_pluma_window_get_notebook (window));
66 	gtk_notebook_next_page (notebook);
67 }
68 
69 void
_pluma_cmd_documents_move_to_new_window(GtkAction * action,PlumaWindow * window)70 _pluma_cmd_documents_move_to_new_window (GtkAction   *action,
71 					PlumaWindow *window)
72 {
73 	PlumaNotebook *old_notebook;
74 	PlumaTab *tab;
75 
76 	pluma_debug (DEBUG_COMMANDS);
77 
78 	tab = pluma_window_get_active_tab (window);
79 
80 	if (tab == NULL)
81 		return;
82 
83 	old_notebook = PLUMA_NOTEBOOK (_pluma_window_get_notebook (window));
84 
85 	g_return_if_fail (gtk_notebook_get_n_pages (GTK_NOTEBOOK (old_notebook)) > 1);
86 
87 	_pluma_window_move_tab_to_new_window (window, tab);
88 }
89