[Xfce4-commits] [apps/xfce4-terminal] 01/01: Implement read-only mode (user input disabled)
noreply at xfce.org
noreply at xfce.org
Thu Aug 18 12:33:26 CEST 2016
This is an automated email from the git hooks/post-receive script.
f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.
commit f2c1a295a3c39de59727f66a6cb107fc62051416
Author: Igor <f2404 at yandex.ru>
Date: Thu Aug 18 13:33:21 2016 +0300
Implement read-only mode (user input disabled)
---
terminal/terminal-screen.c | 10 ++++++++++
terminal/terminal-screen.h | 3 +++
terminal/terminal-window-ui.xml | 3 +++
terminal/terminal-window.c | 15 +++++++++++++++
4 files changed, 31 insertions(+)
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 13dcd00..4442bca 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -2293,3 +2293,13 @@ terminal_screen_search_find_previous (TerminalScreen *screen)
terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
vte_terminal_search_find_previous (VTE_TERMINAL (screen->terminal));
}
+
+
+
+void
+terminal_screen_set_input_enabled (TerminalScreen *screen,
+ gboolean enabled)
+{
+ terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
+ vte_terminal_set_input_enabled (VTE_TERMINAL (screen->terminal), enabled);
+}
diff --git a/terminal/terminal-screen.h b/terminal/terminal-screen.h
index 50469fb..1351b5a 100644
--- a/terminal/terminal-screen.h
+++ b/terminal/terminal-screen.h
@@ -109,6 +109,9 @@ void terminal_screen_search_find_previous (TerminalScreen *scree
void terminal_screen_update_font (TerminalScreen *screen);
+void terminal_screen_set_input_enabled (TerminalScreen *screen,
+ gboolean enabled);
+
G_END_DECLS
#endif /* !TERMINAL_SCREEN_H */
diff --git a/terminal/terminal-window-ui.xml b/terminal/terminal-window-ui.xml
index 5248e93..9e50e82 100644
--- a/terminal/terminal-window-ui.xml
+++ b/terminal/terminal-window-ui.xml
@@ -47,6 +47,8 @@
<separator/>
<menuitem action="set-encoding"/>
<separator/>
+ <menuitem action="read-only"/>
+ <separator/>
<menuitem action="reset"/>
<menuitem action="reset-and-clear"/>
</menu>
@@ -75,6 +77,7 @@
<separator/>
<menuitem action="show-menubar"/>
<menuitem action="fullscreen"/>
+ <menuitem action="read-only"/>
<separator/>
<menuitem action="zoom-in"/>
<menuitem action="zoom-out"/>
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index 49b9177..213f5ba 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -172,6 +172,8 @@ static void terminal_window_action_show_borders (GtkToggleActi
TerminalWindow *window);
static void terminal_window_action_fullscreen (GtkToggleAction *action,
TerminalWindow *window);
+static void terminal_window_action_readonly (GtkToggleAction *action,
+ TerminalWindow *window);
static void terminal_window_action_zoom_in (GtkAction *action,
TerminalWindow *window);
static void terminal_window_action_zoom_out (GtkAction *action,
@@ -262,6 +264,7 @@ static const GtkToggleActionEntry toggle_action_entries[] =
{ "show-toolbar", NULL, N_ ("Show _Toolbar"), NULL, N_ ("Show/hide the toolbar"), G_CALLBACK (terminal_window_action_show_toolbar), FALSE, },
{ "show-borders", NULL, N_ ("Show Window _Borders"), NULL, N_ ("Show/hide the window decorations"), G_CALLBACK (terminal_window_action_show_borders), TRUE, },
{ "fullscreen", "view-fullscreen", N_ ("_Fullscreen"), "F11", N_ ("Toggle fullscreen mode"), G_CALLBACK (terminal_window_action_fullscreen), FALSE, },
+ { "read-only", NULL, N_ ("_Read-Only"), NULL, N_ ("Toggle read-only mode"), G_CALLBACK (terminal_window_action_readonly), FALSE, },
};
@@ -1639,6 +1642,18 @@ terminal_window_action_fullscreen (GtkToggleAction *action,
static void
+terminal_window_action_readonly (GtkToggleAction *action,
+ TerminalWindow *window)
+{
+ terminal_return_if_fail (window->active != NULL);
+
+ terminal_screen_set_input_enabled (window->active,
+ !gtk_toggle_action_get_active (action));
+}
+
+
+
+static void
terminal_window_action_zoom_in (GtkAction *action,
TerminalWindow *window)
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list