X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fgtk%2Fmodest-platform.c;h=a1a9361fb24dd561bb93d00b2aca4a8e2348b612;hb=b4322b2797a54b300ea6601e65623d8a03584b23;hp=848ceecf8d6165dd90a33586eee78296c62f8d02;hpb=1bd2f978c6e98871f2f459786f6121e7ba61fef6;p=modest diff --git a/src/gtk/modest-platform.c b/src/gtk/modest-platform.c index 848ceec..a1a9361 100644 --- a/src/gtk/modest-platform.c +++ b/src/gtk/modest-platform.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "modest-widget-memory.h" #include @@ -66,7 +65,10 @@ #include #include #include "widgets/modest-toolkit-utils.h" +#include "widgets/modest-msg-view-window.h" #include +#include +#include #define HILDON_OSSO_URI_ACTION "uri-action" #define URI_ACTION_COPY "copy:" @@ -444,6 +446,13 @@ folder_chooser_dialog_run (ModestFolderView *original, const gchar *visible_id = NULL; userdata.dialog = gtk_dialog_new (); + + gtk_widget_set_size_request (GTK_WIDGET (userdata.dialog), + MODEST_DIALOG_WINDOW_MAX_WIDTH, + MODEST_DIALOG_WINDOW_MAX_HEIGHT); + + gtk_dialog_add_button (GTK_DIALOG (userdata.dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + scrollable = modest_toolkit_factory_create_scrollable (modest_runtime_get_toolkit_factory ()); folder_view = modest_platform_create_folder_view (NULL); @@ -768,6 +777,8 @@ modest_platform_run_folder_common_dialog (GtkWindow *parent_window, dialog = gtk_dialog_new_with_buttons (dialog_title, parent_window, GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, _FM_NEW_FOLDER_DIALOG_OK, GTK_RESPONSE_ACCEPT, NULL); @@ -948,9 +959,12 @@ modest_platform_run_rename_folder_dialog (ModestWindow *parent_window, const gchar *suggested_name, gchar **folder_name) { + GtkWindow *toplevel; + g_return_val_if_fail (TNY_IS_FOLDER_STORE (parent_folder), GTK_RESPONSE_REJECT); - return modest_platform_run_folder_common_dialog (gtk_widget_get_toplevel (GTK_WIDGET (parent_window)), + toplevel = (GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (parent_window)); + return modest_platform_run_folder_common_dialog (toplevel, parent_folder, _HL_TITLE_RENAME_FOLDER, _HL_RENAME_NAME, @@ -1139,10 +1153,75 @@ modest_platform_create_sort_dialog (GtkWindow *parent_window) } +static guint timeout_handler_id = 0; +static gboolean weak_ref_enabled = FALSE; + +static void +shell_weak_ref (gpointer data, + GObject *was) +{ + if (timeout_handler_id > 0) { + g_source_remove (timeout_handler_id); + timeout_handler_id = 0; + } +} + +static gboolean +update_timeout_handler (gpointer userdata) +{ + gboolean auto_update; + gboolean right_connection = FALSE; + + /* Check if the autoupdate feature is on */ + auto_update = modest_conf_get_bool (modest_runtime_get_conf (), + MODEST_CONF_AUTO_UPDATE, NULL); + + if (auto_update) { + gint connect_when; + /* Do send receive. Never set the current top window + as we always assume that DBus send/receive requests + are not user driven */ + + connect_when = modest_conf_get_int (modest_runtime_get_conf (), + MODEST_CONF_UPDATE_WHEN_CONNECTED_BY, NULL); + /* Perform a send and receive if the user selected to connect + via any mean or if the current connection method is the + same as the one specified by the user */ + if (connect_when == MODEST_CONNECTED_VIA_ANY || + connect_when == modest_platform_get_current_connection ()) { + right_connection = TRUE; + } + } else { + /* Disable auto update */ + modest_platform_set_update_interval (0); + } + + if (auto_update && right_connection) { + modest_ui_actions_do_send_receive_all (NULL, FALSE, FALSE, FALSE); + } + + return TRUE; +} + gboolean modest_platform_set_update_interval (guint minutes) { + if (!weak_ref_enabled) { + ModestWindowMgr *mgr; + GtkWidget *shell; + mgr = modest_runtime_get_window_mgr (); + shell = modest_gtk_window_mgr_get_shell (MODEST_GTK_WINDOW_MGR (mgr)); + g_object_weak_ref ((GObject *) shell, shell_weak_ref, NULL); + weak_ref_enabled = TRUE; + } + if (timeout_handler_id > 0) { + g_source_remove (timeout_handler_id); + timeout_handler_id = 0; + } + if (minutes > 0) + timeout_handler_id = g_timeout_add_seconds (minutes*60, update_timeout_handler, NULL); + return TRUE; } @@ -1160,7 +1239,7 @@ modest_platform_on_new_headers_received (GList *URI_list, } void -modest_platform_remove_new_mail_notifications (gboolean only_visuals) +modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name) { return; } @@ -1461,7 +1540,7 @@ modest_platform_run_alert_dialog (const gchar* prompt, /***************/ typedef struct { - GtkWindow *parent_window; + ModestWindow *parent_window; ModestConnectedPerformer callback; TnyAccount *account; gpointer user_data; @@ -1510,7 +1589,7 @@ on_account_went_online (TnyCamelAccount *account, gboolean canceled, GError *err } void -modest_platform_connect_and_perform (GtkWindow *parent_window, +modest_platform_connect_and_perform (ModestWindow *parent_window, gboolean force, TnyAccount *account, ModestConnectedPerformer callback, @@ -1569,7 +1648,7 @@ modest_platform_connect_and_perform (GtkWindow *parent_window, info->account = TNY_ACCOUNT (g_object_ref (account)); if (parent_window) - info->parent_window = (GtkWindow *) g_object_ref (parent_window); + info->parent_window = (ModestWindow *) g_object_ref (parent_window); else info->parent_window = NULL; @@ -1587,7 +1666,7 @@ modest_platform_connect_and_perform (GtkWindow *parent_window, } void -modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window, +modest_platform_connect_if_remote_and_perform (ModestWindow *parent_window, gboolean force, TnyFolderStore *folder_store, ModestConnectedPerformer callback, @@ -1636,7 +1715,7 @@ modest_platform_connect_if_remote_and_perform (GtkWindow *parent_window, static void src_account_connect_performer (gboolean canceled, GError *err, - GtkWindow *parent_window, + ModestWindow *parent_window, TnyAccount *src_account, gpointer user_data) { @@ -1659,12 +1738,12 @@ src_account_connect_performer (gboolean canceled, void -modest_platform_double_connect_and_perform (GtkWindow *parent_window, +modest_platform_double_connect_and_perform (ModestWindow *parent_window, gboolean force, TnyFolderStore *folder_store, DoubleConnectionInfo *connect_info) { - modest_platform_connect_if_remote_and_perform(parent_window, + modest_platform_connect_if_remote_and_perform(parent_window, force, folder_store, src_account_connect_performer, @@ -2162,6 +2241,8 @@ modest_platform_create_move_to_dialog (GtkWindow *parent_window, GTK_WINDOW (parent_window), GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, _FM_CHANGE_FOLDER_NEW_FOLDER, MODEST_GTK_RESPONSE_NEW_FOLDER, NULL); @@ -2285,3 +2366,29 @@ modest_platform_get_list_to_move (ModestWindow *window) return list; } + +void +modest_platform_emit_folder_updated_signal (const gchar *account_id, const gchar *folder_id) +{ + return; +} + + +void +modest_platform_emit_account_created_signal (const gchar *account_id) +{ + return; +} + +void +modest_platform_emit_account_removed_signal (const gchar *account_id) +{ + return; +} + +void +modest_platform_emit_msg_read_changed_signal (const gchar *msg_uid, + gboolean is_read) +{ + return; +}