X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-msg-edit-window.c;h=976a601ac926b436d09e1afbde20a3631181be73;hp=d2180becffd2820c4168e4f086fbebc42d2d090f;hb=c0342fe819176fe9a3b370bdb43cb97d7d47af75;hpb=9e56dd5da02d65930f3b1225f9ef71cc27778d20 diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index d2180be..976a601 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -75,6 +75,7 @@ #else #include #endif +#include #include "modest-maemo-utils.h" @@ -87,12 +88,15 @@ #define IMAGE_MAX_WIDTH 560 #define DEFAULT_FONT_SCALE 1.5 +static gboolean is_wp_text_buffer_started = FALSE; + static void modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass); static void modest_msg_edit_window_init (ModestMsgEditWindow *obj); 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 attachments_selection_changed (ModestAttachmentsView *buffer, ModestMsgEditWindow *editor); static void recpt_field_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor); static void text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *window); @@ -125,10 +129,6 @@ static void modest_msg_edit_window_add_attachment_clicked (GtkButton *button, /* ModestWindow methods implementation */ static void modest_msg_edit_window_disconnect_signals (ModestWindow *window); -static void modest_msg_edit_window_set_zoom (ModestWindow *window, gdouble zoom); -static gdouble modest_msg_edit_window_get_zoom (ModestWindow *window); -static gboolean modest_msg_edit_window_zoom_minus (ModestWindow *window); -static gboolean modest_msg_edit_window_zoom_plus (ModestWindow *window); static void modest_msg_edit_window_show_toolbar (ModestWindow *window, gboolean show_toolbar); static void modest_msg_edit_window_clipboard_owner_change (GtkClipboard *clipboard, @@ -157,14 +157,20 @@ static void on_account_removed (TnyAccountStore *account_store, TnyAccount *account, gpointer user_data); +static gboolean on_zoom_minus_plus_not_implemented (ModestWindow *window); + +static void set_zoom_do_nothing (ModestWindow *window, gdouble zoom); + +static gdouble get_zoom_do_nothing (ModestWindow *window); + static void init_window (ModestMsgEditWindow *obj); static void DEBUG_BUFFER (WPTextBuffer *buffer) { #ifdef DEBUG GtkTextIter iter; - g_message ("BEGIN BUFFER OF SIZE %d", gtk_text_buffer_get_char_count (GTK_TEXT_BUFFER (buffer))); + gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &iter); while (!gtk_text_iter_is_end (&iter)) { GString *output = g_string_new (""); @@ -250,12 +256,10 @@ struct _ModestMsgEditWindowPrivate { gint last_vadj_upper; gint last_cid; - GList *attachments; - GList *images; + TnyList *attachments; + TnyList *images; TnyHeaderFlags priority_flags; - - gdouble zoom_level; gboolean can_undo, can_redo; gulong clipboard_change_handler_id; @@ -300,7 +304,6 @@ modest_msg_edit_window_get_type (void) "ModestMsgEditWindow", &my_info, 0); - wp_text_buffer_library_init (); } return my_type; } @@ -323,19 +326,19 @@ restore_settings (ModestMsgEditWindow *self) conf = modest_runtime_get_conf (); action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarNormalScreenMenu"); - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), modest_conf_get_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, NULL)); action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarFullScreenMenu"); - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), modest_conf_get_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL)); /* set initial state of cc and bcc */ action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewCcFieldMenu"); - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), modest_conf_get_bool(modest_runtime_get_conf(), MODEST_CONF_SHOW_CC, NULL)); action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewBccFieldMenu"); - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), modest_conf_get_bool(modest_runtime_get_conf(), MODEST_CONF_SHOW_BCC, NULL)); /* Dim at start clipboard actions */ @@ -362,10 +365,10 @@ modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass) parent_class = g_type_class_peek_parent (klass); gobject_class->finalize = modest_msg_edit_window_finalize; - modest_window_class->set_zoom_func = modest_msg_edit_window_set_zoom; - modest_window_class->get_zoom_func = modest_msg_edit_window_get_zoom; - modest_window_class->zoom_plus_func = modest_msg_edit_window_zoom_plus; - modest_window_class->zoom_minus_func = modest_msg_edit_window_zoom_minus; + modest_window_class->set_zoom_func = set_zoom_do_nothing; + modest_window_class->get_zoom_func = get_zoom_do_nothing; + modest_window_class->zoom_plus_func = on_zoom_minus_plus_not_implemented; + modest_window_class->zoom_minus_func = on_zoom_minus_plus_not_implemented; modest_window_class->show_toolbar_func = modest_msg_edit_window_show_toolbar; modest_window_class->save_state_func = save_state; modest_window_class->disconnect_signals_func = modest_msg_edit_window_disconnect_signals; @@ -385,10 +388,9 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj) priv->cc_field = NULL; priv->bcc_field = NULL; priv->subject_field = NULL; - priv->attachments = NULL; - priv->images = NULL; + priv->attachments = TNY_LIST (tny_simple_list_new ()); + priv->images = TNY_LIST (tny_simple_list_new ()); priv->last_cid = 0; - priv->zoom_level = 1.0; priv->cc_caption = NULL; priv->bcc_caption = NULL; @@ -415,7 +417,16 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj) modest_window_mgr_register_help_id (modest_runtime_get_window_mgr(), GTK_WINDOW(obj),"applications_email_editor"); + + if (!is_wp_text_buffer_started) { + is_wp_text_buffer_started = TRUE; + wp_text_buffer_library_init (); + } + init_window (obj); + + hildon_program_add_window (hildon_program_get_instance(), + HILDON_WINDOW(obj)); } @@ -490,6 +501,13 @@ void vadj_changed (GtkAdjustment *adj, priv->last_vadj_upper = adj->upper; } +static void window_focus (GtkWindow *window, + GtkWidget *widget, + gpointer userdata) +{ + modest_window_check_dimming_rules_group (MODEST_WINDOW (userdata), "ModestClipboardDimmingRules"); +} + static void connect_signals (ModestMsgEditWindow *obj) @@ -506,6 +524,8 @@ connect_signals (ModestMsgEditWindow *obj) 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 (priv->attachments_view), "selection-changed", + G_CALLBACK (attachments_selection_changed), obj); g_signal_connect (G_OBJECT (obj), "window-state-event", G_CALLBACK (modest_msg_edit_window_window_state_event), NULL); @@ -525,6 +545,7 @@ connect_signals (ModestMsgEditWindow *obj) G_CALLBACK (msg_body_focus), obj); g_signal_connect (G_OBJECT (priv->msg_body), "focus-out-event", G_CALLBACK (msg_body_focus), obj); + g_signal_connect (G_OBJECT (obj), "set-focus", G_CALLBACK (window_focus), obj); g_signal_connect (G_OBJECT (modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR (priv->to_field))), "changed", G_CALLBACK (recpt_field_changed), obj); g_signal_connect (G_OBJECT (modest_recpt_editor_get_buffer (MODEST_RECPT_EDITOR (priv->cc_field))), @@ -552,17 +573,6 @@ connect_signals (ModestMsgEditWindow *obj) } -static GtkWidget * -menubar_to_menu (GtkUIManager *ui_manager) -{ - GtkWidget *main_menu; - - /* Get the menubar from the UI manager */ - main_menu = gtk_ui_manager_get_widget (ui_manager, "/MenuBar"); - - return main_menu; -} - static void init_window (ModestMsgEditWindow *obj) { @@ -605,12 +615,6 @@ init_window (ModestMsgEditWindow *obj) G_CALLBACK (modest_ui_actions_on_change_justify), obj); gtk_action_group_add_radio_actions (action_group, - modest_msg_edit_zoom_action_entries, - G_N_ELEMENTS (modest_msg_edit_zoom_action_entries), - 100, - G_CALLBACK (modest_ui_actions_on_change_zoom), - obj); - gtk_action_group_add_radio_actions (action_group, modest_msg_edit_priority_action_entries, G_N_ELEMENTS (modest_msg_edit_priority_action_entries), 0, @@ -637,9 +641,7 @@ init_window (ModestMsgEditWindow *obj) gtk_window_add_accel_group (GTK_WINDOW (obj), gtk_ui_manager_get_accel_group (parent_priv->ui_manager)); - /* Menubar. Update the state of some toggles */ - parent_priv->menubar = menubar_to_menu (parent_priv->ui_manager); - hildon_window_set_menu (HILDON_WINDOW (obj), GTK_MENU (parent_priv->menubar)); + parent_priv->menubar = NULL; size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); @@ -741,12 +743,11 @@ init_window (ModestMsgEditWindow *obj) gtk_container_add (GTK_CONTAINER (frame), priv->scroll_area); /* Set window icon */ - window_icon = modest_platform_get_icon (MODEST_APP_MSG_EDIT_ICON); + window_icon = modest_platform_get_icon (MODEST_APP_MSG_EDIT_ICON, MODEST_ICON_SIZE_BIG); if (window_icon) { gtk_window_set_icon (GTK_WINDOW (obj), window_icon); g_object_unref (window_icon); - } - + } } static void @@ -776,7 +777,7 @@ static void modest_msg_edit_window_finalize (GObject *obj) { ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (obj); - + /* Sanity check: shouldn't be needed, the window mgr should call this function before */ modest_msg_edit_window_disconnect_signals (MODEST_WINDOW (obj)); @@ -808,10 +809,8 @@ modest_msg_edit_window_finalize (GObject *obj) g_free (priv->last_search); g_slist_free (priv->font_items_group); g_slist_free (priv->size_items_group); - g_list_foreach (priv->attachments, (GFunc) g_object_unref, NULL); - g_list_free (priv->attachments); - g_list_foreach (priv->images, (GFunc) g_object_unref, NULL); - g_list_free (priv->images); + g_object_unref (priv->attachments); + g_object_unref (priv->images); /* This had to stay alive for as long as the combobox that used it: */ modest_pair_list_free (priv->from_field_protos); @@ -858,15 +857,17 @@ pixbuf_from_stream (TnyStream *stream, const gchar *mime_type) } static void -replace_with_images (ModestMsgEditWindow *self, GList *attachments) +replace_with_images (ModestMsgEditWindow *self, TnyList *attachments) { ModestMsgEditWindowPrivate *priv; - GList *node; + TnyIterator *iter; priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self); - for (node = attachments; node != NULL; node = g_list_next (node)) { - TnyMimePart *part = (TnyMimePart *) node->data; + for (iter = tny_list_create_iterator (attachments); + !tny_iterator_is_done (iter); + tny_iterator_next (iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (iter); const gchar *cid = tny_mime_part_get_content_id (part); const gchar *mime_type = tny_mime_part_get_content_type (part); if ((cid != NULL)&&(mime_type != NULL)) { @@ -879,6 +880,7 @@ replace_with_images (ModestMsgEditWindow *self, GList *attachments) g_object_unref (pixbuf); } } + g_object_unref (part); } } @@ -926,10 +928,9 @@ get_related_images (ModestMsgEditWindow *self, TnyMsg *msg) part = TNY_MIME_PART (tny_iterator_get_current (iter)); content_type = tny_mime_part_get_content_type (part); if (content_type && g_str_has_prefix (content_type, "image/")) { - priv->images = g_list_prepend (priv->images, part); - } else { - g_object_unref (part); - } + tny_list_prepend (priv->images, (GObject *) part); + } + g_object_unref (part); tny_iterator_next (iter); } g_object_unref (iter); @@ -939,13 +940,15 @@ get_related_images (ModestMsgEditWindow *self, TnyMsg *msg) } static void -update_last_cid (ModestMsgEditWindow *self, GList *attachments) +update_last_cid (ModestMsgEditWindow *self, TnyList *attachments) { - GList *node; + TnyIterator *iter; ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self); - for (node = attachments; node != NULL; node = g_list_next (node)) { - TnyMimePart *part = (TnyMimePart *) node->data; + for (iter = tny_list_create_iterator (attachments) ; + !tny_iterator_is_done (iter); + tny_iterator_next (iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (iter); const gchar *cid = tny_mime_part_get_content_id (part); if (cid != NULL) { char *invalid = NULL; @@ -954,7 +957,7 @@ update_last_cid (ModestMsgEditWindow *self, GList *attachments) priv->last_cid = int_cid; } } - + g_object_unref (part); } } @@ -1025,7 +1028,7 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg, gboolean preserve_is_rich) /* Add attachments to the view */ modest_attachments_view_set_message (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), msg); priv->attachments = modest_attachments_view_get_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view)); - if (priv->attachments == NULL) { + if (tny_list_get_length (priv->attachments) == 0) { gtk_widget_hide (priv->attachments_caption); } else { gtk_widget_set_no_show_all (priv->attachments_caption, FALSE); @@ -1061,7 +1064,7 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg, gboolean preserve_is_rich) modest_msg_edit_window_reset_modified (self); - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (self)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (self)); text_buffer_can_undo (priv->text_buffer, FALSE, self); text_buffer_can_redo (priv->text_buffer, FALSE, self); @@ -1285,8 +1288,7 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre ModestWindowPrivate *parent_priv; ModestMsgEditWindowPrivate *priv; ModestPair *account_pair = NULL; - ModestDimmingRulesGroup *menu_rules_group = NULL; - ModestDimmingRulesGroup *toolbar_rules_group = NULL; + ModestDimmingRulesGroup *window_rules_group = NULL; ModestDimmingRulesGroup *clipboard_rules_group = NULL; ModestWindowMgr *mgr = NULL; @@ -1300,6 +1302,9 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (obj); parent_priv = MODEST_WINDOW_GET_PRIVATE (obj); + /* Menubar. Update the state of some toggles */ + parent_priv->menubar = modest_maemo_utils_get_manager_menubar_as_menu (parent_priv->ui_manager, "/MenuBar"); + hildon_window_set_menu (HILDON_WINDOW (obj), GTK_MENU (parent_priv->menubar)); priv->from_field_protos = get_transports (); modest_combo_box_set_pair_list (MODEST_COMBO_BOX (priv->from_field), priv->from_field_protos); modest_msg_edit_window_setup_toolbar (MODEST_MSG_EDIT_WINDOW (obj)); @@ -1317,25 +1322,24 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre modest_combo_box_set_active_id (MODEST_COMBO_BOX (priv->from_field), account_pair->first); parent_priv->ui_dimming_manager = modest_ui_dimming_manager_new (); - menu_rules_group = modest_dimming_rules_group_new ("ModestMenuDimmingRules", FALSE); - toolbar_rules_group = modest_dimming_rules_group_new ("ModestToolbarDimmingRules", TRUE); + window_rules_group = modest_dimming_rules_group_new ("ModestWindowDimmingRules", TRUE); clipboard_rules_group = modest_dimming_rules_group_new ("ModestClipboardDimmingRules", FALSE); /* Add common dimming rules */ - modest_dimming_rules_group_add_rules (menu_rules_group, - modest_msg_edit_window_menu_dimming_entries, - G_N_ELEMENTS (modest_msg_edit_window_menu_dimming_entries), - MODEST_WINDOW (obj)); - modest_dimming_rules_group_add_rules (toolbar_rules_group, + modest_dimming_rules_group_add_rules (window_rules_group, modest_msg_edit_window_toolbar_dimming_entries, G_N_ELEMENTS (modest_msg_edit_window_toolbar_dimming_entries), MODEST_WINDOW (obj)); - modest_dimming_rules_group_add_widget_rule (toolbar_rules_group, priv->font_color_button, + modest_dimming_rules_group_add_rules (window_rules_group, + modest_msg_edit_window_menu_dimming_entries, + G_N_ELEMENTS (modest_msg_edit_window_menu_dimming_entries), + MODEST_WINDOW (obj)); + modest_dimming_rules_group_add_widget_rule (window_rules_group, priv->font_color_button, G_CALLBACK (modest_ui_dimming_rules_on_set_style), MODEST_WINDOW (obj)); - modest_dimming_rules_group_add_widget_rule (toolbar_rules_group, priv->font_size_toolitem, + modest_dimming_rules_group_add_widget_rule (window_rules_group, priv->font_size_toolitem, G_CALLBACK (modest_ui_dimming_rules_on_set_style), MODEST_WINDOW (obj)); - modest_dimming_rules_group_add_widget_rule (toolbar_rules_group, priv->font_face_toolitem, + modest_dimming_rules_group_add_widget_rule (window_rules_group, priv->font_face_toolitem, G_CALLBACK (modest_ui_dimming_rules_on_set_style), MODEST_WINDOW (obj)); modest_dimming_rules_group_add_rules (clipboard_rules_group, @@ -1343,19 +1347,18 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre G_N_ELEMENTS (modest_msg_edit_window_clipboard_dimming_entries), MODEST_WINDOW (obj)); /* Insert dimming rules group for this window */ - modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, menu_rules_group); - modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, toolbar_rules_group); + modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, window_rules_group); modest_ui_dimming_manager_insert_rules_group (parent_priv->ui_dimming_manager, clipboard_rules_group); /* Checks the dimming rules */ - g_object_unref (menu_rules_group); - g_object_unref (toolbar_rules_group); + g_object_unref (window_rules_group); g_object_unref (clipboard_rules_group); + gtk_widget_show_all (GTK_WIDGET (obj)); set_msg (MODEST_MSG_EDIT_WINDOW (obj), msg, preserve_is_rich); text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (obj)); - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (obj)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (obj)); modest_window_check_dimming_rules_group (MODEST_WINDOW (obj), "ModestClipboardDimmingRules"); priv->update_caption_visibility = TRUE; @@ -1406,6 +1409,7 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window) MsgData *data; const gchar *account_name; ModestMsgEditWindowPrivate *priv; + TnyIterator *att_iter; g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (edit_window), NULL); @@ -1443,30 +1447,35 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window) data->html_body = NULL; /* deep-copy the data */ - GList *cursor = priv->attachments; + att_iter = tny_list_create_iterator (priv->attachments); data->attachments = NULL; - while (cursor) { - if (!(TNY_IS_MIME_PART(cursor->data))) { + while (!tny_iterator_is_done (att_iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (att_iter); + if (!(TNY_IS_MIME_PART(part))) { g_warning ("strange data in attachment list"); - cursor = g_list_next (cursor); + g_object_unref (part); + tny_iterator_next (att_iter); continue; } data->attachments = g_list_append (data->attachments, - g_object_ref (cursor->data)); - cursor = g_list_next (cursor); + part); + tny_iterator_next (att_iter); } + g_object_unref (att_iter); GtkTextTagTable *tag_table = gtk_text_buffer_get_tag_table (GTK_TEXT_BUFFER (priv->text_buffer)); - cursor = priv->images; + att_iter = tny_list_create_iterator (priv->images); data->images = NULL; - while (cursor) { + while (!tny_iterator_is_done (att_iter)) { + TnyMimePart *part = (TnyMimePart *) tny_iterator_get_current (att_iter); const gchar *cid; - if (!(TNY_IS_MIME_PART(cursor->data))) { + if (!(TNY_IS_MIME_PART(part))) { g_warning ("strange data in attachment list"); - cursor = g_list_next (cursor); + g_object_unref (part); + tny_iterator_next (att_iter); continue; } - cid = tny_mime_part_get_content_id (cursor->data); + cid = tny_mime_part_get_content_id (part); if (cid) { gchar *image_tag_id; GtkTextTag *image_tag; @@ -1480,9 +1489,10 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window) ((gtk_text_iter_has_tag (&iter, image_tag))|| (gtk_text_iter_forward_to_tag_toggle (&iter, image_tag)))) data->images = g_list_append (data->images, - g_object_ref (cursor->data)); + g_object_ref (part)); } - cursor = g_list_next (cursor); + g_object_unref (part); + tny_iterator_next (att_iter); } data->priority_flags = priv->priority_flags; @@ -1625,27 +1635,34 @@ modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self, wp_text_buffer_freeze (WP_TEXT_BUFFER (priv->text_buffer)); if (buffer_format->cs.bold) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_BOLD, (gpointer) (buffer_format->bold&0x1)); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_BOLD, + GINT_TO_POINTER (buffer_format->bold&0x1)); } if (buffer_format->cs.italic) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_ITALIC, (gpointer) (buffer_format->italic&0x1)); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_ITALIC, + GINT_TO_POINTER (buffer_format->italic&0x1)); } if (buffer_format->cs.color) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FORECOLOR, (gpointer) (&(buffer_format->color))); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FORECOLOR, + GINT_TO_POINTER (&(buffer_format->color))); } if (buffer_format->cs.font_size) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE, (gpointer) (buffer_format->font_size)); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE, + GINT_TO_POINTER (buffer_format->font_size)); } if (buffer_format->cs.justification) { switch (buffer_format->justification) { case GTK_JUSTIFY_LEFT: - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_LEFT, (gpointer) TRUE); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_LEFT, + GINT_TO_POINTER(TRUE)); break; case GTK_JUSTIFY_CENTER: - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_CENTER, (gpointer) TRUE); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_CENTER, + GINT_TO_POINTER(TRUE)); break; case GTK_JUSTIFY_RIGHT: - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_RIGHT, (gpointer) TRUE); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_RIGHT, + GINT_TO_POINTER(TRUE)); break; default: break; @@ -1653,14 +1670,18 @@ modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self, } if (buffer_format->cs.font) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT, (gpointer) (buffer_format->font)); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT, + GINT_TO_POINTER (buffer_format->font)); } wp_text_buffer_thaw (WP_TEXT_BUFFER (priv->text_buffer)); if (buffer_format->cs.bullet) { - wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_BULLET, (gpointer) ((buffer_format->bullet)?1:0)); + wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_BULLET, + GINT_TO_POINTER ((buffer_format->bullet)?1:0)); } /* wp_text_buffer_set_format (WP_TEXT_BUFFER (priv->text_buffer), buffer_format); */ - + + text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), self); + g_free (current_format); } @@ -1681,24 +1702,43 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo if (wp_text_buffer_is_rich_text (WP_TEXT_BUFFER (priv->text_buffer))) { action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatMenu/FileFormatFormattedTextMenu"); if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), TRUE); + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), TRUE); } else { action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatMenu/FileFormatPlainTextMenu"); if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), TRUE); + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), TRUE); } wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), buffer_format, FALSE); action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ActionsBold"); - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->bold); + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->bold); action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ActionsItalics"); - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->italic); + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->italic); /* action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/BulletedListMenu"); */ -/* modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->bullet); */ +/* modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->bullet); */ + action = NULL; + switch (buffer_format->justification) + { + case GTK_JUSTIFY_LEFT: + action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentLeftMenu"); + break; + case GTK_JUSTIFY_CENTER: + action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentCenterMenu"); + break; + case GTK_JUSTIFY_RIGHT: + action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/AlignmentRightMenu"); + break; + default: + break; + } + + if (action != NULL) + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE); + g_signal_handlers_block_by_func (G_OBJECT (priv->font_color_button), G_CALLBACK (modest_msg_edit_window_color_button_change), window); @@ -1714,7 +1754,7 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo gchar *markup; label = gtk_bin_get_child (GTK_BIN (new_size_menuitem)); - markup = g_strconcat ("", gtk_label_get_text (GTK_LABEL (label)), "", NULL); + markup = g_strconcat ("", gtk_label_get_text (GTK_LABEL (label)), "", NULL); gtk_label_set_markup (GTK_LABEL (priv->size_tool_button_label), markup); g_free (markup); g_signal_handlers_block_by_func (G_OBJECT (new_size_menuitem), @@ -1954,9 +1994,10 @@ modest_msg_edit_window_insert_image (ModestMsgEditWindow *window) wp_text_buffer_insert_image (WP_TEXT_BUFFER (priv->text_buffer), &position, g_strdup (tny_mime_part_get_content_id (mime_part)), pixbuf); } - priv->images = g_list_prepend (priv->images, mime_part); + tny_list_prepend (priv->images, (GObject *) mime_part); gtk_text_buffer_set_modified (priv->text_buffer, TRUE); g_free (filename); + g_object_unref (mime_part); } } @@ -2028,8 +2069,7 @@ modest_msg_edit_window_attach_file_one ( if (gnome_vfs_get_file_info (uri, &info, - GNOME_VFS_FILE_INFO_GET_MIME_TYPE | - GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE) + GNOME_VFS_FILE_INFO_GET_MIME_TYPE) == GNOME_VFS_OK) mime_type = gnome_vfs_file_info_get_mime_type (&info); mime_part = tny_platform_factory_new_mime_part @@ -2037,6 +2077,8 @@ modest_msg_edit_window_attach_file_one ( stream = TNY_STREAM (tny_vfs_stream_new (handle)); tny_mime_part_construct_from_stream (mime_part, stream, mime_type); + + g_object_unref (stream); content_id = g_strdup_printf ("%d", priv->last_cid); tny_mime_part_set_content_id (mime_part, content_id); @@ -2047,43 +2089,48 @@ modest_msg_edit_window_attach_file_one ( tny_mime_part_set_filename (mime_part, basename); g_free (basename); - priv->attachments = g_list_prepend (priv->attachments, g_object_ref(mime_part)); + tny_list_prepend (priv->attachments, (GObject *) mime_part); modest_attachments_view_add_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), mime_part); gtk_widget_set_no_show_all (priv->attachments_caption, FALSE); gtk_widget_show_all (priv->attachments_caption); gtk_text_buffer_set_modified (priv->text_buffer, TRUE); g_free (filename); + g_object_unref (mime_part); } } void modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window, - GList *att_list) + TnyList *att_list) { ModestMsgEditWindowPrivate *priv; - gboolean clean_list = FALSE; + TnyIterator *iter; g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); if (att_list == NULL) { att_list = modest_attachments_view_get_selection (MODEST_ATTACHMENTS_VIEW (priv->attachments_view)); - clean_list = TRUE; + } else { + g_object_ref (att_list); } - if (att_list == NULL) { + if (tny_list_get_length (att_list) == 0) { hildon_banner_show_information (NULL, NULL, _("TODO: no attachments selected to remove")); } else { GtkWidget *confirmation_dialog = NULL; gboolean dialog_response; - GList *node; gchar *message = NULL; gchar *filename = NULL; - if (att_list->next == NULL) { - if (TNY_IS_MSG (att_list->data)) { - TnyHeader *header = tny_msg_get_header (TNY_MSG (att_list->data)); + if (tny_list_get_length (att_list) == 1) { + TnyMimePart *part; + iter = tny_list_create_iterator (att_list); + part = (TnyMimePart *) tny_iterator_get_current (iter); + g_object_unref (iter); + if (TNY_IS_MSG (part)) { + TnyHeader *header = tny_msg_get_header (TNY_MSG (part)); if (header) { filename = g_strdup (tny_header_get_subject (header)); g_object_unref (header); @@ -2092,45 +2139,50 @@ modest_msg_edit_window_remove_attachments (ModestMsgEditWindow *window, filename = g_strdup (_("mail_va_no_subject")); } } else { - filename = g_strdup (tny_mime_part_get_filename (TNY_MIME_PART (att_list->data))); + filename = g_strdup (tny_mime_part_get_filename (TNY_MIME_PART (part))); } + g_object_unref (part); } else { filename = g_strdup (""); } message = g_strdup_printf (ngettext("emev_nc_delete_attachment", "emev_nc_delete_attachments", - att_list->next == NULL), filename); + (tny_list_get_length (att_list) == 1)), filename); g_free (filename); confirmation_dialog = hildon_note_new_confirmation (GTK_WINDOW (window), message); g_free (message); dialog_response = (gtk_dialog_run (GTK_DIALOG (confirmation_dialog))==GTK_RESPONSE_OK); gtk_widget_destroy (confirmation_dialog); if (!dialog_response) { - if (clean_list) - g_list_free (att_list); + g_object_unref (att_list); return; } hildon_banner_show_information (NULL, NULL, _("mcen_ib_removing_attachment")); - - for (node = att_list; node != NULL; node = g_list_next (node)) { - TnyMimePart *mime_part = (TnyMimePart *) node->data; + + for (iter = tny_list_create_iterator (att_list); + !tny_iterator_is_done (iter); + tny_iterator_next (iter)) { + TnyMimePart *mime_part = (TnyMimePart *) tny_iterator_get_current (iter); const gchar *att_id; - priv->attachments = g_list_remove (priv->attachments, mime_part); + tny_list_remove (priv->attachments, (GObject *) mime_part); modest_attachments_view_remove_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), mime_part); - if (priv->attachments == NULL) + if (tny_list_get_length (priv->attachments) == 0) gtk_widget_hide (priv->attachments_caption); att_id = tny_mime_part_get_content_id (mime_part); if (att_id != NULL) text_buffer_delete_images_by_id (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->msg_body)), att_id); - g_object_unref (mime_part); gtk_text_buffer_set_modified (priv->text_buffer, TRUE); + g_object_unref (mime_part); } } - if (clean_list) - g_list_free (att_list); + g_object_unref (att_list); + + /* if the last attachment has been removed, focus the Subject: field */ + if (!modest_attachments_view_has_attachments (MODEST_ATTACHMENTS_VIEW (priv->attachments_view))) + gtk_widget_grab_focus (priv->subject_field); } static void @@ -2185,7 +2237,7 @@ modest_msg_edit_window_size_change (GtkCheckMenuItem *menu_item, /* wp_text_buffer_set_format (WP_TEXT_BUFFER (priv->text_buffer), &format); */ if (!wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT_SIZE, - (gpointer) wp_get_font_size_index (new_size_index, 12))) + GINT_TO_POINTER (wp_get_font_size_index (new_size_index, 12)))) wp_text_view_reset_and_show_im (WP_TEXT_VIEW (priv->msg_body)); text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (window)); @@ -2216,7 +2268,7 @@ modest_msg_edit_window_font_change (GtkCheckMenuItem *menu_item, new_font_index = wp_get_font_index (gtk_label_get_text (GTK_LABEL (label)), DEFAULT_FONT); if (!wp_text_buffer_set_attribute (WP_TEXT_BUFFER (priv->text_buffer), WPT_FONT, - (gpointer) new_font_index)) + GINT_TO_POINTER(new_font_index))) wp_text_view_reset_and_show_im (WP_TEXT_VIEW (priv->msg_body)); text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (window)); @@ -2226,117 +2278,6 @@ modest_msg_edit_window_font_change (GtkCheckMenuItem *menu_item, } } -static void -modest_msg_edit_window_set_zoom (ModestWindow *window, - gdouble zoom) -{ - ModestMsgEditWindowPrivate *priv; - ModestWindowPrivate *parent_priv; - GtkRadioAction *zoom_radio_action; - - g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); - - priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); - parent_priv = MODEST_WINDOW_GET_PRIVATE (window); - priv->zoom_level = zoom; - wp_text_buffer_set_font_scaling_factor (WP_TEXT_BUFFER (priv->text_buffer), zoom*DEFAULT_FONT_SCALE); - - /* Zoom level menu options should be updated with the current zoom level */ - parent_priv = MODEST_WINDOW_GET_PRIVATE (window); - zoom_radio_action = GTK_RADIO_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, - "/MenuBar/ViewMenu/ZoomMenu/Zoom50Menu")); -#ifdef MODEST_HAVE_HILDON0_WIDGETS - /* FIXME: Not availible before Gtk 2.10 */ -#else - gtk_radio_action_set_current_value (zoom_radio_action, (gint) (zoom*100.0+0.1)); -#endif -} - -static gdouble -modest_msg_edit_window_get_zoom (ModestWindow *window) -{ - ModestMsgEditWindowPrivate *priv; - - g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), 1.0); - - priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); - return priv->zoom_level; -} - -static gboolean -zoom_allowed (ModestMsgEditWindow *window) -{ - GtkWidget *focus; - - focus = gtk_window_get_focus (GTK_WINDOW (window)); - return (focus != NULL && WP_IS_TEXT_VIEW (focus)); -} - -static gboolean -modest_msg_edit_window_zoom_plus (ModestWindow *window) -{ - ModestWindowPrivate *parent_priv; - GtkRadioAction *zoom_radio_action; - GSList *group, *node; - - /* First we check if the text view is focused. If not, zooming is not allowed */ - if (!zoom_allowed (MODEST_MSG_EDIT_WINDOW (window))) { - hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_cannot_zoom_here")); - return FALSE; - } - - parent_priv = MODEST_WINDOW_GET_PRIVATE (window); - zoom_radio_action = GTK_RADIO_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, - "/MenuBar/ViewMenu/ZoomMenu/Zoom50Menu")); - - group = gtk_radio_action_get_group (zoom_radio_action); - - if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (group->data))) { - hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_max_zoom_level_reached")); - return FALSE; - } - - for (node = group; node != NULL; node = g_slist_next (node)) { - if ((node->next != NULL) && gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (node->next->data))) { - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (node->data), TRUE); - return TRUE; - } - } - return FALSE; -} - -static gboolean -modest_msg_edit_window_zoom_minus (ModestWindow *window) -{ - ModestWindowPrivate *parent_priv; - GtkRadioAction *zoom_radio_action; - GSList *group, *node; - - /* First we check if the text view is focused. If not, zooming is not allowed */ - if (!zoom_allowed (MODEST_MSG_EDIT_WINDOW (window))) { - hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_cannot_zoom_here")); - return FALSE; - } - - parent_priv = MODEST_WINDOW_GET_PRIVATE (window); - zoom_radio_action = GTK_RADIO_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, - "/MenuBar/ViewMenu/ZoomMenu/Zoom50Menu")); - - group = gtk_radio_action_get_group (zoom_radio_action); - - for (node = group; node != NULL; node = g_slist_next (node)) { - if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (node->data))) { - if (node->next != NULL) { - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (node->next->data), TRUE); - return TRUE; - } else - hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_min_zoom_level_reached")); - break; - } - } - return FALSE; -} - static gboolean modest_msg_edit_window_window_state_event (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata) { @@ -2480,7 +2421,7 @@ modest_msg_edit_window_show_toolbar (ModestWindow *self, action_name = "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarNormalScreenMenu"; action = gtk_ui_manager_get_action (parent_priv->ui_manager, action_name); - modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), + modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), show_toolbar); } @@ -2559,12 +2500,12 @@ modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window, wp_text_buffer_enable_rich_text (WP_TEXT_BUFFER (priv->text_buffer), FALSE); } else { GtkToggleAction *action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatMenu/FileFormatFormattedTextMenu")); - modest_maemo_toggle_action_set_active_block_notify (action, TRUE); + modest_utils_toggle_action_set_active_block_notify (action, TRUE); } } break; } - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (window)); } } @@ -2593,7 +2534,6 @@ modest_msg_edit_window_select_font (ModestMsgEditWindow *window) /* First we get the currently selected font information */ wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), &oldfmt, TRUE); - g_object_set (G_OBJECT (dialog), "font-scaling", priv->zoom_level, NULL); switch (oldfmt.text_position) { case TEXT_POSITION_NORMAL: @@ -2677,6 +2617,7 @@ modest_msg_edit_window_select_font (ModestMsgEditWindow *window) ? TEXT_POSITION_SUPERSCRIPT : TEXT_POSITION_SUBSCRIPT ); fmt.cs.text_position = TRUE; + fmt.font_size = oldfmt.font_size; } if (color_set) { fmt.color = *color; @@ -2689,9 +2630,8 @@ modest_msg_edit_window_select_font (ModestMsgEditWindow *window) } g_free(font_name); if (font_size_set) { - fmt.font_size = wp_get_font_size_index( - font_size, DEFAULT_FONT_SIZE); fmt.cs.font_size = TRUE; + fmt.font_size = wp_get_font_size_index(font_size, DEFAULT_FONT_SIZE); } wp_text_buffer_set_format(WP_TEXT_BUFFER(priv->text_buffer), &fmt); text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), window); @@ -2711,7 +2651,7 @@ modest_msg_edit_window_undo (ModestMsgEditWindow *window) wp_text_buffer_undo (WP_TEXT_BUFFER (priv->text_buffer)); - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (window)); } @@ -2725,7 +2665,7 @@ modest_msg_edit_window_redo (ModestMsgEditWindow *window) wp_text_buffer_redo (WP_TEXT_BUFFER (priv->text_buffer)); - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (window)); } @@ -2821,7 +2761,8 @@ msg_body_focus (GtkWidget *focus, gpointer userdata) { - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (userdata)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (userdata)); + modest_window_check_dimming_rules_group (MODEST_WINDOW (userdata), "ModestClipboardDimmingRules"); return FALSE; } @@ -2829,13 +2770,19 @@ static void recpt_field_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor) { - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (editor)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (editor)); } static void body_changed (GtkTextBuffer *buffer, ModestMsgEditWindow *editor) { - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (editor)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (editor)); +} + +static void +attachments_selection_changed (ModestAttachmentsView *atts_view, ModestMsgEditWindow *window) +{ + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (window)); } void @@ -2985,7 +2932,7 @@ subject_field_changed (GtkEditable *editable, ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); update_window_title (window); gtk_text_buffer_set_modified (priv->text_buffer, TRUE); - modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (window)); + modest_ui_actions_check_window_dimming_rules (MODEST_WINDOW (window)); } static void @@ -3264,8 +3211,7 @@ modest_msg_edit_window_add_part (ModestMsgEditWindow *window, ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); g_return_if_fail (TNY_IS_MIME_PART (part)); - priv->attachments = g_list_prepend (priv->attachments, part); - g_object_ref (part); + tny_list_prepend (priv->attachments, (GObject *) part); modest_attachments_view_add_attachment (MODEST_ATTACHMENTS_VIEW (priv->attachments_view), part); gtk_widget_set_no_show_all (priv->attachments_caption, FALSE); gtk_widget_show_all (priv->attachments_caption); @@ -3345,3 +3291,26 @@ on_account_removed (TnyAccountStore *account_store, modest_ui_actions_on_close_window (NULL, MODEST_WINDOW (user_data)); } } + +static gboolean +on_zoom_minus_plus_not_implemented (ModestWindow *window) +{ + g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), FALSE); + + hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_cannot_zoom_here")); + return FALSE; + +} + +static void +set_zoom_do_nothing (ModestWindow *window, + gdouble zoom) +{ +} + +static gdouble +get_zoom_do_nothing (ModestWindow *window) +{ + return 1.0; +} +