forked from enlightenment/enlightenment
e/bluez4: Show errors in dialogs
Patch by: Lucas Joia <lucasjoia@profusion.mobi> SVN revision: 82193
This commit is contained in:
parent
896b8533c9
commit
3f88f455d6
|
@ -374,3 +374,26 @@ ebluez4_update_all_gadgets_visibility()
|
||||||
_ebluez4_search_dialog_del(inst);
|
_ebluez4_search_dialog_del(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ebluez4_show_error(const char *err_name, const char *err_msg)
|
||||||
|
{
|
||||||
|
E_Container *con;
|
||||||
|
E_Dialog *dialog;
|
||||||
|
Evas *evas;
|
||||||
|
Evas_Object *box, *label;
|
||||||
|
int mw, mh;
|
||||||
|
|
||||||
|
con = e_container_current_get(e_manager_current_get());
|
||||||
|
dialog = e_dialog_new(con, "Error Dialog", "error");
|
||||||
|
e_dialog_title_set(dialog, "An error has ocurred");
|
||||||
|
snprintf(tmpbuf, sizeof(tmpbuf), "%s: %s.", err_name, err_msg);
|
||||||
|
evas = e_win_evas_get(dialog->win);
|
||||||
|
label = e_widget_label_add(evas, tmpbuf);
|
||||||
|
box = e_box_add(evas);
|
||||||
|
e_box_pack_start(box, label);
|
||||||
|
e_widget_size_min_get(label, &mw, &mh);
|
||||||
|
e_dialog_content_set(dialog, box, mw+30, mh+30);
|
||||||
|
e_dialog_show(dialog);
|
||||||
|
e_dialog_border_icon_set(dialog, "dialog-error");
|
||||||
|
}
|
||||||
|
|
|
@ -22,5 +22,6 @@ void ebluez4_append_to_instances(void *data, int list_type);
|
||||||
void ebluez4_update_inst(Evas_Object *dest, Eina_List *src, int list_type);
|
void ebluez4_update_inst(Evas_Object *dest, Eina_List *src, int list_type);
|
||||||
void ebluez4_update_instances(Eina_List *src, int list_type);
|
void ebluez4_update_instances(Eina_List *src, int list_type);
|
||||||
void ebluez4_update_all_gadgets_visibility();
|
void ebluez4_update_all_gadgets_visibility();
|
||||||
|
void ebluez4_show_error(const char *err_name, const char *err_msg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -143,6 +143,7 @@ static void
|
||||||
_on_prop_changed(void *context, const EDBus_Message *msg)
|
_on_prop_changed(void *context, const EDBus_Message *msg)
|
||||||
{
|
{
|
||||||
const char *key, *name;
|
const char *key, *name;
|
||||||
|
char err_msg[4096];
|
||||||
Eina_Bool paired, connected;
|
Eina_Bool paired, connected;
|
||||||
EDBus_Message_Iter *variant, *uuids;
|
EDBus_Message_Iter *variant, *uuids;
|
||||||
Device *dev = context;
|
Device *dev = context;
|
||||||
|
@ -151,7 +152,10 @@ _on_prop_changed(void *context, const EDBus_Message *msg)
|
||||||
|
|
||||||
if (!edbus_message_arguments_get(msg, "sv", &key, &variant))
|
if (!edbus_message_arguments_get(msg, "sv", &key, &variant))
|
||||||
{
|
{
|
||||||
ERR("Property of %s changed, but could not be read", dev->name);
|
snprintf(err_msg, sizeof(err_msg),
|
||||||
|
"Property of %s changed, but could not be read", dev->name);
|
||||||
|
ERR("%s", err_msg);
|
||||||
|
ebluez4_show_error("Bluez Error", err_msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,6 +210,7 @@ _on_connected(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
|
||||||
if (edbus_message_error_get(msg, &err_name, &err_msg))
|
if (edbus_message_error_get(msg, &err_name, &err_msg))
|
||||||
{
|
{
|
||||||
ERR("%s: %s", err_name, err_msg);
|
ERR("%s: %s", err_name, err_msg);
|
||||||
|
ebluez4_show_error(err_name, err_msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,6 +230,7 @@ _on_paired(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
|
||||||
if (edbus_message_error_get(msg, &err_name, &err_msg))
|
if (edbus_message_error_get(msg, &err_name, &err_msg))
|
||||||
{
|
{
|
||||||
ERR("%s: %s", err_name, err_msg);
|
ERR("%s: %s", err_name, err_msg);
|
||||||
|
ebluez4_show_error(err_name, err_msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,11 +339,13 @@ _on_list(void *data, const EDBus_Message *msg, EDBus_Pending *pending)
|
||||||
{
|
{
|
||||||
EDBus_Message_Iter *array;
|
EDBus_Message_Iter *array;
|
||||||
const char *path;
|
const char *path;
|
||||||
|
const char *err_msg = "Error reading list of devices";
|
||||||
|
|
||||||
if (!edbus_message_arguments_get(msg, "ao", &array))
|
if (!edbus_message_arguments_get(msg, "ao", &array))
|
||||||
{
|
{
|
||||||
ERR("Error reading list of devices");
|
ERR("%s", err_msg);
|
||||||
return;
|
ebluez4_show_error("Bluez Error", err_msg);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (edbus_message_iter_get_and_next(array, 'o', &path))
|
while (edbus_message_iter_get_and_next(array, 'o', &path))
|
||||||
|
@ -348,10 +356,12 @@ static void
|
||||||
_set_adapter(const EDBus_Message *msg)
|
_set_adapter(const EDBus_Message *msg)
|
||||||
{
|
{
|
||||||
const char *adap_path;
|
const char *adap_path;
|
||||||
|
const char *err_msg = "Error reading path of Default Adapter";
|
||||||
|
|
||||||
if (!edbus_message_arguments_get(msg, "o", &adap_path))
|
if (!edbus_message_arguments_get(msg, "o", &adap_path))
|
||||||
{
|
{
|
||||||
ERR("Error reading path of Default Adapter");
|
ERR("%s", err_msg);
|
||||||
|
ebluez4_show_error("Bluez Error", err_msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,10 +411,12 @@ static void
|
||||||
_on_adapter_removed(void *context, const EDBus_Message *msg)
|
_on_adapter_removed(void *context, const EDBus_Message *msg)
|
||||||
{
|
{
|
||||||
const char *adap_path;
|
const char *adap_path;
|
||||||
|
const char *err_msg = "Error reading path of Removed Adapter";
|
||||||
|
|
||||||
if (!edbus_message_arguments_get(msg, "o", &adap_path))
|
if (!edbus_message_arguments_get(msg, "o", &adap_path))
|
||||||
{
|
{
|
||||||
ERR("Error reading path of Removed Adapter");
|
ERR("%s", err_msg);
|
||||||
|
ebluez4_show_error("Bluez Error", err_msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue