summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/terminal-screen.c8
-rw-r--r--src/terminal-window.c48
-rw-r--r--src/terminal.xml1
3 files changed, 55 insertions, 2 deletions
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 66a26a4..c7ea2fc 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -780,8 +780,7 @@ terminal_screen_get_title (TerminalScreen *screen)
{
TerminalScreenPrivate *priv = screen->priv;
- if (priv->cooked_title == NULL)
- terminal_screen_cook_title (screen);
+ terminal_screen_cook_title (screen);
/* cooked_title may still be NULL */
if (priv->cooked_title != NULL)
@@ -901,6 +900,11 @@ terminal_screen_format_title (TerminalScreen *screen,
add_sep = FALSE;
}
+ if (!vte_terminal_get_input_enabled (VTE_TERMINAL (screen)))
+ {
+ g_string_append (title, _(" (Read Only)"));
+ }
+
if (*titleptr == NULL || strcmp (title->str, *titleptr) != 0)
{
g_free (*titleptr);
diff --git a/src/terminal-window.c b/src/terminal-window.c
index da806b4..b383049 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -233,6 +233,8 @@ static void terminal_set_title_callback (GtkAction *action,
TerminalWindow *window);
static void terminal_add_encoding_callback (GtkAction *action,
TerminalWindow *window);
+static void terminal_readonly_toggled_callback (GtkToggleAction *action,
+ TerminalWindow *window);
static void terminal_reset_callback (GtkAction *action,
TerminalWindow *window);
static void terminal_reset_clear_callback (GtkAction *action,
@@ -1052,6 +1054,25 @@ terminal_window_update_encoding_menu_active_encoding (TerminalWindow *window)
}
static void
+terminal_window_update_readonly_checkbox (TerminalWindow *window)
+{
+ TerminalWindowPrivate *priv = window->priv;
+ GtkToggleAction *action;
+ VteTerminal *terminal;
+ gboolean editable;
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ action = GTK_TOGGLE_ACTION (gtk_action_group_get_action (priv->action_group,
+ "TerminalReadOnly"));
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
+ terminal = VTE_TERMINAL (priv->active_screen);
+ editable = vte_terminal_get_input_enabled (terminal);
+
+ gtk_toggle_action_set_active (action, !editable);
+}
+
+static void
terminal_size_to_cb (GtkAction *action,
TerminalWindow *window)
{
@@ -2246,6 +2267,13 @@ terminal_window_init (TerminalWindow *window)
NULL,
G_CALLBACK (view_fullscreen_toggled_callback),
FALSE
+ },
+ /* Terminal Menu */
+ {
+ "TerminalReadOnly", NULL, N_("_Read Only"), "<shift><control>R",
+ NULL,
+ G_CALLBACK (terminal_readonly_toggled_callback),
+ FALSE
}
};
TerminalWindowPrivate *priv;
@@ -3294,6 +3322,7 @@ notebook_page_selected_callback (GtkWidget *notebook,
terminal_window_update_tabs_menu_sensitivity (window);
terminal_window_update_encoding_menu_active_encoding (window);
+ terminal_window_update_readonly_checkbox (window);
terminal_window_update_set_profile_menu_active_profile (window);
terminal_window_update_copy_sensitivity (screen, window);
terminal_window_update_zoom_sensitivity (window);
@@ -4442,6 +4471,25 @@ terminal_add_encoding_callback (GtkAction *action,
}
static void
+terminal_readonly_toggled_callback (GtkToggleAction *action,
+ TerminalWindow *window)
+{
+ TerminalScreen *screen = window->priv->active_screen;
+ gboolean checked;
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ checked = gtk_toggle_action_get_active (action);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
+ vte_terminal_set_input_enabled (VTE_TERMINAL (screen), !checked);
+
+ /* update titles since (Read Only) may be added or removed */
+ sync_screen_icon_title_set (screen, NULL, window);
+ sync_screen_icon_title (screen, NULL, window);
+ sync_screen_title (screen, NULL, window);
+}
+
+static void
terminal_reset_callback (GtkAction *action,
TerminalWindow *window)
{
diff --git a/src/terminal.xml b/src/terminal.xml
index 281dc90..7489b73 100644
--- a/src/terminal.xml
+++ b/src/terminal.xml
@@ -60,6 +60,7 @@
<separator />
<menuitem action="TerminalAddEncoding" />
</menu>
+ <menuitem action="TerminalReadOnly" />
<separator />
<menuitem action="TerminalReset" />
<menuitem action="TerminalResetClear" />