From: Cho Sanghoon Date: Tue, 21 Aug 2012 10:46:31 +0000 (+0900) Subject: Release tizen_2.0_beta X-Git-Tag: 2.0_alpha^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;p=apps%2Fhome%2Fnet-popup.git Release tizen_2.0_beta Change-Id: I1ee71cefdd898183e68f25cd072e15bd43e87b7f --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 525fedf..fd6afac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,9 @@ pkg_check_modules(pkgs REQUIRED elementary evas syspopup - syspopup-caller) + syspopup-caller + appsvc + notification) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag} -g") @@ -56,8 +58,7 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) # install desktop file & icon SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -CONFIGURE_FILE(data/net.netpopup.desktop.in data/net.netpopup.desktop) -INSTALL(FILES ${CMAKE_BINARY_DIR}/data/net.netpopup.desktop DESTINATION /opt/share/applications/) +INSTALL(FILES ${CMAKE_BINARY_DIR}/data/net.netpopup.xml DESTINATION ${PREFIX}/share/packages/) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/images/ DESTINATION ${PREFIX}/share/icon FILES_MATCHING PATTERN "*.png") diff --git a/data/net.netpopup.desktop.in b/data/net.netpopup.desktop.in deleted file mode 100644 index 1a8969e..0000000 --- a/data/net.netpopup.desktop.in +++ /dev/null @@ -1,9 +0,0 @@ -Name=Network popup -Type=Application -Exec=/usr/bin/net-popup -nodisplay=True -Icon=NULL -Comment=network popup -x-tizen-taskmanage=False -x-tizen-removable=False -Version=0.1.0 diff --git a/data/net.netpopup.xml b/data/net.netpopup.xml new file mode 100644 index 0000000..7d673e0 --- /dev/null +++ b/data/net.netpopup.xml @@ -0,0 +1,9 @@ + + + + Sanghoon Cho + Network popup + + + + diff --git a/debian/changelog b/debian/changelog index aef9771..01b8ccb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,87 @@ +net-popup (0.1.20-5) unstable; urgency=low + + * Change net-popup package license to 'Flora' + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.20-5 + + -- Kim sun il Fri, 10 Aug 2012 13:29:57 +0900 + +net-popup (0.1.20-4) unstable; urgency=low + + * Implement desktop manifest + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.20-4 + + -- Sanghoon Cho Tue, 31 Jul 2012 20:08:48 +0900 + +net-popup (0.1.20-3) unstable; urgency=low + + * Implement to del a notification + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.20-3 + + -- Sanghoon Cho Mon, 16 Jul 2012 16:12:34 +0900 + +net-popup (0.1.20-2) unstable; urgency=low + + * Add NULL check for bundle parameters + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.20-2 + + -- Danny Jeongseok Seo Sat, 07 Jul 2012 19:47:21 +0900 + +net-popup (0.1.20-1) unstable; urgency=low + + * Add NULL check for bundle parameters + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.20-1 + + -- Danny Jeongseok Seo Sat, 07 Jul 2012 17:57:18 +0900 + +net-popup (0.1.20) unstable; urgency=low + + * Add NULL check for bundle parameters + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.20 + + -- Sanghoon Cho Fri, 06 Jul 2012 12:40:06 +0900 + +net-popup (0.1.19) unstable; urgency=low + + * Implement to add a notification + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.19 + + -- Sanghoon Cho Fri, 29 Jun 2012 14:26:00 +0900 + net-popup (0.1.18) unstable; urgency=low - * Update boiler plate - * Git: pkgs/n/net-popup + * Modify a location of desktop file to /usr + * Git: slp/pkgs/n/net-popup * Tag: net-popup_0.1.18 - -- Sanghoon Cho Wed, 02 May 2012 17:20:39 +0900 + -- Sanghoon Cho Tue, 15 May 2012 15:38:43 +0900 + +net-popup (0.1.17) unstable; urgency=low + + * Add a popup style + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.17 + + -- Sanghoon Cho Wed, 04 Apr 2012 20:44:37 +0900 + +net-popup (0.1.16) unstable; urgency=low + + * Change package name from alert-3g-syspopup to net-popup + * Git: slp/pkgs/n/net-popup + * Tag: net-popup_0.1.16 + + -- Sanghoon Cho Mon, 06 Feb 2012 12:56:40 +0900 + +alert-3g-syspopup (0.1.0) unstable; urgency=low + + * Initial Release + * Git: slp/pkgs/a/alert-3g-syspopup + * Tag: alert-3g-syspopup_0.1.0 + -- Sanghoon Cho Mon, 06 Feb 2012 12:56:40 +0900 diff --git a/debian/net.netpopup.install.in b/debian/net.netpopup.install.in index 3b209f2..5e02569 100644 --- a/debian/net.netpopup.install.in +++ b/debian/net.netpopup.install.in @@ -1,4 +1,4 @@ @PREFIX@/bin/net-popup @PREFIX@/share/locale/* -/opt/share/applications/net.netpopup.desktop +@PREFIX@/share/applications/net.netpopup.desktop @PREFIX@/share/process-info/net-popup.ini diff --git a/debian/rules b/debian/rules index 7db2d9b..040ea38 100755 --- a/debian/rules +++ b/debian/rules @@ -10,8 +10,8 @@ #export DH_VERBOSE=1 CFLAGS ?= -Wall -g -CXXFLAGS ?= -Wall -g -LDFLAGS ?= +CXXFLAGS ?= -Wall -g +LDFLAGS ?= PREFIX ?= /usr DATADIR ?= /opt @@ -39,7 +39,7 @@ configure-stamp: build: build-stamp -build-stamp: configure-stamp +build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. @@ -83,18 +83,24 @@ clean: for f in `find $(CURDIR)/ -name "install_manifest.txt"`; do \ rm -f $${f}; \ done - + for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ rm -f $${f%.in}; \ done + rm -f data/*.desktop + rm -f ../net.netpopup_*.deb + rm -f ../net.netpopup-*.deb + rm -f ../net-popup_*.changes + rm -f ../net-popup_*.dsc + rm -f ../net-popup_*.tar.gz - dh_clean + dh_clean install: build dh_testdir dh_testroot - dh_clean -k + dh_clean -k dh_installdirs # Add here commands to install the package into debian/wavplayer. @@ -111,7 +117,7 @@ binary-arch: build install dh_testroot dh_install --sourcedir=debian/tmp # dh_installmenu -# dh_installdebconf +# dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam diff --git a/include/net-popup-strings.h b/include/net-popup-strings.h index ad57827..52c4319 100644 --- a/include/net-popup-strings.h +++ b/include/net-popup-strings.h @@ -1,20 +1,21 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.tizenopensource.org/license - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - +* net-popup +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Licensed under the Flora License, Version 1.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.tizenopensource.org/license +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ #ifndef __DEF_NET_POPUP_STRINGS_H_ #define __DEF_NET_POPUP_STRINGS_H_ @@ -29,4 +30,7 @@ #define ALERT_STR_WIFI_CONNECTED dgettext(PACKAGE, "IDS_WIFI_BODY_CONNECTED") #define ALERT_STR_RESTRICTED_USE_WIFI dgettext(PACKAGE, "IDS_COM_POP_SECURITY_POLICY_RESTRICTS_USE_OF_WI_FI") +#define NOTIFICATION_STR_WIFI_FOUND_TITLE "Wi-Fi networks found" +#define NOTIFICATION_STR_WIFI_FOUND_CONTENT "Open Wi-Fi setting" + #endif /* __DEF_NET_POPUP_STRINGS_H_ */ diff --git a/include/net-popup.h b/include/net-popup.h index 5625043..3f23b71 100644 --- a/include/net-popup.h +++ b/include/net-popup.h @@ -1,20 +1,21 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.tizenopensource.org/license - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - +* net-popup +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Licensed under the Flora License, Version 1.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.tizenopensource.org/license +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ #ifndef __DEF_NET_POPUP_H_ #define __DEF_NET_POPUP_H_ @@ -29,6 +30,11 @@ #define PACKAGE "net-popup" #define ALERT_STR_LEN_MAX 100 +#define NETPOPUP_NOTIFICATION_WIFI_FOUND_PRIV_ID 1000 + +/* temporarily */ +#define NETPOPUP_NOTIFICATION_WIFI_ICON "/opt/ug/res/images/wifi-efl-UG/37_wifi_icon_03.png" + #define NET_POPUP "NET_POPUP" #define log_print(tag, format, args...) LOG(LOG_DEBUG, \ tag, "%s:%d "format, __func__, __LINE__, ##args) diff --git a/packaging/net.netpopup.spec b/packaging/net.netpopup.spec index 6948062..8f9dfc8 100644 --- a/packaging/net.netpopup.spec +++ b/packaging/net.netpopup.spec @@ -2,10 +2,10 @@ Name: net.netpopup Summary: Network Notification Popup application -Version: 0.1.17 +Version: 0.1.20_5 Release: 6 Group: App/Network -License: Flora Software License +License: Flora License Source0: %{name}-%{version}.tar.gz BuildRequires: cmake @@ -18,6 +18,8 @@ BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(syspopup) BuildRequires: pkgconfig(syspopup-caller) +BuildRequires: pkgconfig(appsvc) +BuildRequires: pkgconfig(notification) BuildRequires: gettext %description @@ -40,5 +42,5 @@ rm -rf %{buildroot} %files %{_bindir}/net-popup %{_prefix}/share/process-info/net-popup.ini -/opt/share/applications/net.netpopup.desktop +%{_prefix}/share/packages/net.netpopup.xml %{_prefix}/share/locale/*/LC_MESSAGES/net-popup.mo diff --git a/src/net-popup.c b/src/net-popup.c index 8e0c39f..313cd6b 100644 --- a/src/net-popup.c +++ b/src/net-popup.c @@ -1,29 +1,36 @@ /* - * Copyright 2012 Samsung Electronics Co., Ltd - * - * Licensed under the Flora License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.tizenopensource.org/license - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - +* net-popup +* +* Copyright 2012 Samsung Electronics Co., Ltd +* +* Licensed under the Flora License, Version 1.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.tizenopensource.org/license +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ #include #include +#include +#include #include #include #include "net-popup.h" #include "net-popup-strings.h" +static void __net_popup_wifi_add_notification(void *data); +static void __net_popup_wifi_del_notification(void *data); +static int __net_popup_show_tickernoti(bundle *b, void *data); +static int __net_popup_show_popup(bundle *b, void *data); static int __net_popup_term(bundle *b, void *data) { @@ -68,18 +75,150 @@ static int __net_popup_resume(void *data) static int __net_popup_reset(bundle *b, void *data) { - int ret = 0; - bundle *b_noti = NULL; - log_print(NET_POPUP, "__net_popup_reset()\n"); + const char* type = bundle_get_val(b, "_SYSPOPUP_TYPE_"); + + if (type == NULL) { + elm_exit(); + return 0; + } + + log_print(NET_POPUP, "type = %s\n", type); + + if (g_str_equal(type, "wifi_notification")) { + const char* mode = bundle_get_val(b, "_SYSPOPUP_CONTENT_"); + if (mode == NULL) { + elm_exit(); + return 0; + } + + if (g_str_equal(mode, "add")) { + __net_popup_wifi_add_notification(data); + } else if(g_str_equal(mode, "delete")) { + __net_popup_wifi_del_notification(data); + } else { + log_print(NET_POPUP, "error mode = %s\n", mode); + } + + elm_exit(); + } else if (g_str_equal(type, "notification")) { + __net_popup_show_tickernoti(b, data); + elm_exit(); + } else if (g_str_equal(type, "popup")) { + __net_popup_show_popup(b, data); + } else { + __net_popup_show_tickernoti(b, data); + elm_exit(); + } + + return 0; +} + +static void _ok_button_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + if (data) + evas_object_del(data); + elm_exit(); +} + +static void __net_popup_wifi_add_notification(void *data) +{ + int noti_flags = 0; + notification_h noti = NULL; + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + bundle *b = NULL; + + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NETPOPUP_NOTIFICATION_WIFI_FOUND_PRIV_ID); + if (noti == NULL) { + log_print(NET_POPUP, "fail to create notification"); + return; + } + + noti_err = notification_set_time(noti, time(NULL)); + if(noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_set_time : %d", noti_err); + return; + } + + noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, NETPOPUP_NOTIFICATION_WIFI_ICON); + if(noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_set_image : %d", noti_err); + return; + } + + noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, NOTIFICATION_STR_WIFI_FOUND_TITLE, NOTIFICATION_STR_WIFI_FOUND_TITLE, NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_set_title : %d", noti_err); + return; + } + + noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, NOTIFICATION_STR_WIFI_FOUND_CONTENT, NOTIFICATION_STR_WIFI_FOUND_CONTENT, NOTIFICATION_VARIABLE_TYPE_NONE); + if (noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_set_content : %d", noti_err); + return; + } + + noti_flags = NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY; + noti_err = notification_set_display_applist(noti, noti_flags); + if(noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_set_display_applist : %d", noti_err); + return; + } + + b = bundle_create(); + bundle_add(b, "_INTERNAL_SYSPOPUP_NAME_", "wifi-qs"); + appsvc_set_pkgname(b, "net.wifi-qs"); + noti_err = notification_set_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, "Launch", NULL, b); + if (noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_set_execute_option"); + return; + } + + noti_err = notification_insert(noti, NULL); + if (noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_insert"); + return; + } + + noti_err = notification_free(noti); + if (noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_free"); + return; + } + + log_print(NET_POPUP, "Successfuly added notification"); +} + +static void __net_popup_wifi_del_notification(void *data) +{ + notification_error_e noti_err = NOTIFICATION_ERROR_NONE; + + noti_err = notification_delete_by_priv_id(NULL, NOTIFICATION_TYPE_NOTI, NETPOPUP_NOTIFICATION_WIFI_FOUND_PRIV_ID); + if (noti_err != NOTIFICATION_ERROR_NONE) { + log_print(NET_POPUP, "fail to notification_delete_by_priv_id"); + } + + log_print(NET_POPUP, "Successfuly deleted notification"); +} + +static int __net_popup_show_tickernoti(bundle *b, void *data) +{ + bundle *b_noti = NULL; + b_noti = bundle_create(); bundle_add(b_noti, "2", "1"); bundle_add(b_noti, "3", "3"); const char* mode = bundle_get_val(b, "_SYSPOPUP_CONTENT_"); + + if (mode == NULL) { + bundle_free(b_noti); + return 0; + } + log_print(NET_POPUP, "content = %s\n", mode); - + if (strcmp(mode, "connected") == 0) { bundle_add(b_noti, "1", ALERT_STR_3G_CHARGE); log_print(NET_POPUP, "alert 3g\n"); @@ -98,8 +237,14 @@ static int __net_popup_reset(bundle *b, void *data) } else if (strcmp(mode, "wifi connected") == 0) { char buf[ALERT_STR_LEN_MAX] = ""; char *ap_name = bundle_get_val(b, "_AP_NAME_"); - snprintf(buf, ALERT_STR_LEN_MAX, "%s %s", ap_name, ALERT_STR_WIFI_CONNECTED); + + if (ap_name != NULL) + snprintf(buf, ALERT_STR_LEN_MAX, "%s %s", ap_name, ALERT_STR_WIFI_CONNECTED); + else + snprintf(buf, ALERT_STR_LEN_MAX, "%s", ALERT_STR_WIFI_CONNECTED); + bundle_add(b_noti, "1", buf); + log_print(NET_POPUP, "alert wifi connected\n"); } else { bundle_add(b_noti, "1", mode); @@ -112,6 +257,72 @@ static int __net_popup_reset(bundle *b, void *data) return 0; } +static int __net_popup_show_popup(bundle *b, void *data) +{ + Evas_Object *win; + Evas_Object *popup; + Evas_Object *button; + int w, h; + + const char* mode = bundle_get_val(b, "_SYSPOPUP_CONTENT_"); + + if (mode == NULL) { + elm_exit(); + return 0; + } + + log_print(NET_POPUP, "content = %s\n", mode); + + win = elm_win_add(NULL, PACKAGE, ELM_WIN_BASIC); + elm_win_alpha_set(win, EINA_TRUE); + elm_win_borderless_set(win, EINA_TRUE); + ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); + evas_object_resize(win, w, h); + + popup = elm_popup_add(win); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + if (strcmp(mode, "connected") == 0) { + elm_object_text_set(popup, ALERT_STR_3G_CHARGE); + log_print(NET_POPUP, "alert 3g\n"); + } else if (strcmp(mode, "fail to connect") == 0) { + elm_object_text_set(popup, ALERT_STR_ERR_UNAVAILABLE); + log_print(NET_POPUP, "alert err\n"); + } else if (strcmp(mode, "unable to connect") == 0) { + elm_object_text_set(popup, ALERT_STR_ERR_CONNECT); + log_print(NET_POPUP, "alert unable to connect\n"); + } else if (strcmp(mode, "not support") == 0) { + elm_object_text_set(popup, ALERT_STR_ERR_NOT_SUPPORT); + log_print(NET_POPUP, "alert not support\n"); + } else if (strcmp(mode, "wifi restricted") == 0) { + elm_object_text_set(popup, ALERT_STR_RESTRICTED_USE_WIFI); + log_print(NET_POPUP, "alert wifi restricted\n"); + } else if (strcmp(mode, "wifi connected") == 0) { + char buf[ALERT_STR_LEN_MAX] = ""; + char *ap_name = bundle_get_val(b, "_AP_NAME_"); + + if (ap_name != NULL) + snprintf(buf, ALERT_STR_LEN_MAX, "%s %s", ap_name, ALERT_STR_WIFI_CONNECTED); + else + snprintf(buf, ALERT_STR_LEN_MAX, "%s", ALERT_STR_WIFI_CONNECTED); + + elm_object_text_set(popup, buf); + + log_print(NET_POPUP, "alert wifi connected\n"); + } else { + elm_object_text_set(popup, mode); + log_print(NET_POPUP, "%s\n", mode); + } + + button = elm_button_add(popup); + elm_object_text_set(button, "OK"); + elm_object_part_content_set(popup, "button1", button); + evas_object_smart_callback_add(button, "clicked", _ok_button_clicked_cb, popup); + evas_object_show(popup); + evas_object_show(win); + + return 0; +} + int main(int argc, char *argv[]) { struct appcore_ops ops = {