X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-msg-edit-window.c;h=2df0d39ced024c5aa147ebce6098da4ba4c78836;hp=539d64c5d6ac6829e9d6ad7f6fe611fb8d46bdcf;hb=0a1b33cbe8f22d0af981762b780fa6a0349fae49;hpb=8e88511ff8e810825a3c79f3f3a3cd0add92e520;ds=sidebyside diff --git a/src/hildon2/modest-msg-edit-window.c b/src/hildon2/modest-msg-edit-window.c index 539d64c..2df0d39 100644 --- a/src/hildon2/modest-msg-edit-window.c +++ b/src/hildon2/modest-msg-edit-window.c @@ -78,12 +78,12 @@ #endif #include #include "modest-maemo-utils.h" +#include #define DEFAULT_FONT_SIZE 3 #define DEFAULT_FONT 2 #define DEFAULT_SIZE_BUTTON_FONT_FAMILY "Sans" -#define DEFAULT_SIZE_COMBOBOX_WIDTH 80 #define DEFAULT_MAIN_VBOX_SPACING 6 #define SUBJECT_MAX_LENGTH 1000 #define IMAGE_MAX_WIDTH 560 @@ -738,6 +738,7 @@ init_window (ModestMsgEditWindow *obj) #if (GTK_MINOR_VERSION >= 10) GdkAtom deserialize_type; #endif + priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj); parent_priv = MODEST_WINDOW_GET_PRIVATE (obj); @@ -791,10 +792,15 @@ init_window (ModestMsgEditWindow *obj) size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); - /* Note: This ModestPairList* must exist for as long as the combo - * that uses it, because the ModestComboBox uses the ID opaquely, + /* Note: This ModestPairList* must exist for as long as the picker + * that uses it, because the ModestSelectorPicker uses the ID opaquely, * so it can't know how to manage its memory. */ - priv->from_field = modest_selector_picker_new (NULL, g_str_equal); + priv->from_field = modest_selector_picker_new (MODEST_EDITABLE_SIZE, + MODEST_EDITABLE_ARRANGEMENT, + NULL, g_str_equal); + hildon_button_set_alignment (HILDON_BUTTON (priv->from_field), 0.0, 0.5, 1.0, 0.0); + hildon_button_set_title_alignment (HILDON_BUTTON (priv->from_field), 0.0, 0.5); + hildon_button_set_value_alignment (HILDON_BUTTON (priv->from_field), 0.0, 0.5); priv->to_field = modest_recpt_editor_new (); priv->cc_field = modest_recpt_editor_new (); @@ -802,7 +808,8 @@ init_window (ModestMsgEditWindow *obj) subject_box = gtk_hbox_new (FALSE, 0); priv->priority_icon = gtk_image_new (); gtk_box_pack_start (GTK_BOX (subject_box), priv->priority_icon, FALSE, FALSE, 0); - priv->subject_field = gtk_entry_new_with_max_length (SUBJECT_MAX_LENGTH); + priv->subject_field = hildon_entry_new (MODEST_EDITABLE_SIZE); + gtk_entry_set_max_length (GTK_ENTRY (priv->subject_field) ,SUBJECT_MAX_LENGTH); g_object_set (G_OBJECT (priv->subject_field), "truncate-multiline", TRUE, NULL); hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->subject_field), HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_AUTOCAP); @@ -811,7 +818,7 @@ init_window (ModestMsgEditWindow *obj) GTK_WIDGET_UNSET_FLAGS (GTK_WIDGET (priv->add_attachment_button), GTK_CAN_FOCUS); gtk_button_set_relief (GTK_BUTTON (priv->add_attachment_button), GTK_RELIEF_NONE); gtk_button_set_focus_on_click (GTK_BUTTON (priv->add_attachment_button), FALSE); - gtk_button_set_alignment (GTK_BUTTON (priv->add_attachment_button), 1.0, 1.0); + gtk_button_set_alignment (GTK_BUTTON (priv->add_attachment_button), 1.0, 0.5); attachment_icon = gtk_image_new_from_icon_name (MODEST_HEADER_ICON_ATTACH, GTK_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (priv->add_attachment_button), attachment_icon); gtk_box_pack_start (GTK_BOX (subject_box), priv->add_attachment_button, FALSE, FALSE, 0); @@ -819,14 +826,16 @@ init_window (ModestMsgEditWindow *obj) priv->header_box = gtk_vbox_new (FALSE, 0); - to_caption = hildon_caption_new (size_group, _("mail_va_to"), priv->to_field, NULL, 0); - priv->cc_caption = hildon_caption_new (size_group, _("mail_va_cc"), priv->cc_field, NULL, 0); - priv->bcc_caption = hildon_caption_new (size_group, _("mail_va_hotfix1"), priv->bcc_field, NULL, 0); - subject_caption = hildon_caption_new (size_group, _("mail_va_subject"), subject_box, NULL, 0); - priv->attachments_caption = hildon_caption_new (size_group, _("mail_va_attachment"), priv->attachments_view, NULL, 0); + hildon_button_add_title_size_group (HILDON_BUTTON (priv->from_field), size_group); + to_caption = modest_maemo_utils_create_captioned (size_group, _("mail_va_to"), priv->to_field); + priv->cc_caption = modest_maemo_utils_create_captioned (size_group, _("mail_va_cc"), priv->cc_field); + priv->bcc_caption = modest_maemo_utils_create_captioned (size_group, _("mail_va_hotfix1"), priv->bcc_field); + subject_caption = modest_maemo_utils_create_captioned (size_group, _("mail_va_subject"), subject_box); + priv->attachments_caption = modest_maemo_utils_create_captioned (size_group, _("mail_va_attachment"), priv->attachments_view); g_object_unref (size_group); size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + hildon_button_add_value_size_group (HILDON_BUTTON (priv->from_field), size_group); modest_recpt_editor_set_field_size_group (MODEST_RECPT_EDITOR (priv->to_field), size_group); modest_recpt_editor_set_field_size_group (MODEST_RECPT_EDITOR (priv->cc_field), size_group); modest_recpt_editor_set_field_size_group (MODEST_RECPT_EDITOR (priv->bcc_field), size_group); @@ -968,7 +977,7 @@ modest_msg_edit_window_finalize (GObject *obj) g_object_unref (priv->attachments); g_object_unref (priv->images); - /* This had to stay alive for as long as the combobox that used it: */ + /* This had to stay alive for as long as the picker that used it: */ modest_pair_list_free (priv->from_field_protos); G_OBJECT_CLASS(parent_class)->finalize (obj); @@ -999,6 +1008,8 @@ pixbuf_from_stream (TnyStream *stream, const gchar *mime_type, guint64 *stream_s readed = tny_stream_read (TNY_STREAM (stream), (char *) read_buffer, 128); size += readed; if (!gdk_pixbuf_loader_write (loader, read_buffer, readed, &error)) { + if (error) + g_error_free (error); break; } } @@ -1232,10 +1243,6 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg, gboolean preserve_is_rich) gtk_widget_grab_focus (priv->msg_body); } - /* TODO: lower priority, select in the From: combo to the - value that comes from msg <- not sure, should it be - allowed? */ - DEBUG_BUFFER (WP_TEXT_BUFFER (priv->text_buffer)); gtk_text_buffer_get_start_iter (priv->text_buffer, &iter); @@ -1897,6 +1904,7 @@ modest_msg_edit_window_set_format_state (ModestMsgEditWindow *self, text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), self); + g_free (buffer_format); g_free (current_format); /* Check dimming rules */ @@ -2164,7 +2172,7 @@ modest_msg_edit_window_insert_image (ModestMsgEditWindow *window) modest_maemo_utils_setup_images_filechooser (GTK_FILE_CHOOSER (dialog)); modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), - GTK_WINDOW (dialog)); + GTK_WINDOW (dialog), GTK_WINDOW (window)); response = gtk_dialog_run (GTK_DIALOG (dialog)); switch (response) { @@ -2278,7 +2286,7 @@ modest_msg_edit_window_offer_attach_file (ModestMsgEditWindow *window) dialog = hildon_file_chooser_dialog_new (GTK_WINDOW (window), GTK_FILE_CHOOSER_ACTION_OPEN); gtk_window_set_title (GTK_WINDOW (dialog), _("mcen_ti_select_attachment_title")); gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE); - modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog)); + modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), GTK_WINDOW (window)); response = gtk_dialog_run (GTK_DIALOG (dialog)); switch (response) { @@ -2857,7 +2865,7 @@ modest_msg_edit_window_select_font (ModestMsgEditWindow *window) dialog = hildon_font_selection_dialog_new (GTK_WINDOW (window), NULL); modest_window_mgr_set_modal (modest_runtime_get_window_mgr(), - GTK_WINDOW(dialog)); + GTK_WINDOW(dialog), GTK_WINDOW (window)); /* First we get the currently selected font information */ wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), &oldfmt, TRUE); @@ -2894,7 +2902,7 @@ modest_msg_edit_window_select_font (ModestMsgEditWindow *window) NULL); modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), - GTK_WINDOW (dialog)); + GTK_WINDOW (dialog), GTK_WINDOW (window)); gtk_widget_show_all (dialog); priv->font_dialog = dialog; response = gtk_dialog_run (GTK_DIALOG (dialog)); @@ -3548,8 +3556,12 @@ modest_msg_edit_window_set_draft (ModestMsgEditWindow *window, priv->msg_uid = NULL; } priv->msg_uid = modest_tny_folder_get_header_unique_id (header); - if (GTK_WIDGET_REALIZED (window)) - modest_window_mgr_register_window (mgr, MODEST_WINDOW (window)); + if (GTK_WIDGET_REALIZED (window)) { + if (!modest_window_mgr_register_window (mgr, MODEST_WINDOW (window), NULL)) { + gtk_widget_destroy (GTK_WIDGET (window)); + return; + } + } } priv->draft_msg = draft;