|
Packit |
98cdb6 |
/* Copyright (C) 2006 Openismus GmbH
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
98cdb6 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
98cdb6 |
* License as published by the Free Software Foundation; either
|
|
Packit |
98cdb6 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
98cdb6 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
98cdb6 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
98cdb6 |
* Lesser General Public License for more details.
|
|
Packit |
98cdb6 |
*
|
|
Packit |
98cdb6 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
98cdb6 |
* License along with this library; if not, write to the
|
|
Packit |
98cdb6 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Packit |
98cdb6 |
* Boston, MA 02111-1307, USA.
|
|
Packit |
98cdb6 |
*/
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
#include "gtkimcontextmultipress.h"
|
|
Packit |
98cdb6 |
#include <gtk/gtkimmodule.h> /* For GtkIMContextInfo */
|
|
Packit |
98cdb6 |
#include <config.h>
|
|
Packit |
98cdb6 |
#include <glib/gi18n.h>
|
|
Packit |
98cdb6 |
#include <string.h> /* For strcmp() */
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
#define CONTEXT_ID "multipress"
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
/** NOTE: Change the default language from "" to "*" to enable this input method by default for all locales.
|
|
Packit |
98cdb6 |
*/
|
|
Packit |
98cdb6 |
static const GtkIMContextInfo info = {
|
|
Packit |
98cdb6 |
CONTEXT_ID, /* ID */
|
|
Packit |
98cdb6 |
N_("Multipress"), /* Human readable name */
|
|
Packit |
98cdb6 |
GETTEXT_PACKAGE, /* Translation domain. Defined in configure.ac */
|
|
Packit |
98cdb6 |
MULTIPRESS_LOCALEDIR, /* Dir for bindtextdomain (not strictly needed for "gtk+"). Defined in the Makefile.am */
|
|
Packit |
98cdb6 |
"" /* Languages for which this module is the default */
|
|
Packit |
98cdb6 |
};
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
static const GtkIMContextInfo *info_list[] = {
|
|
Packit |
98cdb6 |
&info
|
|
Packit |
98cdb6 |
};
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
#ifndef INCLUDE_IM_multipress
|
|
Packit |
98cdb6 |
#define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
|
|
Packit |
98cdb6 |
#else
|
|
Packit |
98cdb6 |
#define MODULE_ENTRY(type, function) type _gtk_immodule_multipress_ ## function
|
|
Packit |
98cdb6 |
#endif
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
MODULE_ENTRY (void, init) (GTypeModule *module)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
gtk_im_context_multipress_register_type(module);
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
MODULE_ENTRY (void, exit) (void)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
|
|
Packit |
98cdb6 |
int *n_contexts)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
*contexts = info_list;
|
|
Packit |
98cdb6 |
*n_contexts = G_N_ELEMENTS (info_list);
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
|
|
Packit |
98cdb6 |
MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
if (strcmp (context_id, CONTEXT_ID) == 0)
|
|
Packit |
98cdb6 |
{
|
|
Packit |
98cdb6 |
GtkIMContext* imcontext = GTK_IM_CONTEXT(g_object_new (GTK_TYPE_IM_CONTEXT_MULTIPRESS, NULL));
|
|
Packit |
98cdb6 |
return imcontext;
|
|
Packit |
98cdb6 |
}
|
|
Packit |
98cdb6 |
else
|
|
Packit |
98cdb6 |
return NULL;
|
|
Packit |
98cdb6 |
}
|