Exemplo n.º 1
0
void RimeWithWeaselHandler::Initialize()
{
	m_disabled = _IsDeployerRunning();
	if (m_disabled)
	{
		 return;
	}
	LOG(INFO) << "Initializing la rime.";
	RimeSetNotificationHandler(&RimeWithWeaselHandler::OnNotify, this);
	RimeTraits weasel_traits;
	weasel_traits.shared_data_dir = weasel_shared_data_dir();
	weasel_traits.user_data_dir = weasel_user_data_dir();
	const int len = 20;
	char utf8_str[len];
	memset(utf8_str, 0, sizeof(utf8_str));
	WideCharToMultiByte(CP_UTF8, 0, WEASEL_IME_NAME, -1, utf8_str, len - 1, NULL, NULL);
	weasel_traits.distribution_name = utf8_str;
	weasel_traits.distribution_code_name = WEASEL_CODE_NAME;
	weasel_traits.distribution_version = WEASEL_VERSION;
	RimeInitialize(&weasel_traits);
	Bool full_check = False;
	if (RimeStartMaintenance(full_check))
	{
		m_disabled = true;
	}

	RimeConfig config = { NULL };
	if (RimeConfigOpen("weasel", &config))
	{
		_UpdateUIStyle(&config, m_ui);
		_LoadAppOptions(&config, m_app_options);
		RimeConfigClose(&config);
	}
}
Exemplo n.º 2
0
void RimeWithWeaselHandler::Initialize()
{
	m_disabled = _IsDeployerRunning();
	if (m_disabled)
	{
		 return;
	}

	LOG(INFO) << "Initializing la rime.";
	RimeInitialize(NULL);
	if (RimeStartMaintenance(/*full_check = */False))
	{
		m_disabled = true;
	}

	RimeConfig config = { NULL };
	if (RimeConfigOpen("weasel", &config))
	{
		if (m_ui)
		{
			_UpdateUIStyle(&config, m_ui, true);
			m_base_style = m_ui->style();
		}
		_LoadAppOptions(&config, m_app_options);
		RimeConfigClose(&config);
	}
	m_last_schema_id.clear();
}
Exemplo n.º 3
0
void ibus_rime_start(gboolean full_check) {
    char user_data_dir[512] = {0};
    char old_user_data_dir[512] = {0};
    get_ibus_rime_user_data_dir(user_data_dir);
    if (!g_file_test(user_data_dir, G_FILE_TEST_IS_DIR)) {
        get_ibus_rime_old_user_data_dir(old_user_data_dir);
        if (g_file_test(old_user_data_dir, G_FILE_TEST_IS_DIR)) {
            g_rename(old_user_data_dir, user_data_dir);
        }
        else {
            g_mkdir_with_parents(user_data_dir, 0700);
        }
    }
    RimeSetNotificationHandler(notification_handler, NULL);
    RimeTraits ibus_rime_traits;
    ibus_rime_traits.shared_data_dir = IBUS_RIME_SHARED_DATA_DIR;
    ibus_rime_traits.user_data_dir = user_data_dir;
    ibus_rime_traits.distribution_name = DISTRIBUTION_NAME;
    ibus_rime_traits.distribution_code_name = DISTRIBUTION_CODE_NAME;
    ibus_rime_traits.distribution_version = DISTRIBUTION_VERSION;
    RimeInitialize(&ibus_rime_traits);
    RimeStartMaintenance((Bool)full_check);
}
Exemplo n.º 4
0
static void check(JNIEnv *env, jobject thiz, jboolean full_check) {
  RimeStartMaintenance((Bool)full_check);
  if (RimeIsMaintenancing()) RimeJoinMaintenanceThread();
  RimeSetNotificationHandler(&on_message, NULL);
}