From 559f9ce30d53c5cbc369d18758aa780c29d29c49 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 28 Aug 2011 16:18:39 +0000 Subject: [PATCH] Added an event for modem disconnections --- include/Phone/phone.h | 1 + po/fr.po | 10 +++++----- src/phone.c | 4 +++- src/plugins/panel.c | 5 +++++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/Phone/phone.h b/include/Phone/phone.h index 7bc10d4..baedb8a 100644 --- a/include/Phone/phone.h +++ b/include/Phone/phone.h @@ -64,6 +64,7 @@ typedef enum _PhoneEventType PHONE_EVENT_TYPE_STARTING, PHONE_EVENT_TYPE_STOPPING, PHONE_EVENT_TYPE_SUSPEND, + PHONE_EVENT_TYPE_UNAVAILABLE, PHONE_EVENT_TYPE_VIBRATOR_OFF, PHONE_EVENT_TYPE_VIBRATOR_ON, PHONE_EVENT_TYPE_VOLUME_GET, diff --git a/po/fr.po b/po/fr.po index 3b1ab07..8159270 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Phone 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-24 00:46+0200\n" +"POT-Creation-Date: 2011-08-28 18:15+0200\n" "PO-Revision-Date: 2010-04-24 02:07+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: DeforaOS development (French) \n" @@ -311,21 +311,21 @@ msgstr "Le numéro ne peut être vide" msgid "Message sent" msgstr "Message envoyé" -#: ../src/phone.c:3729 +#: ../src/phone.c:3731 #, c-format msgid "Wrong %s" msgstr "Mauvais %s" -#: ../src/phone.c:3736 +#: ../src/phone.c:3738 #, c-format msgid "%s is valid" msgstr "%s valide" -#: ../src/phone.c:3801 +#: ../src/phone.c:3803 msgid "Raw data (not shown)" msgstr "Données brutes (non affichées)" -#: ../src/phone.c:3834 +#: ../src/phone.c:3836 msgid "Message deleted" msgstr "Message effacé" diff --git a/src/phone.c b/src/phone.c index 66c7b20..4062b0a 100644 --- a/src/phone.c +++ b/src/phone.c @@ -3703,8 +3703,10 @@ static void _phone_modem_event(void * priv, ModemEvent * event) case MODEM_EVENT_TYPE_STATUS: if(event->status.status == MODEM_STATUS_ONLINE) pevent.type = PHONE_EVENT_TYPE_ONLINE; - else /* XXX may not always be right */ + else if(event->status.status == MODEM_STATUS_OFFLINE) pevent.type = PHONE_EVENT_TYPE_OFFLINE; + else /* XXX may not always be right */ + pevent.type = PHONE_EVENT_TYPE_UNAVAILABLE; phone_event(phone, &pevent); break; default: diff --git a/src/plugins/panel.c b/src/plugins/panel.c index 7bc1fc6..ba118cb 100644 --- a/src/plugins/panel.c +++ b/src/plugins/panel.c @@ -264,6 +264,11 @@ static int _panel_event(PhonePlugin * plugin, PhoneEvent * event) _panel_set_signal_level(panel, 0.0 / 0.0); _panel_set_status(panel, FALSE, FALSE); break; + case PHONE_EVENT_TYPE_UNAVAILABLE: + _panel_set_operator(panel, -1, "Unavailable"); + _panel_set_signal_level(panel, 0.0 / 0.0); + _panel_set_status(panel, FALSE, FALSE); + break; default: break; }