+static void
+modest_msg_edit_window_find_toolbar_close (GtkWidget *widget,
+ ModestMsgEditWindow *window)
+{
+ GtkToggleAction *toggle;
+ ModestWindowPrivate *parent_priv;
+ parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
+
+ toggle = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ToolsMenu/FindInMessageMenu"));
+ gtk_toggle_action_set_active (toggle, FALSE);
+}
+
+
+static void
+update_paste_dimming (ModestMsgEditWindow *window)
+{
+ ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
+ GtkAction *action = NULL;
+ GtkClipboard *clipboard = NULL;
+ GtkWidget *focused;
+ gboolean active;
+
+ focused = gtk_window_get_focus (GTK_WINDOW (window));
+
+ clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ active = gtk_clipboard_wait_is_text_available (clipboard);
+
+ if (active) {
+ if (MODEST_IS_ATTACHMENTS_VIEW (focused))
+ active = FALSE;
+ }
+
+ action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/PasteMenu");
+ gtk_action_set_sensitive (action, active);
+
+}
+
+static void
+paste_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor)
+{
+ GtkWidget *focused = gtk_window_get_focus (GTK_WINDOW (editor));
+
+ if (MODEST_IS_ATTACHMENTS_VIEW (focused))
+ hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_unable_to_paste_here"));
+ else
+ hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ecoc_ib_edwin_nothing_to_paste"));
+
+}
+
+
+static void
+modest_msg_edit_window_system_clipboard_owner_change (GtkClipboard *clipboard,
+ GdkEvent *event,
+ ModestMsgEditWindow *window)
+{
+ update_paste_dimming (window);
+}
+
+static void
+update_select_all_dimming (ModestMsgEditWindow *window)
+{
+ GtkWidget *focused;
+ gboolean dimmed = FALSE;
+ GtkAction *action;
+ ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
+
+ focused = gtk_window_get_focus (GTK_WINDOW (window));
+ if (GTK_IS_ENTRY (focused)) {
+ const gchar *current_text;
+ current_text = gtk_entry_get_text (GTK_ENTRY (focused));
+ dimmed = ((current_text == NULL) || (current_text[0] == '\0'));
+ } else if (GTK_IS_TEXT_VIEW (focused)) {
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (focused));
+ dimmed = (gtk_text_buffer_get_char_count (buffer) < 1);
+ } else if (MODEST_IS_ATTACHMENTS_VIEW (focused)) {
+ dimmed = FALSE;
+ }
+ action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/SelectAllMenu");
+ gtk_action_set_sensitive (action, !dimmed);
+}
+
+static void
+update_zoom_dimming (ModestMsgEditWindow *window)
+{
+ GtkWidget *focused;
+ gboolean dimmed = FALSE;
+ GtkAction *action;
+ ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
+
+ focused = gtk_window_get_focus (GTK_WINDOW (window));
+ dimmed = ! WP_IS_TEXT_VIEW (focused);
+ action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ZoomMenu");
+ gtk_action_set_sensitive (action, !dimmed);
+}
+
+static void
+edit_menu_activated (GtkAction *action,
+ gpointer userdata)
+{
+ ModestMsgEditWindow *window = MODEST_MSG_EDIT_WINDOW (userdata);
+
+ update_select_all_dimming (window);
+}
+static void
+view_menu_activated (GtkAction *action,
+ gpointer userdata)
+{
+ ModestMsgEditWindow *window = MODEST_MSG_EDIT_WINDOW (userdata);
+
+ update_zoom_dimming (window);
+}
+
+gboolean
+modest_msg_edit_window_get_sent (ModestMsgEditWindow *window)
+{
+ ModestMsgEditWindowPrivate *priv;
+
+ priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(window);
+ return priv->sent;
+}
+
+void
+modest_msg_edit_window_set_sent (ModestMsgEditWindow *window,
+ gboolean sent)
+{
+ ModestMsgEditWindowPrivate *priv;
+
+ priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(window);
+ priv->sent = sent;
+}