Implement 'Select All' for the VTE widget.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5108 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2010-07-29 18:28:37 +00:00
parent b264ba6107
commit 67c7f1bbfb
4 changed files with 43 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2010-07-29 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/keybindings.cm src/vte.cm src/vte.h:
Implement 'Select All' for the VTE widget.
2010-07-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* geany.nsi:

View File

@ -57,6 +57,9 @@
#include "geanywraplabel.h"
#include "main.h"
#include "search.h"
#ifdef HAVE_VTE
# include "vte.h"
#endif
GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */
@ -2479,6 +2482,14 @@ static gboolean cb_func_select_action(guint key_id)
g_signal_emit_by_name(msgwindow.scribble, "select-all", TRUE);
return TRUE;
}
/* special case for Select All in the VTE widget */
#ifdef HAVE_VTE
else if (key_id == GEANY_KEYS_SELECT_ALL && vte_info.load_vte && focusw == vc->vte)
{
vte_select_all();
return TRUE;
}
#endif
/* special case for Select All in the toolbar search widget */
else if (key_id == GEANY_KEYS_SELECT_ALL && focusw == toolbar_search_entry)
{

View File

@ -114,6 +114,7 @@ struct VteFunctions
void (*vte_terminal_set_cursor_blink_mode) (VteTerminal *terminal,
VteTerminalCursorBlinkMode mode);
void (*vte_terminal_set_cursor_blinks) (VteTerminal *terminal, gboolean blink);
void (*vte_terminal_select_all) (VteTerminal *terminal);
};
@ -135,6 +136,7 @@ enum
{
POPUP_COPY,
POPUP_PASTE,
POPUP_SELECTALL,
POPUP_CHANGEPATH,
POPUP_RESTARTTERMINAL,
POPUP_PREFERENCES,
@ -429,6 +431,7 @@ static void vte_register_symbols(GModule *mod)
/* vte_terminal_set_cursor_blink_mode() is only available since 0.17.1, so if we don't find
* this symbol, we are probably on an older version and use the old API instead */
g_module_symbol(mod, "vte_terminal_set_cursor_blinks", (void*)&vf->vte_terminal_set_cursor_blinks);
g_module_symbol(mod, "vte_terminal_select_all", (void*)&vf->vte_terminal_select_all);
}
@ -466,6 +469,11 @@ static void vte_popup_menu_clicked(GtkMenuItem *menuitem, gpointer user_data)
vf->vte_terminal_paste_clipboard(VTE_TERMINAL(vc->vte));
break;
}
case POPUP_SELECTALL:
{
vte_select_all();
break;
}
case POPUP_CHANGEPATH:
{
GeanyDocument *doc = document_get_current();
@ -513,6 +521,15 @@ static GtkWidget *vte_create_popup_menu(void)
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_SELECT_ALL, NULL);
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
g_signal_connect(item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_SELECTALL));
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
item = gtk_image_menu_item_new_with_mnemonic(_("_Set Path From Document"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
@ -881,6 +898,13 @@ void vte_append_preferences_tab(void)
}
void vte_select_all(void)
{
if (vf->vte_terminal_select_all != NULL)
vf->vte_terminal_select_all(VTE_TERMINAL(vc->vte));
}
void vte_send_selection_to_vte(void)
{
GeanyDocument *doc;

View File

@ -79,6 +79,8 @@ void vte_append_preferences_tab(void);
void vte_send_selection_to_vte(void);
void vte_select_all(void);
#endif
#endif