2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <appcore-efl.h>
22 #include "indicator.h"
23 #include "indicator_icon_util.h"
25 #include "indicator_ui.h"
27 #define ICON_PRIORITY INDICATOR_PRIORITY_NON_FIXED_7
28 #define MODULE_NAME "FM_Radio"
30 static int register_fm_radio_module(void *data);
31 static int unregister_fm_radio_module(void);
33 Indicator_Icon_Object fm_radio = {
34 .type = INDICATOR_IMG_ICON,
36 .priority = ICON_PRIORITY,
37 .always_top = EINA_FALSE,
38 .exist_in_view = EINA_FALSE,
41 .obj_exist = EINA_FALSE,
43 .init = register_fm_radio_module,
44 .fini = unregister_fm_radio_module
47 static char *icon_path[] = {
48 "Background_playing/B03_Backgroundplaying_FMradio.png",
52 static void show_image_icon(void *data)
54 fm_radio.img_obj.data = icon_path[0];
55 indicator_util_icon_show(&fm_radio);
58 static void hide_image_icon(void)
60 indicator_util_icon_hide(&fm_radio);
63 static void indicator_fm_radio_change_cb(keynode_t *node, void *data)
68 retif(data == NULL, , "Invalid parameter!");
70 ret = vconf_get_int(VCONFKEY_RADIO_STATE, &status);
72 INFO("FM_RADIO state: %d", status);
73 if (status == VCONFKEY_RADIO_PLAY)
74 show_image_icon(data);
81 static int register_fm_radio_module(void *data)
85 retif(data == NULL, FAIL, "Invalid parameter!");
87 ret = vconf_notify_key_changed(VCONFKEY_RADIO_STATE,
88 indicator_fm_radio_change_cb, data);
90 ERR("Failed to register callback!");
91 indicator_fm_radio_change_cb(NULL, data);
96 static int unregister_fm_radio_module(void)
100 ret = vconf_ignore_key_changed(VCONFKEY_RADIO_STATE,
101 indicator_fm_radio_change_cb);
103 ERR("Failed to unregister callback!");