Skip to content

Commit

Permalink
rm more dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Apr 28, 2024
1 parent 903fb5e commit 192cdf4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 46 deletions.
21 changes: 10 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions ibus-gokien/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ impl IEngine for IBusGokienEngine {
}
State::Interrupting => {
gokien.commit_preedit(engine);
// maybe we want to disable TELEX here
unimplemented!();
// FIXME: maybe we want to disable TELEX here
}
State::Backspacing => {
gokien.core.state = State::Typing;
Expand Down
1 change: 0 additions & 1 deletion ribus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition.workspace = true
license.workspace = true

[dependencies]
glib-sys = "0.19.0"
gobject-sys.workspace = true
tracing.workspace = true

Expand Down
1 change: 1 addition & 0 deletions ribus/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ bindgen \
--opaque-type '_IBus[A-DF-NP-Z].*|_G[A-KM-RT-Z].*|_IBusEngineDesc.*|_IBusObserved.*' \
--allowlist-function 'ibus_(bus|component|engine|engine_desc|factory|text).*' \
--allowlist-function 'ibus_main|ibus_quit|ibus_init' \
--allowlist-function 'g_list_free' \
--allowlist-type 'IBus.*' \
--allowlist-var 'IBUS_KEY_([0-9a-zA-Z]{1}|Control.*|Tab|Return.*|Delete|Home|KP_.*|Back.*|Insert|Hyper.*|Shift.*|Caps.*|space|asciitilde)' \
--blocklist-type 'gsize|_?IBus(Serializable|Keymap|Panel|HotkeyProfile|ExtensionEvent|XEvent|Registry|Unicode|Emoji).*' \
Expand Down
1 change: 1 addition & 0 deletions ribus/src/ffi/ibus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,7 @@ pub struct _IBusProcessKeyEventData {
pub _bindgen_opaque_blob: [u32; 3usize],
}
extern "C" {
pub fn g_list_free(list: *mut GList);
pub fn ibus_init();
pub fn ibus_main();
pub fn ibus_quit();
Expand Down
4 changes: 2 additions & 2 deletions ribus/src/iter.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::c::GList;
use crate::c::{g_list_free, GList};

#[derive(Debug)]
pub struct EngineIter {
Expand All @@ -15,7 +15,7 @@ impl EngineIter {
impl Drop for EngineIter {
fn drop(&mut self) {
unsafe {
glib_sys::g_list_free(self.origin.cast());
g_list_free(self.origin);
}
}
}
Expand Down
31 changes: 1 addition & 30 deletions ribus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ use std::ffi::CStr;
use std::fmt::{self, Debug};
use std::ptr;

pub use c::{
IBusBusNameFlag as NameFlag, IBusEngine, IBusEngineClass, IBusObject as Object, IBusObjectClass as ObjectClass,
};
pub use c::{IBusBusNameFlag as NameFlag, IBusEngine, IBusEngineClass};
pub use ffi::ibus as c;
use glib_sys::{g_string_free, g_string_sized_new};
use gobject_sys::{g_object_unref, g_signal_connect_object, g_type_is_a};
use iter::EngineIter;
use tracing::{error, info};
Expand Down Expand Up @@ -104,10 +101,6 @@ impl Bus {
unsafe { c::FALSE != c::ibus_bus_register_component(self.0, component.0) }
}

pub fn get_config(&self) {
unimplemented!()
}

pub fn quit(self) {
Self::quit_inner();
}
Expand Down Expand Up @@ -192,19 +185,6 @@ impl Component {
iter::EngineIter::new(list)
}
}

pub fn output(&self) {
unsafe {
let gs = g_string_sized_new(1024);
if gs.is_null() {
return;
}
c::ibus_component_output(self.0, gs.cast(), 0);
let s = std::slice::from_raw_parts((*gs).str.cast::<u8>(), (*gs).len);
println!("{}", std::str::from_utf8(s).unwrap());
g_string_free(gs, !c::FALSE);
}
}
}

// The recommended way to load engine description data is using
Expand All @@ -222,19 +202,10 @@ impl EngineDesc {
}
}

#[derive(Debug)]
#[repr(transparent)]
pub struct Engine(IBusEngine);

impl Engine {
pub fn new() -> Self {
panic!("use Factory::create_engine instead");
}

pub fn get_name(&self) -> &CStr {
todo!()
}

pub fn is_self(this: *const Self) -> bool {
unsafe { g_type_is_a(g_type_from_instance!(this), Self::get_type()) != c::FALSE }
}
Expand Down

0 comments on commit 192cdf4

Please sign in to comment.