X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fgtk%2Fmodest-platform.c;h=f492eb61a81956f7cc45be850dd7e253093ecd4f;hb=50571176a5fd878e78793a6644ca178d55ce1238;hp=dbeedfcfdd231c8c2599e782c14b0b565585830b;hpb=c4c7c252c246777b850efa995641031e0c2e8a22;p=modest diff --git a/src/gtk/modest-platform.c b/src/gtk/modest-platform.c index dbeedfc..f492eb6 100644 --- a/src/gtk/modest-platform.c +++ b/src/gtk/modest-platform.c @@ -64,7 +64,7 @@ #include #include #include - +#include "widgets/modest-toolkit-utils.h" #define HILDON_OSSO_URI_ACTION "uri-action" #define URI_ACTION_COPY "copy:" @@ -76,12 +76,6 @@ #define FOLDER_PICKER_CURRENT_FOLDER "current-folder" #define FOLDER_PICKER_ORIGINAL_ACCOUNT "original-account" -static gboolean ca_con_opened = FALSE; - - -static void modest_platform_play_email_tone (void); - - static void on_modest_conf_update_interval_changed (ModestConf* self, const gchar *key, @@ -103,6 +97,7 @@ on_modest_conf_update_interval_changed (ModestConf* self, static gboolean check_required_files (void) { +#if 0 FILE *mcc_file = modest_utils_open_mcc_mapping_file (); if (!mcc_file) { @@ -117,7 +112,7 @@ check_required_files (void) g_printerr ("modest: cannot find providers data\n"); return FALSE; } - +#endif return TRUE; } @@ -217,9 +212,11 @@ modest_platform_show_uri_popup (const gchar *uri) GdkPixbuf* modest_platform_get_icon (const gchar *name, guint icon_size) { - g_warning ("Not implemented %s", __FUNCTION__); - - return NULL; + return gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), + name, + icon_size, + 0, + NULL); } const gchar* @@ -877,14 +874,14 @@ modest_platform_run_new_folder_dialog (GtkWindow *parent_window, } gint -modest_platform_run_rename_folder_dialog (GtkWindow *parent_window, +modest_platform_run_rename_folder_dialog (ModestWindow *parent_window, TnyFolderStore *parent_folder, const gchar *suggested_name, gchar **folder_name) { g_return_val_if_fail (TNY_IS_FOLDER_STORE (parent_folder), GTK_RESPONSE_REJECT); - return modest_platform_run_folder_common_dialog (parent_window, + return modest_platform_run_folder_common_dialog (gtk_widget_get_toplevel (GTK_WIDGET (parent_window)), parent_folder, _HL("ckdg_ti_rename_folder"), _HL("ckdg_fi_rename_name"), @@ -998,52 +995,6 @@ typedef struct _ConnectAndWaitData { } ConnectAndWaitData; -static void -quit_wait_loop (TnyAccount *account, - ConnectAndWaitData *data) -{ - /* Set the has_callback to TRUE (means that the callback was - executed and wake up every code waiting for cond to be - TRUE */ - g_mutex_lock (data->mutex); - data->has_callback = TRUE; - if (data->wait_loop) - g_main_loop_quit (data->wait_loop); - g_mutex_unlock (data->mutex); -} - -static void -on_connection_status_changed (TnyAccount *account, - TnyConnectionStatus status, - gpointer 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 -on_tny_camel_account_set_online_cb (TnyCamelAccount *account, - gboolean canceled, - GError *err, - gpointer 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) @@ -1481,7 +1432,6 @@ modest_platform_connect_and_perform (GtkWindow *parent_window, gboolean device_online; TnyDevice *device; TnyConnectionStatus conn_status; - OnWentOnlineInfo *info; device = modest_runtime_get_device(); device_online = tny_device_is_online (device); @@ -1513,28 +1463,40 @@ modest_platform_connect_and_perform (GtkWindow *parent_window, conn_status = tny_account_get_connection_status (account); if (device_online && conn_status == TNY_CONNECTION_STATUS_CONNECTED) { - + /* We promise to instantly perform the callback, so ... */ if (callback) { callback (FALSE, NULL, parent_window, account, user_data); } - + return; } - - if (device_online) { - } else { - + + if (!device_online) { + OnWentOnlineInfo *info = NULL; + + info = g_slice_new0 (OnWentOnlineInfo); + + info->device = NULL; + info->iap = NULL; + info->account = TNY_ACCOUNT (g_object_ref (account)); + + if (parent_window) + info->parent_window = (GtkWindow *) g_object_ref (parent_window); + else + info->parent_window = NULL; + + /* So we'll put the callback away for later ... */ + info->user_data = user_data; + info->callback = callback; + /* If the device is online, we'll just connect the account */ - - tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), TRUE, + tny_camel_account_set_online (TNY_CAMEL_ACCOUNT (account), TRUE, on_account_went_online, info); } - + /* The info gets freed by on_account_went_online or on_conic_device_went_online * in both situations, go look if you don't believe me! */ - - return; } void @@ -1773,12 +1735,6 @@ modest_platform_run_header_details_dialog (GtkWindow *parent_window, dialog); } -static void -modest_platform_play_email_tone (void) -{ - return; -} - #define MOVE_TO_DIALOG_FOLDER_VIEW "folder-view" #define MOVE_TO_DIALOG_BACK_BUTTON "back-button" #define MOVE_TO_DIALOG_ACTION_BUTTON "action-button"