Using libDesktop to handle client messages

This commit is contained in:
Pierre Pronchery 2012-01-01 13:33:51 +00:00
parent ab1562f06e
commit 364c2d1f18
4 changed files with 154 additions and 168 deletions

158
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-12-30 21:04+0100\n"
"POT-Creation-Date: 2012-01-01 14:31+0100\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"
@ -27,317 +27,317 @@ msgstr ""
" -m\tNom du greffon modem à charger\n"
" -r\tDélai entre deux tentatives d'accès au modem (ms)\n"
#: ../src/phone.c:357
#: ../src/phone.c:359
msgid "All"
msgstr "Tous"
#: ../src/phone.c:358
#: ../src/phone.c:360
msgid "Inbox"
msgstr "Reçus"
#: ../src/phone.c:359
#: ../src/phone.c:361
msgid "Sent"
msgstr "Envoyés"
#: ../src/phone.c:360
#: ../src/phone.c:362
msgid "Drafts"
msgstr "Brouillons"
#: ../src/phone.c:361
#: ../src/phone.c:363
msgid "Trash"
msgstr "Corbeille"
#: ../src/phone.c:508 ../src/phone.c:2639
#: ../src/phone.c:512 ../src/phone.c:2638
msgid "System preferences"
msgstr "Préférences système"
#: ../src/phone.c:519 ../src/phone.c:2062
#: ../src/phone.c:523 ../src/phone.c:2061
msgid "Plug-ins"
msgstr "Greffons"
#: ../src/phone.c:669
#: ../src/phone.c:673
#, c-format
msgid "Checking %s..."
msgstr "Vérification %s..."
#: ../src/phone.c:732
#: ../src/phone.c:736
msgid "Delete this contact?"
msgstr "Supprimer ce contact?"
#: ../src/phone.c:1130 ../src/phone.c:1296
#: ../src/phone.c:1134 ../src/phone.c:1300
msgid "Delete this message?"
msgstr "Supprimer ce message?"
#: ../src/phone.c:1136 ../src/phone.c:1301
#: ../src/phone.c:1140 ../src/phone.c:1305
msgid "Deleting message..."
msgstr "Suppression du message..."
#: ../src/phone.c:1385
#: ../src/phone.c:1389
msgid "translator-credits"
msgstr "Pierre Pronchery <khorben@defora.org>"
#: ../src/phone.c:1432
#: ../src/phone.c:1436
msgid "Unknown contact"
msgstr "Contact inconnu"
#: ../src/phone.c:1435
#: ../src/phone.c:1439
msgid "Unknown number"
msgstr "Numéro inconnu"
#: ../src/phone.c:1454
#: ../src/phone.c:1458
msgid "In conversation"
msgstr "En conversation"
#: ../src/phone.c:1465
#: ../src/phone.c:1469
msgid "Incoming call"
msgstr "Appel entrant"
#: ../src/phone.c:1475
#: ../src/phone.c:1479
msgid "Outgoing call"
msgstr "Appel sortant"
#: ../src/phone.c:1486
#: ../src/phone.c:1490
msgid "Call finished"
msgstr "Appel terminé"
#: ../src/phone.c:1520
#: ../src/phone.c:1524
msgid "_Answer"
msgstr "_Répondre"
#: ../src/phone.c:1525
#: ../src/phone.c:1529
msgid "_Hangup"
msgstr "Ra_ccrocher"
#: ../src/phone.c:1530
#: ../src/phone.c:1534
msgid "_Reject"
msgstr "Re_jeter"
#: ../src/phone.c:1551
#: ../src/phone.c:1555
msgid "Loudspeaker"
msgstr "Haut-parleur"
#: ../src/phone.c:1559
#: ../src/phone.c:1563
msgid "Mute microphone"
msgstr "Couper le microphone"
#: ../src/phone.c:1567
#: ../src/phone.c:1571
msgid "Show dialer"
msgstr "Afficher le cadran"
#: ../src/phone.c:1608
#: ../src/phone.c:1612
#, c-format
msgid "Enter %s"
msgstr "Entrer %s"
#: ../src/phone.c:1651
#: ../src/phone.c:1655
msgid "Enter"
msgstr "Entrer"
#: ../src/phone.c:1653
#: ../src/phone.c:1657
msgid "Skip"
msgstr "Ignorer"
#: ../src/phone.c:1681
#: ../src/phone.c:1685
msgid "Contacts"
msgstr "Contacts"
#: ../src/phone.c:1687 ../src/phone.c:1806 ../src/phone.c:1842
#: ../src/phone.c:1957 ../src/phone.c:2315
#: ../src/phone.c:1691 ../src/phone.c:1805 ../src/phone.c:1841
#: ../src/phone.c:1956 ../src/phone.c:2314
msgid "Call"
msgstr "Appeler"
#: ../src/phone.c:1693
#: ../src/phone.c:1697
msgid "Write"
msgstr "Écrire"
#: ../src/phone.c:1735 ../src/phone.c:2093 ../src/phone.c:2426
#: ../src/phone.c:1739 ../src/phone.c:2092 ../src/phone.c:2425
msgid "Name"
msgstr "Nom"
#: ../src/phone.c:1781
#: ../src/phone.c:1785
msgid "Dialer"
msgstr "Composer"
#: ../src/phone.c:1808
#: ../src/phone.c:1807
msgid "Hang up"
msgstr "Raccrocher"
#: ../src/phone.c:1836
#: ../src/phone.c:1835
msgid "Phone logs"
msgstr "Journal d'appels"
#: ../src/phone.c:1848
#: ../src/phone.c:1847
msgid "Message"
msgstr "Message"
#: ../src/phone.c:1879
#: ../src/phone.c:1878
msgid "Direction"
msgstr "Direction"
#: ../src/phone.c:1884 ../src/phone.c:2003
#: ../src/phone.c:1883 ../src/phone.c:2002
msgid "To/From"
msgstr "Vers/De"
#: ../src/phone.c:1890 ../src/phone.c:2011
#: ../src/phone.c:1889 ../src/phone.c:2010
msgid "Date"
msgstr "Date"
#: ../src/phone.c:1951
#: ../src/phone.c:1950
msgid "Messages"
msgstr "Messages"
#: ../src/phone.c:1962
#: ../src/phone.c:1961
msgid "New message"
msgstr "Nouveau message"
#: ../src/phone.c:1968 ../src/phone.c:2321
#: ../src/phone.c:1967 ../src/phone.c:2320
msgid "Reply"
msgstr "Répondre"
#: ../src/phone.c:2081
#: ../src/phone.c:2080
msgid "Enabled"
msgstr "Activé"
#: ../src/phone.c:2309
#: ../src/phone.c:2308
msgid "Read message"
msgstr "Lire le message"
#: ../src/phone.c:2327
#: ../src/phone.c:2326
msgid "Forward"
msgstr "Transmettre"
#: ../src/phone.c:2401
#: ../src/phone.c:2400
msgid "Telephony settings"
msgstr "Paramètres de téléphonie"
#: ../src/phone.c:2478
#: ../src/phone.c:2477
msgid "missed calls"
msgstr "appels manqués"
#: ../src/phone.c:2478
#: ../src/phone.c:2477
msgid "missed call"
msgstr "appel manqué"
#: ../src/phone.c:2487
#: ../src/phone.c:2486
msgid "new messages"
msgstr "nouveaux messages"
#: ../src/phone.c:2488
#: ../src/phone.c:2487
msgid "new message"
msgstr "nouveau message"
#: ../src/phone.c:2506 ../src/phone.c:3463 ../src/phone.c:3467
#: ../src/phone.c:2505 ../src/phone.c:3462 ../src/phone.c:3466
msgid "Information"
msgstr "Information"
#: ../src/phone.c:2516
#: ../src/phone.c:2515
msgid "Status"
msgstr "État"
#: ../src/phone.c:2540
#: ../src/phone.c:2539
msgid "_View"
msgstr "_Vue"
#: ../src/phone.c:2559
#: ../src/phone.c:2558
msgid "_Read"
msgstr "_Lire"
#: ../src/phone.c:2699
#: ../src/phone.c:2698
msgid "Open file..."
msgstr "Ouvrir fichier..."
#: ../src/phone.c:2882
#: ../src/phone.c:2881
msgid "Write message"
msgstr "Écrire un message"
#: ../src/phone.c:2888
#: ../src/phone.c:2887
msgid "Send"
msgstr "Envoyer"
#: ../src/phone.c:2894
#: ../src/phone.c:2893
msgid "Attach"
msgstr "Joindre"
#: ../src/phone.c:3010
#: ../src/phone.c:3009
msgid "Attach file..."
msgstr "Joindre un fichier..."
#: ../src/phone.c:3082
#: ../src/phone.c:3081
#, c-format
msgid "%d message%s, %d/%d characters"
msgstr "%d message%s, %d/%d caractères"
#: ../src/phone.c:3083
#: ../src/phone.c:3082
msgid "s"
msgstr "s"
#: ../src/phone.c:3147
#: ../src/phone.c:3146
msgid "Sending message..."
msgstr "Envoi du message..."
#: ../src/phone.c:3182
#: ../src/phone.c:3181
msgid "Outgoing"
msgstr "Sortant"
#: ../src/phone.c:3368
#: ../src/phone.c:3367
msgid "Operation in progress..."
msgstr "Opération en cours..."
#: ../src/phone.c:3408 ../src/phone.c:3412
#: ../src/phone.c:3407 ../src/phone.c:3411
msgid "Question"
msgstr "Question"
#: ../src/phone.c:3432 ../src/phone.c:3436
#: ../src/phone.c:3431 ../src/phone.c:3435
msgid "Error"
msgstr "Erreur"
#: ../src/phone.c:3665
#: ../src/phone.c:3664
msgid "Name: "
msgstr "Nom: "
#: ../src/phone.c:3674
#: ../src/phone.c:3673
msgid "Number: "
msgstr "Numéro: "
#: ../src/phone.c:3690
#: ../src/phone.c:3689
msgid "New contact"
msgstr "Nouveau contact"
#: ../src/phone.c:3692
#: ../src/phone.c:3691
msgid "Edit contact: "
msgstr "Modifier contact: "
#: ../src/phone.c:3719
#: ../src/phone.c:3718
msgid "The name cannot be empty"
msgstr "Le nom ne peut être vide"
#: ../src/phone.c:3724
#: ../src/phone.c:3723
msgid "The number cannot be empty"
msgstr "Le numéro ne peut être vide"
#: ../src/phone.c:3858
#: ../src/phone.c:3857
msgid "Message sent"
msgstr "Message envoyé"
#: ../src/phone.c:3888
#: ../src/phone.c:3887
#, c-format
msgid "Wrong %s"
msgstr "Mauvais %s"
#: ../src/phone.c:3891
#: ../src/phone.c:3890
msgid "Authentication failed"
msgstr "Échec lors de l'authentification"
#: ../src/phone.c:3900
#: ../src/phone.c:3899
#, c-format
msgid "%s is valid"
msgstr "%s valide"
#: ../src/phone.c:3963
#: ../src/phone.c:3962
msgid "Raw data (not shown)"
msgstr "Données brutes (non affichées)"
#: ../src/phone.c:3999
#: ../src/phone.c:3998
msgid "Message deleted"
msgstr "Message effacé"

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Phone */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,85 +32,6 @@ gboolean on_phone_closex(gpointer data)
}
/* on_phone_filter */
static GdkFilterReturn _filter_message_power_management(Phone * phone,
PhoneMessagePowerManagement what);
static GdkFilterReturn _filter_message_show(Phone * phone,
PhoneMessageShow what, gboolean show);
GdkFilterReturn on_phone_filter(GdkXEvent * xevent, GdkEvent * event,
gpointer data)
{
Phone * phone = data;
XEvent * xev = xevent;
XClientMessageEvent * xclient = &xev->xclient;
PhoneMessage message;
if(xev->type != ClientMessage)
return GDK_FILTER_CONTINUE;
if(xclient->message_type != gdk_x11_get_xatom_by_name(
PHONE_CLIENT_MESSAGE))
return GDK_FILTER_CONTINUE;
message = xclient->data.b[0];
switch(message)
{
case PHONE_MESSAGE_POWER_MANAGEMENT:
return _filter_message_power_management(phone,
xclient->data.b[1]);
case PHONE_MESSAGE_SHOW:
return _filter_message_show(phone, xclient->data.b[1],
xclient->data.b[2]);
}
return GDK_FILTER_CONTINUE;
}
static GdkFilterReturn _filter_message_power_management(Phone * phone,
PhoneMessagePowerManagement what)
{
switch(what)
{
case PHONE_MESSAGE_POWER_MANAGEMENT_RESUME:
phone_event_type(phone, PHONE_EVENT_TYPE_RESUME);
break;
case PHONE_MESSAGE_POWER_MANAGEMENT_SUSPEND:
phone_event_type(phone, PHONE_EVENT_TYPE_SUSPEND);
break;
}
return GDK_FILTER_CONTINUE;
}
static GdkFilterReturn _filter_message_show(Phone * phone,
PhoneMessageShow what, gboolean show)
{
switch(what)
{
case PHONE_MESSAGE_SHOW_ABOUT:
phone_show_about(phone, show);
break;
case PHONE_MESSAGE_SHOW_CONTACTS:
phone_show_contacts(phone, show);
break;
case PHONE_MESSAGE_SHOW_DIALER:
phone_show_dialer(phone, show);
break;
case PHONE_MESSAGE_SHOW_LOGS:
phone_show_logs(phone, show);
break;
case PHONE_MESSAGE_SHOW_MESSAGES:
phone_show_messages(phone, show,
MODEM_MESSAGE_FOLDER_INBOX);
break;
case PHONE_MESSAGE_SHOW_SETTINGS:
phone_show_settings(phone, show);
break;
case PHONE_MESSAGE_SHOW_WRITE:
phone_show_write(phone, show, NULL, NULL);
break;
}
return GDK_FILTER_CONTINUE;
}
/* calls */
/* on_phone_call_answer */
void on_phone_call_answer(gpointer data)

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Phone */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,8 +23,6 @@
/* callbacks */
gboolean on_phone_closex(gpointer data);
GdkFilterReturn on_phone_filter(GdkXEvent * xevent, GdkEvent * event,
gpointer data);
/* calls */
void on_phone_call_answer(gpointer data);

View File

@ -1,6 +1,6 @@
/* $Id$ */
static char _copyright[] =
"Copyright (c) 2011 DeforaOS Project <contact@defora.org>";
"Copyright (c) 2012 DeforaOS Project <contact@defora.org>";
/* This file is part of DeforaOS Desktop Phone */
static char const _license[] =
"This program is free software: you can redistribute it and/or modify\n"
@ -342,6 +342,8 @@ static int _phone_unload(Phone * phone, PhonePlugin * plugin);
static void _phone_modem_event(void * priv, ModemEvent * event);
static void _phone_modem_event_authentication(GtkWidget * widget, gint response,
gpointer data);
static int _phone_on_message(void * data, uint32_t value1, uint32_t value2,
uint32_t value3);
static gboolean _phone_timeout_track(gpointer data);
@ -452,6 +454,8 @@ Phone * phone_new(char const * plugin, int retry)
phone_delete(phone);
return NULL;
}
desktop_message_register(PHONE_CLIENT_MESSAGE, _phone_on_message,
phone);
phone->source = g_idle_add(_new_idle, phone);
modem_set_callback(phone->modem, _phone_modem_event, phone);
return phone;
@ -1781,11 +1785,6 @@ static void _show_dialer_window(Phone * phone)
gtk_window_set_title(GTK_WINDOW(phone->di_window), _("Dialer"));
g_signal_connect(phone->di_window, "delete-event", G_CALLBACK(
on_phone_closex), NULL);
#if !GTK_CHECK_VERSION(3, 0, 0)
gdk_display_add_client_message_filter(gdk_display_get_default(),
gdk_atom_intern(PHONE_CLIENT_MESSAGE, FALSE),
on_phone_filter, phone);
#endif
vbox = gtk_vbox_new(FALSE, 4);
/* entry */
hbox = gtk_hbox_new(FALSE, 4);
@ -4061,6 +4060,74 @@ static void _phone_modem_event_authentication(GtkWidget * widget, gint response,
}
/* phone_on_message */
static int _message_power_management(Phone * phone,
PhoneMessagePowerManagement what);
static int _message_show(Phone * phone, PhoneMessageShow what, gboolean show);
static int _phone_on_message(void * data, uint32_t value1, uint32_t value2,
uint32_t value3)
{
Phone * phone = data;
PhoneMessage message;
message = value1;
switch(message)
{
case PHONE_MESSAGE_POWER_MANAGEMENT:
return _message_power_management(phone, value2);
case PHONE_MESSAGE_SHOW:
return _message_show(phone, value2, value3);
}
return GDK_FILTER_CONTINUE;
}
static int _message_power_management(Phone * phone,
PhoneMessagePowerManagement what)
{
switch(what)
{
case PHONE_MESSAGE_POWER_MANAGEMENT_RESUME:
phone_event_type(phone, PHONE_EVENT_TYPE_RESUME);
break;
case PHONE_MESSAGE_POWER_MANAGEMENT_SUSPEND:
phone_event_type(phone, PHONE_EVENT_TYPE_SUSPEND);
break;
}
return 0;
}
static int _message_show(Phone * phone, PhoneMessageShow what, gboolean show)
{
switch(what)
{
case PHONE_MESSAGE_SHOW_ABOUT:
phone_show_about(phone, show);
break;
case PHONE_MESSAGE_SHOW_CONTACTS:
phone_show_contacts(phone, show);
break;
case PHONE_MESSAGE_SHOW_DIALER:
phone_show_dialer(phone, show);
break;
case PHONE_MESSAGE_SHOW_LOGS:
phone_show_logs(phone, show);
break;
case PHONE_MESSAGE_SHOW_MESSAGES:
phone_show_messages(phone, show,
MODEM_MESSAGE_FOLDER_INBOX);
break;
case PHONE_MESSAGE_SHOW_SETTINGS:
phone_show_settings(phone, show);
break;
case PHONE_MESSAGE_SHOW_WRITE:
phone_show_write(phone, show, NULL, NULL);
break;
}
return 0;
}
/* phone_timeout_track */
static gboolean _phone_timeout_track(gpointer data)
{