Beispiel #1
0
static void
_wkb_name_request_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
   const char *error, *error_msg;
   unsigned int reply;

   DBG("NameRequest callback");

   if (eldbus_message_error_get(msg, &error, &error_msg))
     {
        ERR("DBus message error: %s: %s", error, error_msg);
        goto error;
     }

   if (!eldbus_message_arguments_get(msg, "u", &reply))
     {
        ERR("Error reading message arguments");
        goto error;
     }

   if (reply != ELDBUS_NAME_REQUEST_REPLY_PRIMARY_OWNER &&
       reply != ELDBUS_NAME_REQUEST_REPLY_ALREADY_OWNER)
     {
        ERR("Not primary owner: reply=%d", reply);
        goto error;
     }

   return;

error:
   ecore_idler_add(_wkb_ibus_shutdown_idler, NULL);
}
static void
cb_geo_clue2_location_accuracy(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
   void *user_data = eldbus_pending_data_del(pending, "__user_data");
   const char *error, *error_msg;
   Eldbus_Codegen_Property_Double_Get_Cb cb = data;
   Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
   Eldbus_Message_Iter *variant;
   double v;
   if (eldbus_message_error_get(msg, &error, &error_msg))
     {
        Eldbus_Error_Info error_info = {error, error_msg};
        cb(user_data, pending, "Accuracy", proxy, &error_info, 0);
        return;
     }
   if (!eldbus_message_arguments_get(msg, "v", &variant))
     {
        Eldbus_Error_Info error_info = {"", ""};
        cb(user_data, pending, "Accuracy", proxy, &error_info, 0);
        return;
     }
   if (!eldbus_message_iter_arguments_get(variant, "d", &v))
     {
        Eldbus_Error_Info error_info = {"", ""};
        cb(user_data, pending, "Accuracy", proxy, &error_info, 0);
        return;
     }
   cb(user_data, pending, "Accuracy", proxy, NULL, v);
}
static void
cb_mpris_media_player2_can_raise(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
   void *user_data = eldbus_pending_data_del(pending, "__user_data");
   const char *error, *error_msg;
   Eldbus_Codegen_Property_Bool_Get_Cb cb = data;
   Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
   Eldbus_Message_Iter *variant;
   Eina_Bool v;
   if (eldbus_message_error_get(msg, &error, &error_msg))
     {
        Eldbus_Error_Info error_info = {error, error_msg};
        cb(user_data, pending, "CanRaise", proxy, &error_info, 0);
        return;
     }
   if (!eldbus_message_arguments_get(msg, "v", &variant))
     {
        Eldbus_Error_Info error_info = {"", ""};
        cb(user_data, pending, "CanRaise", proxy, &error_info, 0);
        return;
     }
   if (!eldbus_message_iter_arguments_get(variant, "b", &v))
     {
        Eldbus_Error_Info error_info = {"", ""};
        cb(user_data, pending, "CanRaise", proxy, &error_info, 0);
        return;
     }
   cb(user_data, pending, "CanRaise", proxy, NULL, v);
}
static void
cb_mpris_media_player2_supported_uri_schemes(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
   void *user_data = eldbus_pending_data_del(pending, "__user_data");
   const char *error, *error_msg;
   Eldbus_Codegen_Property_Complex_Get_Cb cb = data;
   Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
   Eldbus_Message_Iter *variant;
   Eina_Value *v, stack_value;
   if (eldbus_message_error_get(msg, &error, &error_msg))
     {
        Eldbus_Error_Info error_info = {error, error_msg};
        cb(user_data, pending, "SupportedUriSchemes", proxy, &error_info, NULL);
        return;
     }
   if (!eldbus_message_arguments_get(msg, "v", &variant))
     {
        Eldbus_Error_Info error_info = {"", ""};
        cb(user_data, pending, "SupportedUriSchemes", proxy, &error_info, NULL);
        return;
     }
   v = eldbus_message_iter_struct_like_to_eina_value(variant);
   eina_value_struct_value_get(v, "arg0", &stack_value);
   cb(user_data, pending, "SupportedUriSchemes", proxy, NULL, &stack_value);
   eina_value_flush(&stack_value);
   eina_value_free(v);
}
static void
_efl_net_control_technology_property_set_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
   Eo *o = data;
   Efl_Net_Control_Technology_Data *pd = efl_data_scope_get(o, MY_CLASS);
   const char *err_name, *err_msg;

   pd->pending = eina_list_remove(pd->pending, pending);
   if (eldbus_message_error_get(msg, &err_name, &err_msg))
     {
        ERR("Could not set property %p: %s=%s", o, err_name, err_msg);
        return;
     }
}
static void
cb_name_owner_has(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
   E_Music_Control_Module_Context *ctxt = data;
   Eina_Bool owner_exists;

   if (eldbus_message_error_get(msg, NULL, NULL))
     return;
   if (!eldbus_message_arguments_get(msg, "b", &owner_exists))
     return;
   if (owner_exists)
     {
        media_player2_player_playback_status_propget(ctxt->mpris2_player,
                                                  cb_playback_status_get, ctxt);
        media_player2_player_metadata_propget(ctxt->mpris2_player,
                                              cb_metadata_get, ctxt);
     }
}
Beispiel #7
0
static void
_ibus_global_engine(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
   const char *error, *error_msg;
   Eldbus_Message_Iter *iter, *desc_iter;
   struct wkb_ibus_engine_desc *desc = NULL;

   if (eldbus_message_error_get(msg, &error, &error_msg))
     {
        DBG("DBus message error: %s: %s", error, error_msg);
        goto end;
     }
   else if (!eldbus_message_arguments_get(msg, "v", &iter))
     {
        DBG("Error reading message arguments");
        goto end;
     }

   if (!eldbus_message_iter_arguments_get(iter, "v", &desc_iter))
     {
        DBG("Error retrieving GlobalEngine property");
        goto end;
     }

   desc = wkb_ibus_engine_desc_from_message_iter(desc_iter);
   if (!desc || !desc->name)
     {
        goto end;
     }

   DBG("Global engine is set to '%s'", desc->name);
   free(desc);
   return;

end:
   INF("Global engine is not set, using default: '%s'", IBUS_DEFAULT_ENGINE);
   eldbus_proxy_call(wkb_ibus->ibus, "SetGlobalEngine",
                     NULL, NULL, -1, "s", IBUS_DEFAULT_ENGINE);
}