#include <modest-runtime.h>
#include <modest-main-window.h>
#include <modest-header-view.h>
-#include "modest-maemo-global-settings-dialog.h"
+#include "modest-hildon2-global-settings-dialog.h"
#include "modest-widget-memory.h"
#include <modest-hildon-includes.h>
#include <modest-maemo-utils.h>
#include <tny-maemo-conic-device.h>
#include <tny-simple-list.h>
#include <tny-folder.h>
-#include <tny-camel-imap-store-account.h>
-#include <tny-camel-pop-store-account.h>
#include <gtk/gtkicontheme.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkmain.h>
#include <libgnomevfs/gnome-vfs-mime-utils.h>
#include <modest-account-settings-dialog.h>
#include <modest-easysetup-wizard-dialog.h>
-#include "modest-hildon-sort-dialog.h"
+#include "modest-hildon2-sort-dialog.h"
#include <hildon/hildon-sound.h>
#include <osso-mem.h>
+#include "hildon2/modest-hildon2-details-dialog.h"
+#include <modest-datetime-formatter.h>
#ifdef MODEST_HAVE_MCE
#include <mce/dbus-names.h>
return _("mcen_ap_name");
}
-static void
+static void
entry_insert_text (GtkEditable *editable,
const gchar *text,
gint length,
if (modest_text_utils_is_forbidden_char (*text, FOLDER_NAME_FORBIDDEN_CHARS)) {
/* Show an error */
gchar *tmp, *msg;
-
- tmp = g_strndup (folder_name_forbidden_chars,
+
+ tmp = g_strndup (folder_name_forbidden_chars,
FOLDER_NAME_FORBIDDEN_CHARS_LENGTH);
msg = g_strdup_printf (_CS("ckdg_ib_illegal_characters_entered"), tmp);
- hildon_banner_show_information (gtk_widget_get_parent (GTK_WIDGET (data)),
+ hildon_banner_show_information (gtk_widget_get_parent (GTK_WIDGET (data)),
NULL, msg);
g_free (msg);
g_free (tmp);
- } else {
+ } else {
/* Write the text in the entry if it's valid */
g_signal_handlers_block_by_func (editable,
(gpointer) entry_insert_text, data);
GList *buttons;
buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (user_data)->action_area));
- ok_button = GTK_WIDGET (buttons->next->data);
-
+ ok_button = GTK_WIDGET (buttons->data);
+
chars = gtk_editable_get_chars (editable, 0, -1);
g_return_if_fail (chars != NULL);
-
- if (g_utf8_strlen (chars,-1) >= 21)
+
+ if (g_utf8_strlen (chars,-1) >= 20)
hildon_banner_show_information (gtk_widget_get_parent (GTK_WIDGET (user_data)), NULL,
_CS("ckdg_ib_maximum_characters_reached"));
else
gtk_widget_set_sensitive (ok_button, modest_text_utils_validate_folder_name(chars));
-
+
/* Free */
g_list_free (buttons);
g_free (chars);
dialog = gtk_dialog_new_with_buttons (dialog_title,
parent_window,
GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT,
- _("mcen_bd_dialog_ok"),
+ _HL("wdgt_bd_done"),
GTK_RESPONSE_ACCEPT,
- _("mcen_bd_dialog_cancel"),
- GTK_RESPONSE_REJECT,
NULL);
/* Add accept button (with unsensitive handler) */
buttons = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area));
- accept_btn = GTK_WIDGET (buttons->next->data);
+ accept_btn = GTK_WIDGET (buttons->data);
/* Create label and entry */
label = gtk_label_new (label_text);
- /* TODO: check that the suggested name does not exist */
- /* We set 21 as maximum because we want to show WID-INF036
- when the user inputs more that 20 */
- entry = gtk_entry_new_with_max_length (21);
+
+ entry = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
+ gtk_entry_set_max_length (GTK_ENTRY (entry), 20);
+
if (suggested_name)
gtk_entry_set_text (GTK_ENTRY (entry), suggested_name);
else
button_accept, GTK_RESPONSE_ACCEPT,
button_cancel, GTK_RESPONSE_CANCEL,
NULL);
- gtk_widget_set_no_show_all (button_cancel, FALSE);
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
GTK_WINDOW (dialog), parent_window);
/* Connect the device */
if (!device_online) {
/* Track account connection status changes */
- data->handler = g_signal_connect (account, "connection-status-changed",
+ data->handler = g_signal_connect (account, "connection-status-changed",
G_CALLBACK (on_connection_status_changed),
data);
/* Try to connect the device */
modest_platform_connect_and_wait_if_network_account (GtkWindow *parent_window, TnyAccount *account)
{
if (tny_account_get_account_type (account) == TNY_ACCOUNT_TYPE_STORE) {
- if (!TNY_IS_CAMEL_POP_STORE_ACCOUNT (account) &&
- !TNY_IS_CAMEL_IMAP_STORE_ACCOUNT (account)) {
+ if (!modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account))) {
/* This must be a maildir account, which does not require a connection: */
return TRUE;
}
{
GtkWidget *dialog;
- dialog = modest_hildon_sort_dialog_new (parent_window);
-
- hildon_help_dialog_help_enable (GTK_DIALOG(dialog),
- "applications_email_sort",
- modest_maemo_utils_get_osso_context());
+ dialog = modest_hildon2_sort_dialog_new (parent_window);
return dialog;
}
gboolean first_notification = TRUE;
gint notif_id;
gchar *str;
+ ModestDatetimeFormatter *datetime_formatter;
/* constant string, don't free */
- display_date = modest_text_utils_get_display_date (tny_header_get_date_received (header));
+ datetime_formatter = modest_datetime_formatter_new ();
+ display_date = modest_datetime_formatter_display_datetime (datetime_formatter,
+ tny_header_get_date_received (header));
+ g_object_unref (datetime_formatter);
display_address = tny_header_dup_from (header);
modest_text_utils_get_display_address (display_address); /* string is changed in-place */
GtkWidget *
modest_platform_get_global_settings_dialog ()
{
- return modest_maemo_global_settings_dialog_new ();
+ return modest_hildon2_global_settings_dialog_new ();
}
void
modest_platform_show_help (GtkWindow *parent_window,
const gchar *help_id)
{
- osso_return_t result;
- g_return_if_fail (help_id);
-
- result = hildon_help_show (modest_maemo_utils_get_osso_context(),
- help_id, HILDON_HELP_SHOW_DIALOG);
-
- if (result != OSSO_OK) {
- gchar *error_msg;
- error_msg = g_strdup_printf ("FIXME The help topic %s could not be found", help_id);
- hildon_banner_show_information (GTK_WIDGET (parent_window),
- NULL,
- error_msg);
- g_free (error_msg);
- }
+ return;
}
void
gboolean is_online;
g_return_val_if_fail (account, FALSE);
-
- printf ("DEBUG: %s: account id=%s\n", __FUNCTION__, tny_account_get_id (account));
-
+
if (!tny_device_is_online (modest_runtime_get_device())) {
printf ("DEBUG: %s: device is offline.\n", __FUNCTION__);
return FALSE;
}
-
+
/* The local_folders account never seems to leave TNY_CONNECTION_STATUS_INIT,
* so we avoid wait unnecessarily: */
- if (!TNY_IS_CAMEL_POP_STORE_ACCOUNT (account) &&
- !TNY_IS_CAMEL_IMAP_STORE_ACCOUNT (account) ) {
- return TRUE;
- }
-
- printf ("DEBUG: %s: tny_account_get_connection_status()==%d\n",
- __FUNCTION__, tny_account_get_connection_status (account));
-
+ if (!modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account)))
+ return TRUE;
+
/* The POP & IMAP store accounts seem to be TNY_CONNECTION_STATUS_DISCONNECTED,
* and that seems to be an OK time to use them. Maybe it's just TNY_CONNECTION_STATUS_INIT that
* we want to avoid. */
note = hildon_note_new_confirmation_add_buttons (
GTK_WINDOW(main_win),
question,
- _("mcen_bd_dialog_ok"), GTK_RESPONSE_OK,
- _("mcen_bd_view"), GTK_RESPONSE_APPLY, /* abusing this... */
- _("mcen_bd_dialog_cancel"), GTK_RESPONSE_CANCEL,
+ _HL("wdgt_bd_yes"), GTK_RESPONSE_OK,
+ _HL("wdgt_bd_view"), GTK_RESPONSE_APPLY, /* abusing this... */
+ _HL("wdgt_bd_no"), GTK_RESPONSE_CANCEL,
NULL, NULL);
g_signal_connect (G_OBJECT(note), "response",
if (callback) {
callback (FALSE, NULL, parent_window, NULL, user_data);
}
- return;
-
- /* Original comment: Maybe it is something local. */
- /* PVH's comment: maybe we should KNOW this in stead of assuming? */
-
+ return;
+
} else if (TNY_IS_FOLDER (folder_store)) {
/* Get the folder's parent account: */
account = tny_folder_get_account (TNY_FOLDER (folder_store));
/* Use the folder store as an account: */
account = TNY_ACCOUNT (g_object_ref (folder_store));
}
-
+
if (tny_account_get_account_type (account) == TNY_ACCOUNT_TYPE_STORE) {
- if (!TNY_IS_CAMEL_POP_STORE_ACCOUNT (account) &&
- !TNY_IS_CAMEL_IMAP_STORE_ACCOUNT (account)) {
-
+ if (!modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account))) {
/* No need to connect a local account */
if (callback)
callback (FALSE, NULL, parent_window, account, user_data);
}
}
modest_platform_connect_and_perform (parent_window, force, account, callback, user_data);
-
+
clean:
if (account)
g_object_unref (account);
}
static void
-src_account_connect_performer (gboolean canceled,
+src_account_connect_performer (gboolean canceled,
GError *err,
- GtkWindow *parent_window,
- TnyAccount *src_account,
+ GtkWindow *parent_window,
+ TnyAccount *src_account,
gpointer user_data)
{
DoubleConnectionInfo *info = (DoubleConnectionInfo *) user_data;
return lowmem;
}
+
+void
+modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+ TnyFolder *folder)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_hildon2_details_dialog_new_with_folder (parent_window, folder);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+void
+modest_platform_run_header_details_dialog (GtkWindow *parent_window,
+ TnyHeader *header)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_hildon2_details_dialog_new_with_header (parent_window, header);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+osso_context_t *
+modest_platform_get_osso_context (void)
+{
+ return modest_maemo_utils_get_osso_context ();
+}