Revision: 710 Author: eht16 Date: 2006-08-13 01:45:59 -0700 (Sun, 13 Aug 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=710&view=rev
Log Message: ----------- Added the GTK IM menu items to the VTE popup menu.
Modified Paths: -------------- trunk/ChangeLog trunk/src/vte.c trunk/src/vte.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-08-13 08:36:52 UTC (rev 709) +++ trunk/ChangeLog 2006-08-13 08:45:59 UTC (rev 710) @@ -3,6 +3,7 @@ * src/document.c: Use wrappers for converting between utf8 and locale encoding. Fixed small memory leak. + * src/vte.c: Added the GTK IM menu items to the VTE popup menu.
2006-08-12 Enrico Tröger enrico.troeger@uvena.de
Modified: trunk/src/vte.c =================================================================== --- trunk/src/vte.c 2006-08-13 08:36:52 UTC (rev 709) +++ trunk/src/vte.c 2006-08-13 08:45:59 UTC (rev 710) @@ -41,6 +41,7 @@ static pid_t pid; static GModule *module = NULL; static struct vte_funcs *vf; +static gboolean popup_menu_created = FALSE;
#define VTE_TERMINAL(obj) (GTK_CHECK_CAST((obj), VTE_TYPE_TERMINAL, VteTerminal)) @@ -135,7 +136,6 @@
vte = vf->vte_terminal_new(); vc->vte = vte; - vc->menu = vte_create_popup_menu(); scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(vte)->adjustment)); GTK_WIDGET_UNSET_FLAGS(scrollbar, GTK_CAN_FOCUS);
@@ -181,7 +181,7 @@ * this prevents a segfault on X close window if the message window is hidden * (patch from Nick Treleaven, thanks) */ gtk_widget_destroy(vc->vte); - gtk_widget_destroy(vc->menu); + if (popup_menu_created) gtk_widget_destroy(vc->menu); g_free(vc->font); g_free(vc->emulation); g_free(vc->color_back); @@ -243,6 +243,13 @@ { if (event->button == 3) { + if (! popup_menu_created) + { + vc->menu = vte_create_popup_menu(); + vf->vte_terminal_im_append_menuitems(VTE_TERMINAL(vc->vte), GTK_MENU_SHELL(vc->im_submenu)); + popup_menu_created = TRUE; + } + gtk_menu_popup(GTK_MENU(vc->menu), NULL, NULL, NULL, NULL, event->button, event->time); }
@@ -283,6 +290,7 @@ g_module_symbol(mod, "vte_terminal_set_color_foreground", (void*)&vf->vte_terminal_set_color_foreground); g_module_symbol(mod, "vte_terminal_set_color_background", (void*)&vf->vte_terminal_set_color_background); g_module_symbol(mod, "vte_terminal_feed_child", (void*)&vf->vte_terminal_feed_child); + g_module_symbol(mod, "vte_terminal_im_append_menuitems", (void*)&vf->vte_terminal_im_append_menuitems); }
@@ -378,6 +386,18 @@ gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect((gpointer)item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(2));
+ item = gtk_separator_menu_item_new(); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); + + vc->im_submenu = gtk_menu_new(); + + item = gtk_image_menu_item_new_with_mnemonic(_("_Input Methods")); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); + + gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), vc->im_submenu); + return menu; }
Modified: trunk/src/vte.h =================================================================== --- trunk/src/vte.h 2006-08-13 08:36:52 UTC (rev 709) +++ trunk/src/vte.h 2006-08-13 08:45:59 UTC (rev 710) @@ -66,8 +66,9 @@
struct vte_conf { - GtkWidget *vte; // small hack, to have always a reference to the widget + GtkWidget *vte; GtkWidget *menu; + GtkWidget *im_submenu; gboolean scroll_on_key; gboolean scroll_on_out; gboolean follow_path; @@ -106,6 +107,7 @@ void (*vte_terminal_set_color_foreground) (VteTerminal *terminal, const GdkColor *foreground); void (*vte_terminal_set_color_background) (VteTerminal *terminal, const GdkColor *background); void (*vte_terminal_feed_child) (VteTerminal *terminal, const char *data, glong length); + void (*vte_terminal_im_append_menuitems) (VteTerminal *terminal, GtkMenuShell *menushell); };
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.