(modest_ui_actions_on_send):
Don't ask confirmation if the body is empty as it can't be empty
anymore
* src/maemo/modest-msg-edit-window.c
(update_send_dimming):
(send_insensitive_press):
Check if the message body is empty too.
(body_changed):
New function called everytime the body is updated.
(init_window):
Register callback for "changed" event in the message body.
Fixes: NB#66115
pmo-trunk-r3037
static void modest_msg_edit_window_finalize (GObject *obj);
static gboolean msg_body_focus (GtkWidget *focus, GdkEventFocus *event, gpointer userdata);
static void modest_msg_edit_window_finalize (GObject *obj);
static gboolean msg_body_focus (GtkWidget *focus, GdkEventFocus *event, gpointer userdata);
+static void body_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor);
static void recpt_field_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor);
static void send_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
static void style_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
static void recpt_field_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor);
static void send_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
static void style_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor);
G_CALLBACK (text_buffer_can_undo), obj);
g_signal_connect (G_OBJECT (priv->text_buffer), "can-redo",
G_CALLBACK (text_buffer_can_redo), obj);
G_CALLBACK (text_buffer_can_undo), obj);
g_signal_connect (G_OBJECT (priv->text_buffer), "can-redo",
G_CALLBACK (text_buffer_can_redo), obj);
+ g_signal_connect (G_OBJECT (priv->text_buffer), "changed",
+ G_CALLBACK (body_changed), obj);
g_signal_connect (G_OBJECT (obj), "window-state-event",
G_CALLBACK (modest_msg_edit_window_window_state_event),
NULL);
g_signal_connect (G_OBJECT (obj), "window-state-event",
G_CALLBACK (modest_msg_edit_window_window_state_event),
NULL);
+gboolean
+message_is_empty (ModestMsgEditWindow *window)
+{
+ ModestMsgEditWindowPrivate *priv = NULL;
+
+ g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE);
+ priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
+
+ /** TODO: Add wpeditor API to tell us if there is any _visible_ text,
+ * so we can ignore markup.
+ */
+ GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
+ gint count = 0;
+ if (buf)
+ count = gtk_text_buffer_get_char_count (buf);
+
+ return count == 0;
+}
+
static gboolean
msg_body_focus (GtkWidget *focus,
GdkEventFocus *event,
static gboolean
msg_body_focus (GtkWidget *focus,
GdkEventFocus *event,
update_send_dimming (editor);
}
update_send_dimming (editor);
}
+static void
+body_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor)
+{
+ update_send_dimming (editor);
+}
+
static void
send_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor)
{
ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (editor);
const gchar *subject = gtk_entry_get_text (GTK_ENTRY (priv->subject_field));
static void
send_insensitive_press (GtkWidget *widget, ModestMsgEditWindow *editor)
{
ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (editor);
const gchar *subject = gtk_entry_get_text (GTK_ENTRY (priv->subject_field));
- if (subject == NULL || subject[0] == '\0') {
+ if (message_is_empty(editor) || (subject == NULL || subject[0] == '\0')) {
hildon_banner_show_information (NULL, NULL, _("mcen_ib_subject_or_body_not_modified"));
} else {
hildon_banner_show_information (NULL, NULL, _("mcen_ib_add_recipients_first"));
hildon_banner_show_information (NULL, NULL, _("mcen_ib_subject_or_body_not_modified"));
} else {
hildon_banner_show_information (NULL, NULL, _("mcen_ib_add_recipients_first"));
g_string_free (result, TRUE);
}
g_string_free (result, TRUE);
}
-gboolean
-message_is_empty (ModestMsgEditWindow *window)
-{
- ModestMsgEditWindowPrivate *priv = NULL;
-
- g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE);
- priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window);
-
- /** TODO: Add wpeditor API to tell us if there is any _visible_ text,
- * so we can ignore markup.
- */
- GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body));
- gint count = 0;
- if (buf)
- count = gtk_text_buffer_get_char_count (buf);
-
- return count == 0;
-}
-
void
modest_msg_edit_window_toggle_find_toolbar (ModestMsgEditWindow *window,
gboolean show)
void
modest_msg_edit_window_toggle_find_toolbar (ModestMsgEditWindow *window,
gboolean show)
dim = ((gtk_text_buffer_get_char_count (to_buffer) +
gtk_text_buffer_get_char_count (cc_buffer) +
dim = ((gtk_text_buffer_get_char_count (to_buffer) +
gtk_text_buffer_get_char_count (cc_buffer) +
- gtk_text_buffer_get_char_count (bcc_buffer)) == 0);
-
- dim = dim || (subject == NULL || subject[0] == '\0');
+ gtk_text_buffer_get_char_count (bcc_buffer)) == 0)
+ || (subject == NULL || subject[0] == '\0')
+ || message_is_empty(window);
action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ToolbarSend");
gtk_action_set_sensitive (action, !dim);
action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ToolbarSend");
gtk_action_set_sensitive (action, !dim);
gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name);
gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name);
- if (data->plain_body == NULL || data->plain_body[0] == '\0') {
- GtkResponseType response;
- gchar *note_message;
- gchar *note_subject = data->subject;
- if (note_subject == NULL || note_subject[0] == '\0')
- note_subject = _("mail_va_no_subject");
- note_message = g_strdup_printf (_("emev_ni_ui_smtp_message_null"), note_subject);
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (edit_window),
- note_message);
- g_free (note_message);
- if (response == GTK_RESPONSE_CANCEL) {
- g_free (account_name);
- return;
- }
- }
-
modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent"));
/* Create the mail operation */
modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent"));
/* Create the mail operation */