lib/elementary/elm_access.eo \
lib/elementary/elm_actionslider.eo \
lib/elementary/elm_atspi_bridge.eo \
- lib/elementary/elm_app_client.eo \
- lib/elementary/elm_app_client_view.eo \
- lib/elementary/elm_app_server.eo \
- lib/elementary/elm_app_server_view.eo \
lib/elementary/elm_atspi_app_object.eo \
lib/elementary/elm_bg.eo \
lib/elementary/elm_bubble.eo \
lib/elementary/elm_actionslider.h \
lib/elementary/elm_actionslider_eo.h \
lib/elementary/elm_actionslider_legacy.h \
- lib/elementary/elm_app_common.h \
- lib/elementary/elm_app_server_eo.h \
- lib/elementary/elm_app_server_view_eo.h \
- lib/elementary/elm_app_server_view.h \
- lib/elementary/elm_app_server_eet.h \
- lib/elementary/elm_app_server.h \
- lib/elementary/elm_app_client_eo.h \
- lib/elementary/elm_app_client.h \
- lib/elementary/elm_app_client_view_eo.h \
- lib/elementary/elm_app_client_view.h \
lib/elementary/elm_app.h \
lib/elementary/elm_atspi_app_object.h \
lib/elementary/elm_authors.h \
lib/elementary/elc_scrolled_entry.c \
lib/elementary/elm_access.c \
lib/elementary/elm_actionslider.c \
- lib/elementary/elm_app_common.c \
- lib/elementary/elm_app_server_eet.c \
- lib/elementary/elm_app_server.c \
- lib/elementary/elm_app_server_view.c \
- lib/elementary/elm_app_client.c \
- lib/elementary/elm_app_client_view.c \
lib/elementary/elm_atspi_app_object.c \
lib/elementary/elm_atspi_bridge.c \
lib/elementary/elm_bg.c \
bin/elementary/test_access.c \
bin/elementary/test_actionslider.c \
bin/elementary/test_anim.c \
-bin/elementary/test_application_server.c \
bin/elementary/test_bg.c \
bin/elementary/test_box.c \
bin/elementary/test_bubble.c \
bin/elementary/test_store.c \
bin/elementary/test_sys_notify.c \
bin/elementary/test_systray.c \
-bin/elementary/test_task_switcher.c \
bin/elementary/test_table.c \
bin/elementary/test_thumb.c \
bin/elementary/test_toolbar.c \
void test_dnd_multi_features(void *data, Evas_Object *obj, void *event_info);
void test_dnd_types(void *data, Evas_Object *obj, void *event_info);
void test_task_switcher(void *data, Evas_Object *obj, void *event_info);
-void test_application_server_message(void *data, Evas_Object *obj, void *event_info);
-void test_application_server_phone(void *data, Evas_Object *obj, void *event_info);
void test_win_dialog(void *data, Evas_Object *obj, void *event_info);
void test_box_disable(void *data, Evas_Object *obj, void *event_info);
void test_layout_disable(void *data, Evas_Object *obj, void *event_info);
ADD_TEST(NULL, "Miscellaneous", "Font overlay", test_config_font_overlay);
//------------------------------//
- ADD_TEST(NULL, "Application client/server", "Task switcher", test_task_switcher);
- ADD_TEST(NULL, "Application client/server", "Phone", test_application_server_phone);
- ADD_TEST(NULL, "Application client/server", "Message", test_application_server_message);
-
ADD_TEST(NULL, "Widgets Disable/Enable", "Box", test_box_disable);
ADD_TEST(NULL, "Widgets Disable/Enable", "Layout", test_layout_disable);
#undef ADD_TEST
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-#include <Elementary.h>
-
-typedef struct {
- Evas_Object *win, *label;
- Eina_Stringshare *view_name;
-} App_View_Context;
-
-static Elm_App_Server *phone_server = NULL, *msg_server = NULL;
-
-static void _text_update(App_View_Context *ctx, const char *state)
-{
- char buffer[1024];
-
- if (!ctx->label)
- return;
- snprintf(buffer, sizeof(buffer), "%s - state=%s", ctx->view_name, state);
- elm_object_text_set(ctx->label, buffer);
-}
-
-static void
-_window_create(App_View_Context *ctx)
-{
- ctx->win = elm_win_util_standard_add("app_view", ctx->view_name);
-
- ctx->label = elm_label_add(ctx->win);
- evas_object_size_hint_weight_set(ctx->label, EVAS_HINT_EXPAND,
- EVAS_HINT_EXPAND);
- evas_object_data_set(ctx->win, "label", ctx->label);
-
- _text_update(ctx, "alive");
-
- elm_win_resize_object_add(ctx->win, ctx->label);
- evas_object_show(ctx->label);
-
- evas_object_resize(ctx->win, 400, 300);
- evas_object_show(ctx->win);
-}
-
-static void
-_close_cb(void *data, const Efl_Event *event)
-{
- App_View_Context *ctx = data;
- if (ctx->win)
- evas_object_del(ctx->win);
- efl_del(event->object);
-}
-
-static void
-_pause_cb(void *data, const Efl_Event *event EINA_UNUSED)
-{
- App_View_Context *ctx = data;
- _text_update(ctx, "paused");
-}
-
-static void
-_resume_cb(void *data, const Efl_Event *event)
-{
- App_View_Context *ctx = data;
-
- //shallow state
- if (!ctx->win)
- {
- _window_create(ctx);
- elm_app_server_view_window_set(event->object, ctx->win);
- }
-
- _text_update(ctx, "alive");
-}
-
-static void
-_view_del_cb(void *data, const Efl_Event *event)
-{
- App_View_Context *ctx = data;
-
- if (ctx->win)
- evas_object_del(ctx->win);
- elm_app_server_view_window_set(event->object, NULL);
- eina_stringshare_del(ctx->view_name);
- free(ctx);
-}
-
-static Elm_App_Server_View *
-_create_view_cb(Elm_App_Server *app_server, const Eina_Value *args EINA_UNUSED, Eina_Stringshare **error_name, Eina_Stringshare **error_message EINA_UNUSED)
-{
- Elm_App_Server_View *view;
- const char *id = NULL, *pkg = NULL;
- App_View_Context *ctx;
-
- ctx = calloc(1, sizeof(App_View_Context));
- if (!ctx)
- {
- *error_name = eina_stringshare_add("No memory available");
- return NULL;
- }
-
- view = efl_add(ELM_APP_SERVER_VIEW_CLASS, app_server, elm_app_server_view_id_set(efl_added, NULL));
-
- id = elm_app_server_view_id_get(view);
- pkg = elm_app_server_package_get(app_server);
- ctx->view_name = eina_stringshare_printf("%s %s", pkg, id);
-
- _window_create(ctx);
-
- elm_app_server_view_title_set(view, ctx->view_name);
- elm_app_server_view_new_events_set(view, 5);
- elm_app_server_view_window_set(view, ctx->win);
- elm_app_server_view_resume(view);
- efl_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_CLOSED, _close_cb, ctx);
- efl_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_PAUSED, _pause_cb, ctx);
- efl_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_RESUMED, _resume_cb, ctx);
- efl_event_callback_add(view, EFL_EVENT_DEL, _view_del_cb, ctx);
-
- return view;
-}
-
-static void
-_terminate_cb(void *data EINA_UNUSED, const Efl_Event *event)
-{
- const char *title = NULL;
-
- printf("terminate cb\n");
- elm_app_server_save(event->object);
- title = elm_app_server_title_get(event->object);
-
- printf("Closing: %s\n", title);
- efl_unref(event->object);
-}
-
-Elm_App_Server *
-test_application_server_common(const char *pkg)
-{
- Eina_Iterator *views_iter = NULL;
- Elm_App_Server_View *view;
- Elm_App_Server *server;
-
- server = efl_add(ELM_APP_SERVER_CLASS, NULL, elm_app_server_constructor(efl_added, pkg, _create_view_cb));
- elm_app_server_title_set(server, pkg);
- views_iter = elm_app_server_views_get(server);
- efl_event_callback_add(server, ELM_APP_SERVER_EVENT_TERMINATE, _terminate_cb, NULL);
-
- //views create in shallow state
- EINA_ITERATOR_FOREACH(views_iter, view)
- {
- App_View_Context *ctx;
- const char *id = NULL;
-
- ctx = calloc(1, sizeof(App_View_Context));
-
- id = elm_app_server_view_id_get(view);
- ctx->view_name = eina_stringshare_printf("%s %s", pkg, id);
-
- efl_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_CLOSED, _close_cb, ctx);
- efl_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_PAUSED, _pause_cb, ctx);
- efl_event_callback_add(view, ELM_APP_SERVER_VIEW_EVENT_RESUMED, _resume_cb, ctx);
- efl_event_callback_add(view, EFL_EVENT_DEL, _view_del_cb, ctx);
- }
- eina_iterator_free(views_iter);
-
- return server;
-}
-
-static void
-_server_del_cb(void *data, const Efl_Event *event EINA_UNUSED)
-{
- Elm_App_Server **server = data;
- *server = NULL;
-}
-
-void
-test_application_server_phone(void *data EINA_UNUSED,
- Evas_Object *obj EINA_UNUSED,
- void *event_info EINA_UNUSED)
-{
- if (phone_server)
- {
- printf("Phone already running\n");
- return;
- }
- printf("Starting phone\n");
- phone_server = test_application_server_common("org.enlightenment.phone");
- efl_event_callback_add(phone_server, EFL_EVENT_DEL, _server_del_cb, &phone_server);
-}
-
-void
-test_application_server_message(void *data EINA_UNUSED,
- Evas_Object *obj EINA_UNUSED,
- void *event_info EINA_UNUSED)
-{
- if (msg_server)
- {
- printf("Message already running\n");
- return;
- }
- printf("Starting message\n");
- msg_server = test_application_server_common( "org.enlightenment.message");
- efl_event_callback_add(msg_server, EFL_EVENT_DEL, _server_del_cb, &msg_server);
-}
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-#include <Elementary.h>
-#include <Eina.h>
-
-#define APPS_COL 0
-#define VIEWS_COL 1
-#define PROPS_VIEW_COL 2
-
-static Evas_Object *table = NULL;
-static Elm_App_Client *app_selected = NULL;
-static Eina_List *apps_list = NULL;
-
-static void _app_view_clicked(void *data, Evas_Object *obj, void *event_info);
-static void _apps_list_update(void);
-
-static void _btn_close_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Elm_App_Client_View *view = data;
- elm_app_client_view_close(view, NULL, NULL);
-}
-
-static void _btn_pause_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Elm_App_Client_View *view = data;
- elm_app_client_view_pause(view, NULL, NULL);
-}
-
-static void _btn_resume_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Elm_App_Client_View *view = data;
- elm_app_client_view_resume(view, NULL, NULL);
-}
-
-static void
-_app_view_prop_changed_cb(void *data EINA_UNUSED, const Efl_Event *event)
-{
- Elm_App_View_State state = ELM_APP_VIEW_STATE_UNKNOWN;
-
- state = elm_app_client_view_state_get(event->object);
-
- if (state == ELM_APP_VIEW_STATE_CLOSED)
- {
- Evas_Object *props = elm_table_child_get(table, PROPS_VIEW_COL, 0);
- elm_table_unpack(table, props);
- evas_object_del(props);
- }
- else
- _app_view_clicked(event->object, NULL, NULL);
-}
-
-static void
-_app_view_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Elm_App_Client_View *view = data;
- Evas_Object *view_props, *close_btn, *resume_btn, *pause_btn;
- const char *title = NULL, *icon = NULL;
- int new_events = 0, window = 0;
- unsigned short progress = 0;
- Elm_App_View_State state = ELM_APP_VIEW_STATE_UNKNOWN;
- char buffer[1024];
-
- view_props = elm_table_child_get(table, PROPS_VIEW_COL, 0);
- if (view_props)
- {
- Elm_App_Client_View *old_view;
-
- old_view = evas_object_data_del(view_props, "view");
- efl_event_callback_del(old_view, ELM_APP_CLIENT_VIEW_EVENT_PROPERTY_CHANGED, _app_view_prop_changed_cb, table);
- elm_list_clear(view_props);
- }
- else
- {
- view_props = elm_list_add(table);
- evas_object_size_hint_align_set(view_props, EVAS_HINT_FILL,
- EVAS_HINT_FILL);
- evas_object_show(view_props);
- elm_table_pack(table, view_props, PROPS_VIEW_COL, 0, 1, 1);
- }
-
- evas_object_data_set(view_props, "view", view);
-
- title = elm_app_client_view_title_get(view);
- icon = elm_app_client_view_icon_get(view);
- progress = elm_app_client_view_progress_get(view);
- new_events = elm_app_client_view_new_events_get(view);
- window = elm_app_client_view_window_get(view);
- efl_event_callback_add(view, ELM_APP_CLIENT_VIEW_EVENT_PROPERTY_CHANGED, _app_view_prop_changed_cb, table);
-
- snprintf(buffer, sizeof(buffer), "Title=%s", title);
- elm_list_item_append(view_props, buffer, NULL, NULL, NULL, NULL);
-
- snprintf(buffer, sizeof(buffer), "Icon=%s", icon);
- elm_list_item_append(view_props, buffer, NULL, NULL, NULL, NULL);
-
- snprintf(buffer, sizeof(buffer), "Progress=%d", progress);
- elm_list_item_append(view_props, buffer, NULL, NULL, NULL, NULL);
-
- snprintf(buffer, sizeof(buffer), "New events=%d", new_events);
- elm_list_item_append(view_props, buffer, NULL, NULL, NULL, NULL);
-
- snprintf(buffer, sizeof(buffer), "WindowID=%d", window);
- elm_list_item_append(view_props, buffer, NULL, NULL, NULL, NULL);
-
- state = elm_app_client_view_state_get(view);
- if (state == ELM_APP_VIEW_STATE_LIVE)
- snprintf(buffer, sizeof(buffer), "State=alive");
- else if (state == ELM_APP_VIEW_STATE_PAUSED)
- snprintf(buffer, sizeof(buffer), "State=paused");
- else if (state == ELM_APP_VIEW_STATE_CLOSED)
- snprintf(buffer, sizeof(buffer), "State=closed");
- else if (state == ELM_APP_VIEW_STATE_SHALLOW)
- snprintf(buffer, sizeof(buffer), "State=shallow");
- else
- snprintf(buffer, sizeof(buffer), "State=unknown");
- elm_list_item_append(view_props, buffer, NULL, NULL, NULL, NULL);
-
- close_btn = elm_button_add(view_props);
- elm_object_text_set(close_btn, "Close view");
- evas_object_smart_callback_add(close_btn, "clicked", _btn_close_cb, view);
- elm_list_item_append(view_props, NULL, close_btn, NULL, NULL, NULL);
-
- pause_btn = elm_button_add(view_props);
- elm_object_text_set(pause_btn, "Pause view");
- evas_object_smart_callback_add(pause_btn, "clicked", _btn_pause_cb, view);
- elm_list_item_append(view_props, NULL, pause_btn, NULL, NULL, NULL );
-
- resume_btn = elm_button_add(view_props);
- elm_object_text_set(resume_btn, "Resume view");
- evas_object_smart_callback_add(resume_btn, "clicked", _btn_resume_cb, view);
- elm_list_item_append(view_props, NULL, resume_btn, NULL, NULL, NULL );
-
- elm_list_go(view_props);
-}
-
-static void
-_popup_close_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- evas_object_del(data);
-}
-
-static void app_client_view_open_cb(void *data EINA_UNUSED, Elm_App_Client_View *view, const char *error, const char *error_message)
-{
- Evas_Object *popup, *btn_ok;
- char buf[1024];
-
- popup = elm_popup_add(table);
-
- if (view)
- {
- _app_view_clicked(view, NULL, NULL);
- return;
- }
-
- snprintf(buf, sizeof(buf), "Some error happen opening view: %s %s", error, error_message);
- elm_object_part_text_set(popup, "default", buf);
-
- btn_ok = elm_button_add(popup);
- elm_object_text_set(btn_ok, "Ok");
- elm_object_part_content_set(popup, "button1", btn_ok);
- evas_object_smart_callback_add(btn_ok, "clicked", _popup_close_cb, popup);
-
- elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
- evas_object_show(popup);
-}
-
-static void _popup_btn_open_view_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Evas_Object *popup = data;
- Eina_Value *args = NULL;//TODO fill with args of popup
- Elm_App_Client *app = evas_object_data_get(popup, "app");
-
- elm_app_client_view_open(app, args, app_client_view_open_cb, NULL);
-
- evas_object_del(popup);
-}
-
-static void
-_app_view_open(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Elm_App_Client *app = data;
- Evas_Object *popup, *btn_open, *btn_cancel, *args_box;
-
- popup = elm_popup_add(table);
- elm_object_part_text_set(popup, "title,text", "Open a view");
-
- btn_open = elm_button_add(popup);
- elm_object_text_set(btn_open, "Open");
- elm_object_part_content_set(popup, "button1", btn_open);
- evas_object_smart_callback_add(btn_open, "clicked", _popup_btn_open_view_cb, popup);
- evas_object_show(btn_open);
-
- btn_cancel = elm_button_add(popup);
- elm_object_text_set(btn_cancel, "Cancel");
- elm_object_part_content_set(popup, "button2", btn_cancel);
- evas_object_smart_callback_add(btn_cancel, "clicked", _popup_close_cb, popup);
- evas_object_show(btn_cancel);
-
- args_box = elm_box_add(popup);
- elm_object_part_content_set(popup, "default", args_box);
- elm_object_part_text_set(popup, "default", "TODO: add some entrys to add some parameters to view.");
-
- evas_object_data_set(popup, "app", app);
- elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
- evas_object_show(popup);
-}
-
-static void _app_close_all_views_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Elm_App_Client *app = data;
- elm_app_client_view_all_close(app);
-}
-
-static void
-_app_terminate_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Elm_App_Client *app = data;
- elm_app_client_terminate(app);
-}
-
-static void
-_app_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Evas_Object *views, *btn_close_all, *btn_terminate, *btn_open_view;
- Eina_Iterator *views_iter = NULL;
- Elm_App_Client_View *client_view;
- Elm_App_Client *app = data;
-
- app_selected = app;
-
- views = elm_table_child_get(table, VIEWS_COL, 0);
- if (!views)
- {
- views = elm_list_add(table);
- evas_object_size_hint_align_set(views, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(views);
- elm_table_pack(table, views, VIEWS_COL, 0, 1, 1);
- }
- else
- elm_list_clear(views);
-
- btn_open_view = elm_button_add(views);
- elm_object_text_set(btn_open_view, "Open a view");
- evas_object_smart_callback_add(btn_open_view, "clicked", _app_view_open, app);
- elm_list_item_append(views, NULL, btn_open_view, NULL, NULL, NULL);
-
- views_iter = elm_app_client_views_get(app);
- EINA_ITERATOR_FOREACH(views_iter, client_view)
- {
- const char *path = NULL;
-
- path = elm_app_client_view_path_get(client_view);
- elm_list_item_append(views, path, NULL, NULL, _app_view_clicked, client_view);
- }
- eina_iterator_free(views_iter);
-
- btn_close_all = elm_button_add(views);
- elm_object_text_set(btn_close_all, "Close all views");
- evas_object_smart_callback_add(btn_close_all, "clicked", _app_close_all_views_cb, app);
- elm_list_item_append(views, NULL, btn_close_all, NULL, NULL, NULL);
-
- btn_terminate = elm_button_add(views);
- elm_object_text_set(btn_terminate, "Terminate application");
- evas_object_smart_callback_add(btn_terminate, "clicked", _app_terminate_cb, app);
- elm_list_item_append(views, NULL, btn_terminate, NULL, NULL, NULL);
-
- elm_list_go(views);
-}
-
-static void
-_view_list_update_cb(void *data EINA_UNUSED, const Efl_Event *event)
-{
- if (app_selected == event->object)
- _app_clicked(event->object, NULL, NULL);
-}
-
-static void
-_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
-{
- Elm_App_Client *app;
- EINA_LIST_FREE(apps_list, app)
- efl_del(app);
-}
-
-static void
-_app_open(const char *package)
-{
- Elm_App_Client *app;
- Eina_List *l;
-
- EINA_LIST_FOREACH(apps_list, l, app)
- {
- const char *app_package = NULL;
-
- app_package = elm_app_client_package_get(app);
- if (!app_package)
- return;
- if (!strcmp(package, app_package))
- return;
- }
-
- app = efl_add(ELM_APP_CLIENT_CLASS, NULL, elm_app_client_constructor(efl_added, package));
- efl_event_callback_add(app, ELM_APP_CLIENT_EVENT_VIEW_LIST_LOADED, _view_list_update_cb, table);
- efl_event_callback_add(app, ELM_APP_CLIENT_EVENT_VIEW_CREATED, _view_list_update_cb, table);
- efl_event_callback_add(app, ELM_APP_CLIENT_EVENT_VIEW_DELETED, _view_list_update_cb, table);
- apps_list = eina_list_append(apps_list, app);
-}
-
-static void
-_btn_app_open_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- Evas_Object *entry = data;
- const char *pkg = elm_object_text_get(entry);
-
- if (!pkg || !pkg[0])
- return;
-
- _app_open(pkg);
- _apps_list_update();
-}
-
-static void
-_open_custom_app_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
-{
- elm_list_item_selected_set(event_info, EINA_FALSE);
- elm_object_focus_set(data, EINA_TRUE);
-}
-
-static void
-_apps_list_update(void)
-{
- Evas_Object *entry, *btn_open, *apps;
- Elm_App_Client *app;
- Eina_List *l;
-
- apps = elm_table_child_get(table, APPS_COL, 0);
- elm_list_clear(apps);
-
- EINA_LIST_FOREACH(apps_list, l, app)
- {
- const char *app_package = NULL;
- app_package = elm_app_client_package_get(app);
- elm_list_item_append(apps, app_package, NULL, NULL, _app_clicked, app);
- }
-
- entry = elm_entry_add(apps);
- elm_entry_single_line_set(entry, EINA_TRUE);
- evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0.5);
-
- btn_open = elm_button_add(apps);
- elm_object_text_set(btn_open, "Open");
- evas_object_smart_callback_add(btn_open, "clicked", _btn_app_open_cb, entry);
- elm_list_item_append(apps, NULL, entry, btn_open, _open_custom_app_cb, entry);
-
- elm_list_go(apps);
-}
-
-void
-test_task_switcher(void *data EINA_UNUSED,
- Evas_Object *obj EINA_UNUSED,
- void *event_info EINA_UNUSED)
-{
- Evas_Object *win, *apps;
-
- if (apps_list)
- {
- printf("Task switcher already open.\n");
- return;
- }
-
- win = elm_win_util_standard_add("task switcher", "Task switcher");
- elm_win_autodel_set(win, EINA_TRUE);
-
- evas_object_smart_callback_add(win, "delete,request", _win_del, NULL);
-
- table = elm_table_add(win);
- elm_win_resize_object_add(win, table);
- elm_table_padding_set(table, 0, 0);
- elm_table_homogeneous_set(table, EINA_TRUE);
- evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- _app_open("org.enlightenment.message");
- _app_open("org.enlightenment.phone");
-
- apps = elm_list_add(table);
- evas_object_size_hint_align_set(apps, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_show(apps);
- elm_table_pack(table, apps, APPS_COL, 0, 1, 1);
- _apps_list_update();
-
- evas_object_show(table);
- evas_object_resize(win, 1024, 768);
- evas_object_show(win);
-}
namespace emotion {
EAPI void register_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
}
-EAPI void register_elm_app_client(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_app_client_view(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_app_server(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_app_server_view(v8::Handle<v8::Object> global, v8::Isolate* isolate);
EAPI void register_elm_atspi_app_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
EAPI void register_elm_interface_atspi_accessible(v8::Handle<v8::Object> global, v8::Isolate* isolate);
EAPI void register_elm_interface_atspi_action(v8::Handle<v8::Object> global, v8::Isolate* isolate);
// elm::register_access(exports, v8::Isolate::GetCurrent());
// elm::register_actionslider(exports, v8::Isolate::GetCurrent());
- // ::register_elm_app_client(exports, v8::Isolate::GetCurrent());
- // ::register_elm_app_client_view(exports, v8::Isolate::GetCurrent());
- // ::register_elm_app_server(exports, v8::Isolate::GetCurrent());
- // ::register_elm_app_server_view(exports, v8::Isolate::GetCurrent());
// ::register_elm_atspi_app_object(exports, v8::Isolate::GetCurrent());
// elm::register_box(exports, v8::Isolate::GetCurrent());
#include <elc_naviframe.h>
#include <elc_popup.h>
#include <elm_actionslider.h>
-#include <elm_app_common.h>
-#include <elm_app_server.h>
-#include <elm_app_server_view.h>
-#include <elm_app_client.h>
-#include <elm_app_client_view.h>
#include <elm_app.h>
#include <elm_atspi_app_object.h>
#include <elm_atspi_bridge.h>
# endif
#endif /* ! _WIN32 */
-EAPI void register_elm_app_client(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_app_client_view(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_app_server(v8::Handle<v8::Object> global, v8::Isolate* isolate);
-EAPI void register_elm_app_server_view(v8::Handle<v8::Object> global, v8::Isolate* isolate);
EAPI void register_elm_atspi_app_object(v8::Handle<v8::Object> global, v8::Isolate* isolate);
EAPI void register_elm_interface_atspi_accessible(v8::Handle<v8::Object> global, v8::Isolate* isolate);
EAPI void register_elm_interface_atspi_action(v8::Handle<v8::Object> global, v8::Isolate* isolate);
{
elm::register_access(exports, v8::Isolate::GetCurrent());
elm::register_actionslider(exports, v8::Isolate::GetCurrent());
- ::register_elm_app_client(exports, v8::Isolate::GetCurrent());
- ::register_elm_app_client_view(exports, v8::Isolate::GetCurrent());
- ::register_elm_app_server(exports, v8::Isolate::GetCurrent());
- ::register_elm_app_server_view(exports, v8::Isolate::GetCurrent());
::register_elm_atspi_app_object(exports, v8::Isolate::GetCurrent());
elm::register_bg(exports, v8::Isolate::GetCurrent());
elm::register_box(exports, v8::Isolate::GetCurrent());
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-
-#include <Elementary.h>
-#include "elm_priv.h"
-
-#define MY_CLASS ELM_APP_CLIENT_CLASS
-
-#define MY_CLASS_NAME "Elm_App_Client"
-
-typedef struct
-{
- Eldbus_Proxy *app_proxy;
- Eina_Hash *views;
-} Elm_App_Client_Data;
-
-static void
-_sub_path_process(Elm_App_Client *eo, Eldbus_Message_Iter *obj_iter, Elm_App_Client_Data *data, Eina_Bool loading_list)
-{
- const char *obj_path;
- Eldbus_Message_Iter *array_iface, *iface;
-
- if (!eldbus_message_iter_arguments_get(obj_iter, "oa{sa{sv}}", &obj_path, &array_iface))
- return;
- while (eldbus_message_iter_get_and_next(array_iface, '{', &iface))
- {
- const char *iface_name;
- Eldbus_Message_Iter *array_props;
- Elm_App_Client_View *view;
-
- if (!eldbus_message_iter_arguments_get(iface, "sa{sv}", &iface_name,
- &array_props))
- continue;
- if (strcmp(iface_name, "org.enlightenment.ApplicationView1"))
- continue;
-
- view = eina_hash_find(data->views, obj_path);
- if (view)
- continue;
-
- view = efl_add(ELM_APP_CLIENT_VIEW_CLASS, eo, elm_app_client_view_path_set(efl_added, obj_path));
- eina_hash_add(data->views, obj_path, view);
- if (!loading_list)
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_EVENT_VIEW_CREATED, view);
- }
-}
-
-static void
-_objects_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED)
-{
- Eo *eo = data;
- Elm_App_Client_Data *cdata = efl_data_scope_get(eo, MY_CLASS);
- Eldbus_Message_Iter *array_path, *path;
-
- if (eldbus_message_error_get(msg, NULL, NULL))
- return;
-
- if (!eldbus_message_arguments_get(msg, "a{oa{sa{sv}}}", &array_path))
- return;
- while (eldbus_message_iter_get_and_next(array_path, '{', &path))
- _sub_path_process(eo, path, cdata, EINA_TRUE);
-
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_EVENT_VIEW_LIST_LOADED, NULL);
-}
-
-static void _iface_add(void *data, const Eldbus_Message *msg)
-{
- Eo *eo = data;
- Elm_App_Client_Data *cdata = efl_data_scope_get(eo, MY_CLASS);
- Eldbus_Message_Iter *main_iter;
-
- main_iter = eldbus_message_iter_get(msg);
- _sub_path_process(eo, main_iter, cdata, EINA_FALSE);
-}
-
-static void
-_iface_del(void *data, const Eldbus_Message *msg)
-{
- Eo *eo = data;
- Elm_App_Client_Data *cdata = efl_data_scope_get(eo, MY_CLASS);
- const char *path, *iface;
- Eldbus_Message_Iter *array_iface;
-
- if (!eldbus_message_arguments_get(msg, "oas", &path, &array_iface))
- return;
- while (eldbus_message_iter_get_and_next(array_iface, 's', &iface))
- {
- Elm_App_Client_View *view;
- Elm_App_View_State view_state = ELM_APP_VIEW_STATE_UNKNOWN;
-
- if (strcmp(iface, "org.enlightenment.ApplicationView1"))
- continue;
-
- view = eina_hash_find(cdata->views, path);
- if (!view)
- continue;
-
- view_state = elm_app_client_view_state_get(view);
- if (view_state != ELM_APP_VIEW_STATE_CLOSED)
- {
- elm_app_client_view_internal_state_set(view,
- ELM_APP_VIEW_STATE_SHALLOW);
- continue;
- }
-
- eina_hash_del(cdata->views, path, NULL);
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_EVENT_VIEW_DELETED, view);
- efl_del(view);
- }
-}
-
-static void
-_pkg_name_owner_changed_cb(void *data, const char *bus EINA_UNUSED, const char *old_id EINA_UNUSED, const char *new_id)
-{
- Elm_App_Client *eo = data;
- Elm_App_Client_Data *cdata = efl_data_scope_get(eo, MY_CLASS);
- Eina_Iterator *iter;
- Elm_App_Client_View *view;
- Eina_List *views_list = NULL;
-
- if (!new_id || (new_id[0] == '\0'))
- return;
-
- iter = eina_hash_iterator_data_new(cdata->views);
- EINA_ITERATOR_FOREACH(iter, view)
- views_list = eina_list_append(views_list, view);
- eina_iterator_free(iter);
-
- /*
- * remove all views that are closed of the views hash
- * views not closed, only set they to SHALLOW
- */
- EINA_LIST_FREE(views_list, view)
- {
- Elm_App_View_State view_state = ELM_APP_VIEW_STATE_UNKNOWN;
- const char *path = NULL;
-
- view_state = elm_app_client_view_state_get(view);
- path = elm_app_client_view_path_get(view);
- if (view_state != ELM_APP_VIEW_STATE_CLOSED)
- {
- elm_app_client_view_internal_state_set(view,
- ELM_APP_VIEW_STATE_SHALLOW);
- continue;
- }
-
- eina_hash_del(cdata->views, path, NULL);
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_EVENT_VIEW_DELETED, view);
- efl_del(view);
- }
-}
-
-EOLIAN static void
-_elm_app_client_constructor(Eo *eo, Elm_App_Client_Data *data, const char *pkg)
-{
- Eldbus_Connection *conn;
- Eldbus_Object *obj;
- char *path;
-
- EINA_SAFETY_ON_NULL_RETURN(pkg);
-
- data->views = eina_hash_string_small_new(NULL);
-
- path = _dbus_package_to_path(pkg);
-
- eldbus_init();
- conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
- obj = eldbus_object_get(conn, pkg, path);
- data->app_proxy = eldbus_proxy_get(obj, "org.enlightenment.Application1");
- eldbus_object_managed_objects_get(obj, _objects_get, eo);
- eldbus_object_manager_interfaces_added(obj, _iface_add, eo);
- eldbus_object_manager_interfaces_removed(obj, _iface_del, eo);
- eldbus_name_owner_changed_callback_add(conn, pkg, _pkg_name_owner_changed_cb,
- eo, EINA_FALSE);
-
- free(path);
-}
-
-static void
-_create_view_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
-{
- Elm_App_Client_Open_View_Cb cb = eldbus_pending_data_del(pending, "user_cb");
- void *user_data = eldbus_pending_data_del(pending, "user_data");
- const char *error_name, *error_message, *view_path;
- Elm_App_Client *eo = data;
- Elm_App_Client_View *view;
- Elm_App_Client_Data *cdata = efl_data_scope_get(eo, MY_CLASS);
-
- if (eldbus_message_error_get(msg, &error_name, &error_message))
- {
- if (!cb)
- return;
- if (error_name && !strcmp(error_name, ELDBUS_ERROR_PENDING_CANCELED))
- cb(user_data, NULL, ELM_APP_CLIENT_VIEW_OPEN_CANCELED, NULL);
- else if (error_name && !strcmp(error_name, ELDBUS_ERROR_PENDING_TIMEOUT))
- cb(user_data, NULL, ELM_APP_CLIENT_VIEW_OPEN_TIMEOUT, error_message);
- else
- cb(user_data, NULL, error_name, error_message);
- return;
- }
-
- if (!eldbus_message_arguments_get(msg, "o", &view_path))
- {
- if (cb)
- cb(user_data, NULL, "Unknow error", NULL);
- return;
- }
-
- /**
- * Because a IntefaceAdd signal could arrive first
- */
- view = eina_hash_find(cdata->views, view_path);
- if (!view)
- {
- view = efl_add(ELM_APP_CLIENT_VIEW_CLASS, eo, elm_app_client_view_path_set(efl_added, view_path));
- eina_hash_add(cdata->views, view_path, view);
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_EVENT_VIEW_CREATED, view);
- }
-
- if (!view)
- {
- if (cb)
- cb(user_data, NULL, ELM_APP_CLEINT_VIEW_OPEN_ERROR, NULL);
- return;
- }
- if (cb)
- cb(user_data, view, NULL, NULL);
-}
-
-EOLIAN static Elm_App_Client_Pending *
-_elm_app_client_view_open(Eo *eo, Elm_App_Client_Data *data, Eina_Value *args, Elm_App_Client_Open_View_Cb cb, const void *user_data)
-{
- Eldbus_Message *msg;
- Eldbus_Pending *pending;
-
- msg = eldbus_proxy_method_call_new(data->app_proxy, "CreateView");
-
- if (args)
- {
- if (!eldbus_message_from_eina_value("a{sv}", msg, args))
- {
- eldbus_message_unref(msg);
- //TODO test to find out what type eina_value must be
- ERR("Eina_Value of args don't have a structure of a{sv}");
- return NULL;
- }
- }
- else
- {
- Eldbus_Message_Iter *main_iter = eldbus_message_iter_get(msg);
- Eldbus_Message_Iter *array;
-
- eldbus_message_iter_arguments_append(main_iter, "a{sv}", &array);
- eldbus_message_iter_container_close(main_iter, array);
- }
-
- pending = eldbus_proxy_send(data->app_proxy, msg, _create_view_cb, eo, -1);
- if (user_data)
- eldbus_pending_data_set(pending, "user_data", user_data);
- if (cb)
- eldbus_pending_data_set(pending, "user_cb", cb);
-
- return pending;
-}
-
-EOLIAN static Eina_Iterator*
-_elm_app_client_views_get(Eo *eo EINA_UNUSED, Elm_App_Client_Data *data)
-{
- return eina_hash_iterator_data_new(data->views);
-}
-
-static void
-_elm_app_client_view_all_close(Eo *obj EINA_UNUSED, Elm_App_Client_Data *data)
-{
- eldbus_proxy_call(data->app_proxy, "CloseAllViews", NULL, NULL, -1, "");
-}
-
-EOLIAN static void
-_elm_app_client_terminate(Eo *eo EINA_UNUSED, Elm_App_Client_Data *data)
-{
- eldbus_proxy_call(data->app_proxy, "Terminate", NULL, NULL, -1, "");
-}
-
-EOLIAN static const char*
-_elm_app_client_package_get(Eo *eo EINA_UNUSED, Elm_App_Client_Data *data)
-{
- Eldbus_Object *obj;
-
- obj = eldbus_proxy_object_get(data->app_proxy);
- return eldbus_object_bus_name_get(obj);
-}
-
-EOLIAN static void
-_elm_app_client_view_open_cancel(Eo *eo EINA_UNUSED, Elm_App_Client_Data *_pd EINA_UNUSED, Elm_App_Client_Pending *pending)
-{
- eldbus_pending_cancel(pending);
-}
-
-EOLIAN static Eo *
-_elm_app_client_efl_object_finalize(Eo *obj, Elm_App_Client_Data *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(data->views, NULL);
-
- return efl_finalize(efl_super(obj, MY_CLASS));
-}
-
-EOLIAN static void
-_elm_app_client_efl_object_destructor(Eo *eo, Elm_App_Client_Data *data)
-{
- Eldbus_Object *obj;
- Eldbus_Connection *conn;
- Eina_Iterator *iter;
- Elm_App_Client_View *view;
-
- iter = eina_hash_iterator_data_new(data->views);
- EINA_ITERATOR_FOREACH(iter, view)
- efl_del(view);
- eina_iterator_free(iter);
- eina_hash_free(data->views);
-
- obj = eldbus_proxy_object_get(data->app_proxy);
- conn = eldbus_object_connection_get(obj);
- eldbus_name_owner_changed_callback_del(conn, eldbus_object_bus_name_get(obj),
- _pkg_name_owner_changed_cb, eo);
- eldbus_proxy_unref(data->app_proxy);
- eldbus_object_unref(obj);
- eldbus_connection_unref(conn);
- eldbus_shutdown();
-
- efl_destructor(efl_super(eo, MY_CLASS));
-}
-
-#include "elm_app_client.eo.c"
+++ /dev/null
-import eina_types;
-
-type Elm_App_Client_Open_View_Cb: __undefined_type;
-type Elm_App_Client_Pending: __undefined_type;
-
-class Elm.App.Client (Efl.Object)
-{
- methods {
- @property views {
- get {
- [[Return a iterator with all views of application.]]
- }
- values {
- ret: free(own(iterator<Elm.App.Client.View>), eina_iterator_free); [[The iterator with all views, must be freed after use.]]
- }
- }
- @property package {
- get {
- [[Return the application package.]]
- }
- values {
- ret: string; [[application package]]
- }
- }
- constructor {
- [[Class constructor of elm_app_client.]]
- legacy: null;
- params {
- @in package: string; [[Package of application]]
- }
- }
- view_all_close {
- [[Close all views of application.]]
- }
- terminate {
- [[Terminate application.]]
- }
- view_open {
- [[Open an application view.]]
- params {
- @in args: generic_value * @optional; [[an array of.]]
- @in view_open_cb: Elm_App_Client_Open_View_Cb @optional; [[callback to be called when view open]]
- @in data: const(void_ptr) @optional; [[callback user data]]
- }
- return: Elm_App_Client_Pending *; [[handler to cancel the view opening if it takes to long ]]
- }
- view_open_cancel {
- [[Cancel a pending elm_app_client_view_open().]]
- params {
- @in pending: Elm_App_Client_Pending *; [[the view open handler]]
- }
- }
- }
- implements {
- Efl.Object.destructor;
- Efl.Object.finalize;
- }
- constructors {
- .constructor;
- }
- events {
- view,created; [[Called when a view of this application is created.]]
- view,deleted; [[Called when a view of this application is deleted.]]
- view_list,loaded; [[Called when list of view is loaded.]]
- application,terminated; [[Called when application is terminated.]]
- }
-
-}
+++ /dev/null
-#ifdef EFL_EO_API_SUPPORT
-#include "elm_app_client_eo.h"
-#endif
+++ /dev/null
-typedef Eo Elm_App_Client;
-#define _ELM_APP_CLIENT_EO_CLASS_TYPE
-
-typedef Eo Elm_App_Client_View;
-#define _ELM_APP_CLIENT_VIEW_EO_CLASS_TYPE
-
-typedef Eldbus_Pending Elm_App_Client_Pending;
-
-typedef void (*Elm_App_Client_Open_View_Cb)(void *data, Elm_App_Client_View *view, const char *error, const char *error_message);
-
-#include "elm_app_client.eo.h"
\ No newline at end of file
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-
-#include <Elementary.h>
-#include "elm_priv.h"
-
-#define MY_CLASS ELM_APP_CLIENT_VIEW_CLASS
-
-#define MY_CLASS_NAME "Elm_App_Client_View"
-
-typedef struct
-{
- Eldbus_Proxy *view_proxy;
- Elm_App_View_State state;
- Eina_Stringshare *path;
-} Elm_App_Client_View_Data;
-
-static const char *_string_prop_get(const Eina_Value *v)
-{
- const char *str;
-
- if (!v)
- return "";
-
- eina_value_get(v, &str);
- return str;
-}
-
-static int _int_prop_get(const Eina_Value *v)
-{
- int num;
-
- if (!v)
- return 0;
-
- eina_value_get(v, &num);
- return num;
-}
-
-static short _short_prop_get(const Eina_Value *v)
-{
- short num;
-
- if (!v)
- return 0;
-
- eina_value_get(v, &num);
- return num;
-}
-
-static void
-_prop_changed(void *user_data, Eldbus_Proxy *proxy EINA_UNUSED, void *event_info)
-{
- Eldbus_Proxy_Event_Property_Changed *prop_event = event_info;
- Elm_App_Client_View *eo = user_data;
- const Eina_Value *v = prop_event->value;
- Elm_App_Client_View_Data *cdata = efl_data_scope_get(eo, MY_CLASS);
-
- if (!strcmp(prop_event->name, "Title"))
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_TITLE_CHANGED, (void *) _string_prop_get(v));
- else if (!strcmp(prop_event->name, "IconName"))
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_ICON_CHANGED, (void *) _string_prop_get(v));
- else if (!strcmp(prop_event->name, "IconPixels"))
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_ICON_PIXELS_CHANGED, NULL);
- else if (!strcmp(prop_event->name, "NewEvents"))
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_NEW_EVENTS_CHANGED, (void *)(uintptr_t)_int_prop_get(v));
- else if (!strcmp(prop_event->name, "Progress"))
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_PROGRESS_CHANGED, (void *)(uintptr_t)_short_prop_get(v));
- else if (!strcmp(prop_event->name, "State"))
- {
- cdata->state = _string_state_to_id(_string_prop_get(v));
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_STATE_CHANGED, (void *)(uintptr_t)cdata->state);
- }
- else if (!strcmp(prop_event->name, "WindowId"))
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_WINDOW_CHANGED, (void *)(uintptr_t)_int_prop_get(v));
- else
- return;
-
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_PROPERTY_CHANGED, (void *) prop_event->name);
-}
-
-static void
-_props_loaded(void *user_data, Eldbus_Proxy *proxy EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- const Eina_Hash *props = eldbus_proxy_property_local_get_all(proxy);
- Eina_Iterator *iter;
- Eina_Hash_Tuple *t;
-
- iter = eina_hash_iterator_tuple_new(props);
- EINA_ITERATOR_FOREACH(iter, t)
- {
- Eldbus_Proxy_Event_Property_Changed event;
-
- event.name = t->key;
- event.proxy = proxy;
- event.value = t->data;
-
- _prop_changed(user_data, proxy, &event);
- }
- eina_iterator_free(iter);
-}
-
-void
-elm_app_client_view_internal_state_set(Eo *eo, Elm_App_View_State state)
-{
- Elm_App_Client_View_Data *cdata;
- Eina_Bool changed = EINA_FALSE;
-
- EINA_SAFETY_ON_NULL_RETURN(eo);
- EINA_SAFETY_ON_FALSE_RETURN(efl_isa(eo, ELM_APP_CLIENT_VIEW_CLASS));
-
- cdata = efl_data_scope_get(eo, MY_CLASS);
- changed = cdata->state != state;
- cdata->state = state;
- if (!changed)
- return;
- efl_event_callback_legacy_call(eo, ELM_APP_CLIENT_VIEW_EVENT_STATE_CHANGED, (void *)(uintptr_t)cdata->state);
-}
-
-EOLIAN static Eo *
-_elm_app_client_view_efl_object_finalize(Eo *eo, Elm_App_Client_View_Data *data)
-{
- Elm_App_Client *parent = NULL;
- const char *package = data->path;
- Eldbus_Connection *conn;
- Eldbus_Object *obj;
-
- parent = efl_parent_get(eo);
- EINA_SAFETY_ON_TRUE_RETURN_VAL((!parent) ||
- (!efl_isa(parent, ELM_APP_CLIENT_CLASS)), NULL);
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(data->path, NULL);
-
- package = elm_app_client_package_get(parent);
-
- eldbus_init();
- conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
- obj = eldbus_object_get(conn, package, data->path);
- data->view_proxy = eldbus_proxy_get(obj,
- "org.enlightenment.ApplicationView1");
- eldbus_proxy_properties_monitor(data->view_proxy, EINA_TRUE);
- eldbus_proxy_event_callback_add(data->view_proxy,
- ELDBUS_PROXY_EVENT_PROPERTY_CHANGED,
- _prop_changed, eo);
- eldbus_proxy_event_callback_add(data->view_proxy,
- ELDBUS_PROXY_EVENT_PROPERTY_LOADED,
- _props_loaded, eo);
-
- return efl_finalize(efl_super(eo, MY_CLASS));
-}
-
-static void
-_dbus_state_set_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
-{
- Elm_App_Client_View *eo = data;
- Elm_App_Client_View_Cb cb = eldbus_pending_data_del(pending, "cb");
- void *user_data = eldbus_pending_data_del(pending, "user_data");
- const char *error = NULL, *error_message = NULL;
-
- if (!cb) return;
-
- if (!eldbus_message_error_get(msg, &error, &error_message))
- error_message = NULL;
-
- cb(user_data, eo, error, error_message);
-}
-
-static void
-_dbus_action_do(Eo *eo, Eldbus_Proxy *proxy, const char *action, Elm_App_Client_View_Cb cb, const void *data)
-{
- Eldbus_Pending *pending;
-
- if (!cb)
- {
- eldbus_proxy_call(proxy, action, NULL, NULL, -1, "");
- return;
- }
-
- pending = eldbus_proxy_call(proxy, action, _dbus_state_set_cb, eo, -1, "");
- eldbus_pending_data_set(pending, "cb", cb);
- eldbus_pending_data_set(pending, "user_data", data);
-}
-
-EOLIAN static void
-_elm_app_client_view_resume(Eo *eo, Elm_App_Client_View_Data *data, Elm_App_Client_View_Cb cb, const void *user_data)
-{
-
- _dbus_action_do(eo, data->view_proxy, "Resume", cb, user_data);
-}
-
-EOLIAN static void
-_elm_app_client_view_pause(Eo *eo, Elm_App_Client_View_Data *data, Elm_App_Client_View_Cb cb, const void *user_data)
-{
-
- _dbus_action_do(eo, data->view_proxy, "Pause", cb, user_data);
-}
-
-EOLIAN static void
-_elm_app_client_view_close(Eo *eo, Elm_App_Client_View_Data *data, Elm_App_Client_View_Cb cb, const void *user_data)
-{
-
- _dbus_action_do(eo, data->view_proxy, "Close", cb, user_data);
-}
-
-EOLIAN static const char*
-_elm_app_client_view_title_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- Eina_Value *v;
-
- v = eldbus_proxy_property_local_get(data->view_proxy, "Title");
- return _string_prop_get(v);
-}
-
-EOLIAN static const char*
-_elm_app_client_view_icon_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- Eina_Value *v;
-
- v = eldbus_proxy_property_local_get(data->view_proxy, "IconName");
- return _string_prop_get(v);
-}
-
-EOLIAN static void
-_elm_app_client_view_icon_pixels_get(Eo *obj EINA_UNUSED, Elm_App_Client_View_Data *pd EINA_UNUSED,
- unsigned int *w EINA_UNUSED, unsigned int *h EINA_UNUSED,
- Eina_Bool *has_alpha EINA_UNUSED, const unsigned char **pixels EINA_UNUSED)
-{
- //TODO
-}
-
-EOLIAN static unsigned short
-_elm_app_client_view_progress_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- Eina_Value *v;
-
- v = eldbus_proxy_property_local_get(data->view_proxy, "Progress");
- return _short_prop_get(v);
-}
-
-EOLIAN static int
-_elm_app_client_view_new_events_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- Eina_Value *v;
-
- v = eldbus_proxy_property_local_get(data->view_proxy, "NewEvents");
- return _int_prop_get(v);
-}
-
-EOLIAN static Elm_App_View_State
-_elm_app_client_view_state_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- return data->state;
-}
-
-EOLIAN static int
-_elm_app_client_view_window_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- Eina_Value *v;
-
- v = eldbus_proxy_property_local_get(data->view_proxy, "WindowId");
- return _int_prop_get(v);
-}
-
-EOLIAN static void
-_elm_app_client_view_path_set(Eo *eo, Elm_App_Client_View_Data *data, const char *path)
-{
- if (efl_finalized_get(eo))
- {
- ERR("Can't set id after object has been created.");
- return;
- }
-
- data->path = eina_stringshare_add(path);
-}
-
-EOLIAN static const char*
-_elm_app_client_view_path_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- Eldbus_Object *obj;
-
- obj = eldbus_proxy_object_get(data->view_proxy);
- return eldbus_object_path_get(obj);
-}
-
-EOLIAN static const char*
-_elm_app_client_view_package_get(Eo *eo EINA_UNUSED, Elm_App_Client_View_Data *data)
-{
- Eldbus_Object *obj;
-
- obj = eldbus_proxy_object_get(data->view_proxy);
- return eldbus_object_bus_name_get(obj);
-}
-
-EOLIAN static void
-_elm_app_client_view_efl_object_destructor(Eo *eo, Elm_App_Client_View_Data *data)
-{
- Eldbus_Object *obj;
- Eldbus_Connection *conn;
-
- eldbus_proxy_properties_monitor(data->view_proxy, EINA_FALSE);
- obj = eldbus_proxy_object_get(data->view_proxy);
- conn = eldbus_object_connection_get(obj);
-
- eldbus_proxy_unref(data->view_proxy);
- eldbus_object_unref(obj);
- eldbus_connection_unref(conn);
- eldbus_shutdown();
-
- eina_stringshare_del(data->path);
-
- efl_destructor(efl_super(eo, MY_CLASS));
-}
-
-#include "elm_app_client_view.eo.c"
+++ /dev/null
-import elm_general;
-
-type Elm_App_Client_View_Cb: __undefined_type;
-
-class Elm.App.Client.View (Efl.Object)
-{
- methods {
- @property state {
- get {
- [[Get state of view]]
- }
- values {
- state: Elm.App.View_State; [[state of view]]
- }
- }
- @property new_events {
- get {
- [[Get new events of view]]
- }
- values {
- events: int; [[number of events of view]]
- }
- }
- @property window {
- get {
- [[Get window of view]]
- }
- values {
- window: int; [[window of view]]
- }
- }
- @property icon_pixels {
- get {
- [[Get icon pixels of view, view could have a icon
- in raw format not saved in disk.
- ]]
- }
- values {
- w: uint; [[icon width]]
- h: uint; [[icon height]]
- has_alpha: bool; [[if icon have alpha channel]]
- pixels: const(ubyte)*; [[uchar array, with all bytes of icon]]
- }
- }
- path_set {
- params {
- path: string;
- }
- }
- @property path {
- get {
- [[Get DBus path of view]]
- }
- values {
- ret: stringshare; [[DBus path of view]]
- }
- }
- @property package {
- get {
- [[Get application package]]
- }
- values {
- ret: string; [[Package of application]]
- }
- }
- @property icon {
- get {
- [[Get icon path of view]]
- }
- values {
- ret: string; [[icon path of view]]
- }
- }
- @property progress {
- get {
- [[Get progress of view, should be -1 if there nothing in progress
- or something between 0-100
- ]]
- }
- values {
- progress: ushort; [[progress of view]]
- }
- }
- @property title {
- get {
- [[Get title of view]]
- }
- values {
- ret: string; [[title of view]]
- }
- }
- pause {
- [[Pause view]]
- params {
- @in cb: Elm_App_Client_View_Cb @optional; [[callback to be called when view was paused ]]
- @in data: const(void_ptr) @optional; [[callback user data]]
- }
- }
- resume {
- [[Resume view]]
- params {
- @in cb: Elm_App_Client_View_Cb @optional; [[callback to be called when view was resumed]]
- @in data: const(void_ptr) @optional; [[callback user data]]
- }
- }
- close {
- [[Close view]]
- params {
- @in cb: Elm_App_Client_View_Cb @optional; [[callback to be called when view was closed]]
- @in data: const(void_ptr) @optional; [[callback user data]]
- }
- }
- }
- implements {
- Efl.Object.destructor;
- Efl.Object.finalize;
- }
- events {
- state,changed; [[State of view changed.]]
- title,changed; [[Title of view changed.]]
- icon,changed; [[Icon of view changed.]]
- icon,pixels,changed; [[Icons pixels of view changed.]]
- new_events,changed; [[New events of view changed.]]
- progress,changed; [[Progress of view changed.]]
- window,changed; [[Window of view changed.]]
- property,changed; [[One of view properties changed.]]
- }
-
-}
+++ /dev/null
-#ifdef EFL_EO_API_SUPPORT
-#include "elm_app_client_view_eo.h"
-#endif
+++ /dev/null
-typedef void *(*Elm_App_Client_View_Cb)(void *data, Elm_App_Client_View *view, const char *error, const char *error_message);
-
-#include "elm_app_client_view.eo.h"
\ No newline at end of file
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-
-#include <Elementary.h>
-#include "elm_priv.h"
-
-char *
-_dbus_package_to_path(const char *pkg)
-{
- Eina_Strbuf *buffer;
- char *ret;
-
- buffer = eina_strbuf_new();
- eina_strbuf_append_char(buffer, '/');
- for (; *pkg != '\0'; pkg++)
- {
- if (*pkg == '.')
- eina_strbuf_append_char(buffer, '/');
- else if (isalnum(*pkg))
- eina_strbuf_append_char(buffer, *pkg);
- else
- eina_strbuf_append_printf(buffer, "_%02x", *pkg);
- }
-
- ret = eina_strbuf_string_steal(buffer);
- eina_strbuf_free(buffer);
-
- return ret;
-}
-
-static const char *_string_states[] = {
- "unknown",
- "live",
- "paused",
- "closed",
- "shallow",
- NULL
-};
-
-Elm_App_View_State _string_state_to_id(const char *state)
-{
- int i;
-
- for (i = 0; _string_states[i]; i++)
- {
- if (!strcmp(state, _string_states[i]))
- return i;
- }
- return 0;
-}
-
-const char *_state_id_to_string(Elm_App_View_State state)
-{
- return _string_states[state];
-}
+++ /dev/null
-
-char *_dbus_package_to_path(const char *package);
-
-Elm_App_View_State _string_state_to_id(const char *state);
-
-const char *_state_id_to_string(Elm_App_View_State state);
-
-void elm_app_client_view_internal_state_set(Eo *eo, Elm_App_View_State state);
-
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-
-#include <Elementary.h>
-#include "elm_priv.h"
-#include "elm_app_server_eet.h"
-
-#define MY_CLASS ELM_APP_SERVER_CLASS
-
-#define MY_CLASS_NAME "Elm_App_Server"
-
-typedef struct
-{
- Eldbus_Connection *conn;
- Eldbus_Service_Interface *iface;
- Elm_App_Server_Create_View_Cb create_view_cb;
- Eina_Hash *views;
-
- int PID;
- Eina_Stringshare *title;
- Eina_Stringshare *icon_name;
- Eina_Stringshare *pkg;
- struct {
- unsigned int w, h;
- Eina_Bool has_alpha;
- unsigned char *raw;
- } image_raw;
-} Elm_App_Server_Data;
-
-static void
-_view_del_cb(void *data, const Efl_Event *event)
-{
- Elm_App_Server_Data *cdata = data;
- eina_hash_del(cdata->views, NULL, event->object);
-}
-
-static Eina_Bool
-_view_append(Elm_App_Server_Data *data, Elm_App_Server_View *view)
-{
- Eina_Stringshare *view_id = NULL;
-
- view_id = elm_app_server_view_id_get(view);
-
- if (eina_hash_find(data->views, view_id))
- {
- ERR("%p already have a view with id=%s", data->pkg, view_id);
- efl_del(view);
- return EINA_FALSE;
- }
-
- eina_hash_add(data->views, view_id, view);
- efl_event_callback_add(view, EFL_EVENT_DEL, _view_del_cb, data);
- return EINA_TRUE;
-}
-
-static Eldbus_Message *
-_method_create_view(const Eldbus_Service_Interface *iface, const Eldbus_Message *message)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_Data *data = efl_data_scope_get(eo, MY_CLASS);
- Eina_Value *args;
- Eina_Stringshare *error_name, *error_message, *view_path = NULL;
- Elm_App_Server_View *view;
- Eldbus_Message *reply;
-
- args = eldbus_message_to_eina_value(message);
- if (!args)
- return eldbus_message_error_new(message, ELM_APP_CLEINT_VIEW_OPEN_ERROR, "");
-
- view = data->create_view_cb(eo, args, &error_name, &error_message);
- eina_value_free(args);
-
- if (!view)
- {
- reply = eldbus_message_error_new(message, error_name, error_message);
- eina_stringshare_del(error_name);
- eina_stringshare_del(error_message);
- return reply;
- }
-
- if (!_view_append(data, view))
- {
- reply = eldbus_message_error_new(message,
- ELM_APP_SERVER_VIEW_CREATE_DUPLICATE,
- NULL);
- return reply;
- }
- view_path = elm_app_server_view_path_get(view);
-
- reply = eldbus_message_method_return_new(message);
- eldbus_message_arguments_append(reply, "o", view_path);
-
- return reply;
-}
-
-static void
-_close_all_views(Elm_App_Server_Data *data)
-{
- Eina_Iterator *iter;
- Elm_App_Server_View *view;
- Eina_List *view_list = NULL;
-
- /*
- * need do this because hash will be modified when called
- * elm_app_server_view_close()
- */
- iter = eina_hash_iterator_data_new(data->views);
- EINA_ITERATOR_FOREACH(iter, view)
- view_list = eina_list_append(view_list, view);
- eina_iterator_free(iter);
-
- EINA_LIST_FREE(view_list, view)
- elm_app_server_view_close(view);
-}
-
-static Eldbus_Message *
-_method_close_all_views(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *message EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- _close_all_views(data);
-
- return eldbus_message_method_return_new(message);
-}
-
-static Eldbus_Message *
-_method_terminate(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *message EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
-
- efl_event_callback_legacy_call(eo, ELM_APP_SERVER_EVENT_TERMINATE, NULL);
-
- return eldbus_message_method_return_new(message);
-}
-
-static const Eldbus_Method _methods[] = {
- { "CreateView", ELDBUS_ARGS({"a{sv}", "arguments"}),
- ELDBUS_ARGS({"o", "view_path"}), _method_create_view, 0 },
- { "CloseAllViews", NULL, NULL, _method_close_all_views, 0},
- { "Terminate", NULL, NULL, _method_terminate, 0 },
- { NULL, NULL, NULL, NULL, 0 }
-};
-
-static Eina_Bool
-_prop_pid_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 'i', data->PID);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_prop_title_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 's', data->title);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_prop_icon_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 's', data->icon_name);
- return EINA_TRUE;
-}
-
-/*static Eina_Bool
-_prop_icon_pixels_get(const Eldbus_Service_Interface *iface EINA_UNUSED, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter EINA_UNUSED, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- //TODO
- return EINA_FALSE;
-}*/
-
-static const Eldbus_Property _props[] = {
- { "PID", "i", _prop_pid_get, NULL, 0 },
- { "Title", "s", _prop_title_get, NULL, 0 },
- { "IconName", "s", _prop_icon_get, NULL, 0 },
- //{ "IconPixels", "(uubay)", _prop_icon_pixels_get, NULL, 0 },
- { NULL, NULL, NULL, NULL, 0 }
-};
-
-static const Eldbus_Service_Interface_Desc iface_desc = {
- "org.enlightenment.Application1", _methods, NULL, _props, NULL, NULL
-};
-
-EOLIAN static void
-_elm_app_server_constructor(Eo *obj, Elm_App_Server_Data *data, const char *pkg, Elm_App_Server_Create_View_Cb create_view_cb)
-{
- char *path;
- Elm_App_Server_Views_Eet *views_eet;
- char buf[PATH_MAX];
-
- data->create_view_cb = create_view_cb;
-
- EINA_SAFETY_ON_NULL_RETURN(data->create_view_cb);
- EINA_SAFETY_ON_TRUE_RETURN(!pkg);
-
- data->views = eina_hash_string_small_new(NULL);
- data->PID = getpid();
- data->title = eina_stringshare_add("");
- data->icon_name = eina_stringshare_add("");
- data->pkg = eina_stringshare_add(pkg);
-
- path = _dbus_package_to_path(pkg);
-
- eldbus_init();
- data->conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
- eldbus_name_request(data->conn, pkg, 0, NULL, NULL);
- data->iface = eldbus_service_interface_register(data->conn,
- path,
- &iface_desc);
- eldbus_service_object_data_set(data->iface, MY_CLASS_NAME, obj);
- eldbus_service_object_manager_attach(data->iface);
-
- free(path);
-
- //Check if there a saved list of views
- app_server_views_eet_init();
-
- _elm_config_user_dir_snprintf(buf, sizeof(buf), "apps/%s.eet",
- data->pkg);
- views_eet = elm_app_server_views_eet_load(buf);
- if (views_eet)
- {
- Elm_App_Server_View_Props *view_eet_props;
- Eina_List *l, *views_list;
-
- views_list = elm_app_server_views_eet_views_entries_list_get(views_eet);
- if (!views_list)
- goto free_views_eet;
-
- EINA_LIST_FOREACH(views_list, l, view_eet_props)
- {
- Elm_App_Server_View *view;
- const char *view_id, *title, *icon_name;
- int new_events;
- short progress;
-
- view_id = elm_app_server_view_props_id_get(view_eet_props);
-
- if (eina_hash_find(data->views, view_id))
- continue;
- title = elm_app_server_view_props_title_get(view_eet_props);
- icon_name = elm_app_server_view_props_icon_name_get(view_eet_props);
- new_events = elm_app_server_view_props_new_events_get(view_eet_props);
- progress = elm_app_server_view_props_progress_get(view_eet_props);
-
- view = efl_add(ELM_APP_SERVER_VIEW_CLASS, obj, elm_app_server_view_id_set(efl_added, view_id));
- if (!view)
- continue;
-
- elm_app_server_view_title_set(view, title);
- elm_app_server_view_icon_set(view, icon_name);
- elm_app_server_view_progress_set(view, progress);
- elm_app_server_view_new_events_set(view, new_events);
- efl_event_callback_add(view, EFL_EVENT_DEL, _view_del_cb, data);
- elm_app_server_view_shallow(view);
-
- eina_hash_add(data->views, view_id, view);
- }
-
-free_views_eet:
- elm_app_server_views_eet_free(views_eet);
- }
-
- app_server_views_eet_shutdown();
-
- return;
-}
-
-EOLIAN static void
-_elm_app_server_save(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data)
-{
- Eina_Iterator *iter;
- Elm_App_Server_View *view;
- Elm_App_Server_Views_Eet *views_eet;
- char buf[PATH_MAX];
-
- app_server_views_eet_init();
-
- views_eet = elm_app_server_views_eet_new(1, NULL);
-
- if (!views_eet) return;
-
- iter = eina_hash_iterator_data_new(data->views);
- EINA_ITERATOR_FOREACH(iter, view)
- {
- Elm_App_Server_View_Props *view_props;
- const char *id = NULL, *title = NULL, *icon_name = NULL;
- int new_events = 0;
- short progress = 0;
-
- id = elm_app_server_view_id_get(view);
- title = elm_app_server_view_title_get(view);
- icon_name = elm_app_server_view_icon_get(view);
- new_events = elm_app_server_view_new_events_get(view);
- progress = elm_app_server_view_progress_get(view);
- efl_event_callback_legacy_call(view, ELM_APP_SERVER_VIEW_EVENT_SAVE, NULL);
-
- view_props = elm_app_server_view_props_new(id, title, icon_name,
- new_events, progress);
- elm_app_server_views_eet_views_entries_add(views_eet, view_props);
- }
- eina_iterator_free(iter);
-
- _elm_config_user_dir_snprintf(buf, sizeof(buf), "apps/");
- if (!ecore_file_is_dir(buf))
- ecore_file_mkpath(buf);
- _elm_config_user_dir_snprintf(buf, sizeof(buf), "apps/%s.eet", data->pkg);
- elm_app_server_views_eet_save(views_eet, buf);
- elm_app_server_views_eet_free(views_eet);
- app_server_views_eet_shutdown();
-}
-
-EOLIAN static void
-_elm_app_server_close_all(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data)
-{
- _close_all_views(data);
-}
-
-EOLIAN static Eina_Bool
-_elm_app_server_view_check(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data, const char *id)
-{
- const char *ptr;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(id, EINA_FALSE);
-
- for (ptr = id; *ptr; ptr++)
- {
- if (!isalnum(*ptr))
- break;
- }
-
- if (!eina_hash_find(data->views, id)) return EINA_TRUE;
- return EINA_FALSE;
-}
-
-EOLIAN static void
-_elm_app_server_title_set(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data, const char *title)
-{
- title = title ? title : "";
-
- if (eina_stringshare_replace(&data->title, title))
- eldbus_service_property_changed(data->iface, "Title");
-}
-
-EOLIAN static Eina_Stringshare *
-_elm_app_server_title_get(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data)
-{
- return data->title;
-}
-
-EOLIAN static void
-_elm_app_server_icon_set(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data, const char *icon)
-{
- icon = icon ? icon : "";
-
- if (eina_stringshare_replace(&data->icon_name, icon))
- eldbus_service_property_changed(data->iface, "IconName");
-}
-
-EOLIAN static Eina_Stringshare *
-_elm_app_server_icon_get(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data)
-{
- return data->icon_name;
-}
-
-EOLIAN static void
-_elm_app_server_pixels_set(Eo *obj EINA_UNUSED, Elm_App_Server_Data *pd EINA_UNUSED,
- unsigned int w EINA_UNUSED, unsigned int h EINA_UNUSED,
- Eina_Bool has_alpha EINA_UNUSED, const unsigned char *pixels EINA_UNUSED)
-{
- //TODO
-}
-
-EOLIAN static void
-_elm_app_server_pixels_get(Eo *obj EINA_UNUSED, Elm_App_Server_Data *pd EINA_UNUSED,
- unsigned int *w EINA_UNUSED, unsigned int *h EINA_UNUSED,
- Eina_Bool *has_alpha EINA_UNUSED, const unsigned char **pixels EINA_UNUSED)
-{
- //TODO
-}
-
-EOLIAN static Eina_Stringshare*
-_elm_app_server_package_get(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data)
-{
- return data->pkg;
-}
-
-EOLIAN static Eina_Iterator*
-_elm_app_server_views_get(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data)
-{
- return eina_hash_iterator_data_new(data->views);
-}
-
-EOLIAN static const char*
-_elm_app_server_path_get(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data)
-{
- return eldbus_service_object_path_get(data->iface);
-}
-
-EOLIAN static void
-_elm_app_server_view_add(Eo *obj EINA_UNUSED, Elm_App_Server_Data *data, Elm_App_Server_View *view)
-{
- _view_append(data, view);
-}
-
-EOLIAN static Eo *
-_elm_app_server_efl_object_finalize(Eo *obj, Elm_App_Server_Data *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(data->pkg, NULL);
-
- return efl_finalize(efl_super(obj, MY_CLASS));
-}
-
-EOLIAN static void
-_elm_app_server_efl_object_destructor(Eo *obj, Elm_App_Server_Data *data)
-{
- Eina_Iterator *iter;
- Elm_App_Server_View *view;
-
- iter = eina_hash_iterator_data_new(data->views);
- EINA_ITERATOR_FOREACH(iter, view)
- {
- //do not modify hash when iterating
- efl_event_callback_del(view, EFL_EVENT_DEL, _view_del_cb, data);
- efl_del(view);
- }
- eina_iterator_free(iter);
- eina_hash_free(data->views);
-
- eina_stringshare_del(data->title);
- eina_stringshare_del(data->icon_name);
- eina_stringshare_del(data->pkg);
-
- eldbus_service_object_manager_detach(data->iface);
- eldbus_service_interface_unregister(data->iface);
- eldbus_connection_unref(data->conn);
- eldbus_shutdown();
- efl_destructor(efl_super(obj, MY_CLASS));
-}
-
-#include "elm_app_server.eo.c"
+++ /dev/null
-import eina_types;
-import elm_general;
-
-type Elm_App_Server_Create_View_Cb: __undefined_type;
-
-class Elm.App.Server (Efl.Object)
-{
- eo_prefix: elm_app_server;
- methods {
- @property icon {
- set {
- }
- get {
- }
- values {
- icon: stringshare; [[title of icon]]
- }
- }
- @property views {
- get {
- [[Return a iterator with all views of application]]
- }
- values {
- ret: free(own(iterator<Elm.App.Server.View>), eina_iterator_free); [[Iterator with all views of application, you must free iterator after use]]
- }
- }
- @property path {
- get {
- }
- values {
- ret: string;
- }
- }
- @property package {
- get {
- }
- values {
- ret: stringshare;
- }
- }
- @property pixels {
- get {
- [[Get application raw icon.]]
- }
- set {
- [[Set icon to application, using the raw pixels of image.]]
- }
- values {
- w: uint;
- h: uint;
- has_alpha: bool;
- pixels: const(ubyte)*;
- }
- }
- constructor {
- [[Class constructor of elm_app_server]]
- legacy: null;
- params {
- @in packageid: string; [[package of application]]
- @in create_view_cb: Elm_App_Server_Create_View_Cb; [[callback to be called when user wants to open some application view]]
- }
- }
- close_all {
- [[Close all views of application]]
- }
- view_check {
- [[If view id is available and unique, return the full DBus object path of view]]
- params {
- @in id: string; [[view identifier]]
- }
- return: bool; [[true if id is valid or false if not]]
- }
- view_add {
- [[Add a view to elm_app_server. This should only be
- used if the application open a view that was not
- requested by create_view_cb.
- ]]
- params {
- @in view: Elm.App.Server.View; [[elm_app_server_view]]
- }
- }
- title_set {
- [[Set a title to application.]]
- params {
- @in title: string @nullable; [[title of application]]
- }
- }
- title_get {
- [[Get title of application]]
- return: stringshare; [[title of application]]
- }
- save {
- [[Save the state of all views]]
- }
- }
- implements {
- Efl.Object.destructor;
- Efl.Object.finalize;
- }
- constructors {
- .constructor;
- }
- events {
- terminate; [[Called when application must be terminated.]]
- }
-
-}
+++ /dev/null
-#ifdef EFL_EO_API_SUPPORT
-#include "elm_app_server_eo.h"
-#endif
+++ /dev/null
-#include "elm_app_server_eet.h"
-
-struct _Elm_App_Server_View_Props {
- const char * id;
- const char * title;
- const char * icon_name;
- int new_events;
- char progress;
-};
-
-struct _Elm_App_Server_Views_Eet {
- unsigned int version;
- Eina_List * views_entries;
- const char *__eet_filename;
-};
-
-static const char ELM_APP_SERVER_VIEWS_EET_ENTRY[] = "elm_app_server_views_eet";
-
-static Eet_Data_Descriptor *_elm_app_server_view_props_descriptor = NULL;
-static Eet_Data_Descriptor *_elm_app_server_views_eet_descriptor = NULL;
-
-static inline void
-_elm_app_server_view_props_init(void)
-{
- Eet_Data_Descriptor_Class eddc;
-
- if (_elm_app_server_view_props_descriptor) return;
-
- EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_App_Server_View_Props);
- _elm_app_server_view_props_descriptor = eet_data_descriptor_stream_new(&eddc);
-
- EET_DATA_DESCRIPTOR_ADD_BASIC(_elm_app_server_view_props_descriptor, Elm_App_Server_View_Props, "id", id, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_elm_app_server_view_props_descriptor, Elm_App_Server_View_Props, "title", title, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_elm_app_server_view_props_descriptor, Elm_App_Server_View_Props, "icon_name", icon_name, EET_T_STRING);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_elm_app_server_view_props_descriptor, Elm_App_Server_View_Props, "new_events", new_events, EET_T_INT);
- EET_DATA_DESCRIPTOR_ADD_BASIC(_elm_app_server_view_props_descriptor, Elm_App_Server_View_Props, "progress", progress, EET_T_CHAR);
-}
-
-static inline void
-_elm_app_server_view_props_shutdown(void)
-{
- if (!_elm_app_server_view_props_descriptor) return;
- eet_data_descriptor_free(_elm_app_server_view_props_descriptor);
- _elm_app_server_view_props_descriptor = NULL;
-}
-
-Elm_App_Server_View_Props *
-elm_app_server_view_props_new(const char * id, const char * title, const char * icon_name, int new_events, char progress)
-{
- Elm_App_Server_View_Props *elm_app_server_view_props = calloc(1, sizeof(Elm_App_Server_View_Props));
-
- if (!elm_app_server_view_props)
- {
- fprintf(stderr, "ERROR: could not calloc Elm_App_Server_View_Props\n");
- return NULL;
- }
-
- elm_app_server_view_props->id = eina_stringshare_add(id ? id : "");
- elm_app_server_view_props->title = eina_stringshare_add(title ? title : "");
- elm_app_server_view_props->icon_name = eina_stringshare_add(icon_name ? icon_name : "");
- elm_app_server_view_props->new_events = new_events;
- elm_app_server_view_props->progress = progress;
-
- return elm_app_server_view_props;
-}
-
-void
-elm_app_server_view_props_free(Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- eina_stringshare_del(elm_app_server_view_props->id);
- eina_stringshare_del(elm_app_server_view_props->title);
- eina_stringshare_del(elm_app_server_view_props->icon_name);
- free(elm_app_server_view_props);
-}
-
-inline const char *
-elm_app_server_view_props_id_get(const Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- return elm_app_server_view_props->id;
-}
-
-inline void
-elm_app_server_view_props_id_set(Elm_App_Server_View_Props *elm_app_server_view_props, const char *id)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_view_props);
- eina_stringshare_replace(&(elm_app_server_view_props->id), id);
-}
-
-inline const char *
-elm_app_server_view_props_title_get(const Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- return elm_app_server_view_props->title;
-}
-
-inline void
-elm_app_server_view_props_title_set(Elm_App_Server_View_Props *elm_app_server_view_props, const char *title)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_view_props);
- eina_stringshare_replace(&(elm_app_server_view_props->title), title);
-}
-
-inline const char *
-elm_app_server_view_props_icon_name_get(const Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- return elm_app_server_view_props->icon_name;
-}
-
-inline void
-elm_app_server_view_props_icon_name_set(Elm_App_Server_View_Props *elm_app_server_view_props, const char *icon_name)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_view_props);
- eina_stringshare_replace(&(elm_app_server_view_props->icon_name), icon_name);
-}
-
-inline int
-elm_app_server_view_props_new_events_get(const Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- return elm_app_server_view_props->new_events;
-}
-
-inline void
-elm_app_server_view_props_new_events_set(Elm_App_Server_View_Props *elm_app_server_view_props, int new_events)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_view_props);
- elm_app_server_view_props->new_events = new_events;
-}
-
-inline char
-elm_app_server_view_props_progress_get(const Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- return elm_app_server_view_props->progress;
-}
-
-inline void
-elm_app_server_view_props_progress_set(Elm_App_Server_View_Props *elm_app_server_view_props, char progress)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_view_props);
- elm_app_server_view_props->progress = progress;
-}
-
-static inline void
-_elm_app_server_views_eet_init(void)
-{
- Eet_Data_Descriptor_Class eddc;
-
- if (_elm_app_server_views_eet_descriptor) return;
-
- EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Elm_App_Server_Views_Eet);
- _elm_app_server_views_eet_descriptor = eet_data_descriptor_stream_new(&eddc);
-
- EET_DATA_DESCRIPTOR_ADD_BASIC(_elm_app_server_views_eet_descriptor, Elm_App_Server_Views_Eet, "version", version, EET_T_UINT);
- EET_DATA_DESCRIPTOR_ADD_LIST(_elm_app_server_views_eet_descriptor, Elm_App_Server_Views_Eet, "views_entries", views_entries, _elm_app_server_view_props_descriptor);
-}
-
-static inline void
-_elm_app_server_views_eet_shutdown(void)
-{
- if (!_elm_app_server_views_eet_descriptor) return;
- eet_data_descriptor_free(_elm_app_server_views_eet_descriptor);
- _elm_app_server_views_eet_descriptor = NULL;
-}
-
-Elm_App_Server_Views_Eet *
-elm_app_server_views_eet_new(unsigned int version, Eina_List * views_entries)
-{
- Elm_App_Server_Views_Eet *elm_app_server_views_eet = calloc(1, sizeof(Elm_App_Server_Views_Eet));
-
- if (!elm_app_server_views_eet)
- {
- fprintf(stderr, "ERROR: could not calloc Elm_App_Server_Views_Eet\n");
- return NULL;
- }
-
- elm_app_server_views_eet->version = version;
- elm_app_server_views_eet->views_entries = views_entries;
-
- return elm_app_server_views_eet;
-}
-
-void
-elm_app_server_views_eet_free(Elm_App_Server_Views_Eet *elm_app_server_views_eet)
-{
- if (elm_app_server_views_eet->views_entries)
- {
- Elm_App_Server_View_Props *views_entries_elem;
- EINA_LIST_FREE(elm_app_server_views_eet->views_entries, views_entries_elem)
- elm_app_server_view_props_free(views_entries_elem);
- }
- free(elm_app_server_views_eet);
-}
-
-inline unsigned int
-elm_app_server_views_eet_version_get(const Elm_App_Server_Views_Eet *elm_app_server_views_eet)
-{
- return elm_app_server_views_eet->version;
-}
-
-inline void
-elm_app_server_views_eet_version_set(Elm_App_Server_Views_Eet *elm_app_server_views_eet, unsigned int version)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_views_eet);
- elm_app_server_views_eet->version = version;
-}
-
-inline void
-elm_app_server_views_eet_views_entries_add(Elm_App_Server_Views_Eet *elm_app_server_views_eet, Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_views_eet);
- elm_app_server_views_eet->views_entries = eina_list_append(elm_app_server_views_eet->views_entries, elm_app_server_view_props);
-}
-
-inline void
-elm_app_server_views_eet_views_entries_del(Elm_App_Server_Views_Eet *elm_app_server_views_eet, Elm_App_Server_View_Props *elm_app_server_view_props)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_views_eet);
- elm_app_server_views_eet->views_entries = eina_list_remove(elm_app_server_views_eet->views_entries, elm_app_server_view_props);
-}
-
-inline Elm_App_Server_View_Props *
-elm_app_server_views_eet_views_entries_get(const Elm_App_Server_Views_Eet *elm_app_server_views_eet, unsigned int nth)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(elm_app_server_views_eet, NULL);
- return eina_list_nth(elm_app_server_views_eet->views_entries, nth);
-}
-
-inline unsigned int
-elm_app_server_views_eet_views_entries_count(const Elm_App_Server_Views_Eet *elm_app_server_views_eet)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(elm_app_server_views_eet, 0);
- return eina_list_count(elm_app_server_views_eet->views_entries);
-}
-
-void
-elm_app_server_views_eet_views_entries_list_clear(Elm_App_Server_Views_Eet *elm_app_server_views_eet)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_views_eet);
- Elm_App_Server_View_Props *data;
- EINA_LIST_FREE(elm_app_server_views_eet->views_entries, data) elm_app_server_view_props_free(data);
-}
-
-inline Eina_List *
-elm_app_server_views_eet_views_entries_list_get(const Elm_App_Server_Views_Eet *elm_app_server_views_eet)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(elm_app_server_views_eet, NULL);
- return elm_app_server_views_eet->views_entries;
-}
-
-inline void
-elm_app_server_views_eet_views_entries_list_set(Elm_App_Server_Views_Eet *elm_app_server_views_eet, Eina_List *list)
-{
- EINA_SAFETY_ON_NULL_RETURN(elm_app_server_views_eet);
- elm_app_server_views_eet->views_entries = list;
-}
-
-Elm_App_Server_Views_Eet *
-elm_app_server_views_eet_load(const char *filename)
-{
- Elm_App_Server_Views_Eet *elm_app_server_views_eet = NULL;
- Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ);
- if (!ef)
- {
- fprintf(stderr, "ERROR: could not open '%s' for read\n", filename);
- return NULL;
- }
-
- elm_app_server_views_eet = eet_data_read(ef, _elm_app_server_views_eet_descriptor, ELM_APP_SERVER_VIEWS_EET_ENTRY);
- if (!elm_app_server_views_eet) goto end;
- elm_app_server_views_eet->__eet_filename = eina_stringshare_add(filename);
-
-end:
- eet_close(ef);
- return elm_app_server_views_eet;
-}
-
-Eina_Bool
-elm_app_server_views_eet_save(Elm_App_Server_Views_Eet *elm_app_server_views_eet, const char *filename)
-{
- Eet_File *ef;
- Eina_Bool ret;
-
- if (filename) eina_stringshare_replace(&(elm_app_server_views_eet->__eet_filename), filename);
- else if (elm_app_server_views_eet->__eet_filename) filename = elm_app_server_views_eet->__eet_filename;
- else return EINA_FALSE;
-
- ef = eet_open(filename, EET_FILE_MODE_READ_WRITE);
- if (!ef)
- {
- fprintf(stderr, "ERROR: could not open '%s' for write\n", filename);
- return EINA_FALSE;
- }
-
- ret = !!eet_data_write(ef, _elm_app_server_views_eet_descriptor, ELM_APP_SERVER_VIEWS_EET_ENTRY, elm_app_server_views_eet, EINA_TRUE);
- eet_close(ef);
-
- return ret;
-}
-
-void
-app_server_views_eet_init(void)
-{
- _elm_app_server_view_props_init();
- _elm_app_server_views_eet_init();
-}
-
-void
-app_server_views_eet_shutdown(void)
-{
- _elm_app_server_view_props_shutdown();
- _elm_app_server_views_eet_shutdown();
-}
+++ /dev/null
-#ifndef _ELM_APP_SERVER_EET_H_
-#define _ELM_APP_SERVER_EET_H_
-
-#include <Eina.h>
-#include <Eet.h>
-
-typedef struct _Elm_App_Server_View_Props Elm_App_Server_View_Props;
-typedef struct _Elm_App_Server_Views_Eet Elm_App_Server_Views_Eet;
-
-/* Elm_App_Server_View_Props */
-Elm_App_Server_View_Props *elm_app_server_view_props_new(const char * id, const char * title, const char * icon_name, int new_events, char progress);
-void elm_app_server_view_props_free(Elm_App_Server_View_Props *elm_app_server_view_props);
-
-void elm_app_server_view_props_id_set(Elm_App_Server_View_Props *elm_app_server_view_props, const char * id);
-const char * elm_app_server_view_props_id_get(const Elm_App_Server_View_Props *elm_app_server_view_props);
-void elm_app_server_view_props_title_set(Elm_App_Server_View_Props *elm_app_server_view_props, const char * title);
-const char * elm_app_server_view_props_title_get(const Elm_App_Server_View_Props *elm_app_server_view_props);
-void elm_app_server_view_props_icon_name_set(Elm_App_Server_View_Props *elm_app_server_view_props, const char * icon_name);
-const char * elm_app_server_view_props_icon_name_get(const Elm_App_Server_View_Props *elm_app_server_view_props);
-void elm_app_server_view_props_new_events_set(Elm_App_Server_View_Props *elm_app_server_view_props, int new_events);
-int elm_app_server_view_props_new_events_get(const Elm_App_Server_View_Props *elm_app_server_view_props);
-void elm_app_server_view_props_progress_set(Elm_App_Server_View_Props *elm_app_server_view_props, char progress);
-char elm_app_server_view_props_progress_get(const Elm_App_Server_View_Props *elm_app_server_view_props);
-
-/* Elm_App_Server_Views_Eet */
-Elm_App_Server_Views_Eet *elm_app_server_views_eet_new(unsigned int version, Eina_List * views_entries);
-void elm_app_server_views_eet_free(Elm_App_Server_Views_Eet *elm_app_server_views_eet);
-
-void elm_app_server_views_eet_version_set(Elm_App_Server_Views_Eet *elm_app_server_views_eet, unsigned int version);
-unsigned int elm_app_server_views_eet_version_get(const Elm_App_Server_Views_Eet *elm_app_server_views_eet);
-void elm_app_server_views_eet_views_entries_add(Elm_App_Server_Views_Eet *elm_app_server_views_eet, Elm_App_Server_View_Props *elm_app_server_view_props);
-void elm_app_server_views_eet_views_entries_del(Elm_App_Server_Views_Eet *elm_app_server_views_eet, Elm_App_Server_View_Props *elm_app_server_view_props);
-Elm_App_Server_View_Props *elm_app_server_views_eet_views_entries_get(const Elm_App_Server_Views_Eet *elm_app_server_views_eet, unsigned int nth);
-unsigned int elm_app_server_views_eet_views_entries_count(const Elm_App_Server_Views_Eet *elm_app_server_views_eet);
-Eina_List *elm_app_server_views_eet_views_entries_list_get(const Elm_App_Server_Views_Eet *elm_app_server_views_eet);
-void elm_app_server_views_eet_views_entries_list_clear(Elm_App_Server_Views_Eet *elm_app_server_views_eet);
-void elm_app_server_views_eet_views_entries_list_set(Elm_App_Server_Views_Eet *elm_app_server_views_eet, Eina_List *list);
-
-Elm_App_Server_Views_Eet *elm_app_server_views_eet_load(const char *filename);
-Eina_Bool elm_app_server_views_eet_save(Elm_App_Server_Views_Eet *elm_app_server_views_eet, const char *filename);
-
-/* Global initializer / shutdown functions */
-void app_server_views_eet_init(void);
-void app_server_views_eet_shutdown(void);
-
-#endif
+++ /dev/null
-#define ELM_APP_CLIENT_VIEW_OPEN_CANCELED "org.enlightenment.Application.ViewOpenCanceled"
-#define ELM_APP_CLIENT_VIEW_OPEN_TIMEOUT "org.enlightenment.Application.ViewOpenTimeout"
-#define ELM_APP_CLEINT_VIEW_OPEN_ERROR "org.enlightenment.Application.CouldNotCreateView"
-
-#define ELM_APP_SERVER_VIEW_CREATE_DUPLICATE "org.enlightenment.Application.ViewDuplicate"
-
-typedef Eo Elm_App_Server;
-#define _ELM_APP_SERVER_EO_CLASS_TYPE
-
-typedef Eo Elm_App_Server_View;
-#define _ELM_APP_SERVER_VIEW_EO_CLASS_TYPE
-
-typedef Elm_App_Server_View *(*Elm_App_Server_Create_View_Cb)(Elm_App_Server *app, const Eina_Value *args, Eina_Stringshare **error_name, Eina_Stringshare **error_message);
-
-#include "elm_app_server.eo.h"
\ No newline at end of file
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-# include "elementary_config.h"
-#endif
-
-#include <Elementary.h>
-#include "elm_priv.h"
-
-#define MY_CLASS ELM_APP_SERVER_VIEW_CLASS
-
-#define MY_CLASS_NAME "Elm_App_Server_View"
-
-typedef struct
-{
- Eldbus_Connection *conn;
- Eldbus_Service_Interface *iface;
-
- Eina_Stringshare *id;
- Eina_Stringshare *title;
- Eina_Stringshare *icon_name;
- int new_events;
- short progress;
- Elm_App_View_State state;
- int window_id;
- struct {
- unsigned int w, h;
- Eina_Bool has_alpha;
- unsigned char *raw;
- } image_raw;
-} Elm_App_Server_View_Data;
-
-static void
-_state_set(Elm_App_Server_View_Data *data, Elm_App_View_State state)
-{
- if (data->state != state)
- eldbus_service_property_changed(data->iface, "State");
- data->state = state;
-}
-
-static Eldbus_Message *
-_method_close(const Eldbus_Service_Interface *iface, const Eldbus_Message *message)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- _state_set(data, ELM_APP_VIEW_STATE_CLOSED);
- efl_event_callback_legacy_call(eo, ELM_APP_SERVER_VIEW_EVENT_CLOSED, NULL);
-
- return eldbus_message_method_return_new(message);
-}
-
-static Eldbus_Message *
-_method_pause(const Eldbus_Service_Interface *iface, const Eldbus_Message *message)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- _state_set(data, ELM_APP_VIEW_STATE_PAUSED);
- efl_event_callback_legacy_call(eo, ELM_APP_SERVER_VIEW_EVENT_PAUSED, NULL);
-
- return eldbus_message_method_return_new(message);
-}
-
-static Eldbus_Message *
-_method_resume(const Eldbus_Service_Interface *iface, const Eldbus_Message *message)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- _state_set(data, ELM_APP_VIEW_STATE_LIVE);
- efl_event_callback_legacy_call(eo, ELM_APP_SERVER_VIEW_EVENT_RESUMED, NULL);
-
- return eldbus_message_method_return_new(message);
-}
-
-static const Eldbus_Method _methods[] = {
- { "Close", NULL, NULL, _method_close, 0 },
- { "Pause", NULL, NULL, _method_pause, 0 },
- { "Resume", NULL, NULL, _method_resume, 0 },
- { NULL, NULL, NULL, NULL, 0 }
-};
-
-static Eina_Bool
-_prop_title_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 's', data->title);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_prop_icon_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 's', data->icon_name);
- return EINA_TRUE;
-}
-
-/*static Eina_Bool
-_prop_icon_pixels_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- //TODO
- return EINA_FALSE;
-}*/
-
-static Eina_Bool
-_prop_events_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 'i', data->new_events);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_prop_progress_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 'n', data->progress);
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_prop_state_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 's', _state_id_to_string(data->state));
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_prop_window_get(const Eldbus_Service_Interface *iface, const char *propname EINA_UNUSED, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg EINA_UNUSED, Eldbus_Message **error EINA_UNUSED)
-{
- Eo *eo = eldbus_service_object_data_get(iface, MY_CLASS_NAME);
- Elm_App_Server_View_Data *data = efl_data_scope_get(eo, MY_CLASS);
-
- eldbus_message_iter_basic_append(iter, 'i', data->window_id);
- return EINA_TRUE;
-}
-
-static const Eldbus_Property _props[] = {
- { "Title", "s", _prop_title_get, NULL, 0 },
- { "IconName", "s", _prop_icon_get, NULL, 0 },
- //{ "IconPixels", "(uubay)", _prop_icon_pixels_get, NULL, 0 },
- { "NewEvents", "i", _prop_events_get, NULL, 0 },
- { "Progress", "n", _prop_progress_get, NULL, 0 },
- { "State", "s", _prop_state_get, NULL, 0 },
- { "WindowId", "i", _prop_window_get, NULL, 0 },
- { NULL, NULL, NULL, NULL, 0 }
-};
-
-static const Eldbus_Signal _signals[] = {
- { "Result", ELDBUS_ARGS({"a{sv}", "arguments"}), 0 },
- { NULL, NULL, 0}
-};
-
-static const Eldbus_Service_Interface_Desc iface_desc = {
- "org.enlightenment.ApplicationView1", _methods, _signals, _props, NULL, NULL
-};
-
-EOLIAN static void
-_elm_app_server_view_resume(Eo *obj, Elm_App_Server_View_Data *data)
-{
- _state_set(data, ELM_APP_VIEW_STATE_LIVE);
- efl_event_callback_legacy_call(obj, ELM_APP_SERVER_VIEW_EVENT_RESUMED, NULL);
-}
-
-EOLIAN static void
-_elm_app_server_view_pause(Eo *obj, Elm_App_Server_View_Data *data)
-{
- _state_set(data, ELM_APP_VIEW_STATE_PAUSED);
- efl_event_callback_legacy_call(obj, ELM_APP_SERVER_VIEW_EVENT_PAUSED, NULL);
-}
-
-EOLIAN static void
-_elm_app_server_view_close(Eo *obj, Elm_App_Server_View_Data *data)
-{
- _state_set(data, ELM_APP_VIEW_STATE_CLOSED);
- efl_event_callback_legacy_call(obj, ELM_APP_SERVER_VIEW_EVENT_CLOSED, NULL);
-}
-
-EOLIAN static void
-_elm_app_server_view_shallow(Eo *obj, Elm_App_Server_View_Data *data)
-{
- _state_set(data, ELM_APP_VIEW_STATE_SHALLOW);
- efl_event_callback_legacy_call(obj, ELM_APP_SERVER_VIEW_EVENT_SHALLOW, NULL);
-}
-
-EOLIAN static Elm_App_View_State
-_elm_app_server_view_state_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data)
-{
- return data->state;
-}
-
-EOLIAN static void
-_elm_app_server_view_window_set(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data, Evas_Object *win)
-{
- int before = data->window_id;
-
- data->window_id = elm_win_window_id_get(win);
-
- if (data->window_id != before)
- eldbus_service_property_changed(data->iface, "WindowId");
-}
-
-EOLIAN static void
-_elm_app_server_view_title_set(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data, const char *title)
-{
- title = title ? title : "";
-
- if (eina_stringshare_replace(&data->title, title))
- eldbus_service_property_changed(data->iface, "Title");
-}
-
-EOLIAN static const char*
-_elm_app_server_view_title_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data)
-{
- return data->title;
-}
-
-EOLIAN static void
-_elm_app_server_view_icon_set(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data, const char *icon)
-{
- icon = icon ? icon : "";
-
- if (eina_stringshare_replace(&data->icon_name, icon))
- eldbus_service_property_changed(data->iface, "IconName");
-}
-
-EOLIAN static const char*
-_elm_app_server_view_icon_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data)
-{
- return data->icon_name;
-}
-
-EOLIAN static void
-_elm_app_server_view_pixels_set(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data,
- unsigned int w EINA_UNUSED, unsigned int h EINA_UNUSED,
- Eina_Bool has_alpha EINA_UNUSED, const unsigned char *pixels EINA_UNUSED)
-{
- //TODO
- eldbus_service_property_changed(data->iface, "IconPixels");
-}
-
-EOLIAN static void
-_elm_app_server_view_pixels_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *pd EINA_UNUSED,
- unsigned int *w EINA_UNUSED, unsigned int *h EINA_UNUSED,
- Eina_Bool *has_alpha EINA_UNUSED, const unsigned char **pixels EINA_UNUSED)
-{
- //TODO
-}
-
-EOLIAN static void
-_elm_app_server_view_progress_set(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data, short progress)
-{
- if (data->progress != progress)
- eldbus_service_property_changed(data->iface, "Progress");
- data->progress = progress;
-}
-
-EOLIAN static short
-_elm_app_server_view_progress_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data)
-{
- return data->progress;
-}
-
-EOLIAN static void
-_elm_app_server_view_new_events_set(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data, int events)
-{
- if (data->new_events != events)
- eldbus_service_property_changed(data->iface, "NewEvents");
- data->new_events = events;
-}
-
-EOLIAN static int
-_elm_app_server_view_new_events_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data)
-{
- return data->new_events;
-}
-
-EOLIAN static Eina_Stringshare*
-_elm_app_server_view_id_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data)
-{
- return data->id;
-}
-
-EOLIAN static const char*
-_elm_app_server_view_path_get(Eo *obj EINA_UNUSED, Elm_App_Server_View_Data *data)
-{
- return eldbus_service_object_path_get(data->iface);
-}
-
-EOLIAN static void
-_elm_app_server_view_id_set(Eo *obj, Elm_App_Server_View_Data *data, const char *id)
-{
- Elm_App_Server *server = NULL;
-
- if (efl_finalized_get(obj))
- {
- ERR("Can't set id after object has been created.");
- return;
- }
-
- server = efl_parent_get(obj);
- EINA_SAFETY_ON_TRUE_RETURN(!server || !efl_isa(server, ELM_APP_SERVER_CLASS));
-
- if (!id)
- {
- int i;
- for (i = 1; i < 99999; i++)
- {
- char buf[64];
- Eina_Bool valid = EINA_FALSE;
-
- snprintf(buf, sizeof(buf), "view_%d", i);
- valid = elm_app_server_view_check(server, buf);
- if (valid)
- {
- data->id = eina_stringshare_add(buf);
- break;
- }
- }
- }
- else
- {
- Eina_Bool valid = EINA_FALSE;
- valid = elm_app_server_view_check(server, id);
- if (valid)
- data->id = eina_stringshare_add(id);
- }
-}
-
-EOLIAN static Eo *
-_elm_app_server_view_efl_object_finalize(Eo *obj, Elm_App_Server_View_Data *data)
-{
- const char *server_path = NULL;
- char view_path[PATH_MAX];
- Elm_App_Server *server = NULL;
-
- server = efl_parent_get(obj);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(!server || !efl_isa(server, ELM_APP_SERVER_CLASS), NULL);
-
-
- if (!data->id)
- {
- ERR("Failed");
- return NULL;
- }
-
- server_path = elm_app_server_path_get(server);
- snprintf(view_path, sizeof(view_path), "%s/%s", server_path, data->id);
-
- eldbus_init();
- data->conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION);
- data->iface = eldbus_service_interface_register(data->conn, view_path,
- &iface_desc);
- eldbus_service_object_data_set(data->iface, MY_CLASS_NAME, obj);
-
- data->state = ELM_APP_VIEW_STATE_UNKNOWN;
- data->title = eina_stringshare_add("");
- data->icon_name = eina_stringshare_add("");
-
- return efl_finalize(efl_super(obj, MY_CLASS));
-}
-
-EOLIAN static void
-_elm_app_server_view_efl_object_destructor(Eo *obj, Elm_App_Server_View_Data *data)
-{
- eina_stringshare_del(data->title);
- eina_stringshare_del(data->icon_name);
-
- eina_stringshare_del(data->id);
- eldbus_service_object_unregister(data->iface);
- eldbus_connection_unref(data->conn);
- eldbus_shutdown();
-
- efl_destructor(efl_super(obj, MY_CLASS));
-}
-
-#include "elm_app_server_view.eo.c"
+++ /dev/null
-import elm_general;
-
-class Elm.App.Server.View (Efl.Object)
-{
- eo_prefix: elm_app_server_view;
- methods {
- @property progress {
- set {
- }
- get {
- }
- values {
- progress: short;
- }
- }
- @property new_events {
- set {
- }
- get {
- }
- values {
- events: int;
- }
- }
- @property icon {
- set {
- }
- get {
- }
- values {
- icon: string;
- }
- }
- @property title {
- set {
- }
- get {
- }
- values {
- title: string @nullable;
- }
- }
- @property window {
- set {
- }
- values {
- win: Efl.Canvas.Object;
- }
- }
- @property id {
- set {
- }
- get {
- }
- values {
- ret: string;
- }
- }
- @property state {
- get {
- }
- values {
- ret: Elm.App.View_State;
- }
- }
- @property path {
- get {
- }
- values {
- ret: string;
- }
- }
- @property pixels {
- get {
- [[Get application raw icon.]]
- }
- set {
- [[Set icon to application, using the raw pixels of image.]]
- }
- values {
- w: uint;
- h: uint;
- has_alpha: bool;
- pixels: const(ubyte)*;
- }
- }
- pause {
- }
- resume {
- }
- shallow {
- }
- close {
- }
- }
- implements {
- Efl.Object.destructor;
- Efl.Object.finalize;
- }
- events {
- resumed; [[Called when view must be resumed]]
- paused; [[Called when view must be paused]]
- closed; [[Called when view must be closed]]
- shallow; [[Called when view state is set to shallow]]
- save; [[Called when view state should be saved]]
- }
-
-}
+++ /dev/null
-#ifdef EFL_EO_API_SUPPORT
-#include "elm_app_server_view_eo.h"
-#endif
+++ /dev/null
-#include "elm_app_server_view.eo.h"
\ No newline at end of file