Align wireless button text with wired text when no ap connected 90/132490/4
authorAbhishek Sansanwal <abhishek.s94@samsung.com>
Tue, 6 Jun 2017 04:23:56 +0000 (09:53 +0530)
committerAbhishek Sansanwal <abhishek.s94@samsung.com>
Wed, 7 Jun 2017 03:20:59 +0000 (08:50 +0530)
Signed-off-by: Abhishek Sansanwal <abhishek.s94@samsung.com>
Change-Id: I022b79de1b48e3f192eb425fb3053014a8ffc7af

include/common/menumgr.h
src/common/menumgr.c
src/layout/layout_network.c

index db65603..191da7c 100644 (file)
@@ -60,6 +60,16 @@ struct menumgr *menumgr_create(Evas_Object *table, Evas_Object *tab_menu_btn,
 void menumgr_destroy(struct menumgr *m);
 
 /**
+* @brief Changes the style of a button and sets status function.
+*
+* @param[in] m Menu manager pointer.
+* @param[in] status Status function pointer.
+* @param[in] id Index of the button.
+* @param[in] style Style to be set on the button.
+*/
+void menumgr_style_set(struct menumgr *m, char *(*status)(void *data, int id), int id, const char *style);
+
+/**
 * @brief Updates a Menu manager.
 *
 * @param[in] m Menu manager pointer.
index 47de08a..a311c92 100755 (executable)
@@ -130,6 +130,17 @@ static input_handler _handler = {
        .focused = _focused
 };
 
+void menumgr_style_set(struct menumgr *m, char *(*status)(void *data, int id), int id, const char *style)
+{
+       if (!m) {
+               _ERR("Invalid parameter.");
+               return;
+       }
+
+       m->info[id]->status = status;
+       elm_object_style_set(m->btn[id], style);
+}
+
 void menumgr_update(struct menumgr *m)
 {
        int i;
index eee1b3b..d865769 100644 (file)
@@ -1844,6 +1844,18 @@ err:
        return false;
 }
 
+static void update_style(struct _priv *priv)
+{
+       char *str = NULL;
+       str = _get_connected_ap(priv, TYPE_WIRELESS);
+       if (!str) {
+               menumgr_style_set(priv->menu, NULL, TYPE_WIRELESS, STYLE_NORMAL_BTN);
+       } else {
+               menumgr_style_set(priv->menu, _get_connected_ap, TYPE_WIRELESS, STYLE_STATUS_BTN);
+               free(str);
+       }
+}
+
 static void _show(void *layout_data)
 {
        struct _priv *priv;
@@ -1863,6 +1875,7 @@ static void _show(void *layout_data)
 //             if (priv->cur_type == TYPE_WIRELESS)
 //                     _retry_wireless_network(priv);
        }
+       update_style(priv);
        menumgr_update(priv->menu);
 }
 
@@ -1932,6 +1945,7 @@ static void _update(void *layout_data, int update_type, void *data)
                elm_object_disabled_set(priv->ly, EINA_FALSE);
                break;
        case UPDATE_CONTENT:
+               update_style(priv);
                menumgr_update(priv->menu);
                break;
        default: