Migrated hildon2 to text-utils dgettext macros
[modest] / src / hildon2 / modest-msg-view-window.c
index c228166..4a0f792 100644 (file)
@@ -1443,7 +1443,7 @@ modest_msg_view_window_find_toolbar_search (GtkWidget *widget,
 
        if ((current_search == NULL) || (strcmp (current_search, "") == 0)) {
                g_free (current_search);
-               hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ecdg_ib_find_rep_enter_text"));
+               hildon_banner_show_information (NULL, NULL, _CS("ecdg_ib_find_rep_enter_text"));
                return;
        }
 
@@ -1454,7 +1454,8 @@ modest_msg_view_window_find_toolbar_search (GtkWidget *widget,
                result = modest_isearch_view_search (MODEST_ISEARCH_VIEW (priv->msg_view),
                                                     priv->last_search);
                if (!result) {
-                       hildon_banner_show_information (NULL, NULL, dgettext("hildon-libs", "ckct_ib_find_no_matches"));
+                       hildon_banner_show_information (NULL, NULL, 
+                                                       _HL("ckct_ib_find_no_matches"));
                        g_free (priv->last_search);
                        priv->last_search = NULL;
                } else {
@@ -1463,7 +1464,8 @@ modest_msg_view_window_find_toolbar_search (GtkWidget *widget,
                }
        } else {
                if (!modest_isearch_view_search_next (MODEST_ISEARCH_VIEW (priv->msg_view))) {
-                       hildon_banner_show_information (NULL, NULL, dgettext("hildon-libs", "ckct_ib_find_search_complete"));
+                       hildon_banner_show_information (NULL, NULL, 
+                                                       _HL("ckct_ib_find_search_complete"));
                        g_free (priv->last_search);
                        priv->last_search = NULL;
                } else {
@@ -1507,6 +1509,8 @@ modest_msg_view_window_zoom_plus (ModestWindow *window)
 {
        gdouble zoom_level;
        ModestMsgViewWindowPrivate *priv;
+       gint int_zoom;
+       gchar *banner_text;
      
        g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window), 1.0);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
@@ -1514,7 +1518,8 @@ modest_msg_view_window_zoom_plus (ModestWindow *window)
        zoom_level =  modest_zoomable_get_zoom (MODEST_ZOOMABLE (priv->msg_view));
 
        if (zoom_level >= 2.0) {
-               hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_max_zoom_level_reached"));
+               hildon_banner_show_information (NULL, NULL, 
+                                               _CS("ckct_ib_max_zoom_level_reached"));
                return FALSE;
        } else if (zoom_level >= 1.5) {
                zoom_level = 2.0;
@@ -1531,10 +1536,13 @@ modest_msg_view_window_zoom_plus (ModestWindow *window)
        }
 
        /* set zoom level */
+       int_zoom = (gint) rint (zoom_level*100.0+0.1);
+       banner_text = g_strdup_printf (_("wdgt_ib_zoom"), int_zoom);
+       modest_platform_information_banner (GTK_WIDGET (window), NULL, banner_text);
+       g_free (banner_text);
        modest_zoomable_set_zoom (MODEST_ZOOMABLE (priv->msg_view), zoom_level);
 
        return TRUE;
-       
 }
 
 static gboolean
@@ -1542,6 +1550,8 @@ modest_msg_view_window_zoom_minus (ModestWindow *window)
 {
        gdouble zoom_level;
        ModestMsgViewWindowPrivate *priv;
+       gint int_zoom;
+       gchar *banner_text;
      
        g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window), 1.0);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
@@ -1549,7 +1559,8 @@ modest_msg_view_window_zoom_minus (ModestWindow *window)
        zoom_level =  modest_zoomable_get_zoom (MODEST_ZOOMABLE (priv->msg_view));
 
        if (zoom_level <= 0.5) {
-                         hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_min_zoom_level_reached"));
+               hildon_banner_show_information (NULL, NULL, 
+                                               _CS("ckct_ib_min_zoom_level_reached"));
                return FALSE;
        } else if (zoom_level <= 0.8) {
                zoom_level = 0.5;
@@ -1566,6 +1577,10 @@ modest_msg_view_window_zoom_minus (ModestWindow *window)
        }
 
        /* set zoom level */
+       int_zoom = (gint) rint (zoom_level*100.0+0.1);
+       banner_text = g_strdup_printf (_("wdgt_ib_zoom"), int_zoom);
+       modest_platform_information_banner (GTK_WIDGET (window), NULL, banner_text);
+       g_free (banner_text);
        modest_zoomable_set_zoom (MODEST_ZOOMABLE (priv->msg_view), zoom_level);
 
        return TRUE;
@@ -1830,6 +1845,11 @@ message_reader (ModestMsgViewWindow *window,
        mgr = modest_runtime_get_window_mgr ();
        /* Msg download completed */
        if (!(tny_header_get_flags (header) & TNY_HEADER_FLAG_CACHED)) {
+
+               /* We set the header from model while we're loading */
+               tny_header_view_set_header (TNY_HEADER_VIEW (priv->msg_view), header);
+               gtk_window_set_title (GTK_WINDOW (window), _CS("ckdg_pb_updating"));
+
                /* Ask the user if he wants to download the message if
                   we're not online */
                if (!tny_device_is_online (modest_runtime_get_device())) {
@@ -2599,8 +2619,8 @@ idle_save_mime_part_show_result (SaveMimePartInfo *info)
                if (info->result == GNOME_VFS_OK) {
                        hildon_banner_show_information (NULL, NULL, _CS("sfil_ib_saved"));
                } else if (info->result == GNOME_VFS_ERROR_NO_SPACE) {
-                       hildon_banner_show_information (NULL, NULL, dgettext("ke-recv", 
-                                                                            "cerm_device_memory_full"));
+                       hildon_banner_show_information (NULL, NULL, 
+                                                       _KR("cerm_device_memory_full"));
                } else {
                        hildon_banner_show_information (NULL, NULL, _("mail_ib_file_operation_failed"));
                }
@@ -2693,7 +2713,7 @@ save_attachments_response (GtkDialog *dialog,
 
        if (!modest_utils_folder_writable (chooser_uri)) {
                hildon_banner_show_information 
-                       (NULL, NULL, dgettext("hildon-fm", "sfil_ib_readonly_location"));
+                       (NULL, NULL, _FM("sfil_ib_readonly_location"));
        } else {
                TnyIterator *iter;
 
@@ -2705,7 +2725,7 @@ save_attachments_response (GtkDialog *dialog,
                            !tny_mime_part_is_purged (mime_part) &&
                            (tny_mime_part_get_filename (mime_part) != NULL)) {
                                SaveMimePartPair *pair;
-                                       
+
                                pair = g_slice_new0 (SaveMimePartPair);
 
                                if (tny_list_get_length (mime_parts) > 1) {
@@ -2785,7 +2805,7 @@ modest_msg_view_window_save_attachments (ModestMsgViewWindow *window, TnyList *m
                                                      GTK_FILE_CHOOSER_ACTION_SAVE);
 
        /* set folder */
-       folder = g_build_filename (g_get_home_dir (), g_getenv (MYDOCS_ENV), DOCS_FOLDER, NULL);
+       folder = g_build_filename (g_getenv (MYDOCS_ENV), DOCS_FOLDER, NULL);
        gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (save_dialog), folder);
        g_free (folder);
 
@@ -3093,31 +3113,31 @@ setup_menu (ModestMsgViewWindow *self)
        g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW(self));
 
        /* Settings menu buttons */
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_replytoall"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_replytoall"), NULL,
                                           APP_MENU_CALLBACK (modest_ui_actions_on_reply_all),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_reply_msg));
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_forward"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_forward"), "<Control>d",
                                           APP_MENU_CALLBACK (modest_ui_actions_on_forward),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_reply_msg));
        
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_mark_as_read"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_mark_as_read"), NULL,
                                           APP_MENU_CALLBACK (modest_ui_actions_on_mark_as_read),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_read_msg_in_view));
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_mark_as_unread"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_mark_as_unread"), NULL,
                                           APP_MENU_CALLBACK (modest_ui_actions_on_mark_as_unread),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_unread_msg_in_view));
        
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_viewer_save_attachments"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_viewer_save_attachments"), NULL,
                                           APP_MENU_CALLBACK (modest_ui_actions_save_attachments),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_save_attachments));
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_remove_attachments"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_remove_attachments"), NULL,
                                           APP_MENU_CALLBACK (modest_ui_actions_remove_attachments),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_remove_attachments));
        
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_viewer_newemail"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_new_message"), "<Control>n",
                                           APP_MENU_CALLBACK (modest_ui_actions_on_new_msg),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg));
-       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_viewer_addtocontacts"),
+       modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_viewer_addtocontacts"), NULL,
                                           APP_MENU_CALLBACK (modest_ui_actions_add_to_contacts),
                                           MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_add_to_contacts));
 }
@@ -3132,8 +3152,18 @@ modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self)
        gboolean contacts_to_add = FALSE;
 
        msg = tny_msg_view_get_msg (TNY_MSG_VIEW (priv->msg_view));
-       if (msg == NULL) return;
-       recipients = modest_tny_msg_get_all_recipients_list (msg);
+       if (msg == NULL) {
+               TnyHeader *header;
+
+               header = modest_msg_view_window_get_header (self);
+               if (header == NULL)
+                       return;
+               recipients = modest_tny_msg_header_get_all_recipients_list (header);
+               g_object_unref (header);
+       } else {
+               recipients = modest_tny_msg_get_all_recipients_list (msg);
+               g_object_unref (msg);
+       }
 
        if (recipients != NULL) {
                GtkWidget *picker_dialog;
@@ -3180,5 +3210,4 @@ modest_msg_view_window_add_to_contacts (ModestMsgViewWindow *self)
        }
        
        if (recipients) {g_slist_foreach (recipients, (GFunc) g_free, NULL); g_slist_free (recipients);}
-       g_object_unref (msg);
 }