From: Jose Dapena Paz Date: Thu, 12 Apr 2007 11:13:11 +0000 (+0000) Subject: * src/modest-ui-actions.[ch]: X-Git-Tag: git_migration_finished~3904 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=5a5108804dcac3687462958bd3ca208694e0e9a4 * src/modest-ui-actions.[ch]: * Refactored and reworked fullscreen methods to use the new modest_window_mgr methods. * New Zoom plus and Zoom minus action handlers using the new ModestWindow zooming interfaces. * Added handlers for toggle actions "Show Cc:" and "Show Bcc:". * src/maemo/modest-main-window-ui.h: * Put zoom actions in main window action list. * Use the new fullscreen actions interface. * src/maemo/modest-msg-edit-window.ch: * Implement the ModestWindow set_zoom and get_zoom interfaces. Added menu actions for switching among different zoom levels. * Implement full view scroll of the editor. Now it includes the headers in the scrollable area. It uses the mark_set event handler of the body GtkTextView, to update the scroll current value. * Replaced buttons and labels form header fields with HildonCaption, to fit UI specs (and make the UI more usable). * Added autocap setters. * Max length of the subject field is now 1000 characters. * Support for fullscreen modes (not ended yet). * If To: field is empty on setting a new message to edit, it's the field to take focus. If not, focus goes to body editor. * Added zoom plus and minus key shortcuts. * Implemented showing/hiding Cc: and Bcc: fields depending on the selected menu option. * src/maemo/modest-main-window.[ch]: * Replaced radio menu options for fullscreen modes with a toggle. * Added support for the new window manager fullscreen management API and behavior. * src/maemo/ui/modest-msg-edit-window-ui.xml: * Added zoom levels to menu. * Added fullscreen toggle to menu. * Added key accelerators for zoom and fullscreen. * src/maemo/ui/modest-main-window-ui.xml: * Added key accelerator for fullscreen. * Now it uses the fullscreen toggle instead of radio menu items. * src/maemo/modest-msg-view-window.c: * Use the new zooming api available in ModestMsgWindow. Add fullscreen state code to modify the status of the fullscreen toggle action. * src/gnome/modest-msg-edit-window.c: * Added some stubs for newly implemented functionality in maemo client. Anyway, there may be missing ones to compile in gnome. * src/widgets/modest-msg-edit-window.h: * Added new methods for toggling Cc: and Bcc: fields. * Added interface for toggling fullscreen status. * src/widgets/modest-window-mgr.[ch]: * Added method for getting the current fullscreen status. * src/widgets/modest-window.[ch]: * Added interface methods for working with zoom (set/get, and minus/plus). Added also default empty implementations. * src/widgets/modest-msg-view-window.h: * Added toggle fullscreen method. * src/widgets/modest-msg-edit-window-ui.h: * Added zoom support menu options. * Added fullscreen toggle menu option * Updated the Cc: and Bcc: field toggles, and removed the To: toggle. * Added key accelerator actions for zoom and fullscreen. pmo-trunk-r1548 --- diff --git a/src/gnome/modest-msg-edit-window.c b/src/gnome/modest-msg-edit-window.c index 62d56a0..4d773f8 100644 --- a/src/gnome/modest-msg-edit-window.c +++ b/src/gnome/modest-msg-edit-window.c @@ -489,3 +489,86 @@ modest_msg_edit_window_insert_image (ModestMsgEditWindow *window) g_message ("Insert image operation is not supported"); } + +void +modest_msg_edit_window_show_cc (ModestMsgEditWindow *window, + gboolean show) +{ + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); + + g_message ("not implemented yet %s", __FUNCTION__); +} +void +modest_msg_edit_window_show_bcc (ModestMsgEditWindow *window, + gboolean show) +{ + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); + + g_message ("not implemented yet %s", __FUNCTION__); +} + +static void +modest_msg_edit_window_set_zoom (ModestWindow *window, + gdouble zoom) +{ + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); + +} + +static gdouble +modest_msg_edit_window_get_zoom (ModestWindow *window) +{ + g_return_val_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window), 1.0); + + return 1.0; +} + +static void +modest_msg_edit_window_zoom_plus (GtkAction *action, ModestWindow *window) +{ + ModestWindowPrivate *parent_priv; + GtkRadioAction *zoom_radio_action; + GSList *group, *node; + + 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, _("mcen_ib_max_zoom_level")); + return; + } + + 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; + } + } +} + +static void +modest_msg_edit_window_zoom_minus (GtkAction *action, ModestWindow *window) +{ + ModestWindowPrivate *parent_priv; + GtkRadioAction *zoom_radio_action; + GSList *group, *node; + + 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); + else + hildon_banner_show_information (NULL, NULL, _("mcen_ib_min_zoom_level")); + break; + } + } +} diff --git a/src/maemo/modest-main-window-ui.h b/src/maemo/modest-main-window-ui.h index 969fec9..9547872 100644 --- a/src/maemo/modest-main-window-ui.h +++ b/src/maemo/modest-main-window-ui.h @@ -53,6 +53,11 @@ static const GtkActionEntry modest_action_entries [] = { { "Close", NULL, N_("mcen_me_inbox_close") }, { "Zoom", NULL, N_("Zoom") }, + /* Zoom and fullscreen keyboard actions*/ + { "ZoomPlus", NULL, N_("Zoom +"), "F7", NULL, G_CALLBACK (modest_ui_actions_on_zoom_plus) }, + { "ZoomMinus", NULL, N_("Zoom -"), "F8", NULL, G_CALLBACK (modest_ui_actions_on_zoom_minus) }, + { "ToggleFullscreen", NULL, N_("Toggle fullscreen"), "F6", NULL, G_CALLBACK (modest_ui_actions_on_change_fullscreen) }, + /* Email */ { "EmailNew", NULL, N_("mcen_me_inbox_new") }, /* submenu */ { "EmailNewMessage", NULL, N_("mcen_me_inbox_message"), "N", NULL, G_CALLBACK (modest_ui_actions_on_new_msg) }, diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index 728dea5..4bb0fb7 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -56,6 +56,9 @@ static void modest_main_window_class_init (ModestMainWindowClass *klass); static void modest_main_window_init (ModestMainWindow *obj); static void modest_main_window_finalize (GObject *obj); +static gboolean modest_main_window_window_state_event (GtkWidget *widget, + GdkEventWindowState *event, + gpointer userdata); static void connect_signals (ModestMainWindow *self); static void restore_sizes (ModestMainWindow *self); @@ -92,13 +95,6 @@ typedef struct _GetMsgAsyncHelper { } GetMsgAsyncHelper; -/* FIXME use an enum not values, UI actions must know them. Create a - modest-window-mgr-ui.h and include it here? */ -static const GtkRadioActionEntry main_window_radio_action_entries [] = { - { "ViewFolders", NULL, N_("mcen_me_inbox_hidefolders"), NULL, NULL, 0 }, - { "ViewFullscreen", NULL, N_("mcen_me_inbox_fullscreen"), NULL, NULL, 1 }, -}; - /* globals */ static GtkWindowClass *parent_class = NULL; @@ -343,6 +339,10 @@ connect_signals (ModestMainWindow *self) /* window */ g_signal_connect (G_OBJECT(self), "delete-event", G_CALLBACK(on_delete_event), self); + g_signal_connect (G_OBJECT (self), "window-state-event", + G_CALLBACK (modest_main_window_window_state_event), + NULL); + /* modest_maemo_utils_get_device_name will probably change @@ -390,13 +390,11 @@ modest_main_window_new (void) G_N_ELEMENTS (modest_action_entries), self); - gtk_action_group_add_radio_actions (action_group, - main_window_radio_action_entries, - G_N_ELEMENTS (main_window_radio_action_entries), - 0, - G_CALLBACK (modest_ui_actions_on_change_fullscreen), - self); - + gtk_action_group_add_toggle_actions (action_group, + modest_toggle_action_entries, + G_N_ELEMENTS (modest_toggle_action_entries), + self); + gtk_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0); g_object_unref (action_group); @@ -502,3 +500,30 @@ modest_main_window_close_all (ModestMainWindow *self) else return FALSE; } + +static gboolean +modest_main_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); + + parent_priv = MODEST_WINDOW_GET_PRIVATE (widget); + + fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ShowToggleFullscreenMenu"); + 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; + +} diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 7910a87..86d8c58 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,6 @@ #include -#include #include "modest-icon-names.h" #include "modest-widget-memory.h" #include "modest-window-priv.h" @@ -56,6 +56,8 @@ #include #include #include +#include +#include #ifdef MODEST_HILDON_VERSION_0 #include @@ -64,15 +66,19 @@ #endif /*MODEST_HILDON_VERSION_0 */ + #define DEFAULT_FONT_SIZE 3 #define DEFAULT_FONT 2 #define DEFAULT_SIZE_COMBOBOX_WIDTH 80 +#define DEFAULT_MAIN_VBOX_SPACING 6 +#define SUBJECT_MAX_LENGTH 1000 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 void text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *window); +static void text_buffer_mark_set (GtkTextBuffer *buffer, GtkTextIter *location, GtkTextMark *mark, gpointer userdata); static void modest_msg_edit_window_color_button_change (ModestMsgEditWindow *window, gpointer userdata); static void modest_msg_edit_window_size_combobox_change (ModestMsgEditWindow *window, @@ -80,6 +86,19 @@ static void modest_msg_edit_window_size_combobox_change (ModestMsgEditWindow *w static void modest_msg_edit_window_font_combobox_change (ModestMsgEditWindow *window, 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); + +/* ModestWindow methods implementation */ +static void modest_msg_edit_window_set_zoom (ModestWindow *window, gdouble zoom); +static gdouble modest_msg_edit_window_get_zoom (ModestWindow *window); +static void modest_msg_edit_window_zoom_minus (GtkAction *action, ModestWindow *window); +static void modest_msg_edit_window_zoom_plus (GtkAction *action, ModestWindow *window); + +#include + + /* list my signals */ enum { @@ -91,20 +110,28 @@ enum { typedef struct _ModestMsgEditWindowPrivate ModestMsgEditWindowPrivate; struct _ModestMsgEditWindowPrivate { GtkWidget *msg_body; + GtkWidget *header_box; GtkWidget *from_field; GtkWidget *to_field; GtkWidget *cc_field; GtkWidget *bcc_field; GtkWidget *subject_field; + GtkWidget *cc_caption; + GtkWidget *bcc_caption; + GtkTextBuffer *text_buffer; GtkWidget *font_color_button; GtkWidget *size_combobox; GtkWidget *font_combobox; + GtkWidget *scroll; + gint last_cid; GList *attachments; + + gdouble zoom_level; }; #define MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ @@ -146,11 +173,16 @@ static void modest_msg_edit_window_class_init (ModestMsgEditWindowClass *klass) { GObjectClass *gobject_class; + ModestWindowClass *modest_window_class; gobject_class = (GObjectClass*) klass; + modest_window_class = (ModestWindowClass*) 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; + g_type_class_add_private (gobject_class, sizeof(ModestMsgEditWindowPrivate)); } @@ -166,8 +198,12 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj) priv->cc_field = NULL; priv->bcc_field = NULL; priv->subject_field = NULL; - priv->attachments = NULL; - priv->last_cid = 0; + priv->attachments = NULL; + priv->last_cid = 0; + priv->zoom_level = 1.0; + + priv->cc_caption = NULL; + priv->bcc_caption = NULL; } @@ -219,47 +255,84 @@ get_transports (void) } +static void +text_buffer_mark_set (GtkTextBuffer *buffer, GtkTextIter *iter, GtkTextMark *mark, gpointer userdata) +{ + ModestMsgEditWindow *window; + ModestMsgEditWindowPrivate *priv; + GdkRectangle location; + gint v_scroll_min_value = 0; + gint v_scroll_max_value = 0; + gint v_scroll_visible; + GtkAdjustment *vadj; + GtkTextMark *insert_mark; + GtkTextIter insert_iter; + + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (userdata)); + g_return_if_fail (GTK_IS_TEXT_MARK (mark)); + window = MODEST_MSG_EDIT_WINDOW (userdata); + priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (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), &insert_iter, insert_mark); + gtk_text_view_get_iter_location (GTK_TEXT_VIEW (priv->msg_body), &insert_iter, &location); + + if (priv->header_box) + v_scroll_min_value += priv->header_box->allocation.height + DEFAULT_MAIN_VBOX_SPACING; + v_scroll_min_value += location.y; + v_scroll_max_value = v_scroll_min_value + location.height; + + v_scroll_visible = GTK_WIDGET (window)->allocation.height; + + vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->scroll)); + + if (((gdouble) v_scroll_min_value) < vadj->value) + gtk_adjustment_set_value (vadj, v_scroll_min_value); + else if (((gdouble) v_scroll_max_value) > (vadj->value + vadj->page_size)) + gtk_adjustment_set_value (vadj, ((gdouble)v_scroll_max_value) - vadj->page_size); +} static void init_window (ModestMsgEditWindow *obj) { - GtkWidget *to_button, *cc_button, *bcc_button; - GtkWidget *header_table; + GtkWidget *from_caption, *to_caption, *subject_caption; GtkWidget *main_vbox; - GtkWidget *body_scroll; ModestMsgEditWindowPrivate *priv; ModestPairList *protos; + GtkSizeGroup *size_group; priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(obj); - to_button = gtk_button_new_with_label (_("To...")); - cc_button = gtk_button_new_with_label (_("Cc...")); - bcc_button = gtk_button_new_with_label (_("Bcc...")); - + size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + protos = get_transports (); priv->from_field = modest_combo_box_new (protos, g_str_equal); modest_pair_list_free (protos); priv->to_field = gtk_entry_new_with_max_length (80); + g_object_set (G_OBJECT (priv->to_field), "autocap", FALSE, NULL); priv->cc_field = gtk_entry_new_with_max_length (80); + g_object_set (G_OBJECT (priv->cc_field), "autocap", FALSE, NULL); priv->bcc_field = gtk_entry_new_with_max_length (80); + g_object_set (G_OBJECT (priv->bcc_field), "autocap", FALSE, NULL); priv->subject_field = gtk_entry_new_with_max_length (80); + g_object_set (G_OBJECT (priv->subject_field), "autocap", TRUE, NULL); + gtk_entry_set_max_length (GTK_ENTRY (priv->subject_field), SUBJECT_MAX_LENGTH); - header_table = gtk_table_new (5,2, FALSE); + priv->header_box = gtk_vbox_new (FALSE, 0); - gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("From:")), - 0,1,0,1, GTK_SHRINK, 0, 0, 0); - gtk_table_attach (GTK_TABLE(header_table), to_button, 0,1,1,2, GTK_SHRINK, 0, 0, 0); - gtk_table_attach (GTK_TABLE(header_table), cc_button, 0,1,2,3, GTK_SHRINK, 0, 0, 0); - gtk_table_attach (GTK_TABLE(header_table), bcc_button, 0,1,3,4, GTK_SHRINK, 0, 0, 0); - gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("Subject:")), - 0,1,4,5, GTK_SHRINK, 0, 0, 0); - - gtk_table_attach_defaults (GTK_TABLE(header_table), priv->from_field, 1,2,0,1); - gtk_table_attach_defaults (GTK_TABLE(header_table), priv->to_field, 1,2,1,2); - gtk_table_attach_defaults (GTK_TABLE(header_table), priv->cc_field, 1,2,2,3); - gtk_table_attach_defaults (GTK_TABLE(header_table), priv->bcc_field, 1,2,3,4); - gtk_table_attach_defaults (GTK_TABLE(header_table), priv->subject_field,1,2,4,5); + from_caption = hildon_caption_new (size_group, _("From:"), priv->from_field, NULL, 0); + to_caption = hildon_caption_new (size_group, _("To:"), priv->to_field, NULL, 0); + priv->cc_caption = hildon_caption_new (size_group, _("Cc:"), priv->cc_field, NULL, 0); + priv->bcc_caption = hildon_caption_new (size_group, _("Bcc:"), priv->bcc_field, NULL, 0); + subject_caption = hildon_caption_new (size_group, _("Subject:"), priv->subject_field, NULL, 0); + + gtk_box_pack_start (GTK_BOX (priv->header_box), from_caption, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (priv->header_box), to_caption, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (priv->header_box), priv->cc_caption, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (priv->header_box), priv->bcc_caption, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (priv->header_box), subject_caption, FALSE, FALSE, 0); + priv->msg_body = wp_text_view_new (); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->msg_body), GTK_WRAP_WORD_CHAR); @@ -270,25 +343,31 @@ init_window (ModestMsgEditWindow *obj) wp_text_buffer_reset_buffer (WP_TEXT_BUFFER (priv->text_buffer), TRUE); g_signal_connect (G_OBJECT (priv->text_buffer), "refresh_attributes", G_CALLBACK (text_buffer_refresh_attributes), obj); - - body_scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (body_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (body_scroll), GTK_SHADOW_IN); - gtk_container_add (GTK_CONTAINER (body_scroll), priv->msg_body); + g_signal_connect (G_OBJECT (priv->text_buffer), "mark-set", + G_CALLBACK (text_buffer_mark_set), obj); + g_signal_connect (G_OBJECT (obj), "window-state-event", + G_CALLBACK (modest_msg_edit_window_window_state_event), + NULL); + + priv->scroll = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->scroll), GTK_SCROLL_NONE); - main_vbox = gtk_vbox_new (FALSE, 6); + main_vbox = gtk_vbox_new (FALSE, DEFAULT_MAIN_VBOX_SPACING); - gtk_box_pack_start (GTK_BOX(main_vbox), header_table, FALSE, FALSE, 6); - gtk_box_pack_start (GTK_BOX(main_vbox), body_scroll, TRUE, TRUE, 6); + gtk_box_pack_start (GTK_BOX(main_vbox), priv->header_box, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX(main_vbox), priv->msg_body, TRUE, TRUE, 0); - gtk_widget_show_all (GTK_WIDGET(main_vbox)); + gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (priv->scroll), main_vbox); + gtk_container_set_focus_vadjustment (GTK_CONTAINER (main_vbox), gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->scroll))); + gtk_widget_show_all (GTK_WIDGET(priv->scroll)); if (!modest_conf_get_bool(modest_runtime_get_conf(), MODEST_CONF_SHOW_CC, NULL)) gtk_widget_hide (priv->cc_field); if (!modest_conf_get_bool(modest_runtime_get_conf(), MODEST_CONF_SHOW_BCC, NULL)) gtk_widget_hide (priv->bcc_field); - gtk_container_add (GTK_CONTAINER(obj), main_vbox); + gtk_container_add (GTK_CONTAINER(obj), priv->scroll); } @@ -360,7 +439,7 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg) gtk_entry_set_text (GTK_ENTRY(priv->bcc_field), bcc); if (subject) gtk_entry_set_text (GTK_ENTRY(priv->subject_field), subject); - + /* gtk_text_buffer_set_can_paste_rich_text (priv->text_buffer, TRUE); */ wp_text_buffer_reset_buffer (WP_TEXT_BUFFER (priv->text_buffer), TRUE); body = modest_tny_msg_get_body (msg, FALSE); @@ -385,6 +464,12 @@ set_msg (ModestMsgEditWindow *self, TnyMsg *msg) wp_text_buffer_set_format (WP_TEXT_BUFFER (priv->text_buffer), &fmt); } + if (!to) { + gtk_widget_grab_focus (priv->to_field); + } else { + 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? */ @@ -482,6 +567,12 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name) GTK_JUSTIFY_LEFT, 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_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0); g_object_unref (action_group); @@ -992,3 +1083,143 @@ modest_msg_edit_window_font_combobox_change (ModestMsgEditWindow *window, text_buffer_refresh_attributes (WP_TEXT_BUFFER (priv->text_buffer), MODEST_MSG_EDIT_WINDOW (window)); } + +static void +modest_msg_edit_window_set_zoom (ModestWindow *window, + gdouble zoom) +{ + ModestMsgEditWindowPrivate *priv; + + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); + + priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); + priv->zoom_level = zoom; + wp_text_buffer_set_font_scaling_factor (WP_TEXT_BUFFER (priv->text_buffer), zoom); +} + +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 void +modest_msg_edit_window_zoom_plus (GtkAction *action, ModestWindow *window) +{ + ModestWindowPrivate *parent_priv; + GtkRadioAction *zoom_radio_action; + GSList *group, *node; + + 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, _("mcen_ib_max_zoom_level")); + return; + } + + 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; + } + } +} + +static void +modest_msg_edit_window_zoom_minus (GtkAction *action, ModestWindow *window) +{ + ModestWindowPrivate *parent_priv; + GtkRadioAction *zoom_radio_action; + GSList *group, *node; + + 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); + else + hildon_banner_show_information (NULL, NULL, _("mcen_ib_min_zoom_level")); + break; + } + } +} + +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; + gboolean is_fullscreen; + GtkAction *fs_toggle_action; + gboolean active; + + is_fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)?1:0; + + parent_priv = MODEST_WINDOW_GET_PRIVATE (widget); + + fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ShowToggleFullscreenMenu"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)); + if (is_fullscreen != active) + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), is_fullscreen); + } + + return FALSE; + +} + +void +modest_msg_edit_window_toggle_fullscreen (ModestMsgEditWindow *window) +{ + ModestWindowPrivate *parent_priv; + GtkAction *fs_toggle_action; + gboolean active; + + parent_priv = MODEST_WINDOW_GET_PRIVATE (window); + + fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ShowToggleFullscreenMenu"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), !active); +} + +void +modest_msg_edit_window_show_cc (ModestMsgEditWindow *window, + gboolean show) +{ + ModestMsgEditWindowPrivate *priv = NULL; + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); + + priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); + if (show) + gtk_widget_show (priv->cc_caption); + else + gtk_widget_hide (priv->cc_caption); +} + +void +modest_msg_edit_window_show_bcc (ModestMsgEditWindow *window, + gboolean show) +{ + ModestMsgEditWindowPrivate *priv = NULL; + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); + + priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (window); + if (show) + gtk_widget_show (priv->bcc_caption); + else + gtk_widget_hide (priv->bcc_caption); +} + diff --git a/src/maemo/modest-msg-view-window.c b/src/maemo/modest-msg-view-window.c index 15547aa..db51502 100644 --- a/src/maemo/modest-msg-view-window.c +++ b/src/maemo/modest-msg-view-window.c @@ -57,14 +57,16 @@ static void modest_msg_view_window_find_toolbar_search (GtkWidget *widget, static void modest_msg_view_window_set_zoom (ModestWindow *window, gdouble zoom); static gdouble modest_msg_view_window_get_zoom (ModestWindow *window); -static void modest_msg_view_window_zoom_minus (GtkAction *action, ModestWindow *window); -static void modest_msg_view_window_zoom_plus (GtkAction *action, ModestWindow *window); +static gboolean modest_msg_view_window_zoom_minus (ModestWindow *window); +static gboolean modest_msg_view_window_zoom_plus (ModestWindow *window); static gboolean modest_msg_view_window_key_release_event (GtkWidget *window, GdkEventKey *event, gpointer userdata); +static gboolean modest_msg_view_window_window_state_event (GtkWidget *widget, + GdkEventWindowState *event, + gpointer userdata); static void modest_msg_view_window_scroll_up (ModestWindow *window); static void modest_msg_view_window_scroll_down (ModestWindow *window); -static void modest_msg_view_window_toggle_fullscreen (GtkAction *action, ModestWindow *window); static gboolean modest_msg_view_window_is_last_message (ModestMsgViewWindow *window); static gboolean modest_msg_view_window_is_first_message (ModestMsgViewWindow *window); static TnyFolderType modest_msg_view_window_get_folder_type (ModestMsgViewWindow *window); @@ -94,12 +96,6 @@ static const GtkRadioActionEntry msg_view_zoom_action_entries [] = { { "Zoom200", NULL, N_("mcen_me_viewer_200"), NULL, NULL, 200 } }; -static const GtkActionEntry modest_msg_view_action_entries [] = { - { "ZoomPlus", NULL, N_("Zoom +"), "F7", NULL, G_CALLBACK (modest_msg_view_window_zoom_plus) }, - { "ZoomMinus", NULL, N_("Zoom -"), "F8", NULL, G_CALLBACK (modest_msg_view_window_zoom_minus) }, - { "ToggleFullscreen", NULL, N_("Toggle fullscreen"), "F6", NULL, G_CALLBACK (modest_msg_view_window_toggle_fullscreen) }, -}; - typedef struct _ModestMsgViewWindowPrivate ModestMsgViewWindowPrivate; struct _ModestMsgViewWindowPrivate { @@ -160,6 +156,8 @@ modest_msg_view_window_class_init (ModestMsgViewWindowClass *klass) modest_window_class->set_zoom_func = modest_msg_view_window_set_zoom; modest_window_class->get_zoom_func = modest_msg_view_window_get_zoom; + modest_window_class->zoom_minus_func = modest_msg_view_window_zoom_minus; + modest_window_class->zoom_plus_func = modest_msg_view_window_zoom_plus; g_type_class_add_private (gobject_class, sizeof(ModestMsgViewWindowPrivate)); } @@ -378,14 +376,10 @@ modest_msg_view_window_new (TnyMsg *msg, const gchar *account_name) modest_action_entries, G_N_ELEMENTS (modest_action_entries), obj); - gtk_action_group_add_actions (action_group, - modest_msg_view_action_entries, - G_N_ELEMENTS (modest_msg_view_action_entries), - obj); gtk_action_group_add_toggle_actions (action_group, - modest_toggle_action_entries, - G_N_ELEMENTS (modest_toggle_action_entries), - obj); + modest_toggle_action_entries, + G_N_ELEMENTS (modest_toggle_action_entries), + obj); gtk_action_group_add_toggle_actions (action_group, msg_view_toggle_action_entries, G_N_ELEMENTS (msg_view_toggle_action_entries), @@ -438,6 +432,10 @@ modest_msg_view_window_new (TnyMsg *msg, const gchar *account_name) G_CALLBACK (modest_msg_view_window_key_release_event), NULL); + g_signal_connect (G_OBJECT (obj), "window-state-event", + G_CALLBACK (modest_msg_view_window_window_state_event), + NULL); + modest_window_set_active_account (MODEST_WINDOW(obj), account_name); priv->last_search = NULL; @@ -565,8 +563,8 @@ modest_msg_view_window_get_zoom (ModestWindow *window) return modest_msg_view_get_zoom (MODEST_MSG_VIEW (priv->msg_view)); } -static void -modest_msg_view_window_zoom_plus (GtkAction *action, ModestWindow *window) +static gboolean +modest_msg_view_window_zoom_plus (ModestWindow *window) { ModestWindowPrivate *parent_priv; GtkRadioAction *zoom_radio_action; @@ -580,19 +578,20 @@ modest_msg_view_window_zoom_plus (GtkAction *action, ModestWindow *window) if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (group->data))) { hildon_banner_show_information (NULL, NULL, _("mcen_ib_max_zoom_level")); - return; + 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; + return TRUE; } } + return FALSE; } -static void -modest_msg_view_window_zoom_minus (GtkAction *action, ModestWindow *window) +static gboolean +modest_msg_view_window_zoom_minus (ModestWindow *window) { ModestWindowPrivate *parent_priv; GtkRadioAction *zoom_radio_action; @@ -606,13 +605,17 @@ modest_msg_view_window_zoom_minus (GtkAction *action, ModestWindow *window) 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) + if (node->next != NULL) { gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (node->next->data), TRUE); - else + return TRUE; + } else { hildon_banner_show_information (NULL, NULL, _("mcen_ib_min_zoom_level")); + return FALSE; + } break; } } + return FALSE; } static gboolean @@ -934,16 +937,40 @@ modest_msg_view_window_update_priority (ModestMsgViewWindow *window) } -static void -modest_msg_view_window_toggle_fullscreen (GtkAction *action, ModestWindow *window) +static gboolean +modest_msg_view_window_window_state_event (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata) { - ModestWindowPrivate *parent_priv; - GtkAction *fs_toggle_action; - gboolean active; + if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) { + ModestWindowPrivate *parent_priv; + ModestWindowMgr *mgr; + gboolean is_fullscreen; + GtkAction *fs_toggle_action; + gboolean active; - parent_priv = MODEST_WINDOW_GET_PRIVATE (window); + 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/ShowToggleFullscreenMenu"); + 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; - fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ShowToggleFullscreenMenu"); - active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), !active); +} + +void +modest_msg_view_window_toggle_fullscreen (ModestMsgViewWindow *window) +{ + ModestWindowPrivate *parent_priv; + GtkAction *fs_toggle_action; + parent_priv = MODEST_WINDOW_GET_PRIVATE (window); + + fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ShowToggleFullscreenMenu"); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), + !gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action))); } diff --git a/src/maemo/ui/modest-main-window-ui.xml b/src/maemo/ui/modest-main-window-ui.xml index 461adda..0840a08 100644 --- a/src/maemo/ui/modest-main-window-ui.xml +++ b/src/maemo/ui/modest-main-window-ui.xml @@ -69,7 +69,7 @@ - + @@ -128,5 +128,5 @@ - + diff --git a/src/maemo/ui/modest-msg-edit-window-ui.xml b/src/maemo/ui/modest-msg-edit-window-ui.xml index 5730398..255248c 100644 --- a/src/maemo/ui/modest-msg-edit-window-ui.xml +++ b/src/maemo/ui/modest-msg-edit-window-ui.xml @@ -41,7 +41,15 @@ - + + + + + + + + + @@ -73,4 +81,8 @@ + + + + diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 0909b13..5a14c75 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -1493,25 +1493,6 @@ modest_ui_actions_on_select_all (GtkAction *action, } } -void -modest_ui_actions_on_toggle_fullscreen (GtkAction *action, - ModestWindow *window) -{ - ModestWindowMgr *mgr; - gboolean active; - - mgr = modest_runtime_get_window_mgr (); - /* set/unset the application fullscreen mode */ - active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); - modest_window_mgr_set_fullscreen_mode (mgr, active); - - /* Bring the current window to the front. The above call will - put all the windows in fullscreen mode, so we can not be - sure that the last fullscreen-ed window is the current - one */ - gtk_window_present (GTK_WINDOW (window)); -} - void modest_ui_actions_on_change_zoom (GtkRadioAction *action, GtkRadioAction *selected, @@ -1525,6 +1506,59 @@ modest_ui_actions_on_change_zoom (GtkRadioAction *action, } } +void +modest_ui_actions_on_zoom_plus (GtkAction *action, + ModestWindow *window) +{ + g_return_if_fail (MODEST_IS_WINDOW (window)); + + modest_window_zoom_plus (MODEST_WINDOW (window)); +} + +void +modest_ui_actions_on_zoom_minus (GtkAction *action, + ModestWindow *window) +{ + g_return_if_fail (MODEST_IS_WINDOW (window)); + + modest_window_zoom_minus (MODEST_WINDOW (window)); +} + +void +modest_ui_actions_on_toggle_fullscreen (GtkToggleAction *toggle, + ModestWindow *window) +{ + ModestWindowMgr *mgr; + gboolean fullscreen, active; + g_return_if_fail (MODEST_IS_WINDOW (window)); + + mgr = modest_runtime_get_window_mgr (); + + active = (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (toggle)))?1:0; + fullscreen = (modest_window_mgr_get_fullscreen_mode (mgr))?1:0; + + if (active != fullscreen) { + modest_window_mgr_set_fullscreen_mode (mgr, active); + gtk_window_present (GTK_WINDOW (window)); + } +} + +void +modest_ui_actions_on_change_fullscreen (GtkAction *action, + ModestWindow *window) +{ + ModestWindowMgr *mgr; + gboolean fullscreen; + + g_return_if_fail (MODEST_IS_WINDOW (window)); + + mgr = modest_runtime_get_window_mgr (); + fullscreen = modest_window_mgr_get_fullscreen_mode (mgr); + modest_window_mgr_set_fullscreen_mode (mgr, !fullscreen); + + gtk_window_present (GTK_WINDOW (window)); +} + static void modest_ui_actions_message_details_cb (gpointer msg_data, gpointer helper_data) @@ -1578,21 +1612,20 @@ modest_ui_actions_on_message_details (GtkAction *action, } } -void -modest_ui_actions_on_change_fullscreen (GtkRadioAction *action, - GtkRadioAction *selected, - ModestWindow *window) +void +modest_ui_actions_on_toggle_show_cc (GtkToggleAction *toggle, + ModestMsgEditWindow *window) { - gint value; - ModestWindowMgr *mgr; + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); - value = gtk_radio_action_get_current_value (selected); - mgr = modest_runtime_get_window_mgr (); + modest_msg_edit_window_show_cc (window, gtk_toggle_action_get_active (toggle)); +} - if (value == 0) - modest_window_mgr_set_fullscreen_mode (mgr, FALSE); - else - modest_window_mgr_set_fullscreen_mode (mgr, TRUE); +void +modest_ui_actions_on_toggle_show_bcc (GtkToggleAction *toggle, + ModestMsgEditWindow *window) +{ + g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window)); - gtk_window_present (GTK_WINDOW (window)); + modest_msg_edit_window_show_bcc (window, gtk_toggle_action_get_active (toggle)); } diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index d043027..c47c66a 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -157,29 +157,32 @@ void modest_ui_actions_on_cut (GtkAction *action, void modest_ui_actions_on_copy (GtkAction *action, ModestWindow *window); +void modest_ui_actions_on_zoom_plus (GtkAction *action, + ModestWindow *window); + +void modest_ui_actions_on_zoom_minus (GtkAction *action, + ModestWindow *window); + +void modest_ui_actions_on_toggle_fullscreen (GtkToggleAction *toggle, + ModestWindow *window); void modest_ui_actions_on_paste (GtkAction *action, ModestWindow *window); +void modest_ui_actions_on_change_fullscreen (GtkAction *toggle, + ModestWindow *window); void modest_ui_actions_on_select_all (GtkAction *action, ModestWindow *window); -/** - * modest_ui_actions_on_toggle_fullscreen: - * @action: the #GtkAction - * @window: the window that will be shown in fullscreen mode - * - * puts a window in fullscreen mode - **/ -void modest_ui_actions_on_toggle_fullscreen (GtkAction *action, - ModestWindow *window); +void modest_ui_actions_on_toggle_show_cc (GtkToggleAction *toggle, + ModestMsgEditWindow *window); + +void modest_ui_actions_on_toggle_show_bcc (GtkToggleAction *toggle, + ModestMsgEditWindow *window); void modest_ui_actions_on_change_zoom (GtkRadioAction *action, GtkRadioAction *selected, ModestWindow *window); -void modest_ui_actions_on_change_fullscreen (GtkRadioAction *action, - GtkRadioAction *selected, - ModestWindow *window); G_END_DECLS #endif /* __MODEST_UI_ACTIONS_H__ */ diff --git a/src/widgets/modest-msg-edit-window-ui.h b/src/widgets/modest-msg-edit-window-ui.h index 07c45c6..8722044 100644 --- a/src/widgets/modest-msg-edit-window-ui.h +++ b/src/widgets/modest-msg-edit-window-ui.h @@ -45,6 +45,7 @@ static const GtkActionEntry modest_msg_edit_action_entries [] = { { "Format", NULL, N_("For_mat") }, { "Alignment", NULL, N_("_Alignment") }, { "Attachments", NULL, N_("Attachments") }, + { "Zoom", NULL, N_("Zoom") }, /* ACTIONS */ { "ActionsSend", MODEST_STOCK_MAIL_SEND, N_("Send"), NULL, N_("Send a message"), G_CALLBACK (modest_ui_actions_on_send) }, @@ -55,14 +56,22 @@ static const GtkActionEntry modest_msg_edit_action_entries [] = { { "Copy", GTK_STOCK_COPY, N_("Copy"), NULL, N_("Copy selection"), G_CALLBACK (modest_ui_actions_on_copy)}, { "Paste", GTK_STOCK_PASTE, N_("Paste"), NULL, N_("Paste selection"), G_CALLBACK (modest_ui_actions_on_paste)}, { "SelectAll", NULL, N_("Select all"), NULL, N_("Select all"), G_CALLBACK (modest_ui_actions_on_select_all)}, + + /* KEY ACCELERATOR ACTIONS */ + { "ZoomPlus", NULL, N_("Zoom +"), "F7", NULL, G_CALLBACK (modest_msg_edit_window_zoom_plus) }, + { "ZoomMinus", NULL, N_("Zoom -"), "F8", NULL, G_CALLBACK (modest_msg_edit_window_zoom_minus) }, + { "ToggleFullscreen", NULL, N_("Toggle fullscreen"), "F6", NULL, G_CALLBACK (modest_ui_actions_on_change_fullscreen) }, + }; static const GtkToggleActionEntry modest_msg_edit_toggle_action_entries [] = { /* VIEW */ - { "ViewToField", NULL, N_("To: field"), NULL, N_("Shows the To: field"), NULL, TRUE }, - { "ViewCcField", NULL, N_("Cc: field"), NULL, N_("Shows the Cc: field"), NULL, TRUE }, - { "ViewBccField", NULL, N_("Bcc: filed"), NULL, N_("Shows the Bcc: field"), NULL, FALSE }, + { "ViewCcField", NULL, N_("Cc: field"), NULL, N_("Shows the Cc: field"), G_CALLBACK (modest_ui_actions_on_toggle_show_cc), TRUE }, + { "ViewBccField", NULL, N_("Bcc: filed"), NULL, N_("Shows the Bcc: field"), G_CALLBACK (modest_ui_actions_on_toggle_show_bcc), TRUE }, + + /* Fullscreen toggle */ + { "ShowToggleFullscreen", GTK_STOCK_FULLSCREEN, N_("Show fullscreen"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_fullscreen), FALSE}, /* Rich text editor functions */ { "ActionsBold", GTK_STOCK_BOLD, N_("Bold"), NULL, N_("Use bold"), G_CALLBACK (modest_ui_actions_on_toggle_bold), FALSE }, @@ -76,5 +85,14 @@ static const GtkRadioActionEntry modest_msg_edit_alignment_radio_action_entries { "AlignmentRight", NULL, N_("Right"), NULL, N_("Align to the right"), GTK_JUSTIFY_RIGHT }, }; +static const GtkRadioActionEntry modest_msg_edit_zoom_action_entries [] = { + { "Zoom50", NULL, N_("mcen_me_viewer_50"), NULL, NULL, 50 }, + { "Zoom100", NULL, N_("mcen_me_viewer_100"), NULL, NULL, 100 }, + { "Zoom150", NULL, N_("mcen_me_viewer_150"), NULL, NULL, 150 }, + { "Zoom200", NULL, N_("mcen_me_viewer_200"), NULL, NULL, 200 } +}; + + + G_END_DECLS #endif /* __MODEST_MSG_EDIT_WINDOW_UI_H__ */ diff --git a/src/widgets/modest-msg-edit-window.h b/src/widgets/modest-msg-edit-window.h index 4d91d4a..d5942ef 100644 --- a/src/widgets/modest-msg-edit-window.h +++ b/src/widgets/modest-msg-edit-window.h @@ -196,6 +196,33 @@ void modest_msg_edit_window_select_background_color */ void modest_msg_edit_window_insert_image (ModestMsgEditWindow *window); +/** + * modest_msg_edit_window_show_cc: + * @window: a #ModestMsgEditWindow + * @show: a #gboolean + * + * Set the CC field as visible (or not visible) depending on @show + */ +void modest_msg_edit_window_show_cc (ModestMsgEditWindow *window, gboolean show); + +/** + * modest_msg_edit_window_show_bcc: + * @window: a #ModestMsgEditWindow + * @show: a #gboolean + * + * Set the BCC field as visible (or not visible) depending on @show + */ +void modest_msg_edit_window_show_bcc (ModestMsgEditWindow *window, gboolean show); + +/** + * modest_msg_edit_window_toggle_fullscreen: + * @window: a #ModestMsgEditWindow + * + * toggles the current fullscreen status + */ +void modest_msg_edit_window_toggle_fullscreen (ModestMsgEditWindow *window); + + G_END_DECLS #endif /* __MODEST_MSG_EDIT_WINDOW_H__ */ diff --git a/src/widgets/modest-msg-view-window.h b/src/widgets/modest-msg-view-window.h index b75155a..9249d19 100644 --- a/src/widgets/modest-msg-view-window.h +++ b/src/widgets/modest-msg-view-window.h @@ -137,6 +137,13 @@ gboolean modest_msg_view_window_select_next_message (ModestMsgViewWindow */ gboolean modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window); +/** + * modest_msg_view_window_toggle_fullscreen: + * @window: a #ModestMsgViewWindow + * + * toggles the current fullscreen status + */ +void modest_msg_view_window_toggle_fullscreen (ModestMsgViewWindow *window); G_END_DECLS #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */ diff --git a/src/widgets/modest-window-mgr.c b/src/widgets/modest-window-mgr.c index 8ebfe55..07e3e25 100644 --- a/src/widgets/modest-window-mgr.c +++ b/src/widgets/modest-window-mgr.c @@ -296,3 +296,15 @@ modest_window_mgr_set_fullscreen_mode (ModestWindowMgr *self, win = g_list_next (win); } } + +gboolean +modest_window_mgr_get_fullscreen_mode (ModestWindowMgr *self) +{ + ModestWindowMgrPrivate *priv; + + g_return_val_if_fail (MODEST_IS_WINDOW_MGR (self), FALSE); + + priv = MODEST_WINDOW_MGR_GET_PRIVATE (self); + + return priv->fullscreen_mode; +} diff --git a/src/widgets/modest-window-mgr.h b/src/widgets/modest-window-mgr.h index 5a19ede..5598f98 100644 --- a/src/widgets/modest-window-mgr.h +++ b/src/widgets/modest-window-mgr.h @@ -102,13 +102,23 @@ ModestWindow* modest_window_mgr_find_window_by_msguid (ModestWindowMgr *self, /** * modest_window_mgr_set_fullscreen_mode: - * @self: - * @on: + * @self: a #ModestWindowMgr + * @on: a #gboolean * * sets/unsets the application windows in fullscreen mode **/ void modest_window_mgr_set_fullscreen_mode (ModestWindowMgr *self, gboolean on); + +/** + * modest_window_mgr_set_fullscreen_mode: + * @self: a #ModestWindowMgr + * + * gets the current fullscreen mode of the windows in the application. + * + * Returns: %TRUE if fullscreen mode is enabled, %FALSE if not. + **/ +gboolean modest_window_mgr_get_fullscreen_mode (ModestWindowMgr *self); G_END_DECLS #endif /* __MODEST_WINDOW_MGR_H__ */ diff --git a/src/widgets/modest-window.c b/src/widgets/modest-window.c index 0e93b07..2aed604 100644 --- a/src/widgets/modest-window.c +++ b/src/widgets/modest-window.c @@ -38,7 +38,9 @@ static void modest_window_finalize (GObject *obj); static void modest_window_set_zoom_default (ModestWindow *window, gdouble zoom); -gdouble modest_window_get_zoom_default (ModestWindow *window); +static gdouble modest_window_get_zoom_default (ModestWindow *window); +static gboolean modest_window_zoom_plus_default (ModestWindow *window); +static gboolean modest_window_zoom_minus_default (ModestWindow *window); /* list my signals */ @@ -94,6 +96,8 @@ modest_window_class_init (ModestWindowClass *klass) klass->set_zoom_func = modest_window_set_zoom_default; klass->get_zoom_func = modest_window_get_zoom_default; + klass->zoom_plus_func = modest_window_zoom_plus_default; + klass->zoom_minus_func = modest_window_zoom_minus_default; g_type_class_add_private (gobject_class, sizeof(ModestWindowPrivate)); } @@ -168,6 +172,18 @@ modest_window_get_zoom (ModestWindow *window) return MODEST_WINDOW_GET_CLASS (window)->get_zoom_func (window); } +gboolean +modest_window_zoom_plus (ModestWindow *window) +{ + return MODEST_WINDOW_GET_CLASS (window)->zoom_plus_func (window); +} + +gboolean +modest_window_zoom_minus (ModestWindow *window) +{ + return MODEST_WINDOW_GET_CLASS (window)->zoom_minus_func (window); +} + static void modest_window_set_zoom_default (ModestWindow *window, gdouble zoom) @@ -175,8 +191,20 @@ modest_window_set_zoom_default (ModestWindow *window, return; } -gdouble +static gdouble modest_window_get_zoom_default (ModestWindow *window) { return 1.0; } + +static gboolean +modest_window_zoom_plus_default (ModestWindow *window) +{ + return FALSE; +} + +static gboolean +modest_window_zoom_minus_default (ModestWindow *window) +{ + return FALSE; +} diff --git a/src/widgets/modest-window.h b/src/widgets/modest-window.h index 8706f41..2cf0993 100644 --- a/src/widgets/modest-window.h +++ b/src/widgets/modest-window.h @@ -76,6 +76,8 @@ struct _ModestWindowClass { /* virtual methods */ void (*set_zoom_func) (ModestWindow *self, gdouble zoom); gdouble (*get_zoom_func) (ModestWindow *self); + gboolean (*zoom_plus_func) (ModestWindow *self); + gboolean (*zoom_minus_func) (ModestWindow *self); }; /** @@ -130,6 +132,26 @@ void modest_window_set_zoom (ModestWindow *window, */ gdouble modest_window_get_zoom (ModestWindow *window); +/** + * modest_window_zoom_plus: + * @window: a #ModestWindow + * + * increases one level the zoom. + * + * Returns: %TRUE if successful, %FALSE if increasing zoom is not available + */ +gboolean modest_window_zoom_plus (ModestWindow *window); + +/** + * modest_window_zoom_minus: + * @window: a #ModestWindow + * + * decreases one level the zoom. + * + * Returns: %TRUE if successful, %FALSE if increasing zoom is not available + */ +gboolean modest_window_zoom_minus (ModestWindow *window); + G_END_DECLS #endif /* __MODEST_WINDOW_H__ */