Some bugfixes

This commit is contained in:
Pierre Pronchery 2011-10-07 13:46:25 +00:00
parent 9b679aded5
commit afccdbd688
6 changed files with 127 additions and 125 deletions

View File

@ -286,7 +286,6 @@ typedef enum _ModemRequestType
MODEM_REQUEST_AUTHENTICATE = 0,
MODEM_REQUEST_CALL,
MODEM_REQUEST_CALL_ANSWER,
MODEM_REQUEST_CALL_CONTACT,
MODEM_REQUEST_CALL_HANGUP,
MODEM_REQUEST_CALL_LAST,
MODEM_REQUEST_CALL_MUTE_DISABLE,

134
po/fr.po
View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Phone 0.0.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-10-01 01:04+0200\n"
"POT-Creation-Date: 2011-10-07 15:45+0200\n"
"PO-Revision-Date: 2010-04-24 02:07+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: DeforaOS development (French) <devel-fr@lists.defora.org>\n"
@ -47,11 +47,11 @@ msgstr "Brouillons"
msgid "Trash"
msgstr "Corbeille"
#: ../src/phone.c:508 ../src/phone.c:2555
#: ../src/phone.c:508 ../src/phone.c:2551
msgid "System preferences"
msgstr "Préférences système"
#: ../src/phone.c:519 ../src/phone.c:1981
#: ../src/phone.c:519 ../src/phone.c:1977
msgid "Plug-ins"
msgstr "Greffons"
@ -76,260 +76,260 @@ msgstr "Suppression du message..."
msgid "translator-credits"
msgstr "Pierre Pronchery <khorben@defora.org>"
#: ../src/phone.c:1365
#: ../src/phone.c:1358
msgid "Unknown contact"
msgstr "Contact inconnu"
#: ../src/phone.c:1372
#: ../src/phone.c:1361
msgid "Unknown number"
msgstr "Numéro inconnu"
#: ../src/phone.c:1384
#: ../src/phone.c:1380
msgid "In conversation"
msgstr "En conversation"
#: ../src/phone.c:1395
#: ../src/phone.c:1391
msgid "Incoming call"
msgstr "Appel entrant"
#: ../src/phone.c:1405
#: ../src/phone.c:1401
msgid "Outgoing call"
msgstr "Appel sortant"
#: ../src/phone.c:1416
#: ../src/phone.c:1412
msgid "Call finished"
msgstr "Appel terminé"
#: ../src/phone.c:1448
#: ../src/phone.c:1444
msgid "_Answer"
msgstr "_Répondre"
#: ../src/phone.c:1453
#: ../src/phone.c:1449
msgid "_Hangup"
msgstr "Ra_ccrocher"
#: ../src/phone.c:1458
#: ../src/phone.c:1454
msgid "_Reject"
msgstr "Re_jeter"
#: ../src/phone.c:1478
#: ../src/phone.c:1474
msgid "Loudspeaker"
msgstr "Haut-parleur"
#: ../src/phone.c:1486
#: ../src/phone.c:1482
msgid "Mute microphone"
msgstr "Couper le microphone"
#: ../src/phone.c:1528
#: ../src/phone.c:1524
#, c-format
msgid "Enter %s"
msgstr "Entrer %s"
#: ../src/phone.c:1571
#: ../src/phone.c:1567
msgid "Enter"
msgstr "Entrer"
#: ../src/phone.c:1573
#: ../src/phone.c:1569
msgid "Skip"
msgstr "Ignorer"
#: ../src/phone.c:1601
#: ../src/phone.c:1597
msgid "Contacts"
msgstr "Contacts"
#: ../src/phone.c:1607 ../src/phone.c:1726 ../src/phone.c:1762
#: ../src/phone.c:1877 ../src/phone.c:2233
#: ../src/phone.c:1603 ../src/phone.c:1722 ../src/phone.c:1758
#: ../src/phone.c:1873 ../src/phone.c:2229
msgid "Call"
msgstr "Appeler"
#: ../src/phone.c:1613
#: ../src/phone.c:1609
msgid "Write"
msgstr "Écrire"
#: ../src/phone.c:1655 ../src/phone.c:2012 ../src/phone.c:2344
#: ../src/phone.c:1651 ../src/phone.c:2008 ../src/phone.c:2340
msgid "Name"
msgstr "Nom"
#: ../src/phone.c:1701
#: ../src/phone.c:1697
msgid "Dialer"
msgstr "Composer"
#: ../src/phone.c:1728
#: ../src/phone.c:1724
msgid "Hang up"
msgstr "Raccrocher"
#: ../src/phone.c:1756
#: ../src/phone.c:1752
msgid "Phone logs"
msgstr "Journal d'appels"
#: ../src/phone.c:1768
#: ../src/phone.c:1764
msgid "Message"
msgstr "Message"
#: ../src/phone.c:1799
#: ../src/phone.c:1795
msgid "Direction"
msgstr "Direction"
#: ../src/phone.c:1804 ../src/phone.c:1923
#: ../src/phone.c:1800 ../src/phone.c:1919
msgid "To/From"
msgstr "Vers/De"
#: ../src/phone.c:1810 ../src/phone.c:1931
#: ../src/phone.c:1806 ../src/phone.c:1927
msgid "Date"
msgstr "Date"
#: ../src/phone.c:1871
#: ../src/phone.c:1867
msgid "Messages"
msgstr "Messages"
#: ../src/phone.c:1882
#: ../src/phone.c:1878
msgid "New message"
msgstr "Nouveau message"
#: ../src/phone.c:1888 ../src/phone.c:2239
#: ../src/phone.c:1884 ../src/phone.c:2235
msgid "Reply"
msgstr "Répondre"
#: ../src/phone.c:2000
#: ../src/phone.c:1996
msgid "Enabled"
msgstr "Activé"
#: ../src/phone.c:2227
#: ../src/phone.c:2223
msgid "Read message"
msgstr "Lire le message"
#: ../src/phone.c:2245
#: ../src/phone.c:2241
msgid "Forward"
msgstr "Transmettre"
#: ../src/phone.c:2319
#: ../src/phone.c:2315
msgid "Phone settings"
msgstr "Paramètres du téléphone"
#: ../src/phone.c:2396
#: ../src/phone.c:2392
msgid "missed calls"
msgstr "appels manqués"
#: ../src/phone.c:2396
#: ../src/phone.c:2392
msgid "missed call"
msgstr "appel manqué"
#: ../src/phone.c:2405
#: ../src/phone.c:2401
msgid "new messages"
msgstr "nouveaux messages"
#: ../src/phone.c:2406
#: ../src/phone.c:2402
msgid "new message"
msgstr "nouveau message"
#: ../src/phone.c:2424 ../src/phone.c:3352 ../src/phone.c:3356
#: ../src/phone.c:2420 ../src/phone.c:3347 ../src/phone.c:3351
msgid "Information"
msgstr "Information"
#: ../src/phone.c:2434
#: ../src/phone.c:2430
msgid "Status"
msgstr "État"
#: ../src/phone.c:2458
#: ../src/phone.c:2454
msgid "_View"
msgstr "_Vue"
#: ../src/phone.c:2477
#: ../src/phone.c:2473
msgid "_Read"
msgstr "_Lire"
#: ../src/phone.c:2609
#: ../src/phone.c:2605
msgid "Open file..."
msgstr "Ouvrir fichier..."
#: ../src/phone.c:2780
#: ../src/phone.c:2776
msgid "Write message"
msgstr "Écrire un message"
#: ../src/phone.c:2786
#: ../src/phone.c:2782
msgid "Send"
msgstr "Envoyer"
#: ../src/phone.c:2792
#: ../src/phone.c:2788
msgid "Attach"
msgstr "Joindre"
#: ../src/phone.c:2908
#: ../src/phone.c:2904
msgid "Attach file..."
msgstr "Joindre un fichier..."
#: ../src/phone.c:2979
#: ../src/phone.c:2975
#, c-format
msgid "%d message%s, %d/%d characters"
msgstr "%d message%s, %d/%d caractères"
#: ../src/phone.c:2980
#: ../src/phone.c:2976
msgid "s"
msgstr "s"
#: ../src/phone.c:3044
#: ../src/phone.c:3040
msgid "Sending message..."
msgstr "Envoi du message..."
#: ../src/phone.c:3080
#: ../src/phone.c:3075
msgid "Outgoing"
msgstr "Sortant"
#: ../src/phone.c:3266
#: ../src/phone.c:3261
msgid "Operation in progress..."
msgstr "Opération en cours..."
#: ../src/phone.c:3304 ../src/phone.c:3308
#: ../src/phone.c:3299 ../src/phone.c:3303
msgid "Question"
msgstr "Question"
#: ../src/phone.c:3328 ../src/phone.c:3332
#: ../src/phone.c:3323 ../src/phone.c:3327
msgid "Error"
msgstr "Erreur"
#: ../src/phone.c:3558
#: ../src/phone.c:3553
msgid "Name: "
msgstr "Nom: "
#: ../src/phone.c:3567
#: ../src/phone.c:3562
msgid "Number: "
msgstr "Numéro: "
#: ../src/phone.c:3583
#: ../src/phone.c:3578
msgid "New contact"
msgstr "Nouveau contact"
#: ../src/phone.c:3585
#: ../src/phone.c:3580
msgid "Edit contact: "
msgstr "Modifier contact: "
#: ../src/phone.c:3612
#: ../src/phone.c:3607
msgid "The name cannot be empty"
msgstr "Le nom ne peut être vide"
#: ../src/phone.c:3617
#: ../src/phone.c:3612
msgid "The number cannot be empty"
msgstr "Le numéro ne peut être vide"
#: ../src/phone.c:3753
#: ../src/phone.c:3748
msgid "Message sent"
msgstr "Message envoyé"
#: ../src/phone.c:3784
#: ../src/phone.c:3779
#, c-format
msgid "Wrong %s"
msgstr "Mauvais %s"
#: ../src/phone.c:3791
#: ../src/phone.c:3788
#, c-format
msgid "%s is valid"
msgstr "%s valide"
#: ../src/phone.c:3856
#: ../src/phone.c:3843
msgid "Raw data (not shown)"
msgstr "Données brutes (non affichées)"
#: ../src/phone.c:3889
#: ../src/phone.c:3876
msgid "Message deleted"
msgstr "Message effacé"

View File

@ -12,6 +12,10 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* FIXME:
* - don't report SIM ready is not explicitly required? or in src/phone.c?
* - verify that the error when the SIM PIN code is wrong is handled properly
* - allow a trace log to be stored */
@ -342,8 +346,8 @@ typedef enum _HayesConfig
static ModemConfig _hayes_config[HAYES_CONFIG_COUNT + 1] =
{
{ "device", "Device", MCT_FILENAME, NULL },
{ "baudrate", "Baudrate", MCT_UINT32, (void*)115200 },
{ "hwflow", "Hardware flow control",MCT_BOOLEAN, (void*)1 },
{ "baudrate", "Baudrate", MCT_UINT32, (void *)115200},
{ "hwflow", "Hardware flow control",MCT_BOOLEAN, (void *)1 },
{ NULL, NULL, MCT_NONE, NULL }
};
@ -644,6 +648,7 @@ static int _hayes_request(ModemPlugin * modem, ModemRequest * request)
{
int ret;
Hayes * hayes = modem->priv;
unsigned int type = request->type;
size_t i;
size_t count = sizeof(_hayes_request_handlers)
/ sizeof(*_hayes_request_handlers);
@ -657,7 +662,7 @@ static int _hayes_request(ModemPlugin * modem, ModemRequest * request)
if(request == NULL)
return -1;
if(hayes->quirks & HAYES_QUIRK_CONNECTED_LINE_DISABLED
&& request->type == HAYES_REQUEST_CONNECTED_LINE_ENABLE)
&& type == HAYES_REQUEST_CONNECTED_LINE_ENABLE)
request->type = HAYES_REQUEST_CONNECTED_LINE_DISABLE;
for(i = 0; i < count; i++)
if(_hayes_request_handlers[i].type == request->type)
@ -683,9 +688,10 @@ static int _hayes_request(ModemPlugin * modem, ModemRequest * request)
static char * _request_attention(ModemPlugin * modem, ModemRequest * request)
{
unsigned int type = request->type;
char buf[32];
switch(request->type)
switch(type)
{
case HAYES_REQUEST_CONTACT_LIST:
return _request_attention_contact_list(request);
@ -773,6 +779,8 @@ static char * _request_attention_call(ModemPlugin * modem,
else if(!_is_number(request->call.number))
return NULL;
event = &hayes->events[MODEM_EVENT_TYPE_CALL];
/* XXX should really be set at the time of the call */
event->call.call_type = request->call.call_type;
free(hayes->call_number);
if(request->call.call_type == MODEM_CALL_TYPE_DATA)
hayes->call_number = NULL;
@ -795,7 +803,9 @@ static char * _request_attention_call_hangup(ModemPlugin * modem)
ModemEvent * event = &hayes->events[MODEM_EVENT_TYPE_CONNECTION];
/* FIXME check that this works on all phones, including:
* - while calling (still ringing) => simply inject "\r\n"?
* - while calling:
* . still ringing => simply inject "\r\n"?
* . in the queue => simply remove?
* - while ringing (incoming) */
if(hayes->mode == HAYES_MODE_DATA)
{
@ -2222,6 +2232,7 @@ static HayesCommandStatus _on_request_authenticate(HayesCommand * command,
default:
return status;
}
/* XXX it should be bound to the request instead */
if(event->authentication.name != NULL)
modem->helper->event(modem->helper->modem, event);
if(status == HCS_SUCCESS)
@ -3385,7 +3396,7 @@ static void _on_trigger_cring(ModemPlugin * modem, char const * answer)
ModemEvent * event = &hayes->events[MODEM_EVENT_TYPE_CALL];
if(strcmp(answer, "VOICE") == 0)
; /* FIXME implement */
event->call.call_type = MODEM_CALL_TYPE_VOICE;
event->call.status = MODEM_CALL_STATUS_RINGING;
event->call.direction = MODEM_CALL_DIRECTION_INCOMING;
event->call.number = "";

View File

@ -716,7 +716,7 @@ void phone_contacts_call_selected(Phone * phone)
{
GtkTreeSelection * treesel;
GtkTreeIter iter;
unsigned int id;
gchar * number;
if((treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(
phone->co_view))) == NULL)
@ -724,9 +724,9 @@ void phone_contacts_call_selected(Phone * phone)
if(gtk_tree_selection_get_selected(treesel, NULL, &iter) != TRUE)
return;
gtk_tree_model_get(GTK_TREE_MODEL(phone->co_store), &iter,
PHONE_CONTACT_COLUMN_ID, &id, -1);
modem_request_type(phone->modem, MODEM_REQUEST_CALL_CONTACT,
MODEM_CALL_TYPE_VOICE, id);
PHONE_CONTACT_COLUMN_NUMBER, &number, -1);
_phone_call_number(phone, number);
g_free(number);
}
@ -1325,13 +1325,14 @@ void phone_show_about(Phone * phone, gboolean show)
static void _show_call_window(Phone * phone);
void phone_show_call(Phone * phone, gboolean show, ...)
/* FIXME let the API closer to ModemEvent.call */
{
va_list ap;
PhoneCall call;
char const * name = NULL;
ModemEvent * me;
PhoneEvent pe;
char const * name;
char const * number = NULL;
PhoneEvent event;
ModemCallStatus status;
PhoneCall call;
if(show == FALSE)
{
@ -1340,39 +1341,34 @@ void phone_show_call(Phone * phone, gboolean show, ...)
return;
}
va_start(ap, show);
call = va_arg(ap, PhoneCall);
if(call == PHONE_CALL_INCOMING || call == PHONE_CALL_OUTGOING)
{
name = va_arg(ap, char const *);
number = va_arg(ap, char const *);
}
me = va_arg(ap, ModemEvent *);
va_end(ap);
if(phone->ca_window == NULL)
_show_call_window(phone);
phone_show_dialer(phone, FALSE);
/* get the current volume */
memset(&event, 0, sizeof(event));
event.type = PHONE_EVENT_TYPE_VOLUME_GET;
event.volume_get.level = gtk_range_get_value(GTK_RANGE(
memset(&pe, 0, sizeof(pe));
pe.type = PHONE_EVENT_TYPE_VOLUME_GET;
pe.volume_get.level = gtk_range_get_value(GTK_RANGE(
phone->ca_volume));
if(phone_event(phone, &event) == 0)
if(phone_event(phone, &pe) == 0)
gtk_range_set_value(GTK_RANGE(phone->ca_volume),
event.volume_get.level);
if(name != NULL)
{
if(name[0] == '\0')
/* XXX look it up if we have the number */
name = _("Unknown contact");
gtk_label_set_text(GTK_LABEL(phone->ca_name), name);
}
if(number != NULL)
{
if(number[0] == '\0')
/* XXX look it up if we have the name */
number = _("Unknown number");
gtk_label_set_text(GTK_LABEL(phone->ca_number), number);
}
pe.volume_get.level);
/* XXX look it up if we have the number */
name = _("Unknown contact");
gtk_label_set_text(GTK_LABEL(phone->ca_name), name);
if((number = me->call.number) == NULL)
number = _("Unknown number");
gtk_label_set_text(GTK_LABEL(phone->ca_number), number);
gtk_widget_show_all(phone->ca_window);
/* XXX this isn't so nice */
if((status = me->call.status) == MODEM_CALL_STATUS_ACTIVE)
call = PHONE_CALL_ESTABLISHED;
else if(status == MODEM_CALL_STATUS_RINGING)
call = (me->call.direction == MODEM_CALL_DIRECTION_INCOMING)
? PHONE_CALL_INCOMING : PHONE_CALL_OUTGOING;
else
call = PHONE_CALL_TERMINATED;
switch(call)
{
case PHONE_CALL_ESTABLISHED:
@ -1467,7 +1463,7 @@ static void _show_call_window(Phone * phone)
/* volume bar */
hbox = gtk_hbox_new(FALSE, 4);
phone->ca_image = gtk_image_new_from_icon_name(
"audio-volume-muted", GTK_ICON_SIZE_BUTTON);
"audio-volume-medium", GTK_ICON_SIZE_BUTTON);
gtk_box_pack_start(GTK_BOX(hbox), phone->ca_image, FALSE, TRUE, 0);
phone->ca_volume = gtk_hscale_new_with_range(0.0, 1.0, 0.02);
g_signal_connect(phone->ca_volume, "value-changed", G_CALLBACK(
@ -3069,7 +3065,6 @@ static int _phone_call_number(Phone * phone, char const * number)
return -1;
modem_request_type(phone->modem, MODEM_REQUEST_CALL,
MODEM_CALL_TYPE_VOICE, number, 0);
phone_show_call(phone, TRUE, PHONE_CALL_OUTGOING, "", number);
/* add a log entry */
gtk_list_store_append(phone->lo_store, &iter);
date = time(NULL);
@ -3805,22 +3800,12 @@ static void _modem_event_authentication(Phone * phone, ModemEvent * event)
static void _modem_event_call(Phone * phone, ModemEvent * event)
{
PhoneCall call;
ModemCallStatus call_status;
ModemCallDirection call_direction;
if(event->call.number == NULL)
return; /* XXX ignore for now */
call_status = event->call.status;
call_direction = event->call.direction;
if(call_status == MODEM_CALL_STATUS_ACTIVE)
call = PHONE_CALL_ESTABLISHED;
else if(call_status == MODEM_CALL_STATUS_RINGING)
call = (call_direction == MODEM_CALL_DIRECTION_INCOMING)
? PHONE_CALL_INCOMING : PHONE_CALL_OUTGOING;
else
call = PHONE_CALL_TERMINATED;
phone_show_call(phone, TRUE, call, "", event->call.number);
fprintf(stderr, "DEBUG: %s() %u %u\n", __func__, event->call.call_type,
event->call.status);
if(event->call.call_type != MODEM_CALL_TYPE_VOICE
|| event->call.number == NULL)
return; /* XXX ignore these for now */
phone_show_call(phone, TRUE, event);
}
static void _modem_event_error(Phone * phone, ModemEvent * event)

View File

@ -12,6 +12,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* FIXME:
* - check if it resets the modem on "OK" (and if so, avoid it) */
@ -108,6 +110,9 @@ static int _gprs_init(PhonePlugin * plugin)
gprs->window = NULL;
#if GTK_CHECK_VERSION(2, 10, 0)
gprs->icon = gtk_status_icon_new_from_icon_name("stock_internet");
# if GTK_CHECK_VERSION(2, 16, 0)
gtk_status_icon_set_tooltip_text(gprs->icon, "Not connected");
# endif
# if GTK_CHECK_VERSION(2, 18, 0)
gtk_status_icon_set_title(gprs->icon, "GPRS");
# if GTK_CHECK_VERSION(2, 20, 0)

View File

@ -12,6 +12,8 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* FIXME:
* - implement native NetBSD support */