Modified webpage: now tinymail repository is in gitorious.
[modest] / src / modest-utils.h
index a055cc0..3d8f8a1 100644 (file)
 
 #include <gtk/gtk.h>
 #include <stdio.h> /* for FILE* */
 
 #include <gtk/gtk.h>
 #include <stdio.h> /* for FILE* */
-#include <modest-protocol-info.h>
 #include <tny-fs-stream.h>
 #include <tny-fs-stream.h>
+#include <modest-protocol.h>
+#include "widgets/modest-validating-entry.h"
+#include <widgets/modest-window.h>
 
 typedef enum {
        MODEST_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED
 } ModestUtilsGetSupportedSecureAuthenticationError;
 
 
 typedef enum {
        MODEST_UTILS_GET_SUPPORTED_SECURE_AUTHENTICATION_ERROR_CANCELED
 } ModestUtilsGetSupportedSecureAuthenticationError;
 
+typedef enum _ModestSortDialogType {
+       MODEST_SORT_HEADERS,
+} ModestSortDialogType;
+
+typedef struct _ModestMsgNotificationData {
+       gchar *subject;
+       gchar *from;
+       gchar *uri;
+       time_t time;
+} ModestMsgNotificationData;
+
 GQuark modest_utils_get_supported_secure_authentication_error_quark (void);
 
 
 GQuark modest_utils_get_supported_secure_authentication_error_quark (void);
 
 
@@ -57,7 +70,9 @@ gboolean modest_utils_folder_writable (const gchar *filename);
  * modest_utils_file_exists:
  * @filename: a string
  *
  * modest_utils_file_exists:
  * @filename: a string
  *
- * Checks if @filename exists
+ * Checks if @filename exists. The filename must NOT use escaped
+ * characters as this function uses g_access to check if the file
+ * exists or not
  *
  * Returns: %TRUE if @filename currently exists, %FALSE otherwise
  */
  *
  * Returns: %TRUE if @filename currently exists, %FALSE otherwise
  */
@@ -92,7 +107,7 @@ TnyFsStream *modest_utils_create_temp_stream (const gchar *orig_name, const gcha
  *
  */
 
  *
  */
 
-GList* modest_utils_get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto, 
+GList* modest_utils_get_supported_secure_authentication_methods (ModestProtocolType proto, 
        const gchar* hostname, gint port, const gchar* username, GtkWindow *parent_window, GError** error);
 
 /** modest_show_information_note_in_main_context_and_forget:
        const gchar* hostname, gint port, const gchar* username, GtkWindow *parent_window, GError** error);
 
 /** modest_show_information_note_in_main_context_and_forget:
@@ -124,4 +139,131 @@ void modest_utils_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *d
  */
 void modest_utils_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value);
 
  */
 void modest_utils_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value);
 
+/**
+ * modest_utils_run_sort_dialog:
+ * @parent_window: the modest window the dialog has been requested from
+ * @type: a #ModestSortDialogType
+ *
+ * raises a sort dialog for this window
+ */
+void modest_utils_run_sort_dialog (ModestWindow *parent_window, ModestSortDialogType type);
+
+
+/**
+ * modest_list_index:
+ * @list: a #TnyList
+ * @object: a #GObject
+ *
+ * finds the index of @object in @list
+ *
+ * Returns: the index of @object, or -1 if @object is not in @list
+ */
+gint modest_list_index (TnyList *list, GObject *object);
+
+/**
+ * modest_utils_get_available_space:
+ * @maildir_path: the path of the maildir folder, or %NULL to
+ * get the space available in local folders
+ *
+ * Obtains the space available in the local folder.
+ *
+ * Returns: a #guint64
+ */
+guint64 modest_utils_get_available_space (const gchar *maildir_path);
+
+/**
+ * modest_images_cache_get_id:
+ * @account: a #TnyAccount
+ * @uri: an uri string
+ *
+ * obtains the hash corresponding to an image external resource to be
+ * stored in image cache.
+ *
+ * Returns: a newly allocated string containing the hash key
+ */
+gchar *modest_images_cache_get_id (const gchar *account, const gchar *uri);
+
+
+/**
+ * modest_utils_get_account_name_from_recipient:
+ * @from: the result of a call to tny_header_dup_from
+ *
+ * returns the account name that corresponds to the given from address
+ *
+ * Returns: a newly allocated string containing the account name or
+ * %NULL in case of error
+ */
+gchar *modest_utils_get_account_name_from_recipient (const gchar *from, gchar **mailbox);
+
+void modest_utils_on_entry_invalid_character (ModestValidatingEntry *self, 
+                                             const gchar* character,
+                                             gpointer user_data);
+
+/**
+ * modest_utils_open_mcc_mapping_file:
+ * @translated: a #gboolean pointer
+ *
+ * open the mcc mapping file, or %NULL if it fails
+ *
+ * Returns: file ptr or %NULL in case of error
+ */
+FILE* modest_utils_open_mcc_mapping_file (void);
+
+typedef enum {
+       MODEST_UTILS_COUNTRY_MODEL_COLUMN_NAME = 0,
+       MODEST_UTILS_COUNTRY_MODEL_COLUMN_MCC = 1,
+       MODEST_UTILS_COUNTRY_MODEL_N_COLUMNS
+} ModestUtilsCountryModelColumns;
+
+/**
+ * modest_utils_create_country_model:
+ * @locale_mcc: a #gboolean
+ *
+ * creates the countries tree model used in wizard from the mcc
+ * files.
+ *
+ * Returns: an empty #GtkTreeModel with the columns enumerated in
+ *  #ModestUtilsCountryModelColumns
+ */
+GtkTreeModel *modest_utils_create_country_model (void);
+
+/**
+ * modest_utils_fill_country_model:
+ * @model: a #GtkTreeModel (obtained with modest_utils_create_country_model
+ * @locale_mcc: a #gboolean
+ *
+ * fills the countries tree model used in wizard from the mcc
+ * files.
+ *
+ */
+void modest_utils_fill_country_model (GtkTreeModel *model, gint *locale_mcc);
+
+/**
+ * modest_utils_create_notification_list_from_header_list:
+ * @header_list: a #TnyList of #TnyHeader instances
+ *
+ * This function transforms a list of #TnyHeader objects into a list
+ * that will be used to issue new email notifications
+ *
+ * Returns: a #GList of #ModestMsgNotificationData
+ **/
+GList *modest_utils_create_notification_list_from_header_list (TnyList *header_list);
+
+/**
+ * modest_utils_free_notification_list:
+ * @notification_list: a #GList of #ModestMsgNotificationData
+ *
+ * Frees a list of #ModestMsgNotificationData structures
+ **/
+void  modest_utils_free_notification_list (GList *notification_list);
+
+/**
+ * modest_utils_flush_send_queue:
+ * @account_id: the ID of the modest account
+ *
+ * Flushes the send queue of the given account. That will try to send
+ * all the remaining messages in the send queue
+ **/
+void  modest_utils_flush_send_queue (const gchar *account_id);
+
 #endif /*__MODEST_MAEMO_UTILS_H__*/
 #endif /*__MODEST_MAEMO_UTILS_H__*/