World Clock Widget / src /

data.c

  1. /*
  2. * Copyright (c) 2015 Samsung Electronics Co., Ltd
  3. *
  4. * Licensed under the Flora License, Version 1.1 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://floralicense.org/license/
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16.  
  17. #include <Elementary.h>
  18. #include <dlog.h>
  19. #include "log.h"
  20. #include "data.h"
  21.  
  22. /*
  23. * @brief: Initialize data that is used in this application.
  24. */
  25. void data_initialize(void)
  26. {
  27. /*
  28. * If you need to initialize managing data,
  29. * please use this function.
  30. */
  31. }
  32.  
  33. /*
  34. * @brief: Destroy data that is used in this application.
  35. */
  36. void data_finalize(void)
  37. {
  38. /*
  39. * If you need to finalize managing data,
  40. * please use this function.
  41. */
  42. }
  43.  
  44. /*
  45. * @brief: Get text according to given part
  46. * @param[part]: name string of one of the existing text parts in the EDJ group
  47. */
  48. char *data_get_text(const char *part)
  49. {
  50. /*
  51. * You can use this function to retrieve data.
  52. */
  53. char *ret = NULL;
  54.  
  55. if (!strcmp("widget.region", part)) {
  56. ret = strdup("San Francisco");
  57. } else if (!strcmp("widget.time", part)) {
  58. ret = strdup("9:30 AM");
  59. } else if (!strcmp("widget.date", part)) {
  60. ret = strdup("Wed, Jul 28");
  61. } else {
  62. dlog_print(DLOG_ERROR, LOG_TAG, "failed to get text.");
  63. return NULL;
  64. }
  65.  
  66. return ret;
  67. }
  68.  
  69. /* End of file */