static void _ibus_input_ctx_create(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending) { const char *obj_path; Eldbus_Object *obj; Eldbus_Proxy *ibus_ctx; unsigned int capabilities = IBUS_CAP_FOCUS | IBUS_CAP_PREEDIT_TEXT | IBUS_CAP_SURROUNDING_TEXT; _check_message_errors(msg); if (!eldbus_message_arguments_get(msg, "o", &obj_path)) { ERR("Error reading message arguments"); goto end; } DBG("Got new IBus input context: '%s'", obj_path); obj = eldbus_object_get(wkb_ibus->conn, IBUS_SERVICE_IBUS, obj_path); wkb_ibus->input_ctx->ibus_ctx = ibus_ctx = eldbus_proxy_get(obj, IBUS_INTERFACE_INPUT_CONTEXT); eldbus_proxy_signal_handler_add(ibus_ctx, "CommitText", _ibus_input_ctx_commit_text, NULL); eldbus_proxy_signal_handler_add(ibus_ctx, "ForwardKeyEvent", _ibus_input_ctx_forward_key_event, NULL); eldbus_proxy_signal_handler_add(ibus_ctx, "UpdatePreeditText", _ibus_input_ctx_update_preedit_text, NULL); eldbus_proxy_signal_handler_add(ibus_ctx, "ShowPreeditText", _ibus_input_ctx_show_preedit_text, NULL); eldbus_proxy_signal_handler_add(ibus_ctx, "HidePreeditText", _ibus_input_ctx_hide_preedit_text, NULL); eldbus_proxy_call(ibus_ctx, "FocusIn", NULL, NULL, -1, ""); eldbus_proxy_call(ibus_ctx, "SetCapabilities", NULL, NULL, -1, "u", capabilities); end: wkb_ibus->input_ctx->pending = NULL; }
Eldbus_Proxy * geo_clue2_location_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path) { Eldbus_Object *obj; Eldbus_Proxy *proxy; EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(bus, NULL); if (!path) path = "/"; obj = eldbus_object_get(conn, bus, path); proxy = eldbus_proxy_get(obj, "org.freedesktop.GeoClue2.Location"); return proxy; }
Eldbus_Proxy * mpris_media_player2_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path) { Eldbus_Object *obj; Eldbus_Proxy *proxy; EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(bus, NULL); if (!path) path = "/org/mpris/MediaPlayer2"; obj = eldbus_object_get(conn, bus, path); proxy = eldbus_proxy_get(obj, "org.mpris.MediaPlayer2"); return proxy; }
static void _ecore_drm_dbus_device_pause_done(uint32_t major, uint32_t minor) { Eldbus_Proxy *proxy; Eldbus_Message *msg; /* try to get the Session proxy */ if (!(proxy = eldbus_proxy_get(dobj, "org.freedesktop.login1.Session"))) { ERR("Could not get eldbus session proxy"); return; } if (!(msg = eldbus_proxy_method_call_new(proxy, "PauseDeviceComplete"))) { ERR("Could not create method call for proxy"); return; } eldbus_message_arguments_append(msg, "uu", major, minor); eldbus_proxy_send(proxy, msg, NULL, NULL, -1); }
static void _wkb_name_acquired_cb(void *data, const Eldbus_Message *msg) { const char *name, *path; _check_message_errors(msg); if (!eldbus_message_arguments_get(msg, "s", &name)) { ERR("Error reading message arguments"); return; } DBG("NameAcquired: '%s'", name); if (strncmp(name, IBUS_INTERFACE_PANEL, strlen(IBUS_INTERFACE_PANEL)) == 0) { wkb_ibus->panel = wkb_ibus_panel_register(wkb_ibus->conn); INF("Registering Panel Interface: %s", wkb_ibus->panel ? "Success" : "Fail"); } else if (strncmp(name, IBUS_INTERFACE_CONFIG, strlen(IBUS_INTERFACE_CONFIG)) == 0) { path = eina_stringshare_printf("%s/wkb-ibus-cfg.eet", efreet_config_home_get()); wkb_ibus->config = wkb_ibus_config_register(wkb_ibus->conn, path); eina_stringshare_del(path); INF("Registering Config Interface: %s", wkb_ibus->config ? "Success" : "Fail"); if (wkb_ibus->config) { Eldbus_Object *obj = eldbus_object_get(wkb_ibus->conn, IBUS_SERVICE_CONFIG, IBUS_PATH_CONFIG); Eldbus_Proxy *config = eldbus_proxy_get(obj, IBUS_INTERFACE_CONFIG); eldbus_proxy_signal_handler_add(config, "ValueChanged", _wkb_config_value_changed_cb, wkb_ibus); } } else { INF("Unexpected name %s, ignoring", name); } }
int efreet_cache_init(void) { char buf[PATH_MAX]; _efreet_cache_log_dom = eina_log_domain_register("efreet_cache", EFREET_DEFAULT_LOG_COLOR); if (_efreet_cache_log_dom < 0) return 0; if (!eina_lock_new(&_lock)) { ERR("Could not create lock"); goto error; } snprintf(buf, sizeof(buf), "%s/efreet", efreet_cache_home_get()); if (!ecore_file_mkpath(buf)) { ERR("Failed to create directory '%s'", buf); } EFREET_EVENT_ICON_CACHE_UPDATE = ecore_event_type_new(); EFREET_EVENT_DESKTOP_CACHE_UPDATE = ecore_event_type_new(); EFREET_EVENT_DESKTOP_CACHE_BUILD = ecore_event_type_new(); themes = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_theme_free)); icons = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_free)); fallbacks = eina_hash_string_superfast_new(EINA_FREE_CB(efreet_cache_icon_fallback_free)); desktops = eina_hash_string_superfast_new(NULL); eldbus_init(); if (efreet_cache_update) { conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); if (conn) { Eldbus_Object *obj; obj = eldbus_object_get(conn, BUS, PATH); proxy = eldbus_proxy_get(obj, INTERFACE); eldbus_proxy_signal_handler_add(proxy, "IconCacheUpdate", icon_cache_update, NULL); eldbus_proxy_signal_handler_add(proxy, "DesktopCacheUpdate", desktop_cache_update, NULL); eldbus_proxy_call(proxy, "Register", on_send_register, NULL, -1, "s", efreet_language_get()); /* * TODO: Needed? eldbus_name_owner_changed_callback_add(conn, BUS, on_name_owner_changed, conn, EINA_TRUE); */ } else { /* TODO: Run cache process directly */ } } return 1; error: if (themes) eina_hash_free(themes); themes = NULL; if (icons) eina_hash_free(icons); icons = NULL; if (fallbacks) eina_hash_free(fallbacks); fallbacks = NULL; if (desktops) eina_hash_free(desktops); desktops = NULL; efreet_cache_edd_shutdown(); return 0; }
Eina_Bool wkb_ibus_connect(void) { Eldbus_Object *obj; if (wkb_ibus->conn) { INF("Already connected to IBus"); return EINA_TRUE; } if (wkb_ibus->address_pending) { INF("IBus address query in progress"); return EINA_FALSE; } if (!wkb_ibus->address) { char *env_addr = getenv(IBUS_ADDRESS_ENV); if (!env_addr) { _wkb_ibus_query_address(); return EINA_FALSE; } DBG("Got IBus address from '%s' environment variable: '%s'", IBUS_ADDRESS_ENV, env_addr); wkb_ibus->address = strdup(env_addr); } INF("Connecting to IBus at address '%s'", wkb_ibus->address); wkb_ibus->conn = eldbus_address_connection_get(wkb_ibus->address); if (!wkb_ibus->conn) { ERR("Error connecting to IBus"); return EINA_FALSE; } eldbus_connection_event_callback_add(wkb_ibus->conn, ELDBUS_CONNECTION_EVENT_DISCONNECTED, _wkb_ibus_disconnected_cb, NULL); wkb_ibus->name_acquired = eldbus_signal_handler_add(wkb_ibus->conn, ELDBUS_FDO_BUS, ELDBUS_FDO_PATH, ELDBUS_FDO_INTERFACE, "NameAcquired", _wkb_name_acquired_cb, wkb_ibus); wkb_ibus->name_lost = eldbus_signal_handler_add(wkb_ibus->conn, ELDBUS_FDO_BUS, ELDBUS_FDO_PATH, ELDBUS_FDO_INTERFACE, "NameLost", _wkb_name_lost_cb, wkb_ibus); /* Config */ eldbus_name_owner_changed_callback_add(wkb_ibus->conn, IBUS_SERVICE_CONFIG, _wkb_name_owner_changed_cb, wkb_ibus, EINA_TRUE); DBG("Requesting ownership of " IBUS_SERVICE_CONFIG); eldbus_name_request(wkb_ibus->conn, IBUS_SERVICE_CONFIG, ELDBUS_NAME_REQUEST_FLAG_REPLACE_EXISTING | ELDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, _wkb_name_request_cb, wkb_ibus); /* Panel */ eldbus_name_owner_changed_callback_add(wkb_ibus->conn, IBUS_SERVICE_PANEL, _wkb_name_owner_changed_cb, wkb_ibus, EINA_TRUE); DBG("Requesting ownership of " IBUS_SERVICE_PANEL); eldbus_name_request(wkb_ibus->conn, IBUS_SERVICE_PANEL, ELDBUS_NAME_REQUEST_FLAG_REPLACE_EXISTING | ELDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE, _wkb_name_request_cb, wkb_ibus); obj = eldbus_object_get(wkb_ibus->conn, IBUS_SERVICE_IBUS, IBUS_PATH_IBUS); wkb_ibus->ibus = eldbus_proxy_get(obj, IBUS_INTERFACE_IBUS); eldbus_proxy_property_get(wkb_ibus->ibus, "GlobalEngine", _ibus_global_engine, NULL); ecore_event_add(WKB_IBUS_CONNECTED, NULL, NULL, NULL); return EINA_TRUE; }