Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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);
     }
}
Ejemplo n.º 3
0
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;
}