X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-platform.c;h=614aa13e156831da54767d25a6db98009bcece7f;hp=f80687f02dfc791fbeaad21adef8504253c5e5fd;hb=454354bdd5a2370614e99d0a95b5d016b4467f17;hpb=1c4231d3e067c7c17ce6675a4685e58c152f17a7 diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index f80687f..614aa13 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include /* For alarm_event_add(), etc. */ @@ -55,6 +54,10 @@ #include #include +#ifdef MODEST_HAVE_ABOOK +#include +#endif /*MODEST_HAVE_ABOOK*/ + #define HILDON_OSSO_URI_ACTION "uri-action" #define URI_ACTION_COPY "copy:" @@ -199,12 +202,16 @@ modest_platform_init (int argc, char *argv[]) modest_account_mgr_free_account_names (acc_names); } + +#ifdef MODEST_HAVE_ABOOK /* initialize the addressbook */ if (!osso_abook_init (&argc, &argv, osso_context)) { g_printerr ("modest: failed to initialized addressbook\n"); return FALSE; } - +#endif /*MODEST_HAVE_ABOOK*/ + + return TRUE; } @@ -607,7 +614,7 @@ launch_sort_headers_dialog (GtkWindow *parent_window, sort_key = hildon_sort_dialog_add_sort_key (dialog, _("mcen_li_sort_priority")); sort_model_ids[sort_key] = TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN; - sort_ids[sort_key] = TNY_HEADER_FLAG_PRIORITY; + sort_ids[sort_key] = TNY_HEADER_FLAG_PRIORITY_MASK; priority_sort_id = sort_key; sortable = GTK_TREE_SORTABLE (gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (GTK_TREE_VIEW (header_view))))); @@ -621,7 +628,7 @@ launch_sort_headers_dialog (GtkWindow *parent_window, if (current_sort_colid == TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN) { gpointer flags_sort_type_pointer; flags_sort_type_pointer = g_object_get_data (G_OBJECT (cols->data), MODEST_HEADER_VIEW_FLAG_SORT); - if (GPOINTER_TO_INT (flags_sort_type_pointer) == TNY_HEADER_FLAG_PRIORITY) + if (GPOINTER_TO_INT (flags_sort_type_pointer) == TNY_HEADER_FLAG_PRIORITY_MASK) hildon_sort_dialog_set_sort_key (dialog, priority_sort_id); else hildon_sort_dialog_set_sort_key (dialog, attachments_sort_id); @@ -929,28 +936,18 @@ modest_platform_run_information_dialog (GtkWindow *parent_window, -typedef struct _UtilIdleData { +typedef struct _ConnectAndWaitData { GMutex *mutex; GMainLoop *wait_loop; gboolean has_callback; gulong handler; -} UtilIdleData; +} ConnectAndWaitData; static void -check_connection_status_and_quit (TnyAccount *account, - UtilIdleData *data) +quit_wait_loop (TnyAccount *account, + ConnectAndWaitData *data) { - TnyConnectionStatus conn_status; - - conn_status = tny_account_get_connection_status (account); - if (conn_status == TNY_CONNECTION_STATUS_RECONNECTING || - conn_status == TNY_CONNECTION_STATUS_DISCONNECTED) - return; - - /* Remove the handler */ - g_signal_handler_disconnect (account, data->handler); - /* Set the has_callback to TRUE (means that the callback was executed and wake up every code waiting for cond to be TRUE */ @@ -966,8 +963,21 @@ on_connection_status_changed (TnyAccount *account, TnyConnectionStatus status, gpointer user_data) { - check_connection_status_and_quit (account, - (UtilIdleData *) user_data); + TnyConnectionStatus conn_status; + ConnectAndWaitData *data; + + /* Ignore if reconnecting or disconnected */ + conn_status = tny_account_get_connection_status (account); + if (conn_status == TNY_CONNECTION_STATUS_RECONNECTING || + conn_status == TNY_CONNECTION_STATUS_DISCONNECTED) + return; + + /* Remove the handler */ + data = (ConnectAndWaitData *) user_data; + g_signal_handler_disconnect (account, data->handler); + + /* Quit from wait loop */ + quit_wait_loop (account, (ConnectAndWaitData *) user_data); } static void @@ -976,15 +986,15 @@ on_tny_camel_account_set_online_cb (TnyCamelAccount *account, GError *err, gpointer user_data) { - check_connection_status_and_quit (TNY_ACCOUNT (account), - (UtilIdleData *) user_data); + /* Quit from wait loop */ + quit_wait_loop (TNY_ACCOUNT (account), (ConnectAndWaitData *) user_data); } gboolean modest_platform_connect_and_wait (GtkWindow *parent_window, TnyAccount *account) { - UtilIdleData *data = NULL; + ConnectAndWaitData *data = NULL; gboolean device_online; TnyDevice *device; TnyConnectionStatus conn_status; @@ -1006,7 +1016,7 @@ modest_platform_connect_and_wait (GtkWindow *parent_window, return TRUE; /* Create the helper */ - data = g_slice_new0 (UtilIdleData); + data = g_slice_new0 (ConnectAndWaitData); data->mutex = g_mutex_new (); data->has_callback = FALSE; @@ -1046,7 +1056,7 @@ modest_platform_connect_and_wait (GtkWindow *parent_window, g_signal_handler_disconnect (account, data->handler); g_mutex_free (data->mutex); g_main_loop_unref (data->wait_loop); - g_slice_free (UtilIdleData, data); + g_slice_free (ConnectAndWaitData, data); } conn_status = tny_account_get_connection_status (account); @@ -1622,7 +1632,7 @@ on_cert_dialog_response (GtkDialog *dialog, gint response_id, const gchar* cert gboolean -modest_platform_run_certificate_conformation_dialog (const gchar* server_name, +modest_platform_run_certificate_confirmation_dialog (const gchar* server_name, const gchar *certificate) { GtkWidget *note; @@ -1652,7 +1662,7 @@ modest_platform_run_certificate_conformation_dialog (const gchar* server_name, on_destroy_dialog (GTK_DIALOG(note)); g_free (question); - return response; + return response == GTK_RESPONSE_OK; }