Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InputMethod View #287

Merged
merged 38 commits into from
Jul 20, 2020
Merged

Add InputMethod View #287

merged 38 commits into from
Jul 20, 2020

Conversation

ryonakano
Copy link
Contributor

@ryonakano ryonakano commented May 7, 2020

Screenshot from 2020-05-24 07-57-31

Fixes #22
Related to #173
Derive from https://github.com/ele-l10n-cjk/switchboard-plug-inputmethod but some code originally brought from Locale Plug or Keyboard View of Keyboard Plug

I would appreciate any opinions, suggestions, or ideas.

Before Testing

@danirabbit
Copy link
Member

Would it be possible to check if the iBus daemon is running and offer to start it in this UI?

@ryonakano
Copy link
Contributor Author

Screenshot from 2020-05-24 07-57-08

@danrabbit Done :)

@ryonakano ryonakano marked this pull request as ready for review May 23, 2020 23:59
@jeremypw
Copy link
Collaborator

I am afraid this crashes for me when I try to switch ibus on (or if it is already on). Looks like an infinite loop of some kind. Terminal output is:

(io.elementary.switchboard:23027): IBUS-CRITICAL **: 09:21:45.965: ibus_serializable_deserialize: assertion 'g_type_is_a (type, IBUS_TYPE_SERIALIZABLE)' failed

(io.elementary.switchboard:23027): GLib-GObject-CRITICAL **: 09:21:45.966: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed

(io.elementary.switchboard:23027): IBUS-CRITICAL **: 09:21:45.966: ibus_serializable_deserialize: assertion 'g_type_is_a (type, IBUS_TYPE_SERIALIZABLE)' failed

(io.elementary.switchboard:23027): GLib-GObject-CRITICAL **: 09:21:45.966: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed

(io.elementary.switchboard:23027): IBUS-CRITICAL **: 09:21:45.966: ibus_serializable_deserialize: assertion 'g_type_is_a (type, IBUS_TYPE_SERIALIZABLE)' failed

(io.elementary.switchboard:23027): GLib-GObject-CRITICAL **: 09:21:45.966: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed

(io.elementary.switchboard:23027): IBUS-CRITICAL **: 09:21:45.966: ibus_serializable_deserialize: assertion 'g_type_is_a (type, IBUS_TYPE_SERIALIZABLE)' failed

(io.elementary.switchboard:23027): GLib-GObject-CRITICAL **: 09:21:45.966: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed

......

(io.elementary.switchboard:23027): IBUS-CRITICAL **: 09:21:45.986: ibus_serializable_deserialize: assertion 'g_type_is_a (type, IBUS_TYPE_SERIALIZABLE)' failed

(io.elementary.switchboard:23027): GLib-GObject-CRITICAL **: 09:21:45.986: g_object_ref_sink: assertion 'G_IS_OBJECT (object)' failed
Segmentation fault


@jeremypw
Copy link
Collaborator

Backtrace is:

#0  0x00007fffe42c9f00 in ibus_engine_desc_get_name () at /usr/lib/x86_64-linux-gnu/libibus-1.0.so.5
#1  0x00007fffe4b1092a in pantheon_keyboard_input_method_page_page_update_engines_list (self=0x555556161a40)
    at /media/jeremy/Shared/shared_data/Vala/Elementary/switchboard plugs/switchboard-plug-keyboard/src/Views/InputMethod.vala:272
#2  0x00007fffe4b11234 in pantheon_keyboard_input_method_page_page_set_visible_view (self=0x555556161a40)
    at /media/jeremy/Shared/shared_data/Vala/Elementary/switchboard plugs/switchboard-plug-keyboard/src/Views/InputMethod.vala:315
#3  0x00007fffe4b13448 in pantheon_keyboard_input_method_page_page_constructor (type=93825002681952, n_construct_properties=0, construct_properties=0x0)
    at /media/jeremy/Shared/shared_data/Vala/Elementary/switchboard plugs/switchboard-plug-keyboard/src/Views/InputMethod.vala:160
#4  0x00007ffff72dae57 in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#5  0x00007ffff72dc5c0 in g_object_new_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#6  0x00007ffff72dc939 in g_object_new () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7  0x00007fffe4b15dc2 in pantheon_keyboard_abstract_page_construct (object_type=93825002681952)
    at /media/jeremy/Shared/shared_data/Vala/Elementary/switchboard plugs/switchboard-plug-keyboard/src/Views/AbstractPage.vala:22
#8  0x00007fffe4b0fc6f in pantheon_keyboard_input_method_page_page_construct (object_type=93825002681952)
    at /media/jeremy/Shared/shared_data/Vala/Elementary/switchboard plugs/switchboard-plug-keyboard/src/Views/InputMethod.vala:34
#9  0x00007fffe4b0fc8a in pantheon_keyboard_input_method_page_page_new ()
    at /media/jeremy/Shared/shared_data/Vala/Elementary/switchboard plugs/switchboard-plug-keyboard/src/Views/InputMethod.vala:34
#10 0x00007fffe4af7466 in pantheon_keyboard_plug_real_get_widget (base=0x555555920450)
    at /media/jeremy/Shared/shared_data/Vala/Elementary/switchboard plugs/switchboard-plug-keyboard/src/Plug.vala:49
#11 0x000055555555b5c1 in  ()
---Type <return> to continue, or q <return> to quit---
#12 0x00007ffff7904285 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff7904650 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff7904962 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff6927a25 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#16 0x000055555555d456 in  ()
#17 0x00007ffff72d510d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#18 0x00007ffff72e7de8 in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007ffff72f0715 in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#20 0x00007ffff72f112f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007ffff75bbc55 in  () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#22 0x00007ffff75bbe66 in g_application_run () at /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#23 0x000055555555d6ee in switchboard_main ()
#24 0x00007ffff609ab97 in __libc_start_main (main=
    0x55555555b2b0 <main>, argc=1, argv=0x7fffffffde28, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffde18) at ../csu/libc-start.c:310
#25 0x000055555555b2ea in _start ()

@ryonakano
Copy link
Contributor Author

@jeremypw Should be good now.

@jeremypw
Copy link
Collaborator

jeremypw commented May 25, 2020

I had problems getting Japanese input to work using yesterday's version but it may not be due to the PR though. I tried ibus-anthy, ibus-mozc, fcitx-mozc and some other input engines. None gave any suggestion list when switched to with <Ctrl>Space or <Ctrl>J even though in the case of mozc and anthy at least the toolbar appears. Logging out or restarting does not fix it. I have ibus-anthy installed and working on a Hera stable install so I am not sure what the problem is.

@danirabbit
Copy link
Member

The "Show icon on system tray" option doesn't appear to do anything. Does this require a special branch of the keyboard indicator?

@ryonakano
Copy link
Contributor Author

ryonakano commented May 26, 2020

@jeremypw Hmm, a new engine should be available soon after you choose it. I've tested on an en_US environment and it works.

Edit: I misunderstood you're saying, now I confirm this issue. A new engine appears in the selection list if I excuse ibus-daemon -drx (even if I don't log out), so we may want to run that command after installing/removing an engine.

Is there a reason why the Japanese language does not offer to install ibus-anthy?

Thanks, I forgot to add this because I don't use it 😅

@jeremypw
Copy link
Collaborator

@ryonakano Thanks - I can now install ibus-anthy. But I still have to log out before I can choose it. Also, if I uninstall ibus-anthy (with AppCenter) and then re-open Switchboard, Japanese-Anthy is still in the list of available engines.

If we can get to the point that it is possible to install and select an input engine, close Switchboard and immediately start using that engine that would be ideal. There is a "Type to test your settings" entry on the Input Method page which implies you should be able to start type e.g. Japanese in that entry once you have selected Japanese-Anthy (and switched to that input method).

I am still having problems getting Japanese input to work on my current laptop although it works perfectly on my old laptop with the same version of elementary and identical settings. Maybe a hardware issue??

@danirabbit
Copy link
Member

@ryonakano we should probably merge that functionality with the keyboard indicator, I'd imagine. So yeah I would say we should probably remove that setting.

Cass and I have been talking about making indicator hiding in one central place and we wouldn't have to implement a bunch of keys across System Settings like this

@ryonakano
Copy link
Contributor Author

I think closing and restarting System Settings is not ideal for the purpose of updating the engines list. Users may feel it crashes.
However, I'm still struggling with how to update the engines list―the installer has install_finished signal so I connected to run spawn_ibus_daemon () but the following warnings are shown for many times……

** (io.elementary.switchboard:15566): CRITICAL **: 22:10:55.699: pantheon_keyboard_input_method_page_add_engines_list_get_engine_full_name: assertion 'self != NULL' failed

(io.elementary.switchboard:15566): GLib-CRITICAL **: 22:10:55.699: g_utf8_strdown: assertion 'str != NULL' failed

** (io.elementary.switchboard:15566): CRITICAL **: 22:10:55.699: string_contains: assertion 'self != NULL' failed
……

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick pass through the code and left some comments.

Regarding some of the apt daemon stuff, do you think it's at all possible to use PackageKit for this instead? I'm sure our Fedora friends would be greatful for that :)

src/InputMethod/Installer/aptd-client.vala Outdated Show resolved Hide resolved
src/Views/InputMethod.vala Outdated Show resolved Hide resolved
src/Views/InputMethod.vala Outdated Show resolved Hide resolved
src/Views/InputMethod.vala Outdated Show resolved Hide resolved
@ryonakano
Copy link
Contributor Author

@danrabbit Thank you for your review, I addressed these points. Regarding the use of PackageKits, I've never used them so I'll check docs and some codes 👀

@jeremypw
Copy link
Collaborator

jeremypw commented Jun 8, 2020

Now requires Odin

@ryonakano
Copy link
Contributor Author

I've been struggling with PackageKit. I found few samples and have not yet understood how to use it…

@danirabbit
Copy link
Member

@ryonakano okay no problem. I'll make a point to take a look at this again Monday. Would be great to have it merged :)

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, let's do this!

@danirabbit danirabbit merged commit 801c13d into master Jul 20, 2020
@danirabbit danirabbit deleted the add-input-method-view branch July 20, 2020 17:43
@ghost
Copy link

ghost commented Jul 23, 2020

Thank you my friends ^_^
Dreams come true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants