gtkimmulticontext.c 18.2 KB
Newer Older
1 2 3 4
/* GTK - The GIMP Toolkit
 * Copyright (C) 2000 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6 7 8 9 10 11
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15 16 17 18 19
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

20
#include <config.h>
21

Owen Taylor's avatar
Owen Taylor committed
22 23 24
#include <string.h>
#include <locale.h>

25
#include "gtkimmulticontext.h"
Owen Taylor's avatar
Owen Taylor committed
26
#include "gtkimmodule.h"
27
#include "gtkmain.h"
28
#include "gtkradiomenuitem.h"
29
#include "gtkintl.h"
30
#include "gtkalias.h"
31

32 33 34 35 36 37 38 39 40
/* Do *not* include "gtkprivate.h" in this file. If you do, the
 * the two definitions of GTK_LOCALEDIR will trigger a wrong 
 * warning in gtk_im_multicontext_append_menuitems()
 */

#ifdef __GTK_PRIVATE_H__
#error gtkprivate.h should not be included in this file
#endif

41 42 43 44 45 46 47 48 49 50
struct _GtkIMMulticontextPrivate
{
  GdkWindow *client_window;
  GdkRectangle cursor_location;

  guint use_preedit : 1;
  guint have_cursor_location : 1;
  guint focus_in : 1;
};

51 52 53
static void     gtk_im_multicontext_finalize           (GObject                 *object);

static void     gtk_im_multicontext_set_slave          (GtkIMMulticontext       *multicontext,
54 55
							GtkIMContext            *slave,
							gboolean                 finalizing);
56 57 58 59 60

static void     gtk_im_multicontext_set_client_window  (GtkIMContext            *context,
							GdkWindow               *window);
static void     gtk_im_multicontext_get_preedit_string (GtkIMContext            *context,
							gchar                  **str,
Owen Taylor's avatar
Owen Taylor committed
61 62
							PangoAttrList          **attrs,
							gint                   *cursor_pos);
63 64 65 66
static gboolean gtk_im_multicontext_filter_keypress    (GtkIMContext            *context,
							GdkEventKey             *event);
static void     gtk_im_multicontext_focus_in           (GtkIMContext            *context);
static void     gtk_im_multicontext_focus_out          (GtkIMContext            *context);
Owen Taylor's avatar
Owen Taylor committed
67
static void     gtk_im_multicontext_reset              (GtkIMContext            *context);
68
static void     gtk_im_multicontext_set_cursor_location (GtkIMContext            *context,
69
							GdkRectangle		*area);
70 71
static void     gtk_im_multicontext_set_use_preedit    (GtkIMContext            *context,
							gboolean                 use_preedit);
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
static gboolean gtk_im_multicontext_get_surrounding    (GtkIMContext            *context,
							gchar                  **text,
							gint                    *cursor_index);
static void     gtk_im_multicontext_set_surrounding    (GtkIMContext            *context,
							const char              *text,
							gint                     len,
							gint                     cursor_index);

static void     gtk_im_multicontext_preedit_start_cb        (GtkIMContext      *slave,
							     GtkIMMulticontext *multicontext);
static void     gtk_im_multicontext_preedit_end_cb          (GtkIMContext      *slave,
							     GtkIMMulticontext *multicontext);
static void     gtk_im_multicontext_preedit_changed_cb      (GtkIMContext      *slave,
							     GtkIMMulticontext *multicontext);
static void     gtk_im_multicontext_commit_cb               (GtkIMContext      *slave,
							     const gchar       *str,
							     GtkIMMulticontext *multicontext);
static gboolean gtk_im_multicontext_retrieve_surrounding_cb (GtkIMContext      *slave,
							     GtkIMMulticontext *multicontext);
static gboolean gtk_im_multicontext_delete_surrounding_cb   (GtkIMContext      *slave,
							     gint               offset,
							     gint               n_chars,
							     GtkIMMulticontext *multicontext);
95

Owen Taylor's avatar
Owen Taylor committed
96 97
static const gchar *global_context_id = NULL;

Matthias Clasen's avatar
Matthias Clasen committed
98
G_DEFINE_TYPE (GtkIMMulticontext, gtk_im_multicontext, GTK_TYPE_IM_CONTEXT)
99 100 101 102 103 104 105 106 107 108 109 110

static void
gtk_im_multicontext_class_init (GtkIMMulticontextClass *class)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
  GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class);
  
  im_context_class->set_client_window = gtk_im_multicontext_set_client_window;
  im_context_class->get_preedit_string = gtk_im_multicontext_get_preedit_string;
  im_context_class->filter_keypress = gtk_im_multicontext_filter_keypress;
  im_context_class->focus_in = gtk_im_multicontext_focus_in;
  im_context_class->focus_out = gtk_im_multicontext_focus_out;
Owen Taylor's avatar
Owen Taylor committed
111
  im_context_class->reset = gtk_im_multicontext_reset;
112
  im_context_class->set_cursor_location = gtk_im_multicontext_set_cursor_location;
113
  im_context_class->set_use_preedit = gtk_im_multicontext_set_use_preedit;
114 115
  im_context_class->set_surrounding = gtk_im_multicontext_set_surrounding;
  im_context_class->get_surrounding = gtk_im_multicontext_get_surrounding;
116 117

  gobject_class->finalize = gtk_im_multicontext_finalize;
118 119

  g_type_class_add_private (gobject_class, sizeof (GtkIMMulticontextPrivate));   
120 121 122 123 124 125
}

static void
gtk_im_multicontext_init (GtkIMMulticontext *multicontext)
{
  multicontext->slave = NULL;
126
  
127
  multicontext->priv = G_TYPE_INSTANCE_GET_PRIVATE (multicontext, GTK_TYPE_IM_MULTICONTEXT, GtkIMMulticontextPrivate);
128 129 130
  multicontext->priv->use_preedit = TRUE;
  multicontext->priv->have_cursor_location = FALSE;
  multicontext->priv->focus_in = FALSE;
131 132
}

Matthias Clasen's avatar
Matthias Clasen committed
133 134 135 136 137 138 139
/**
 * gtk_im_multicontext_new:
 *
 * Creates a new #GtkIMMulticontext.
 *
 * Returns: a new #GtkIMMulticontext.
 **/
140 141 142
GtkIMContext *
gtk_im_multicontext_new (void)
{
Manish Singh's avatar
Manish Singh committed
143
  return g_object_new (GTK_TYPE_IM_MULTICONTEXT, NULL);
144 145 146 147 148
}

static void
gtk_im_multicontext_finalize (GObject *object)
{
149 150 151
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (object);
  
  gtk_im_multicontext_set_slave (multicontext, NULL, TRUE);
152

Matthias Clasen's avatar
Matthias Clasen committed
153
  G_OBJECT_CLASS (gtk_im_multicontext_parent_class)->finalize (object);
154 155 156 157
}

static void
gtk_im_multicontext_set_slave (GtkIMMulticontext *multicontext,
158 159
			       GtkIMContext      *slave,
			       gboolean           finalizing)
160
{
161
  GtkIMMulticontextPrivate *priv = multicontext->priv;
162 163
  gboolean need_preedit_changed = FALSE;
  
164 165
  if (multicontext->slave)
    {
166 167 168
      if (!finalizing)
	gtk_im_context_reset (multicontext->slave);
      
169
      g_signal_handlers_disconnect_by_func (multicontext->slave,
Manish Singh's avatar
Manish Singh committed
170
					    gtk_im_multicontext_preedit_start_cb,
171 172
					    multicontext);
      g_signal_handlers_disconnect_by_func (multicontext->slave,
Manish Singh's avatar
Manish Singh committed
173
					    gtk_im_multicontext_preedit_end_cb,
174 175
					    multicontext);
      g_signal_handlers_disconnect_by_func (multicontext->slave,
Manish Singh's avatar
Manish Singh committed
176
					    gtk_im_multicontext_preedit_changed_cb,
177 178
					    multicontext);
      g_signal_handlers_disconnect_by_func (multicontext->slave,
Manish Singh's avatar
Manish Singh committed
179
					    gtk_im_multicontext_commit_cb,
180
					    multicontext);
181

182
      g_object_unref (multicontext->slave);
183 184 185
      multicontext->slave = NULL;

      if (!finalizing)
186
	need_preedit_changed = TRUE;
187 188 189 190 191 192
    }
  
  multicontext->slave = slave;

  if (multicontext->slave)
    {
193 194 195 196 197 198 199 200 201 202 203 204 205 206
      g_object_ref (multicontext->slave);

      g_signal_connect (multicontext->slave, "preedit_start",
			G_CALLBACK (gtk_im_multicontext_preedit_start_cb),
			multicontext);
      g_signal_connect (multicontext->slave, "preedit_end",
			G_CALLBACK (gtk_im_multicontext_preedit_end_cb),
			multicontext);
      g_signal_connect (multicontext->slave, "preedit_changed",
			G_CALLBACK (gtk_im_multicontext_preedit_changed_cb),
			multicontext);
      g_signal_connect (multicontext->slave, "commit",
			G_CALLBACK (gtk_im_multicontext_commit_cb),
			multicontext);
207 208 209 210 211 212
      g_signal_connect (multicontext->slave, "retrieve_surrounding",
			G_CALLBACK (gtk_im_multicontext_retrieve_surrounding_cb),
			multicontext);
      g_signal_connect (multicontext->slave, "delete_surrounding",
			G_CALLBACK (gtk_im_multicontext_delete_surrounding_cb),
			multicontext);
213
      
214 215 216 217 218 219 220 221
      if (!priv->use_preedit)	/* Default is TRUE */
	gtk_im_context_set_use_preedit (slave, FALSE);
      if (priv->client_window)
	gtk_im_context_set_client_window (slave, priv->client_window);
      if (priv->have_cursor_location)
	gtk_im_context_set_cursor_location (slave, &priv->cursor_location);
      if (priv->focus_in)
	gtk_im_context_focus_in (slave);
222
    }
223 224 225

  if (need_preedit_changed)
    g_signal_emit_by_name (multicontext, "preedit_changed");
226 227 228 229 230 231
}

static GtkIMContext *
gtk_im_multicontext_get_slave (GtkIMMulticontext *multicontext)
{
  if (!multicontext->slave)
Owen Taylor's avatar
Owen Taylor committed
232
    {
233 234
      GtkIMContext *slave;

Owen Taylor's avatar
Owen Taylor committed
235 236
      if (!global_context_id)
	{
237
	  gchar *locale = _gtk_get_lc_ctype ();
Owen Taylor's avatar
Owen Taylor committed
238
	  global_context_id = _gtk_im_module_get_default_context_id (locale);
239
	  g_free (locale);
Owen Taylor's avatar
Owen Taylor committed
240 241
	}
	
242 243 244 245
      slave = _gtk_im_module_create (global_context_id);
      gtk_im_multicontext_set_slave (multicontext, slave, FALSE);
      g_object_unref (slave);

Owen Taylor's avatar
Owen Taylor committed
246 247
      multicontext->context_id = global_context_id;
    }
248 249 250 251 252 253 254 255 256

  return multicontext->slave;
}

static void
gtk_im_multicontext_set_client_window (GtkIMContext *context,
				       GdkWindow    *window)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
257
  
258 259
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

260
  multicontext->priv->client_window = window;
Owen Taylor's avatar
Owen Taylor committed
261
  
262 263 264 265 266 267 268
  if (slave)
    gtk_im_context_set_client_window (slave, window);
}

static void
gtk_im_multicontext_get_preedit_string (GtkIMContext   *context,
					gchar         **str,
Owen Taylor's avatar
Owen Taylor committed
269 270
					PangoAttrList **attrs,
					gint           *cursor_pos)
271 272 273 274 275
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

  if (slave)
Owen Taylor's avatar
Owen Taylor committed
276
    gtk_im_context_get_preedit_string (slave, str, attrs, cursor_pos);
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
  else
    {
      if (str)
	*str = g_strdup ("");
      if (attrs)
	*attrs = pango_attr_list_new ();
    }
}

static gboolean
gtk_im_multicontext_filter_keypress (GtkIMContext *context,
				     GdkEventKey  *event)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

  if (slave)
    return gtk_im_context_filter_keypress (slave, event);
  else
    return FALSE;
}

static void
gtk_im_multicontext_focus_in (GtkIMContext   *context)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
Owen Taylor's avatar
Owen Taylor committed
303 304 305 306 307 308 309 310
  GtkIMContext *slave;

  /* If the global context type is different from the context we were
   * using before, get rid of the old slave and create a new one
   * for the new global context type.
   */
  if (!multicontext->context_id ||
      strcmp (global_context_id, multicontext->context_id) != 0)
311
    gtk_im_multicontext_set_slave (multicontext, NULL, FALSE);
Owen Taylor's avatar
Owen Taylor committed
312 313

  slave = gtk_im_multicontext_get_slave (multicontext);
314 315 316
  
  multicontext->priv->focus_in = TRUE;
  
317
  if (slave)
Tor Lillqvist's avatar
Tor Lillqvist committed
318
    gtk_im_context_focus_in (slave);
319 320 321 322 323 324 325 326
}

static void
gtk_im_multicontext_focus_out (GtkIMContext   *context)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

327 328
  multicontext->priv->focus_in = FALSE;
  
329
  if (slave)
Tor Lillqvist's avatar
Tor Lillqvist committed
330
    gtk_im_context_focus_out (slave);
331 332
}

Owen Taylor's avatar
Owen Taylor committed
333 334 335 336 337 338 339 340 341 342
static void
gtk_im_multicontext_reset (GtkIMContext   *context)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

  if (slave)
    gtk_im_context_reset (slave);
}

343
static void
344 345
gtk_im_multicontext_set_cursor_location (GtkIMContext   *context,
					 GdkRectangle   *area)
346 347 348 349
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

350 351 352
  multicontext->priv->have_cursor_location = TRUE;
  multicontext->priv->cursor_location = *area;

353
  if (slave)
354
    gtk_im_context_set_cursor_location (slave, area);
355 356
}

357 358 359 360 361 362 363
static void
gtk_im_multicontext_set_use_preedit (GtkIMContext   *context,
				     gboolean	    use_preedit)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

364 365 366 367
  use_preedit = use_preedit != FALSE;

  multicontext->priv->use_preedit = use_preedit;

368 369 370 371
  if (slave)
    gtk_im_context_set_use_preedit (slave, use_preedit);
}

372 373 374 375 376 377 378 379 380
static gboolean
gtk_im_multicontext_get_surrounding (GtkIMContext  *context,
				     gchar        **text,
				     gint          *cursor_index)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

  if (slave)
381
    return gtk_im_context_get_surrounding (slave, text, cursor_index);
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
  else
    {
      if (text)
	*text = NULL;
      if (cursor_index)
	*cursor_index = 0;

      return FALSE;
    }
}

static void
gtk_im_multicontext_set_surrounding (GtkIMContext *context,
				     const char   *text,
				     gint          len,
				     gint          cursor_index)
{
  GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
  GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);

  if (slave)
    gtk_im_context_set_surrounding (slave, text, len, cursor_index);
}

406
static void
407 408 409
gtk_im_multicontext_preedit_start_cb   (GtkIMContext      *slave,
					GtkIMMulticontext *multicontext)
{
410
  g_signal_emit_by_name (multicontext, "preedit_start");
411 412
}

413
static void
414 415 416
gtk_im_multicontext_preedit_end_cb (GtkIMContext      *slave,
				    GtkIMMulticontext *multicontext)
{
417
  g_signal_emit_by_name (multicontext, "preedit_end");
418 419
}

420
static void
421 422 423
gtk_im_multicontext_preedit_changed_cb (GtkIMContext      *slave,
					GtkIMMulticontext *multicontext)
{
424
  g_signal_emit_by_name (multicontext, "preedit_changed");
425 426
}

427
static void
428 429 430 431
gtk_im_multicontext_commit_cb (GtkIMContext      *slave,
			       const gchar       *str,
			       GtkIMMulticontext *multicontext)
{
432
  g_signal_emit_by_name (multicontext, "commit", str);;
433 434
}

435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
static gboolean
gtk_im_multicontext_retrieve_surrounding_cb (GtkIMContext      *slave,
					     GtkIMMulticontext *multicontext)
{
  gboolean result;
  
  g_signal_emit_by_name (multicontext, "retrieve_surrounding", &result);

  return result;
}

static gboolean
gtk_im_multicontext_delete_surrounding_cb (GtkIMContext      *slave,
					   gint               offset,
					   gint               n_chars,
					   GtkIMMulticontext *multicontext)
{
  gboolean result;
  
  g_signal_emit_by_name (multicontext, "delete_surrounding",
			 offset, n_chars, &result);

  return result;
}

Owen Taylor's avatar
Owen Taylor committed
460 461 462 463
static void
activate_cb (GtkWidget         *menuitem,
	     GtkIMMulticontext *context)
{
464 465
  if (GTK_CHECK_MENU_ITEM (menuitem)->active)
    {
Manish Singh's avatar
Manish Singh committed
466
      const gchar *id = g_object_get_data (G_OBJECT (menuitem), "gtk-context-id");
Owen Taylor's avatar
Owen Taylor committed
467

468 469 470
      gtk_im_context_reset (GTK_IM_CONTEXT (context));
      
      global_context_id = id;
471
      gtk_im_multicontext_set_slave (context, NULL, FALSE);
472
    }
Owen Taylor's avatar
Owen Taylor committed
473 474
}

475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
static int
pathnamecmp (const char *a,
	     const char *b)
{
#ifndef G_OS_WIN32
  return strcmp (a, b);
#else
  /* Ignore case insensitivity, probably not that relevant here. Just
   * make sure slash and backslash compare equal.
   */
  while (*a && *b)
    if ((G_IS_DIR_SEPARATOR (*a) && G_IS_DIR_SEPARATOR (*b)) ||
	*a == *b)
      a++, b++;
    else
      return (*a - *b);
  return (*a - *b);
#endif
}

Owen Taylor's avatar
Owen Taylor committed
495 496 497 498 499 500 501 502 503 504 505 506 507 508
/**
 * gtk_im_multicontext_append_menuitems:
 * @context: a #GtkIMMultiContext
 * @menushell: a #GtkMenuShell
 * 
 * Add menuitems for various available input methods to a menu;
 * the menuitems, when selected, will switch the input method
 * for the context and the global default input method.
 **/
void
gtk_im_multicontext_append_menuitems (GtkIMMulticontext *context,
				      GtkMenuShell      *menushell)
{
  const GtkIMContextInfo **contexts;
509
  guint n_contexts, i;
510
  GSList *group = NULL;
Owen Taylor's avatar
Owen Taylor committed
511 512 513 514 515 516
  
  _gtk_im_module_list (&contexts, &n_contexts);

  for (i=0; i < n_contexts; i++)
    {
      GtkWidget *menuitem;
517 518
      const gchar *translated_name;
#ifdef ENABLE_NLS
519
      if (contexts[i]->domain && contexts[i]->domain[0])
520
	{
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547
	  if (strcmp (contexts[i]->domain, GETTEXT_PACKAGE) == 0)
	    {
	      /* Same translation domain as GTK+ */
	      if (!(contexts[i]->domain_dirname && contexts[i]->domain_dirname[0]) ||
		  pathnamecmp (contexts[i]->domain_dirname, GTK_LOCALEDIR) == 0)
		{
		  /* Empty or NULL, domain directory, or same as
		   * GTK+. Input method may have a name in the GTK+
		   * message catalog.
		   */
		  translated_name = _(contexts[i]->context_name);
		}
	      else
		{
		  /* Separate domain directory but the same
		   * translation domain as GTK+. We can't call
		   * bindtextdomain() as that would make GTK+ forget
		   * its own messages.
		   */
		  g_warning ("Input method %s should not use GTK's translation domain %s",
			     contexts[i]->context_id, GETTEXT_PACKAGE);
		  /* Try translating the name in GTK+'s domain */
		  translated_name = _(contexts[i]->context_name);
		}
	    }
	  else if (contexts[i]->domain_dirname && contexts[i]->domain_dirname[0])
	    /* Input method has own translation domain and message catalog */
548 549 550 551 552 553 554 555
	    {
	      bindtextdomain (contexts[i]->domain,
			      contexts[i]->domain_dirname);
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
	      bind_textdomain_codeset (contexts[i]->domain, "UTF-8");
#endif
	      translated_name = dgettext (contexts[i]->domain, contexts[i]->context_name);
	    }
556 557 558 559 560
	  else
	    {
	      /* Different translation domain, but no domain directory */
	      translated_name = contexts[i]->context_name;
	    }
561 562
	}
      else
563 564
	/* Empty or NULL domain. We assume that input method does not
	 * want a translated name in this case.
565 566 567 568 569
	 */
	translated_name = contexts[i]->context_name;
#else
      translated_name = contexts[i]->context_name;
#endif
570
      menuitem = gtk_radio_menu_item_new_with_label (group,
571
						     translated_name);
572 573 574 575 576 577 578
      
      if ((global_context_id == NULL && group == NULL) ||
          (global_context_id &&
           strcmp (contexts[i]->context_id, global_context_id) == 0))
        gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
                                        TRUE);
      
Manish Singh's avatar
Manish Singh committed
579
      group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
580
      
581
      g_object_set_data (G_OBJECT (menuitem), I_("gtk-context-id"),
Manish Singh's avatar
Manish Singh committed
582 583 584
			 (char *)contexts[i]->context_id);
      g_signal_connect (menuitem, "activate",
			G_CALLBACK (activate_cb), context);
Owen Taylor's avatar
Owen Taylor committed
585 586 587 588

      gtk_widget_show (menuitem);
      gtk_menu_shell_append (menushell, menuitem);
    }
589 590

  g_free (contexts);
Owen Taylor's avatar
Owen Taylor committed
591 592
}

593 594
#define __GTK_IM_MULTICONTEXT_C__
#include "gtkaliasdef.c"