From: Enlightenment S. <no-...@en...> - 2009-05-23 17:58:54
|
Log: Send notifications connected/disconnected Author: watchwolf Date: 2009-05-23 10:58:50 -0700 (Sat, 23 May 2009) New Revision: 40801 Modified: trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.c trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.h Modified: trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.c =================================================================== --- trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.c 2009-05-23 17:58:27 UTC (rev 40800) +++ trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.c 2009-05-23 17:58:50 UTC (rev 40801) @@ -571,9 +571,7 @@ if(send_notif) { - notify = e_notification_new(); - e_notification_app_name_set(notify, "Exalt"); - e_notification_timeout_set(notify, 10000); + notify = notification_new(); } //printf("Question id: %d\n",exalt_dbus_response_msg_id_get(response)); @@ -599,12 +597,6 @@ popup_update(inst,response); if_wired_dialog_update(inst,response); if_network_dialog_update(inst,response); - if(send_notif && exalt_dbus_response_address_get(response) - && strcmp(exalt_dbus_response_address_get(response),"")!=0) - { - snprintf(buf,1024,"Connected to a wired network\n"); - e_notification_body_set(notify,buf); - } break; case EXALT_DBUS_RESPONSE_IFACE_NETMASK_GET: if_wired_dialog_update(inst,response); @@ -686,6 +678,43 @@ switch(action) { + case EXALT_ETH_CB_ACTION_CONNECTED: + { + E_Notification *notify = notification_new(); + + e_notification_body_set(notify, + "Connected to a wired network"); + + e_notification_send(notify,NULL,NULL); + e_notification_unref(notify); + } + break; + case EXALT_ETH_CB_ACTION_DISCONNECTED: + { + E_Notification *notify = notification_new(); + + e_notification_body_set(notify, + "Disconnected from a wired network"); + + e_notification_send(notify,NULL,NULL); + e_notification_unref(notify); + } + break; + case EXALT_WIRELESS_CB_ACTION_CONNECTED: + id = calloc(1,sizeof(int)); + *id = exalt_dbus_wireless_essid_get(inst->conn,eth); + notification = eina_list_append(notification,id); + break; + case EXALT_WIRELESS_CB_ACTION_DISCONNECTED: + { + E_Notification *notify = notification_new(); + + e_notification_body_set(notify, + "Disconnected from a wireless network"); + + e_notification_send(notify,NULL,NULL); + } + break; case EXALT_ETH_CB_ACTION_NEW: case EXALT_ETH_CB_ACTION_ADD: popup_iface_add(inst,eth,IFACE_WIRED); @@ -703,14 +732,9 @@ exalt_dbus_eth_link_is(inst->conn,eth); break; case EXALT_WIRELESS_CB_ACTION_ESSIDCHANGE: - id = calloc(1,sizeof(int)); - *id = exalt_dbus_wireless_essid_get(inst->conn,eth); - notification = eina_list_append(notification,id); break; case EXALT_ETH_CB_ACTION_ADDRESS_NEW: - id = calloc(1,sizeof(int)); - *id = exalt_dbus_eth_ip_get(inst->conn,eth); - notification = eina_list_append(notification,id); + exalt_dbus_eth_ip_get(inst->conn,eth); break; case EXALT_ETH_CB_ACTION_NETMASK_NEW: exalt_dbus_eth_netmask_get(inst->conn,eth); @@ -724,7 +748,6 @@ break; default: ; } - } void notify_scan_cb(char* iface, Eina_List* networks, void* user_data ) @@ -732,3 +755,10 @@ popup_notify_scan(iface,networks,user_data ); } +E_Notification* notification_new() +{ + E_Notification *notify = e_notification_new(); + e_notification_app_name_set(notify, "Exalt"); + e_notification_timeout_set(notify, 3000); + return notify; +} Modified: trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.h =================================================================== --- trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.h 2009-05-23 17:58:27 UTC (rev 40800) +++ trunk/E-MODULES-EXTRA/exalt-client/src/e_mod_main.h 2009-05-23 17:58:50 UTC (rev 40801) @@ -247,6 +247,7 @@ void response_cb(Exalt_DBus_Response* response, void* data ); void notify_cb(char* eth, Exalt_Enum_Action action, void* user_data); void notify_scan_cb(char* iface, Eina_List* networks, void* user_data ); +E_Notification* notification_new(); void popup_init(Instance* inst); void popup_show(Instance* inst); |