summaryrefslogtreecommitdiff
path: root/viewer/src/msg-ui-viewer-callback.c
blob: 2121301a0d44bd1f6d93811df0b47d0608b13555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://floralicense.org/license
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*==================================================================================================
 *										INCLUDE HEADERS
*==================================================================================================*/
#include "msg-ui-viewer-main.h"
#include "msg-ui-common-utility.h"

/*==================================================================================================
 *									FUNCTION IMPLEMENTATIONS
 *================================================================================================*/
void msg_ui_viewer_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
{
	MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG);
	MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, ug == NULL);
	MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, priv == NULL);
	Evas_Object *base = NULL;
	MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)priv;

	base = ug_get_layout(ug);
	if (!base) {
		MSG_UI_DEBUG(MSG_UI_LEVEL_ERR, "base is NULL");
		ug_destroy(ug);
		return;
	}

	Evas_Object *win = ug_get_window();

	switch (mode) {
	case UG_MODE_FULLVIEW:
		evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
		evas_object_show(base);

		break;
	case UG_MODE_FRAMEVIEW:
		elm_object_part_content_set(viewer_main_data->layout_main, "content", base);
		break;
    default:
		break;
	}

	MSG_UI_LEAVE(MSG_UI_LEVEL_DEBUG);
}


void msg_ui_viewer_result_cb(ui_gadget_h ug, service_h service, void *priv)
{
	MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG);
}


Eina_Bool msg_ui_viewer_ug_quit(void *data)
{
	MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG);
	MSG_UI_RETV_IF(MSG_UI_LEVEL_ERR, data == NULL, ECORE_CALLBACK_CANCEL);
	MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)data;

	if (viewer_main_data != NULL) {
		/*destroy captured image and resource.*/
		if (viewer_main_data->SmilHandle) {
			msg_smil_destroy_smil_player(viewer_main_data->SmilHandle);
			msg_ui_viewer_set_smilhandle(viewer_main_data, NULL);

			if (viewer_main_data->player_view)
				viewer_main_data->player_view->SmilHandle = NULL;
		}

		if (viewer_main_data->viewer_ug) {
			msg_common_reset_font_size("entry");
			ug_destroy_me(viewer_main_data->viewer_ug);
		}
	} else {
		MSG_UI_DEBUG(MSG_UI_LEVEL_ERR, "viewer_main_data is NULL");
	}

	return ECORE_CALLBACK_CANCEL;
}


void msg_ui_viewer_destroy_cb(ui_gadget_h ug, void *priv)
{
	MSG_UI_ENTER(MSG_UI_LEVEL_DEBUG);
	MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, ug == NULL);
	MSG_UI_RET_IF(MSG_UI_LEVEL_ERR, priv == NULL);
	MSG_VIEWER_MAIN_DATA_S *viewer_main_data = (MSG_VIEWER_MAIN_DATA_S *)priv;

	if (viewer_main_data->loaded_ug) {
		ug_destroy(viewer_main_data->loaded_ug);
		viewer_main_data->loaded_ug = NULL;
	}

	MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "viewer_main_data->view_mode : %d", viewer_main_data->view_mode);
	if (viewer_main_data->view_mode == MSG_VIEWER_PLAYER_VIEW) {
		if (viewer_main_data->player_view) {
			MSG_UI_DEBUG(MSG_UI_LEVEL_DEBUG, "PLAYER launch_cmd : %d, cmd_type : %d", viewer_main_data->player_view->launch_cmd, viewer_main_data->player_view->cmd_type);
			if (viewer_main_data->player_view->launch_cmd == MSG_VIEWER_LOAD_OTHER_UG_MODE &&
					(viewer_main_data->player_view->cmd_type == MSG_VIEWER_CMD_LOAD_CONTACT)) {

				/*update title button text after contact sync */
				msg_ui_viewer_title_update(viewer_main_data->player_view, MSG_VIEWER_OPTION_CONTACT);
			}

			bool isHelpText = (!viewer_main_data->player_view->smil_eventStatus) ? false : ((viewer_main_data->player_view->smil_eventStatus->isHelpSlide) ? true : false);
			MSG_VIEWER_ENTRY_TYPE_E entry_type = (isHelpText) ? MSG_VIEWER_ENTRY_HELP_TEXT : MSG_VIEWER_ENTRY_NORMAL_TEXT;
			msg_ui_viewer_set_font_size(viewer_main_data->player_view, entry_type, MSG_VIEWER_FONT_CHANGE_LATEST_UPDATE);

			/*connect handler again*/
			msg_ui_viewer_connect_handler(viewer_main_data->player_view);

			viewer_main_data->player_view->launch_cmd = MSG_VIEWER_DEFAULT_MODE;
			viewer_main_data->player_view->cmd_type = MSG_VIEWER_CMD_NONE;
		}
	}

	MSG_UI_LEAVE(MSG_UI_LEVEL_DEBUG);
}