From: Colin Leroy Date: Tue, 29 Jul 2008 05:39:21 +0000 (+0000) Subject: 2008-07-29 [colin] 3.5.0cvs36 X-Git-Tag: rel_3_6_0~121 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=af22661c5ea80bbbd17b2752a8f904811de38a74 2008-07-29 [colin] 3.5.0cvs36 * src/action.c * src/action.h * src/addressbook.c * src/addressitem.h * src/compose.c * src/compose.h * src/messageview.c * src/messageview.h * src/summaryview.c * src/gtk/menu.c * src/gtk/menu.h More switches to GtkUIManager --- diff --git a/ChangeLog b/ChangeLog index a60f2995b..7d64f3dcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-07-29 [colin] 3.5.0cvs36 + + * src/action.c + * src/action.h + * src/addressbook.c + * src/addressitem.h + * src/compose.c + * src/compose.h + * src/messageview.c + * src/messageview.h + * src/summaryview.c + * src/gtk/menu.c + * src/gtk/menu.h + More switches to GtkUIManager + 2008-07-26 [colin] 3.5.0cvs35 * src/gtk/menu.c diff --git a/PATCHSETS b/PATCHSETS index 6ebb64392..82829297d 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -3447,3 +3447,4 @@ ( cvs diff -u -r 1.4.2.13 -r 1.4.2.14 src/gtk/menu.h; ) > 3.5.0cvs33.patchset ( cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/addrcustomattr.c; cvs diff -u -r 1.60.2.119 -r 1.60.2.120 src/addressbook.c; cvs diff -u -r 1.382.2.457 -r 1.382.2.458 src/compose.c; cvs diff -u -r 1.14.2.50 -r 1.14.2.51 src/editaddress.c; cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/editaddress_other_attributes_ldap.h; cvs diff -u -r 1.1.2.17 -r 1.1.2.18 src/edittags.c; cvs diff -u -r 1.274.2.256 -r 1.274.2.257 src/mainwindow.c; cvs diff -u -r 1.83.2.136 -r 1.83.2.137 src/mimeview.c; cvs diff -u -r 1.60.2.59 -r 1.60.2.60 src/prefs_actions.c; cvs diff -u -r 1.59.2.70 -r 1.59.2.71 src/prefs_filtering.c; cvs diff -u -r 1.12.2.64 -r 1.12.2.65 src/prefs_template.c; cvs diff -u -r 1.395.2.375 -r 1.395.2.376 src/summaryview.c; cvs diff -u -r 1.96.2.202 -r 1.96.2.203 src/textview.c; cvs diff -u -r 1.12.2.22 -r 1.12.2.23 src/textview.h; cvs diff -u -r 1.43.2.102 -r 1.43.2.103 src/toolbar.c; cvs diff -u -r 1.4.2.64 -r 1.4.2.65 src/gtk/about.c; cvs diff -u -r 1.5.2.29 -r 1.5.2.30 src/gtk/menu.c; cvs diff -u -r 1.4.2.14 -r 1.4.2.15 src/gtk/menu.h; cvs diff -u -r 1.14.2.64 -r 1.14.2.65 src/plugins/trayicon/trayicon.c; ) > 3.5.0cvs34.patchset ( cvs diff -u -r 1.5.2.30 -r 1.5.2.31 src/gtk/menu.c; cvs diff -u -r 1.4.2.15 -r 1.4.2.16 src/gtk/menu.h; ) > 3.5.0cvs35.patchset +( cvs diff -u -r 1.12.2.50 -r 1.12.2.51 src/action.c; cvs diff -u -r 1.3.2.8 -r 1.3.2.9 src/action.h; cvs diff -u -r 1.60.2.120 -r 1.60.2.121 src/addressbook.c; cvs diff -u -r 1.5.2.8 -r 1.5.2.9 src/addressitem.h; cvs diff -u -r 1.382.2.458 -r 1.382.2.459 src/compose.c; cvs diff -u -r 1.50.2.47 -r 1.50.2.48 src/compose.h; cvs diff -u -r 1.94.2.181 -r 1.94.2.182 src/messageview.c; cvs diff -u -r 1.19.2.19 -r 1.19.2.20 src/messageview.h; cvs diff -u -r 1.395.2.376 -r 1.395.2.377 src/summaryview.c; cvs diff -u -r 1.5.2.31 -r 1.5.2.32 src/gtk/menu.c; cvs diff -u -r 1.4.2.16 -r 1.4.2.17 src/gtk/menu.h; ) > 3.5.0cvs36.patchset diff --git a/configure.ac b/configure.ac index fa1e32cc2..85b79d3a9 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=5 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=35 +EXTRA_VERSION=36 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/action.c b/src/action.c index 562b516ca..28e8a58e4 100644 --- a/src/action.c +++ b/src/action.c @@ -107,18 +107,27 @@ struct _ChildInfo }; static void action_update_menu (GtkItemFactory *ifactory, + GtkUIManager *ui_manager, + const gchar *accel_group, gchar *branch_path, gpointer callback, gpointer data); -static void compose_actions_execute_cb (Compose *compose, +static void compose_actions_execute_cb (GtkWidget *widget, + gpointer data); +static void compose_actions_execute (Compose *compose, guint action_nb, - GtkWidget *widget); + GtkWidget *widget); + static void mainwin_actions_execute_cb (MainWindow *mainwin, guint action_nb, GtkWidget *widget); -static void msgview_actions_execute_cb (MessageView *msgview, + +static void msgview_actions_execute_cb (GtkWidget *widget, + gpointer data); +static void msgview_actions_execute (MessageView *msgview, guint action_nb, - GtkWidget *widget); + GtkWidget *widget); + static void message_actions_execute (MessageView *msgview, guint action_nb, GSList *msg_list); @@ -428,36 +437,80 @@ void actions_execute(gpointer data, if (source == TOOLBAR_MAIN) mainwin_actions_execute_cb((MainWindow*)data, action_nb, widget); else if (source == TOOLBAR_COMPOSE) - compose_actions_execute_cb((Compose*)data, action_nb, widget); + compose_actions_execute((Compose*)data, action_nb, widget); else if (source == TOOLBAR_MSGVIEW) - msgview_actions_execute_cb((MessageView*)data, action_nb, widget); + msgview_actions_execute((MessageView*)data, action_nb, widget); } void action_update_mainwin_menu(GtkItemFactory *ifactory, gchar *branch_path, MainWindow *mainwin) { - action_update_menu(ifactory, branch_path, + action_update_menu(ifactory, NULL, "", branch_path, mainwin_actions_execute_cb, mainwin); } -void action_update_msgview_menu(GtkItemFactory *ifactory, +void action_update_msgview_menu(GtkUIManager *ui_manager, gchar *branch_path, MessageView *msgview) { - action_update_menu(ifactory, branch_path, + action_update_menu(NULL, ui_manager, "", branch_path, msgview_actions_execute_cb, msgview); } -void action_update_compose_menu(GtkItemFactory *ifactory, +void action_update_compose_menu(GtkUIManager *ui_manager, gchar *branch_path, Compose *compose) { - action_update_menu(ifactory, branch_path, + action_update_menu(NULL, ui_manager, "", branch_path, compose_actions_execute_cb, compose); } -static void action_update_menu(GtkItemFactory *ifactory, +static GtkWidget *find_item_in_menu(GtkWidget *menu, gchar *name) +{ + GList *amenu = GTK_MENU_SHELL(menu)->children; + const gchar *existing_name; + while (amenu) { + GtkWidget *item = GTK_WIDGET(amenu->data); + if ((existing_name = g_object_get_data(G_OBJECT(item), "s_name")) != NULL && + !strcmp2(name, existing_name)) + return item; + amenu = amenu->next; + } + return NULL; +} + +static GtkWidget *create_submenus(GtkWidget *menu, const gchar *action) +{ + gchar *submenu = g_strdup(action); + GtkWidget *new_menu = NULL; + + if (strchr(submenu, '/')) { + const gchar *end = (strchr(submenu, '/')+1); + GtkWidget *menu_item = NULL; + if (end && *end) { + *strchr(submenu, '/') = '\0'; + if ((menu_item = find_item_in_menu(menu, submenu)) == NULL) { + menu_item = gtk_menu_item_new_with_mnemonic(submenu); + g_object_set_data_full(G_OBJECT(menu_item), "s_name", g_strdup(submenu), g_free); + gtk_widget_show(menu_item); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + new_menu = gtk_menu_new(); + gtk_widget_show(new_menu); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), new_menu); + } else { + new_menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menu_item)); + } + new_menu = create_submenus(new_menu, end); + } + } + g_free(submenu); + return new_menu ? new_menu : menu; +} + +static void action_update_menu(GtkItemFactory *ifactory, + GtkUIManager *ui_manager, + const gchar *accel_group, gchar *branch_path, gpointer callback, gpointer data) { @@ -467,44 +520,91 @@ static void action_update_menu(GtkItemFactory *ifactory, gchar *action, *action_p; GList *amenu; GtkItemFactoryEntry ifentry = {NULL, NULL, NULL, 0, ""}; + int callback_action = 0; + + if (ifactory) { + ifentry.path = branch_path; + menuitem = gtk_item_factory_get_widget(ifactory, branch_path); + ifentry.accelerator = NULL; + ifentry.callback_action = 0; + ifentry.callback = callback; + ifentry.item_type = NULL; + g_return_if_fail(menuitem != NULL); + amenu = GTK_MENU_SHELL(menuitem)->children; + while (amenu != NULL) { + GList *alist = amenu->next; + gtk_widget_destroy(GTK_WIDGET(amenu->data)); + amenu = alist; + } - ifentry.path = branch_path; - menuitem = gtk_item_factory_get_widget(ifactory, branch_path); - g_return_if_fail(menuitem != NULL); - - amenu = GTK_MENU_SHELL(menuitem)->children; - while (amenu != NULL) { - GList *alist = amenu->next; - gtk_widget_destroy(GTK_WIDGET(amenu->data)); - amenu = alist; - } + for (cur = prefs_common.actions_list; cur; cur = cur->next) { + action = g_strdup((gchar *)cur->data); + action_p = strstr(action, ": "); + if (action_p && action_p[2] && + (action_get_type(&action_p[2]) != ACTION_ERROR) && + (action[0] != '/')) { + action_p[0] = '\0'; + menu_path = g_strdup_printf("%s/%s", branch_path, + action); + ifentry.path = menu_path; + gtk_item_factory_create_item(ifactory, &ifentry, data, + 1); + g_free(menu_path); + } + g_free(action); + ifentry.callback_action++; + } + } else { + GtkWidget *menu = gtk_menu_new(); + GtkWidget *item; + for (cur = prefs_common.actions_list; cur != NULL; cur = cur->next) { + GtkWidget *cur_menu = menu; + const gchar *action_name = NULL; + action = g_strdup((gchar *)cur->data); + action_p = strstr(action, ": "); + if (action_p && action_p[2] && + (action_get_type(&action_p[2]) != ACTION_ERROR) && + (action[0] != '/')) { + gchar *accel_path = NULL; + + action_p[0] = '\0'; + if (strchr(action, '/')) { + cur_menu = create_submenus(cur_menu, action); + action_name = strrchr(action, '/')+1; + } else { + action_name = action; + } + gtk_menu_set_accel_group (GTK_MENU (cur_menu), + gtk_ui_manager_get_accel_group(ui_manager)); + item = gtk_menu_item_new_with_label(action_name); + gtk_menu_shell_append(GTK_MENU_SHELL(cur_menu), item); + g_signal_connect(G_OBJECT(item), "activate", + G_CALLBACK(callback), data); + g_object_set_data(G_OBJECT(item), "action_num", GINT_TO_POINTER(callback_action)); + gtk_widget_show(item); + accel_path = g_strconcat(accel_group,branch_path, "/", action, NULL); + gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path); + g_free(accel_path); - ifentry.accelerator = NULL; - ifentry.callback_action = 0; - ifentry.callback = callback; - ifentry.item_type = NULL; - - for (cur = prefs_common.actions_list; cur; cur = cur->next) { - action = g_strdup((gchar *)cur->data); - action_p = strstr(action, ": "); - if (action_p && action_p[2] && - (action_get_type(&action_p[2]) != ACTION_ERROR) && - (action[0] != '/')) { - action_p[0] = '\0'; - menu_path = g_strdup_printf("%s/%s", branch_path, - action); - ifentry.path = menu_path; - gtk_item_factory_create_item(ifactory, &ifentry, data, - 1); - g_free(menu_path); + } + g_free(action); + callback_action++; } - g_free(action); - ifentry.callback_action++; + + gtk_widget_show(menu); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(gtk_ui_manager_get_widget(ui_manager, branch_path)), menu); + } } -static void compose_actions_execute_cb(Compose *compose, guint action_nb, - GtkWidget *widget) +static void compose_actions_execute_cb(GtkWidget *widget, gpointer data) +{ + Compose *compose = (Compose *)data; + gint action_nb = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "action_num")); + compose_actions_execute(compose, action_nb, NULL); +} + +static void compose_actions_execute(Compose *compose, guint action_nb, GtkWidget *widget) { gchar *buf, *action; ActionType action_type; @@ -541,7 +641,14 @@ static void mainwin_actions_execute_cb(MainWindow *mainwin, guint action_nb, g_slist_free(msg_list); } -static void msgview_actions_execute_cb(MessageView *msgview, guint action_nb, +static void msgview_actions_execute_cb(GtkWidget *widget, gpointer data) +{ + MessageView *msgview = (MessageView *)data; + gint action_nb = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "action_num")); + msgview_actions_execute(msgview, action_nb, NULL); +} + +static void msgview_actions_execute(MessageView *msgview, guint action_nb, GtkWidget *widget) { GSList *msg_list = NULL; diff --git a/src/action.h b/src/action.h index f86a23584..0eeb3d6f1 100644 --- a/src/action.h +++ b/src/action.h @@ -55,10 +55,10 @@ void actions_execute (gpointer data, void action_update_mainwin_menu (GtkItemFactory *ifactory, gchar *branch_path, MainWindow *mainwin); -void action_update_msgview_menu (GtkItemFactory *ifactory, +void action_update_msgview_menu (GtkUIManager *ui_manager, gchar *branch_path, MessageView *msgview); -void action_update_compose_menu (GtkItemFactory *ifactory, +void action_update_compose_menu (GtkUIManager *ui_manager, gchar *branch_path, Compose *compose); diff --git a/src/addressbook.c b/src/addressbook.c index 0262d18f0..c652e8167 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -232,57 +232,44 @@ static gboolean addressbook_tree_button_released(GtkWidget *ctree, GdkEventButton *event, gpointer data); -static void addressbook_new_folder_cb (gpointer data, - guint action, - GtkWidget *widget); -static void addressbook_new_group_cb (gpointer data, - guint action, - GtkWidget *widget); -static void addressbook_treenode_edit_cb (gpointer data, - guint action, - GtkWidget *widget); -static void addressbook_treenode_delete_cb (gpointer data, - guint action, - GtkWidget *widget); +static void addressbook_new_folder_cb (GtkAction *action, + gpointer data); +static void addressbook_new_group_cb (GtkAction *action, + gpointer data); +static void addressbook_treenode_edit_cb (GtkAction *action, + gpointer data); +static void addressbook_treenode_delete_cb (GtkAction *action, + gpointer data); static void addressbook_change_node_name (GtkCTreeNode *node, const gchar *name); -static void addressbook_new_address_cb (gpointer data, - guint action, - GtkWidget *widget); -static void addressbook_edit_address_cb (gpointer data, - guint action, - GtkWidget *widget); -static void addressbook_delete_address_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void close_cb (gpointer data, - guint action, - GtkWidget *widget); -static void addressbook_file_save_cb (gpointer data, - guint action, - GtkWidget *widget); +static void addressbook_new_address_cb (GtkAction *action, + gpointer data); +static void addressbook_edit_address_cb (GtkAction *action, + gpointer data); +static void addressbook_delete_address_cb (GtkAction *action, + gpointer data); + +static void close_cb (GtkAction *action, + gpointer data); +static void addressbook_file_save_cb (GtkAction *action, + gpointer data); /* Data source edit stuff */ -static void addressbook_new_book_cb (gpointer data, - guint action, - GtkWidget *widget); -static void addressbook_new_vcard_cb (gpointer data, - guint action, - GtkWidget *widget); +static void addressbook_new_book_cb (GtkAction *action, + gpointer data); +static void addressbook_new_vcard_cb (GtkAction *action, + gpointer data); #ifdef USE_JPILOT -static void addressbook_new_jpilot_cb (gpointer data, - guint action, - GtkWidget *widget); +static void addressbook_new_jpilot_cb (GtkAction *action, + gpointer data); #endif #ifdef USE_LDAP -static void addressbook_new_ldap_cb (gpointer data, - guint action, - GtkWidget *widget); +static void addressbook_new_ldap_cb (GtkAction *action, + gpointer data); #endif static void addressbook_set_clist (AddressObject *obj, @@ -354,25 +341,25 @@ static void addressbook_list_select_add ( AddrItemObject *aio, AddressDataSource *ds ); static void addressbook_list_select_remove ( AddrItemObject *aio ); -static void addressbook_import_ldif_cb ( void ); -static void addressbook_find_duplicates_cb ( void ); -static void addressbook_edit_custom_attr_cb ( void ); -static void addressbook_import_mutt_cb ( void ); -static void addressbook_import_pine_cb ( void ); -static void addressbook_export_html_cb ( void ); -static void addressbook_export_ldif_cb ( void ); -static void addressbook_select_all_cb ( void ); -static void addressbook_clip_cut_cb ( void ); -static void addressbook_clip_copy_cb ( void ); -static void addressbook_clip_paste_cb ( void ); -static void addressbook_treenode_cut_cb ( void ); -static void addressbook_treenode_copy_cb ( void ); -static void addressbook_treenode_paste_cb ( void ); - -static void addressbook_mail_to_cb ( void ); +static void addressbook_import_ldif_cb ( GtkAction *action, gpointer data ); +static void addressbook_find_duplicates_cb ( GtkAction *action, gpointer data ); +static void addressbook_edit_custom_attr_cb ( GtkAction *action, gpointer data ); +static void addressbook_import_mutt_cb ( GtkAction *action, gpointer data ); +static void addressbook_import_pine_cb ( GtkAction *action, gpointer data ); +static void addressbook_export_html_cb ( GtkAction *action, gpointer data ); +static void addressbook_export_ldif_cb ( GtkAction *action, gpointer data ); +static void addressbook_select_all_cb ( GtkAction *action, gpointer data ); +static void addressbook_clip_cut_cb ( GtkAction *action, gpointer data ); +static void addressbook_clip_copy_cb ( GtkAction *action, gpointer data ); +static void addressbook_clip_paste_cb ( GtkAction *action, gpointer data ); +static void addressbook_treenode_cut_cb ( GtkAction *action, gpointer data ); +static void addressbook_treenode_copy_cb ( GtkAction *action, gpointer data ); +static void addressbook_treenode_paste_cb ( GtkAction *action, gpointer data ); + +static void addressbook_mail_to_cb ( GtkAction *action, gpointer data ); #ifdef USE_LDAP -static void addressbook_browse_entry_cb ( void ); +static void addressbook_browse_entry_cb ( GtkAction *action, gpointer data ); #endif static void addressbook_edit_clicked(GtkButton *button, gpointer data); @@ -412,86 +399,106 @@ static GtkTargetEntry addressbook_drag_types[] = static GtkTargetList *addressbook_target_list = NULL; +static void about_show_cb(GtkAction *action, gpointer data) +{ + about_show(); +} -static GtkItemFactoryEntry addressbook_entries[] = +static GtkActionEntry addressbook_entries[] = { - {N_("/_Book"), NULL, NULL, 0, "", NULL}, - {N_("/_Book/New _Book"), "B", addressbook_new_book_cb, 0, NULL, NULL}, - {N_("/_Book/New _Folder"), "R", addressbook_new_folder_cb, 0, NULL, NULL}, - {N_("/_Book/New _vCard"), "D", addressbook_new_vcard_cb, 0, NULL, NULL}, + {"Menu", NULL, "Menu" }, +/* menus */ + {"Book", NULL, N_("_Message") }, + {"Address", NULL, N_("_Edit") }, + {"Tools", NULL, N_("_Tools") }, + {"Help", NULL, N_("_Help") }, + +/* Book menu */ + {"Book/NewBook", NULL, N_("New _Book"), "B", NULL, G_CALLBACK(addressbook_new_book_cb) }, + {"Book/NewFolder", NULL, N_("New _Folder"), "R", NULL, G_CALLBACK(addressbook_new_folder_cb) }, + {"Book/NewVCard", NULL, N_("New _vCard"), "D", NULL, G_CALLBACK(addressbook_new_vcard_cb) }, + + #ifdef USE_JPILOT - {N_("/_Book/New _JPilot"), "J", addressbook_new_jpilot_cb, 0, NULL, NULL}, + {"Book/NewJPilot", NULL, N_("New _JPilot"), "J", NULL, G_CALLBACK(addressbook_new_jpilot_cb) }, #endif #ifdef USE_LDAP - {N_("/_Book/New LDAP _Server"), "S", addressbook_new_ldap_cb, 0, NULL, NULL}, + {"Book/NewLDAPServer", NULL, N_("New LDAP _Server"), "S", NULL, G_CALLBACK(addressbook_new_ldap_cb) }, #endif - {N_("/_Book/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Book/_Edit book"), NULL, addressbook_treenode_edit_cb, 0, NULL, NULL}, - {N_("/_Book/_Delete book"), NULL, addressbook_treenode_delete_cb, 0, NULL, NULL}, - {N_("/_Book/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Book/_Save"), "S", addressbook_file_save_cb, 0, NULL, NULL}, - {N_("/_Book/_Close"), "W", close_cb, 0, NULL, NULL}, - {N_("/_Address"), NULL, NULL, 0, "", NULL}, - {N_("/_Address/_Select all"), "A", addressbook_select_all_cb, 0, NULL, NULL}, - {N_("/_Address/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Address/C_ut"), "X", addressbook_clip_cut_cb, 0, NULL, NULL}, - {N_("/_Address/_Copy"), "C", addressbook_clip_copy_cb, 0, NULL, NULL}, - {N_("/_Address/_Paste"), "V", addressbook_clip_paste_cb, 0, NULL, NULL}, - {N_("/_Address/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Address/_Edit"), "Return",addressbook_edit_address_cb, 0, NULL, NULL}, - {N_("/_Address/_Delete"), "D", addressbook_delete_address_cb, 0, NULL, NULL}, - {N_("/_Address/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Address/New _Address"), "N", addressbook_new_address_cb, 0, NULL, NULL}, - {N_("/_Address/New _Group"), "G", addressbook_new_group_cb, 0, NULL, NULL}, - {N_("/_Address/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Address/_Mail To"), NULL, addressbook_mail_to_cb, 0, NULL, NULL}, - {N_("/_Tools"), NULL, NULL, 0, "", NULL}, - {N_("/_Tools/Import _LDIF file..."), NULL, addressbook_import_ldif_cb, 0, NULL, NULL}, - {N_("/_Tools/Import M_utt file..."), NULL, addressbook_import_mutt_cb, 0, NULL, NULL}, - {N_("/_Tools/Import _Pine file..."), NULL, addressbook_import_pine_cb, 0, NULL, NULL}, - {N_("/_Tools/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Tools/Export _HTML..."), NULL, addressbook_export_html_cb, 0, NULL, NULL}, - {N_("/_Tools/Export LDI_F..."), NULL, addressbook_export_ldif_cb, 0, NULL, NULL}, - {N_("/_Tools/---"), NULL, NULL, 0, "", NULL}, - {N_("/_Tools/Find duplicates..."), NULL, addressbook_find_duplicates_cb, 0, NULL, NULL}, - {N_("/_Tools/Edit custom attributes..."), NULL, addressbook_edit_custom_attr_cb, 0, NULL, NULL}, - {N_("/_Help"), NULL, NULL, 0, "", NULL}, - {N_("/_Help/_About"), NULL, about_show, 0, NULL, NULL} + {"Book/---", NULL, "---", NULL, NULL, NULL }, + + {"Book/EditBook", NULL, N_("_Edit book"), NULL, NULL, G_CALLBACK(addressbook_treenode_edit_cb) }, + {"Book/DeleteBook", NULL, N_("_Delete book"), NULL, NULL, G_CALLBACK(addressbook_treenode_delete_cb) }, + /* {"Book/---", NULL, "---", NULL, NULL, NULL }, */ + {"Book/Save", NULL, N_("_Save"), "S", NULL, G_CALLBACK(addressbook_file_save_cb) }, + {"Book/Close", NULL, N_("_Close"), "W", NULL, G_CALLBACK(close_cb) }, + +/* Adress menu */ + {"Address/SelectAll", NULL, N_("_Select all"), "A", NULL, G_CALLBACK(addressbook_select_all_cb) }, + {"Address/---", NULL, "---", NULL, NULL, NULL }, + {"Address/Cut", NULL, N_("C_ut"), "X", NULL, G_CALLBACK(addressbook_clip_cut_cb) }, + {"Address/Copy", NULL, N_("_Copy"), "C", NULL, G_CALLBACK(addressbook_clip_copy_cb) }, + {"Address/Paste", NULL, N_("_Paste"), "V", NULL, G_CALLBACK(addressbook_clip_paste_cb) }, + /* {"Address/---", NULL, "---", NULL, NULL, NULL }, */ + {"Address/Edit", NULL, N_("_Edit"), "Return", NULL, G_CALLBACK(addressbook_edit_address_cb) }, + {"Address/Delete", NULL, N_("_Delete"), "D", NULL, G_CALLBACK(addressbook_delete_address_cb) }, + /* {"Address/---", NULL, "---", NULL, NULL, NULL }, */ + {"Address/NewAddress", NULL, N_("New _Address"), "N", NULL, G_CALLBACK(addressbook_new_address_cb) }, + {"Address/NewGroup", NULL, N_("New _Group"), "G", NULL, G_CALLBACK(addressbook_new_group_cb) }, + /* {"Address/---", NULL, "---", NULL, NULL, NULL }, */ + {"Address/Mailto", NULL, N_("_Mail To"), "M", NULL, G_CALLBACK(addressbook_mail_to_cb) }, + + +/* Tools menu */ + {"Tools/ImportLDIF", NULL, N_("Import _LDIF file..."), NULL, NULL, G_CALLBACK(addressbook_import_ldif_cb) }, + {"Tools/ImportMutt", NULL, N_("Import M_utt file..."), NULL, NULL, G_CALLBACK(addressbook_import_mutt_cb) }, + {"Tools/ImportPine", NULL, N_("Import _Pine file..."), NULL, NULL, G_CALLBACK(addressbook_import_pine_cb) }, + {"Tools/---", NULL, "---", NULL, NULL, NULL }, + {"Tools/ExportHTML", NULL, N_("Export _HTML..."), NULL, NULL, G_CALLBACK(addressbook_export_html_cb) }, + {"Tools/ExportLDIF", NULL, N_("Export LDI_F..."), NULL, NULL, G_CALLBACK(addressbook_export_ldif_cb) }, + /* {"Tools/---", NULL, "---", NULL, NULL, NULL },*/ + {"Tools/FindDuplicates", NULL, N_("Find duplicates..."), NULL, NULL, G_CALLBACK(addressbook_find_duplicates_cb) }, + {"Tools/EditAttrs", NULL, N_("Edit custom attributes..."), NULL, NULL, G_CALLBACK(addressbook_edit_custom_attr_cb) }, + +/* Help menu */ + {"Help/About", NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_show_cb) }, + }; -static GtkItemFactoryEntry addressbook_tree_popup_entries[] = +static GtkActionEntry addressbook_tree_popup_entries[] = { - {N_("/_Edit"), NULL, addressbook_treenode_edit_cb, 0, NULL, NULL}, - {N_("/_Delete"), NULL, addressbook_treenode_delete_cb, 0, NULL, NULL}, - {"/---", NULL, NULL, 0, "", NULL}, - {N_("/New _Book"), NULL, addressbook_new_book_cb, 0, NULL, NULL}, - {N_("/New _Folder"), NULL, addressbook_new_folder_cb, 0, NULL, NULL}, - {N_("/New _Group"), NULL, addressbook_new_group_cb, 0, NULL, NULL}, - {"/---", NULL, NULL, 0, "", NULL}, - {N_("/C_ut"), NULL, addressbook_treenode_cut_cb, 0, NULL, NULL}, - {N_("/_Copy"), NULL, addressbook_treenode_copy_cb, 0, NULL, NULL}, - {N_("/_Paste"), NULL, addressbook_treenode_paste_cb, 0, NULL, NULL} + {"ABTreePopup", NULL, "ABTreePopup" }, + {"ABTreePopup/EditBook", NULL, N_("_Edit"), NULL, NULL, G_CALLBACK(addressbook_treenode_edit_cb) }, + {"ABTreePopup/DeleteBook", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(addressbook_treenode_delete_cb) }, + {"ABTreePopup/---", NULL, "---", NULL, NULL, NULL }, + {"ABTreePopup/NewBook", NULL, N_("New _Book"), NULL, NULL, G_CALLBACK(addressbook_new_book_cb) }, + {"ABTreePopup/NewFolder", NULL, N_("New _Folder"), NULL, NULL, G_CALLBACK(addressbook_new_folder_cb) }, + {"ABTreePopup/NewGroup", NULL, N_("New _Group"), NULL, NULL, G_CALLBACK(addressbook_new_group_cb) }, + /* {"ABTreePopup/---", NULL, "---", NULL, NULL, NULL }, */ + {"ABTreePopup/Cut", NULL, N_("C_ut"), NULL, NULL, G_CALLBACK(addressbook_treenode_cut_cb) }, + {"ABTreePopup/Copy", NULL, N_("_Copy"), NULL, NULL, G_CALLBACK(addressbook_treenode_copy_cb) }, + {"ABTreePopup/Paste", NULL, N_("_Paste"), NULL, NULL, G_CALLBACK(addressbook_treenode_paste_cb) }, }; -static GtkItemFactoryEntry addressbook_list_popup_entries[] = +static GtkActionEntry addressbook_list_popup_entries[] = { - {N_("/_Select all"), NULL, addressbook_select_all_cb, 0, NULL, NULL}, - {"/---", NULL, NULL, 0, "", NULL}, - {N_("/_Edit"), NULL, addressbook_edit_address_cb, 0, NULL, NULL}, - {N_("/_Delete"), NULL, addressbook_delete_address_cb, 0, NULL, NULL}, - {"/---", NULL, NULL, 0, "", NULL}, - {N_("/New _Address"), NULL, addressbook_new_address_cb, 0, NULL, NULL}, - {N_("/New _Group"), NULL, addressbook_new_group_cb, 0, NULL, NULL}, - {"/---", NULL, NULL, 0, "", NULL}, - {N_("/C_ut"), NULL, addressbook_clip_cut_cb, 0, NULL, NULL}, - {N_("/_Copy"), NULL, addressbook_clip_copy_cb, 0, NULL, NULL}, - {N_("/_Paste"), NULL, addressbook_clip_paste_cb, 0, NULL, NULL}, - {"/---", NULL, NULL, 0, "", NULL}, -/* {N_("/Pa_ste Address"), NULL, addressbook_clip_paste_address_cb, 0, NULL, NULL},*/ - {N_("/_Mail To"), NULL, addressbook_mail_to_cb, 0, NULL, NULL}, + {"ABListPopup", NULL, "ABListPopup" }, + {"ABListPopup/SelectAll", NULL, N_("_Select all"), NULL, NULL, G_CALLBACK(addressbook_select_all_cb) }, + {"ABListPopup/---", NULL, "---", NULL, NULL, NULL }, + {"ABListPopup/Edit", NULL, N_("_Edit"), NULL, NULL, G_CALLBACK(addressbook_edit_address_cb) }, + {"ABListPopup/Delete", NULL, N_("_Delete"), NULL, NULL, G_CALLBACK(addressbook_delete_address_cb) }, + /* {"ABListPopup/---", NULL, "---", NULL, NULL, NULL }, */ + {"ABListPopup/NewAddress", NULL, N_("New _Address"), NULL, NULL, G_CALLBACK(addressbook_new_address_cb) }, + {"ABListPopup/NewGroup", NULL, N_("New _Group"), NULL, NULL, G_CALLBACK(addressbook_new_group_cb) }, + /* {"ABListPopup/---", NULL, "---", NULL, NULL, NULL }, */ + {"ABListPopup/Cut", NULL, N_("C_ut"), NULL, NULL, G_CALLBACK(addressbook_clip_cut_cb) }, + {"ABListPopup/Copy", NULL, N_("_Copy"), NULL, NULL, G_CALLBACK(addressbook_clip_copy_cb) }, + {"ABListPopup/Paste", NULL, N_("_Paste"), NULL, NULL, G_CALLBACK(addressbook_clip_paste_cb) }, + /* {"ABListPopup/---", NULL, "---", NULL, NULL, NULL }, */ + {"ABListPopup/Mailto", NULL, N_("_Mail To"), NULL, NULL, G_CALLBACK(addressbook_mail_to_cb) }, #ifdef USE_LDAP - {N_("/_Browse Entry"), NULL, addressbook_browse_entry_cb, 0, NULL, NULL}, -#endif + {"ABListPopup/BrowseEntry", NULL, N_("_Browse Entry"), NULL, NULL, G_CALLBACK(addressbook_browse_entry_cb) }, +#endif }; /** @@ -902,12 +909,9 @@ static void addressbook_create(void) GtkWidget *close_btn; GtkWidget *tree_popup; GtkWidget *list_popup; - GtkItemFactory *tree_factory; - GtkItemFactory *list_factory; - GtkItemFactory *menu_factory; - gint n_entries; GList *nodeIf; - + GtkUIManager *ui_manager; + GtkActionGroup *action_group; gchar *index_titles[N_INDEX_COLS]; gchar *text; gint i; @@ -936,12 +940,70 @@ static void addressbook_create(void) gtk_container_add(GTK_CONTAINER(window), vbox); /* Menu bar */ - n_entries = sizeof(addressbook_entries) / - sizeof(addressbook_entries[0]); - menubar = menubar_create(window, addressbook_entries, n_entries, - "", NULL); + ui_manager = gtk_ui_manager_new(); + action_group = cm_menu_create_action_group_full(ui_manager,"Menu", addressbook_entries, + G_N_ELEMENTS(addressbook_entries), NULL); + gtk_action_group_add_actions(action_group, addressbook_tree_popup_entries, + G_N_ELEMENTS(addressbook_tree_popup_entries), NULL); + gtk_action_group_add_actions(action_group, addressbook_list_popup_entries, + G_N_ELEMENTS(addressbook_list_popup_entries), NULL); + + MENUITEM_ADDUI_MANAGER(ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR) + + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu", "Book", "Book", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu", "Address", "Address", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu", "Tools", "Tools", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu", "Help", "Help", GTK_UI_MANAGER_MENU) + +/* Book menu */ + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "NewBook", "Book/NewBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "NewFolder", "Book/NewFolder", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "NewVCard", "Book/NewVCard", GTK_UI_MANAGER_MENUITEM) +#ifdef USE_JPILOT + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "NewJPilot", "Book/NewJPilot", GTK_UI_MANAGER_MENUITEM) +#endif +#ifdef USE_LDAP + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "NewLDAPServer", "Book/NewLDAPServer", GTK_UI_MANAGER_MENUITEM) +#endif + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "Separator1", "Book/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "EditBook", "Book/EditBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "DeleteBook", "Book/DeleteBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "Separator2", "Book/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "Save", "Book/Save", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Book", "Close", "Book/Close", GTK_UI_MANAGER_MENUITEM) + +/* Address menu */ + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "SelectAll", "Address/SelectAll", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Separator1", "Address/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Cut", "Address/Cut", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Copy", "Address/Copy", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Paste", "Address/Paste", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Separator2", "Address/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Edit", "Address/Edit", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Delete", "Address/Delete", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Separator3", "Address/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "NewAddress", "Address/NewAddress", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "NewGroup", "Address/NewGroup", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Separator4", "Address/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Address", "Mailto", "Address/Mailto", GTK_UI_MANAGER_MENUITEM) + +/* Tools menu */ + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "ImportLDIF", "Tools/ImportLDIF", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "ImportMutt", "Tools/ImportMutt", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "ImportPine", "Tools/ImportPine", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "Separator1", "Tools/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "ExportHTML", "Tools/ExportHTML", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "ExportLDIF", "Tools/ExportLDIF", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "Separator2", "Tools/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "FindDuplicates", "Tools/FindDuplicates", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Tools", "EditAttrs", "Tools/EditAttrs", GTK_UI_MANAGER_MENUITEM) + +/* Help menu */ + MENUITEM_ADDUI_MANAGER(ui_manager, "/Menu/Help", "About", "Help/About", GTK_UI_MANAGER_MENUITEM) + + menubar = gtk_ui_manager_get_widget(ui_manager, "/Menu"); + gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); - menu_factory = gtk_item_factory_from_widget(menubar); vbox2 = gtk_vbox_new(FALSE, BORDER_WIDTH); gtk_container_set_border_width(GTK_CONTAINER(vbox2), BORDER_WIDTH); @@ -1195,7 +1257,7 @@ static void addressbook_create(void) interfacexpm, interfacexpmmask, interfacexpm, interfacexpmmask, FALSE, FALSE ); - menu_set_sensitive( menu_factory, atci->menuCommand, adapter->haveLibrary ); + cm_menu_set_sensitive_full(ui_manager, atci->menuCommand, adapter->haveLibrary ); gtk_ctree_node_set_row_data_full( GTK_CTREE(ctree), adapter->treeNode, adapter, addressbook_free_treenode ); @@ -1203,18 +1265,42 @@ static void addressbook_create(void) } /* Popup menu */ - n_entries = sizeof(addressbook_tree_popup_entries) / - sizeof(addressbook_tree_popup_entries[0]); - tree_popup = menu_create_items(addressbook_tree_popup_entries, - n_entries, - "", &tree_factory, - NULL); - n_entries = sizeof(addressbook_list_popup_entries) / - sizeof(addressbook_list_popup_entries[0]); - list_popup = menu_create_items(addressbook_list_popup_entries, - n_entries, - "", &list_factory, - NULL); + + MENUITEM_ADDUI_MANAGER(ui_manager, "/", "Popups", NULL, GTK_UI_MANAGER_MENUBAR); + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups", "ABTreePopup", "ABTreePopup", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "EditBook", "ABTreePopup/EditBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "DeleteBook", "ABTreePopup/DeleteBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "Separator1", "ABTreePopup/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "NewBook", "ABTreePopup/NewBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "NewFolder", "ABTreePopup/NewFolder", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "NewGroup", "ABTreePopup/NewGroup", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "Separator2", "ABTreePopup/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "Cut", "ABTreePopup/Cut", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "Copy", "ABTreePopup/Copy", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABTreePopup", "Paste", "ABTreePopup/Paste", GTK_UI_MANAGER_MENUITEM) + + tree_popup = gtk_menu_item_get_submenu(GTK_MENU_ITEM( + gtk_ui_manager_get_widget(ui_manager, "/Popups/ABTreePopup"))); + + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups", "ABListPopup", "ABListPopup", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "SelectAll", "ABListPopup/SelectAll", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Separator1", "ABListPopup/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Edit", "ABListPopup/Edit", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Delete", "ABListPopup/Delete", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Separator2", "ABListPopup/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "NewAddress", "ABListPopup/NewAddress", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "NewGroup", "ABListPopup/NewGroup", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Separator3", "ABListPopup/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Cut", "ABListPopup/Cut", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Copy", "ABListPopup/Copy", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Paste", "ABListPopup/Paste", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Separator4", "ABListPopup/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "Mailto", "ABListPopup/Mailto", GTK_UI_MANAGER_MENUITEM) +#ifdef USE_LDAP + MENUITEM_ADDUI_MANAGER(ui_manager, "/Popups/ABListPopup", "BrowseEntry", "ABListPopup/BrowseEntry", GTK_UI_MANAGER_MENUITEM) +#endif + list_popup = gtk_menu_item_get_submenu(GTK_MENU_ITEM( + gtk_ui_manager_get_widget(ui_manager, "/Popups/ABListPopup"))); addrbook.window = window; addrbook.hpaned = hpaned; @@ -1242,9 +1328,7 @@ static void addressbook_create(void) addrbook.tree_popup = tree_popup; addrbook.list_popup = list_popup; - addrbook.tree_factory = tree_factory; - addrbook.list_factory = list_factory; - addrbook.menu_factory = menu_factory; + addrbook.ui_manager = ui_manager; addrbook.listSelected = NULL; @@ -1345,7 +1429,7 @@ static void addressbook_button_set_sensitive(void) static void addressbook_edit_clicked(GtkButton *button, gpointer data) { - addressbook_edit_address_cb(NULL, 0, NULL); + addressbook_edit_address_cb(NULL, NULL); } static gboolean find_person(AddrSelectItem *item_a, ItemPerson *person) @@ -1612,7 +1696,7 @@ thaw_ret: static void addressbook_reg_clicked(GtkButton *button, gpointer data) { - addressbook_new_address_cb( NULL, 0, NULL ); + addressbook_new_address_cb( NULL, NULL ); } static gchar *addressbook_format_address( AddrItemObject * aio ) { @@ -1738,18 +1822,18 @@ static void addressbook_to_clicked(GtkButton *button, gpointer data) } static void addressbook_menubar_set_sensitive( gboolean sensitive ) { - menu_set_sensitive( addrbook.menu_factory, "/Book/Edit book", sensitive ); - menu_set_sensitive( addrbook.menu_factory, "/Book/Delete book", sensitive ); - menu_set_sensitive( addrbook.menu_factory, "/Book/New Folder", sensitive ); - - menu_set_sensitive( addrbook.menu_factory, "/Address/Select all", TRUE ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Cut", sensitive ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Copy", sensitive ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Paste", sensitive ); - - menu_set_sensitive( addrbook.menu_factory, "/Address/New Address", sensitive ); - menu_set_sensitive( addrbook.menu_factory, "/Address/New Group", sensitive ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Mail To", sensitive ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/EditBook", sensitive ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/DeleteBook", sensitive ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/NewFolder", sensitive ); + + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/SelectAll", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Cut", sensitive ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Copy", sensitive ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Paste", sensitive ); + + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/NewAddress", sensitive ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/NewGroup", sensitive ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Mailto", sensitive ); gtk_widget_set_sensitive( addrbook.edit_btn, sensitive ); gtk_widget_set_sensitive( addrbook.del_btn, sensitive ); } @@ -1773,7 +1857,7 @@ static void addressbook_menuitem_set_sensitive( AddressObject *obj, GtkCTreeNode if( iface->haveLibrary ) { /* Enable appropriate File / New command */ atci = adapter->atci; - menu_set_sensitive( addrbook.menu_factory, atci->menuCommand, TRUE ); + cm_menu_set_sensitive_full(addrbook.ui_manager, atci->menuCommand, TRUE ); } } canEditTr = canExport = FALSE; @@ -1816,23 +1900,23 @@ static void addressbook_menuitem_set_sensitive( AddressObject *obj, GtkCTreeNode canEdit = FALSE; /* Enable add */ - menu_set_sensitive( addrbook.menu_factory, "/Address/New Address", editAddress ); - menu_set_sensitive( addrbook.menu_factory, "/Address/New Group", canAdd ); - menu_set_sensitive( addrbook.menu_factory, "/Book/New Folder", canAdd ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/NewAddress", editAddress ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/NewGroup", canAdd ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/NewFolder", canAdd ); gtk_widget_set_sensitive( addrbook.reg_btn, editAddress ); /* Enable edit */ - menu_set_sensitive( addrbook.menu_factory, "/Address/Edit", canEdit ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Delete", canDelete ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Edit", canEdit ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Delete", canDelete ); gtk_widget_set_sensitive( addrbook.edit_btn, canEdit ); gtk_widget_set_sensitive( addrbook.del_btn, canDelete ); - menu_set_sensitive( addrbook.menu_factory, "/Book/Edit book", canEditTr ); - menu_set_sensitive( addrbook.menu_factory, "/Book/Delete book", canEditTr ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/EditBook", canEditTr ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/DeleteBook", canEditTr ); /* Export data */ - menu_set_sensitive( addrbook.menu_factory, "/Tools/Export HTML...", canExport ); - menu_set_sensitive( addrbook.menu_factory, "/Tools/Export LDIF...", canExport ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Tools/ExportHTML", canExport ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Tools/ExportLDIF", canExport ); } /** @@ -1953,7 +2037,7 @@ static void addressbook_list_menu_setup( void ) { if( obj == NULL ) canEdit = FALSE; menu_set_insensitive_all( GTK_MENU_SHELL(addrbook.list_popup) ); - menu_set_sensitive( addrbook.list_factory, "/Select all", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/SelectAll", TRUE ); if( pobj->type == ADDR_DATASOURCE ) { /* Parent object is a data source */ @@ -1965,9 +2049,9 @@ static void addressbook_list_menu_setup( void ) { if (!iface) return; if( ! iface->readOnly ) { - menu_set_sensitive( addrbook.list_factory, "/New Address", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/NewAddress", TRUE ); if (iface->type != ADDR_IF_LDAP) - menu_set_sensitive( addrbook.list_factory, "/New Group", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/NewGroup", TRUE ); gtk_widget_set_sensitive( addrbook.reg_btn, TRUE ); if( obj ) canEdit = TRUE; @@ -1985,14 +2069,14 @@ static void addressbook_list_menu_setup( void ) { if( ! iface->readOnly ) { /* Folder or group */ if( pobj->type == ADDR_ITEM_FOLDER || pobj->type == ADDR_ITEM_GROUP ) { - menu_set_sensitive( addrbook.list_factory, "/New Address", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/NewAddress", TRUE ); gtk_widget_set_sensitive( addrbook.reg_btn, TRUE ); if( obj ) canEdit = TRUE; } /* Folder */ if( pobj->type == ADDR_ITEM_FOLDER ) { if (iface->type != ADDR_IF_LDAP) - menu_set_sensitive( addrbook.list_factory, "/New Group", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/NewGroup", TRUE ); if( obj ) canEdit = TRUE; } canDelete = canEdit; @@ -2029,28 +2113,28 @@ static void addressbook_list_menu_setup( void ) { } /* Now go finalize menu items */ - menu_set_sensitive( addrbook.list_factory, "/Edit", canEdit ); - menu_set_sensitive( addrbook.list_factory, "/Delete", canDelete ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/Edit", canEdit ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/Delete", canDelete ); - menu_set_sensitive( addrbook.list_factory, "/Cut", canCut ); - menu_set_sensitive( addrbook.list_factory, "/Copy", canCopy ); - menu_set_sensitive( addrbook.list_factory, "/Paste", canPaste ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/Cut", canCut ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/Copy", canCopy ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/Paste", canPaste ); - menu_set_sensitive( addrbook.list_factory, "/Mail To", canCopy ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/Mailto", canCopy ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Cut", canCut ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Copy", canCopy ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Paste", canPaste ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Cut", canCut ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Copy", canCopy ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Paste", canPaste ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Edit", canEdit ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Delete", canDelete ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Mail To", canCopy ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Edit", canEdit ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Delete", canDelete ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Mailto", canCopy ); gtk_widget_set_sensitive( addrbook.edit_btn, canEdit ); gtk_widget_set_sensitive( addrbook.del_btn, canDelete ); #ifdef USE_LDAP - menu_set_sensitive( addrbook.list_factory, "/Browse Entry", canBrowse ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/BrowseEntry", canBrowse ); #endif } @@ -2095,14 +2179,14 @@ static void addressbook_treenode_add_list( } } -static void addressbook_select_all_cb( void ) { +static void addressbook_select_all_cb( GtkAction *action, gpointer data ) { gtk_clist_select_all(GTK_CLIST(addrbook.clist)); } /** * Cut from address list widget. */ -static void addressbook_clip_cut_cb( void ) { +static void addressbook_clip_cut_cb( GtkAction *action, gpointer data ) { _clipBoard_->cutFlag = TRUE; addrclip_clear( _clipBoard_ ); addrclip_add( _clipBoard_, _addressSelect_ ); @@ -2112,7 +2196,7 @@ static void addressbook_clip_cut_cb( void ) { /** * Copy from address list widget. */ -static void addressbook_clip_copy_cb( void ) { +static void addressbook_clip_copy_cb(GtkAction *action, gpointer data) { _clipBoard_->cutFlag = FALSE; addrclip_clear( _clipBoard_ ); addrclip_add( _clipBoard_, _addressSelect_ ); @@ -2122,7 +2206,7 @@ static void addressbook_clip_copy_cb( void ) { /** * Paste clipboard into address list widget. */ -static void addressbook_clip_paste_cb( void ) { +static void addressbook_clip_paste_cb( GtkAction *action, gpointer data ) { GtkCTree *ctree = GTK_CTREE( addrbook.ctree ); AddressObject *pobj = NULL; AddressDataSource *ds = NULL; @@ -2244,7 +2328,7 @@ static void addressbook_treenode_to_clipboard( void ) { /** * Cut from tree widget. */ -static void addressbook_treenode_cut_cb( void ) { +static void addressbook_treenode_cut_cb( GtkAction *action, gpointer data ) { _clipBoard_->cutFlag = TRUE; addressbook_treenode_to_clipboard(); addrclip_clear( _clipBoard_ ); @@ -2255,7 +2339,7 @@ static void addressbook_treenode_cut_cb( void ) { /** * Copy from tree widget. */ -static void addressbook_treenode_copy_cb( void ) { +static void addressbook_treenode_copy_cb( GtkAction *action, gpointer data ) { _clipBoard_->cutFlag = FALSE; addressbook_treenode_to_clipboard(); addrclip_clear( _clipBoard_ ); @@ -2266,8 +2350,8 @@ static void addressbook_treenode_copy_cb( void ) { /** * Paste clipboard into address tree widget. */ -static void addressbook_treenode_paste_cb( void ) { - addressbook_clip_paste_cb(); +static void addressbook_treenode_paste_cb( GtkAction *action, gpointer data ) { + addressbook_clip_paste_cb(NULL,NULL); } /** @@ -2302,7 +2386,7 @@ static void addressbook_list_select_remove( AddrItemObject *aio ) { /** * Invoke EMail compose window with addresses in selected address list. */ -static void addressbook_mail_to_cb( void ) { +static void addressbook_mail_to_cb( GtkAction *action, gpointer data ) { GList *listAddress; if( ! addrselect_test_empty( _addressSelect_ ) ) { @@ -2389,12 +2473,12 @@ static gboolean addressbook_list_button_pressed(GtkWidget *widget, addressbook_to_clicked(NULL, GINT_TO_POINTER(COMPOSE_TO)); else if (prefs_common.addressbook_use_editaddress_dialog) - addressbook_edit_address_cb(NULL, 0, NULL); + addressbook_edit_address_cb(NULL, NULL); else { GtkCTree *clist = GTK_CTREE(addrbook.clist); AddressObject *obj = gtk_ctree_node_get_row_data( clist, addrbook.listSelected ); if( obj && obj->type == ADDR_ITEM_GROUP ) - addressbook_edit_address_cb(NULL, 0, NULL); + addressbook_edit_address_cb(NULL, NULL); } } } @@ -2444,7 +2528,7 @@ static gboolean addressbook_tree_button_pressed(GtkWidget *ctree, if (obj->type == ADDR_ITEM_GROUP) { /* edit group */ - addressbook_treenode_edit_cb(NULL, 0, NULL); + addressbook_treenode_edit_cb(NULL, NULL); } else { /* expand pr collapse */ node = gtk_ctree_node_nth(GTK_CTREE(ctree), row); @@ -2478,7 +2562,7 @@ static gboolean addressbook_tree_button_pressed(GtkWidget *ctree, if( !iface ) goto just_set_sens; if( !iface->readOnly ) { - menu_set_sensitive( addrbook.tree_factory, "/New Book", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/NewBook", TRUE ); gtk_widget_set_sensitive( addrbook.reg_btn, TRUE ); } if( iface->externalQuery ) @@ -2494,8 +2578,8 @@ static gboolean addressbook_tree_button_pressed(GtkWidget *ctree, goto just_set_sens; if( !iface->readOnly ) { canDelete = TRUE; - menu_set_sensitive( addrbook.tree_factory, "/New Folder", TRUE ); - menu_set_sensitive( addrbook.tree_factory, "/New Group", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/NewFolder", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/NewGroup", TRUE ); gtk_widget_set_sensitive( addrbook.reg_btn, TRUE ); } canEdit = TRUE; @@ -2514,8 +2598,8 @@ static gboolean addressbook_tree_button_pressed(GtkWidget *ctree, canEdit = TRUE; canDelete = TRUE; canTreeCut = TRUE; - menu_set_sensitive( addrbook.tree_factory, "/New Folder", TRUE ); - menu_set_sensitive( addrbook.tree_factory, "/New Group", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/NewFolder", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/NewGroup", TRUE ); gtk_widget_set_sensitive( addrbook.reg_btn, TRUE ); } canTreeCopy = TRUE; @@ -2536,7 +2620,7 @@ static gboolean addressbook_tree_button_pressed(GtkWidget *ctree, if( ! iface->readOnly ) { canEdit = TRUE; canDelete = TRUE; - menu_set_sensitive( addrbook.list_factory, "/New Address", TRUE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABListPopup/NewAddress", TRUE ); gtk_widget_set_sensitive( addrbook.reg_btn, TRUE ); } } @@ -2559,17 +2643,17 @@ static gboolean addressbook_tree_button_pressed(GtkWidget *ctree, just_set_sens: /* Enable edit */ - menu_set_sensitive( addrbook.tree_factory, "/Edit", canEdit ); - menu_set_sensitive( addrbook.tree_factory, "/Delete", canDelete ); - menu_set_sensitive( addrbook.tree_factory, "/Cut", canTreeCut ); - menu_set_sensitive( addrbook.tree_factory, "/Copy", canTreeCopy ); - menu_set_sensitive( addrbook.tree_factory, "/Paste", canTreePaste ); - - menu_set_sensitive( addrbook.menu_factory, "/Book/Edit book", canEdit ); - menu_set_sensitive( addrbook.menu_factory, "/Book/Delete book", canEdit ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Cut", canCut ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Copy", canCopy ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Paste", canPaste ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/EditBook", canEdit ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/DeleteBook", canDelete ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/Cut", canTreeCut ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/Copy", canTreeCopy ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Popups/ABTreePopup/Paste", canTreePaste ); + + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/EditBook", canEdit ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Book/DeleteBook", canEdit ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Cut", canCut ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Copy", canCopy ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Paste", canPaste ); addressbook_show_buttons(addrbook.target_compose == NULL, canLookup, addrbook.target_compose != NULL); @@ -2589,8 +2673,7 @@ static gboolean addressbook_tree_button_released(GtkWidget *ctree, return FALSE; } -static void addressbook_new_folder_cb(gpointer data, guint action, - GtkWidget *widget) +static void addressbook_new_folder_cb(GtkAction *action, gpointer data) { GtkCTree *ctree = GTK_CTREE(addrbook.ctree); AddressObject *obj = NULL; @@ -2628,8 +2711,7 @@ static void addressbook_new_folder_cb(gpointer data, guint action, } } -static void addressbook_new_group_cb(gpointer data, guint action, - GtkWidget *widget) +static void addressbook_new_group_cb(GtkAction *action, gpointer data) { GtkCTree *ctree = GTK_CTREE(addrbook.ctree); AddressObject *obj = NULL; @@ -2737,8 +2819,7 @@ static gchar *addressbook_edit_datasource( AddressObject *obj, GtkCTreeNode *nod /* * Edit an object that is in the address tree area. */ -static void addressbook_treenode_edit_cb(gpointer data, guint action, - GtkWidget *widget) +static void addressbook_treenode_edit_cb(GtkAction *action, gpointer data) { GtkCTree *ctree = GTK_CTREE(addrbook.ctree); AddressObject *obj; @@ -2803,8 +2884,7 @@ typedef enum { * \param action Action. * \param widget Widget issuing callback. */ -static void addressbook_treenode_delete_cb( - gpointer data, guint action, GtkWidget *widget ) +static void addressbook_treenode_delete_cb(GtkAction *action, gpointer data) { GtkCTree *ctree = GTK_CTREE(addrbook.ctree); GtkCTreeNode *node = NULL; @@ -3089,7 +3169,7 @@ static ItemFolder * addressbook_setup_subf( return NULL; } -static void addressbook_new_address_cb( gpointer data, guint action, GtkWidget *widget ) { +static void addressbook_new_address_cb( GtkAction *action, gpointer data ) { AddressObject *pobj = NULL; AddressDataSource *ds = NULL; AddressBookFile *abf = NULL; @@ -3312,13 +3392,13 @@ void addressbook_address_list_set_focus( void ) void addressbook_address_list_disable_some_actions(void) { /* disable address copy/pasting when editing contact's detail (embedded form) */ - menu_set_sensitive( addrbook.menu_factory, "/Address/Cut", FALSE ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Copy", FALSE ); - menu_set_sensitive( addrbook.menu_factory, "/Address/Paste", FALSE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Cut", FALSE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Copy", FALSE ); + cm_menu_set_sensitive_full( addrbook.ui_manager, "Menu/Address/Paste", FALSE ); } -static void addressbook_edit_address_cb( gpointer data, guint action, GtkWidget *widget ) { - addressbook_edit_address(data, action, widget, TRUE); +static void addressbook_edit_address_cb( GtkAction *action, gpointer data ) { + addressbook_edit_address(data, 0, NULL, TRUE); } static void addressbook_edit_address( gpointer data, guint action, GtkWidget *widget, @@ -3418,18 +3498,17 @@ static void addressbook_edit_address( gpointer data, guint action, GtkWidget *wi TRUE); } -static void addressbook_delete_address_cb(gpointer data, guint action, - GtkWidget *widget) +static void addressbook_delete_address_cb(GtkAction *action, gpointer data) { addressbook_del_clicked(NULL, NULL); } -static void close_cb(gpointer data, guint action, GtkWidget *widget) +static void close_cb(GtkAction *action, gpointer data) { addressbook_close(); } -static void addressbook_file_save_cb( gpointer data, guint action, GtkWidget *widget ) { +static void addressbook_file_save_cb( GtkAction *action, gpointer data ) { addressbook_export_to_file(); } @@ -4328,7 +4407,7 @@ static gint addressbook_treenode_compare_func( return g_utf8_collate( name1, name2 ); } -static void addressbook_new_book_cb( gpointer data, guint action, GtkWidget *widget ) { +static void addressbook_new_book_cb( GtkAction *action, gpointer data ) { AdapterDSource *ads; AdapterInterface *adapter; GtkCTreeNode *newNode; @@ -4345,7 +4424,7 @@ static void addressbook_new_book_cb( gpointer data, guint action, GtkWidget *wid } } -static void addressbook_new_vcard_cb( gpointer data, guint action, GtkWidget *widget ) { +static void addressbook_new_vcard_cb( GtkAction *action, gpointer data ) { AdapterDSource *ads; AdapterInterface *adapter; GtkCTreeNode *newNode; @@ -4363,7 +4442,7 @@ static void addressbook_new_vcard_cb( gpointer data, guint action, GtkWidget *wi } #ifdef USE_JPILOT -static void addressbook_new_jpilot_cb( gpointer data, guint action, GtkWidget *widget ) { +static void addressbook_new_jpilot_cb( GtkAction *action, gpointer data ) { AdapterDSource *ads; AdapterInterface *adapter; AddressInterface *iface; @@ -4385,7 +4464,7 @@ static void addressbook_new_jpilot_cb( gpointer data, guint action, GtkWidget *w #endif #ifdef USE_LDAP -static void addressbook_new_ldap_cb( gpointer data, guint action, GtkWidget *widget ) { +static void addressbook_new_ldap_cb( GtkAction *action, gpointer data ) { AdapterDSource *ads; AdapterInterface *adapter; AddressInterface *iface; @@ -4614,7 +4693,7 @@ static void addressbook_close_clicked( GtkButton *button, gpointer data ) { /** * Browse address entry for highlighted entry. */ -static void addressbook_browse_entry_cb(void) +static void addressbook_browse_entry_cb( GtkAction *action, gpointer data) { GtkCTree *clist = GTK_CTREE(addrbook.clist); AddressObject *obj; @@ -4733,7 +4812,7 @@ static void addrbookctl_build_map( GtkWidget *window ) { atci->maskXpm = bookxpmmask; atci->iconXpmOpen = bookxpm; atci->maskXpmOpen = bookxpmmask; - atci->menuCommand = "/Book/New Book"; + atci->menuCommand = "Menu/Book/NewBook"; g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci ); _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci ); @@ -4813,7 +4892,7 @@ static void addrbookctl_build_map( GtkWidget *window ) { atci->maskXpm = vcardxpmmask; atci->iconXpmOpen = vcardxpm; atci->maskXpmOpen = vcardxpmmask; - atci->menuCommand = "/Book/New vCard"; + atci->menuCommand = "Menu/Book/NewVCard"; g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci ); _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci ); @@ -4829,7 +4908,7 @@ static void addrbookctl_build_map( GtkWidget *window ) { atci->maskXpm = jpilotxpmmask; atci->iconXpmOpen = jpilotxpm; atci->maskXpmOpen = jpilotxpmmask; - atci->menuCommand = "/Book/New JPilot"; + atci->menuCommand = "Menu/Book/NewJPilot"; g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci ); _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci ); @@ -4861,7 +4940,7 @@ static void addrbookctl_build_map( GtkWidget *window ) { atci->maskXpm = ldapxpmmask; atci->iconXpmOpen = ldapxpm; atci->maskXpmOpen = ldapxpmmask; - atci->menuCommand = "/Book/New LDAP Server"; + atci->menuCommand = "Menu/Book/NewLDAPServer"; g_hash_table_insert( _addressBookTypeHash_, &atci->objectType, atci ); _addressBookTypeList_ = g_list_append( _addressBookTypeList_, atci ); @@ -5271,7 +5350,7 @@ gboolean addressbook_peek_folder_exists( gchar *folderpath, /** * Import LDIF file. */ -static void addressbook_import_ldif_cb( void ) { +static void addressbook_import_ldif_cb( GtkAction *action, gpointer data ) { AddressDataSource *ds = NULL; AdapterDSource *ads = NULL; AddressBookFile *abf = NULL; @@ -5308,7 +5387,7 @@ static void addressbook_import_ldif_cb( void ) { /** * Import MUTT file. */ -static void addressbook_import_mutt_cb( void ) { +static void addressbook_import_mutt_cb( GtkAction *action, gpointer data ) { AddressDataSource *ds = NULL; AdapterDSource *ads = NULL; AddressBookFile *abf = NULL; @@ -5345,7 +5424,7 @@ static void addressbook_import_mutt_cb( void ) { /** * Import Pine file. */ -static void addressbook_import_pine_cb( void ) { +static void addressbook_import_pine_cb( GtkAction *action, gpointer data ) { AddressDataSource *ds = NULL; AdapterDSource *ads = NULL; AddressBookFile *abf = NULL; @@ -5419,7 +5498,7 @@ void addressbook_harvest( /** * Export HTML file. */ -static void addressbook_export_html_cb( void ) { +static void addressbook_export_html_cb( GtkAction *action, gpointer data ) { GtkCTree *ctree = GTK_CTREE(addrbook.ctree); AddressObject *obj; AddressDataSource *ds = NULL; @@ -5443,7 +5522,7 @@ static void addressbook_export_html_cb( void ) { /** * Export LDIF file. */ -static void addressbook_export_ldif_cb( void ) { +static void addressbook_export_ldif_cb( GtkAction *action, gpointer data ) { GtkCTree *ctree = GTK_CTREE(addrbook.ctree); AddressObject *obj; AddressDataSource *ds = NULL; @@ -5464,12 +5543,12 @@ static void addressbook_export_ldif_cb( void ) { addressbook_exp_ldif( cache ); } -static void addressbook_find_duplicates_cb(void) +static void addressbook_find_duplicates_cb(GtkAction *action, gpointer data) { addrduplicates_find(GTK_WINDOW(addrbook.window)); } -static void addressbook_edit_custom_attr_cb(void) +static void addressbook_edit_custom_attr_cb(GtkAction *action, gpointer data) { addressbook_custom_attr_edit(); } @@ -5646,11 +5725,11 @@ static void addressbook_drag_received_cb(GtkWidget *widget, gtk_clist_freeze(GTK_CLIST(addrbook.clist)); if (drag_context->action == GDK_ACTION_COPY || !strcmp(data->data, "Dummy_addr_copy")) - addressbook_clip_copy_cb(); + addressbook_clip_copy_cb(NULL, NULL); else - addressbook_clip_cut_cb(); + addressbook_clip_cut_cb(NULL, NULL); gtk_sctree_select( GTK_SCTREE(addrbook.ctree), node); - addressbook_clip_paste_cb(); + addressbook_clip_paste_cb(NULL,NULL); gtk_sctree_select( GTK_SCTREE(addrbook.ctree), lastopened); gtk_clist_thaw(GTK_CLIST(addrbook.clist)); gtk_drag_finish(drag_context, TRUE, TRUE, time); diff --git a/src/addressitem.h b/src/addressitem.h index 8bd76012f..80c9d65dd 100644 --- a/src/addressitem.h +++ b/src/addressitem.h @@ -92,6 +92,7 @@ struct _AddressBook_win Compose *target_compose; gint status_cid; + GtkUIManager *ui_manager; }; typedef struct _AddressTypeControlItem AddressTypeControlItem; diff --git a/src/compose.c b/src/compose.c index 52c841d6d..c33857974 100644 --- a/src/compose.c +++ b/src/compose.c @@ -294,9 +294,11 @@ static void compose_convert_header (Compose *compose, gboolean addr_field); static void compose_attach_info_free (AttachInfo *ainfo); -static void compose_attach_remove_selected (Compose *compose); +static void compose_attach_remove_selected (GtkAction *action, + gpointer data); -static void compose_attach_property (Compose *compose); +static void compose_attach_property (GtkAction *action, + gpointer data); static void compose_attach_property_create (gboolean *cancelled); static void attach_property_ok (GtkWidget *widget, gboolean *cancelled); @@ -353,61 +355,59 @@ static gboolean attach_button_pressed (GtkWidget *widget, static gboolean attach_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer data); -static void compose_send_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_send_later_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void compose_draft_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void compose_attach_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_insert_file_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_insert_sig_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void compose_close_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void compose_set_encoding_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void compose_address_cb (gpointer data, - guint action, - GtkWidget *widget); +static void compose_send_cb (GtkAction *action, gpointer data); +static void compose_send_later_cb (GtkAction *action, gpointer data); + +static void compose_save_cb (GtkAction *action, + gpointer data); + +static void compose_attach_cb (GtkAction *action, + gpointer data); +static void compose_insert_file_cb (GtkAction *action, + gpointer data); +static void compose_insert_sig_cb (GtkAction *action, + gpointer data); + +static void compose_close_cb (GtkAction *action, + gpointer data); + +static void compose_set_encoding_cb (GtkAction *action, GtkRadioAction *current, gpointer data); + +static void compose_address_cb (GtkAction *action, + gpointer data); +static void about_show_cb (GtkAction *action, + gpointer data); static void compose_template_activate_cb(GtkWidget *widget, gpointer data); -static void compose_ext_editor_cb (gpointer data, - guint action, - GtkWidget *widget); +static void compose_ext_editor_cb (GtkAction *action, + gpointer data); static gint compose_delete_cb (GtkWidget *widget, GdkEventAny *event, gpointer data); -static void compose_undo_cb (Compose *compose); -static void compose_redo_cb (Compose *compose); -static void compose_cut_cb (Compose *compose); -static void compose_copy_cb (Compose *compose); -static void compose_paste_cb (Compose *compose); -static void compose_paste_as_quote_cb (Compose *compose); -static void compose_paste_no_wrap_cb (Compose *compose); -static void compose_paste_wrap_cb (Compose *compose); -static void compose_allsel_cb (Compose *compose); +static void compose_undo_cb (GtkAction *action, + gpointer data); +static void compose_redo_cb (GtkAction *action, + gpointer data); +static void compose_cut_cb (GtkAction *action, + gpointer data); +static void compose_copy_cb (GtkAction *action, + gpointer data); +static void compose_paste_cb (GtkAction *action, + gpointer data); +static void compose_paste_as_quote_cb (GtkAction *action, + gpointer data); +static void compose_paste_no_wrap_cb (GtkAction *action, + gpointer data); +static void compose_paste_wrap_cb (GtkAction *action, + gpointer data); +static void compose_allsel_cb (GtkAction *action, + gpointer data); -static void compose_advanced_action_cb (Compose *compose, - ComposeCallAdvancedAction action); +static void compose_advanced_action_cb (GtkAction *action, + gpointer data); static void compose_grab_focus_cb (GtkWidget *widget, Compose *compose); @@ -415,43 +415,35 @@ static void compose_grab_focus_cb (GtkWidget *widget, static void compose_changed_cb (GtkTextBuffer *textbuf, Compose *compose); -static void compose_wrap_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_find_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_toggle_autowrap_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void compose_toggle_ruler_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_toggle_sign_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_toggle_encrypt_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_set_privacy_system_cb(GtkWidget *widget, - gpointer data); +static void compose_wrap_cb (GtkAction *action, + gpointer data); +static void compose_wrap_all_cb (GtkAction *action, + gpointer data); +static void compose_find_cb (GtkAction *action, + gpointer data); +static void compose_toggle_autowrap_cb (GtkToggleAction *action, + gpointer data); + +static void compose_toggle_ruler_cb (GtkToggleAction *action, + gpointer data); +static void compose_toggle_sign_cb (GtkToggleAction *action, + gpointer data); +static void compose_toggle_encrypt_cb (GtkToggleAction *action, + gpointer data); +static void compose_set_privacy_system_cb(GtkWidget *widget, gpointer data); static void compose_update_privacy_system_menu_item(Compose * compose, gboolean warn); static void activate_privacy_system (Compose *compose, PrefsAccount *account, gboolean warn); static void compose_use_signing(Compose *compose, gboolean use_signing); static void compose_use_encryption(Compose *compose, gboolean use_encryption); -static void compose_toggle_return_receipt_cb(gpointer data, guint action, - GtkWidget *widget); -static void compose_toggle_remove_refs_cb(gpointer data, guint action, - GtkWidget *widget); -static void compose_set_priority_cb (gpointer data, - guint action, - GtkWidget *widget); -static void compose_reply_change_mode (gpointer data, - ComposeMode action, - GtkWidget *widget); +static void compose_toggle_return_receipt_cb(GtkToggleAction *action, + gpointer data); +static void compose_toggle_remove_refs_cb(GtkToggleAction *action, + gpointer data); +static void compose_set_priority_cb (GtkAction *action, GtkRadioAction *current, gpointer data); +static void compose_reply_change_mode (Compose *compose, ComposeMode action); +static void compose_reply_change_mode_cb(GtkAction *action, GtkRadioAction *current, gpointer data); static void compose_attach_drag_received_cb (GtkWidget *widget, GdkDragContext *drag_context, @@ -506,11 +498,16 @@ static void compose_show_first_last_header (Compose *compose, gboolean show_firs static void compose_allow_user_actions (Compose *compose, gboolean allow); +static void compose_nothing_cb (GtkAction *action, gpointer data) +{ + +} + #if USE_ASPELL -static void compose_check_all (Compose *compose); -static void compose_highlight_all (Compose *compose); -static void compose_check_backwards (Compose *compose); -static void compose_check_forwards_go (Compose *compose); +static void compose_check_all (GtkAction *action, gpointer data); +static void compose_highlight_all (GtkAction *action, gpointer data); +static void compose_check_backwards (GtkAction *action, gpointer data); +static void compose_check_forwards_go (GtkAction *action, gpointer data); #endif static gint compose_defer_auto_save_draft (Compose *compose); @@ -526,266 +523,189 @@ static void compose_attach_update_label(Compose *compose); static void compose_attach_from_list(Compose *compose, GList *file_list, gboolean free_data); -static GtkItemFactoryEntry compose_popup_entries[] = +static GtkActionEntry compose_popup_entries[] = { - {N_("/_Add..."), NULL, compose_attach_cb, 0, NULL}, - {N_("/_Remove"), NULL, compose_attach_remove_selected, 0, NULL}, - {"/---", NULL, NULL, 0, ""}, - {N_("/_Properties..."), NULL, compose_attach_property, 0, NULL} + {"Compose", NULL, "Compose" }, + {"Compose/Add", NULL, N_("_Add..."), NULL, NULL, G_CALLBACK(compose_attach_cb) }, + {"Compose/Remove", NULL, N_("_Remove"), NULL, NULL, G_CALLBACK(compose_attach_remove_selected) }, + {"Compose/---", NULL, "---", NULL, NULL, NULL }, + {"Compose/Properties", NULL, N_("_Properties..."), NULL, NULL, G_CALLBACK(compose_attach_property) }, }; -static GtkItemFactoryEntry compose_entries[] = -{ - {N_("/_Message"), NULL, NULL, 0, ""}, - {N_("/_Message/S_end"), "Return", - compose_send_cb, 0, NULL}, - {N_("/_Message/Send _later"), "S", - compose_send_later_cb, 0, NULL}, - {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/_Attach file"), "M", compose_attach_cb, 0, NULL}, - {N_("/_Message/_Insert file"), "I", compose_insert_file_cb, 0, NULL}, - {N_("/_Message/Insert si_gnature"), "G", compose_insert_sig_cb, 0, NULL}, - {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/_Save"), - "S", compose_draft_cb, COMPOSE_KEEP_EDITING, NULL}, - {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/_Close"), "W", compose_close_cb, 0, NULL}, - - {N_("/_Edit"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Undo"), "Z", compose_undo_cb, 0, NULL}, - {N_("/_Edit/_Redo"), "Y", compose_redo_cb, 0, NULL}, - {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/Cu_t"), "X", compose_cut_cb, 0, NULL}, - {N_("/_Edit/_Copy"), "C", compose_copy_cb, 0, NULL}, - {N_("/_Edit/_Paste"), "V", compose_paste_cb, 0, NULL}, - {N_("/_Edit/Special paste"), NULL, NULL, 0, ""}, - {N_("/_Edit/Special paste/as _quotation"), - NULL, compose_paste_as_quote_cb, 0, NULL}, - {N_("/_Edit/Special paste/_wrapped"), - NULL, compose_paste_wrap_cb, 0, NULL}, - {N_("/_Edit/Special paste/_unwrapped"), - NULL, compose_paste_no_wrap_cb, 0, NULL}, - {N_("/_Edit/Select _all"), "A", compose_allsel_cb, 0, NULL}, - {N_("/_Edit/A_dvanced"), NULL, NULL, 0, ""}, - {N_("/_Edit/A_dvanced/Move a character backward"), - "B", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_CHARACTER, - NULL}, - {N_("/_Edit/A_dvanced/Move a character forward"), - "F", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_CHARACTER, - NULL}, - {N_("/_Edit/A_dvanced/Move a word backward"), - NULL, /* "B" */ - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_WORD, - NULL}, - {N_("/_Edit/A_dvanced/Move a word forward"), - NULL, /* "F" */ - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_WORD, - NULL}, - {N_("/_Edit/A_dvanced/Move to beginning of line"), - NULL, /* "A" */ - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE, - NULL}, - {N_("/_Edit/A_dvanced/Move to end of line"), - "E", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE, - NULL}, - {N_("/_Edit/A_dvanced/Move to previous line"), - "P", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_PREVIOUS_LINE, - NULL}, - {N_("/_Edit/A_dvanced/Move to next line"), - "N", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_MOVE_NEXT_LINE, - NULL}, - {N_("/_Edit/A_dvanced/Delete a character backward"), - "H", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_CHARACTER, - NULL}, - {N_("/_Edit/A_dvanced/Delete a character forward"), - "D", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_CHARACTER, - NULL}, - {N_("/_Edit/A_dvanced/Delete a word backward"), - NULL, /* "W" */ - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_WORD, - NULL}, - {N_("/_Edit/A_dvanced/Delete a word forward"), - NULL, /* "D", */ - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_WORD, - NULL}, - {N_("/_Edit/A_dvanced/Delete line"), - "U", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE, - NULL}, - {N_("/_Edit/A_dvanced/Delete to end of line"), - "K", - compose_advanced_action_cb, - COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END, - NULL}, - {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Find"), - "F", compose_find_cb, 0, NULL}, - {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Wrap current paragraph"), - "L", compose_wrap_cb, 0, NULL}, - {N_("/_Edit/Wrap all long _lines"), - "L", compose_wrap_cb, 1, NULL}, - {N_("/_Edit/Aut_o wrapping"), "L", compose_toggle_autowrap_cb, 0, ""}, - {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/Edit with e_xternal editor"), - "X", compose_ext_editor_cb, 0, NULL}, +static GtkActionEntry compose_entries[] = +{ + {"Menu", NULL, "Menu" }, +/* menus */ + {"Message", NULL, N_("_Message") }, + {"Edit", NULL, N_("_Edit") }, +#if USE_ASPELL + {"Spelling", NULL, N_("_Spelling") }, +#endif + {"Options", NULL, N_("_Options") }, + {"Tools", NULL, N_("_Tools") }, + {"Help", NULL, N_("_Help") }, +/* Message menu */ + {"Message/Send", NULL, N_("S_end"), "Return", NULL, G_CALLBACK(compose_send_cb) }, + {"Message/SendLater", NULL, N_("Send _later"), "S", NULL, G_CALLBACK(compose_send_later_cb) }, + {"Message/---", NULL, "---" }, + + {"Message/AttachFile", NULL, N_("_Attach file"), "M", NULL, G_CALLBACK(compose_attach_cb) }, + {"Message/InsertFile", NULL, N_("_Insert file"), "I", NULL, G_CALLBACK(compose_insert_file_cb) }, + {"Message/InsertSig", NULL, N_("Insert si_gnature"), "G", NULL, G_CALLBACK(compose_insert_sig_cb) }, + /* {"Message/---", NULL, "---" }, */ + {"Message/Save", NULL, N_("_Save"), "S", NULL, G_CALLBACK(compose_save_cb) }, /*COMPOSE_KEEP_EDITING*/ + /* {"Message/---", NULL, "---" }, */ + {"Message/Close", NULL, N_("_Close"), "W", NULL, G_CALLBACK(compose_close_cb) }, + +/* Edit menu */ + {"Edit/Undo", NULL, N_("_Undo"), "Z", NULL, G_CALLBACK(compose_undo_cb) }, + {"Edit/Redo", NULL, N_("_Redo"), "Y", NULL, G_CALLBACK(compose_redo_cb) }, + {"Edit/---", NULL, "---" }, + + {"Edit/Cut", NULL, N_("Cu_t"), "X", NULL, G_CALLBACK(compose_cut_cb) }, + {"Edit/Copy", NULL, N_("_Copy"), "C", NULL, G_CALLBACK(compose_copy_cb) }, + {"Edit/Paste", NULL, N_("_Paste"), "V", NULL, G_CALLBACK(compose_paste_cb) }, + + {"Edit/SpecialPaste", NULL, N_("Special paste") }, + {"Edit/SpecialPaste/AsQuotation", NULL, N_("as _quotation"), NULL, NULL, G_CALLBACK(compose_paste_as_quote_cb) }, + {"Edit/SpecialPaste/Wrapped", NULL, N_("_wrapped"), NULL, NULL, G_CALLBACK(compose_paste_wrap_cb) }, + {"Edit/SpecialPaste/Unwrapped", NULL, N_("_unwrapped"), NULL, NULL, G_CALLBACK(compose_paste_no_wrap_cb) }, + + {"Edit/SelectAll", NULL, N_("Select _all"), "A", NULL, G_CALLBACK(compose_allsel_cb) }, + + {"Edit/Advanced", NULL, N_("A_dvanced") }, + {"Edit/Advanced/BackChar", NULL, N_("Move a character backward"), "B", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_CHARACTER*/ + {"Edit/Advanced/ForwChar", NULL, N_("Move a character forward"), "F", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_CHARACTER*/ + {"Edit/Advanced/BackWord", NULL, N_("Move a word backward"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_WORD*/ + {"Edit/Advanced/ForwWord", NULL, N_("Move a word forward"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_WORD*/ + {"Edit/Advanced/BegLine", NULL, N_("Move to beginning of line"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE*/ + {"Edit/Advanced/EndLine", NULL, N_("Move to end of line"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE*/ + {"Edit/Advanced/PrevLine", NULL, N_("Move to previous line"), "P", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_PREVIOUS_LINE*/ + {"Edit/Advanced/NextLine", NULL, N_("Move to next line"), "N", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_MOVE_NEXT_LINE*/ + {"Edit/Advanced/DelBackChar", NULL, N_("Delete a character backward"), "H", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_CHARACTER*/ + {"Edit/Advanced/DelForwChar", NULL, N_("Delete a character forward"), "D", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_CHARACTER*/ + {"Edit/Advanced/DelBackWord", NULL, N_("Delete a word backward"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_WORD*/ + {"Edit/Advanced/DelForwWord", NULL, N_("Delete a word forward"), NULL, NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_WORD*/ + {"Edit/Advanced/DelLine", NULL, N_("Delete line"), "U", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE*/ + {"Edit/Advanced/DelEndLine", NULL, N_("Delete to end of line"), "K", NULL, G_CALLBACK(compose_advanced_action_cb) }, /*COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END*/ + + /* {"Edit/---", NULL, "---" }, */ + {"Edit/Find", NULL, N_("_Find"), "F", NULL, G_CALLBACK(compose_find_cb) }, + + /* {"Edit/---", NULL, "---" }, */ + {"Edit/WrapPara", NULL, N_("_Wrap current paragraph"), "L", NULL, G_CALLBACK(compose_wrap_cb) }, /* 0 */ + {"Edit/WrapAllLines", NULL, N_("Wrap all long _lines"), "L", NULL, G_CALLBACK(compose_wrap_all_cb) }, /* 1 */ + /* {"Edit/---", NULL, "---" }, */ + {"Edit/ExtEditor", NULL, N_("Edit with e_xternal editor"), "X", NULL, G_CALLBACK(compose_ext_editor_cb) }, #if USE_ASPELL - {N_("/_Spelling"), NULL, NULL, 0, ""}, - {N_("/_Spelling/_Check all or check selection"), - NULL, compose_check_all, 0, NULL}, - {N_("/_Spelling/_Highlight all misspelled words"), - NULL, compose_highlight_all, 0, NULL}, - {N_("/_Spelling/Check _backwards misspelled word"), - NULL, compose_check_backwards , 0, NULL}, - {N_("/_Spelling/_Forward to next misspelled word"), - NULL, compose_check_forwards_go, 0, NULL}, - {N_("/_Spelling/---"), NULL, NULL, 0, ""}, - {N_("/_Spelling/Options"), - NULL, NULL, 0, ""}, +/* Spelling menu */ + {"Spelling/CheckAllSel", NULL, N_("_Check all or check selection"), NULL, NULL, G_CALLBACK(compose_check_all) }, + {"Spelling/HighlightAll", NULL, N_("_Highlight all misspelled words"), NULL, NULL, G_CALLBACK(compose_highlight_all) }, + {"Spelling/CheckBackwards", NULL, N_("Check _backwards misspelled word"), NULL, NULL, G_CALLBACK(compose_check_backwards) }, + {"Spelling/ForwardNext", NULL, N_("_Forward to next misspelled word"), NULL, NULL, G_CALLBACK(compose_check_forwards_go) }, + + {"Spelling/---", NULL, "---" }, + {"Spelling/Options", NULL, N_("_Options") }, #endif - {N_("/_Options"), NULL, NULL, 0, ""}, - {N_("/_Options/Reply _mode"), NULL, NULL, 0, ""}, - {N_("/_Options/Reply _mode/_Normal"), NULL, compose_reply_change_mode, COMPOSE_REPLY, ""}, - {N_("/_Options/Reply _mode/_All"), NULL, compose_reply_change_mode, COMPOSE_REPLY_TO_ALL, "/Options/Reply mode/Normal"}, - {N_("/_Options/Reply _mode/_Sender"), NULL, compose_reply_change_mode, COMPOSE_REPLY_TO_SENDER, "/Options/Reply mode/Normal"}, - {N_("/_Options/Reply _mode/_Mailing-list"), NULL, compose_reply_change_mode, COMPOSE_REPLY_TO_LIST, "/Options/Reply mode/Normal"}, - {N_("/_Options/---"), NULL, NULL, 0, ""}, - {N_("/_Options/Privacy _System"), NULL, NULL, 0, ""}, - {N_("/_Options/Privacy _System/None"), NULL, NULL, 0, ""}, - {N_("/_Options/Si_gn"), NULL, compose_toggle_sign_cb , 0, ""}, - {N_("/_Options/_Encrypt"), NULL, compose_toggle_encrypt_cb, 0, ""}, - {N_("/_Options/---"), NULL, NULL, 0, ""}, - {N_("/_Options/_Priority"), NULL, NULL, 0, ""}, - {N_("/_Options/Priority/_Highest"), NULL, compose_set_priority_cb, PRIORITY_HIGHEST, ""}, - {N_("/_Options/Priority/Hi_gh"), NULL, compose_set_priority_cb, PRIORITY_HIGH, "/Options/Priority/Highest"}, - {N_("/_Options/Priority/_Normal"), NULL, compose_set_priority_cb, PRIORITY_NORMAL, "/Options/Priority/Highest"}, - {N_("/_Options/Priority/Lo_w"), NULL, compose_set_priority_cb, PRIORITY_LOW, "/Options/Priority/Highest"}, - {N_("/_Options/Priority/_Lowest"), NULL, compose_set_priority_cb, PRIORITY_LOWEST, "/Options/Priority/Highest"}, - {N_("/_Options/---"), NULL, NULL, 0, ""}, - {N_("/_Options/_Request Return Receipt"), NULL, compose_toggle_return_receipt_cb, 0, ""}, - {N_("/_Options/---"), NULL, NULL, 0, ""}, - {N_("/_Options/Remo_ve references"), NULL, compose_toggle_remove_refs_cb, 0, ""}, - {N_("/_Options/---"), NULL, NULL, 0, ""}, - -#define ENC_ACTION(action) \ - NULL, compose_set_encoding_cb, action, \ - "/Options/Character encoding/Automatic" - - {N_("/_Options/Character _encoding"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/_Automatic"), - NULL, compose_set_encoding_cb, C_AUTO, ""}, - {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, ""}, - - {N_("/_Options/Character _encoding/7bit ASCII (US-ASC_II)"), - ENC_ACTION(C_US_ASCII)}, - {N_("/_Options/Character _encoding/Unicode (_UTF-8)"), - ENC_ACTION(C_UTF_8)}, - {N_("/_Options/Character _encoding/---"), NULL, NULL, 0, ""}, - - {N_("/_Options/Character _encoding/Western European"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Western European/ISO-8859-_1"), - ENC_ACTION(C_ISO_8859_1)}, - {N_("/_Options/Character _encoding/Western European/ISO-8859-15"), - ENC_ACTION(C_ISO_8859_15)}, - {N_("/_Options/Character _encoding/Western European/Windows-1252"), - ENC_ACTION(C_WINDOWS_1252)}, - - {N_("/_Options/Character _encoding/Central European (ISO-8859-_2)"), - ENC_ACTION(C_ISO_8859_2)}, - - {N_("/_Options/Character _encoding/Baltic"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Baltic/ISO-8859-13"), - ENC_ACTION(C_ISO_8859_13)}, - {N_("/_Options/Character _encoding/Baltic/ISO-8859-_4"), - ENC_ACTION(C_ISO_8859_4)}, - - {N_("/_Options/Character _encoding/Greek (ISO-8859-_7)"), - ENC_ACTION(C_ISO_8859_7)}, - - {N_("/_Options/Character _encoding/Hebrew"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Hebrew/ISO-8859-_8"), - ENC_ACTION(C_ISO_8859_8)}, - {N_("/_Options/Character _encoding/Hebrew/Windows-1255"), - ENC_ACTION(C_WINDOWS_1255)}, - - {N_("/_Options/Character _encoding/Arabic"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Arabic/ISO-8859-_6"), - ENC_ACTION(C_ISO_8859_6)}, - {N_("/_Options/Character _encoding/Arabic/Windows-1256"), - ENC_ACTION(C_CP1256)}, - - {N_("/_Options/Character _encoding/Turkish (ISO-8859-_9)"), - ENC_ACTION(C_ISO_8859_9)}, - - {N_("/_Options/Character _encoding/Cyrillic"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Cyrillic/ISO-8859-_5"), - ENC_ACTION(C_ISO_8859_5)}, - {N_("/_Options/Character _encoding/Cyrillic/KOI8-_R"), - ENC_ACTION(C_KOI8_R)}, - {N_("/_Options/Character _encoding/Cyrillic/KOI8-U"), - ENC_ACTION(C_KOI8_U)}, - {N_("/_Options/Character _encoding/Cyrillic/Windows-1251"), - ENC_ACTION(C_WINDOWS_1251)}, - - {N_("/_Options/Character _encoding/Japanese"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Japanese/ISO-2022-_JP"), - ENC_ACTION(C_ISO_2022_JP)}, - {N_("/_Options/Character _encoding/Japanese/ISO-2022-JP-2"), - ENC_ACTION(C_ISO_2022_JP_2)}, - {N_("/_Options/Character _encoding/Japanese/_EUC-JP"), - ENC_ACTION(C_EUC_JP)}, - {N_("/_Options/Character _encoding/Japanese/_Shift__JIS"), - ENC_ACTION(C_SHIFT_JIS)}, - - {N_("/_Options/Character _encoding/Chinese"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Chinese/Simplified (_GB2312)"), - ENC_ACTION(C_GB2312)}, - {N_("/_Options/Character _encoding/Chinese/Simplified (GBK)"), - ENC_ACTION(C_GBK)}, - {N_("/_Options/Character _encoding/Chinese/Traditional (_Big5)"), - ENC_ACTION(C_BIG5)}, - {N_("/_Options/Character _encoding/Chinese/Traditional (EUC-_TW)"), - ENC_ACTION(C_EUC_TW)}, - - {N_("/_Options/Character _encoding/Korean"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Korean/EUC-_KR"), - ENC_ACTION(C_EUC_KR)}, - {N_("/_Options/Character _encoding/Korean/ISO-2022-KR"), - ENC_ACTION(C_ISO_2022_KR)}, - - {N_("/_Options/Character _encoding/Thai"), NULL, NULL, 0, ""}, - {N_("/_Options/Character _encoding/Thai/TIS-620"), - ENC_ACTION(C_TIS_620)}, - {N_("/_Options/Character _encoding/Thai/Windows-874"), - ENC_ACTION(C_WINDOWS_874)}, - - {N_("/_Tools"), NULL, NULL, 0, ""}, - {N_("/_Tools/Show _ruler"), NULL, compose_toggle_ruler_cb, 0, ""}, - {N_("/_Tools/_Address book"), "A", compose_address_cb , 0, NULL}, - {N_("/_Tools/_Template"), NULL, NULL, 0, ""}, - {N_("/_Tools/Actio_ns"), NULL, NULL, 0, ""}, - {N_("/_Help"), NULL, NULL, 0, ""}, - {N_("/_Help/_About"), NULL, about_show, 0, NULL} + +/* Options menu */ + + {"Options/ReplyMode", NULL, N_("Reply _mode") }, + {"Options/---", NULL, "---" }, + {"Options/PrivacySystem", NULL, N_("Privacy _System") }, + {"Options/PrivacySystem/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(compose_nothing_cb) }, + + /* {"Options/---", NULL, "---" }, */ + + {"Options/Priority", NULL, N_("_Priority") }, + + {"Options/Encoding", NULL, N_("Character _encoding") }, + {"Options/Encoding/---", NULL, "---" }, +#define ENC_ACTION(cs_char,c_char,string) \ + { "Options/Encoding/" cs_char, NULL, N_(string), NULL, NULL, c_char } + + {"Options/Encoding/Western", NULL, N_("Western European") }, + {"Options/Encoding/Baltic", NULL, N_("Baltic") }, + {"Options/Encoding/Hebrew", NULL, N_("Hebrew") }, + {"Options/Encoding/Arabic", NULL, N_("Arabic") }, + {"Options/Encoding/Cyrillic", NULL, N_("Cyrillic") }, + {"Options/Encoding/Japanese", NULL, N_("Japanese") }, + {"Options/Encoding/Chinese", NULL, N_("Chinese") }, + {"Options/Encoding/Korean", NULL, N_("Korean") }, + {"Options/Encoding/Thai", NULL, N_("Thai") }, + +/* Tools menu */ + {"Tools/AddressBook", NULL, N_("_Address book"), NULL, NULL, G_CALLBACK(compose_address_cb) }, + + {"Tools/Template", NULL, N_("_Template") }, + {"Tools/Template/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(compose_nothing_cb) }, + {"Tools/Actions", NULL, N_("Actio_ns") }, + {"Tools/Actions/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(compose_nothing_cb) }, + +/* Help menu */ + {"Help/About", NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_show_cb) }, +}; + +static GtkToggleActionEntry compose_toggle_entries[] = +{ + {"Edit/AutoWrap", NULL, N_("Aut_o wrapping"), "L", NULL, G_CALLBACK(compose_toggle_autowrap_cb) }, /* TOGGLE */ + {"Options/Sign", NULL, N_("Si_gn"), NULL, NULL, G_CALLBACK(compose_toggle_sign_cb) }, /* Toggle */ + {"Options/Encrypt", NULL, N_("_Encrypt"), NULL, NULL, G_CALLBACK(compose_toggle_encrypt_cb) }, /* Toggle */ + {"Options/RequestRetRcpt", NULL, N_("_Request Return Receipt"), NULL, NULL, G_CALLBACK(compose_toggle_return_receipt_cb) }, /* TOGGLE */ + {"Options/RemoveReferences", NULL, N_("Remo_ve references"), NULL, NULL, G_CALLBACK(compose_toggle_remove_refs_cb) }, /* TOGGLE */ + {"Tools/ShowRuler", NULL, N_("Show _ruler"), NULL, NULL, G_CALLBACK(compose_toggle_ruler_cb) }, /* Toggle */ +}; + +static GtkRadioActionEntry compose_radio_rm_entries[] = +{ + {"Options/ReplyMode/Normal", NULL, N_("_Normal"), NULL, NULL, COMPOSE_REPLY }, /* RADIO compose_reply_change_mode_cb */ + {"Options/ReplyMode/All", NULL, N_("_All"), NULL, NULL, COMPOSE_REPLY_TO_ALL }, /* RADIO compose_reply_change_mode_cb */ + {"Options/ReplyMode/Sender", NULL, N_("_Sender"), NULL, NULL, COMPOSE_REPLY_TO_SENDER }, /* RADIO compose_reply_change_mode_cb */ + {"Options/ReplyMode/List", NULL, N_("_Mailing-list"), NULL, NULL, COMPOSE_REPLY_TO_LIST }, /* RADIO compose_reply_change_mode_cb */ +}; + +static GtkRadioActionEntry compose_radio_prio_entries[] = +{ + {"Options/Priority/Highest", NULL, N_("_Highest"), NULL, NULL, PRIORITY_HIGHEST }, /* RADIO compose_set_priority_cb */ + {"Options/Priority/High", NULL, N_("Hi_gh"), NULL, NULL, PRIORITY_HIGH }, /* RADIO compose_set_priority_cb */ + {"Options/Priority/Normal", NULL, N_("_Normal"), NULL, NULL, PRIORITY_NORMAL }, /* RADIO compose_set_priority_cb */ + {"Options/Priority/Low", NULL, N_("Lo_w"), NULL, NULL, PRIORITY_LOW }, /* RADIO compose_set_priority_cb */ + {"Options/Priority/Lowest", NULL, N_("Lowest"), NULL, NULL, PRIORITY_LOWEST }, /* RADIO compose_set_priority_cb */ +}; + +static GtkRadioActionEntry compose_radio_enc_entries[] = +{ + ENC_ACTION(CS_AUTO, C_AUTO, "_Automatic"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION(CS_US_ASCII, C_US_ASCII, "7bit ASCII (US-ASC_II)"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION(CS_UTF_8, C_UTF_8, "Unicode (_UTF-8)"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Western/"CS_ISO_8859_1, C_ISO_8859_1, "ISO-8859-_1"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Western/"CS_ISO_8859_15, C_ISO_8859_15, "ISO-8859-15"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Western/"CS_WINDOWS_1252, C_WINDOWS_1252, "Windows-1252"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, "Central European (ISO-8859-_2)"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Baltic/"CS_ISO_8859_13, C_ISO_8859_13, "ISO-8859-13"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Baltic/"CS_ISO_8859_4, C_ISO_8859_14, "ISO-8859-_4"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, "Greek (ISO-8859-_7)"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Hebrew/"CS_ISO_8859_8, C_ISO_8859_8, "ISO-8859-_8"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Hebrew/"CS_WINDOWS_1255, C_WINDOWS_1255, "Windows-1255"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Arabic/"CS_ISO_8859_6, C_ISO_8859_6, "ISO-8859-_6"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Arabic/"CS_WINDOWS_1256, C_WINDOWS_1256, "Windows-1256"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, "Turkish (ISO-8859-_9)"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Cyrillic/"CS_WINDOWS_1251, C_WINDOWS_1251, "Windows-1251"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Japanese/"CS_ISO_2022_JP, C_ISO_2022_JP, "ISO-2022-_JP"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Chinese/"CS_EUC_TW, C_EUC_TW, "EUC-_TW"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Korean/"CS_EUC_KR, C_EUC_KR, "_EUC-KR"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Korean/"CS_ISO_2022_KR, C_ISO_2022_KR, "_ISO-2022-KR"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Thai/"CS_TIS_620, C_TIS_620, "_TIS-620-KR"), /* RADIO compose_set_encoding_cb */ + ENC_ACTION("Thai/"CS_WINDOWS_874, C_WINDOWS_874, "_Windows-874"), /* RADIO compose_set_encoding_cb */ }; static GtkTargetEntry compose_mime_types[] = @@ -971,7 +891,6 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI GtkTextView *textview; GtkTextBuffer *textbuf; GtkTextIter iter; - GtkItemFactory *ifactory; const gchar *subject_format = NULL; const gchar *body_format = NULL; gchar *mailto_from = NULL; @@ -1039,8 +958,6 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI g_free(tmp); } - ifactory = gtk_item_factory_from_widget(compose->menubar); - compose->replyinfo = NULL; compose->fwdinfo = NULL; @@ -1067,7 +984,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI compose_entry_mark_default_to(compose, item->prefs->default_to); } if (item && item->ret_rcpt) { - menu_set_active(ifactory, "/Options/Request Return Receipt", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE); } } else { if (mailto && *mailto != '\0') { @@ -1082,7 +999,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI * CLAWS: just don't allow return receipt request, even if the user * may want to send an email. simple but foolproof. */ - menu_set_sensitive(ifactory, "/Options/Request Return Receipt", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", FALSE); } compose_add_field_list( compose, listAddress ); @@ -1260,7 +1177,6 @@ static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar MsgInfo *msginfo; guint list_len; Compose *compose = NULL; - GtkItemFactory *ifactory = NULL; g_return_val_if_fail(msginfo_list != NULL, NULL); @@ -1353,7 +1269,6 @@ static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar alertpanel_error(_("Unable to reply. The original email probably doesn't exist.")); return NULL; } - ifactory = gtk_item_factory_from_widget(compose->menubar); compose->rmode = mode; switch (compose->rmode) { @@ -1362,26 +1277,26 @@ static Compose *compose_reply_mode(ComposeMode mode, GSList *msginfo_list, gchar case COMPOSE_REPLY_WITHOUT_QUOTE: case COMPOSE_FOLLOWUP_AND_REPLY_TO: debug_print("reply mode Normal\n"); - menu_set_active(ifactory, "/Options/Reply mode/Normal", TRUE); - compose_reply_change_mode(compose, COMPOSE_REPLY, NULL); /* force update */ + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/ReplyMode/Normal", TRUE); + compose_reply_change_mode(compose, COMPOSE_REPLY); /* force update */ break; case COMPOSE_REPLY_TO_SENDER: case COMPOSE_REPLY_TO_SENDER_WITH_QUOTE: case COMPOSE_REPLY_TO_SENDER_WITHOUT_QUOTE: debug_print("reply mode Sender\n"); - menu_set_active(ifactory, "/Options/Reply mode/Sender", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/ReplyMode/Sender", TRUE); break; case COMPOSE_REPLY_TO_ALL: case COMPOSE_REPLY_TO_ALL_WITH_QUOTE: case COMPOSE_REPLY_TO_ALL_WITHOUT_QUOTE: debug_print("reply mode All\n"); - menu_set_active(ifactory, "/Options/Reply mode/All", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/ReplyMode/All", TRUE); break; case COMPOSE_REPLY_TO_LIST: case COMPOSE_REPLY_TO_LIST_WITH_QUOTE: case COMPOSE_REPLY_TO_LIST_WITHOUT_QUOTE: debug_print("reply mode List\n"); - menu_set_active(ifactory, "/Options/Reply mode/Mailing-list", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/ReplyMode/List", TRUE); break; default: break; @@ -1459,7 +1374,6 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean followup_and_reply_to, const gchar *body) { - GtkItemFactory *ifactory; Compose *compose; PrefsAccount *account = NULL; GtkTextView *textview; @@ -1479,10 +1393,8 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, compose->updating = TRUE; - ifactory = gtk_item_factory_from_widget(compose->menubar); - - menu_set_active(ifactory, "/Options/Remove references", FALSE); - menu_set_sensitive(ifactory, "/Options/Remove references", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RemoveReferences", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/RemoveReferences", TRUE); compose->replyinfo = procmsg_msginfo_get_full_info(msginfo); if (!compose->replyinfo) @@ -1491,7 +1403,7 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, compose_extract_original_charset(compose); if (msginfo->folder && msginfo->folder->ret_rcpt) - menu_set_active(ifactory, "/Options/Request Return Receipt", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE); /* Set save folder */ if (msginfo->folder && msginfo->folder->prefs && msginfo->folder->prefs->save_copy_to_folder) { @@ -2193,9 +2105,7 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch) if (!procheader_get_header_from_msginfo(msginfo, queueheader_buf, sizeof(queueheader_buf), "RRCPT:")) { gint active = atoi(&queueheader_buf[strlen("RRCPT:")]); if (active) { - GtkItemFactory *ifactory; - ifactory = gtk_item_factory_from_widget(compose->menubar); - menu_set_active(ifactory, "/Options/Request Return Receipt", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/RequestRetRcpt", TRUE); } } } @@ -2277,7 +2187,6 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo, { Compose *compose; gchar *filename; - GtkItemFactory *ifactory; FolderItem *item; g_return_val_if_fail(msginfo != NULL, NULL); @@ -2291,7 +2200,6 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo, compose->updating = TRUE; - ifactory = gtk_item_factory_from_widget(compose->menubar); compose_create_tags(GTK_TEXT_VIEW(compose->text), compose); compose->replyinfo = NULL; compose->fwdinfo = NULL; @@ -2336,20 +2244,19 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo, compose_colorize_signature(compose); - ifactory = gtk_item_factory_from_widget(compose->popupmenu); - menu_set_sensitive(ifactory, "/Add...", FALSE); - menu_set_sensitive(ifactory, "/Remove", FALSE); - menu_set_sensitive(ifactory, "/Properties...", FALSE); - - ifactory = gtk_item_factory_from_widget(compose->menubar); - menu_set_sensitive(ifactory, "/Message/Save", FALSE); - menu_set_sensitive(ifactory, "/Message/Insert file", FALSE); - menu_set_sensitive(ifactory, "/Message/Attach file", FALSE); - menu_set_sensitive(ifactory, "/Message/Insert signature", FALSE); - menu_set_sensitive(ifactory, "/Edit", FALSE); - menu_set_sensitive(ifactory, "/Options", FALSE); - menu_set_sensitive(ifactory, "/Tools/Show ruler", FALSE); - menu_set_sensitive(ifactory, "/Tools/Actions", FALSE); + + cm_menu_set_sensitive_full(compose->ui_manager, "Popup/Compose/Add", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Popup/Compose/Remove", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Popup/Compose/Properties", FALSE); + + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/Save", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/InsertFile", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/AttachFile", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/InsertSig", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Tools/ShowRuler", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Tools/Actions", FALSE); if (compose->toolbar->draft_btn) gtk_widget_set_sensitive(compose->toolbar->draft_btn, FALSE); @@ -2492,25 +2399,25 @@ void compose_toolbar_cb(gint action, gpointer data) switch(action) { case A_SEND: - compose_send_cb(compose, 0, NULL); + compose_send_cb(NULL, compose); break; case A_SENDL: - compose_send_later_cb(compose, 0, NULL); + compose_send_later_cb(NULL, compose); break; case A_DRAFT: - compose_draft_cb(compose, COMPOSE_QUIT_EDITING, NULL); + compose_draft(compose, COMPOSE_QUIT_EDITING); break; case A_INSERT: - compose_insert_file_cb(compose, 0, NULL); + compose_insert_file_cb(NULL, compose); break; case A_ATTACH: - compose_attach_cb(compose, 0, NULL); + compose_attach_cb(NULL, compose); break; case A_SIG: compose_insert_sig(compose, FALSE); break; case A_EXTEDITOR: - compose_ext_editor_cb(compose, 0, NULL); + compose_ext_editor_cb(NULL, compose); break; case A_LINEWRAP_CURRENT: compose_beautify_paragraph(compose, NULL, TRUE); @@ -2519,11 +2426,11 @@ void compose_toolbar_cb(gint action, gpointer data) compose_wrap_all_full(compose, TRUE); break; case A_ADDRBOOK: - compose_address_cb(compose, 0, NULL); + compose_address_cb(NULL, compose); break; #ifdef USE_ASPELL case A_CHECK_SPELLING: - compose_check_all(compose); + compose_check_all(NULL, compose); break; #endif default: @@ -3560,29 +3467,14 @@ static gboolean compose_attach_append(Compose *compose, const gchar *file, static void compose_use_signing(Compose *compose, gboolean use_signing) { - GtkItemFactory *ifactory; - GtkWidget *menuitem = NULL; - compose->use_signing = use_signing; - ifactory = gtk_item_factory_from_widget(compose->menubar); - menuitem = gtk_item_factory_get_item - (ifactory, "/Options/Sign"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), - use_signing); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", use_signing); } static void compose_use_encryption(Compose *compose, gboolean use_encryption) { - GtkItemFactory *ifactory; - GtkWidget *menuitem = NULL; - compose->use_encryption = use_encryption; - ifactory = gtk_item_factory_from_widget(compose->menubar); - menuitem = gtk_item_factory_get_item - (ifactory, "/Options/Encrypt"); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), - use_encryption); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", use_encryption); } #define NEXT_PART_NOT_CHILD(info) \ @@ -4515,7 +4407,6 @@ compose_current_mail_account(void) static void compose_select_account(Compose *compose, PrefsAccount *account, gboolean init) { - GtkItemFactory *ifactory; gchar *from = NULL; g_return_if_fail(account != NULL); @@ -4538,16 +4429,14 @@ static void compose_select_account(Compose *compose, PrefsAccount *account, compose_set_title(compose); - ifactory = gtk_item_factory_from_widget(compose->menubar); - if (account->default_sign && compose->mode != COMPOSE_REDIRECT) - menu_set_active(ifactory, "/Options/Sign", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", TRUE); else - menu_set_active(ifactory, "/Options/Sign", FALSE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Sign", FALSE); if (account->default_encrypt && compose->mode != COMPOSE_REDIRECT) - menu_set_active(ifactory, "/Options/Encrypt", TRUE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", TRUE); else - menu_set_active(ifactory, "/Options/Encrypt", FALSE); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Options/Encrypt", FALSE); activate_privacy_system(compose, account, FALSE); @@ -6637,14 +6526,13 @@ static void compose_spell_menu_changed(void *data) GtkWidget *menuitem; GtkWidget *parent_item; GtkMenu *menu = GTK_MENU(gtk_menu_new()); - GtkItemFactory *ifactory = gtk_item_factory_from_widget(compose->menubar); GSList *spell_menu; if (compose->gtkaspell == NULL) return; - parent_item = gtk_item_factory_get_item(ifactory, - "/Spelling/Options"); + parent_item = gtk_ui_manager_get_widget(compose->ui_manager, + "/Menu/Spelling/Options"); /* setting the submenu removes /Spelling/Options from the factory * so we need to save it */ @@ -6723,13 +6611,9 @@ static Compose *compose_create(PrefsAccount *account, UndoMain *undostruct; gchar *titles[N_ATTACH_COLS]; - guint n_menu_entries; GtkWidget *popupmenu; - GtkItemFactory *popupfactory; - GtkItemFactory *ifactory; GtkWidget *tmpl_menu; - gint n_entries; - GtkWidget *menuitem; + GtkActionGroup *action_group = NULL; #if USE_ASPELL GtkAspell * gtkaspell = NULL; @@ -6791,9 +6675,195 @@ static Compose *compose_create(PrefsAccount *account, vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(window), vbox); - n_menu_entries = sizeof(compose_entries) / sizeof(compose_entries[0]); - menubar = menubar_create(window, compose_entries, - n_menu_entries, "", compose); + compose->ui_manager = gtk_ui_manager_new(); + action_group = cm_menu_create_action_group_full(compose->ui_manager,"Menu", compose_entries, + G_N_ELEMENTS(compose_entries), (gpointer)compose); + gtk_action_group_add_toggle_actions(action_group, compose_toggle_entries, + G_N_ELEMENTS(compose_toggle_entries), (gpointer)compose); + gtk_action_group_add_radio_actions(action_group, compose_radio_rm_entries, + G_N_ELEMENTS(compose_radio_rm_entries), COMPOSE_REPLY, G_CALLBACK(compose_reply_change_mode_cb), (gpointer)compose); + gtk_action_group_add_radio_actions(action_group, compose_radio_prio_entries, + G_N_ELEMENTS(compose_radio_prio_entries), PRIORITY_NORMAL, G_CALLBACK(compose_set_priority_cb), (gpointer)compose); + gtk_action_group_add_radio_actions(action_group, compose_radio_enc_entries, + G_N_ELEMENTS(compose_radio_enc_entries), C_AUTO, G_CALLBACK(compose_set_encoding_cb), (gpointer)compose); + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu", "Message", "Message", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu", "Edit", "Edit", GTK_UI_MANAGER_MENU) +#ifdef USE_ASPELL + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu", "Spelling", "Spelling", GTK_UI_MANAGER_MENU) +#endif + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu", "Options", "Options", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu", "Tools", "Tools", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu", "Help", "Help", GTK_UI_MANAGER_MENU) + +/* Compose menu */ + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Send", "Message/Send", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "SendLater", "Message/SendLater", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Separator1", "Message/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "AttachFile", "Message/AttachFile", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "InsertFile", "Message/InsertFile", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "InsertSig", "Message/InsertSig", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Separator2", "Message/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Save", "Message/Save", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Separator3", "Message/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Message", "Close", "Message/Close", GTK_UI_MANAGER_MENUITEM) + +/* Edit menu */ + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Undo", "Edit/Undo", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Redo", "Edit/Redo", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Separator1", "Edit/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Cut", "Edit/Cut", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Copy", "Edit/Copy", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Paste", "Edit/Paste", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "SpecialPaste", "Edit/SpecialPaste", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/SpecialPaste", "AsQuotation", "Edit/SpecialPaste/AsQuotation", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/SpecialPaste", "Wrapped", "Edit/SpecialPaste/Wrapped", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/SpecialPaste", "Unwrapped", "Edit/SpecialPaste/Unwrapped", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "SelectAll", "Edit/SelectAll", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Advanced", "Edit/Advanced", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "BackChar", "Edit/Advanced/BackChar", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "ForwChar", "Edit/Advanced/ForwChar", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "BackWord", "Edit/Advanced/BackWord", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "ForwWord", "Edit/Advanced/ForwWord", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "BegLine", "Edit/Advanced/BegLine", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "EndLine", "Edit/Advanced/EndLine", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "PrevLine", "Edit/Advanced/PrevLine", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "NextLine", "Edit/Advanced/NextLine", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "DelBackChar", "Edit/Advanced/DelBackChar", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "DelForwChar", "Edit/Advanced/DelForwChar", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "DelBackWord", "Edit/Advanced/DelBackWord", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "DelForwWord", "Edit/Advanced/DelForwWord", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "DelLine", "Edit/Advanced/DelLine", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit/Advanced", "DelEndLine", "Edit/Advanced/DelEndLine", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Separator2", "Edit/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Find", "Edit/Find", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "WrapPara", "Edit/WrapPara", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "WrapAllLines", "Edit/WrapAllLines", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "AutoWrap", "Edit/AutoWrap", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "Separator3", "Edit/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Edit", "ExtEditor", "Edit/ExtEditor", GTK_UI_MANAGER_MENUITEM) + +#if USE_ASPELL +/* Spelling menu */ + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Spelling", "CheckAllSel", "Spelling/CheckAllSel", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Spelling", "HighlightAll", "Spelling/HighlightAll", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Spelling", "CheckBackwards", "Spelling/CheckBackwards", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Spelling", "ForwardNext", "Spelling/ForwardNext", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Spelling", "Separator1", "Spelling/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Spelling", "Options", "Spelling/Options", GTK_UI_MANAGER_MENU) +#endif + +/* Options menu */ + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "ReplyMode", "Options/ReplyMode", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/ReplyMode", "Normal", "Options/ReplyMode/Normal", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/ReplyMode", "All", "Options/ReplyMode/All", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/ReplyMode", "Sender", "Options/ReplyMode/Sender", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/ReplyMode", "List", "Options/ReplyMode/List", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator1", "Options/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "PrivacySystem", "Options/PrivacySystem", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/PrivacySystem", "PlaceHolder", "Options/PrivacySystem/PlaceHolder", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Sign", "Options/Sign", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Encrypt", "Options/Encrypt", GTK_UI_MANAGER_MENUITEM) + + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator2", "Options/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Priority", "Options/Priority", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Priority", "Highest", "Options/Priority/Highest", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Priority", "High", "Options/Priority/High", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Priority", "Normal", "Options/Priority/Normal", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Priority", "Low", "Options/Priority/Low", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Priority", "Lowest", "Options/Priority/Lowest", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator3", "Options/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "RequestRetRcpt", "Options/RequestRetRcpt", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator4", "Options/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "RemoveReferences", "Options/RemoveReferences", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Separator5", "Options/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options", "Encoding", "Options/Encoding", GTK_UI_MANAGER_MENU) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", CS_AUTO, "Options/Encoding/"CS_AUTO, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Separator1", "Options/Encoding/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", CS_US_ASCII, "Options/Encoding/"CS_US_ASCII, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", CS_UTF_8, "Options/Encoding/"CS_UTF_8, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Separator2", "Options/Encoding/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Western", "Options/Encoding/Western", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Western", CS_ISO_8859_1, "Options/Encoding/Western/"CS_ISO_8859_1, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Western", CS_ISO_8859_15, "Options/Encoding/Western/"CS_ISO_8859_15, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Western", CS_WINDOWS_1252, "Options/Encoding/Western/"CS_WINDOWS_1252, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", CS_ISO_8859_2, "Options/Encoding/"CS_ISO_8859_2, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Baltic", "Options/Encoding/Baltic", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Baltic", CS_ISO_8859_13, "Options/Encoding/Baltic/"CS_ISO_8859_13, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Baltic", CS_ISO_8859_4, "Options/Encoding/Baltic/"CS_ISO_8859_4, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", CS_ISO_8859_7, "Options/Encoding/"CS_ISO_8859_7, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Hebrew", "Options/Encoding/Hebrew", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Hebrew", CS_ISO_8859_8, "Options/Encoding/Hebrew/"CS_ISO_8859_8, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Hebrew", CS_WINDOWS_1255, "Options/Encoding/Hebrew/"CS_WINDOWS_1255, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Arabic", "Options/Encoding/Arabic", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Arabic", CS_ISO_8859_6, "Options/Encoding/Arabic/"CS_ISO_8859_6, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Arabic", CS_WINDOWS_1256, "Options/Encoding/Arabic/"CS_WINDOWS_1256, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", CS_ISO_8859_9, "Options/Encoding/"CS_ISO_8859_9, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Cyrillic", "Options/Encoding/Cyrillic", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_ISO_8859_5, "Options/Encoding/Cyrillic/"CS_ISO_8859_5, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_KOI8_R, "Options/Encoding/Cyrillic/"CS_KOI8_R, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_KOI8_U, "Options/Encoding/Cyrillic/"CS_KOI8_U, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Cyrillic", CS_WINDOWS_1251, "Options/Encoding/Cyrillic/"CS_WINDOWS_1251, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Japanese", "Options/Encoding/Japanese", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Japanese", CS_ISO_2022_JP, "Options/Encoding/Japanese/"CS_ISO_2022_JP, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Japanese", CS_ISO_2022_JP_2, "Options/Encoding/Japanese/"CS_ISO_2022_JP_2, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Japanese", CS_EUC_JP, "Options/Encoding/Japanese/"CS_EUC_JP, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Japanese", CS_SHIFT_JIS, "Options/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Chinese", "Options/Encoding/Chinese", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_GB2312, "Options/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_GBK, "Options/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_BIG5, "Options/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Chinese", CS_EUC_TW, "Options/Encoding/Chinese/"CS_EUC_TW, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Korean", "Options/Encoding/Korean", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Korean", CS_EUC_KR, "Options/Encoding/Korean/"CS_EUC_KR, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Korean", CS_ISO_2022_KR, "Options/Encoding/Korean/"CS_ISO_2022_KR, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding", "Thai", "Options/Encoding/Thai", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Thai", CS_TIS_620, "Options/Encoding/Thai/"CS_TIS_620, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Options/Encoding/Thai", CS_WINDOWS_874, "Options/Encoding/Thai/"CS_WINDOWS_874, GTK_UI_MANAGER_MENUITEM) +/* phew. */ + +/* Tools menu */ + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools", "ShowRuler", "Tools/ShowRuler", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools", "Template", "Tools/Template", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools/Template", "PlaceHolder", "Tools/Template/PlaceHolder", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools", "Actions", "Tools/Actions", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Tools/Actions", "PlaceHolder", "Tools/Actions/PlaceHolder", GTK_UI_MANAGER_MENUITEM) + +/* Help menu */ + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Menu/Help", "About", "Help/About", GTK_UI_MANAGER_MENUITEM) + + menubar = gtk_ui_manager_get_widget(compose->ui_manager, "/Menu"); + gtk_widget_show_all(menubar); + + gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(compose->ui_manager)); gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); if (prefs_common.toolbar_detachable) { @@ -6963,22 +7033,26 @@ static Compose *compose_create(PrefsAccount *account, } } - n_entries = sizeof(compose_popup_entries) / - sizeof(compose_popup_entries[0]); - popupmenu = menu_create_items(compose_popup_entries, n_entries, - "", &popupfactory, - compose); + gtk_action_group_add_actions(action_group, compose_popup_entries, + G_N_ELEMENTS(compose_popup_entries), (gpointer)compose); + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/", "Popup", NULL, GTK_UI_MANAGER_MENUBAR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Popup", "Compose", "Compose", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Popup/Compose", "Add", "Compose/Add", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Popup/Compose", "Remove", "Compose/Remove", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Popup/Compose", "Separator1", "Compose/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(compose->ui_manager, "/Popup/Compose", "Properties", "Compose/Properties", GTK_UI_MANAGER_MENUITEM) + + popupmenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtk_ui_manager_get_widget(compose->ui_manager, "/Popup/Compose"))); - ifactory = gtk_item_factory_from_widget(menubar); - menu_set_sensitive(ifactory, "/Edit/Undo", FALSE); - menu_set_sensitive(ifactory, "/Edit/Redo", FALSE); - menu_set_sensitive(ifactory, "/Options/Remove references", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Undo", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Redo", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/RemoveReferences", FALSE); - tmpl_menu = gtk_item_factory_get_item(ifactory, "/Tools/Template"); + tmpl_menu = gtk_ui_manager_get_widget(compose->ui_manager, "/Menu/Tools/Template"); undostruct = undo_init(text); undo_set_change_state_func(undostruct, &compose_undo_state_changed, - menubar); + compose); address_completion_start(window); @@ -7003,7 +7077,6 @@ static Compose *compose_create(PrefsAccount *account, compose->focused_editable = NULL; compose->popupmenu = popupmenu; - compose->popupfactory = popupfactory; compose->tmpl_menu = tmpl_menu; @@ -7049,7 +7122,7 @@ static Compose *compose_create(PrefsAccount *account, compose->draft_timeout_tag = -2; /* inhibit auto-drafting while loading */ #if USE_ASPELL - menu_set_sensitive(ifactory, "/Spelling", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", FALSE); if (mode != COMPOSE_REDIRECT) { if (prefs_common.enable_aspell && prefs_common.dictionary && strcmp(prefs_common.dictionary, "")) { @@ -7080,7 +7153,7 @@ static Compose *compose_create(PrefsAccount *account, gtkaspell_checkers_reset_error(); } - menu_set_sensitive(ifactory, "/Spelling", TRUE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", TRUE); } } } @@ -7090,7 +7163,8 @@ static Compose *compose_create(PrefsAccount *account, compose_select_account(compose, account, TRUE); - menu_set_active(ifactory, "/Edit/Auto wrapping", prefs_common.autowrap); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Edit/AutoWrap", prefs_common.autowrap); + if (account->set_autocc && account->auto_cc && mode != COMPOSE_REEDIT) compose_entry_append(compose, account->auto_cc, COMPOSE_CC); @@ -7100,8 +7174,7 @@ static Compose *compose_create(PrefsAccount *account, if (account->set_autoreplyto && account->auto_replyto && mode != COMPOSE_REEDIT) compose_entry_append(compose, account->auto_replyto, COMPOSE_REPLYTO); - menu_set_sensitive(ifactory, "/Options/Reply mode", compose->mode == COMPOSE_REPLY); - + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/ReplyMode", compose->mode == COMPOSE_REPLY); if (account->protocol != A_NNTP) gtk_entry_set_text(GTK_ENTRY(GTK_BIN(compose->header_last->combo)->child), prefs_common_translated_header_name("To:")); @@ -7114,8 +7187,7 @@ static Compose *compose_create(PrefsAccount *account, if (mode != COMPOSE_REDIRECT) compose_set_template_menu(compose); else { - menuitem = gtk_item_factory_get_item(ifactory, "/Tools/Template"); - menu_set_sensitive(ifactory, "/Tools/Template", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Tools/Template", FALSE); } compose_list = g_list_append(compose_list, compose); @@ -7123,9 +7195,7 @@ static Compose *compose_create(PrefsAccount *account, if (!prefs_common.show_ruler) gtk_widget_hide(ruler_hbox); - menuitem = gtk_item_factory_get_item(ifactory, "/Tools/Show ruler"); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), - prefs_common.show_ruler); + cm_toggle_menu_set_active_full(compose->ui_manager, "Menu/Tools/ShowRuler", prefs_common.show_ruler); /* Priority */ compose->priority = PRIORITY_NORMAL; @@ -7231,19 +7301,20 @@ static GtkWidget *compose_account_option_menu_create(Compose *compose) return hbox; } -static void compose_set_priority_cb(gpointer data, - guint action, - GtkWidget *widget) +static void compose_set_priority_cb(GtkAction *action, GtkRadioAction *current, gpointer data) { + gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)); + gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current)); Compose *compose = (Compose *) data; - compose->priority = action; + if (active) { + printf("activated %d\n", value); + compose->priority = value; + } } -static void compose_reply_change_mode(gpointer data, - ComposeMode action, - GtkWidget *widget) +static void compose_reply_change_mode(Compose *compose, + ComposeMode action) { - Compose *compose = (Compose *) data; gboolean was_modified = compose->modified; gboolean all = FALSE, ml = FALSE, sender = FALSE, followup = FALSE; @@ -7276,33 +7347,39 @@ static void compose_reply_change_mode(gpointer data, compose_set_title(compose); } +static void compose_reply_change_mode_cb(GtkAction *action, GtkRadioAction *current, gpointer data) +{ + gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)); + gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current)); + Compose *compose = (Compose *) data; + + if (active) + compose_reply_change_mode(compose, value); +} + static void compose_update_priority_menu_item(Compose * compose) { - GtkItemFactory *ifactory; GtkWidget *menuitem = NULL; - - ifactory = gtk_item_factory_from_widget(compose->menubar); - switch (compose->priority) { case PRIORITY_HIGHEST: - menuitem = gtk_item_factory_get_item - (ifactory, "/Options/Priority/Highest"); + menuitem = gtk_ui_manager_get_widget + (compose->ui_manager, "/Menu/Options/Priority/Highest"); break; case PRIORITY_HIGH: - menuitem = gtk_item_factory_get_item - (ifactory, "/Options/Priority/High"); + menuitem = gtk_ui_manager_get_widget + (compose->ui_manager, "/Menu/Options/Priority/High"); break; case PRIORITY_NORMAL: - menuitem = gtk_item_factory_get_item - (ifactory, "/Options/Priority/Normal"); + menuitem = gtk_ui_manager_get_widget + (compose->ui_manager, "/Menu/Options/Priority/Normal"); break; case PRIORITY_LOW: - menuitem = gtk_item_factory_get_item - (ifactory, "/Options/Priority/Low"); + menuitem = gtk_ui_manager_get_widget + (compose->ui_manager, "/Menu/Options/Priority/Low"); break; case PRIORITY_LOWEST: - menuitem = gtk_item_factory_get_item - (ifactory, "/Options/Priority/Lowest"); + menuitem = gtk_ui_manager_get_widget + (compose->ui_manager, "/Menu/Options/Priority/Lowest"); break; } gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE); @@ -7312,7 +7389,6 @@ static void compose_set_privacy_system_cb(GtkWidget *widget, gpointer data) { Compose *compose = (Compose *) data; gchar *systemid; - GtkItemFactory *ifactory; gboolean can_sign = FALSE, can_encrypt = FALSE; g_return_if_fail(GTK_IS_CHECK_MENU_ITEM(widget)); @@ -7332,25 +7408,22 @@ static void compose_set_privacy_system_cb(GtkWidget *widget, gpointer data) debug_print("activated privacy system: %s\n", systemid != NULL ? systemid : "None"); - ifactory = gtk_item_factory_from_widget(compose->menubar); - menu_set_sensitive(ifactory, "/Options/Sign", can_sign); - menu_set_sensitive(ifactory, "/Options/Encrypt", can_encrypt); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Sign", can_sign); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Encrypt", can_encrypt); } static void compose_update_privacy_system_menu_item(Compose * compose, gboolean warn) { - static gchar *branch_path = "/Options/Privacy System"; - GtkItemFactory *ifactory; + static gchar *branch_path = "/Menu/Options/PrivacySystem"; GtkWidget *menuitem = NULL; GList *amenu; gboolean can_sign = FALSE, can_encrypt = FALSE; gboolean found = FALSE; - ifactory = gtk_item_factory_from_widget(compose->menubar); - if (compose->privacy_system != NULL) { gchar *systemid; - menuitem = gtk_item_factory_get_widget(ifactory, branch_path); + menuitem = gtk_menu_item_get_submenu(GTK_MENU_ITEM( + gtk_ui_manager_get_widget(compose->ui_manager, branch_path))); g_return_if_fail(menuitem != NULL); amenu = GTK_MENU_SHELL(menuitem)->children; @@ -7389,43 +7462,51 @@ static void compose_update_privacy_system_menu_item(Compose * compose, gboolean } } - menu_set_sensitive(ifactory, "/Options/Sign", can_sign); - menu_set_sensitive(ifactory, "/Options/Encrypt", can_encrypt); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Sign", can_sign); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options/Encrypt", can_encrypt); } static void compose_set_out_encoding(Compose *compose) { - GtkItemFactoryEntry *entry; - GtkItemFactory *ifactory; CharSet out_encoding; - gchar *path, *p, *q; - GtkWidget *item; - + const gchar *branch = NULL; out_encoding = conv_get_charset_from_str(prefs_common.outgoing_charset); - ifactory = gtk_item_factory_from_widget(compose->menubar); - - for (entry = compose_entries; entry->callback != compose_address_cb; - entry++) { - if (entry->callback == compose_set_encoding_cb && - (CharSet)entry->callback_action == out_encoding) { - p = q = path = g_strdup(entry->path); - while (*p) { - if (*p == '_') { - if (p[1] == '_') { - p++; - *q++ = '_'; - } - } else - *q++ = *p; - p++; - } - *q = '\0'; - item = gtk_item_factory_get_item(ifactory, path); - gtk_widget_activate(item); - g_free(path); - break; - } - } + + switch(out_encoding) { + case C_AUTO: branch = "Menu/Options/Encoding/" CS_AUTO; break; + case C_US_ASCII: branch = "Menu/Options/Encoding/" CS_US_ASCII; break; + case C_UTF_8: branch = "Menu/Options/Encoding/" CS_UTF_8; break; + case C_ISO_8859_2: branch = "Menu/Options/Encoding/" CS_ISO_8859_2; break; + case C_ISO_8859_7: branch = "Menu/Options/Encoding/" CS_ISO_8859_7; break; + case C_ISO_8859_9: branch = "Menu/Options/Encoding/" CS_ISO_8859_9; break; + case C_ISO_8859_1: branch = "Menu/Options/Encoding/Western/" CS_ISO_8859_1; break; + case C_ISO_8859_15: branch = "Menu/Options/Encoding/Western/" CS_ISO_8859_15; break; + case C_WINDOWS_1252: branch = "Menu/Options/Encoding/Western/" CS_WINDOWS_1252; break; + case C_ISO_8859_13: branch = "Menu/Options/Encoding/Baltic/" CS_ISO_8859_13; break; + case C_ISO_8859_4: branch = "Menu/Options/Encoding/Baltic" CS_ISO_8859_4; break; + case C_ISO_8859_8: branch = "Menu/Options/Encoding/Hebrew/" CS_ISO_8859_8; break; + case C_WINDOWS_1255: branch = "Menu/Options/Encoding/Hebrew/" CS_WINDOWS_1255; break; + case C_ISO_8859_6: branch = "Menu/Options/Encoding/Arabic/" CS_ISO_8859_6; break; + case C_WINDOWS_1256: branch = "Menu/Options/Encoding/Arabic/" CS_WINDOWS_1256; break; + case C_ISO_8859_5: branch = "Menu/Options/Encoding/Cyrillic/" CS_ISO_8859_5; break; + case C_KOI8_R: branch = "Menu/Options/Encoding/Cyrillic/" CS_KOI8_R; break; + case C_KOI8_U: branch = "Menu/Options/Encoding/Cyrillic/" CS_KOI8_U; break; + case C_WINDOWS_1251: branch = "Menu/Options/Encoding/Cyrillic/" CS_WINDOWS_1251; break; + case C_ISO_2022_JP: branch = "Menu/Options/Encoding/Japanese/" CS_ISO_2022_JP; break; + case C_ISO_2022_JP_2: branch = "Menu/Options/Encoding/Japanese/" CS_ISO_2022_JP_2; break; + case C_EUC_JP: branch = "Menu/Options/Encoding/Japanese/" CS_EUC_JP; break; + case C_SHIFT_JIS: branch = "Menu/Options/Encoding/Japanese/" CS_SHIFT_JIS; break; + case C_GB2312: branch = "Menu/Options/Encoding/Chinese/" CS_GB2312; break; + case C_GBK: branch = "Menu/Options/Encoding/Chinese/" CS_GBK; break; + case C_BIG5: branch = "Menu/Options/Encoding/Chinese/" CS_BIG5; break; + case C_EUC_TW: branch = "Menu/Options/Encoding/Chinese/" CS_EUC_TW; break; + case C_EUC_KR: branch = "Menu/Options/Encoding/Korean/" CS_EUC_KR; break; + case C_ISO_2022_KR: branch = "Menu/Options/Encoding/Korean/" CS_ISO_2022_KR; break; + case C_TIS_620: branch = "Menu/Options/Encoding/Thai/" CS_TIS_620; break; + case C_WINDOWS_874: branch = "Menu/Options/Encoding/Thai/" CS_WINDOWS_874; break; + default: branch = "Menu/Options/Encoding/" CS_AUTO; break; + } + cm_toggle_menu_set_active_full(compose->ui_manager, (gchar *)branch, TRUE); } static void compose_set_template_menu(Compose *compose) @@ -7438,9 +7519,11 @@ static void compose_set_template_menu(Compose *compose) menu = gtk_menu_new(); + gtk_menu_set_accel_group (GTK_MENU (menu), + gtk_ui_manager_get_accel_group(compose->ui_manager)); for (cur = tmpl_list; cur != NULL; cur = cur->next) { Template *tmpl = (Template *)cur->data; - + gchar *accel_path = NULL; item = gtk_menu_item_new_with_label(tmpl->name); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); g_signal_connect(G_OBJECT(item), "activate", @@ -7448,6 +7531,9 @@ static void compose_set_template_menu(Compose *compose) compose); g_object_set_data(G_OBJECT(item), "template", tmpl); gtk_widget_show(item); + accel_path = g_strconcat("" , "/", tmpl->name, NULL); + gtk_menu_item_set_accel_path(item, accel_path); + g_free(accel_path); } gtk_widget_show(menu); @@ -7456,42 +7542,28 @@ static void compose_set_template_menu(Compose *compose) void compose_update_actions_menu(Compose *compose) { - GtkItemFactory *ifactory; - - ifactory = gtk_item_factory_from_widget(compose->menubar); - action_update_compose_menu(ifactory, "/Tools/Actions", compose); + action_update_compose_menu(compose->ui_manager, "/Menu/Tools/Actions", compose); } static void compose_update_privacy_systems_menu(Compose *compose) { - static gchar *branch_path = "/Options/Privacy System"; - GtkItemFactory *ifactory; - GtkWidget *menuitem; + static gchar *branch_path = "/Menu/Options/PrivacySystem"; GSList *systems, *cur; - GList *amenu; GtkWidget *widget; GtkWidget *system_none; GSList *group; + GtkWidget *privacy_menuitem = gtk_ui_manager_get_widget(compose->ui_manager, branch_path); + GtkWidget *privacy_menu = gtk_menu_new(); - ifactory = gtk_item_factory_from_widget(compose->menubar); - - /* remove old entries */ - menuitem = gtk_item_factory_get_widget(ifactory, branch_path); - g_return_if_fail(menuitem != NULL); - - amenu = GTK_MENU_SHELL(menuitem)->children->next; - while (amenu != NULL) { - GList *alist = amenu->next; - gtk_widget_destroy(GTK_WIDGET(amenu->data)); - amenu = alist; - } - - system_none = gtk_item_factory_get_widget(ifactory, - "/Options/Privacy System/None"); + system_none = gtk_radio_menu_item_new_with_mnemonic(NULL, _("_None")); + g_object_set_data_full(G_OBJECT(system_none), "privacy_system", NULL, NULL); g_signal_connect(G_OBJECT(system_none), "activate", G_CALLBACK(compose_set_privacy_system_cb), compose); + gtk_menu_shell_append(GTK_MENU_SHELL(privacy_menu), system_none); + gtk_widget_show(system_none); + systems = privacy_get_system_ids(); for (cur = systems; cur != NULL; cur = g_slist_next(cur)) { gchar *systemid = cur->data; @@ -7504,11 +7576,14 @@ static void compose_update_privacy_systems_menu(Compose *compose) g_signal_connect(G_OBJECT(widget), "activate", G_CALLBACK(compose_set_privacy_system_cb), compose); - gtk_menu_append(GTK_MENU(system_none->parent), widget); + gtk_menu_shell_append(GTK_MENU_SHELL(privacy_menu), widget); gtk_widget_show(widget); g_free(systemid); } g_slist_free(systems); + gtk_menu_item_set_submenu(GTK_MENU_ITEM(privacy_menuitem), privacy_menu); + gtk_widget_show_all(privacy_menu); + gtk_widget_show_all(privacy_menuitem); } void compose_reflect_prefs_all(void) @@ -7886,8 +7961,9 @@ static void compose_attach_update_label(Compose *compose) g_free(text); } -static void compose_attach_remove_selected(Compose *compose) +static void compose_attach_remove_selected(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist); GtkTreeSelection *selection; GList *sel, *cur; @@ -7939,8 +8015,9 @@ static void gtk_tree_path_free_(gpointer ptr, gpointer data) gtk_tree_path_free((GtkTreePath *)ptr); } -static void compose_attach_property(Compose *compose) +static void compose_attach_property(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist); AttachInfo *ainfo; GtkComboBox *optmenu; @@ -8442,18 +8519,13 @@ static gboolean compose_input_cb(GIOChannel *source, GIOCondition condition, static void compose_set_ext_editor_sensitive(Compose *compose, gboolean sensitive) { - GtkItemFactory *ifactory; - - ifactory = gtk_item_factory_from_widget(compose->menubar); - - menu_set_sensitive(ifactory, "/Message/Send", sensitive); - menu_set_sensitive(ifactory, "/Message/Send later", sensitive); - menu_set_sensitive(ifactory, "/Message/Insert file", sensitive); - menu_set_sensitive(ifactory, "/Message/Insert signature", sensitive); - menu_set_sensitive(ifactory, "/Edit/Wrap current paragraph", sensitive); - menu_set_sensitive(ifactory, "/Edit/Wrap all long lines", sensitive); - menu_set_sensitive(ifactory, "/Edit/Edit with external editor", - sensitive); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/Send", sensitive); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/SendLater", sensitive); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/InsertFile", sensitive); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message/InsertSig", sensitive); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/WrapPara", sensitive); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/WrapAllLines", sensitive); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/ExtEditor", sensitive); gtk_widget_set_sensitive(compose->text, sensitive); if (compose->toolbar->send_btn) @@ -8483,31 +8555,25 @@ static void compose_set_ext_editor_sensitive(Compose *compose, static void compose_undo_state_changed(UndoMain *undostruct, gint undo_state, gint redo_state, gpointer data) { - GtkWidget *widget = GTK_WIDGET(data); - GtkItemFactory *ifactory; - - g_return_if_fail(widget != NULL); - - ifactory = gtk_item_factory_from_widget(widget); + Compose *compose = (Compose *)data; switch (undo_state) { case UNDO_STATE_TRUE: if (!undostruct->undo_state) { undostruct->undo_state = TRUE; - menu_set_sensitive(ifactory, "/Edit/Undo", TRUE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Undo", TRUE); } break; case UNDO_STATE_FALSE: if (undostruct->undo_state) { undostruct->undo_state = FALSE; - menu_set_sensitive(ifactory, "/Edit/Undo", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Undo", FALSE); } break; case UNDO_STATE_UNCHANGED: break; case UNDO_STATE_REFRESH: - menu_set_sensitive(ifactory, "/Edit/Undo", - undostruct->undo_state); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Undo", undostruct->undo_state); break; default: g_warning("Undo state not recognized"); @@ -8518,20 +8584,19 @@ static void compose_undo_state_changed(UndoMain *undostruct, gint undo_state, case UNDO_STATE_TRUE: if (!undostruct->redo_state) { undostruct->redo_state = TRUE; - menu_set_sensitive(ifactory, "/Edit/Redo", TRUE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Redo", TRUE); } break; case UNDO_STATE_FALSE: if (undostruct->redo_state) { undostruct->redo_state = FALSE; - menu_set_sensitive(ifactory, "/Edit/Redo", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Redo", FALSE); } break; case UNDO_STATE_UNCHANGED: break; case UNDO_STATE_REFRESH: - menu_set_sensitive(ifactory, "/Edit/Redo", - undostruct->redo_state); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit/Redo", undostruct->redo_state); break; default: g_warning("Redo state not recognized"); @@ -8607,7 +8672,7 @@ static void account_activated(GtkComboBox *optmenu, gpointer data) static void attach_selected(GtkTreeView *tree_view, GtkTreePath *tree_path, GtkTreeViewColumn *column, Compose *compose) { - compose_attach_property(compose); + compose_attach_property(NULL, compose); } static gboolean attach_button_pressed(GtkWidget *widget, GdkEventButton *event, @@ -8616,22 +8681,20 @@ static gboolean attach_button_pressed(GtkWidget *widget, GdkEventButton *event, Compose *compose = (Compose *)data; GtkTreeSelection *attach_selection; gint attach_nr_selected; - GtkItemFactory *ifactory; if (!event) return FALSE; if (event->button == 3) { attach_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget)); attach_nr_selected = gtk_tree_selection_count_selected_rows(attach_selection); - ifactory = gtk_item_factory_from_widget(compose->popupmenu); if (attach_nr_selected > 0) { - menu_set_sensitive(ifactory, "/Remove", TRUE); - menu_set_sensitive(ifactory, "/Properties...", TRUE); + cm_menu_set_sensitive_full(compose->ui_manager, "Popup/Compose/Remove", TRUE); + cm_menu_set_sensitive_full(compose->ui_manager, "Popup/Compose/Properties", TRUE); } else { - menu_set_sensitive(ifactory, "/Remove", FALSE); - menu_set_sensitive(ifactory, "/Properties...", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Popup/Compose/Remove", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Popup/Compose/Properties", FALSE); } gtk_menu_popup(GTK_MENU(compose->popupmenu), NULL, NULL, @@ -8651,7 +8714,7 @@ static gboolean attach_key_pressed(GtkWidget *widget, GdkEventKey *event, switch (event->keyval) { case GDK_Delete: - compose_attach_remove_selected(compose); + compose_attach_remove_selected(NULL, compose); break; } return FALSE; @@ -8659,22 +8722,21 @@ static gboolean attach_key_pressed(GtkWidget *widget, GdkEventKey *event, static void compose_allow_user_actions (Compose *compose, gboolean allow) { - GtkItemFactory *ifactory = gtk_item_factory_from_widget(compose->menubar); toolbar_comp_set_sensitive(compose, allow); - menu_set_sensitive(ifactory, "/Message", allow); - menu_set_sensitive(ifactory, "/Edit", allow); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Message", allow); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Edit", allow); #if USE_ASPELL - menu_set_sensitive(ifactory, "/Spelling", allow); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", allow); #endif - menu_set_sensitive(ifactory, "/Options", allow); - menu_set_sensitive(ifactory, "/Tools", allow); - menu_set_sensitive(ifactory, "/Help", allow); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Options", allow); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Tools", allow); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Help", allow); gtk_text_view_set_editable(GTK_TEXT_VIEW(compose->text), allow); } -static void compose_send_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_send_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; @@ -8692,8 +8754,7 @@ static void compose_send_cb(gpointer data, guint action, GtkWidget *widget) compose_send(compose); } -static void compose_send_later_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_send_later_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; gint val; @@ -8996,9 +9057,9 @@ void compose_reopen_exit_drafts(void) compose_clear_exit_drafts(); } -static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_save_cb(GtkAction *action, gpointer data) { - compose_draft(data, action); + compose_draft(data, COMPOSE_KEEP_EDITING); } static void compose_attach_from_list(Compose *compose, GList *file_list, gboolean free_data) @@ -9020,7 +9081,7 @@ static void compose_attach_from_list(Compose *compose, GList *file_list, gboolea } } -static void compose_attach_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_attach_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; GList *file_list; @@ -9036,8 +9097,7 @@ static void compose_attach_cb(gpointer data, guint action, GtkWidget *widget) } } -static void compose_insert_file_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_insert_file_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; GList *file_list; @@ -9068,8 +9128,7 @@ static void compose_insert_file_cb(gpointer data, guint action, } } -static void compose_insert_sig_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_insert_sig_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; @@ -9088,16 +9147,16 @@ static gint compose_delete_cb(GtkWidget *widget, GdkEventAny *event, if (compose->sending || compose->updating) return TRUE; - compose_close_cb(compose, 0, NULL); + compose_close_cb(NULL, compose); return TRUE; } void compose_close_toolbar(Compose *compose) { - compose_close_cb(compose, 0, NULL); + compose_close_cb(NULL, compose); } -static void compose_close_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_close_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; AlertValue val; @@ -9128,7 +9187,7 @@ static void compose_close_cb(gpointer data, guint action, GtkWidget *widget) compose_remove_draft(compose); break; case G_ALERTALTERNATE: - compose_draft_cb(data, COMPOSE_QUIT_EDITING, NULL); + compose_draft(data, COMPOSE_QUIT_EDITING); return; default: return; @@ -9138,22 +9197,28 @@ static void compose_close_cb(gpointer data, guint action, GtkWidget *widget) compose_close(compose); } -static void compose_set_encoding_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_set_encoding_cb(GtkAction *action, GtkRadioAction *current, gpointer data) { - Compose *compose = (Compose *)data; + gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)); + gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current)); + Compose *compose = (Compose *) data; - if (GTK_CHECK_MENU_ITEM(widget)->active) - compose->out_encoding = (CharSet)action; + if (active) + compose->out_encoding = (CharSet)value; } -static void compose_address_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_address_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; addressbook_open(compose); } +static void about_show_cb(GtkAction *action, gpointer data) +{ + about_show(); +} + static void compose_template_activate_cb(GtkWidget *widget, gpointer data) { Compose *compose = (Compose *)data; @@ -9176,16 +9241,16 @@ static void compose_template_activate_cb(GtkWidget *widget, gpointer data) compose_template_apply(compose, tmpl, FALSE); } -static void compose_ext_editor_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_ext_editor_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; compose_exec_ext_editor(compose); } -static void compose_undo_cb(Compose *compose) +static void compose_undo_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; gboolean prev_autowrap = compose->autowrap; compose->autowrap = FALSE; @@ -9193,8 +9258,9 @@ static void compose_undo_cb(Compose *compose) compose->autowrap = prev_autowrap; } -static void compose_redo_cb(Compose *compose) +static void compose_redo_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; gboolean prev_autowrap = compose->autowrap; compose->autowrap = FALSE; @@ -9295,8 +9361,9 @@ static void entry_allsel(GtkWidget *entry) } } -static void compose_cut_cb(Compose *compose) +static void compose_cut_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; if (compose->focused_editable #ifndef GENERIC_UMPC && GTK_WIDGET_HAS_FOCUS(compose->focused_editable) @@ -9305,8 +9372,9 @@ static void compose_cut_cb(Compose *compose) entry_cut_clipboard(compose->focused_editable); } -static void compose_copy_cb(Compose *compose) +static void compose_copy_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; if (compose->focused_editable #ifndef GENERIC_UMPC && GTK_WIDGET_HAS_FOCUS(compose->focused_editable) @@ -9315,8 +9383,9 @@ static void compose_copy_cb(Compose *compose) entry_copy_clipboard(compose->focused_editable); } -static void compose_paste_cb(Compose *compose) +static void compose_paste_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; gint prev_autowrap; GtkTextBuffer *buffer; BLOCK_WRAP(); @@ -9328,8 +9397,9 @@ static void compose_paste_cb(Compose *compose) UNBLOCK_WRAP(); } -static void compose_paste_as_quote_cb(Compose *compose) +static void compose_paste_as_quote_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; gint wrap_quote = prefs_common.linewrap_quote; if (compose->focused_editable #ifndef GENERIC_UMPC @@ -9354,8 +9424,9 @@ static void compose_paste_as_quote_cb(Compose *compose) } } -static void compose_paste_no_wrap_cb(Compose *compose) +static void compose_paste_no_wrap_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; gint prev_autowrap; GtkTextBuffer *buffer; BLOCK_WRAP(); @@ -9369,8 +9440,9 @@ static void compose_paste_no_wrap_cb(Compose *compose) UNBLOCK_WRAP(); } -static void compose_paste_wrap_cb(Compose *compose) +static void compose_paste_wrap_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; gint prev_autowrap; GtkTextBuffer *buffer; BLOCK_WRAP(); @@ -9384,8 +9456,9 @@ static void compose_paste_wrap_cb(Compose *compose) UNBLOCK_WRAP(); } -static void compose_allsel_cb(Compose *compose) +static void compose_allsel_cb(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; if (compose->focused_editable #ifndef GENERIC_UMPC && GTK_WIDGET_HAS_FOCUS(compose->focused_editable) @@ -9640,10 +9713,39 @@ static void textview_delete_to_line_end (GtkTextView *text) gtk_text_buffer_delete(buffer, &ins, &end_iter); } -static void compose_advanced_action_cb(Compose *compose, - ComposeCallAdvancedAction action) +#define DO_ACTION(name, act) { \ + if(!strcmp(name, a_name)) { \ + return act; \ + } \ +} +static ComposeCallAdvancedAction compose_call_advanced_action_from_path(GtkAction *action) +{ + const gchar *a_name = gtk_action_get_name(action); + DO_ACTION("Edit/Advanced/BackChar", COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_CHARACTER); + DO_ACTION("Edit/Advanced/ForwChar", COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_CHARACTER); + DO_ACTION("Edit/Advanced/BackWord", COMPOSE_CALL_ADVANCED_ACTION_MOVE_BACKWARD_WORD); + DO_ACTION("Edit/Advanced/ForwWord", COMPOSE_CALL_ADVANCED_ACTION_MOVE_FORWARD_WORD); + DO_ACTION("Edit/Advanced/BegLine", COMPOSE_CALL_ADVANCED_ACTION_MOVE_BEGINNING_OF_LINE); + DO_ACTION("Edit/Advanced/EndLine", COMPOSE_CALL_ADVANCED_ACTION_MOVE_END_OF_LINE); + DO_ACTION("Edit/Advanced/PrevLine", COMPOSE_CALL_ADVANCED_ACTION_MOVE_PREVIOUS_LINE); + DO_ACTION("Edit/Advanced/NextLine", COMPOSE_CALL_ADVANCED_ACTION_MOVE_NEXT_LINE); + DO_ACTION("Edit/Advanced/DelBackChar", COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_CHARACTER); + DO_ACTION("Edit/Advanced/DelForwChar", COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_CHARACTER); + DO_ACTION("Edit/Advanced/DelBackWord", COMPOSE_CALL_ADVANCED_ACTION_DELETE_BACKWARD_WORD); + DO_ACTION("Edit/Advanced/DelForwWord", COMPOSE_CALL_ADVANCED_ACTION_DELETE_FORWARD_WORD); + DO_ACTION("Edit/Advanced/DelLine", COMPOSE_CALL_ADVANCED_ACTION_DELETE_LINE); + DO_ACTION("Edit/Advanced/DelEndLine", COMPOSE_CALL_ADVANCED_ACTION_DELETE_TO_LINE_END); + return -1; +} + +static void compose_advanced_action_cb(GtkAction *gaction, gpointer data) { + Compose *compose = (Compose *)data; GtkTextView *text = GTK_TEXT_VIEW(compose->text); + ComposeCallAdvancedAction action = -1; + + action = compose_call_advanced_action_from_path(gaction); + static struct { void (*do_action) (GtkTextView *text); } action_table[] = { @@ -9757,53 +9859,47 @@ static void compose_changed_cb(GtkTextBuffer *textbuf, Compose *compose) #endif } -static void compose_wrap_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_wrap_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; + compose_beautify_paragraph(compose, NULL, TRUE); +} - if (action == 1) - compose_wrap_all_full(compose, TRUE); - else - compose_beautify_paragraph(compose, NULL, TRUE); +static void compose_wrap_all_cb(GtkAction *action, gpointer data) +{ + Compose *compose = (Compose *)data; + compose_wrap_all_full(compose, TRUE); } -static void compose_find_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_find_cb(GtkAction *action, gpointer data) { Compose *compose = (Compose *)data; message_search_compose(compose); } -static void compose_toggle_autowrap_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_toggle_autowrap_cb(GtkToggleAction *action, + gpointer data) { Compose *compose = (Compose *)data; - compose->autowrap = GTK_CHECK_MENU_ITEM(widget)->active; + compose->autowrap = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (compose->autowrap) compose_wrap_all_full(compose, TRUE); - compose->autowrap = GTK_CHECK_MENU_ITEM(widget)->active; + compose->autowrap = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); } -static void compose_toggle_sign_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_toggle_sign_cb(GtkToggleAction *action, gpointer data) { Compose *compose = (Compose *)data; - if (GTK_CHECK_MENU_ITEM(widget)->active) - compose->use_signing = TRUE; - else - compose->use_signing = FALSE; + compose->use_signing = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); } -static void compose_toggle_encrypt_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_toggle_encrypt_cb(GtkToggleAction *action, gpointer data) { Compose *compose = (Compose *)data; - if (GTK_CHECK_MENU_ITEM(widget)->active) - compose->use_encryption = TRUE; - else - compose->use_encryption = FALSE; + compose->use_encryption = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); } static void activate_privacy_system(Compose *compose, PrefsAccount *account, gboolean warn) @@ -9814,12 +9910,11 @@ static void activate_privacy_system(Compose *compose, PrefsAccount *account, gbo compose_update_privacy_system_menu_item(compose, warn); } -static void compose_toggle_ruler_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_toggle_ruler_cb(GtkToggleAction *action, gpointer data) { Compose *compose = (Compose *)data; - if (GTK_CHECK_MENU_ITEM(widget)->active) { + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gtk_widget_show(compose->ruler_hbox); prefs_common.show_ruler = TRUE; } else { @@ -10019,23 +10114,21 @@ static void compose_header_drag_received_cb (GtkWidget *widget, gtk_drag_finish(drag_context, TRUE, FALSE, time); } -static void compose_toggle_return_receipt_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_toggle_return_receipt_cb(GtkToggleAction *action, gpointer data) { Compose *compose = (Compose *)data; - if (GTK_CHECK_MENU_ITEM(widget)->active) + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) compose->return_receipt = TRUE; else compose->return_receipt = FALSE; } -static void compose_toggle_remove_refs_cb(gpointer data, guint action, - GtkWidget *widget) +static void compose_toggle_remove_refs_cb(GtkToggleAction *action, gpointer data) { Compose *compose = (Compose *)data; - if (GTK_CHECK_MENU_ITEM(widget)->active) + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) compose->remove_references = TRUE; else compose->remove_references = FALSE; @@ -10201,44 +10294,42 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter, static gint compose_defer_auto_save_draft(Compose *compose) { compose->draft_timeout_tag = -1; - compose_draft_cb((gpointer)compose, COMPOSE_AUTO_SAVE, NULL); + compose_draft((gpointer)compose, COMPOSE_AUTO_SAVE); return FALSE; } #if USE_ASPELL -static void compose_check_all(Compose *compose) +static void compose_check_all(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; if (compose->gtkaspell) gtkaspell_check_all(compose->gtkaspell); } -static void compose_highlight_all(Compose *compose) +static void compose_highlight_all(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; if (compose->gtkaspell) gtkaspell_highlight_all(compose->gtkaspell); } -static void compose_check_backwards(Compose *compose) +static void compose_check_backwards(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; if (compose->gtkaspell) gtkaspell_check_backwards(compose->gtkaspell); else { - GtkItemFactory *ifactory; - ifactory = gtk_item_factory_from_widget(compose->popupmenu); - menu_set_sensitive(ifactory, "/Edit/Check backwards misspelled word", FALSE); - menu_set_sensitive(ifactory, "/Edit/Forward to next misspelled word", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", FALSE); } } -static void compose_check_forwards_go(Compose *compose) +static void compose_check_forwards_go(GtkAction *action, gpointer data) { + Compose *compose = (Compose *)data; if (compose->gtkaspell) gtkaspell_check_forwards_go(compose->gtkaspell); else { - GtkItemFactory *ifactory; - ifactory = gtk_item_factory_from_widget(compose->popupmenu); - menu_set_sensitive(ifactory, "/Edit/Check backwards misspelled word", FALSE); - menu_set_sensitive(ifactory, "/Edit/Forward to next misspelled word", FALSE); + cm_menu_set_sensitive_full(compose->ui_manager, "Menu/Spelling", FALSE); } } #endif diff --git a/src/compose.h b/src/compose.h index 94ef6abb5..53b37c8fb 100644 --- a/src/compose.h +++ b/src/compose.h @@ -24,8 +24,7 @@ typedef struct _Compose Compose; typedef struct _AttachInfo AttachInfo; #include -#include -#include +#include #include "procmsg.h" #include "procmime.h" @@ -129,8 +128,6 @@ struct _Compose GtkWidget *popupmenu; - GtkItemFactory *popupfactory; - GtkWidget *tmpl_menu; ComposeMode mode; @@ -233,6 +230,8 @@ struct _Compose ComposeMode rmode; GtkWidget *first_combo; GtkWidget *first_entry; + + GtkUIManager *ui_manager; }; struct _AttachInfo diff --git a/src/gtk/menu.c b/src/gtk/menu.c index b2c320d7f..89220b3d8 100644 --- a/src/gtk/menu.c +++ b/src/gtk/menu.c @@ -94,6 +94,16 @@ GtkActionGroup *cm_menu_create_action_group(const gchar *name, GtkActionEntry *e return group; } +GtkActionGroup *cm_menu_create_action_group_full(GtkUIManager *manager, const gchar *name, GtkActionEntry *entries, + gint num_entries, gpointer data) +{ + GtkActionGroup *group = gtk_action_group_new(name); + gtk_action_group_set_translate_func(group, menu_translate, NULL, NULL); + gtk_action_group_add_actions(group, entries, num_entries, data); + gtk_ui_manager_insert_action_group(manager, group, 0); + return group; +} + gchar *menu_translate(const gchar *path, gpointer data) { gchar *retval; @@ -120,7 +130,26 @@ void cm_menu_set_sensitive(gchar *menu, gboolean sensitive) { GtkUIManager *gui_manager = gtkut_ui_manager(); GtkWidget *widget; - gchar *path = g_strdup_printf("/Menus/%s/", menu); + gchar *path = g_strdup_printf("Menus/%s", menu); + + cm_menu_set_sensitive_full(gui_manager, path, sensitive); + g_free(path); +} + +void cm_toggle_menu_set_active(gchar *menu, gboolean active) +{ + GtkUIManager *gui_manager = gtkut_ui_manager(); + GtkWidget *widget; + gchar *path = g_strdup_printf("Menus/%s", menu); + + cm_toggle_menu_set_active_full(gui_manager, path, active); + g_free(path); +} + +void cm_menu_set_sensitive_full(GtkUIManager *gui_manager, gchar *menu, gboolean sensitive) +{ + GtkWidget *widget; + gchar *path = g_strdup_printf("/%s/", menu); widget = gtk_ui_manager_get_widget(gui_manager, path); if( !GTK_IS_WIDGET(widget) ) { @@ -135,11 +164,10 @@ void cm_menu_set_sensitive(gchar *menu, gboolean sensitive) g_free(path); } -void cm_toggle_menu_set_active(gchar *menu, gboolean active) +void cm_toggle_menu_set_active_full(GtkUIManager *gui_manager, gchar *menu, gboolean active) { - GtkUIManager *gui_manager = gtkut_ui_manager(); GtkWidget *widget; - gchar *path = g_strdup_printf("/Menus/%s/", menu); + gchar *path = g_strdup_printf("/%s/", menu); widget = gtk_ui_manager_get_widget(gui_manager, path); if( !GTK_IS_WIDGET(widget) ) { diff --git a/src/gtk/menu.h b/src/gtk/menu.h index 8ae544f80..e896a622c 100644 --- a/src/gtk/menu.h +++ b/src/gtk/menu.h @@ -51,6 +51,11 @@ gtk_ui_manager_new_merge_id(gtkut_ui_manager()),\ path, name, action, type, FALSE); +#define MENUITEM_ADDUI_MANAGER(ui_manager, path, name, action, type) \ + gtk_ui_manager_add_ui(ui_manager, \ + gtk_ui_manager_new_merge_id(ui_manager), \ + path, name, action, type, FALSE); + #define MENUITEM_ADDUI_ID(path, name, action, type,id) \ id = gtk_ui_manager_new_merge_id(gtkut_ui_manager()); \ gtk_ui_manager_add_ui(gtkut_ui_manager(), \ @@ -84,8 +89,13 @@ void menu_set_sensitive (GtkItemFactory *ifactory, GtkActionGroup *cm_menu_create_action_group(const gchar *name, GtkActionEntry *entries, gint num_entries, gpointer data); +GtkActionGroup *cm_menu_create_action_group_full(GtkUIManager *ui_manager, + const gchar *name, GtkActionEntry *entries, + gint num_entries, gpointer data); void cm_menu_set_sensitive(gchar *menu, gboolean sensitive); void cm_toggle_menu_set_active(gchar *menu, gboolean active); +void cm_menu_set_sensitive_full(GtkUIManager *gui_manager, gchar *menu, gboolean sensitive); +void cm_toggle_menu_set_active_full(GtkUIManager *gui_manager, gchar *menu, gboolean active); void menu_set_active (GtkItemFactory *ifactory, const gchar *path, diff --git a/src/messageview.c b/src/messageview.c index bb5b648cb..872166124 100644 --- a/src/messageview.c +++ b/src/messageview.c @@ -97,333 +97,265 @@ static void partial_recv_del_clicked (NoticeView *noticeview, MsgInfo *msginfo); static void partial_recv_unmark_clicked (NoticeView *noticeview, MsgInfo *msginfo); -static void save_as_cb (gpointer data, - guint action, - GtkWidget *widget); +static void save_as_cb (GtkAction *action, + gpointer data); #if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT) -static void page_setup_cb (gpointer data, - guint action, - GtkWidget *widget); +static void page_setup_cb (GtkAction *action, + gpointer data); #endif -static void print_cb (gpointer data, - guint action, - GtkWidget *widget); -static void close_cb (gpointer data, - guint action, - GtkWidget *widget); -static void copy_cb (gpointer data, - guint action, - GtkWidget *widget); -static void allsel_cb (gpointer data, - guint action, - GtkWidget *widget); -static void search_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void prev_cb (gpointer data, - guint action, - GtkWidget *widget); -static void next_cb (gpointer data, - guint action, - GtkWidget *widget); -static void prev_unread_cb (gpointer data, - guint action, - GtkWidget *widget); -static void next_unread_cb (gpointer data, - guint action, - GtkWidget *widget); -static void prev_new_cb (gpointer data, - guint action, - GtkWidget *widget); -static void next_new_cb (gpointer data, - guint action, - GtkWidget *widget); -static void prev_marked_cb (gpointer data, - guint action, - GtkWidget *widget); -static void next_marked_cb (gpointer data, - guint action, - GtkWidget *widget); -static void prev_labeled_cb (gpointer data, - guint action, - GtkWidget *widget); -static void next_labeled_cb (gpointer data, - guint action, - GtkWidget *widget); -static void last_read_cb (gpointer data, - guint action, - GtkWidget *widget); -static void parent_cb (gpointer data, - guint action, - GtkWidget *widget); -static void goto_unread_folder_cb (gpointer data, - guint action, - GtkWidget *widget); -static void goto_folder_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void set_charset_cb (gpointer data, - guint action, - GtkWidget *widget); -static void set_decode_cb (gpointer data, - guint action, - GtkWidget *widget); -static void view_source_cb (gpointer data, - guint action, - GtkWidget *widget); -static void show_all_header_cb (gpointer data, - guint action, - GtkWidget *widget); -static void msg_hide_quotes_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void compose_cb (gpointer data, - guint action, - GtkWidget *widget); -static void reply_cb (gpointer data, - guint action, - GtkWidget *widget); +static void print_cb (GtkAction *action, + gpointer data); +static void close_cb (GtkAction *action, + gpointer data); +static void copy_cb (GtkAction *action, + gpointer data); +static void allsel_cb (GtkAction *action, + gpointer data); +static void search_cb (GtkAction *action, + gpointer data); + +static void prev_cb (GtkAction *action, + gpointer data); +static void next_cb (GtkAction *action, + gpointer data); +static void prev_unread_cb (GtkAction *action, + gpointer data); +static void next_unread_cb (GtkAction *action, + gpointer data); +static void prev_new_cb (GtkAction *action, + gpointer data); +static void next_new_cb (GtkAction *action, + gpointer data); +static void prev_marked_cb (GtkAction *action, + gpointer data); +static void next_marked_cb (GtkAction *action, + gpointer data); +static void prev_labeled_cb (GtkAction *action, + gpointer data); +static void next_labeled_cb (GtkAction *action, + gpointer data); +static void last_read_cb (GtkAction *action, + gpointer data); +static void parent_cb (GtkAction *action, + gpointer data); +static void goto_unread_folder_cb (GtkAction *action, + gpointer data); +static void goto_folder_cb (GtkAction *action, + gpointer data); + +static void set_charset_cb (GtkAction *action, GtkRadioAction *current, gpointer data); +static void set_decode_cb (GtkAction *action, GtkRadioAction *current, gpointer data); + +static void view_source_cb (GtkAction *action, + gpointer data); + +static void show_all_header_cb (GtkToggleAction *action, + gpointer data); +static void msg_hide_quotes_cb (GtkToggleAction *action, + gpointer data); + +static void compose_cb (GtkAction *action, + gpointer data); +static void reply_cb (GtkAction *action, + gpointer data); static PrefsAccount *select_account_from_list (GList *ac_list); -static void addressbook_open_cb (gpointer data, - guint action, - GtkWidget *widget); -static void add_address_cb (gpointer data, - guint action, - GtkWidget *widget); -static void create_filter_cb (gpointer data, - guint action, - GtkWidget *widget); -static void create_processing_cb (gpointer data, - guint action, - GtkWidget *widget); -static void open_urls_cb (gpointer data, - guint action, - GtkWidget *widget); - -static void about_cb (gpointer data, - guint action, - GtkWidget *widget); +static void addressbook_open_cb (GtkAction *action, + gpointer data); +static void add_address_cb (GtkAction *action, + gpointer data); +static void create_filter_cb (GtkAction *action, + gpointer data); +static void create_processing_cb (GtkAction *action, + gpointer data); +static void open_urls_cb (GtkAction *action, + gpointer data); + +static void about_cb (GtkAction *action, + gpointer data); static void messageview_update (MessageView *msgview, MsgInfo *old_msginfo); static gboolean messageview_update_msg (gpointer source, gpointer data); -static GList *msgview_list = NULL; -static GtkItemFactoryEntry msgview_entries[] = +static void messageview_nothing_cb (GtkAction *action, gpointer data) { - {N_("/_File"), NULL, NULL, 0, ""}, - {N_("/_File/_Save as..."), "S", save_as_cb, 0, NULL}, + +} + +static GList *msgview_list = NULL; +static GtkActionEntry msgview_entries[] = +{ + {"Menu", NULL, "Menu" }, +/* menus */ + {"File", NULL, N_("_File") }, + {"Edit", NULL, N_("_Edit") }, + {"View", NULL, N_("_View") }, + {"Message", NULL, N_("_Message") }, + {"Tools", NULL, N_("_Tools") }, + {"Help", NULL, N_("_Help") }, + {"PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(messageview_nothing_cb) }, + +/* File menu */ + {"File/SaveAs", NULL, N_("_Save as..."), "S", NULL, G_CALLBACK(save_as_cb) }, #if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT) - {N_("/_File/Page setup..."), NULL, page_setup_cb, 0, NULL}, + {"File/PageSetup", NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) }, #endif - {N_("/_File/_Print..."), "P", print_cb, 0, NULL}, - {N_("/_File/---"), NULL, NULL, 0, ""}, - {N_("/_File/_Close"), "W", close_cb, 0, NULL}, - - {N_("/_Edit"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Copy"), "C", copy_cb, 0, NULL}, - {N_("/_Edit/Select _all"), "A", allsel_cb, 0, NULL}, - {N_("/_Edit/---"), NULL, NULL, 0, ""}, - {N_("/_Edit/_Find in current message..."), - "F", search_cb, 0, NULL}, - - {N_("/_View"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to/_Previous message"), "P", prev_cb, 0, NULL}, - {N_("/_View/_Go to/_Next message"), "N", next_cb, 0, NULL}, - {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to/P_revious unread message"), - "P", prev_unread_cb, 0, NULL}, - {N_("/_View/_Go to/N_ext unread message"), - "N", next_unread_cb, 0, NULL}, - {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to/Previous ne_w message"), NULL, prev_new_cb, 0, NULL}, - {N_("/_View/_Go to/Ne_xt new message"), NULL, next_new_cb, 0, NULL}, - {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to/Previous _marked message"), - NULL, prev_marked_cb, 0, NULL}, - {N_("/_View/_Go to/Next m_arked message"), - NULL, next_marked_cb, 0, NULL}, - {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to/Previous _labeled message"), - NULL, prev_labeled_cb, 0, NULL}, - {N_("/_View/_Go to/Next la_beled message"), - NULL, next_labeled_cb, 0, NULL}, - {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to/Last read message"), - NULL, last_read_cb, 0, NULL}, - {N_("/_View/_Go to/Parent message"), - "Up", parent_cb, 0, NULL}, - {N_("/_View/_Go to/---"), NULL, NULL, 0, ""}, - {N_("/_View/_Go to/Next unread _folder"), "G", goto_unread_folder_cb, 0, NULL}, - {N_("/_View/_Go to/_Other folder..."), "G", goto_folder_cb, 0, NULL}, - {N_("/_View/---"), NULL, NULL, 0, ""}, - -#define ENC_SEPARATOR \ - {N_("/_View/Character _encoding/---"), NULL, NULL, 0, ""} -#define ENC_ACTION(action) \ - NULL, set_charset_cb, action, "/View/Character encoding/Auto detect" - - {N_("/_View/Character _encoding"), NULL, NULL, 0, ""}, - {N_("/_View/Character _encoding/_Auto detect"), - NULL, set_charset_cb, C_AUTO, ""}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/7bit ASCII (US-ASC_II)"), - ENC_ACTION(C_US_ASCII)}, - - {N_("/_View/Character _encoding/Unicode (_UTF-8)"), - ENC_ACTION(C_UTF_8)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Western European (ISO-8859-_1)"), - ENC_ACTION(C_ISO_8859_1)}, - {N_("/_View/Character _encoding/Western European (ISO-8859-15)"), - ENC_ACTION(C_ISO_8859_15)}, - {N_("/_View/Character _encoding/Western European (Windows-1252)"), - ENC_ACTION(C_WINDOWS_1252)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Central European (ISO-8859-_2)"), - ENC_ACTION(C_ISO_8859_2)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/_Baltic (ISO-8859-13)"), - ENC_ACTION(C_ISO_8859_13)}, - {N_("/_View/Character _encoding/Baltic (ISO-8859-_4)"), - ENC_ACTION(C_ISO_8859_4)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Greek (ISO-8859-_7)"), - ENC_ACTION(C_ISO_8859_7)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Hebrew (ISO-8859-_8)"), - ENC_ACTION(C_ISO_8859_8)}, - {N_("/_View/Character _encoding/Hebrew (Windows-1255)"), - ENC_ACTION(C_CP1255)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Arabic (ISO-8859-_6)"), - ENC_ACTION(C_ISO_8859_6)}, - {N_("/_View/Character _encoding/Arabic (Windows-1256)"), - ENC_ACTION(C_CP1256)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Turkish (ISO-8859-_9)"), - ENC_ACTION(C_ISO_8859_9)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Cyrillic (ISO-8859-_5)"), - ENC_ACTION(C_ISO_8859_5)}, - {N_("/_View/Character _encoding/Cyrillic (KOI8-_R)"), - ENC_ACTION(C_KOI8_R)}, - {N_("/_View/Character _encoding/Cyrillic (KOI8-U)"), - ENC_ACTION(C_KOI8_U)}, - {N_("/_View/Character _encoding/Cyrillic (Windows-1251)"), - ENC_ACTION(C_CP1251)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Japanese (ISO-2022-_JP)"), - ENC_ACTION(C_ISO_2022_JP)}, - {N_("/_View/Character _encoding/Japanese (ISO-2022-JP-2)"), - ENC_ACTION(C_ISO_2022_JP_2)}, - {N_("/_View/Character _encoding/Japanese (_EUC-JP)"), - ENC_ACTION(C_EUC_JP)}, - {N_("/_View/Character _encoding/Japanese (_Shift__JIS)"), - ENC_ACTION(C_SHIFT_JIS)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Simplified Chinese (_GB2312)"), - ENC_ACTION(C_GB2312)}, - {N_("/_View/Character _encoding/Simplified Chinese (GBK)"), - ENC_ACTION(C_GBK)}, - {N_("/_View/Character _encoding/Traditional Chinese (_Big5)"), - ENC_ACTION(C_BIG5)}, - {N_("/_View/Character _encoding/Traditional Chinese (EUC-_TW)"), - ENC_ACTION(C_EUC_TW)}, - {N_("/_View/Character _encoding/Chinese (ISO-2022-_CN)"), - ENC_ACTION(C_ISO_2022_CN)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Korean (EUC-_KR)"), - ENC_ACTION(C_EUC_KR)}, - {N_("/_View/Character _encoding/Korean (ISO-2022-KR)"), - ENC_ACTION(C_ISO_2022_KR)}, - ENC_SEPARATOR, - {N_("/_View/Character _encoding/Thai (TIS-620)"), - ENC_ACTION(C_TIS_620)}, - {N_("/_View/Character _encoding/Thai (Windows-874)"), - ENC_ACTION(C_WINDOWS_874)}, - -#undef ENC_SEPARATOR -#undef ENC_ACTION - -#define DEC_SEPARATOR \ - {N_("/_View/Decode/---"), NULL, NULL, 0, ""} -#define DEC_ACTION(action) \ - NULL, set_decode_cb, action, "/View/Decode/Auto detect" - {N_("/_View/Decode"), NULL, NULL, 0, ""}, - {N_("/_View/Decode/_Auto detect"), - NULL, set_decode_cb, 0, ""}, - {N_("/_View/Decode/---"), NULL, NULL, 0, ""}, - {N_("/_View/Decode/_8bit"), DEC_ACTION(ENC_8BIT)}, - {N_("/_View/Decode/_Quoted printable"), DEC_ACTION(ENC_QUOTED_PRINTABLE)}, - {N_("/_View/Decode/_Base64"), DEC_ACTION(ENC_BASE64)}, - {N_("/_View/Decode/_Uuencode"), DEC_ACTION(ENC_X_UUENCODE)}, - -#undef DEC_SEPARATOR -#undef DEC_ACTION - - {N_("/_View/---"), NULL, NULL, 0, ""}, - {N_("/_View/Mess_age source"), "U", view_source_cb, 0, NULL}, - {N_("/_View/Show all _headers"),"H", show_all_header_cb, 0, ""}, - {N_("/_View/Quotes"), NULL, NULL, 0, ""}, - {N_("/_View/Quotes/_Fold all"), "Q", msg_hide_quotes_cb, 1, ""}, - {N_("/_View/Quotes/Fold from level _2"),NULL, msg_hide_quotes_cb, 2, ""}, - {N_("/_View/Quotes/Fold from level _3"),NULL, msg_hide_quotes_cb, 3, ""}, - - {N_("/_Message"), NULL, NULL, 0, ""}, - {N_("/_Message/Compose _new message"), - "M", compose_cb, 0, NULL}, - {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/_Reply"), "R", reply_cb, COMPOSE_REPLY, NULL}, - {N_("/_Message/Repl_y to/_all"), - "R", reply_cb, COMPOSE_REPLY_TO_ALL, NULL}, - {N_("/_Message/Repl_y to/_sender"), - NULL, reply_cb, COMPOSE_REPLY_TO_SENDER, NULL}, - {N_("/_Message/Repl_y to/mailing _list"), - "L", reply_cb, COMPOSE_REPLY_TO_LIST, NULL}, - {N_("/_Message/---"), NULL, NULL, 0, ""}, - {N_("/_Message/_Forward"), "F", reply_cb, COMPOSE_FORWARD_INLINE, NULL}, - {N_("/_Message/For_ward as attachment"), - NULL, reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL}, - {N_("/_Message/Redirec_t"), NULL, reply_cb, COMPOSE_REDIRECT, NULL}, - - {N_("/_Tools"), NULL, NULL, 0, ""}, - {N_("/_Tools/_Address book"), "A", addressbook_open_cb, 0, NULL}, - {N_("/_Tools/Add sender to address boo_k"), - NULL, add_address_cb, 0, NULL}, - {N_("/_Tools/---"), NULL, NULL, 0, ""}, - {N_("/_Tools/_Create filter rule"), - NULL, NULL, 0, ""}, - {N_("/_Tools/_Create filter rule/_Automatically"), - NULL, create_filter_cb, FILTER_BY_AUTO, NULL}, - {N_("/_Tools/_Create filter rule/by _From"), - NULL, create_filter_cb, FILTER_BY_FROM, NULL}, - {N_("/_Tools/_Create filter rule/by _To"), - NULL, create_filter_cb, FILTER_BY_TO, NULL}, - {N_("/_Tools/_Create filter rule/by _Subject"), - NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL}, - {N_("/_Tools/Create processing rule"), - NULL, NULL, 0, ""}, - {N_("/_Tools/Create processing rule/_Automatically"), - NULL, create_processing_cb, FILTER_BY_AUTO, NULL}, - {N_("/_Tools/Create processing rule/by _From"), - NULL, create_processing_cb, FILTER_BY_FROM, NULL}, - {N_("/_Tools/Create processing rule/by _To"), - NULL, create_processing_cb, FILTER_BY_TO, NULL}, - {N_("/_Tools/Create processing rule/by _Subject"), - NULL, create_processing_cb, FILTER_BY_SUBJECT, NULL}, - {N_("/_Tools/---"), NULL, NULL, 0, ""}, - {N_("/_Tools/List _URLs..."), "U", open_urls_cb, 0, NULL}, - {N_("/_Tools/---"), NULL, NULL, 0, ""}, - {N_("/_Tools/Actio_ns"), NULL, NULL, 0, ""}, - - {N_("/_Help"), NULL, NULL, 0, ""}, - {N_("/_Help/_About"), NULL, about_cb, 0, NULL} + {"File/Print", NULL, N_("_Print..."), "P", NULL, G_CALLBACK(print_cb) }, + {"File/---", NULL, "---", NULL, NULL, NULL }, + {"File/Close", NULL, N_("_Close"), "W", NULL, G_CALLBACK(close_cb) }, + +/* Edit menu */ + {"Edit/Copy", NULL, N_("_Copy"), "C", NULL, G_CALLBACK(copy_cb) }, + {"Edit/SelectAll", NULL, N_("_Select all"), "A", NULL, G_CALLBACK(allsel_cb) }, + {"Edit/---", NULL, "---", NULL, NULL, NULL }, + {"Edit/Find", NULL, N_("_Find"), "F", NULL, G_CALLBACK(search_cb) }, + +/* View menu */ + {"View/Goto", NULL, N_("_Go to") }, + {"View/Goto/Prev", NULL, N_("_Previous message"), "P", NULL, G_CALLBACK(prev_cb) }, + {"View/Goto/Next", NULL, N_("_Next message"), "N", NULL, G_CALLBACK(next_cb) }, + {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, + {"View/Goto/PrevUnread", NULL, N_("P_revious unread message"), "P", NULL, G_CALLBACK(prev_unread_cb) }, + {"View/Goto/NextUnread", NULL, N_("N_ext unread message"), "N", NULL, G_CALLBACK(next_unread_cb) }, + /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */ + {"View/Goto/PrevNew", NULL, N_("Previous ne_w message"), NULL, NULL, G_CALLBACK(prev_new_cb) }, + {"View/Goto/NextNew", NULL, N_("Ne_xt new message"), NULL, NULL, G_CALLBACK(next_new_cb) }, + /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */ + {"View/Goto/PrevMarked", NULL, N_("Previous _marked message"), NULL, NULL, G_CALLBACK(prev_marked_cb) }, + {"View/Goto/NextMarked", NULL, N_("Next m_arked message"), NULL, NULL, G_CALLBACK(next_marked_cb) }, + /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */ + {"View/Goto/PrevLabeled", NULL, N_("Previous _labeled message"), NULL, NULL, G_CALLBACK(prev_labeled_cb) }, + {"View/Goto/NextLabeled", NULL, N_("Next la_beled message"), NULL, NULL, G_CALLBACK(next_labeled_cb) }, + /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */ + {"View/Goto/LastRead", NULL, N_("Last read message"), NULL, NULL, G_CALLBACK(last_read_cb) }, + {"View/Goto/ParentMessage", NULL, N_("Parent message"), "Up", NULL, G_CALLBACK(parent_cb) }, + /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */ + {"View/Goto/NextUnreadFolder", NULL, N_("Next unread _folder"), "G", NULL, G_CALLBACK(goto_unread_folder_cb) }, + {"View/Goto/OtherFolder", NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) }, + /* {"View/Goto/---", NULL, "---", NULL, NULL, NULL }, */ + + {"View/Encoding", NULL, N_("Character _encoding") }, /* set_charset_cb */ + {"View/Encoding/---", NULL, "---" }, +#define ENC_ACTION(cs_char,c_char,string) \ + { "View/Encoding/" cs_char, NULL, N_(string), NULL, NULL, c_char } + + {"View/Encoding/Western", NULL, N_("Western European") }, + {"View/Encoding/Baltic", NULL, N_("Baltic") }, + {"View/Encoding/Hebrew", NULL, N_("Hebrew") }, + {"View/Encoding/Arabic", NULL, N_("Arabic") }, + {"View/Encoding/Cyrillic", NULL, N_("Cyrillic") }, + {"View/Encoding/Japanese", NULL, N_("Japanese") }, + {"View/Encoding/Chinese", NULL, N_("Chinese") }, + {"View/Encoding/Korean", NULL, N_("Korean") }, + {"View/Encoding/Thai", NULL, N_("Thai") }, + + {"View/Decode", NULL, N_("Decode") }, /* set_decode_cb */ + {"View/Decode/---", NULL, "---" }, + +#define DEC_ACTION(cs_type,c_type,string) \ + { "View/Decode/" cs_type, NULL, N_(string), NULL, NULL, c_type } + + {"View/---", NULL, "---", NULL, NULL, NULL }, + {"View/MessageSource", NULL, N_("Mess_age source"), "U", NULL, G_CALLBACK(view_source_cb) }, + + {"View/Quotes", NULL, N_("Quotes") }, + +/* Message menu */ + {"Message/Compose", NULL, N_("Compose _new message"), "M", NULL, G_CALLBACK(compose_cb) }, + {"Message/---", NULL, "---", NULL, NULL, NULL }, + + {"Message/Reply", NULL, N_("_Reply"), "R", NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_REPLY */ + {"Message/ReplyTo", NULL, N_("Repl_y to") }, + {"Message/ReplyTo/All", NULL, N_("_all"), "R", NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_REPLY_TO_ALL */ + {"Message/ReplyTo/Sender", NULL, N_("_sender"), NULL, NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_REPLY_TO_SENDER */ + {"Message/ReplyTo/List", NULL, N_("mailing _list"), "L", NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_REPLY_TO_LIST */ + /* {"Message/---", NULL, "---", NULL, NULL, NULL }, */ + + {"Message/Forward", NULL, N_("_Forward"), "F", NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_FORWARD_INLINE */ + {"Message/ForwardAtt", NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_FORWARD_AS_ATTACH */ + {"Message/Redirect", NULL, N_("Redirec_t"), NULL, NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_REDIRECT */ + +/* Tools menu */ + {"Tools/AddressBook", NULL, N_("_Address book"), "A", NULL, G_CALLBACK(addressbook_open_cb) }, + {"Tools/AddSenderToAB", NULL, N_("Add sender to address boo_k"), NULL, NULL, G_CALLBACK(add_address_cb) }, + {"Tools/---", NULL, "---", NULL, NULL, NULL }, + + {"Tools/CreateFilterRule", NULL, "_Create filter rule" }, + {"Tools/CreateFilterRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_AUTO */ + {"Tools/CreateFilterRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_FROM */ + {"Tools/CreateFilterRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_TO */ + {"Tools/CreateFilterRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_filter_cb) }, /* FILTER_BY_SUBJECT */ + + {"Tools/CreateProcessingRule", NULL, "Create processing rule" }, + {"Tools/CreateProcessingRule/Automatically", NULL, N_("_Automatically"), NULL, NULL, G_CALLBACK(create_processing_cb) }, + {"Tools/CreateProcessingRule/ByFrom", NULL, N_("By _From"), NULL, NULL, G_CALLBACK(create_processing_cb) }, + {"Tools/CreateProcessingRule/ByTo", NULL, N_("By _To"), NULL, NULL, G_CALLBACK(create_processing_cb) }, + {"Tools/CreateProcessingRule/BySubject", NULL, N_("By _Subject"), NULL, NULL, G_CALLBACK(create_processing_cb) }, + + /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */ + + {"Tools/ListUrls", NULL, N_("List _URLs..."), "U", NULL, G_CALLBACK(open_urls_cb) }, + + /* {"Tools/---", NULL, "---", NULL, NULL, NULL }, */ + {"Tools/Actions", NULL, N_("Actio_ns") }, + {"Tools/Actions/PlaceHolder", NULL, "Placeholder", NULL, NULL, G_CALLBACK(messageview_nothing_cb) }, + +/* Help menu */ + {"Help/About", NULL, N_("_About"), NULL, NULL, G_CALLBACK(about_cb) }, +}; + +static GtkToggleActionEntry msgview_toggle_entries[] = +{ + {"View/AllHeaders", NULL, N_("Show all _headers"), "H", NULL, G_CALLBACK(show_all_header_cb) }, /* toggle */ + {"View/Quotes/FoldAll", NULL, N_("_Fold all"), "Q", NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 1 toggle */ + {"View/Quotes/Fold2", NULL, N_("Fold from level _2"), NULL, NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 2 toggle */ + {"View/Quotes/Fold3", NULL, N_("Fold from level _3"), NULL, NULL, G_CALLBACK(msg_hide_quotes_cb) }, /* 3 toggle */ +}; + +static GtkRadioActionEntry msgview_radio_enc_entries[] = +{ + ENC_ACTION(CS_AUTO, C_AUTO, "_Automatic"), /* RADIO set_charset_cb */ + ENC_ACTION(CS_US_ASCII, C_US_ASCII, "7bit ASCII (US-ASC_II)"), /* RADIO set_charset_cb */ + ENC_ACTION(CS_UTF_8, C_UTF_8, "Unicode (_UTF-8)"), /* RADIO set_charset_cb */ + ENC_ACTION("Western/"CS_ISO_8859_1, C_ISO_8859_1, "ISO-8859-_1"), /* RADIO set_charset_cb */ + ENC_ACTION("Western/"CS_ISO_8859_15, C_ISO_8859_15, "ISO-8859-15"), /* RADIO set_charset_cb */ + ENC_ACTION("Western/"CS_WINDOWS_1252, C_WINDOWS_1252, "Windows-1252"), /* RADIO set_charset_cb */ + ENC_ACTION(CS_ISO_8859_2, C_ISO_8859_2, "Central European (ISO-8859-_2)"), /* RADIO set_charset_cb */ + ENC_ACTION("Baltic/"CS_ISO_8859_13, C_ISO_8859_13, "ISO-8859-13"), /* RADIO set_charset_cb */ + ENC_ACTION("Baltic/"CS_ISO_8859_4, C_ISO_8859_14, "ISO-8859-_4"), /* RADIO set_charset_cb */ + ENC_ACTION(CS_ISO_8859_7, C_ISO_8859_7, "Greek (ISO-8859-_7)"), /* RADIO set_charset_cb */ + ENC_ACTION("Hebrew/"CS_ISO_8859_8, C_ISO_8859_8, "ISO-8859-_8"), /* RADIO set_charset_cb */ + ENC_ACTION("Hebrew/"CS_WINDOWS_1255, C_WINDOWS_1255, "Windows-1255"), /* RADIO set_charset_cb */ + ENC_ACTION("Arabic/"CS_ISO_8859_6, C_ISO_8859_6, "ISO-8859-_6"), /* RADIO set_charset_cb */ + ENC_ACTION("Arabic/"CS_WINDOWS_1256, C_WINDOWS_1256, "Windows-1256"), /* RADIO set_charset_cb */ + ENC_ACTION(CS_ISO_8859_9, C_ISO_8859_9, "Turkish (ISO-8859-_9)"), /* RADIO set_charset_cb */ + ENC_ACTION("Cyrillic/"CS_ISO_8859_5, C_ISO_8859_5, "ISO-8859-_5"), /* RADIO set_charset_cb */ + ENC_ACTION("Cyrillic/"CS_KOI8_R, C_KOI8_R, "KOI8-_R"), /* RADIO set_charset_cb */ + ENC_ACTION("Cyrillic/"CS_KOI8_U, C_KOI8_U, "KOI8-_U"), /* RADIO set_charset_cb */ + ENC_ACTION("Cyrillic/"CS_WINDOWS_1251, C_WINDOWS_1251, "Windows-1251"), /* RADIO set_charset_cb */ + ENC_ACTION("Japanese/"CS_ISO_2022_JP, C_ISO_2022_JP, "ISO-2022-_JP"), /* RADIO set_charset_cb */ + ENC_ACTION("Japanese/"CS_ISO_2022_JP_2, C_ISO_2022_JP_2, "ISO-2022-JP-_2"), /* RADIO set_charset_cb */ + ENC_ACTION("Japanese/"CS_EUC_JP, C_EUC_JP, "_EUC-JP"), /* RADIO set_charset_cb */ + ENC_ACTION("Japanese/"CS_SHIFT_JIS, C_SHIFT_JIS, "_Shift-JIS"), /* RADIO set_charset_cb */ + ENC_ACTION("Chinese/"CS_GB2312, C_GB2312, "_GB2312"), /* RADIO set_charset_cb */ + ENC_ACTION("Chinese/"CS_GBK, C_GBK, "GB_K"), /* RADIO set_charset_cb */ + ENC_ACTION("Chinese/"CS_BIG5, C_BIG5, "_Big5-JP"), /* RADIO set_charset_cb */ + ENC_ACTION("Chinese/"CS_EUC_TW, C_EUC_TW, "EUC-_TW"), /* RADIO set_charset_cb */ + ENC_ACTION("Korean/"CS_EUC_KR, C_EUC_KR, "_EUC-KR"), /* RADIO set_charset_cb */ + ENC_ACTION("Korean/"CS_ISO_2022_KR, C_ISO_2022_KR, "_ISO-2022-KR"), /* RADIO set_charset_cb */ + ENC_ACTION("Thai/"CS_TIS_620, C_TIS_620, "_TIS-620-KR"), /* RADIO set_charset_cb */ + ENC_ACTION("Thai/"CS_WINDOWS_874, C_WINDOWS_874, "_Windows-874"), /* RADIO set_charset_cb */ +}; + +static GtkRadioActionEntry msgview_radio_dec_entries[] = +{ + DEC_ACTION("AutoDetect", 0, "_Auto detect"), /* set_decode_cb */ + /* --- */ + DEC_ACTION("8bit", ENC_8BIT, "_8bit"), + DEC_ACTION("QP", ENC_QUOTED_PRINTABLE, "_Quoted printable"), + DEC_ACTION("B64", ENC_BASE64, "_Base64"), + DEC_ACTION("Uuencode", ENC_X_UUENCODE, "_Uuencode"), }; MessageView *messageview_create(MainWindow *mainwin) @@ -481,13 +413,10 @@ GList *messageview_get_msgview_list(void) void messageview_update_actions_menu(MessageView *msgview) { - GtkItemFactory *ifactory; - /* Messages opened in a new window do not have a menu bar */ if (msgview->menubar == NULL) return; - ifactory = gtk_item_factory_from_widget(msgview->menubar); - action_update_msgview_menu(ifactory, "/Tools/Actions", msgview); + action_update_msgview_menu(msgview->ui_manager, "/Menu/Tools/Actions", msgview); } static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window) @@ -498,16 +427,189 @@ static void messageview_add_toolbar(MessageView *msgview, GtkWidget *window) #ifndef GENERIC_UMPC GtkWidget *statusbar = NULL; #endif - guint n_menu_entries; + GtkActionGroup *action_group; + vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(window), vbox); - n_menu_entries = sizeof(msgview_entries) / sizeof(msgview_entries[0]); - menubar = menubar_create(window, msgview_entries, - n_menu_entries, "", msgview); - gtk_widget_show(menubar); + msgview->ui_manager = gtk_ui_manager_new(); + action_group = cm_menu_create_action_group_full(msgview->ui_manager,"Menu", msgview_entries, + G_N_ELEMENTS(msgview_entries), (gpointer)msgview); + gtk_action_group_add_toggle_actions(action_group, msgview_toggle_entries, + G_N_ELEMENTS(msgview_toggle_entries), (gpointer)msgview); + gtk_action_group_add_radio_actions(action_group, msgview_radio_enc_entries, + G_N_ELEMENTS(msgview_radio_enc_entries), C_AUTO, G_CALLBACK(set_charset_cb), (gpointer)msgview); + gtk_action_group_add_radio_actions(action_group, msgview_radio_dec_entries, + G_N_ELEMENTS(msgview_radio_dec_entries), C_AUTO, G_CALLBACK(set_decode_cb), (gpointer)msgview); + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/", "Menu", NULL, GTK_UI_MANAGER_MENUBAR) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu", "File", "File", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu", "Edit", "Edit", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu", "View", "View", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu", "Message", "Message", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu", "Tools", "Tools", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu", "Help", "Help", GTK_UI_MANAGER_MENU) + +/* File menu */ + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM) +#if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM) +#endif + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Separator1", "File/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Close", "File/Close", GTK_UI_MANAGER_MENUITEM) + +/* Edit menu */ + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Edit", "Copy", "Edit/Copy", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Edit", "SelectAll", "Edit/SelectAll", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Edit", "Separator1", "Edit/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Edit", "Find", "Edit/Find", GTK_UI_MANAGER_MENUITEM) + +/* View menu */ + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Goto", "View/Goto", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Prev", "View/Goto/Prev", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Next", "View/Goto/Next", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator1", "View/Goto/---", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevUnread", "View/Goto/PrevUnread", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextUnread", "View/Goto/NextUnread", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator2", "View/Goto/---", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevNew", "View/Goto/PrevNew", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextNew", "View/Goto/NextNew", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator3", "View/Goto/---", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevMarked", "View/Goto/PrevMarked", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextMarked", "View/Goto/NextMarked", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator4", "View/Goto/---", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevLabeled", "View/Goto/PrevLabeled", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextLabeled", "View/Goto/NextLabeled", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator5", "View/Goto/---", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "LastRead", "View/Goto/LastRead", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "ParentMessage", "View/Goto/ParentMessage", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator6", "View/Goto/---", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Separator1", "View/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Encoding", "View/Encoding", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", CS_AUTO, "View/Encoding/"CS_AUTO, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Separator1", "View/Encoding/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", CS_US_ASCII, "View/Encoding/"CS_US_ASCII, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", CS_UTF_8, "View/Encoding/"CS_UTF_8, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Separator2", "View/Encoding/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Western", "View/Encoding/Western", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Western", CS_ISO_8859_1, "View/Encoding/Western/"CS_ISO_8859_1, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Western", CS_ISO_8859_15, "View/Encoding/Western/"CS_ISO_8859_15, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Western", CS_WINDOWS_1252, "View/Encoding/Western/"CS_WINDOWS_1252, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_2, "View/Encoding/"CS_ISO_8859_2, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Baltic", "View/Encoding/Baltic", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Baltic", CS_ISO_8859_13, "View/Encoding/Baltic/"CS_ISO_8859_13, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Baltic", CS_ISO_8859_4, "View/Encoding/Baltic/"CS_ISO_8859_4, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_7, "View/Encoding/"CS_ISO_8859_7, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Hebrew", "View/Encoding/Hebrew", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Hebrew", CS_ISO_8859_8, "View/Encoding/Hebrew/"CS_ISO_8859_8, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Hebrew", CS_WINDOWS_1255, "View/Encoding/Hebrew/"CS_WINDOWS_1255, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Arabic", "View/Encoding/Arabic", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Arabic", CS_ISO_8859_6, "View/Encoding/Arabic/"CS_ISO_8859_6, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Arabic", CS_WINDOWS_1256, "View/Encoding/Arabic/"CS_WINDOWS_1256, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", CS_ISO_8859_9, "View/Encoding/"CS_ISO_8859_9, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Cyrillic", "View/Encoding/Cyrillic", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_ISO_8859_5, "View/Encoding/Cyrillic/"CS_ISO_8859_5, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_R, "View/Encoding/Cyrillic/"CS_KOI8_R, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_KOI8_U, "View/Encoding/Cyrillic/"CS_KOI8_U, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Cyrillic", CS_WINDOWS_1251, "View/Encoding/Cyrillic/"CS_WINDOWS_1251, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Japanese", "View/Encoding/Japanese", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Japanese", CS_ISO_2022_JP, "View/Encoding/Japanese/"CS_ISO_2022_JP, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Japanese", CS_ISO_2022_JP_2, "View/Encoding/Japanese/"CS_ISO_2022_JP_2, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Japanese", CS_EUC_JP, "View/Encoding/Japanese/"CS_EUC_JP, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Japanese", CS_SHIFT_JIS, "View/Encoding/Japanese/"CS_SHIFT_JIS, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Chinese", "View/Encoding/Chinese", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GB2312, "View/Encoding/Chinese/"CS_GB2312, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_GBK, "View/Encoding/Chinese/"CS_GBK, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_BIG5, "View/Encoding/Chinese/"CS_BIG5, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Chinese", CS_EUC_TW, "View/Encoding/Chinese/"CS_EUC_TW, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Korean", "View/Encoding/Korean", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Korean", CS_EUC_KR, "View/Encoding/Korean/"CS_EUC_KR, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Korean", CS_ISO_2022_KR, "View/Encoding/Korean/"CS_ISO_2022_KR, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding", "Thai", "View/Encoding/Thai", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Thai", CS_TIS_620, "View/Encoding/Thai/"CS_TIS_620, GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Encoding/Thai", CS_WINDOWS_874, "View/Encoding/Thai/"CS_WINDOWS_874, GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Decode", "View/Decode", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Decode", "AutoDetect", "View/Decode/AutoDetect", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Decode", "Separator1", "View/Decode/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Decode", "8bit", "View/Decode/8bit", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Decode", "QP", "View/Decode/QP", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Decode", "B64", "View/Decode/B64", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Decode", "Uuencode", "View/Decode/Uuencode", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Separator2", "View/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "MessageSource", "View/MessageSource", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "AllHeaders", "View/AllHeaders", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Quotes", "View/Quotes", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "FoldAll", "View/Quotes/FoldAll", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Fold2", "View/Quotes/Fold2", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Fold3", "View/Quotes/Fold3", GTK_UI_MANAGER_MENUITEM) + +/* Message menu */ + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Compose", "Message/Compose", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Separator1", "Message/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Reply", "Message/Reply", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "ReplyTo", "Message/ReplyTo", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message/ReplyTo", "All", "Message/ReplyTo/All", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message/ReplyTo", "Sender", "Message/ReplyTo/Sender", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message/ReplyTo", "List", "Message/ReplyTo/List", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Separator2", "Message/---", GTK_UI_MANAGER_SEPARATOR) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Forward", "Message/Forward", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "ForwardAtt", "Message/ForwardAtt", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Redirect", "Message/Redirect", GTK_UI_MANAGER_MENUITEM) + +/* Tools menu */ + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "AddSenderToAB", "Tools/AddSenderToAB", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "Separator1", "Tools/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "CreateFilterRule", "Tools/CreateFilterRule", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "Automatically", "Tools/CreateFilterRule/Automatically", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "ByFrom", "Tools/CreateFilterRule/ByFrom", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "ByTo", "Tools/CreateFilterRule/ByTo", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateFilterRule", "BySubject", "Tools/CreateFilterRule/BySubject", GTK_UI_MANAGER_MENUITEM) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "CreateProcessingRule", "Tools/CreateProcessingRule", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "Automatically", "Tools/CreateProcessingRule/Automatically", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByFrom", "Tools/CreateProcessingRule/ByFrom", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "ByTo", "Tools/CreateProcessingRule/ByTo", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/CreateProcessingRule", "BySubject", "Tools/CreateProcessingRule/BySubject", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "Separator2", "Tools/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "ListUrls", "Tools/ListUrls", GTK_UI_MANAGER_MENUITEM) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "Separator3", "Tools/---", GTK_UI_MANAGER_SEPARATOR) + + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "Actions", "Tools/Actions", GTK_UI_MANAGER_MENU) + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools/Actions", "PlaceHolder", "Tools/Actions/PlaceHolder", GTK_UI_MANAGER_MENUITEM) + +/* Help menu */ + MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Help", "About", "Help/About", GTK_UI_MANAGER_MENUITEM) + + menubar = gtk_ui_manager_get_widget(msgview->ui_manager, "/Menu"); + gtk_widget_show_all(menubar); + gtk_window_add_accel_group(GTK_WINDOW(window), gtk_ui_manager_get_accel_group(msgview->ui_manager)); + gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0); if (prefs_common.toolbar_detachable) { @@ -1815,7 +1917,7 @@ gchar *messageview_get_selection(MessageView *msgview) return text; } -static void save_as_cb(gpointer data, guint action, GtkWidget *widget) +static void save_as_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview_save_as(messageview); @@ -1896,7 +1998,7 @@ void messageview_print(MsgInfo *msginfo, gboolean all_headers, #endif #if GTK_CHECK_VERSION(2,10,0) && !defined(USE_GNOMEPRINT) -static void page_setup_cb(gpointer data, guint action, GtkWidget *widget) +static void page_setup_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; printing_page_setup(messageview ? @@ -1904,7 +2006,7 @@ static void page_setup_cb(gpointer data, guint action, GtkWidget *widget) } #endif -static void print_cb(gpointer data, guint action, GtkWidget *widget) +static void print_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; #if !defined(USE_GNOMEPRINT) && !GTK_CHECK_VERSION(2,10,0) @@ -1940,31 +2042,31 @@ static void print_cb(gpointer data, guint action, GtkWidget *widget) #endif } -static void close_cb(gpointer data, guint action, GtkWidget *widget) +static void close_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview_destroy(messageview); } -static void copy_cb(gpointer data, guint action, GtkWidget *widget) +static void copy_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview_copy_clipboard(messageview); } -static void allsel_cb(gpointer data, guint action, GtkWidget *widget) +static void allsel_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview_select_all(messageview); } -static void search_cb(gpointer data, guint action, GtkWidget *widget) +static void search_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; message_search(messageview); } -static void prev_cb(gpointer data, guint action, GtkWidget *widget) +static void prev_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -1989,7 +2091,7 @@ static void prev_cb(gpointer data, guint action, GtkWidget *widget) } } -static void next_cb(gpointer data, guint action, GtkWidget *widget) +static void next_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2014,7 +2116,7 @@ static void next_cb(gpointer data, guint action, GtkWidget *widget) } } -static void prev_unread_cb(gpointer data, guint action, GtkWidget *widget) +static void prev_unread_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2039,7 +2141,7 @@ static void prev_unread_cb(gpointer data, guint action, GtkWidget *widget) } } -static void next_unread_cb(gpointer data, guint action, GtkWidget *widget) +static void next_unread_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2064,7 +2166,7 @@ static void next_unread_cb(gpointer data, guint action, GtkWidget *widget) } } -static void prev_new_cb(gpointer data, guint action, GtkWidget *widget) +static void prev_new_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2089,7 +2191,7 @@ static void prev_new_cb(gpointer data, guint action, GtkWidget *widget) } } -static void next_new_cb(gpointer data, guint action, GtkWidget *widget) +static void next_new_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2114,7 +2216,7 @@ static void next_new_cb(gpointer data, guint action, GtkWidget *widget) } } -static void prev_marked_cb(gpointer data, guint action, GtkWidget *widget) +static void prev_marked_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2139,7 +2241,7 @@ static void prev_marked_cb(gpointer data, guint action, GtkWidget *widget) } } -static void next_marked_cb(gpointer data, guint action, GtkWidget *widget) +static void next_marked_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2164,7 +2266,7 @@ static void next_marked_cb(gpointer data, guint action, GtkWidget *widget) } } -static void prev_labeled_cb(gpointer data, guint action, GtkWidget *widget) +static void prev_labeled_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2189,7 +2291,7 @@ static void prev_labeled_cb(gpointer data, guint action, GtkWidget *widget) } } -static void next_labeled_cb(gpointer data, guint action, GtkWidget *widget) +static void next_labeled_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2214,7 +2316,7 @@ static void next_labeled_cb(gpointer data, guint action, GtkWidget *widget) } } -static void last_read_cb(gpointer data, guint action, GtkWidget *widget) +static void last_read_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2239,7 +2341,7 @@ static void last_read_cb(gpointer data, guint action, GtkWidget *widget) } } -static void parent_cb(gpointer data, guint action, GtkWidget *widget) +static void parent_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2264,7 +2366,7 @@ static void parent_cb(gpointer data, guint action, GtkWidget *widget) } } -static void goto_unread_folder_cb(gpointer data, guint action, GtkWidget *widget) +static void goto_unread_folder_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2289,7 +2391,7 @@ static void goto_unread_folder_cb(gpointer data, guint action, GtkWidget *widget } } -static void goto_folder_cb(gpointer data, guint action, GtkWidget *widget) +static void goto_folder_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview->updating = TRUE; @@ -2320,13 +2422,15 @@ static void goto_folder_cb(gpointer data, guint action, GtkWidget *widget) } } -static void set_charset_cb(gpointer data, guint action, GtkWidget *widget) +static void set_charset_cb(GtkAction *action, GtkRadioAction *current, gpointer data) { MessageView *messageview = (MessageView *)data; + gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)); + gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current)); const gchar *charset; - if (GTK_CHECK_MENU_ITEM(widget)->active) { - charset = conv_get_charset_str((CharSet)action); + if (active) { + charset = conv_get_charset_str((CharSet)value); g_free(messageview->forced_charset); messageview->forced_charset = g_strdup(charset); procmime_force_charset(charset); @@ -2335,20 +2439,22 @@ static void set_charset_cb(gpointer data, guint action, GtkWidget *widget) } } -static void set_decode_cb(gpointer data, guint action, GtkWidget *widget) +static void set_decode_cb(GtkAction *action, GtkRadioAction *current, gpointer data) { MessageView *messageview = (MessageView *)data; - if (GTK_CHECK_MENU_ITEM(widget)->active) { - messageview->forced_encoding = (EncodingType)action; + gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current)); + gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current)); + + if (active) { + messageview->forced_encoding = (EncodingType)value; messageview_show(messageview, messageview->msginfo, FALSE); - - debug_print("forced encoding: %d\n", action); + debug_print("forced encoding: %d\n", value); } } -static void view_source_cb(gpointer data, guint action, GtkWidget *widget) +static void view_source_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; SourceWindow *srcwin; @@ -2360,7 +2466,7 @@ static void view_source_cb(gpointer data, guint action, GtkWidget *widget) source_window_show(srcwin); } -static void show_all_header_cb(gpointer data, guint action, GtkWidget *widget) +static void show_all_header_cb(GtkToggleAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; MsgInfo *msginfo = messageview->msginfo; @@ -2373,39 +2479,36 @@ static void show_all_header_cb(gpointer data, guint action, GtkWidget *widget) return; messageview->all_headers = - GTK_CHECK_MENU_ITEM(widget)->active; + gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); if (!msginfo) return; messageview->msginfo = NULL; - messageview_show(messageview, msginfo, - GTK_CHECK_MENU_ITEM(widget)->active); + messageview_show(messageview, msginfo,gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))); procmsg_msginfo_free(msginfo); main_window_set_menu_sensitive(messageview->mainwin); } -#define SET_CHECK_MENU_ACTIVE(path, active) \ -{ \ - menuitem = gtk_item_factory_get_widget(ifactory, path); \ - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), active); \ -} - -static void msg_hide_quotes_cb(gpointer data, guint action, GtkWidget *widget) +static void msg_hide_quotes_cb(GtkToggleAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; MsgInfo *msginfo = messageview->msginfo; static gboolean updating_menu = FALSE; - GtkItemFactory *ifactory = gtk_item_factory_from_widget(messageview->menubar); - GtkWidget *menuitem; + if (updating_menu) return; - - prefs_common.hide_quotes = - GTK_CHECK_MENU_ITEM(widget)->active ? action : 0; + if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { + const gchar *a_name = gtk_action_get_name(GTK_ACTION(action)); + if (!strcmp(a_name, "View/Quotes/FoldAll")) prefs_common.hide_quotes = 1; + else if (!strcmp(a_name, "View/Quotes/Fold2")) prefs_common.hide_quotes = 2; + else if (!strcmp(a_name, "View/Quotes/Fold3")) prefs_common.hide_quotes = 3; + } else + prefs_common.hide_quotes = 0; updating_menu=TRUE; - SET_CHECK_MENU_ACTIVE("/View/Quotes/Fold all", FALSE); - SET_CHECK_MENU_ACTIVE("/View/Quotes/Fold from level 2", FALSE); - SET_CHECK_MENU_ACTIVE("/View/Quotes/Fold from level 3", FALSE); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), prefs_common.hide_quotes > 0); + + cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/FoldAll", (prefs_common.hide_quotes == 1)); + cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold2", (prefs_common.hide_quotes == 2)); + cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold3", (prefs_common.hide_quotes == 3)); + updating_menu=FALSE; if (!msginfo) return; messageview->msginfo = NULL; @@ -2419,7 +2522,7 @@ static void msg_hide_quotes_cb(gpointer data, guint action, GtkWidget *widget) } #undef SET_CHECK_MENU_ACTIVE -static void compose_cb(gpointer data, guint action, GtkWidget *widget) +static void compose_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; PrefsAccount *ac = NULL; @@ -2440,24 +2543,36 @@ static void compose_cb(gpointer data, guint action, GtkWidget *widget) compose_new(ac, NULL, NULL); } -static void reply_cb(gpointer data, guint action, GtkWidget *widget) +#define DO_ACTION(name, act) { if (!strcmp(a_name, name)) action = act; } + +static void reply_cb(GtkAction *gaction, gpointer data) { MessageView *messageview = (MessageView *)data; GSList *msginfo_list = NULL; - + gint action = COMPOSE_REPLY; + const gchar *a_name = gtk_action_get_name(gaction); + g_return_if_fail(messageview->msginfo); + DO_ACTION("Message/Reply", COMPOSE_REPLY); + DO_ACTION("Message/ReplyTo/All", COMPOSE_REPLY_TO_ALL); + DO_ACTION("Message/ReplyTo/Sender", COMPOSE_REPLY_TO_SENDER); + DO_ACTION("Message/ReplyTo/List", COMPOSE_REPLY_TO_LIST); + DO_ACTION("Message/Forward", COMPOSE_FORWARD_INLINE); + DO_ACTION("Message/ForwardAtt", COMPOSE_FORWARD_AS_ATTACH); + DO_ACTION("Message/Redirect", COMPOSE_REDIRECT); + msginfo_list = g_slist_append(msginfo_list, messageview->msginfo); compose_reply_from_messageview(messageview, msginfo_list, action); g_slist_free(msginfo_list); } -static void addressbook_open_cb(gpointer data, guint action, GtkWidget *widget) +static void addressbook_open_cb(GtkAction *action, gpointer data) { addressbook_open(NULL); } -static void add_address_cb(gpointer data, guint action, GtkWidget *widget) +static void add_address_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; MsgInfo *msginfo, *full_msginfo; @@ -2498,38 +2613,51 @@ static void add_address_cb(gpointer data, guint action, GtkWidget *widget) gtk_widget_destroy(image); } -static void create_filter_cb(gpointer data, guint action, GtkWidget *widget) +static void create_filter_cb(GtkAction *gaction, gpointer data) { MessageView *messageview = (MessageView *)data; FolderItem * item; - + gint action = -1; + const gchar *a_name = gtk_action_get_name(gaction); + if (!messageview->msginfo) return; + + DO_ACTION("Tools/CreateFilterRule/Automatically", FILTER_BY_AUTO); + DO_ACTION("Tools/CreateFilterRule/ByFrom", FILTER_BY_FROM); + DO_ACTION("Tools/CreateFilterRule/ByTo", FILTER_BY_TO); + DO_ACTION("Tools/CreateFilterRule/BySubject", FILTER_BY_SUBJECT); item = messageview->msginfo->folder; summary_msginfo_filter_open(item, messageview->msginfo, (PrefsFilterType)action, 0); } -static void create_processing_cb(gpointer data, guint action, - GtkWidget *widget) +static void create_processing_cb(GtkAction *gaction, gpointer data) { MessageView *messageview = (MessageView *)data; FolderItem * item; + gint action = -1; + const gchar *a_name = gtk_action_get_name(gaction); if (!messageview->msginfo) return; + DO_ACTION("Tools/CreateProcessingRule/Automatically", FILTER_BY_AUTO); + DO_ACTION("Tools/CreateProcessingRule/ByFrom", FILTER_BY_FROM); + DO_ACTION("Tools/CreateProcessingRule/ByTo", FILTER_BY_TO); + DO_ACTION("Tools/CreateProcessingRule/BySubject", FILTER_BY_SUBJECT); + item = messageview->msginfo->folder; summary_msginfo_filter_open(item, messageview->msginfo, (PrefsFilterType)action, 1); } -static void open_urls_cb(gpointer data, guint action, GtkWidget *widget) +static void open_urls_cb(GtkAction *action, gpointer data) { MessageView *messageview = (MessageView *)data; messageview_list_urls(messageview); } -static void about_cb(gpointer data, guint action, GtkWidget *widget) +static void about_cb(GtkAction *gaction, gpointer data) { about_show(); } @@ -2553,31 +2681,14 @@ static gboolean messageview_update_msg(gpointer source, gpointer data) void messageview_set_menu_sensitive(MessageView *messageview) { - GtkItemFactory *ifactory; - GtkWidget *menuitem = NULL; - if (!messageview || !messageview->new_window) return; /* do some smart things */ if (!messageview->menubar) return; - ifactory = gtk_item_factory_from_widget(messageview->menubar); - if (!ifactory) return; - - if (prefs_common.hide_quotes) { - menuitem = NULL; - if (prefs_common.hide_quotes == 1) - menuitem = gtk_item_factory_get_widget(ifactory, - "/View/Quotes/Fold all"); - if (prefs_common.hide_quotes == 2) - menuitem = gtk_item_factory_get_widget(ifactory, - "/View/Quotes/Fold from level 2"); - if (prefs_common.hide_quotes == 3) - menuitem = gtk_item_factory_get_widget(ifactory, - "/View/Quotes/Fold from level 3"); - gtk_check_menu_item_set_active - (GTK_CHECK_MENU_ITEM(menuitem), - TRUE); - } + + cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/FoldAll", (prefs_common.hide_quotes == 1)); + cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold2", (prefs_common.hide_quotes == 2)); + cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Fold3", (prefs_common.hide_quotes == 3)); } void messageview_learn (MessageView *msgview, gboolean is_spam) diff --git a/src/messageview.h b/src/messageview.h index 003916d54..10058675c 100644 --- a/src/messageview.h +++ b/src/messageview.h @@ -76,6 +76,7 @@ struct _MessageView gboolean deferred_destroy; gboolean show_full_text; + GtkUIManager *ui_manager; }; MessageView *messageview_create (MainWindow *mainwin); diff --git a/src/summaryview.c b/src/summaryview.c index 25116b9e2..d70b4c20c 100644 --- a/src/summaryview.c +++ b/src/summaryview.c @@ -5915,6 +5915,7 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh) GSList *cur = tags_get_list(); GSList *orig = NULL; gboolean existing_tags = FALSE; + gchar *accel_path = NULL; cur = orig = g_slist_sort(cur, summary_tag_cmp_list); label_menuitem = gtk_ui_manager_get_widget(gtkut_ui_manager(), "/Menus/SummaryViewPopup/Tags"); @@ -5926,11 +5927,13 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh) menu = gtk_menu_new(); + gtk_menu_set_accel_group (GTK_MENU (menu), + gtk_ui_manager_get_accel_group(gtkut_ui_manager())); + /* create tags menu items */ for (; cur; cur = cur->next) { gint id = GPOINTER_TO_INT(cur->data); const gchar *tag = tags_get_tag(id); - item = gtk_check_menu_item_new_with_label(tag); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); g_signal_connect(G_OBJECT(item), "activate", @@ -5941,6 +5944,9 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh) g_object_set_data(G_OBJECT(item), "tag_id", GINT_TO_POINTER(id)); gtk_widget_show(item); + accel_path = g_strconcat("/",tag, NULL); + gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path); + g_free(accel_path); existing_tags = TRUE; } if (existing_tags) { @@ -5958,6 +5964,9 @@ static void summary_tags_menu_create(SummaryView *summaryview, gboolean refresh) g_object_set_data(G_OBJECT(item), "summaryview", summaryview); gtk_widget_show(item); + accel_path = g_strconcat("/","Apply tags...", NULL); + gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path); + g_free(accel_path); g_slist_free(orig); gtk_widget_show(menu);