summaryrefslogtreecommitdiff
path: root/src/examples
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2019-10-02 17:45:07 +0200
committerStefan Schmidt <s.schmidt@samsung.com>2019-12-09 15:31:00 +0100
commit4ff8fb140cf6c9bda359c8872095d2c1c28fad86 (patch)
tree911554cc63aa874e8f7cc4acb0f69768a6d52f49 /src/examples
parent431f3b1fcef2b49b4c43539c51ad50fcd99a55bd (diff)
downloadefl-4ff8fb140cf6c9bda359c8872095d2c1c28fad86.tar.gz
elocation: remove beta library
This has never been fully finished or really used. The GeoClue project dbus API moved on to a newer version as well. We still have it marked as beta so we should take the chance and get rid of it to cleanup our tree a little bit. Reviewed-by: Chris Michael <cp.michael@samsung.com> Reviewed-by: Vincent Torri <vincent.torri@gmail.com> Differential Revision: https://phab.enlightenment.org/D10788
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/elementary/location_example_01.c151
-rw-r--r--src/examples/elementary/meson.build1
-rw-r--r--src/examples/elocation/.gitignore1
-rw-r--r--src/examples/elocation/elocation.c167
4 files changed, 0 insertions, 320 deletions
diff --git a/src/examples/elementary/location_example_01.c b/src/examples/elementary/location_example_01.c
deleted file mode 100644
index 7b8ad6f897..0000000000
--- a/src/examples/elementary/location_example_01.c
+++ /dev/null
@@ -1,151 +0,0 @@
-//Compile with:
-//gcc -o location_example_01 location_example_01.c -g `pkg-config --cflags --libs elementary elocation`
-#ifndef EFL_BETA_API_SUPPORT
-# define EFL_BETA_API_SUPPORT
-#endif
-
-#include <Elementary.h>
-#ifdef ELM_ELOCATION
-#include <Elocation.h>
-#endif
-
-static Evas_Object *pos_label, *addr_label, *box, *win;
-
-#ifdef ELM_ELOCATION
-static void
-_print_position(Elocation_Position *position)
-{
- char buffer[1024];
-
- if (!position) return;
- snprintf(buffer, sizeof(buffer),
- "<b>### Position Detail ###</b><br/>"
- "<b>GeoClue position reply with data from timestamp</b> %i<br/>"
- "<b>Latitude:</b> %f<br/>"
- "<b>Longitude:</b> %f<br/>"
- "<b>Altitude:</b> %f<br/>"
- "<b>Accuracy level:</b> %i<br/>"
- "<b>Accuracy horizontal:</b> %f<br/>"
- "<b>Accuracy vertical:</b> %f",
- position->timestamp, position->latitude, position->longitude,
- position->altitude, position->accur->level,
- position->accur->horizontal, position->accur->vertical);
- elm_object_text_set(pos_label, buffer);
-}
-
-static void
-_print_address(Elocation_Address *address)
-{
- char buffer[1024];
-
- if (!address) return;
- snprintf(buffer, sizeof(buffer),
- "<b>### Address Detail ###</b><br/>"
- "<b>Address update with data from timestamp:</b> %i<br/>"
- "<b>Country:</b> %s<br/>"
- "<b>Countrycode:</b> %s<br/>"
- "<b>Locality:</b> %s<br/>"
- "<b>Postalcode:</b> %s<br/>"
- "<b>Region:</b> %s<br/>"
- "<b>Timezone:</b> %s<br/>"
- "<b>Accuracy level:</b> %i<br/>"
- "<b>Accuracy horizontal:</b> %f<br/>"
- "<b>Accuracy vertical:</b> %f",
- address->timestamp, address->country, address->countrycode,
- address->locality, address->postalcode, address->region,
- address->timezone, address->accur->level, address->accur->horizontal,
- address->accur->vertical);
- elm_object_text_set(addr_label, buffer);
-}
-
-static Eina_Bool
-_position_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
-{
- Elocation_Position *position;
-
- position = event;
- _print_position(position);
- return ECORE_CALLBACK_DONE;
-}
-
-static Eina_Bool
-_address_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
-{
- Elocation_Address *address;
-
- address = event;
- _print_address(address);
-
- return ECORE_CALLBACK_DONE;
-}
-#endif
-
-EAPI_MAIN int
-elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
-{
-#ifdef ELM_ELOCATION
- Elocation_Address *address;
- Elocation_Position *position;
-#endif
-
- /* The program will proceed only if Ewebkit library is available. */
- if (elm_need_elocation() == EINA_FALSE)
- return -1;
-
- elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
-
- win = elm_win_util_standard_add("elocation", "Elocation example");
- elm_win_autodel_set(win, EINA_TRUE);
-
- box = elm_box_add(win);
- elm_win_resize_object_add(win, box);
- evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
- pos_label = elm_label_add(box);
- elm_label_line_wrap_set(pos_label, ELM_WRAP_CHAR);
- elm_object_text_set(pos_label, "Getting location ...");
- evas_object_size_hint_weight_set(pos_label, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(pos_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_label_slide_mode_set(pos_label, ELM_LABEL_SLIDE_MODE_ALWAYS);
- elm_box_pack_end(box, pos_label);
- evas_object_show(pos_label);
- elm_box_padding_set(box, 0, 50);
-
- addr_label = elm_label_add(box);
- elm_label_line_wrap_set(addr_label, ELM_WRAP_CHAR);
- elm_object_text_set(addr_label, "Getting location ...");
- evas_object_size_hint_weight_set(addr_label, EVAS_HINT_EXPAND, 0.0);
- evas_object_size_hint_align_set(addr_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_label_slide_mode_set(addr_label, ELM_LABEL_SLIDE_MODE_ALWAYS);
- elm_box_pack_end(box, addr_label);
- evas_object_show(addr_label);
-
-#ifdef ELM_ELOCATION
- address = elocation_address_new();
- position = elocation_position_new();
-
- ecore_event_handler_add(ELOCATION_EVENT_POSITION, _position_changed, NULL);
- ecore_event_handler_add(ELOCATION_EVENT_ADDRESS, _address_changed, NULL);
-
- elocation_position_get(position);
- _print_position(position);
-
- elocation_address_get(address);
- _print_address(address);
-#endif
-
- evas_object_show(box);
- evas_object_resize(win, 600, 480);
- evas_object_show(win);
-
- elm_run();
-
-#ifdef ELM_ELOCATION
- elocation_position_free(position);
- elocation_address_free(address);
-#endif
-
- return 0;
-}
-ELM_MAIN()
diff --git a/src/examples/elementary/meson.build b/src/examples/elementary/meson.build
index 380d3ef446..e88ddfe567 100644
--- a/src/examples/elementary/meson.build
+++ b/src/examples/elementary/meson.build
@@ -59,7 +59,6 @@ examples = [
'list_example_01',
'list_example_02',
'list_example_03',
- 'location_example_01',
'map_example_01',
'map_example_02',
'map_example_03',
diff --git a/src/examples/elocation/.gitignore b/src/examples/elocation/.gitignore
deleted file mode 100644
index 5945c2ea49..0000000000
--- a/src/examples/elocation/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/elocation
diff --git a/src/examples/elocation/elocation.c b/src/examples/elocation/elocation.c
deleted file mode 100644
index b9c8b99d87..0000000000
--- a/src/examples/elocation/elocation.c
+++ /dev/null
@@ -1,167 +0,0 @@
-#include <stdio.h>
-
-#define EFL_BETA_API_SUPPORT
-
-#include <Ecore.h>
-#include <Elocation.h>
-
-/* A set of callbacks to react on incoming elocation events. They are standard
- * ecore events and we register callbacks based on these events in the main
- * function.
- */
-static Eina_Bool
-status_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
-{
- int *status = event;
-
- printf("Status changed to: %i\n", *status);
- printf("\n");
-
- return ECORE_CALLBACK_DONE;
-}
-
-static Eina_Bool
-rgeocode_arrived(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
-{
- Elocation_Address *address;
-
- address = event;
- printf("Geocode reply:\n");
- printf("Country: %s\n", address->country);
- printf("Countrycode: %s\n", address->countrycode);
- printf("Locality: %s\n", address->locality);
- printf("Postalcode: %s\n", address->postalcode);
- printf("Region: %s\n", address->region);
- printf("Timezone: %s\n", address->timezone);
- printf("Accuracy level: %i\n", address->accur->level);
- printf("Accuracy horizontal: %f\n", address->accur->horizontal);
- printf("Accuracy vertical: %f\n", address->accur->vertical);
- printf("\n");
-
- return ECORE_CALLBACK_DONE;
-}
-
-static Eina_Bool
-geocode_arrived(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
-{
- Elocation_Position *position;
-
- position = event;
- printf("Reverse geocode reply:\n");
- printf("Latitude:\t %f\n", position->latitude);
- printf("Longitude:\t %f\n", position->longitude);
- printf("Altitude:\t %f\n", position->altitude);
- printf("Accuracy level: %i\n", position->accur->level);
- printf("Accuracy horizontal: %f\n", position->accur->horizontal);
- printf("Accuracy vertical: %f\n", position->accur->vertical);
- printf("\n");
-
- return ECORE_CALLBACK_DONE;
-}
-
-static Eina_Bool
-address_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
-{
- Elocation_Address *address;
-
- address = event;
- printf("Address update with data from timestamp: %i\n", address->timestamp);
- printf("Country: %s\n", address->country);
- printf("Countrycode: %s\n", address->countrycode);
- printf("Locality: %s\n", address->locality);
- printf("Postalcode: %s\n", address->postalcode);
- printf("Region: %s\n", address->region);
- printf("Timezone: %s\n", address->timezone);
- printf("Accuracy level: %i\n", address->accur->level);
- printf("Accuracy horizontal: %f\n", address->accur->horizontal);
- printf("Accuracy vertical: %f\n", address->accur->vertical);
- printf("\n");
-
- return ECORE_CALLBACK_DONE;
-}
-
-static Eina_Bool
-position_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
-{
- Elocation_Position *position;
-
- position = event;
- printf("GeoClue position reply with data from timestamp %i\n", position->timestamp);
- printf("Latitude:\t %f\n", position->latitude);
- printf("Longitude:\t %f\n", position->longitude);
- printf("Altitude:\t %f\n", position->altitude);
- printf("Accuracy level: %i\n", position->accur->level);
- printf("Accuracy horizontal: %f\n", position->accur->horizontal);
- printf("Accuracy vertical: %f\n", position->accur->vertical);
- printf("\n");
-
- return ECORE_CALLBACK_DONE;
-}
-
-int
-main(void)
-{
- Elocation_Address *address, *addr_geocode;
- Elocation_Position *position, *pos_geocode;
- int status;
-
- /* Init the needed efl subsystems so we can safely use them */
- ecore_init();
- eldbus_init();
- elocation_init();
-
- /* Create an address and positon object that we use for all our operations.
- * Needs to be freed manually with elocation_*_free when we now longer use
- * them */
- address = elocation_address_new();
- position = elocation_position_new();
-
- /* Register callback so we get updates later on */
- ecore_event_handler_add(ELOCATION_EVENT_STATUS, status_changed, NULL);
- ecore_event_handler_add(ELOCATION_EVENT_POSITION, position_changed, NULL);
- ecore_event_handler_add(ELOCATION_EVENT_ADDRESS, address_changed, NULL);
- ecore_event_handler_add(ELOCATION_EVENT_GEOCODE, geocode_arrived, NULL);
- ecore_event_handler_add(ELOCATION_EVENT_REVERSEGEOCODE, rgeocode_arrived, NULL);
-
- /* To the initial request for status address and position. This fills in the
- * objects with the data from GeoClue */
- elocation_status_get(&status);
- elocation_position_get(position);
- elocation_address_get(address);
-
- /* Another set of address and position object. This time for demonstrating
- * the GeoCode functionalities */
- addr_geocode = elocation_address_new();
- pos_geocode = elocation_position_new();
-
- /* The Freeform API could use any string to transform it into position
- * coordinates. How good that works depends on the used GeoClue provider */
- elocation_freeform_address_to_position("London", pos_geocode);
-
- /* Some demo values to show the position to address conversion */
- pos_geocode->latitude = 51.7522;
- pos_geocode->longitude = -1.25596;
- pos_geocode->accur->level = 3;
- elocation_position_to_address(pos_geocode, addr_geocode);
-
- /* And now from address to position */
- addr_geocode->locality = "Cambridge";
- addr_geocode->countrycode = "UK";
- elocation_address_to_position(addr_geocode, pos_geocode);
-
- /* Enter the mainloop now that we are setup with initial data and waiting for
- * events. */
- ecore_main_loop_begin();
-
- /* Cleanup allocated memory now that we shut down */
- elocation_address_free(addr_geocode);
- elocation_position_free(pos_geocode);
- elocation_address_free(address);
- elocation_position_free(position);
-
- /* Make sure we also shut down the initialized subsystems */
- elocation_shutdown();
- eldbus_shutdown();
- ecore_shutdown();
- return 0;
-}