aboutsummaryrefslogtreecommitdiffstats
path: root/gtk-im/im-module.c
blob: 049aa17a3bb61277d92f4ea30fe86cbbb0128838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 *  Matchbox Keyboard - A lightweight software keyboard.
 *
 *  Author: Ross Burton <ross@o-hand.com>
 *
 *  Copyright (c) 2007-2012 Intel Corp
 *
 *  SPDX-License-Identifier: LGPL-2.1
 *
 */

#include <string.h>
#include <gtk/gtkimmodule.h>
#include "im-context.h"

#define IM_CONTEXT "matchbox-im-invoker"

static const
GtkIMContextInfo im_info = {
  IM_CONTEXT, "Virtual Keyboard",
  /* TODO: localise the above string */
  "", "", "*"
};

static const GtkIMContextInfo *info_list[] = { &im_info };

void
im_module_list(const GtkIMContextInfo ***contexts, guint *n_contexts )
{
  *contexts = info_list;
  *n_contexts = G_N_ELEMENTS (info_list);
}

void
im_module_init(GTypeModule *module)
{
  mb_im_context_register_type (module);
}

void
im_module_exit(void)
{
}

/* returns a new GtkIMContext with the id HILDON_IM_CONTEXT_ID or NULL
 * if given id does not match HILDON_IM_CONTEXT_ID
 */
GtkIMContext *
im_module_create(const gchar *context_id)
{
  if (strcmp (context_id, IM_CONTEXT) == 0) {
    return mb_im_context_new();
  } else {
    return NULL;
  }
}