Extended internal messages to open the composition window

This commit is contained in:
Pierre Pronchery 2011-08-20 23:17:40 +00:00
parent 236c68bd13
commit cef05cca05
6 changed files with 91 additions and 41 deletions

View File

@ -106,7 +106,8 @@ typedef enum _PhoneMessageShow
PHONE_MESSAGE_SHOW_DIALER, PHONE_MESSAGE_SHOW_DIALER,
PHONE_MESSAGE_SHOW_LOGS, PHONE_MESSAGE_SHOW_LOGS,
PHONE_MESSAGE_SHOW_MESSAGES, PHONE_MESSAGE_SHOW_MESSAGES,
PHONE_MESSAGE_SHOW_SETTINGS PHONE_MESSAGE_SHOW_SETTINGS,
PHONE_MESSAGE_SHOW_WRITE
} PhoneMessageShow; } PhoneMessageShow;

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Phone 0.0.0\n" "Project-Id-Version: Phone 0.0.0\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: 2010-04-24 02:07+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n" "Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: DeforaOS development (French) <devel-fr@lists.defora.org>\n" "Language-Team: DeforaOS development (French) <devel-fr@lists.defora.org>\n"
@ -283,45 +283,45 @@ msgstr "Question"
msgid "Error" msgid "Error"
msgstr "Erreur" msgstr "Erreur"
#: ../src/phone.c:3454 #: ../src/phone.c:3456
msgid "Name: " msgid "Name: "
msgstr "Nom: " msgstr "Nom: "
#: ../src/phone.c:3463 #: ../src/phone.c:3465
msgid "Number: " msgid "Number: "
msgstr "Numéro: " msgstr "Numéro: "
#: ../src/phone.c:3479 #: ../src/phone.c:3481
msgid "New contact" msgid "New contact"
msgstr "Nouveau contact" msgstr "Nouveau contact"
#: ../src/phone.c:3481 #: ../src/phone.c:3483
msgid "Edit contact: " msgid "Edit contact: "
msgstr "Modifier contact: " msgstr "Modifier contact: "
#: ../src/phone.c:3508 #: ../src/phone.c:3510
msgid "The name cannot be empty" msgid "The name cannot be empty"
msgstr "Le nom ne peut être vide" msgstr "Le nom ne peut être vide"
#: ../src/phone.c:3513 #: ../src/phone.c:3515
msgid "The number cannot be empty" msgid "The number cannot be empty"
msgstr "Le numéro ne peut être vide" msgstr "Le numéro ne peut être vide"
#: ../src/phone.c:3644 #: ../src/phone.c:3646
msgid "Message sent" msgid "Message sent"
msgstr "Message envoyé" msgstr "Message envoyé"
#: ../src/phone.c:3680 #: ../src/phone.c:3682
#, c-format #, c-format
msgid "Wrong %s" msgid "Wrong %s"
msgstr "Mauvais %s" msgstr "Mauvais %s"
#: ../src/phone.c:3687 #: ../src/phone.c:3689
#, c-format #, c-format
msgid "%s is valid" msgid "%s is valid"
msgstr "%s valide" msgstr "%s valide"
#: ../src/phone.c:3750 #: ../src/phone.c:3752
msgid "Raw data (not shown)" msgid "Raw data (not shown)"
msgstr "Données brutes (non affichées)" msgstr "Données brutes (non affichées)"
@ -332,6 +332,7 @@ msgid ""
" phonectl -L\n" " phonectl -L\n"
" phonectl -M\n" " phonectl -M\n"
" phonectl -S\n" " phonectl -S\n"
" phonectl -W\n"
" phonectl -r\n" " phonectl -r\n"
" phonectl -s\n" " phonectl -s\n"
" -C\tOpen the contacts window\n" " -C\tOpen the contacts window\n"
@ -348,6 +349,7 @@ msgstr ""
" phonectl -L\n" " phonectl -L\n"
" phonectl -M\n" " phonectl -M\n"
" phonectl -S\n" " phonectl -S\n"
" phonectl -W\n"
" phonectl -r\n" " phonectl -r\n"
" phonectl -s\n" " phonectl -s\n"
" -C\tAfficher les contacts\n" " -C\tAfficher les contacts\n"

View File

@ -105,6 +105,9 @@ static GdkFilterReturn _filter_message_show(Phone * phone,
case PHONE_MESSAGE_SHOW_SETTINGS: case PHONE_MESSAGE_SHOW_SETTINGS:
phone_show_settings(phone, show); phone_show_settings(phone, show);
break; break;
case PHONE_MESSAGE_SHOW_WRITE:
phone_show_write(phone, show, NULL, NULL);
break;
} }
return GDK_FILTER_CONTINUE; return GDK_FILTER_CONTINUE;
} }

View File

@ -3292,6 +3292,8 @@ static void _phone_message(Phone * phone, PhoneMessage message, ...)
phone_show_messages(phone, TRUE); phone_show_messages(phone, TRUE);
else if(show == PHONE_MESSAGE_SHOW_SETTINGS) else if(show == PHONE_MESSAGE_SHOW_SETTINGS)
phone_show_settings(phone, TRUE); phone_show_settings(phone, TRUE);
else if(show == PHONE_MESSAGE_SHOW_WRITE)
phone_show_write(phone, TRUE, NULL, NULL);
break; break;
} }
va_end(ap); va_end(ap);

View File

@ -46,6 +46,7 @@ static int _usage(void)
" phonectl -L\n" " phonectl -L\n"
" phonectl -M\n" " phonectl -M\n"
" phonectl -S\n" " phonectl -S\n"
" phonectl -W\n"
" phonectl -r\n" " phonectl -r\n"
" phonectl -s\n" " phonectl -s\n"
" -C Open the contacts window\n" " -C Open the contacts window\n"
@ -73,7 +74,7 @@ int main(int argc, char * argv[])
bindtextdomain(PACKAGE, LOCALEDIR); bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE); textdomain(PACKAGE);
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
while((o = getopt(argc, argv, "CDLMSrs")) != -1) while((o = getopt(argc, argv, "CDLMSWrs")) != -1)
switch(o) switch(o)
{ {
case 'C': case 'C':
@ -101,6 +102,11 @@ int main(int argc, char * argv[])
return _usage(); return _usage();
action = PHONE_MESSAGE_SHOW_SETTINGS; action = PHONE_MESSAGE_SHOW_SETTINGS;
break; break;
case 'W':
if(action != -1)
return _usage();
action = PHONE_MESSAGE_SHOW_WRITE;
break;
case 'r': case 'r':
if(action != -1) if(action != -1)
return _usage(); return _usage();

View File

@ -151,10 +151,12 @@ static gboolean _activate_on_closex(gpointer data)
/* systray_on_popup_menu */ /* 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_dialer(gpointer data);
static void _popup_menu_on_show_logs(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_messages(gpointer data);
static void _popup_menu_on_show_settings(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_resume(gpointer data);
static void _popup_menu_on_suspend(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; PhonePlugin * plugin = data;
GtkWidget * menu; GtkWidget * menu;
GtkWidget * menuitem; 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(); menu = gtk_menu_new();
/* show windows */ for(i = 0; i < sizeof(items) / sizeof(*items); i++)
menuitem = gtk_menu_item_new_with_mnemonic("Show _dialer"); {
g_signal_connect_swapped(menuitem, "activate", G_CALLBACK( if(items[i].name == NULL)
_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(); menuitem = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
menuitem = gtk_menu_item_new_with_mnemonic("_Resume telephony"); 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( g_signal_connect_swapped(menuitem, "activate", G_CALLBACK(
_popup_menu_on_resume), plugin); items[i].callback), plugin);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); gtk_container_add(GTK_CONTAINER(menuitem), hbox);
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); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
}
gtk_widget_show_all(menu); gtk_widget_show_all(menu);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, time); 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) static void _popup_menu_on_show_dialer(gpointer data)
{ {
PhonePlugin * plugin = data; PhonePlugin * plugin = data;
@ -230,6 +258,14 @@ static void _popup_menu_on_show_settings(gpointer data)
PHONE_MESSAGE_SHOW_SETTINGS); 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) static void _popup_menu_on_resume(gpointer data)
{ {
PhonePlugin * plugin = data; PhonePlugin * plugin = data;