diff --git a/include/Phone/phone.h b/include/Phone/phone.h index ac2a684..c99d6cb 100644 --- a/include/Phone/phone.h +++ b/include/Phone/phone.h @@ -106,7 +106,8 @@ typedef enum _PhoneMessageShow PHONE_MESSAGE_SHOW_DIALER, PHONE_MESSAGE_SHOW_LOGS, PHONE_MESSAGE_SHOW_MESSAGES, - PHONE_MESSAGE_SHOW_SETTINGS + PHONE_MESSAGE_SHOW_SETTINGS, + PHONE_MESSAGE_SHOW_WRITE } PhoneMessageShow; diff --git a/po/fr.po b/po/fr.po index a918a42..01d1d96 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-21 00:40+0200\n" +"POT-Creation-Date: 2011-08-21 01:15+0200\n" "PO-Revision-Date: 2010-04-24 02:07+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: DeforaOS development (French) \n" @@ -283,45 +283,45 @@ msgstr "Question" msgid "Error" msgstr "Erreur" -#: ../src/phone.c:3454 +#: ../src/phone.c:3456 msgid "Name: " msgstr "Nom: " -#: ../src/phone.c:3463 +#: ../src/phone.c:3465 msgid "Number: " msgstr "Numéro: " -#: ../src/phone.c:3479 +#: ../src/phone.c:3481 msgid "New contact" msgstr "Nouveau contact" -#: ../src/phone.c:3481 +#: ../src/phone.c:3483 msgid "Edit contact: " msgstr "Modifier contact: " -#: ../src/phone.c:3508 +#: ../src/phone.c:3510 msgid "The name cannot be empty" msgstr "Le nom ne peut être vide" -#: ../src/phone.c:3513 +#: ../src/phone.c:3515 msgid "The number cannot be empty" msgstr "Le numéro ne peut être vide" -#: ../src/phone.c:3644 +#: ../src/phone.c:3646 msgid "Message sent" msgstr "Message envoyé" -#: ../src/phone.c:3680 +#: ../src/phone.c:3682 #, c-format msgid "Wrong %s" msgstr "Mauvais %s" -#: ../src/phone.c:3687 +#: ../src/phone.c:3689 #, c-format msgid "%s is valid" msgstr "%s valide" -#: ../src/phone.c:3750 +#: ../src/phone.c:3752 msgid "Raw data (not shown)" msgstr "Données brutes (non affichées)" @@ -332,6 +332,7 @@ msgid "" " phonectl -L\n" " phonectl -M\n" " phonectl -S\n" +" phonectl -W\n" " phonectl -r\n" " phonectl -s\n" " -C\tOpen the contacts window\n" @@ -348,6 +349,7 @@ msgstr "" " phonectl -L\n" " phonectl -M\n" " phonectl -S\n" +" phonectl -W\n" " phonectl -r\n" " phonectl -s\n" " -C\tAfficher les contacts\n" diff --git a/src/callbacks.c b/src/callbacks.c index 77aaf47..b553f80 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -105,6 +105,9 @@ static GdkFilterReturn _filter_message_show(Phone * phone, 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; } diff --git a/src/phone.c b/src/phone.c index 99fda5c..adf3304 100644 --- a/src/phone.c +++ b/src/phone.c @@ -3292,6 +3292,8 @@ static void _phone_message(Phone * phone, PhoneMessage message, ...) phone_show_messages(phone, TRUE); else if(show == PHONE_MESSAGE_SHOW_SETTINGS) phone_show_settings(phone, TRUE); + else if(show == PHONE_MESSAGE_SHOW_WRITE) + phone_show_write(phone, TRUE, NULL, NULL); break; } va_end(ap); diff --git a/src/phonectl.c b/src/phonectl.c index 147315e..095835a 100644 --- a/src/phonectl.c +++ b/src/phonectl.c @@ -46,6 +46,7 @@ static int _usage(void) " phonectl -L\n" " phonectl -M\n" " phonectl -S\n" +" phonectl -W\n" " phonectl -r\n" " phonectl -s\n" " -C Open the contacts window\n" @@ -73,7 +74,7 @@ int main(int argc, char * argv[]) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); gtk_init(&argc, &argv); - while((o = getopt(argc, argv, "CDLMSrs")) != -1) + while((o = getopt(argc, argv, "CDLMSWrs")) != -1) switch(o) { case 'C': @@ -101,6 +102,11 @@ int main(int argc, char * argv[]) return _usage(); action = PHONE_MESSAGE_SHOW_SETTINGS; break; + case 'W': + if(action != -1) + return _usage(); + action = PHONE_MESSAGE_SHOW_WRITE; + break; case 'r': if(action != -1) return _usage(); diff --git a/src/plugins/systray.c b/src/plugins/systray.c index 1a60bfc..bc59817 100644 --- a/src/plugins/systray.c +++ b/src/plugins/systray.c @@ -151,10 +151,12 @@ static gboolean _activate_on_closex(gpointer data) /* systray_on_popup_menu */ +static void _popup_menu_on_show_contacts(gpointer data); static void _popup_menu_on_show_dialer(gpointer data); static void _popup_menu_on_show_logs(gpointer data); static void _popup_menu_on_show_messages(gpointer data); static void _popup_menu_on_show_settings(gpointer data); +static void _popup_menu_on_show_write(gpointer data); static void _popup_menu_on_resume(gpointer data); static void _popup_menu_on_suspend(gpointer data); @@ -164,40 +166,66 @@ static void _systray_on_popup_menu(GtkStatusIcon * icon, guint button, PhonePlugin * plugin = data; GtkWidget * menu; GtkWidget * menuitem; + GtkWidget * hbox; + GtkWidget * label; + struct + { + char const * icon; + char const * name; + void (*callback)(gpointer data); + } items[] = { + { "stock_addressbook", "Show _contacts", + _popup_menu_on_show_contacts }, + { "phone-dialer", "Show _dialer", _popup_menu_on_show_dialer }, + { "logviewer", "Show _logs", _popup_menu_on_show_logs }, + { "stock_mail-compose", "Show _messages", + _popup_menu_on_show_messages }, + { "gtk-preferences", "Show _settings", + _popup_menu_on_show_settings }, + { "stock_mail-compose", "_Write a message", + _popup_menu_on_show_write }, + { NULL, NULL, NULL }, + { "gtk-media-play-ltr", "_Resume telephony", + _popup_menu_on_resume }, + { "gtk-media-pause", "S_uspend telephony", + _popup_menu_on_suspend }, + }; + size_t i; menu = gtk_menu_new(); - /* show windows */ - menuitem = gtk_menu_item_new_with_mnemonic("Show _dialer"); - g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( - _popup_menu_on_show_dialer), plugin); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_menu_item_new_with_mnemonic("Show _logs"); - g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( - _popup_menu_on_show_logs), plugin); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_menu_item_new_with_mnemonic("Show _messages"); - g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( - _popup_menu_on_show_messages), plugin); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_menu_item_new_with_mnemonic("Show _settings"); - g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( - _popup_menu_on_show_settings), plugin); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - /* suspend and resume */ - menuitem = gtk_separator_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_menu_item_new_with_mnemonic("_Resume telephony"); - g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( - _popup_menu_on_resume), plugin); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - menuitem = gtk_menu_item_new_with_mnemonic("S_uspend telephony"); - g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( - _popup_menu_on_suspend), plugin); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + for(i = 0; i < sizeof(items) / sizeof(*items); i++) + { + if(items[i].name == NULL) + { + menuitem = gtk_separator_menu_item_new(); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + continue; + } + hbox = gtk_hbox_new(FALSE, 4); + gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_icon_name( + items[i].icon, GTK_ICON_SIZE_MENU), + FALSE, FALSE, 0); + label = gtk_label_new_with_mnemonic(items[i].name); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); + menuitem = gtk_menu_item_new(); + g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( + items[i].callback), plugin); + gtk_container_add(GTK_CONTAINER(menuitem), hbox); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + } gtk_widget_show_all(menu); gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, time); } +static void _popup_menu_on_show_contacts(gpointer data) +{ + PhonePlugin * plugin = data; + + plugin->helper->message(plugin->helper->phone, PHONE_MESSAGE_SHOW, + PHONE_MESSAGE_SHOW_CONTACTS); +} + static void _popup_menu_on_show_dialer(gpointer data) { PhonePlugin * plugin = data; @@ -230,6 +258,14 @@ static void _popup_menu_on_show_settings(gpointer data) PHONE_MESSAGE_SHOW_SETTINGS); } +static void _popup_menu_on_show_write(gpointer data) +{ + PhonePlugin * plugin = data; + + plugin->helper->message(plugin->helper->phone, PHONE_MESSAGE_SHOW, + PHONE_MESSAGE_SHOW_WRITE); +} + static void _popup_menu_on_resume(gpointer data) { PhonePlugin * plugin = data;