ibus-m17n/ibus-m17n-iok.patch

102 lines
3.7 KiB
Diff
Raw Normal View History

2010-12-08 09:25:29 +00:00
From 17e633c3e3cbfd1a240b95352167005a8396a7b2 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <ueno@unixuser.org>
Date: Wed, 8 Dec 2010 18:06:11 +0900
Subject: [PATCH] Apply iok patch from fedora.
---
src/engine.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/src/engine.c b/src/engine.c
2010-12-08 09:25:29 +00:00
index f8e7fe5..ff8bbfc 100644
--- a/src/engine.c
+++ b/src/engine.c
2010-12-08 09:25:29 +00:00
@@ -35,6 +35,7 @@ struct _IBusM17NEngine {
IBusProperty *status_prop;
2010-09-03 08:30:46 +00:00
IBusProperty *setup_prop;
2009-03-05 04:34:40 +00:00
IBusPropList *prop_list;
+ IBusProperty *show_iok_prop;
};
struct _IBusM17NEngineClass {
2010-12-08 09:25:29 +00:00
@@ -411,6 +412,8 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
{
IBusText* label;
IBusText* tooltip;
+ const gchar *engine_name;
+ gchar *lang = NULL, *name = NULL;
m17n->status_prop = ibus_property_new ("status",
PROP_TYPE_NORMAL,
@@ -436,10 +439,32 @@ ibus_m17n_engine_init (IBusM17NEngine *m17n)
2010-09-03 08:30:46 +00:00
NULL);
g_object_ref_sink (m17n->setup_prop);
2009-03-05 04:34:40 +00:00
2010-12-08 09:25:29 +00:00
+ /* show iok icon for inscript - should be go in default.xml? */
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name) &&
+ (g_strcmp0 (name, "inscript") == 0 ||
+ g_strcmp0 (name, "inscript2") == 0))
+ ibus_property_set_visible (m17n->show_iok_prop, TRUE);
+ g_free (lang);
+ g_free (name);
+
2010-09-03 08:30:46 +00:00
+ label = ibus_text_new_from_string ("iok");
2009-03-05 04:34:40 +00:00
+ m17n->show_iok_prop = ibus_property_new ("iok",
2010-09-03 08:30:46 +00:00
+ PROP_TYPE_NORMAL,
+ label,
+ "/usr/share/pixmaps/iok.xpm",
+ label,
+ TRUE,
+ FALSE,
+ 0,
+ NULL);
2010-02-02 03:25:05 +00:00
+ g_object_ref_sink (m17n->show_iok_prop);
2009-03-05 04:34:40 +00:00
+
m17n->prop_list = ibus_prop_list_new ();
2010-02-02 03:25:05 +00:00
g_object_ref_sink (m17n->prop_list);
2009-03-05 04:34:40 +00:00
ibus_prop_list_append (m17n->prop_list, m17n->status_prop);
2010-09-03 08:30:46 +00:00
ibus_prop_list_append (m17n->prop_list, m17n->setup_prop);
2009-03-05 04:34:40 +00:00
+ ibus_prop_list_append (m17n->prop_list, m17n->show_iok_prop);
m17n->table = ibus_lookup_table_new (9, 0, TRUE, TRUE);
2010-02-02 03:25:05 +00:00
g_object_ref_sink (m17n->table);
2010-12-08 09:25:29 +00:00
@@ -524,6 +549,11 @@ ibus_m17n_engine_destroy (IBusM17NEngine *m17n)
2010-09-03 08:30:46 +00:00
m17n->setup_prop = NULL;
2009-03-05 04:34:40 +00:00
}
2010-02-02 03:25:05 +00:00
+ if (m17n->show_iok_prop) {
+ g_object_unref (m17n->show_iok_prop);
+ m17n->show_iok_prop = NULL;
+ }
2009-03-05 04:34:40 +00:00
+
2010-02-02 03:25:05 +00:00
if (m17n->table) {
g_object_unref (m17n->table);
m17n->table = NULL;
2010-12-08 09:25:29 +00:00
@@ -827,6 +857,22 @@ ibus_m17n_engine_property_activate (IBusEngine *engine,
2010-09-03 08:30:46 +00:00
LIBEXECDIR, engine_name);
g_spawn_command_line_async (setup, NULL);
g_free (setup);
+ } else if (g_strcmp0 (prop_name, "iok") == 0) {
2010-12-08 09:25:29 +00:00
+ const gchar *engine_name;
+ gchar *lang = NULL, *name = NULL;
2009-03-05 04:34:40 +00:00
+
2010-12-08 09:25:29 +00:00
+ engine_name = ibus_engine_get_name ((IBusEngine *) m17n);
+ if (ibus_m17n_scan_engine_name (engine_name, &lang, &name)) {
+ gchar *iok;
2009-03-05 04:34:40 +00:00
+
2010-12-08 09:25:29 +00:00
+ iok = g_strdup_printf ("/usr/bin/iok -n %s", lang);
+ g_debug ("keymap name = %s,prop_name=%s, prop_state=%d",
+ engine_name, prop_name, prop_state);
+ g_spawn_command_line_async(iok, NULL);
+ g_free (iok);
+ }
+ g_free (lang);
+ g_free (name);
2010-09-03 08:30:46 +00:00
}
2009-03-05 04:34:40 +00:00
parent_class->property_activate (engine, prop_name, prop_state);
}
2010-12-08 09:25:29 +00:00
--
1.7.3.3