1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ 2 3 /* 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, but 9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, see <http://www.gnu.org/licenses/>. 15 * 16 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) 17 */ 18 19 #ifndef E_COMPOSER_PRIVATE_H 20 #define E_COMPOSER_PRIVATE_H 21 22 #include "e-msg-composer.h" 23 24 #include <errno.h> 25 26 #include <gtk/gtk.h> 27 #include <gdk/gdkkeysyms.h> 28 29 #include <glib/gstdio.h> 30 #include <glib/gi18n-lib.h> 31 32 #include <libebackend/libebackend.h> 33 34 #include "e-composer-actions.h" 35 #include "e-composer-header-table.h" 36 37 #ifdef HAVE_XFREE 38 #include <X11/XF86keysym.h> 39 #endif 40 41 #define E_MSG_COMPOSER_GET_PRIVATE(obj) \ 42 (G_TYPE_INSTANCE_GET_PRIVATE \ 43 ((obj), E_TYPE_MSG_COMPOSER, EMsgComposerPrivate)) 44 45 /* Shorthand, requires a variable named "composer". */ 46 #define ACTION(name) (E_COMPOSER_ACTION_##name (composer)) 47 48 /* For use in dispose() methods. */ 49 #define DISPOSE(obj) \ 50 G_STMT_START { \ 51 if ((obj) != NULL) { g_object_unref (obj); (obj) = NULL; } \ 52 } G_STMT_END 53 54 G_BEGIN_DECLS 55 56 struct _EMsgComposerPrivate { 57 58 gpointer shell; /* weak pointer */ 59 60 EHTMLEditor *editor; 61 62 /*** UI Management ***/ 63 64 GtkWidget *header_table; 65 GtkWidget *attachment_paned; 66 67 EFocusTracker *focus_tracker; 68 GtkWindowGroup *window_group; 69 70 GtkActionGroup *async_actions; 71 GtkActionGroup *charset_actions; 72 GtkActionGroup *composer_actions; 73 74 GPtrArray *extra_hdr_names; 75 GPtrArray *extra_hdr_values; 76 77 GtkWidget *focused_entry; 78 79 GtkWidget *gallery_icon_view; 80 GtkWidget *gallery_scrolled_window; 81 82 GtkWidget *address_dialog; 83 84 gchar *mime_type; 85 gchar *mime_body; 86 gchar *charset; 87 88 guint32 autosaved : 1; 89 guint32 mode_post : 1; 90 guint32 in_signature_insert : 1; 91 guint32 application_exiting : 1; 92 93 CamelMimeMessage *redirect; 94 95 guint soft_busy_count; /* Only to disable async operations when >0 */ 96 gboolean had_activities; /* Hard busy flag */ 97 gboolean disable_signature; 98 gboolean is_reply_or_forward; 99 /* The web view is uneditable while the editor is busy. 100 * This is used to restore the previous editable state. */ 101 gboolean saved_editable; 102 gboolean set_signature_from_message; 103 gboolean is_sending_message; 104 gboolean dnd_history_saved; 105 gboolean check_if_signature_is_changed; 106 gboolean ignore_next_signature_change; 107 gboolean last_signal_was_paste_primary; 108 109 gint focused_entry_selection_start; 110 gint focused_entry_selection_end; 111 112 gulong notify_destinations_bcc_handler; 113 gulong notify_destinations_cc_handler; 114 gulong notify_destinations_to_handler; 115 gulong notify_identity_uid_handler; 116 gulong notify_reply_to_handler; 117 gulong notify_signature_uid_handler; 118 gulong notify_subject_handler; 119 gulong notify_subject_changed_handler; 120 121 gulong drag_data_received_handler_id; 122 123 gchar *previous_identity_uid; 124 125 guint content_hash_ref_count; /* when reaches 0, the content_hash is freed; to be able to reuse it */ 126 EContentEditorContentHash *content_hash; 127 128 GCancellable *load_signature_cancellable; 129 }; 130 131 void e_composer_private_constructed (EMsgComposer *composer); 132 void e_composer_private_dispose (EMsgComposer *composer); 133 void e_composer_private_finalize (EMsgComposer *composer); 134 135 /* Private Utilities */ 136 137 void e_composer_actions_init (EMsgComposer *composer); 138 gchar * e_composer_find_data_file (const gchar *basename); 139 gchar * e_composer_get_default_charset (void); 140 gchar * e_composer_decode_clue_value (const gchar *encoded_value); 141 gchar * e_composer_encode_clue_value (const gchar *decoded_value); 142 gboolean e_composer_paste_image (EMsgComposer *composer, 143 GtkClipboard *clipboard); 144 gboolean e_composer_paste_uris (EMsgComposer *composer, 145 GtkClipboard *clipboard); 146 gboolean e_composer_selection_is_base64_uris 147 (EMsgComposer *composer, 148 GtkSelectionData *selection); 149 gboolean e_composer_selection_is_image_uris 150 (EMsgComposer *composer, 151 GtkSelectionData *selection); 152 void e_composer_update_signature (EMsgComposer *composer); 153 void e_composer_emit_before_destroy (EMsgComposer *composer); 154 155 G_END_DECLS 156 157 #endif /* E_COMPOSER_PRIVATE_H */ 158