From dd899bb530d7759f34a20c234330a54154a7002b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Thu, 29 Jul 2010 20:45:54 +0200 Subject: [PATCH] Add 'Select All' shortcut and menu item --- terminal/terminal-preferences.c | 12 ++++++++++++ terminal/terminal-screen.c | 15 +++++++++++++++ terminal/terminal-screen.h | 2 ++ terminal/terminal-shortcut-editor.c | 1 + terminal/terminal-window-ui.xml | 4 +++- terminal/terminal-window.c | 13 +++++++++++++ 6 files changed, 46 insertions(+), 1 deletions(-) diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c index 0809118..b57f902 100644 --- a/terminal/terminal-preferences.c +++ b/terminal/terminal-preferences.c @@ -50,6 +50,7 @@ enum PROP_ACCEL_COPY, PROP_ACCEL_PASTE, PROP_ACCEL_PASTE_SELECTION, + PROP_ACCEL_SELECT_ALL, PROP_ACCEL_PREFERENCES, PROP_ACCEL_SHOW_MENUBAR, PROP_ACCEL_SHOW_TOOLBARS, @@ -389,6 +390,17 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass) EXO_PARAM_READWRITE)); /** + * TerminalPreferences:accel-select-all: + **/ + g_object_class_install_property (gobject_class, + PROP_ACCEL_SELECT_ALL, + g_param_spec_string ("accel-select-all", + _("Select All"), + "AccelSelectAll", + "a", + EXO_PARAM_READWRITE)); + + /** * TerminalPreferences:accel-preferences: **/ g_object_class_install_property (gobject_class, diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c index 9ba86fb..b6574a2 100644 --- a/terminal/terminal-screen.c +++ b/terminal/terminal-screen.c @@ -1793,6 +1793,21 @@ terminal_screen_paste_primary (TerminalScreen *screen) /** + * terminal_screen_select_all: + * @screen : A #TerminalScreen. + * + * Selects all text in the terminal. + **/ +void +terminal_screen_select_all (TerminalScreen *screen) +{ + terminal_return_if_fail (TERMINAL_IS_SCREEN (screen)); + vte_terminal_select_all (VTE_TERMINAL (screen->terminal)); +} + + + +/** * terminal_screen_reset: * @screen : A #TerminalScreen. * @clear : %TRUE to also clear the terminal screen. diff --git a/terminal/terminal-screen.h b/terminal/terminal-screen.h index 7498409..faee251 100644 --- a/terminal/terminal-screen.h +++ b/terminal/terminal-screen.h @@ -74,6 +74,8 @@ void terminal_screen_copy_clipboard (TerminalScreen *scree void terminal_screen_paste_clipboard (TerminalScreen *screen); void terminal_screen_paste_primary (TerminalScreen *screen); +void terminal_screen_select_all (TerminalScreen *screen); + void terminal_screen_reset (TerminalScreen *screen, gboolean clear); diff --git a/terminal/terminal-shortcut-editor.c b/terminal/terminal-shortcut-editor.c index ed057f2..de3021c 100644 --- a/terminal/terminal-shortcut-editor.c +++ b/terminal/terminal-shortcut-editor.c @@ -101,6 +101,7 @@ static const ToplevelMenu toplevel_menus[] = "accel-copy", "accel-paste", "accel-paste-selection", + "accel-select-all", "accel-preferences", NULL, }, diff --git a/terminal/terminal-window-ui.xml b/terminal/terminal-window-ui.xml index 9709078..cf298b3 100644 --- a/terminal/terminal-window-ui.xml +++ b/terminal/terminal-window-ui.xml @@ -1,7 +1,7 @@ @@ -22,6 +22,8 @@ + + diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c index 6294ef2..04c65e9 100644 --- a/terminal/terminal-window.c +++ b/terminal/terminal-window.c @@ -154,6 +154,8 @@ static void terminal_window_action_paste (GtkAction TerminalWindow *window); static void terminal_window_action_paste_selection (GtkAction *action, TerminalWindow *window); +static void terminal_window_action_select_all (GtkAction *action, + TerminalWindow *window); static void terminal_window_action_edit_toolbars (GtkAction *action, TerminalWindow *window); static void terminal_window_action_prefs (GtkAction *action, @@ -228,6 +230,7 @@ static const GtkActionEntry action_entries[] = { "copy", GTK_STOCK_COPY, N_ ("_Copy"), NULL, N_ ("Copy to clipboard"), G_CALLBACK (terminal_window_action_copy), }, { "paste", GTK_STOCK_PASTE, N_ ("_Paste"), NULL, N_ ("Paste from clipboard"), G_CALLBACK (terminal_window_action_paste), }, { "paste-selection", NULL, N_ ("Paste _Selection"), NULL, N_ ("Paste from primary selection"), G_CALLBACK (terminal_window_action_paste_selection), }, + { "select-all", GTK_STOCK_SELECT_ALL, N_ ("Select _All"), NULL, N_ ("Select all text in the terminal"), G_CALLBACK (terminal_window_action_select_all), }, { "edit-toolbars", NULL, N_ ("_Toolbars..."), NULL, N_ ("Customize the toolbars"), G_CALLBACK (terminal_window_action_edit_toolbars), }, { "preferences", GTK_STOCK_PREFERENCES, N_ ("Pr_eferences..."), NULL, N_ ("Open the Terminal preferences dialog"), G_CALLBACK (terminal_window_action_prefs), }, { "view-menu", NULL, N_ ("_View"), NULL, NULL, NULL, }, @@ -1342,6 +1345,16 @@ terminal_window_action_paste_selection (GtkAction *action, static void +terminal_window_action_select_all (GtkAction *action, + TerminalWindow *window) +{ + if (G_LIKELY (window->active != NULL)) + terminal_screen_select_all (window->active); +} + + + +static void terminal_window_action_edit_toolbars (GtkAction *action, TerminalWindow *window) { -- 1.7.1