Пример #1
0
struct wkb_ibus_attr *
wkb_ibus_attr_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_attr *attr = calloc(1, sizeof(*attr));
   Eldbus_Message_Iter *iter_attr;

   EINA_SAFETY_ON_NULL_RETURN_VAL(attr, NULL);

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}uuuu)", &iter_attr);
   if (!eldbus_message_iter_arguments_get(iter_attr, "sa{sv}uuuu", &ignore.text,
                                          &ignore.dict, &attr->type,
                                          &attr->value, &attr->start_idx,
                                          &attr->end_idx))
     {
        ERR("Error deserializing IBusAttribute");
        wkb_ibus_attr_free(attr);
        attr = NULL;
     }

   DBG("Attribute:");
   DBG("\tType........: '%d'", attr->type);
   DBG("\tValue.......: '%d'", attr->value);
   DBG("\tStart index.: '%d'", attr->start_idx);
   DBG("\tEnd index...: '%d'", attr->end_idx);

   return attr;
}
Пример #2
0
struct wkb_ibus_text *
wkb_ibus_text_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_text *text = calloc(1, sizeof(*text));
   Eldbus_Message_Iter *iter_text, *attrs;

   EINA_SAFETY_ON_NULL_RETURN_VAL(text, NULL);

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}sv)", &iter_text);
   if (!eldbus_message_iter_arguments_get(iter_text, "sa{sv}sv", &ignore.text,
                                          &ignore.dict, &text->text, &attrs))
     {
        ERR("Error deserializing IBusText");
        free(text);
        text = NULL;
        goto end;
     }

   DBG("Text.: '%s'", text->text);

   if (attrs == NULL)
     {
        INF("Text has no attributes");
        goto end;
     }

   text->attrs = _wkb_ibus_attr_list_from_message_iter(attrs);

end:
   return text;
}
Пример #3
0
static void
_sub_path_process(Elm_App_Client *eo, Eldbus_Message_Iter *obj_iter, Elm_App_Client_Data *data, Eina_Bool loading_list)
{
   const char *obj_path;
   Eldbus_Message_Iter *array_iface, *iface;

   eldbus_message_iter_arguments_get(obj_iter, "oa{sa{sv}}", &obj_path, &array_iface);
   while (eldbus_message_iter_get_and_next(array_iface, '{', &iface))
     {
        const char *iface_name;
        Eldbus_Message_Iter *array_props;
        Elm_App_Client_View *view;

        eldbus_message_iter_arguments_get(iface, "sa{sv}", &iface_name,
                                          &array_props);
        if (strcmp(iface_name, "org.enlightenment.ApplicationView1"))
          continue;

        view = eina_hash_find(data->views, obj_path);
        if (view)
          continue;

        view = eo_add(ELM_APP_CLIENT_VIEW_CLASS, eo,
                             elm_app_client_view_path_set(obj_path));
        eina_hash_add(data->views, obj_path, view);
        if (!loading_list)
          eo_do(eo, eo_event_callback_call(ELM_APP_CLIENT_EVENT_VIEW_CREATED, view));
     }
}
Пример #4
0
struct wkb_ibus_engine_desc *
wkb_ibus_engine_desc_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_engine_desc *desc = calloc(1, sizeof(*desc));
   Eldbus_Message_Iter *iter_desc = NULL;

   EINA_SAFETY_ON_NULL_RETURN_VAL(desc, NULL);

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}ssssssssusssssss)", &iter_desc);
   if (!eldbus_message_iter_arguments_get(iter_desc, "sa{sv}ssssssssusssssss",
                                          &ignore.text, &ignore.dict,
                                          &desc->name, &desc->long_name,
                                          &desc->desc, &desc->lang,
                                          &desc->license, &desc->author,
                                          &desc->icon, &desc->layout,
                                          &desc->rank, &desc->hotkeys,
                                          &desc->symbol, &desc->setup,
                                          &desc->layout_variant, &desc->layout_option,
                                          &desc->version, &desc->text_domain))
     {
        ERR("Error deserializing IBusEngineDesc");
        free(desc);
        desc = NULL;
        goto end;
     }

   DBG("Engine description:");
   DBG("\tName...........: %s", desc->name);
   DBG("\tLong Name......: %s", desc->long_name);
   DBG("\tDescription....: %s", desc->desc);
   DBG("\tLanguage.......: %s", desc->lang);
   DBG("\tLicense........: %s", desc->license);
   DBG("\tAuthor.........: %s", desc->author);
   DBG("\tIcon...........: %s", desc->icon);
   DBG("\tLayout.........: %s", desc->layout);
   DBG("\tRank...........: %d", desc->rank);
   DBG("\tHotkeys........: %s", desc->hotkeys);
   DBG("\tSymbol.........: %s", desc->symbol);
   DBG("\tSetup..........: %s", desc->setup);
   DBG("\tLayout variant.: %s", desc->layout_variant);
   DBG("\tLayout option..: %s", desc->layout_option);
   DBG("\tVersion........: %s", desc->version);
   DBG("\tText domain....: %s", desc->text_domain);

end:
   return desc;

}
Пример #5
0
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);
}
Пример #6
0
EAPI void
eldbus_message_iter_dict_iterate(Eldbus_Message_Iter *array, const char *signature, Eldbus_Dict_Cb_Get cb, const void *data)
{
   Eldbus_Message_Iter *entry;
   char *iter_sig;
   unsigned len;
   EINA_SAFETY_ON_FALSE_RETURN(array);
   EINA_SAFETY_ON_NULL_RETURN(signature);

   iter_sig = eldbus_message_iter_signature_get(array);
   len = strlen(iter_sig + 1);
   if (strncmp(signature, iter_sig + 1, len - 1))
     {
        ERR("Unexpected signature, expected is: %s", iter_sig);
        free(iter_sig);
        return;
     }
   free(iter_sig);

   while (eldbus_message_iter_get_and_next(array, 'e', &entry))
     {
        const void *key;
        Eldbus_Message_Iter *var;
        if (!eldbus_message_iter_arguments_get(entry, signature, &key, &var))
          continue;
        cb((void *)data, key, var);
     }
}
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);
}
Пример #8
0
static void
_efl_net_control_technology_property_changed_internal(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *itr)
{
   Eldbus_Message_Iter *value;
   const char *name;

   if (!eldbus_message_iter_arguments_get(itr, "sv", &name, &value))
     {
        ERR("Unexpected signature: %s", eldbus_message_iter_signature_get(itr));
        return;
     }

   if (strcmp(name, "Powered") == 0)
     _efl_net_control_technology_property_powered_changed(o, pd, value);
   else if (strcmp(name, "Connected") == 0)
     _efl_net_control_technology_property_connected_changed(o, pd, value);
   else if (strcmp(name, "Name") == 0)
     _efl_net_control_technology_property_name_changed(o, pd, value);
   else if (strcmp(name, "Type") == 0)
     _efl_net_control_technology_property_type_changed(o, pd, value);
   else if (strcmp(name, "Tethering") == 0)
     _efl_net_control_technology_property_tethering_changed(o, pd, value);
   else if (strcmp(name, "TetheringIdentifier") == 0)
     _efl_net_control_technology_property_tethering_identifier_changed(o, pd, value);
   else if (strcmp(name, "TetheringPassphrase") == 0)
     _efl_net_control_technology_property_tethering_passphrase_changed(o, pd, value);
   else
     WRN("Unknown property name: %s", name);
}
Пример #9
0
static Eina_Array *
_wkb_ibus_attr_list_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   Eldbus_Message_Iter *iter_array, *iter_attr;
   struct wkb_ibus_attr *attr = NULL;
   Eina_Array *attr_list = NULL;

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}av)", &iter_attr);
   if (!eldbus_message_iter_arguments_get(iter_attr, "sa{sv}av", &ignore.text,
                                          &ignore.dict, &iter_array))
     {
        ERR("Error deserializing IBusAttrList");
        goto end;
     }

   if (!iter_array)
     {
        INF("AttrList has no attribute");
        goto end;
     }

   while (eldbus_message_iter_get_and_next(iter_array, 'v', &iter_attr))
     {
        if (!(attr = wkb_ibus_attr_from_message_iter(iter_attr)))
          {
             _free_eina_array(attr_list, (_free_func) free);
             attr_list = NULL;
             goto end;
          }

        if (!attr_list)
            attr_list = eina_array_new(10);

        DBG("Appending new attribute: %p", attr);
        eina_array_push(attr_list, attr);
     }

end:
   return attr_list;
}
Пример #10
0
Eina_Array *
wkb_ibus_properties_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_property *property = NULL;
   Eina_Array *properties = NULL;
   Eldbus_Message_Iter *iter_props, *props, *prop;

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}av)", &iter_props);
   if (!eldbus_message_iter_arguments_get(iter_props, "sa{sv}av", &ignore.text,
                                          &ignore.dict, &props))
     {
        ERR("Error deserializing IBusPropList");
        goto end;
     }

   if (!props)
     {
        INF("PropList has no property");
        goto end;
     }

   while (eldbus_message_iter_get_and_next(props, 'v', &prop))
     {
        if (!(property = wkb_ibus_property_from_message_iter(prop)))
          {
             wkb_ibus_properties_free(properties);
             properties = NULL;
             goto end;
          }

        if (!properties)
           properties = eina_array_new(10);

        DBG("Appending new property %p", property);
        eina_array_push(properties, property);
     }

end:
   return properties;
}
Пример #11
0
static void
hints_dict_iter(void *data, const void *key, Eldbus_Message_Iter *var)
{
   E_Notification_Notify *n = data;
   if (!strcmp(key, "image-data") || !strcmp(key, "image_data"))
     {
        Eldbus_Message_Iter *st, *data_iter;
        int w, h, r, bits, channels;
        Eina_Bool alpha;
        unsigned char *raw_data;
        if (!eldbus_message_iter_arguments_get(var, "(iiibiiay)", &st))
          return;
        if (!eldbus_message_iter_arguments_get(st, "iiibiiay", &w, &h, &r,
                                              &alpha, &bits, &channels,
                                              &data_iter))
          return;
        eldbus_message_iter_fixed_array_get(data_iter, 'y', &raw_data,
                                           &n->icon.raw.data_size);
        n->icon.raw.width = w;
        n->icon.raw.height = h;
        n->icon.raw.has_alpha = alpha;
        n->icon.raw.rowstride = r;
        n->icon.raw.bits_per_sample = bits;
        n->icon.raw.channels = channels;
        n->icon.raw.data = malloc(sizeof(char) * n->icon.raw.data_size);
        EINA_SAFETY_ON_NULL_RETURN(n->icon.raw.data);
        memcpy(n->icon.raw.data, raw_data, sizeof(char) * n->icon.raw.data_size);
     }
   else if (!strcmp(key, "urgency"))
     {
        unsigned char urgency;
        eldbus_message_iter_arguments_get(var, "y", &urgency);
        if (urgency < 3)
          n->urgency = urgency;
     }
   else if (!strcmp(key, "image-path") || !strcmp(key, "image_path"))
     {
        eldbus_message_iter_arguments_get(var, "s", &n->icon.icon_path);
        n->icon.icon_path = eina_stringshare_add(n->icon.icon_path);
     }
}
Пример #12
0
static void
_dump_serializable(struct wkb_ibus_serializable *s)
{
   Eldbus_Message_Iter *entry, *iter;
   const char *str;

   DBG("Serializable:");
   DBG("\tText...: %s", s->text);
   while (eldbus_message_iter_get_and_next(s->dict, 'v', &entry))
     {
        eldbus_message_iter_arguments_get(entry, "sv", &str, &iter);
        DBG("\t\tEntry.: '%s':'%s'", str, eldbus_message_iter_signature_get(iter));
     }
}
Пример #13
0
static void
_efl_net_control_technology_property_name_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
{
   const char *name;

   if (!eldbus_message_iter_arguments_get(value, "s", &name))
     {
        ERR("Expected string, got %s", eldbus_message_iter_signature_get(value));
        return;
     }

   if (!eina_stringshare_replace(&pd->name, name)) return;
   DBG("name=%s", name);
   efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
}
Пример #14
0
static void
_efl_net_control_technology_property_connected_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
{
   Eina_Bool connected;

   if (!eldbus_message_iter_arguments_get(value, "b", &connected))
     {
        ERR("Expected boolean, got %s", eldbus_message_iter_signature_get(value));
        return;
     }

   if (pd->connected == connected) return;
   pd->connected = connected;
   DBG("connected=%hhu", connected);
   efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
}
Пример #15
0
static void
_efl_net_control_technology_property_type_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
{
   const char *str;
   Efl_Net_Control_Technology_Type type;

   if (!eldbus_message_iter_arguments_get(value, "s", &str))
     {
        ERR("Expected string, got %s", eldbus_message_iter_signature_get(value));
        return;
     }

   type = efl_net_connman_technology_type_from_str(str);
   if (pd->type == type) return;
   pd->type = type;
   DBG("type=%d (%s)", type, str);
   efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
}
Пример #16
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);
}
Пример #17
0
struct wkb_ibus_property *
wkb_ibus_property_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_property *prop = calloc(1, sizeof(*prop));
   Eldbus_Message_Iter *iter_prop, *label, *symbol, *tooltip, *sub_props;

   EINA_SAFETY_ON_NULL_RETURN_VAL(prop, NULL);

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}suvsvbbuvv)", &iter_prop);
   if (!eldbus_message_iter_arguments_get(iter_prop, "sa{sv}suvsvbbuvv",
                                          &ignore.text, &ignore.dict,
                                          &prop->key, &prop->type,
                                          &label, &prop->icon, &tooltip,
                                          &prop->sensitive, &prop->visible,
                                          &prop->state, &sub_props, &symbol))
     {
        ERR("Error deserializing IBusProperty");
        free(prop);
        prop = NULL;
        goto end;
     }

   DBG("Property :");
   DBG("\tKey.............: '%s'", prop->key);
   DBG("\tType............: '%d'", prop->type);
   DBG("\tLabel...........: '%p'", label);
   DBG("\tIcon............: '%s'", prop->icon);
   DBG("\tTooltip.........: '%p'", tooltip);
   DBG("\tSensitive.......: '%d'", prop->sensitive);
   DBG("\tVisible.........: '%d'", prop->visible);
   DBG("\tState...........: '%d'", prop->state);
   DBG("\tSub Properties..: '%p'", sub_props);
   DBG("\tSymbol..........: '%p'", symbol);

   if (!label)
     {
        INF("Property has no label");
        goto symbol;
     }

   if (!(prop->label = wkb_ibus_text_from_message_iter(label)))
     {
        wkb_ibus_property_free(prop);
        prop = NULL;
        goto end;
     }

symbol:
   if (!symbol)
     {
        INF("Property has no symbol");
        goto tooltip;
     }

   if (!(prop->symbol = wkb_ibus_text_from_message_iter(symbol)))
     {
        wkb_ibus_property_free(prop);
        prop = NULL;
        goto end;
     }

tooltip:
   if (!tooltip)
     {
        INF("Property has no tooltip");
        goto sub_props;
     }

   if (!(prop->tooltip = wkb_ibus_text_from_message_iter(tooltip)))
     {
        wkb_ibus_property_free(prop);
        prop = NULL;
        goto end;
     }

sub_props:
   if (!sub_props)
     {
        INF("Property has no sub properties");
        goto end;
     }

   prop->sub_properties = wkb_ibus_properties_from_message_iter(sub_props);

end:
   return prop;
}
Пример #18
0
struct wkb_ibus_lookup_table *
wkb_ibus_lookup_table_from_message_iter(Eldbus_Message_Iter *iter)
{
   struct wkb_ibus_serializable ignore = { 0 };
   struct wkb_ibus_lookup_table *table = calloc(1, sizeof(*table));
   struct wkb_ibus_text *text = NULL;
   Eldbus_Message_Iter *iter_table, *candidates, *labels, *t;

   EINA_SAFETY_ON_NULL_RETURN_VAL(table, NULL);

   DBG("Message iter signature '%s'", eldbus_message_iter_signature_get(iter));

   eldbus_message_iter_arguments_get(iter, "(sa{sv}uubbiavav)", &iter_table);
   if (!eldbus_message_iter_arguments_get(iter_table, "sa{sv}uubbiavav",
                                          &ignore.text, &ignore.dict,
                                          &table->page_size, &table->cursor_pos,
                                          &table->cursor_visible, &table->round,
                                          &table->orientation, &candidates,
                                          &labels))
     {
        ERR("Error deserializing IBusLookupTable");
        free(table);
        table = NULL;
        goto end;
     }

   DBG("Lookup table:");
   DBG("\tPage size.......: '%d'", table->page_size);
   DBG("\tCursor position.: '%d'", table->cursor_pos);
   DBG("\tCursor visible..: '%d'", table->cursor_visible);
   DBG("\tRound...........: '%d'", table->round);
   DBG("\tOrientation.....: '%d'", table->orientation);
   DBG("\tCandidates......: '%p'", candidates);
   DBG("\tLabels..........: '%p'", labels);

   if (!candidates)
     {
        INF("Lookup table has no candidates");
        goto labels;
     }

   while (eldbus_message_iter_get_and_next(candidates, 'v', &t))
     {
        if (!(text = wkb_ibus_text_from_message_iter(t)))
          {
             wkb_ibus_lookup_table_free(table);
             table = NULL;
             goto end;
          }

        if (!table->candidates)
           table->candidates = eina_array_new(10);

        DBG("Appending new candidate %s", text->text);
        eina_array_push(table->candidates, text);
     }

labels:
   if (!labels)
     {
        INF("Lookup table has no labels");
        goto end;
     }

   while (eldbus_message_iter_get_and_next(labels, 'v', &t))
     {
        if (!(text = wkb_ibus_text_from_message_iter(t)))
          {
             wkb_ibus_lookup_table_free(table);
             table = NULL;
             goto end;
          }

        if (!table->labels)
           table->labels = eina_array_new(10);

        DBG("Appending new label %s", text->text);
        eina_array_push(table->labels, text);
     }

end:
   return table;
}