Add gettext support for internationalization
[profile/ivi/lemolo.git] / dialer / history.c
index d1d0b41..0224265 100644 (file)
@@ -12,6 +12,8 @@
 #include "log.h"
 #include "util.h"
 #include "gui.h"
+#include "simple-popup.h"
+#include "i18n.h"
 
 #ifndef EET_COMPRESSION_DEFAULT
 #define EET_COMPRESSION_DEFAULT 1
@@ -232,20 +234,6 @@ static Eina_Bool _history_call_info_update(Call_Info *call_info)
        return EINA_FALSE;
 }
 
-static void _dial_reply(void *data, OFono_Error err,
-                       OFono_Call *call __UNUSED__)
-{
-       const char *number = data;
-
-       if (err != OFONO_ERROR_NONE) {
-               char buf[1024];
-               const char *msg = ofono_error_message_get(err);
-               snprintf(buf, sizeof(buf), "Could not call %s: %s",
-                               number, msg);
-               gui_simple_popup("Error", buf);
-       }
-}
-
 static void _on_item_clicked(void *data, Evas_Object *obj __UNUSED__,
                                void *event_info)
 {
@@ -253,7 +241,7 @@ static void _on_item_clicked(void *data, Evas_Object *obj __UNUSED__,
        const char *number = data;
 
        INF("call %s", number);
-       ofono_dial(number, NULL, _dial_reply, number);
+       gui_dial(number);
        elm_genlist_item_selected_set(it, EINA_FALSE);
 }
 
@@ -646,14 +634,14 @@ static void _history_clear(History *ctx)
 
        EINA_SAFETY_ON_TRUE_RETURN(ctx->clear_popup != NULL);
 
-       ctx->clear_popup = p = gui_simple_popup("Clear History",
-                               "Do you want to clear all history entries?");
+       ctx->clear_popup = p = gui_simple_popup(_("Clear History"),
+                               _("Do you want to clear all history entries?"));
 
-       gui_simple_popup_buttons_set(p,
-                                       "Dismiss",
+       simple_popup_buttons_set(p,
+                                       _("Dismiss"),
                                        "dialer",
                                        _history_clear_cancel,
-                                       "Yes, Clear",
+                                       _("Yes, Clear"),
                                        "dialer-caution",
                                        _history_clear_do,
                                        ctx);
@@ -702,7 +690,7 @@ static char *_item_label_get(void *data, Evas_Object *obj __UNUSED__,
 
        if (!strcmp(part, "type")) {
                if (!call_info->contact_type)
-                       return strdup("Unknown");
+                       return strdup(_("Unknown"));
                return strdup(call_info->contact_type);
        }
 
@@ -733,16 +721,28 @@ static void _on_clicked(void *data, Evas_Object *obj __UNUSED__,
                        const char *emission, const char *source __UNUSED__)
 {
        History *ctx = data;
+       Last_User_Mode *last;
 
        EINA_SAFETY_ON_NULL_RETURN(emission);
        emission += strlen("clicked,");
 
        DBG("ctx=%p, signal: %s", ctx, emission);
+       last = util_get_last_user_mode();
 
-       if (!strcmp(emission, "all"))
+       if (!strcmp(emission, "all")) {
                elm_object_signal_emit(obj, "show,all", "gui");
-       else if (!strcmp(emission, "missed"))
+               if (last) {
+                       last->last_history_view = DIALER_LAST_HISTORY_VIEW_ALL;
+                       util_set_last_user_mode(last);
+               }
+       }
+       else if (!strcmp(emission, "missed")) {
                elm_object_signal_emit(obj, "show,missed", "gui");
+               if (last) {
+                       last->last_history_view = DIALER_LAST_HISTORY_VIEW_MISSED;
+                       util_set_last_user_mode(last);
+               }
+       }
        else if (!strcmp(emission, "clear"))
                _history_clear(ctx);
        else if (!strcmp(emission, "edit")) {
@@ -778,7 +778,7 @@ static Evas_Object *_item_content_get(void *data, Evas_Object *obj,
        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);
@@ -837,7 +837,7 @@ Evas_Object *history_add(Evas_Object *parent)
        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);