本文整理汇总了C++中FcitxLog函数的典型用法代码示例。如果您正苦于以下问题:C++ FcitxLog函数的具体用法?C++ FcitxLog怎么用?C++ FcitxLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FcitxLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FcitxNotificationItemEnable
boolean FcitxNotificationItemEnable(FcitxNotificationItem* notificationitem, FcitxNotificationItemAvailableCallback callback, void* data)
{
if (!callback || notificationitem->callback)
return false;
if (notificationitem->serviceName) {
FcitxLog(ERROR, "This should not happen, please report bug.");
return false;
}
notificationitem->callback = callback;
notificationitem->data = data;
asprintf(¬ificationitem->serviceName, "org.kde.StatusNotifierItem-%u-%d", getpid(), ++notificationitem->index);
/* once we have name, request it first */
DBusError err;
dbus_error_init(&err);
dbus_bus_request_name(notificationitem->conn, notificationitem->serviceName,
DBUS_NAME_FLAG_DO_NOT_QUEUE,
&err);
if (dbus_error_is_set(&err)) {
FcitxLog(WARNING, "NotificationItem Name Error (%s)", err.message);
}
dbus_error_free(&err);
if (notificationitem->available) {
if (notificationitem->callback) {
FcitxNotificationItemRegister(notificationitem);
}
}
return true;
}
示例2: FcitxXkbDBusCreate
void* FcitxXkbDBusCreate(FcitxInstance* instance)
{
FcitxXkbDBus* xkbdbus = fcitx_utils_new(FcitxXkbDBus);
xkbdbus->owner = instance;
do {
FcitxModuleFunctionArg arg;
DBusConnection* conn = InvokeFunction(instance, FCITX_DBUS, GETCONNECTION, arg);
if (conn == NULL) {
FcitxLog(ERROR, "DBus Not initialized");
break;
}
DBusObjectPathVTable fcitxIPCVTable = {NULL, &FcitxXkbDBusEventHandler, NULL, NULL, NULL, NULL };
if (!dbus_connection_register_object_path(conn, FCITX_XKB_PATH,
&fcitxIPCVTable, xkbdbus)) {
FcitxLog(ERROR, "No memory");
break;
}
FcitxModuleFunctionArg args;
FcitxXkbRules* rules = InvokeFunction(instance, FCITX_XKB, GETRULES, args);
if (!rules)
break;
xkbdbus->rules = rules;
xkbdbus->isocodes = FcitxXkbReadIsoCodes(ISOCODES_ISO639_XML, ISOCODES_ISO3166_XML);
return xkbdbus;
} while(0);
free(xkbdbus);
return NULL;
}
示例3: LoadLuaConfig
static int LoadLuaConfig(LuaModule *luamodule) {
int count = 0;
FcitxStringHashSet *sset = FcitxXDGGetFiles("lua", NULL, ".lua");
FcitxStringHashSet *str;
for (str = sset; str != NULL;) {
FcitxStringHashSet *tmp = str->hh.next;
char *path;
FILE *f = FcitxXDGGetFileWithPrefix("lua", str->name, "r", &path);
if (f && path) {
if (LoadExtension(luamodule, path)) {
FcitxLog(INFO, "lua load extension file:%s", path);
++count;
} else {
FcitxLog(ERROR, "LoadExtension() failed");
}
}
if (f) {
fclose(f);
}
if (path) {
free(path);
}
HASH_DEL(sset, str);
free(str->name);
free(str);
str = tmp;
}
return count;
}
示例4: LoadAutoEng
void LoadAutoEng(FcitxAutoEngState* autoEngState)
{
FILE *fp;
char *buf = NULL;
size_t length = 0;
LoadAutoEngConfig(&autoEngState->config);
fp = FcitxXDGGetFileWithPrefix("data", "AutoEngNg.dat", "r", NULL);
if (!fp)
{
FcitxLog(WARNING, "Load AutoEngNg.dat failed");
return;
}
utarray_new(autoEngState->autoEng, &autoeng_icd);
AUTO_ENG autoeng;
while (getline(&buf, &length, fp) != -1) {
char* line = fcitx_utils_trim(buf);
if (strlen(line) > MAX_AUTO_TO_ENG)
FcitxLog(WARNING, _("Too long item for AutoEngNg"));
strncpy(autoeng.str, line, MAX_AUTO_TO_ENG);
free(line);
autoeng.str[MAX_AUTO_TO_ENG] = '\0';
utarray_push_back(autoEngState->autoEng, &autoeng);
}
free(buf);
fclose(fp);
}
示例5: FcitxChewingCreate
/**
* @brief initialize the extra input method
*
* @param arg
* @return successful or not
**/
__EXPORT_API
void* FcitxChewingCreate(FcitxInstance* instance)
{
if (GetFcitxChewingConfigDesc() == NULL)
return NULL;
char* user_path = NULL;
FILE* fp = FcitxXDGGetFileUserWithPrefix("chewing", ".place_holder", "w", NULL);
if (fp)
fclose(fp);
FcitxXDGGetFileUserWithPrefix("chewing", "", NULL, &user_path);
FcitxLog(INFO, "Chewing storage path %s", user_path);
if (0 == chewing_Init(CHEWING_DATADIR, user_path)) {
FcitxLog(DEBUG, "chewing init ok");
} else {
FcitxLog(DEBUG, "chewing init failed");
return NULL;
}
FcitxChewing* chewing = (FcitxChewing*) fcitx_utils_malloc0(sizeof(FcitxChewing));
FcitxGlobalConfig* config = FcitxInstanceGetGlobalConfig(instance);
FcitxInputState *input = FcitxInstanceGetInputState(instance);
FcitxCandidateWordSetChoose(FcitxInputStateGetCandidateList(input), DIGIT_STR_CHOOSE);
bindtextdomain("fcitx-chewing", LOCALEDIR);
chewing->context = chewing_new();
ChewingContext * c = chewing->context;
chewing->owner = instance;
chewing_set_ChiEngMode(c, CHINESE_MODE);
chewing_set_maxChiSymbolLen(c, 16);
// chewing will crash without set page
chewing_set_candPerPage(c, config->iMaxCandWord);
FcitxCandidateWordSetPageSize(FcitxInputStateGetCandidateList(input), config->iMaxCandWord);
chewing_set_selKey(c, selKey, 10);
LoadChewingConfig(&chewing->config);
ConfigChewing(chewing);
FcitxInstanceRegisterIM(
instance,
chewing,
"chewing",
_("Chewing"),
"chewing",
FcitxChewingInit,
FcitxChewingReset,
FcitxChewingDoInput,
FcitxChewingGetCandWords,
NULL,
NULL,
FcitxChewingReloadConfig,
NULL,
1,
"zh_TW"
);
return chewing;
}
示例6: PushCoordinate
// Adds a new coordinate to the stroke buffer, enlarging if necessary
static void PushCoordinate(FcitxTablet* tablet, pt_t newpt) {
*tablet->strokesPtr++ = newpt;
if(tablet->strokesPtr == &tablet->strokesBuffer[tablet->strokesBufferSize]) { // if we overflow the buffer, increase it
FcitxLog(WARNING, "Resizing stroke buffer");
int newsize = tablet->strokesBufferSize + 1024;
pt_t* newbuf = (pt_t*) realloc(tablet->strokesBuffer, sizeof(pt_t)*newsize);
if(newbuf == NULL)
FcitxLog(ERROR, "Failed to allocate more stroke memory");
tablet->strokesBuffer = newbuf;
tablet->strokesPtr = &tablet->strokesBuffer[tablet->strokesBufferSize];
tablet->strokesBufferSize = newsize;
}
}
示例7: LuaCreate
void* LuaCreate(FcitxInstance* instance) {
LuaModule *luamodule = LuaModuleAlloc(instance);
if (luamodule == NULL) {
FcitxLog(ERROR, "LuaModule alloc failed");
goto err;
}
LoadLuaConfig(luamodule);
FcitxIMEventHook hook = {.arg = luamodule,
.func = LuaUpdateCandidateWordHookCallback};
FcitxInstanceRegisterUpdateCandidateWordHook(instance, hook);
FcitxAddon* luaAddon = FcitxAddonsGetAddonByName(
FcitxInstanceGetAddons(instance),
FCITX_LUA_NAME);
AddFunction(luaAddon, LuaCallCommand);
return luamodule;
err:
if (luamodule) {
LuaModuleFree(luamodule);
}
return NULL;
}
示例8: _changed_cb
static void _changed_cb(DBusGProxy* proxy, char* service, char* old_owner, char* new_owner, gpointer user_data)
{
FcitxLog(LOG_LEVEL, "_changed_cb");
FcitxIMClient* client = (FcitxIMClient*) user_data;
if (g_str_equal(service, client->servicename))
{
gboolean new_owner_good = new_owner && (new_owner[0] != '\0');
if (new_owner_good)
{
if (client->proxy)
{
g_object_unref(client->proxy);
client->proxy = NULL;
}
if (client->icproxy)
{
g_object_unref(client->icproxy);
client->icproxy = NULL;
}
FcitxIMClientCreateIC(client);
}
}
}
示例9: CloudPinyinAddCandidateWord
void CloudPinyinAddCandidateWord(void* arg)
{
FcitxCloudPinyin* cloudpinyin = (FcitxCloudPinyin*) arg;
FcitxIM* im = FcitxInstanceGetCurrentIM(cloudpinyin->owner);
FcitxInputState* input = FcitxInstanceGetInputState(cloudpinyin->owner);
if (cloudpinyin->initialized == false)
return;
/* check whether the current im is pinyin */
if (CHECK_VALID_IM)
{
/* there is something pending input */
if (FcitxInputStateGetRawInputBufferSize(input) >= cloudpinyin->config.iMinimumPinyinLength)
{
char* strToFree = NULL, *inputString;
strToFree = GetCurrentString(cloudpinyin);
inputString = SplitHZAndPY(strToFree);
if (inputString)
{
CloudPinyinCache* cacheEntry = CloudPinyinCacheLookup(cloudpinyin, inputString);
FcitxLog(LOGLEVEL, "%s", inputString);
if (cacheEntry == NULL)
CloudPinyinAddInputRequest(cloudpinyin, inputString);
_CloudPinyinAddCandidateWord(cloudpinyin, inputString);
}
if (strToFree)
free(strToFree);
}
}
return;
}
示例10: LoadQuickPhraseConfig
boolean LoadQuickPhraseConfig(QuickPhraseState* qpstate)
{
FcitxConfigFileDesc* configDesc = GetQuickPhraseConfigDesc();
if (configDesc == NULL)
return false;
FILE *fp;
char *file;
fp = FcitxXDGGetFileUserWithPrefix("conf", "fcitx-quickphrase.config", "r", &file);
FcitxLog(DEBUG, "Load Config File %s", file);
free(file);
if (!fp) {
if (errno == ENOENT)
SaveQuickPhraseConfig(qpstate);
}
FcitxConfigFile *cfile = FcitxConfigParseConfigFileFp(fp, configDesc);
QuickPhraseStateConfigBind(qpstate, cfile, configDesc);
FcitxConfigBindSync((FcitxGenericConfig*)qpstate);
if (fp)
fclose(fp);
return true;
}
示例11: fcitx_im_context_focus_out
static void
fcitx_im_context_focus_out(GtkIMContext *context)
{
FcitxLog(LOG_LEVEL, "fcitx_im_context_focus_out");
FcitxIMContext *fcitxcontext = FCITX_IM_CONTEXT(context);
if (!fcitxcontext->has_focus) {
return;
}
g_assert (context == _focus_im_context);
g_object_remove_weak_pointer ((GObject *) context,
(gpointer *) &_focus_im_context);
_focus_im_context = NULL;
fcitxcontext->has_focus = false;
if (fcitx_client_is_valid(fcitxcontext->client)) {
fcitx_client_focus_out(fcitxcontext->client);
}
fcitxcontext->cursor_pos = 0;
if (fcitxcontext->preedit_string != NULL) {
g_free(fcitxcontext->preedit_string);
fcitxcontext->preedit_string = NULL;
g_signal_emit(fcitxcontext, _signal_preedit_changed_id, 0);
g_signal_emit(fcitxcontext, _signal_preedit_end_id, 0);
}
gtk_im_context_focus_out(fcitxcontext->slave);
return;
}
示例12: fcitx_im_context_finalize
static void
fcitx_im_context_finalize(GObject *obj)
{
FcitxLog(LOG_LEVEL, "fcitx_im_context_finalize");
FcitxIMContext *context = FCITX_IM_CONTEXT(obj);
fcitx_im_context_set_client_window(GTK_IM_CONTEXT(context), NULL);
g_object_unref(context->client);
context->client = NULL;
if (context->slave) {
g_object_unref(context->slave);
context->slave = NULL;
}
if (context->preedit_string)
g_free(context->preedit_string);
context->preedit_string = NULL;
if (context->attrlist)
pango_attr_list_unref(context->attrlist);
context->attrlist = NULL;
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
示例13: FcitxInitThread
void FcitxInitThread(FcitxInstance* inst)
{
int rc;
rc = pthread_mutex_init(&inst->fcitxMutex, NULL);
if (rc != 0)
FcitxLog(ERROR, _("pthread mutex init failed"));
}
示例14: FcitxNotificationItemRegister
void FcitxNotificationItemRegister(FcitxNotificationItem* notificationitem)
{
if (!notificationitem->serviceName) {
FcitxLog(ERROR, "This should not happen, please report bug.");
return;
}
DBusMessage *message =
dbus_message_new_method_call(NOTIFICATION_WATCHER_DBUS_ADDR,
NOTIFICATION_WATCHER_DBUS_OBJ,
NOTIFICATION_WATCHER_DBUS_IFACE,
"RegisterStatusNotifierItem");
dbus_message_append_args(message,
DBUS_TYPE_STRING, ¬ificationitem->serviceName,
DBUS_TYPE_INVALID);
DBusPendingCall *call = NULL;
dbus_bool_t reply =
dbus_connection_send_with_reply(notificationitem->conn, message,
&call, DBUS_TIMEOUT_USE_DEFAULT);
dbus_message_unref(message);
if (reply == TRUE) {
dbus_pending_call_set_notify(call,
FcitxNotificationItemRegisterSuccess,
notificationitem,
NULL);
dbus_pending_call_unref(call);
}
}
示例15: LoadIMSelectorConfig
boolean LoadIMSelectorConfig(IMSelector* imselector)
{
FcitxConfigFileDesc* configDesc = GetIMSelectorConfig();
if (configDesc == NULL)
return false;
FILE *fp;
char *file;
fp = FcitxXDGGetFileUserWithPrefix("conf", "fcitx-imselector.config", "r", &file);
FcitxLog(DEBUG, "Load Config File %s", file);
free(file);
if (!fp) {
if (errno == ENOENT)
SaveIMSelectorConfig(imselector);
}
FcitxConfigFile *cfile = FcitxConfigParseConfigFileFp(fp, configDesc);
IMSelectorConfigBind(imselector, cfile, configDesc);
FcitxConfigBindSync((FcitxGenericConfig*)imselector);
if (fp)
fclose(fp);
return true;
}