modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow *win)
{
GtkClipboard *clipboard = NULL;
modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow *win)
{
GtkClipboard *clipboard = NULL;
/* Do nothing if there was any problem with the mail
operation. The error will be shown by the error_handler of
the mail operation */
/* Do nothing if there was any problem with the mail
operation. The error will be shown by the error_handler of
the mail operation */
if (folder_type == TNY_FOLDER_TYPE_OUTBOX) {
TnyTransportAccount *traccount = NULL;
ModestTnyAccountStore *accstore = modest_runtime_get_account_store();
if (folder_type == TNY_FOLDER_TYPE_OUTBOX) {
TnyTransportAccount *traccount = NULL;
ModestTnyAccountStore *accstore = modest_runtime_get_account_store();
if (TNY_IS_SEND_QUEUE (send_queue)) {
msg_id = modest_tny_send_queue_get_msg_id (header);
status = modest_tny_send_queue_get_msg_status(send_queue, msg_id);
if (TNY_IS_SEND_QUEUE (send_queue)) {
msg_id = modest_tny_send_queue_get_msg_id (header);
status = modest_tny_send_queue_get_msg_status(send_queue, msg_id);
/* Only open messages in outbox with the editor if they are in Failed state */
if (status == MODEST_TNY_SEND_QUEUE_FAILED) {
open_in_editor = TRUE;
/* Only open messages in outbox with the editor if they are in Failed state */
if (status == MODEST_TNY_SEND_QUEUE_FAILED) {
open_in_editor = TRUE;
account = g_strdup (modest_window_get_active_account (MODEST_WINDOW (parent_win)));
if (!account)
account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
account = g_strdup (modest_window_get_active_account (MODEST_WINDOW (parent_win)));
if (!account)
account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
if (open_in_editor) {
ModestAccountMgr *mgr = modest_runtime_get_account_mgr ();
gchar *from_header = NULL, *acc_name;
if (open_in_editor) {
ModestAccountMgr *mgr = modest_runtime_get_account_mgr ();
gchar *from_header = NULL, *acc_name;
win = modest_msg_edit_window_new (msg, account, TRUE);
} else {
gchar *uid = modest_tny_folder_get_header_unique_id (header);
win = modest_msg_edit_window_new (msg, account, TRUE);
} else {
gchar *uid = modest_tny_folder_get_header_unique_id (header);
if (MODEST_IS_MAIN_WINDOW (parent_win)) {
GtkTreeRowReference *row_reference;
row_reference = (GtkTreeRowReference *) g_hash_table_lookup (helper->row_refs_per_header, header);
if (MODEST_IS_MAIN_WINDOW (parent_win)) {
GtkTreeRowReference *row_reference;
row_reference = (GtkTreeRowReference *) g_hash_table_lookup (helper->row_refs_per_header, header);
win = modest_msg_view_window_new_with_header_model (msg, account, (const gchar*) uid,
helper->model, row_reference);
} else {
win = modest_msg_view_window_new_with_header_model (msg, account, (const gchar*) uid,
helper->model, row_reference);
} else {
/* Create the error messages */
if (tny_list_get_length (not_opened_headers) == 1) {
ModestProtocol *protocol;
/* Create the error messages */
if (tny_list_get_length (not_opened_headers) == 1) {
ModestProtocol *protocol;
header = TNY_HEADER (tny_iterator_get_current (iter));
if (header)
flags = tny_header_get_flags (header);
window = NULL;
found = modest_window_mgr_find_registered_header (mgr, header, &window);
header = TNY_HEADER (tny_iterator_get_current (iter));
if (header)
flags = tny_header_get_flags (header);
window = NULL;
found = modest_window_mgr_find_registered_header (mgr, header, &window);
gboolean *remember,
ModestMainWindow *main_window)
{
g_return_if_fail(server_account_name);
gboolean completed = FALSE;
PasswordDialogFields *fields = NULL;
gboolean *remember,
ModestMainWindow *main_window)
{
g_return_if_fail(server_account_name);
gboolean completed = FALSE;
PasswordDialogFields *fields = NULL;
#ifndef MODEST_TOOLKIT_GTK
/* Maemo uses a different (awkward) button order,
* It should probably just use gtk_alternative_dialog_button_order ().
*/
#ifndef MODEST_TOOLKIT_GTK
/* Maemo uses a different (awkward) button order,
* It should probably just use gtk_alternative_dialog_button_order ().
*/
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("mail_ti_password_protected"),
- NULL,
- GTK_DIALOG_MODAL,
- _("mcen_bd_dialog_ok"),
- GTK_RESPONSE_ACCEPT,
- _("mcen_bd_dialog_cancel"),
- GTK_RESPONSE_REJECT,
- NULL);
+#ifdef MODEST_TOOLKIT_HILDON2
+ GtkWidget *dialog =
+ gtk_dialog_new_with_buttons (_("mail_ti_password_protected"),
+ NULL,
+ GTK_DIALOG_MODAL,
+ _HL("wdgt_bd_done"),
+ GTK_RESPONSE_ACCEPT,
+ NULL);
- GtkWidget *dialog = gtk_dialog_new_with_buttons (_("mail_ti_password_protected"),
- NULL,
- GTK_DIALOG_MODAL,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_REJECT,
- GTK_STOCK_OK,
- GTK_RESPONSE_ACCEPT,
- NULL);
-#endif /* !MODEST_TOOLKIT_GTK */
+ GtkWidget *dialog =
+ gtk_dialog_new_with_buttons (_("mail_ti_password_protected"),
+ NULL,
+ _("mcen_bd_dialog_ok"),
+ GTK_RESPONSE_ACCEPT,
+ _("mcen_bd_dialog_cancel"),
+ GTK_RESPONSE_REJECT,
+ NULL);
+#endif /* MODEST_TOOLKIT_HILDON2 */
+#else
+ GtkWidget *dialog =
+ gtk_dialog_new_with_buttons (_("mail_ti_password_protected"),
+ NULL,
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+#endif /* MODEST_TOOLKIT_GTK */
gchar *server_name = modest_account_mgr_get_server_account_hostname (
modest_runtime_get_account_mgr(), server_account_name);
if (!server_name) {/* This happened once, though I don't know why. murrayc. */
gchar *server_name = modest_account_mgr_get_server_account_hostname (
modest_runtime_get_account_mgr(), server_account_name);
if (!server_name) {/* This happened once, though I don't know why. murrayc. */
gchar *txt = g_strdup_printf (_("mail_ia_password_info"), server_name);
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), gtk_label_new(txt),
FALSE, FALSE, 0);
gchar *txt = g_strdup_printf (_("mail_ia_password_info"), server_name);
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), gtk_label_new(txt),
FALSE, FALSE, 0);
/* username: */
gchar *initial_username = modest_account_mgr_get_server_account_username (
modest_runtime_get_account_mgr(), server_account_name);
/* username: */
gchar *initial_username = modest_account_mgr_get_server_account_username (
modest_runtime_get_account_mgr(), server_account_name);
GtkWidget *entry_username = gtk_entry_new ();
if (initial_username)
gtk_entry_set_text (GTK_ENTRY (entry_username), initial_username);
GtkWidget *entry_username = gtk_entry_new ();
if (initial_username)
gtk_entry_set_text (GTK_ENTRY (entry_username), initial_username);
#ifndef MODEST_TOOLKIT_GTK
/* Auto-capitalization is the default, so let's turn it off: */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry_username), HILDON_GTK_INPUT_MODE_FULL);
#ifndef MODEST_TOOLKIT_GTK
/* Auto-capitalization is the default, so let's turn it off: */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (entry_username), HILDON_GTK_INPUT_MODE_FULL);
/* Create a size group to be used by all captions.
* Note that HildonCaption does not create a default size group if we do not specify one.
* We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
/* Create a size group to be used by all captions.
* Note that HildonCaption does not create a default size group if we do not specify one.
* We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
GtkSizeGroup *sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
GtkWidget *caption = hildon_caption_new (sizegroup,
_("mail_fi_username"), entry_username, NULL, HILDON_CAPTION_MANDATORY);
gtk_widget_show (entry_username);
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), caption,
FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
GtkWidget *caption = hildon_caption_new (sizegroup,
_("mail_fi_username"), entry_username, NULL, HILDON_CAPTION_MANDATORY);
gtk_widget_show (entry_username);
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), caption,
FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
/* password: */
GtkWidget *entry_password = gtk_entry_new ();
gtk_entry_set_visibility (GTK_ENTRY(entry_password), FALSE);
/* gtk_entry_set_invisible_char (GTK_ENTRY(entry_password), "*"); */
/* password: */
GtkWidget *entry_password = gtk_entry_new ();
gtk_entry_set_visibility (GTK_ENTRY(entry_password), FALSE);
/* gtk_entry_set_invisible_char (GTK_ENTRY(entry_password), "*"); */
#ifndef MODEST_TOOLKIT_GTK
/* Auto-capitalization is the default, so let's turn it off: */
#ifndef MODEST_TOOLKIT_GTK
/* Auto-capitalization is the default, so let's turn it off: */
_("mail_fi_password"), entry_password, NULL, HILDON_CAPTION_MANDATORY);
gtk_widget_show (entry_password);
_("mail_fi_password"), entry_password, NULL, HILDON_CAPTION_MANDATORY);
gtk_widget_show (entry_password);
FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
g_object_unref (sizegroup);
FALSE, FALSE, MODEST_MARGIN_HALF);
gtk_widget_show (caption);
g_object_unref (sizegroup);
/* This is not in the Maemo UI spec:
remember_pass_check = gtk_check_button_new_with_label (_("Remember password"));
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), remember_pass_check,
/* This is not in the Maemo UI spec:
remember_pass_check = gtk_check_button_new_with_label (_("Remember password"));
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), remember_pass_check,
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
if (username) {
*username = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry_username)));
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
if (username) {
*username = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry_username)));
/* Note that an empty field becomes the "" string */
if (*username && strlen (*username) > 0) {
modest_account_mgr_set_server_account_username (modest_runtime_get_account_mgr(),
server_account_name,
*username);
completed = TRUE;
/* Note that an empty field becomes the "" string */
if (*username && strlen (*username) > 0) {
modest_account_mgr_set_server_account_username (modest_runtime_get_account_mgr(),
server_account_name,
*username);
completed = TRUE;
const gboolean username_was_changed =
(strcmp (*username, initial_username) != 0);
if (username_was_changed) {
const gboolean username_was_changed =
(strcmp (*username, initial_username) != 0);
if (username_was_changed) {
/* We do not save the password in the configuration,
* because this function is only called for passwords that should
* not be remembered:
/* We do not save the password in the configuration,
* because this function is only called for passwords that should
* not be remembered:
/* Set parent to NULL or the banner will disappear with its parent dialog */
modest_platform_information_banner(NULL, NULL, _("mail_ib_login_cancelled"));
/* Set parent to NULL or the banner will disappear with its parent dialog */
modest_platform_information_banner(NULL, NULL, _("mail_ib_login_cancelled"));
modest_platform_show_help (GTK_WINDOW (win), help_id);
else
modest_ui_actions_on_help (action, win);
modest_platform_show_help (GTK_WINDOW (win), help_id);
else
modest_ui_actions_on_help (action, win);