screens: add a dialogue with a button for close and settings panel.

When there is user information missing or a change required in
settings, display a dialogue with the information and an added
button to open the "Settings" window.
This commit is contained in:
Al Poole 2018-03-20 16:34:29 +00:00 committed by Andy Williams
parent ca463c691e
commit ea02efa416
3 changed files with 75 additions and 3 deletions

View File

@ -562,7 +562,7 @@ edi_launcher_config_missing()
title = _("Unable to launch");
message = _("No launch binary found, please configure in Settings.");
edi_screens_message(_edi_main_win, title, message);
edi_screens_settings_message(_edi_main_win, title, message);
}
void
@ -573,7 +573,7 @@ edi_debug_exe_missing(void)
title = _("Unable to launch debugger");
message = _("No debug binary found, please check system configuration and Settings.");
edi_screens_message(_edi_main_win, title, message);
edi_screens_settings_message(_edi_main_win, title, message);
}
static void
@ -585,7 +585,7 @@ _edi_project_credentials_missing()
title = _("Missing user information");
message = _("No user information found, please configure in Settings.");
edi_screens_message(_edi_main_win, title, message);
edi_screens_settings_message(_edi_main_win, title, message);
}
static Eina_Bool

View File

@ -125,6 +125,66 @@ void edi_screens_message(Evas_Object *parent, const char *title, const char *mes
evas_object_show(popup);
}
static void
_edi_screens_settings_display_cb(void *data, Evas_Object *obj,
void *event_info EINA_UNUSED)
{
Evas_Object *parent = evas_object_data_get(obj, "parent");
evas_object_del((Evas_Object *) data);
edi_settings_show(parent);
}
void edi_screens_settings_message(Evas_Object *parent, const char *title, const char *message)
{
Evas_Object *popup, *table, *box, *icon, *sep, *label, *button;
popup = elm_popup_add(parent);
elm_object_part_text_set(popup, "title,text", title);
table = elm_table_add(popup);
icon = elm_icon_add(table);
elm_icon_standard_set(icon, "dialog-information");
evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get());
evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(icon);
elm_table_pack(table, icon, 0, 0, 1, 1);
label = elm_label_add(popup);
elm_object_text_set(label, message);
evas_object_show(label);
elm_table_pack(table, label, 1, 0, 1, 1);
evas_object_show(table);
box = elm_box_add(popup);
sep = elm_separator_add(box);
elm_separator_horizontal_set(sep, EINA_TRUE);
evas_object_show(sep);
elm_box_pack_end(box, sep);
elm_box_pack_end(box, table);
sep = elm_separator_add(box);
elm_separator_horizontal_set(sep, EINA_TRUE);
evas_object_show(sep);
elm_box_pack_end(box, sep);
elm_object_content_set(popup, box);
button = elm_button_add(popup);
elm_object_text_set(button, _("OK"));
elm_object_part_content_set(popup, "button1", button);
evas_object_smart_callback_add(button, "clicked", _edi_screens_popup_cancel_cb, popup);
button = elm_button_add(popup);
elm_object_text_set(button, _("Settings"));
elm_object_part_content_set(popup, "button2", button);
evas_object_data_set(button, "parent", parent);
evas_object_smart_callback_add(button, "clicked", _edi_screens_settings_display_cb, popup);
evas_object_show(popup);
}
void edi_screens_desktop_notify(const char *title, const char *message)
{
Eina_Strbuf *command;

View File

@ -83,6 +83,18 @@ void edi_screens_message_confirm(Evas_Object *parent, const char *message, void
*/
void edi_screens_message(Evas_Object *parent, const char *title, const char *message);
/**
* Create an information dialogue with additional button to settings.
*
* @param parent The parent object to display the dialogue in.
* @param title The title for the popup.
* @param message The text to be displayed in the popup.
*
* @ingroup UI
*/
void edi_screens_settings_message(Evas_Object *parent, const char *title, const char *message);
/**
* Send a desktop notification message to the window manager.
*