X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fhildon2%2Fmodest-msg-edit-window.c;h=1a7816b3c09153d8c12bd3fb7228dbb8e89c2adb;hp=17e3e60a5ee9b675d5fe4af5d66e6c1bfca217e9;hb=4b690d574fc0ee33ee4204fc9dd07af280aaae4e;hpb=e81ca9261d24e4ad5997329a8bef54d10347fba7 diff --git a/src/hildon2/modest-msg-edit-window.c b/src/hildon2/modest-msg-edit-window.c index 17e3e60..1a7816b 100644 --- a/src/hildon2/modest-msg-edit-window.c +++ b/src/hildon2/modest-msg-edit-window.c @@ -119,9 +119,7 @@ static void modest_msg_edit_window_size_change (GtkCheckMenuItem *menu_item, static void modest_msg_edit_window_font_change (GtkCheckMenuItem *menu_item, gpointer userdata); static void modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window); -static gboolean modest_msg_edit_window_window_state_event (GtkWidget *widget, - GdkEventWindowState *event, - gpointer userdata); + static void modest_msg_edit_window_open_addressbook (ModestMsgEditWindow *window, ModestRecptEditor *editor); static void modest_msg_edit_window_add_attachment_clicked (GtkButton *button, @@ -342,22 +340,6 @@ restore_settings (ModestMsgEditWindow *self) ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (self); conf = modest_runtime_get_conf (); - action = gtk_ui_manager_get_action (parent_priv->ui_manager, - "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarNormalScreenMenu"); - 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_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_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_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 */ action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/EditMenu/CutMenu"); @@ -367,8 +349,7 @@ restore_settings (ModestMsgEditWindow *self) action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/AttachmentsMenu/RemoveAttachmentsMenu"); gtk_action_set_sensitive (action, FALSE); - modest_widget_memory_restore (conf, - G_OBJECT(self), MODEST_CONF_EDIT_WINDOW_KEY); + modest_widget_memory_restore (conf, G_OBJECT(self), MODEST_CONF_EDIT_WINDOW_KEY); } @@ -455,8 +436,6 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj) } -/* FIXME: this is a dup from the one in gtk/ */ - /** * @result: A ModestPairList, which must be freed with modest_pair_list_free(). */ @@ -666,9 +645,6 @@ connect_signals (ModestMsgEditWindow *obj) G_CALLBACK (body_changed), obj); g_signal_connect (G_OBJECT (priv->text_buffer), "modified-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 (priv->text_buffer), "end-user-action", G_CALLBACK (text_buffer_end_user_action), obj); g_signal_connect (G_OBJECT (priv->text_buffer), "mark-set", @@ -731,7 +707,8 @@ init_window (ModestMsgEditWindow *obj) GdkPixbuf *window_icon = NULL; GError *error = NULL; - GtkSizeGroup *size_group; + GtkSizeGroup *title_size_group; + GtkSizeGroup *value_size_group; GtkWidget *subject_box; GtkWidget *attachment_icon; GtkWidget *window_box; @@ -790,17 +767,17 @@ init_window (ModestMsgEditWindow *obj) parent_priv->menubar = NULL; - size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); /* 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 (MODEST_EDITABLE_SIZE, - MODEST_EDITABLE_ARRANGEMENT, + HILDON_BUTTON_ARRANGEMENT_HORIZONTAL, 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); + modest_maemo_utils_set_hbutton_layout (title_size_group, value_size_group, + _("mail_va_from"), priv->from_field); priv->to_field = modest_recpt_editor_new (); priv->cc_field = modest_recpt_editor_new (); @@ -826,22 +803,22 @@ init_window (ModestMsgEditWindow *obj) priv->header_box = gtk_vbox_new (FALSE, 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); - gtk_size_group_add_widget (size_group, priv->subject_field); - gtk_size_group_add_widget (size_group, priv->attachments_view); - g_object_unref (size_group); + to_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group, + _("mail_va_to"), priv->to_field); + priv->cc_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group, + _("mail_va_cc"), priv->cc_field); + priv->bcc_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group, + _("mail_va_hotfix1"), priv->bcc_field); + subject_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group, + _("mail_va_subject"), subject_box); + priv->attachments_caption = modest_maemo_utils_create_captioned (title_size_group, value_size_group, + _("mail_va_attachment"), + priv->attachments_view); + /* modest_recpt_editor_set_field_size_group (MODEST_RECPT_EDITOR (priv->to_field), value_size_group); */ + /* modest_recpt_editor_set_field_size_group (MODEST_RECPT_EDITOR (priv->cc_field), value_size_group); */ + /* modest_recpt_editor_set_field_size_group (MODEST_RECPT_EDITOR (priv->bcc_field), value_size_group); */ + g_object_unref (title_size_group); + g_object_unref (value_size_group); gtk_box_pack_start (GTK_BOX (priv->header_box), priv->from_field, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (priv->header_box), to_caption, FALSE, FALSE, 0); @@ -1539,10 +1516,6 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre modest_dimming_rules_group_add_widget_rule (toolbar_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, - modest_msg_edit_window_clipboard_dimming_entries, - 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); @@ -1926,11 +1899,11 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); 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"); + action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatFormattedTextMenu"); if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) 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"); + action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatPlainTextMenu"); if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), TRUE); } @@ -2250,6 +2223,7 @@ modest_msg_edit_window_insert_image (ModestMsgEditWindow *window) insert_mark = gtk_text_buffer_get_insert (GTK_TEXT_BUFFER (priv->text_buffer)); gtk_text_buffer_get_iter_at_mark (GTK_TEXT_BUFFER (priv->text_buffer), &position, insert_mark); wp_text_buffer_insert_image (WP_TEXT_BUFFER (priv->text_buffer), &position, g_strdup (tny_mime_part_get_content_id (mime_part)), pixbuf); + g_object_unref (pixbuf); } tny_list_prepend (priv->images, (GObject *) mime_part); @@ -2602,31 +2576,6 @@ modest_msg_edit_window_font_change (GtkCheckMenuItem *menu_item, } } -static gboolean -modest_msg_edit_window_window_state_event (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata) -{ - if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { - ModestWindowPrivate *parent_priv; - ModestWindowMgr *mgr; - gboolean is_fullscreen; - GtkAction *fs_toggle_action; - gboolean active; - - mgr = modest_runtime_get_window_mgr (); - is_fullscreen = (modest_window_mgr_get_fullscreen_mode (mgr))?1:0; - - parent_priv = MODEST_WINDOW_GET_PRIVATE (widget); - - fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewToggleFullscreenMenu"); - active = (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)))?1:0; - if (is_fullscreen != active) - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), is_fullscreen); - } - - return FALSE; - -} - void modest_msg_edit_window_show_cc (ModestMsgEditWindow *window, gboolean show) @@ -2727,9 +2676,7 @@ modest_msg_edit_window_show_toolbar (ModestWindow *self, gboolean show_toolbar) { ModestWindowPrivate *parent_priv; - const gchar *action_name; - GtkAction *action; - + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self)); parent_priv = MODEST_WINDOW_GET_PRIVATE(self); @@ -2740,21 +2687,6 @@ modest_msg_edit_window_show_toolbar (ModestWindow *self, gtk_widget_show (GTK_WIDGET (parent_priv->toolbar)); else gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar)); - - /* Update also the actions (to update the toggles in the - menus), we have to do it manually because some other window - of the same time could have changed it (remember that the - toolbar fullscreen mode is shared by all the windows of the - same type */ - if (modest_window_mgr_get_fullscreen_mode (modest_runtime_get_window_mgr ())) - action_name = "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarFullScreenMenu"; - else - action_name = "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarNormalScreenMenu"; - - action = gtk_ui_manager_get_action (parent_priv->ui_manager, action_name); - modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), - show_toolbar); - } void @@ -2776,13 +2708,13 @@ modest_msg_edit_window_set_priority_flags (ModestMsgEditWindow *window, switch (priority_flags) { case TNY_HEADER_FLAG_HIGH_PRIORITY: - gtk_image_set_from_icon_name (GTK_IMAGE (priv->priority_icon), "qgn_list_messaging_high", GTK_ICON_SIZE_MENU); + gtk_image_set_from_icon_name (GTK_IMAGE (priv->priority_icon), MODEST_HEADER_ICON_HIGH, GTK_ICON_SIZE_MENU); gtk_widget_show (priv->priority_icon); priority_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ToolsMenu/MessagePriorityMenu/MessagePriorityHighMenu"); break; case TNY_HEADER_FLAG_LOW_PRIORITY: - gtk_image_set_from_icon_name (GTK_IMAGE (priv->priority_icon), "qgn_list_messaging_low", GTK_ICON_SIZE_MENU); + gtk_image_set_from_icon_name (GTK_IMAGE (priv->priority_icon), "MODEST_HEADER_ICON_LOW", GTK_ICON_SIZE_MENU); gtk_widget_show (priv->priority_icon); priority_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ToolsMenu/MessagePriorityMenu/MessagePriorityLowMenu"); @@ -2830,7 +2762,7 @@ modest_msg_edit_window_set_file_format (ModestMsgEditWindow *window, if (response == GTK_RESPONSE_OK) { 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")); + GtkToggleAction *action = GTK_TOGGLE_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/FormatMenu/FileFormatFormattedTextMenu")); modest_utils_toggle_action_set_active_block_notify (action, TRUE); } }