[gnome-flashback/wip/segeiger/inputmethods: 24/27] Print available engine names and use timeout to change engine to german
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback/wip/segeiger/inputmethods: 24/27] Print available engine names and use timeout to change engine to german
- Date: Fri, 18 Sep 2015 20:15:44 +0000 (UTC)
commit 8e921e5f27b769534cea4961e28d98d8796d8270
Author: Sebastian Geiger <sbastig gmx net>
Date: Tue Sep 15 00:41:25 2015 +0200
Print available engine names and use timeout to change engine to german
gnome-flashback/libinput-sources/gf-ibus-manager.c | 3 +-
.../libinput-sources/gf-input-sources.c | 31 ++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-ibus-manager.c
b/gnome-flashback/libinput-sources/gf-ibus-manager.c
index af5b084..09b057b 100644
--- a/gnome-flashback/libinput-sources/gf-ibus-manager.c
+++ b/gnome-flashback/libinput-sources/gf-ibus-manager.c
@@ -131,7 +131,7 @@ on_register_properties (IBusPanelService *panelService, IBusPropList *properties
static void
onEngineChanged (GfIBusManager *manager, const gchar *engineName)
{
- g_message ("onEngineChanged");
+ g_message ("onEngineChanged: %s", engineName);
if (!manager->ready) {
return;
}
@@ -158,6 +158,7 @@ static void
add_to_engines (IBusEngineDesc *engineDescription, GfIBusManager *manager)
{
const char* name = ibus_engine_desc_get_name (engineDescription);
+ g_message ("EngineName: %s", name);
g_hash_table_insert (manager->engines, (gpointer) name, engineDescription);
}
diff --git a/gnome-flashback/libinput-sources/gf-input-sources.c
b/gnome-flashback/libinput-sources/gf-input-sources.c
index 6926ffe..7c184b9 100644
--- a/gnome-flashback/libinput-sources/gf-input-sources.c
+++ b/gnome-flashback/libinput-sources/gf-input-sources.c
@@ -71,6 +71,34 @@ gf_input_sources_class_init (GfInputSourcesClass *sources_class)
}
static void
+gf_callback (GObject *object, GAsyncResult *result, gpointer user_data)
+{
+ IBusBus *ibus;
+ g_return_if_fail (IBUS_IS_BUS (user_data));
+
+ ibus = IBUS_BUS (object);
+
+ if (result) {
+ GError *error;
+ gboolean success;
+ error = NULL;
+ success = ibus_bus_set_global_engine_async_finish (ibus, result, &error);
+ if (error) {
+ g_log ("gnome-flashback", G_LOG_LEVEL_ERROR, "Error changing engine: %s", error->message);
+ g_error_free (error);
+ }
+ g_message ("Success: %s", success ? "true" : "false");
+ }
+}
+
+static gboolean
+change_ime(GfIBusManager *manager)
+{
+ gf_ibus_manager_set_engine (manager, "xkb:de::ger", gf_callback);
+ return G_SOURCE_REMOVE;
+};
+
+static void
gf_input_sources_init (GfInputSources *sources) {
sources->manager = gf_ibus_manager_new ();
@@ -78,6 +106,9 @@ gf_input_sources_init (GfInputSources *sources) {
g_signal_connect(sources->manager, "properties-registered", G_CALLBACK (properties_registered), sources);
g_signal_connect(sources->manager, "property-updated", G_CALLBACK (property_updated), sources);
g_signal_connect(sources->manager, "set-content-type", G_CALLBACK (set_content_type), sources);
+
+
+ g_timeout_add (2000, change_ime, sources->manager);
}
GfInputSources *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]