[dia] Bug 341655 - IM selection in text element pop-up
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 341655 - IM selection in text element pop-up
- Date: Sun, 2 Mar 2014 14:56:36 +0000 (UTC)
commit 80d14cc3d53dd72af41319d65685569421f606cb
Author: Hans Breuer <hans breuer org>
Date: Sun Mar 2 15:55:55 2014 +0100
Bug 341655 - IM selection in text element pop-up
The annoying top-level menu is gone now. And there is even less
code needed to do it this way ;)
app/disp_callbacks.c | 13 +++++++++++++
app/display.c | 40 ----------------------------------------
app/menus.c | 2 --
data/display-ui.xml | 1 -
data/integrated-ui.xml | 1 -
data/popup-ui.xml | 1 -
6 files changed, 13 insertions(+), 45 deletions(-)
---
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index ebb5226..2378330 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -355,6 +355,19 @@ popup_object_menu(DDisplay *ddisp, GdkEventButton *bevent)
if (dia_menu->app_data == NULL) {
create_object_menu(dia_menu, TRUE);
+ /* append the Input Methods menu, if there is canvas editable text */
+ if (obj && focus_get_first_on_object(obj) != NULL) {
+ GtkWidget *menuitem = gtk_menu_item_new_with_mnemonic (_("Input _Methods"));
+ GtkWidget *submenu = gtk_menu_new ();
+
+ gtk_widget_show (menuitem);
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+ gtk_menu_shell_append (GTK_MENU_SHELL (dia_menu->app_data), menuitem);
+
+ gtk_im_multicontext_append_menuitems (
+ GTK_IM_MULTICONTEXT(ddisp->im_context),
+ GTK_MENU_SHELL(submenu));
+ }
}
/* Update active/nonactive menuitems */
for (i=0;i<num_items;i++) {
diff --git a/app/display.c b/app/display.c
index 9d60d96..6684a5e 100644
--- a/app/display.c
+++ b/app/display.c
@@ -132,32 +132,6 @@ selection_changed (Diagram* dia, int n, DDisplay* ddisp)
ddisplay_do_update_menu_sensitivity (ddisp);
}
-static void
-append_im_menu (DDisplay* ddisp, GtkAction* action)
-{
- GSList *proxies;
- GtkWidget *im_menu;
- /* GtkWidget *im_menu_tearoff; */
-
- proxies = gtk_action_get_proxies (action);
- while (proxies) {
- if (GTK_IS_MENU_ITEM (proxies->data)) {
- im_menu = gtk_menu_new ();
- /* tearoff should be added depending on gtk settings
- im_menu_tearoff = gtk_tearoff_menu_item_new ();
- gtk_menu_shell_append (GTK_MENU_SHELL(im_menu), im_menu_tearoff);
- */
- gtk_im_multicontext_append_menuitems (
- GTK_IM_MULTICONTEXT(ddisp->im_context),
- GTK_MENU_SHELL(im_menu));
- gtk_menu_item_set_submenu (GTK_MENU_ITEM(proxies->data), im_menu);
- gtk_widget_show (GTK_WIDGET (proxies->data));
- gtk_widget_show (GTK_WIDGET (im_menu));
- }
- proxies = proxies->next;
- }
-}
-
/** Initialize the various GTK-level thinks in a display after the internal
* data has been set.
* @param ddisp A display with all non-GTK/GDK items set.
@@ -166,7 +140,6 @@ static void
initialize_display_widgets(DDisplay *ddisp)
{
GtkAction* im_menu_item;
- static gboolean input_methods_done = FALSE;
Diagram *dia = ddisp->diagram;
gchar *filename;
@@ -193,19 +166,6 @@ initialize_display_widgets(DDisplay *ddisp)
ddisplay_update_statusbar (ddisp);
ddisplay_set_cursor(ddisp, current_cursor);
-
- if (!input_methods_done) {
- im_menu_item = menus_get_action ("InputMethods");
- g_assert (im_menu_item);
- append_im_menu (ddisp, im_menu_item);
- input_methods_done = TRUE;
- }
- /* the diagram menubar gets recreated for every diagram */
- if (ddisp->menu_bar) {
- im_menu_item = gtk_action_group_get_action (ddisp->actions, "InputMethods");
- g_assert (im_menu_item);
- append_im_menu (ddisp, im_menu_item);
- }
}
/** Make a copy of an existing display. The original does not need to have
diff --git a/app/menus.c b/app/menus.c
index 1d3f57c..9017ec5 100644
--- a/app/menus.c
+++ b/app/menus.c
@@ -224,8 +224,6 @@ static const GtkActionEntry display_entries[] =
/* For placment of the toplevel Layout menu and it's accelerator */
{ "Layout", NULL, N_("L_ayout"), NULL, NULL, NULL },
- { "InputMethods", NULL, N_("_Input Methods"), NULL, NULL, NULL },
-
{ "Dialogs", NULL, N_("D_ialogs"), NULL, NULL, NULL },
{ "Debug", NULL, N_("D_ebug"), NULL, NULL, NULL }
diff --git a/data/display-ui.xml b/data/display-ui.xml
index 7abbda6..049de3b 100644
--- a/data/display-ui.xml
+++ b/data/display-ui.xml
@@ -158,7 +158,6 @@
<separator name="ToolsSep2" />
<separator name="ToolsExtensionStart" />
</menu>
- <menuitem name="InputMethods" action="InputMethods" />
<menu name="Dialogs" action="Dialogs">
<separator name="DialogsExtensionStart" />
</menu>
diff --git a/data/integrated-ui.xml b/data/integrated-ui.xml
index 8ac8423..988c6a2 100644
--- a/data/integrated-ui.xml
+++ b/data/integrated-ui.xml
@@ -171,7 +171,6 @@
<separator name="ToolsSep2" />
<separator name="ToolsExtensionStart" />
</menu>
- <menuitem name="InputMethods" action="InputMethods" />
<menu name="Dialogs" action="Dialogs">
<separator name="DialogsExtensionStart" />
</menu>
diff --git a/data/popup-ui.xml b/data/popup-ui.xml
index 228de14..4a4b297 100644
--- a/data/popup-ui.xml
+++ b/data/popup-ui.xml
@@ -158,7 +158,6 @@
<separator name="ToolsSep2" />
<separator name="ToolsExtensionStart" />
</menu>
- <menuitem name="InputMethods" action="InputMethods" />
<menu name="Dialogs" action="Dialogs">
<separator name="DialogsExtensionStart" />
</menu>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]