From: Felipe Erias Morandeira Date: Thu, 22 Nov 2007 16:56:14 +0000 (+0000) Subject: Fixes NB#76638 X-Git-Tag: git_migration_finished~2036 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=f3faf3e04b021831d01436400dd8d93a87fa9cff;ds=sidebyside Fixes NB#76638 I had to remove the menu entry MessageEditWindow->menu->zoom and all of the associated code. I also changed the callback for the HW buttons, so now they show an "Unable to zoom" banner. Changes: * modest/src/widgets/modest-msg-edit-window-ui.h: remove _"Zoom"_ action entries. * modest/src/maemo/modest-msg-edit-window.c: remove code associated with the "Zoom" menu entries, use a callback for the HW buttons that only shows a banner. * modest/src/maemo/modest-msg-edit-window-ui-dimming.h: remove dimming rules for "Zoom" menu entries. * modest/src/maemo/ui/modest-msg-edit-window-ui.xml: remove "Zoom" menu entries. pmo-trunk-r3797 --- diff --git a/src/maemo/modest-msg-edit-window-ui-dimming.h b/src/maemo/modest-msg-edit-window-ui-dimming.h index cb23941..6144a7b 100644 --- a/src/maemo/modest-msg-edit-window-ui-dimming.h +++ b/src/maemo/modest-msg-edit-window-ui-dimming.h @@ -16,8 +16,7 @@ static const ModestDimmingEntry modest_msg_edit_window_menu_dimming_entries [] = { "/MenuBar/FormatMenu/AlignmentLeftMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) }, { "/MenuBar/FormatMenu/AlignmentRightMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) }, { "/MenuBar/FormatMenu/AlignmentCenterMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) }, - { "/MenuBar/FormatMenu/InsertImageMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) }, - { "/MenuBar/ViewMenu/ZoomMenu", G_CALLBACK (modest_ui_dimming_rules_on_zoom) }, + { "/MenuBar/FormatMenu/InsertImageMenu", G_CALLBACK (modest_ui_dimming_rules_on_set_style) }, { "/MenuBar/EditMenu/SelectAllMenu", G_CALLBACK (modest_ui_dimming_rules_on_select_all) }, { "/MenuBar/EditMenu/UndoMenu", G_CALLBACK (modest_ui_dimming_rules_on_undo) }, { "/MenuBar/EditMenu/RedoMenu", G_CALLBACK (modest_ui_dimming_rules_on_redo) }, diff --git a/src/maemo/modest-msg-edit-window.c b/src/maemo/modest-msg-edit-window.c index 4b6759d..3da88fe 100644 --- a/src/maemo/modest-msg-edit-window.c +++ b/src/maemo/modest-msg-edit-window.c @@ -127,10 +127,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, @@ -159,6 +155,8 @@ 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 init_window (ModestMsgEditWindow *obj); static void DEBUG_BUFFER (WPTextBuffer *buffer) @@ -256,8 +254,6 @@ struct _ModestMsgEditWindowPrivate { GList *images; TnyHeaderFlags priority_flags; - - gdouble zoom_level; gboolean can_undo, can_redo; gulong clipboard_change_handler_id; @@ -363,10 +359,8 @@ 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->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; @@ -389,7 +383,6 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj) priv->attachments = NULL; priv->images = NULL; priv->last_cid = 0; - priv->zoom_level = 1.0; priv->cc_caption = NULL; priv->bcc_caption = NULL; @@ -612,12 +605,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, @@ -2234,117 +2221,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) { @@ -2601,7 +2477,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: @@ -3353,3 +3228,13 @@ 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; + +} diff --git a/src/maemo/ui/modest-msg-edit-window-ui.xml b/src/maemo/ui/modest-msg-edit-window-ui.xml index f67c433..4ba8bd3 100644 --- a/src/maemo/ui/modest-msg-edit-window-ui.xml +++ b/src/maemo/ui/modest-msg-edit-window-ui.xml @@ -54,15 +54,6 @@ - - - - - - - - - diff --git a/src/widgets/modest-msg-edit-window-ui.h b/src/widgets/modest-msg-edit-window-ui.h index c506727..a7fbc04 100644 --- a/src/widgets/modest-msg-edit-window-ui.h +++ b/src/widgets/modest-msg-edit-window-ui.h @@ -46,7 +46,6 @@ static const GtkActionEntry modest_msg_edit_action_entries [] = { { "Format", NULL, N_("mcen_me_editor_format") , NULL, NULL, G_CALLBACK (modest_ui_actions_on_format_menu_activated)}, { "Alignment", NULL, N_("mcen_me_editor_align") }, { "Attachments", NULL, N_("mcen_me_viewer_attachments"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_attachment_menu_activated) }, - { "Zoom", NULL, N_("mcen_me_viewer_zoom") }, { "MessagePriority", NULL, N_("mcen_me_editor_message_priority") }, { "FileFormat", NULL, N_("mcen_me_editor_file_format") }, { "Tools", NULL, N_("mcen_me_inbox_tools") }, @@ -78,10 +77,10 @@ static const GtkActionEntry modest_msg_edit_action_entries [] = { { "SearchMessages", NULL, N_("mcen_me_inbox_search"), "E", NULL, G_CALLBACK (modest_ui_actions_on_search_messages) }, - /* KEY ACCELERATOR ACTIONS */ + /* KEY ACCELERATOR 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) }, + { "ToggleFullscreen", NULL, N_("Toggle fullscreen"), "F6", NULL, G_CALLBACK (modest_ui_actions_on_change_fullscreen) }, { "CloseWindowShortcut", NULL, NULL, "Escape", NULL, G_CALLBACK (modest_ui_actions_on_close_window) }, /* TOOLBAR ACTIONS */ @@ -119,15 +118,6 @@ static const GtkRadioActionEntry modest_msg_edit_alignment_radio_action_entries { "AlignmentRight", NULL, N_("mcen_me_editor_align_right"), NULL, NULL, GTK_JUSTIFY_RIGHT }, }; -static const GtkRadioActionEntry modest_msg_edit_zoom_action_entries [] = { - { "Zoom50", NULL, N_("mcen_me_viewer_50"), NULL, NULL, 50 }, - { "Zoom80", NULL, N_("mcen_me_viewer_80"), NULL, NULL, 80 }, - { "Zoom100", NULL, N_("mcen_me_viewer_100"), NULL, NULL, 100 }, - { "Zoom120", NULL, N_("mcen_me_viewer_120"), NULL, NULL, 120 }, - { "Zoom150", NULL, N_("mcen_me_viewer_150"), NULL, NULL, 150 }, - { "Zoom200", NULL, N_("mcen_me_viewer_200"), NULL, NULL, 200 } -}; - static const GtkRadioActionEntry modest_msg_edit_priority_action_entries [] = { { "MessagePriorityHigh", NULL, N_("mcen_me_editor_priority_high"), NULL, NULL, TNY_HEADER_FLAG_HIGH_PRIORITY }, { "MessagePriorityNormal", NULL, N_("mcen_me_editor_priority_normal"), NULL, NULL, TNY_HEADER_FLAG_NORMAL_PRIORITY },