type = _call_type_get(c);
number = phone_format(ofono_call_line_id_get(c));
- it = gui_layout_add(ctx->multiparty.bx, "multiparty-details");
+ it = layout_add(ctx->multiparty.bx, "multiparty-details");
evas_object_size_hint_align_set(it,
EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(it);
}
} else {
if (!ctx->gui_activecall) {
- ctx->gui_activecall = gui_layout_add(o, "activecall");
+ ctx->gui_activecall = layout_add(o, "activecall");
elm_object_signal_callback_add(
ctx->gui_activecall, "clicked", "call",
_on_active_call_clicked, ctx);
Evas_Object *callscreen_add(Evas_Object *parent)
{
Callscreen *ctx;
- Evas_Object *obj = gui_layout_add(parent, "call");
+ Evas_Object *obj = layout_add(parent, "call");
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
ctx = calloc(1, sizeof(Callscreen));
contacts = calloc(1, sizeof(Contacts));
EINA_SAFETY_ON_NULL_RETURN_VAL(contacts, NULL);
- contacts->self = gui_layout_add(parent, "contacts_bg");
+ contacts->self = layout_add(parent, "contacts_bg");
EINA_SAFETY_ON_NULL_GOTO(contacts->self, err_layout);
evas_object_event_callback_add(contacts->self, EVAS_CALLBACK_DEL,
_on_del, contacts);
EINA_SAFETY_ON_NULL_RETURN_VAL(contacts, NULL);
- details = gui_layout_add(parent, "contacts_details");
+ details = layout_add(parent, "contacts_details");
EINA_SAFETY_ON_NULL_GOTO(details, err_layout);
- obj = gui_layout_add(parent, "contacts_bg");
+ obj = layout_add(parent, "contacts_bg");
EINA_SAFETY_ON_NULL_GOTO(obj, err_obj);
genlist = elm_genlist_add(obj);
static Evas_Object *history = NULL;
static Evas_Object *cs = NULL;
static Evas_Object *flip = NULL;
-static char def_theme[PATH_MAX] = "";
static OFono_Callback_List_Modem_Node *callback_node_modem_changed = NULL;
static OFono_Callback_List_USSD_Notify_Node *callback_node_ussd_notify = NULL;
return ofono_dial(copy, NULL, _dial_reply, copy);
}
-Evas_Object *gui_layout_add(Evas_Object *parent, const char *style)
-{
- Evas_Object *layout = elm_layout_add(parent);
- if (!elm_layout_theme_set(layout, "layout", "dialer", style)) {
- CRITICAL("No theme for 'elm/layout/dialer/%s' at %s",
- style, def_theme);
- evas_object_del(layout);
- return NULL;
- }
- return layout;
-}
-
static void _gui_show(Evas_Object *o)
{
if (o == keypad)
Evas_Object *gui_simple_popup(const char *title, const char *message)
{
- Evas_Object *p = gui_layout_add(win, "popup");
+ Evas_Object *p = layout_add(win, "popup");
Simple_Popup *ctx;
EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL);
ussd_start(message);
}
-Eina_Bool gui_init(const char *theme)
+Eina_Bool gui_init(void)
{
Evas_Object *lay, *obj;
Evas_Coord w, h;
/* dialer should never, ever quit */
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_NONE);
- elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
- elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
- elm_app_info_set(gui_init, "ofono-efl", "themes/default.edj");
-
- snprintf(def_theme, sizeof(def_theme), "%s/themes/default.edj",
- elm_app_data_dir_get());
-
- elm_theme_extension_add(NULL, def_theme);
- if (!theme)
- elm_theme_overlay_add(NULL, def_theme);
- else {
- char tmp[PATH_MAX];
- if (theme[0] != '/') {
- if (eina_str_has_suffix(theme, ".edj")) {
- snprintf(tmp, sizeof(tmp), "%s/themes/%s",
- elm_app_data_dir_get(), theme);
- } else {
- snprintf(tmp, sizeof(tmp), "%s/themes/%s.edj",
- elm_app_data_dir_get(), theme);
- }
- theme = tmp;
- }
- elm_theme_overlay_add(NULL, theme);
- }
-
win = elm_win_util_standard_add("ofono-dialer", "oFono Dialer");
EINA_SAFETY_ON_NULL_RETURN_VAL(win, EINA_FALSE);
elm_win_autodel_set(win, EINA_FALSE);
_gui_call_sync, NULL);
evas_object_show(flip);
- main_layout = lay = gui_layout_add(win, "main");
+ main_layout = lay = layout_add(win, "main");
EINA_SAFETY_ON_NULL_RETURN_VAL(lay, EINA_FALSE);
evas_object_size_hint_weight_set(lay,
EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
#include "contacts.h"
#include "ofono.h"
-Evas_Object *gui_layout_add(Evas_Object *parent, const char *style);
-
Evas_Object *gui_simple_popup(const char *title, const char *message);
void gui_simple_popup_title_set(Evas_Object *p, const char *title);
void gui_call_enter(void);
void gui_call_exit(void);
-Eina_Bool gui_init(const char *theme);
+Eina_Bool gui_init(void);
void gui_shutdown(void);
Contact_Info *gui_contact_search(const char *number, const char **type);
Evas_Object *btn = NULL;
if (strcmp(part, "call.swallow.more") == 0) {
- btn = gui_layout_add(obj, "history/img");
+ btn = layout_add(obj, "history/img");
EINA_SAFETY_ON_NULL_RETURN_VAL(btn, NULL);
elm_object_signal_callback_add(btn, "clicked,more", "gui",
_on_more_clicked, NULL);
history = calloc(1, sizeof(History));
EINA_SAFETY_ON_NULL_RETURN_VAL(history, NULL);
- history->self = obj = gui_layout_add(parent, "history_bg");
+ history->self = obj = layout_add(parent, "history_bg");
EINA_SAFETY_ON_NULL_GOTO(obj, err_layout);
genlist_all = elm_genlist_add(obj);
Evas_Object *keypad_add(Evas_Object *parent)
{
Keypad *ctx;
- Evas_Object *obj = gui_layout_add(parent, "keypad");
+ Evas_Object *obj = layout_add(parent, "keypad");
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
ctx = calloc(1, sizeof(Keypad));
#include "ofono.h"
#include "gui.h"
#include "rc.h"
+#include "util.h"
#include <Ecore_Getopt.h>
ofono_modem_type_require(def_modem_type);
}
- if (!gui_init(theme)) {
+ if (!util_init(theme)) {
CRITICAL("Could not setup graphical user interface");
_app_exit_code = EXIT_FAILURE;
goto end_ofono;
}
+ if (!gui_init()) {
+ CRITICAL("Could not setup graphical user interface");
+ _app_exit_code = EXIT_FAILURE;
+ goto end_util;
+ }
+
INF("Entering main loop");
elm_run();
INF("Quit main loop");
gui_shutdown();
+end_util:
+ util_shutdown();
end_ofono:
ofono_shutdown();
end_rc:
#include "gui.h"
#include "util.h"
+#include "log.h"
+
+static char def_theme[PATH_MAX] = "";
/* TODO: find a configurable way to format the number.
* Right now it's: 1-234-567-8901 as per
}
return icon;
}
+
+Evas_Object *layout_add(Evas_Object *parent, const char *style)
+{
+ Evas_Object *layout = elm_layout_add(parent);
+ if (!elm_layout_theme_set(layout, "layout", "dialer", style)) {
+ CRITICAL("No theme for 'elm/layout/dialer/%s' at %s",
+ style, def_theme);
+ evas_object_del(layout);
+ return NULL;
+ }
+ return layout;
+}
+
+Eina_Bool util_init(const char *theme)
+{
+ elm_app_compile_bin_dir_set(PACKAGE_BIN_DIR);
+ elm_app_compile_data_dir_set(PACKAGE_DATA_DIR);
+ elm_app_info_set(util_init, "ofono-efl", "themes/default.edj");
+
+ snprintf(def_theme, sizeof(def_theme), "%s/themes/default.edj",
+ elm_app_data_dir_get());
+
+ elm_theme_extension_add(NULL, def_theme);
+ if (!theme)
+ elm_theme_overlay_add(NULL, def_theme);
+ else {
+ char tmp[PATH_MAX];
+ if (theme[0] != '/') {
+ if (eina_str_has_suffix(theme, ".edj")) {
+ snprintf(tmp, sizeof(tmp), "%s/themes/%s",
+ elm_app_data_dir_get(), theme);
+ } else {
+ snprintf(tmp, sizeof(tmp), "%s/themes/%s.edj",
+ elm_app_data_dir_get(), theme);
+ }
+ theme = tmp;
+ }
+ elm_theme_overlay_add(NULL, theme);
+ }
+
+ return EINA_TRUE;
+}
+
+void util_shutdown(void)
+{
+}
Evas_Object *picture_icon_get(Evas_Object *parent, const char *picture);
+Evas_Object *layout_add(Evas_Object *parent, const char *style);
+
+Eina_Bool util_init(const char *theme);
+void util_shutdown(void);
+
#endif