void e_composer_actions_init (EMsgComposer *composer) { GtkActionGroup *action_group; GtkAccelGroup *accel_group; GtkUIManager *ui_manager; EHTMLEditor *editor; EContentEditor *cnt_editor; gboolean visible; GIcon *gcr_gnupg_icon; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); editor = e_msg_composer_get_editor (composer); cnt_editor = e_html_editor_get_content_editor (editor); ui_manager = e_html_editor_get_ui_manager (editor); /* Composer Actions */ action_group = composer->priv->composer_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions ( action_group, entries, G_N_ELEMENTS (entries), composer); gtk_action_group_add_toggle_actions ( action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Asynchronous Actions */ action_group = composer->priv->async_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions ( action_group, async_entries, G_N_ELEMENTS (async_entries), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Character Set Actions */ action_group = composer->priv->charset_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); e_charset_add_radio_actions ( action_group, "charset-", composer->priv->charset, G_CALLBACK (action_charset_cb), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Fine Tuning */ g_object_set ( ACTION (ATTACH), "short-label", _("Attach"), NULL); g_object_set ( ACTION (PICTURE_GALLERY), "is-important", TRUE, NULL); g_object_set ( ACTION (SAVE_DRAFT), "short-label", _("Save Draft"), NULL); #define init_toolbar_option(x, always_visible) \ gtk_action_set_visible (ACTION (TOOLBAR_ ## x), always_visible); \ e_binding_bind_property ( \ ACTION (x), "active", \ ACTION (TOOLBAR_ ## x), "active", \ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); \ e_binding_bind_property ( \ ACTION (x), "label", \ ACTION (TOOLBAR_ ## x), "label", \ G_BINDING_SYNC_CREATE); \ e_binding_bind_property ( \ ACTION (x), "tooltip", \ ACTION (TOOLBAR_ ## x), "tooltip", \ G_BINDING_SYNC_CREATE); \ e_binding_bind_property ( \ ACTION (x), "sensitive", \ ACTION (TOOLBAR_ ## x), "sensitive", \ G_BINDING_SYNC_CREATE); \ g_signal_connect (ACTION (TOOLBAR_ ## x), "toggled", \ G_CALLBACK (composer_actions_toolbar_option_toggled_cb), composer); init_toolbar_option (PGP_SIGN, FALSE); init_toolbar_option (PGP_ENCRYPT, FALSE); init_toolbar_option (PRIORITIZE_MESSAGE, TRUE); init_toolbar_option (REQUEST_READ_RECEIPT, TRUE); init_toolbar_option (SMIME_SIGN, FALSE); init_toolbar_option (SMIME_ENCRYPT, FALSE); #undef init_toolbar_option /* Borrow a GnuPG icon from gcr to distinguish between GPG and S/MIME Sign/Encrypt actions */ gcr_gnupg_icon = g_themed_icon_new ("gcr-gnupg"); if (gcr_gnupg_icon) { GIcon *temp_icon; GIcon *action_icon; GEmblem *emblem; GtkAction *action; emblem = g_emblem_new (gcr_gnupg_icon); action = ACTION (TOOLBAR_PGP_SIGN); action_icon = g_themed_icon_new (gtk_action_get_icon_name (action)); temp_icon = g_emblemed_icon_new (action_icon, emblem); g_object_unref (action_icon); gtk_action_set_gicon (action, temp_icon); g_object_unref (temp_icon); action = ACTION (TOOLBAR_PGP_ENCRYPT); action_icon = g_themed_icon_new (gtk_action_get_icon_name (action)); temp_icon = g_emblemed_icon_new (action_icon, emblem); g_object_unref (action_icon); gtk_action_set_gicon (action, temp_icon); g_object_unref (temp_icon); g_object_unref (emblem); g_object_unref (gcr_gnupg_icon); } e_binding_bind_property ( cnt_editor, "html-mode", ACTION (PICTURE_GALLERY), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "edit-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "format-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "insert-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "options-menu"), "sensitive", G_BINDING_SYNC_CREATE); e_binding_bind_property ( cnt_editor, "editable", e_html_editor_get_action (editor, "picture-gallery"), "sensitive", G_BINDING_SYNC_CREATE); #if defined (ENABLE_SMIME) visible = TRUE; #else visible = FALSE; #endif gtk_action_set_visible (ACTION (SMIME_ENCRYPT), visible); gtk_action_set_visible (ACTION (SMIME_SIGN), visible); accel_group = gtk_ui_manager_get_accel_group (ui_manager); g_signal_connect (accel_group, "accel-activate", G_CALLBACK (composer_actions_accel_activate_cb), composer); }
void e_composer_actions_init (EMsgComposer *composer) { GtkActionGroup *action_group; GtkAccelGroup *accel_group; GtkUIManager *ui_manager; EHTMLEditor *editor; EHTMLEditorView *view; gboolean visible; g_return_if_fail (E_IS_MSG_COMPOSER (composer)); editor = e_msg_composer_get_editor (composer); view = e_html_editor_get_view (editor); ui_manager = e_html_editor_get_ui_manager (editor); /* Composer Actions */ action_group = composer->priv->composer_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions ( action_group, entries, G_N_ELEMENTS (entries), composer); gtk_action_group_add_toggle_actions ( action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Asynchronous Actions */ action_group = composer->priv->async_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions ( action_group, async_entries, G_N_ELEMENTS (async_entries), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Character Set Actions */ action_group = composer->priv->charset_actions; gtk_action_group_set_translation_domain ( action_group, GETTEXT_PACKAGE); e_charset_add_radio_actions ( action_group, "charset-", composer->priv->charset, G_CALLBACK (action_charset_cb), composer); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* Fine Tuning */ g_object_set ( ACTION (ATTACH), "short-label", _("Attach"), NULL); g_object_set ( ACTION (PICTURE_GALLERY), "is-important", TRUE, NULL); g_object_set ( ACTION (SAVE_DRAFT), "short-label", _("Save Draft"), NULL); g_object_bind_property ( view, "html-mode", ACTION (PICTURE_GALLERY), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( view, "editable", e_html_editor_get_action (editor, "edit-menu"), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( view, "editable", e_html_editor_get_action (editor, "format-menu"), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( view, "editable", e_html_editor_get_action (editor, "insert-menu"), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( view, "editable", e_html_editor_get_action (editor, "options-menu"), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property ( view, "editable", e_html_editor_get_action (editor, "picture-gallery"), "sensitive", G_BINDING_SYNC_CREATE); #if defined (HAVE_NSS) visible = TRUE; #else visible = FALSE; #endif gtk_action_set_visible (ACTION (SMIME_ENCRYPT), visible); gtk_action_set_visible (ACTION (SMIME_SIGN), visible); accel_group = gtk_ui_manager_get_accel_group (ui_manager); g_signal_connect (accel_group, "accel-activate", G_CALLBACK (composer_actions_accel_activate_cb), composer); }