--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _CLOCK_UTILS_THEME_MANAGER_H_
+#define _CLOCK_UTILS_THEME_MANAGER_H_
+
+#include <set>
+#include <string>
+
+namespace utils {
+
+class ThemeExtension {
+public:
+
+ /**
+ * @brief Adds theme to the list of extensions.
+ *
+ * @param[in] path The path to the edje file
+ */
+ static void AddTheme(const std::string &path);
+
+ /**
+ * @brief Removes theme from the list of extensions.
+ *
+ * @param[in] path The path to the edje file
+ */
+ static void DelTheme(const std::string &path);
+
+private:
+ static std::set<std::string> themes_;
+ ThemeExtension() {};
+};
+}
+
+#endif //_CLOCK_UTILS_THEME_MANAGER_H_
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <Elementary.h>
+
+#include "Utils/ThemeExtension.h"
+#include "Utils/Log.h"
+
+namespace utils {
+
+std::set<std::string> ThemeExtension::themes_;
+
+void ThemeExtension::AddTheme(const std::string &path)
+{
+ auto ret = themes_.insert(path);
+ if (!ret.second) {
+ INF("Theme with %s path already exists", path.c_str());
+ return;
+ }
+
+ elm_theme_extension_add(NULL, path.c_str());
+}
+
+void ThemeExtension::DelTheme(const std::string &path)
+{
+ auto it = themes_.find(path);
+ if (it == themes_.end())
+ return;
+ else
+ themes_.erase(it);
+
+ elm_theme_extension_del(NULL, path.c_str());
+}
+
+}
#include "Utils/Log.h"
#include "Utils/PopupManager.h"
+#include "Utils/ThemeExtension.h"
using namespace view;
using namespace model;
Evas_Object *btn = elm_button_add(fb);
evas_object_smart_callback_add(btn, "clicked", AlarmView::ButtonClicked, this);
Evas_Object *image = elm_image_add(fb);
- elm_image_file_set(image, Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "images/core_floating_icon_01.png"), NULL);
+ elm_image_file_set(image, Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE,
+ "images/core_floating_icon_01.png"), NULL);
elm_object_part_content_set(btn, "icon", image);
elm_object_part_content_set(fb, "button1", btn);
- elm_theme_extension_add(NULL, Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/alarm.edj"));
+ ThemeExtension::AddTheme(Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/alarm.edj"));
- eext_object_event_callback_add(content_, EEXT_CALLBACK_MORE,
+ eext_object_event_callback_add(content_, EEXT_CALLBACK_MORE,
AlarmView::MoreButtonClicked, this);
}
#include "Utils/Log.h"
#include "View/EditAlarmView.h"
#include "Utils/Utils.h"
+#include "Utils/ThemeExtension.h"
#include <efl_extension.h>
#include <Elementary.h>
elm_object_item_content_set(navi_item_, content_);
// load additional genlist item styles
- elm_theme_extension_add(NULL,
- Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/edit_alarm.edj"));
+ ThemeExtension::AddTheme(Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE,
+ "edje/edit_alarm.edj"));
CreateGenlistItems();
}
* limitations under the License.
*/
-#include <efl_extension.h>
#include <vector>
#include <sstream>
#include <tuple>
#include "Utils/Time.h"
#include "Utils/Log.h"
#include "Utils/WorldClock.h"
+#include "Utils/ThemeExtension.h"
using namespace view;
using namespace utils;
elm_object_item_style_set(navi_item_, "basic");
- static bool extension_init = false;
-
- if (!extension_init) {
- elm_theme_extension_add(NULL,
- Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE,
+ ThemeExtension::AddTheme(Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE,
"edje/WorldClockDeleteReorderList.edj"));
- extension_init = true;
- }
+
left_button_ = elm_button_add(parent);
elm_object_text_set(left_button_, "CANCEL");
elm_object_style_set(left_button_, "naviframe/title_left");
#include "Utils/Time.h"
#include "Utils/WorldClock.h"
#include "Utils/PopupManager.h"
+#include "Utils/ThemeExtension.h"
using namespace view;
using namespace utils;
"main")) {
FAT("Failed to load layout file");
}
- elm_theme_extension_add(NULL,
- Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/CitiesListItem.edj"));
+
+ ThemeExtension::AddTheme(Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE,
+ "edje/CitiesListItem.edj"));
evas_object_size_hint_align_set(world_clock_, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(world_clock_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);