-- Moises Martinez <moises.martinez@nokia.com> Fri, 12 Jun 2009 15:31:10 +0300
+modest (3.0.17-rc13) unstable; urgency=low
+
+ * Week 25 - second release
+ *
+ * Fixes: NB#108159 Contacts Startup is slow in Email - New mail compose view
+ * Fixes: NB#116869 Theme and Layout Issues
+ * Fixes: NB#117340 Sometimes Send/receive not initiated after a connection is selected
+ * Fixes: NB#120910 Modest crash while updating the folders view.
+ * Fixes: NB#121339 Messages disappear from Inbox and modest is continuously retrieving in the particular scenario
+ * Fixes: NB#121911 No error note is shown upon creating non existing account using manual account setup
+ * Fixes: NB#121968 Move to folder: Unable to move local user defined folder under Gmail account root folder
+ * Fixes: NB#122003 modest-74E5-11-3571.rcore.lzo crashed
+ * Fixes: NB#122017 After removing all messages from Imap folder still the menu commands
+ * related to messages management are not dimmed
+ * Fixes: NB#122232 Signature gets duplicated
+ * Fixes: NB#122287 Conflict behavior in closing "Find on page" tool bar using Ctrl+F short cut key in Email
+ * Fixes: NB#119126 LED is not glowing for incoming mail when E-mail main view is open and display is off
+
+ -- Moises Martinez <moises.martinez@nokia.com> Fri, 12 Jun 2009 13:06:45 +0300
+
+modest (3.0.17-rc12) unstable; urgency=low
+
+ * Week 25, 2009 - first release
+ *
+ * Fixes: NB#112963 Opening New Editor takes more than expected time(ie 1 sec) when
+ * launched from Accounts view/Folders View.
+ * Fixes: NB#117782 'incorrect password' error banner is not displaying
+ * Fixes: NB#117967 Opening a email viewer when tapped on new email notification
+ * received should be improved
+ * Fixes: NB#120960 Attachments are not saved properly in local device folder after
+ * attempting to save in external MMC memory full condition
+ * Fixes: NB#121112 dbus API doesn't support filename with commas
+ * Fixes: NB#121163 modest is crashing while trying to select Sent/Outbox folders in new folder dialog box
+ * Fixes: NB#121240 No Information note is displayed when attempt to save files in Memory full external MMC.
+ * Fixes: NB#121353 New folder: All the account's Inbox folder is listed in change folder
+ * dialog once outbox folder is chosen as location
+ * Fixes: NB#121486 Editor: a wrong banner is shown when a file is too large to be attached
+
+ -- Moises Martinez <moises.martinez@nokia.com> Tue, 09 Jun 2009 19:13:48 +0300
+
modest (3.0.17-rc11) unstable; urgency=low
* Week 24, 2009 - second release
*
- * Fixes: NB#101877 Memory full: No error note is shown when account is not refreshed after it has been configured
- * Fixes: NB#110512 "Last Updated" time is proper
- * Fixes: NB#113658 Viewer view: Ctrl+R Shortcut is not working to open reply editor window.
- * Fixes: NB#113941 email application very slow with continuous mail notifications
- * Fixes: NB#114892 New folder dialog opened during move messages, location path should be chosen folder in the currently selected folder
- * Fixes: NB#114986 "Unable to create folder. External MMC memory full" information note should show when attempt to create folder if external MMC is full
- * Fixes: NB#116970 Modest crashes at "gstring_copy ()" when theme is changed while Email application is open
- * Fixes: NB#117408 Outbox folder : Message is not removed when email account is deleted from accounts settings dialog opened through error information banner.
- * Fixes: NB#118464 New message with no subject is moved to outbox using “Ctrl+Enterâ€\9d shortcut key.
- * Fixes: NB#119126 LED is not glowing for incoming mail when E-mail main view is open and display is off
- * Fixes: NB#119622 Mem full: No notification is shown when an attempt to delete a user defined remote Gmail folder fails
- * Fixes: NB#119629 Mem full: a wrong notification/no notification is shown when attempt to move a remote folder under Archive fails
- * Fixes: NB#119631 Mem full and Email is not running: attempt to launch editor from other applications silently fails
- * Fixes: NB#119633 Archive folder name shown untranslated in the path area in Move to folder dialog
- * Fixes: NB#119715 E-Mail hangs while interacting with Camera under mentioned scenario
- * Fixes: NB#119775 mcen_va_new_messages logical ID
- * Fixes: NB#119784 Modest spams the console
- * Fixes: NB#119818 Folders view hierarchy is sometimes displayed incorrectly
- * Fixes: NB#119920 Folder status representation string has wrong vertical alignment
- * Fixes: NB#120155 Wrong file name is shown in the Replace existing file of same name confirmation note
- * Fixes: NB#120160 Colour pallete window appears instead of new message editor
- * Fixes: NB#120277 Different Infobanners while sharing a large file via email through FileManager & as an attachment in new email
- * Fixes: NB#120338 modest plugins need a way to notify modest that they don't want to received timed-interval syncs
- * Fixes: NB#120438 Remote Folders are not displayed while creating New Folder in Change Folder Dialog.
- * Fixes: NB#120943 IMAP Remote folders not shown in change folder dialog after choosing local user defined folder
- * Fixes: NB#120950 Modest crashes after connecting to network in a particular scenario
- * Fixes: NB#120969 Signature separator misses trailing space (RFC 3676 violation)
- * Fixes: NB#120978 find/search toolbar misplaced relative to main toolbar
+ * Fixes NB#101877 Memory full: No error note is shown when account is not refreshed after it has been configured
+ * Fixes NB#110512 "Last Updated" time is proper
+ * Fixes NB#113658 Viewer view: Ctrl+R Shortcut is not working to open reply editor window.
+ * Fixes NB#113941 email application very slow with continuous mail notifications
+ * Fixes NB#114892 New folder dialog opened during move messages, location path should be chosen folder in the currently selected folder
+ * Fixes NB#114986 "Unable to create folder. External MMC memory full" information note should show when attempt to create folder if external MMC is full
+ * Fixes NB#116970 Modest crashes at "gstring_copy ()" when theme is changed while Email application is open
+ * Fixes NB#117408 Outbox folder : Message is not removed when email account is deleted from accounts settings dialog opened through error information banner.
+ * Fixes NB#118464 New message with no subject is moved to outbox using “Ctrl+Enterâ€\9d shortcut key.
+ * Fixes NB#119126 LED is not glowing for incoming mail when E-mail main view is open and display is off
+ * Fixes NB#119622 Mem full: No notification is shown when an attempt to delete a user defined remote Gmail folder fails
+ * Fixes NB#119629 Mem full: a wrong notification/no notification is shown when attempt to move a remote folder under Archive fails
+ * Fixes NB#119631 Mem full and Email is not running: attempt to launch editor from other applications silently fails
+ * Fixes NB#119633 Archive folder name shown untranslated in the path area in Move to folder dialog
+ * Fixes NB#119715 E-Mail hangs while interacting with Camera under mentioned scenario
+ * Fixes NB#119775 mcen_va_new_messages logical ID
+ * Fixes NB#119784 Modest spams the console
+ * Fixes NB#119818 Folders view hierarchy is sometimes displayed incorrectly
+ * Fixes NB#119920 Folder status representation string has wrong vertical alignment
+ * Fixes NB#120155 Wrong file name is shown in the Replace existing file of same name confirmation note
+ * Fixes NB#120160 Colour pallete window appears instead of new message editor
+ * Fixes NB#120277 Different Infobanners while sharing a large file via email through FileManager & as an attachment in new email
+ * Fixes NB#120338 modest plugins need a way to notify modest that they don't want to received timed-interval syncs
+ * Fixes NB#120438 Remote Folders are not displayed while creating New Folder in Change Folder Dialog.
+ * Fixes NB#120943 IMAP Remote folders not shown in change folder dialog after choosing local user defined folder
+ * Fixes NB#120950 Modest crashes after connecting to network in a particular scenario
+ * Fixes NB#120969 Signature separator misses trailing space (RFC 3676 violation)
+ * Fixes NB#120978 find/search toolbar misplaced relative to main toolbar
-- Moises Martinez <moises.martinez@nokia.com> Fri, 05 Jun 2009 18:17:56 +0300
#include <modest-address-book.h>
void
+modest_address_book_init (void)
+{
+ g_debug (__FUNCTION__);
+}
+
+void
modest_address_book_add_address (const gchar *address)
{
g_debug (__FUNCTION__);
modest-osso-autosave-callbacks.h \
modest-osso-state-saving.c \
modest-osso-state-saving.h \
- modest-limit-retrieve-picker.h modest-limit-retrieve-picker.c \
- modest-retrieve-picker.h modest-retrieve-picker.c \
modest-secureauth-picker.h modest-secureauth-picker.c \
modest-selector-picker.h modest-selector-picker.c \
modest-hildon2-window-mgr.h modest-hildon2-window-mgr.c
/* globals */
static GtkWindowClass *parent_class = NULL;
+static GtkWidget *pre_created_accounts_window = NULL;
/************************************************************************/
* after disconnecting all signals, in destroy stage */
}
-ModestWindow *
-modest_accounts_window_new (void)
+static ModestWindow *
+modest_accounts_window_new_real (void)
{
ModestAccountsWindow *self = NULL;
ModestAccountsWindowPrivate *priv = NULL;
- HildonProgram *app;
GdkPixbuf *window_icon;
GdkPixbuf *new_message_pixbuf;
- GtkWidget *action_area_box;
guint accel_key;
GdkModifierType accel_mods;
GtkAccelGroup *accel_group;
G_CALLBACK (on_queue_changed),
self);
- priv->account_view = GTK_WIDGET (modest_account_view_new (modest_runtime_get_account_mgr ()));
-
- action_area_box = hildon_tree_view_get_action_area_box (GTK_TREE_VIEW (priv->account_view));
- priv->new_message_button = hildon_button_new (0, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
+ priv->new_message_button = hildon_button_new (MODEST_EDITABLE_SIZE,
+ HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
hildon_button_set_title (HILDON_BUTTON (priv->new_message_button), _("mcen_ti_new_message"));
hildon_button_set_image (HILDON_BUTTON (priv->new_message_button), gtk_image_new_from_pixbuf (new_message_pixbuf));
- gtk_box_pack_start (GTK_BOX (action_area_box), priv->new_message_button, TRUE, TRUE, 0);
gtk_widget_show_all (priv->new_message_button);
- hildon_tree_view_set_action_area_visible (GTK_TREE_VIEW (priv->account_view), TRUE);
g_object_unref (new_message_pixbuf);
setup_menu (self);
- gtk_container_add (GTK_CONTAINER (priv->pannable), priv->account_view);
gtk_box_pack_start (GTK_BOX (priv->box), priv->pannable, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (box_alignment), priv->box);
gtk_container_add (GTK_CONTAINER (self), box_alignment);
gtk_widget_show (priv->box);
gtk_widget_show (box_alignment);
- connect_signals (MODEST_ACCOUNTS_WINDOW (self));
-
- /* Load previous osso state, for instance if we are being restored from
- * hibernation: */
- modest_osso_load_state ();
-
/* Get device name */
modest_maemo_utils_get_device_name ();
- app = hildon_program_get_instance ();
- hildon_program_add_window (app, HILDON_WINDOW (self));
-
/* Set window icon */
window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG);
if (window_icon) {
g_object_unref (window_icon);
}
+ accel_group = gtk_accel_group_new ();
+ gtk_accelerator_parse ("<Control>n", &accel_key, &accel_mods);
+ gtk_widget_add_accelerator (priv->new_message_button, "clicked", accel_group,
+ accel_key, accel_mods, 0);
+ gtk_window_add_accel_group (GTK_WINDOW (self), accel_group);
+
+ return MODEST_WINDOW(self);
+}
+
+ModestWindow *
+modest_accounts_window_new (void)
+{
+ GtkWidget *action_area_box;
+ ModestWindow *self;
+ ModestAccountsWindowPrivate *priv = NULL;
+ HildonProgram *app;
+
+ if (pre_created_accounts_window) {
+ self = MODEST_WINDOW (pre_created_accounts_window);
+ pre_created_accounts_window = NULL;
+ } else {
+ self = modest_accounts_window_new_real ();
+ }
+ priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE(self);
+ priv->account_view = GTK_WIDGET (modest_account_view_new (modest_runtime_get_account_mgr ()));
+
+ action_area_box = hildon_tree_view_get_action_area_box (GTK_TREE_VIEW (priv->account_view));
+ gtk_box_pack_start (GTK_BOX (action_area_box), priv->new_message_button, TRUE, TRUE, 0);
+ hildon_tree_view_set_action_area_visible (GTK_TREE_VIEW (priv->account_view), TRUE);
+ gtk_container_add (GTK_CONTAINER (priv->pannable), priv->account_view);
+
+ connect_signals (MODEST_ACCOUNTS_WINDOW (self));
+
+ /* Load previous osso state, for instance if we are being restored from
+ * hibernation: */
+ modest_osso_load_state ();
+
+ app = hildon_program_get_instance ();
+ hildon_program_add_window (app, HILDON_WINDOW (self));
+
/* Dont't restore settings here,
* because it requires a gtk_widget_show(),
* and we don't want to do that until later,
g_signal_connect (G_OBJECT (self), "map-event",
G_CALLBACK (_modest_accounts_window_map_event),
G_OBJECT (self));
- update_progress_hint (self);
+ update_progress_hint (MODEST_ACCOUNTS_WINDOW (self));
- row_count_changed (self);
-
- accel_group = gtk_accel_group_new ();
- gtk_accelerator_parse ("<Control>n", &accel_key, &accel_mods);
- gtk_widget_add_accelerator (priv->new_message_button, "clicked", accel_group,
- accel_key, accel_mods, 0);
- gtk_window_add_accel_group (GTK_WINDOW (self), accel_group);
+ row_count_changed (MODEST_ACCOUNTS_WINDOW (self));
- return MODEST_WINDOW(self);
+ return self;
}
+
ModestAccountView *
modest_accounts_window_get_account_view (ModestAccountsWindow *self)
{
}
}
+void
+modest_accounts_window_pre_create (void)
+{
+ static gboolean pre_created = FALSE;
+ if (!pre_created) {
+ pre_created = TRUE;
+ pre_created_accounts_window = GTK_WIDGET (modest_accounts_window_new_real ());
+ }
+}
*/
ModestAccountView *modest_accounts_window_get_account_view (ModestAccountsWindow *self);
+/**
+ * modest_accounts_window_pre_create:
+ *
+ * Creates an instance of #ModestAccountsWindow that will be used in the next call
+ * to modest_accounts_window_new (). Should be called in the initialisation process
+ *
+ */
+void modest_accounts_window_pre_create (void);
+
G_END_DECLS
#endif
static EBookView * book_view = NULL;
static GSList *get_recipients_for_given_contact (EContact * contact, gboolean *canceled);
-static void commit_contact(EContact * contact, gboolean is_new);
static gchar *get_email_addr_from_user(const gchar * given_name, gboolean *canceled);
static gchar *ui_get_formatted_email_id(gchar * current_given_name,
gchar * current_sur_name, gchar * current_email_id);
static gboolean resolve_address (const gchar *address, GSList **resolved_addresses, GSList **contact_id, gboolean *canceled);
static gchar *unquote_string (const gchar *str);
-
-static void
-unref_gobject (GObject *obj)
-{
- if (obj)
- g_object_unref (obj);
-}
-
-
-static void
-get_book_view_cb (EBook *book, EBookStatus status, EBookView *bookview, gpointer data)
-{
- if (status != E_BOOK_ERROR_OK) {
- g_object_unref (book);
- book = NULL;
- return;
- }
- book_view = bookview;
-
- if (contact_model)
-#if MODEST_ABOOK_API < 4
- osso_abook_tree_model_set_book_view (OSSO_ABOOK_TREE_MODEL (contact_model),
- book_view);
-#else /* MODEST_ABOOK_API < 4 */
- osso_abook_list_store_set_book_view (OSSO_ABOOK_LIST_STORE (contact_model),
- book_view);
-#endif /* MODEST_ABOOK_API < 4 */
-
- e_book_view_start (book_view);
-}
-
-static void
-book_open_cb (EBook *view, EBookStatus status, gpointer data)
-{
- EBookQuery *query = NULL;
-
- if (status != E_BOOK_ERROR_OK) {
- g_object_unref (book);
- book = NULL;
- return;
- }
- query = e_book_query_any_field_contains ("");
- e_book_async_get_book_view (book, query, NULL, -1, get_book_view_cb, NULL);
- e_book_query_unref (query);
-}
-
-static gboolean
-open_addressbook ()
-{
- book = e_book_new_system_addressbook (NULL);
- if (!book)
- return FALSE;
-
- if (e_book_async_open (book, FALSE, book_open_cb, NULL) != E_BOOK_ERROR_OK)
- return FALSE;
-
- return TRUE; /* FIXME */
-}
-
-typedef struct _OpenAddressbookSyncInfo {
- gboolean retval;
- GMainLoop *mainloop;
-} OpenAddressbookSyncInfo;
-
-static void
-get_book_view_sync_cb (EBook *book, EBookStatus status, EBookView *bookview, gpointer data)
-{
- OpenAddressbookSyncInfo *info = (OpenAddressbookSyncInfo *) data;
-
- if (status != E_BOOK_ERROR_OK) {
- g_object_unref (book);
- book = NULL;
- info->retval = FALSE;
- g_main_loop_quit (info->mainloop);
- return;
- }
- book_view = bookview;
-
- if (contact_model)
-#if MODEST_ABOOK_API < 4
- osso_abook_tree_model_set_book_view (OSSO_ABOOK_TREE_MODEL (contact_model),
- book_view);
-#else /* MODEST_ABOOK_API < 4 */
- osso_abook_list_store_set_book_view (OSSO_ABOOK_LIST_STORE (contact_model),
- book_view);
-#endif /* MODEST_ABOOK_API < 4 */
-
- e_book_view_start (book_view);
- info->retval = TRUE;
- g_main_loop_quit (info->mainloop);
-}
-
-static void
-book_open_sync_cb (EBook *view, EBookStatus status, gpointer data)
-{
- EBookQuery *query = NULL;
- OpenAddressbookSyncInfo *info = (OpenAddressbookSyncInfo *) data;
-
- if (status != E_BOOK_ERROR_OK) {
- g_object_unref (book);
- book = NULL;
- info->retval = FALSE;
- g_main_loop_quit (info->mainloop);
- return;
- }
- query = e_book_query_any_field_contains ("");
- e_book_async_get_book_view (book, query, NULL, -1, get_book_view_sync_cb, info);
- e_book_query_unref (query);
-}
-
static gboolean
-open_addressbook_sync ()
+open_addressbook ()
{
- OpenAddressbookSyncInfo *info;
- gboolean retval;
-
- book = e_book_new_system_addressbook (NULL);
- if (!book)
- return FALSE;
-
- info = g_slice_new (OpenAddressbookSyncInfo);
- info->mainloop = g_main_loop_new (NULL, FALSE);
- info->retval = FALSE;
- if (e_book_async_open (book, FALSE, book_open_sync_cb, info) == E_BOOK_ERROR_OK) {
- GDK_THREADS_LEAVE ();
- g_main_loop_run (info->mainloop);
- GDK_THREADS_ENTER ();
- }
- retval = info->retval;
- g_main_loop_unref (info->mainloop);
- g_slice_free (OpenAddressbookSyncInfo, info);
- /* Make it launch a main loop */
- return e_book_open (book, FALSE, NULL);
+ OssoABookRoster *roster;
+ GError *error = NULL;
+ time_t init,end;
+
+ if (book && book_view)
+ return TRUE;
+
+ roster = osso_abook_aggregator_get_default (&error);
+ if (error)
+ goto error;
+
+ /* Wait until it's ready */
+ init = time (NULL);
+ osso_abook_waitable_run ((OssoABookWaitable *) roster,
+ g_main_context_default (),
+ &error);
+ end = time (NULL);
+ g_debug ("Opening addressbook lasted %ld seconds", (gint) end-init);
+
+ if (error)
+ goto error;
+
+ if (!osso_abook_waitable_is_ready ((OssoABookWaitable *) roster,
+ &error))
+ goto error;
+
+ book = osso_abook_roster_get_book (roster);
+ book_view = osso_abook_roster_get_book_view (roster);
+
+ return TRUE;
+ error:
+ g_warning ("error opening addressbook %s", error->message);
+ g_error_free (error);
+ return FALSE;
}
void
modest_address_book_select_addresses (ModestRecptEditor *recpt_editor,
GtkWindow *parent_window)
{
-#if MODEST_ABOOK_API < 4
- GtkWidget *contact_view = NULL;
- GtkWidget *contact_dialog;
- GtkWidget *toplevel;
-#else /* MODEST_ABOOK_API < 4 */
GtkWidget *contact_chooser = NULL;
-#endif /* MODEST_ABOOK_API < 4 */
-
GList *contacts_list = NULL;
GSList *email_addrs_per_contact = NULL;
gchar *econtact_id;
g_return_if_fail (MODEST_IS_RECPT_EDITOR (recpt_editor));
-#if MODEST_ABOOK_API < 4
- if (!open_addressbook ()) {
- if (contact_model) {
- g_object_unref (contact_model);
- contact_model = NULL;
- }
- return;
- }
- contact_model = osso_abook_contact_model_new ();
-
- contact_view = osso_abook_contact_selector_new_basic (contact_model);
- osso_abook_contact_selector_set_minimum_selection (OSSO_ABOOK_CONTACT_SELECTOR (contact_view), 1);
-
- contact_dialog = osso_abook_select_dialog_new (OSSO_ABOOK_TREE_VIEW (contact_view));
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (recpt_editor));
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (contact_dialog), GTK_WINDOW (toplevel));
-
- gtk_widget_show (contact_dialog);
-
- if (gtk_dialog_run (GTK_DIALOG (contact_dialog)) == GTK_RESPONSE_OK) {
- contacts_list =
- osso_abook_contact_selector_get_extended_selection (OSSO_ABOOK_CONTACT_SELECTOR
- (contact_view));
- }
-#else /* MODEST_ABOOK_API < 4 */
/* TODO: figure out how to make the contact chooser modal */
contact_chooser = osso_abook_contact_chooser_new_with_capabilities (parent_window,
_AB("addr_ti_dia_select_contacts"),
if (gtk_dialog_run (GTK_DIALOG (contact_chooser)) == GTK_RESPONSE_OK)
contacts_list = osso_abook_contact_chooser_get_selection (OSSO_ABOOK_CONTACT_CHOOSER (contact_chooser));
gtk_widget_destroy (contact_chooser);
-#endif
if (contacts_list) {
GList *node;
g_list_free (contacts_list);
}
-#if MODEST_ABOOK_API < 4
- if (contact_model) {
- g_object_unref (contact_model);
- contact_model = NULL;
- }
-
- gtk_widget_destroy (contact_dialog);
-#endif
-
if (focus_recpt_editor)
modest_recpt_editor_grab_focus (MODEST_RECPT_EDITOR (recpt_editor));
/*Launch the 'Add e-mail addr to contact' dialog if required */
if (email_not_present) {
-#if MODEST_ABOOK_API < 4
- display_name = osso_abook_contact_get_display_name(contact);
-#else
OssoABookContact *abook_contact;
abook_contact = osso_abook_contact_new_from_template (contact);
display_name = osso_abook_contact_get_display_name(abook_contact);
-#endif
emailid = get_email_addr_from_user(display_name, canceled);
if (emailid) {
- e_contact_set(contact, E_CONTACT_EMAIL_1, emailid);
- commit_contact(contact, FALSE);
+ e_contact_set(E_CONTACT (abook_contact), E_CONTACT_EMAIL_1, emailid);
+ osso_abook_contact_commit (abook_contact, FALSE, NULL, NULL);
}
-#if MODEST_ABOOK_API >= 4
g_object_unref (abook_contact);
-#endif
}
if (emailid) {
}
/**
- * This is a helper function to commit a EContact to Address_Book application.
- *
- * @param contact Contact of type #EContact
- * @return void
- */
-static void
-commit_contact(EContact * contact, gboolean is_new)
-{
- g_return_if_fail (contact);
- g_return_if_fail (book);
-
- if (!contact || !book)
- return;
-
-#if MODEST_ABOOK_API < 4
- osso_abook_contact_commit(contact, is_new, book);
-#else
- if (OSSO_ABOOK_IS_CONTACT (contact)) {
- osso_abook_contact_commit(OSSO_ABOOK_CONTACT(contact), is_new, book, NULL);
- } else {
- GError *err = NULL;
- if (is_new) {
- if (!e_book_add_contact (book, contact, &err)) {
- g_warning ("Failed to add contact: %s", err->message);
- g_error_free (err);
- }
- } else {
- if (!e_book_commit_contact (book, contact, &err)) {
- g_warning ("Failed to commit contact: %s", err->message);
- g_error_free (err);
- }
- }
- }
-#endif /* MODEST_ABOOK_API < 2 */
-}
-
-/**
* This is a helper function used to launch 'Add e-mail address to contact' dialog
* after showing appropriate notification, when there is no e-mail address defined
* for a selected contact.
g_slist_foreach (addresses, (GFunc) g_free, NULL);
g_slist_free (addresses);
}
- if (contacts) {
- g_list_foreach (contacts, (GFunc) g_object_unref, NULL);
+ if (contacts)
g_list_free (contacts);
- }
}
return result;
}
+static gboolean
+filter_by_name (OssoABookContactChooser *chooser,
+ OssoABookContact *contact,
+ gpointer user_data)
+{
+ const gchar *contact_name;
+ const gchar *name = (const gchar *) user_data;
+
+ contact_name = osso_abook_contact_get_name (contact);
+ /* contact_name includes both name and surname */
+ if (contact_name && name && strstr (contact_name, name))
+ return TRUE;
+ else
+ return FALSE;
+}
+
static GList *
select_contacts_for_name_dialog (const gchar *name)
{
- EBookQuery *full_name_book_query = NULL;
- EBookView *book_view = NULL;
+ GtkWidget *contact_view;
+ OssoABookContactChooser *contact_dialog;
GList *result = NULL;
gchar *unquoted;
- unquoted = unquote_string (name);
- full_name_book_query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_CONTAINS, unquoted);
- g_free (unquoted);
- e_book_get_book_view (book, full_name_book_query, NULL, -1, &book_view, NULL);
- e_book_query_unref (full_name_book_query);
+ contact_dialog = (OssoABookContactChooser *)
+ osso_abook_contact_chooser_new_with_capabilities (NULL,
+ _AB("addr_ti_dia_select_contacts"),
+ OSSO_ABOOK_CAPS_EMAIL,
+ OSSO_ABOOK_CONTACT_ORDER_NAME);
- if (book_view) {
- GtkWidget *contact_dialog = NULL;
-#if MODEST_ABOOK_API < 4
- GtkWidget *contact_view = NULL;
- osso_abook_tree_model_set_book_view (OSSO_ABOOK_TREE_MODEL (contact_model), book_view);
- e_book_view_start (book_view);
+ /* Enable multiselection */
+ osso_abook_contact_chooser_set_maximum_selection (contact_dialog, G_MAXUINT);
- contact_view = osso_abook_contact_selector_new_basic (contact_model);
- contact_dialog = osso_abook_select_dialog_new (OSSO_ABOOK_TREE_VIEW (contact_view));
+ /* Set up the filtering */
+ unquoted = unquote_string (name);
+ contact_view = osso_abook_contact_chooser_get_contact_view (contact_dialog);
+ osso_abook_contact_chooser_set_model (contact_dialog, contact_model);
+ osso_abook_contact_chooser_set_visible_func (contact_dialog, filter_by_name, unquoted, NULL);
- if (gtk_dialog_run (GTK_DIALOG (contact_dialog)) == GTK_RESPONSE_OK) {
- result = osso_abook_contact_view_get_selection (OSSO_ABOOK_CONTACT_VIEW (contact_view));
- }
- e_book_view_stop (book_view);
- g_object_unref (book_view);
- gtk_widget_destroy (contact_dialog);
-#else /* MODEST_ABOOK_API < 4 */
- osso_abook_list_store_set_book_view (OSSO_ABOOK_LIST_STORE (contact_model), book_view);
- e_book_view_start (book_view);
-
- /* TODO: figure out how to make the contact chooser modal */
- contact_dialog = osso_abook_contact_chooser_new_with_capabilities (NULL,
- _AB("addr_ti_dia_select_contacts"),
- OSSO_ABOOK_CAPS_EMAIL,
- OSSO_ABOOK_CONTACT_ORDER_NAME);
- /* Enable multiselection */
- osso_abook_contact_chooser_set_maximum_selection (OSSO_ABOOK_CONTACT_CHOOSER (contact_dialog),
- G_MAXUINT);
- osso_abook_contact_chooser_set_model (OSSO_ABOOK_CONTACT_CHOOSER (contact_dialog),
- contact_model);
-
- if (gtk_dialog_run (GTK_DIALOG (contact_dialog)) == GTK_RESPONSE_OK)
- result = osso_abook_contact_chooser_get_selection (OSSO_ABOOK_CONTACT_CHOOSER (contact_dialog));
- e_book_view_stop (book_view);
- g_object_unref (book_view);
- gtk_widget_destroy (contact_dialog);
-#endif /* MODEST_ABOOK_API < 4 */
- }
+ if (gtk_dialog_run (GTK_DIALOG (contact_dialog)) == GTK_RESPONSE_OK)
+ result = osso_abook_contact_chooser_get_selection (contact_dialog);
+
+ g_free (unquoted);
return result;
}
*canceled = FALSE;
info = g_slice_new0 (CheckNamesInfo);
show_check_names_banner (info);
-
- contact_model = osso_abook_contact_model_new ();
- if (!open_addressbook_sync ()) {
+
+ contact_model = osso_abook_contact_model_get_default ();
+ if (!open_addressbook ()) {
hide_check_names_banner (info);
if (contact_model) {
g_object_unref (contact_model);
}
}
- g_list_foreach (resolved_contacts, (GFunc)unref_gobject, NULL);
g_list_free (resolved_contacts);
clean_check_names_banner (info);
gboolean
modest_address_book_has_address (const gchar *address)
{
- EBookQuery *query;
GList *contacts = NULL;
GError *err = NULL;
gchar *email;
gboolean result;
+ OssoABookAggregator *roster;
g_return_val_if_fail (address, FALSE);
-
+
if (!book) {
if (!open_addressbook ()) {
g_return_val_if_reached (FALSE);
}
}
-
g_return_val_if_fail (book, FALSE);
email = modest_text_utils_get_email_address (address);
-
- query = e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_IS, email);
- if (!e_book_get_contacts (book, query, &contacts, &err)) {
- g_printerr ("modest: failed to get contacts: %s",
- err ? err->message : "<unknown>");
+
+ roster = (OssoABookAggregator *) osso_abook_aggregator_get_default (NULL);
+ contacts = osso_abook_aggregator_find_contacts_for_email_address (roster, email);
+ if (!contacts) {
if (err)
g_error_free (err);
g_free (email);
- e_book_query_unref (query);
return FALSE;
}
- e_book_query_unref (query);
- result = (contacts != NULL);
if (contacts) {
- g_list_foreach (contacts, (GFunc)unref_gobject, NULL);
g_list_free (contacts);
+ result = TRUE;
}
-
+
g_free (email);
return result;
else
return NULL;
}
+
+void
+modest_address_book_init (void)
+{
+ open_addressbook ();
+}
modest_country_picker_new (HildonSizeType size,
HildonButtonArrangement arrangement)
{
- return g_object_new (MODEST_TYPE_COUNTRY_PICKER,
- "arrangement", arrangement,
- "size", size,
- NULL);
+ ModestCountryPicker *picker = g_object_new (MODEST_TYPE_COUNTRY_PICKER,
+ "arrangement", arrangement,
+ "size", size,
+ NULL);
+
+ /* For theming purpouses. Widget name must end in Button-finger */
+ gtk_widget_set_name ((GtkWidget *) picker, "ModestCountryPickerButton-finger");
+
+ return picker;
}
/**
#include "modest-account-mgr.h"
#include "modest-secureauth-picker.h"
#include "widgets/modest-validating-entry.h"
-#include "modest-retrieve-picker.h"
-#include "modest-limit-retrieve-picker.h"
#include "modest-text-utils.h"
#include "modest-account-mgr.h"
#include "modest-account-mgr-helpers.h" /* For modest_account_mgr_get_account_data(). */
#define PORT_MIN 1
#define PORT_MAX 65535
+#define RESPONSE_DELETE_DUMMY 1
+#define RESPONSE_SIGNATURE_DUMMY 2
+
static void modest_account_settings_dialog_init (gpointer g, gpointer iface_data);
G_DEFINE_TYPE_EXTENDED (ModestDefaultAccountSettingsDialog,
GtkWidget *page_account_details;
GtkWidget *entry_account_title;
- GtkWidget *retrieve_picker;
- GtkWidget *limit_retrieve_picker;
GtkWidget *checkbox_leave_messages;
GtkWidget *page_user_details;
GtkWidget *entry_user_username;
GtkWidget *entry_user_password;
GtkWidget *entry_user_email;
-/* GtkWidget *entry_incoming_port; */
GtkWidget *button_signature;
GtkWidget *button_delete;
on_entry_max, self);
hbox = gtk_hbox_new (TRUE, 0);
- /* The retrieve picker: */
- priv->retrieve_picker = GTK_WIDGET (modest_retrieve_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL));
- modest_maemo_utils_set_vbutton_layout (title_sizegroup,
- _("mcen_fi_advsetup_retrievetype"), priv->retrieve_picker);
-
- gtk_widget_show (priv->retrieve_picker);
- connect_for_modified (self, priv->retrieve_picker);
- gtk_box_pack_start (GTK_BOX (hbox), priv->retrieve_picker, TRUE, TRUE, 0);
-
- /* The limit-retrieve picker: */
- priv->limit_retrieve_picker = GTK_WIDGET (modest_limit_retrieve_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL));
- modest_maemo_utils_set_vbutton_layout (value_sizegroup,
- _("mcen_fi_advsetup_limit_retrieve"),
- priv->limit_retrieve_picker);
- gtk_widget_show (priv->limit_retrieve_picker);
- connect_for_modified (self, priv->limit_retrieve_picker);
- gtk_box_pack_start (GTK_BOX (hbox), priv->limit_retrieve_picker, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
/* The leave-messages widgets: */
if(!priv->checkbox_leave_messages) {
static void
-on_button_signature (GtkButton *button, gpointer user_data)
+signature_button_clicked (ModestDefaultAccountSettingsDialog *self)
{
- ModestDefaultAccountSettingsDialog *self;
gint response;
ModestDefaultAccountSettingsDialogPrivate *priv;
- self = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG (user_data);
priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
/* Create the window, if necessary: */
if (!(priv->signature_dialog)) {
priv->signature_dialog = GTK_WIDGET (modest_signature_editor_dialog_new ());
-
+
gboolean use_signature = modest_account_settings_get_use_signature (priv->settings);
const gchar *signature = modest_account_settings_get_signature(priv->settings);
gchar* account_title = get_entered_account_title (self);
}
}
-static void
-on_button_delete (GtkButton *button, gpointer user_data)
+static gboolean
+delete_button_clicked (ModestDefaultAccountSettingsDialog *self)
{
- ModestDefaultAccountSettingsDialog *self;
ModestDefaultAccountSettingsDialogPrivate *priv;
gchar *account_title;
gboolean removed;
- self = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG (user_data);
priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
if (priv->modified)
(const gchar *) account_title);
g_free (account_title);
- /* Close window */
- if (removed)
- gtk_widget_destroy (GTK_WIDGET (self));
+ return removed;
}
static GtkWidget*
/* Delete button: */
if (!priv->button_delete)
- priv->button_delete = gtk_button_new_with_label (_HL("wdgt_bd_delete"));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->action_area), priv->button_delete,
- FALSE, FALSE, 0);
+ priv->button_delete = gtk_dialog_add_button (GTK_DIALOG (self),
+ _HL("wdgt_bd_delete"),
+ RESPONSE_DELETE_DUMMY);
/* Signature button: */
if (!priv->button_signature)
- priv->button_signature = gtk_button_new_with_label (_("mcen_bd_email_signature"));
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->action_area), priv->button_signature,
- FALSE, FALSE, 0);
+ priv->button_signature = gtk_dialog_add_button (GTK_DIALOG (self),
+ _("mcen_bd_email_signature"),
+ RESPONSE_SIGNATURE_DUMMY);
gtk_widget_show (priv->button_signature);
g_object_unref (title_sizegroup);
g_object_unref (value_sizegroup);
-
- g_signal_connect (G_OBJECT (priv->button_signature), "clicked",
- G_CALLBACK (on_button_signature), self);
-
- g_signal_connect (G_OBJECT (priv->button_delete), "clicked",
- G_CALLBACK (on_button_delete), self);
-
+
gtk_widget_show (GTK_WIDGET (box));
return GTK_WIDGET (box);
g_free (incomingserver_title);
}
-static GtkWidget*
-create_page_incoming (ModestDefaultAccountSettingsDialog *self)
+/* The size groups passed as arguments are only used by the security settings */
+static GtkWidget*
+create_page_incoming (ModestDefaultAccountSettingsDialog *self,
+ GtkSizeGroup *security_title_sizegroup,
+ GtkSizeGroup *security_value_sizegroup)
{
ModestDefaultAccountSettingsDialogPrivate *priv;
GtkWidget *box;
- GtkSizeGroup *title_sizegroup;
- GtkSizeGroup *value_sizegroup;
priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
- box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
- /* Create a size group to be used by all captions.
- * Note that HildonCaption does not create a default size group if we do not specify one.
- * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
- title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-
+ box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
+
/* The incoming server widgets: */
if(!priv->entry_incomingserver)
priv->entry_incomingserver = hildon_entry_new (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH);
if (priv->caption_incoming)
gtk_widget_destroy (priv->caption_incoming);
-
+
/* The caption title will be updated in update_incoming_server_title().
* so this default text will never be seen: */
/* (Note: Changing the title seems pointless. murrayc) */
- priv->caption_incoming = create_captioned (self, title_sizegroup, value_sizegroup,
+ priv->caption_incoming = create_captioned (self, security_title_sizegroup, security_value_sizegroup,
"Incoming Server", FALSE, priv->entry_incomingserver);
gtk_widget_show (priv->entry_incomingserver);
connect_for_modified (self, priv->entry_incomingserver);
gtk_widget_show (priv->caption_incoming);
/* Incoming security widgets */
- priv->incoming_security =
+ priv->incoming_security =
modest_maemo_security_options_view_new (MODEST_SECURITY_OPTIONS_INCOMING,
- TRUE, title_sizegroup, value_sizegroup);
- gtk_box_pack_start (GTK_BOX (box), priv->incoming_security,
+ TRUE, security_title_sizegroup,
+ security_value_sizegroup);
+ gtk_box_pack_start (GTK_BOX (box), priv->incoming_security,
FALSE, FALSE, 0);
gtk_widget_show (priv->incoming_security);
-
- g_object_unref (title_sizegroup);
- g_object_unref (value_sizegroup);
gtk_widget_show (GTK_WIDGET (box));
-
+
return GTK_WIDGET (box);
}
!missing);
}
-static GtkWidget*
-create_page_outgoing (ModestDefaultAccountSettingsDialog *self)
+static GtkWidget*
+create_page_outgoing (ModestDefaultAccountSettingsDialog *self,
+ GtkSizeGroup *security_title_sizegroup,
+ GtkSizeGroup *security_value_sizegroup)
{
ModestDefaultAccountSettingsDialogPrivate *priv;
gchar *smtp_caption_label;
GtkWidget *box = gtk_vbox_new (FALSE, MODEST_MARGIN_NONE);
priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
-
- /* Create a size group to be used by all captions.
- * Note that HildonCaption does not create a default size group if we do not specify one.
- * We use GTK_SIZE_GROUP_HORIZONTAL, so that the widths are the same. */
- GtkSizeGroup *title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- GtkSizeGroup *value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
/* The outgoing server widgets: */
if (!priv->entry_outgoingserver)
/* Auto-capitalization is the default, so let's turn it off: */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (priv->entry_outgoingserver), HILDON_GTK_INPUT_MODE_FULL);
smtp_caption_label = g_strconcat (_("mcen_li_emailsetup_smtp"), "\n<small>(SMTP)</small>", NULL);
- GtkWidget *caption = create_captioned (self, title_sizegroup, value_sizegroup,
+ GtkWidget *caption = create_captioned (self, security_title_sizegroup, security_value_sizegroup,
smtp_caption_label, TRUE, priv->entry_outgoingserver);
g_free (smtp_caption_label);
gtk_widget_show (priv->entry_outgoingserver);
/* Outgoing security widgets */
priv->outgoing_security =
modest_maemo_security_options_view_new (MODEST_SECURITY_OPTIONS_OUTGOING,
- TRUE, title_sizegroup, value_sizegroup);
+ TRUE, security_title_sizegroup,
+ security_value_sizegroup);
gtk_box_pack_start (GTK_BOX (box), priv->outgoing_security,
FALSE, FALSE, 0);
gtk_widget_show (priv->outgoing_security);
enable_widget_for_checkbutton (priv->button_outgoing_smtp_servers,
GTK_BUTTON (priv->checkbox_outgoing_smtp_specific));
- g_object_unref (title_sizegroup);
- g_object_unref (value_sizegroup);
-
g_signal_connect (G_OBJECT (priv->button_outgoing_smtp_servers), "clicked",
G_CALLBACK (on_button_outgoing_smtp_servers), self);
gboolean prevent_response = FALSE, sec_changed;
ModestSecurityOptionsView *incoming_sec, *outgoing_sec;
+ /* Dummy and delete buttons have a response id because they're
+ added with gtk_dialog_add_button in order to get the proper
+ theme */
+ if (response_id == RESPONSE_SIGNATURE_DUMMY) {
+ signature_button_clicked (self);
+ g_signal_stop_emission_by_name (wizard_dialog, "response");
+ return;
+ }
+
+ if (response_id == RESPONSE_DELETE_DUMMY) {
+ if (!delete_button_clicked (self))
+ g_signal_stop_emission_by_name (wizard_dialog, "response");
+ return;
+ }
+
priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE (self);
enable_buttons (self);
}
if (prevent_response) {
- /* This is a nasty hack. murrayc. */
/* Don't let the dialog close */
g_signal_stop_emission_by_name (wizard_dialog, "response");
return;
GtkWidget *pannable;
GtkWidget *separator;
GtkWidget *align;
+ GtkSizeGroup *sec_title_sizegroup, *sec_value_sizegroup;
priv = MODEST_DEFAULT_ACCOUNT_SETTINGS_DIALOG_GET_PRIVATE(self);
priv->account_manager = modest_runtime_get_account_mgr ();
g_assert (priv->account_manager);
g_object_ref (priv->account_manager);
-
+
priv->protocol_authentication_incoming = MODEST_PROTOCOLS_AUTH_PASSWORD;
- /* Create the common pages,
- */
+ /* Create the common pages */
priv->page_account_details = create_page_account_details (self);
priv->page_user_details = create_page_user_details (self);
- priv->page_incoming = create_page_incoming (self);
- priv->page_outgoing = create_page_outgoing (self);
-
+
+ /* Create size groups for security settings */
+ sec_title_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ sec_value_sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+
+ /* Create incoming and outgoing "pages" */
+ priv->page_incoming = create_page_incoming (self, sec_title_sizegroup, sec_value_sizegroup);
+ priv->page_outgoing = create_page_outgoing (self, sec_title_sizegroup, sec_value_sizegroup);
+ g_object_unref (sec_title_sizegroup);
+ g_object_unref (sec_value_sizegroup);
+
/* Add the notebook pages: */
gtk_box_pack_start (GTK_BOX (priv->main_container),
priv->page_account_details,
null_means_empty (modest_account_settings_get_fullname (settings)));
gtk_entry_set_text( GTK_ENTRY (priv->entry_user_email),
null_means_empty (modest_account_settings_get_email_address (settings)));
- modest_limit_retrieve_picker_set_active_limit_retrieve (
- MODEST_LIMIT_RETRIEVE_PICKER (priv->limit_retrieve_picker),
- modest_account_settings_get_retrieve_limit (settings));
hildon_check_button_set_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages),
modest_account_settings_get_leave_messages_on_server (settings));
gchar *proto_name, *title;
ModestProtocolType incoming_protocol;
- modest_retrieve_picker_fill (MODEST_RETRIEVE_PICKER (priv->retrieve_picker), modest_server_account_settings_get_protocol (incoming_account));
- modest_retrieve_picker_set_active_retrieve_conf (MODEST_RETRIEVE_PICKER (priv->retrieve_picker),
- modest_account_settings_get_retrieve_type (settings));
-
if (!modest_protocol_registry_protocol_type_has_leave_on_server (protocol_registry,
modest_server_account_settings_get_protocol (incoming_account))) {
gtk_widget_hide (priv->checkbox_leave_messages);
const gchar* emailaddress;
ModestServerAccountSettings *store_settings;
ModestServerAccountSettings *transport_settings;
- ModestAccountRetrieveType retrieve_type;
- gint retrieve_limit;
gboolean leave_on_server;
const gchar* hostname;
const gchar* username;
modest_account_settings_set_use_signature (priv->settings, use_signature);
modest_account_settings_set_signature (priv->settings, signature);
}
-
- retrieve_type = modest_retrieve_picker_get_active_retrieve_conf (
- MODEST_RETRIEVE_PICKER (priv->retrieve_picker));
- modest_account_settings_set_retrieve_type (priv->settings, retrieve_type);
-
- retrieve_limit = modest_limit_retrieve_picker_get_active_limit_retrieve (
- MODEST_LIMIT_RETRIEVE_PICKER (priv->limit_retrieve_picker));
- modest_account_settings_set_retrieve_limit (priv->settings, retrieve_limit);
-
+
leave_on_server = hildon_check_button_get_active (HILDON_CHECK_BUTTON (priv->checkbox_leave_messages));
modest_account_settings_set_leave_messages_on_server (priv->settings, leave_on_server);
const gchar *label)
{
gint index;
+
/* Append page and set attributes */
index = gtk_notebook_append_page (notebook, page, gtk_label_new (label));
gtk_container_child_set (GTK_CONTAINER (notebook), page,
"tab-expand", TRUE, "tab-fill", TRUE,
NULL);
+
+ /* Give focus to page and show it */
+ gtk_container_set_focus_child (GTK_CONTAINER (notebook), page);
gtk_widget_show (page);
}
G_CALLBACK (edit_mode_changed), (gpointer) self);
action_area_box = hildon_tree_view_get_action_area_box (GTK_TREE_VIEW (priv->folder_view));
- priv->new_message_button = hildon_button_new (0, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
+ priv->new_message_button = hildon_button_new (MODEST_EDITABLE_SIZE, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
hildon_button_set_title (HILDON_BUTTON (priv->new_message_button), _("mcen_ti_new_message"));
new_message_pixbuf = modest_platform_get_icon ("general_add", MODEST_ICON_SIZE_BIG);
G_CALLBACK (edit_mode_changed), (gpointer) self);
action_area_box = hildon_tree_view_get_action_area_box (GTK_TREE_VIEW (priv->header_view));
- priv->new_message_button = hildon_button_new (0, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
+ priv->new_message_button = hildon_button_new (MODEST_EDITABLE_SIZE, HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
hildon_button_set_title (HILDON_BUTTON (priv->new_message_button), _("mcen_ti_new_message"));
new_message_pixbuf = modest_platform_get_icon ("general_add", MODEST_ICON_SIZE_BIG);
static GtkWidget* create_updating_page (ModestHildon2GlobalSettingsDialog *self);
-static gboolean on_range_error (ModestNumberEditor *editor,
- ModestNumberEditorErrorType type,
- gpointer user_data);
-
-static void on_size_notify (ModestNumberEditor *editor,
- GParamSpec *arg1,
- gpointer user_data);
-
static void on_auto_update_clicked (GtkButton *button,
gpointer user_data);
static void update_sensitive (ModestGlobalSettingsDialog *dialog);
static GtkWidget*
create_updating_page (ModestHildon2GlobalSettingsDialog *self)
{
- GtkWidget *vbox, *vbox_update, *vbox_limit, *label, *hbox;
- GtkWidget *align;
+ GtkWidget *vbox;
GtkSizeGroup *title_size_group;
GtkSizeGroup *value_size_group;
ModestGlobalSettingsDialogPrivate *ppriv;
- GtkWidget *pannable;
+ GtkWidget *pannable, *separator;
ModestHildon2GlobalSettingsDialogPrivate *priv;
priv = MODEST_HILDON2_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
ppriv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (self);
vbox = gtk_vbox_new (FALSE, MODEST_MARGIN_HALF);
- vbox_update = gtk_vbox_new (FALSE, 0);
title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- /* Auto update */
- ppriv->auto_update = hildon_check_button_new (MODEST_EDITABLE_SIZE);
- gtk_button_set_label (GTK_BUTTON (ppriv->auto_update), _("mcen_fi_options_autoupdate"));
- gtk_button_set_alignment (GTK_BUTTON (ppriv->auto_update), 0.0, 0.5);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->auto_update, FALSE, FALSE, MODEST_MARGIN_HALF);
- g_signal_connect (ppriv->auto_update, "clicked", G_CALLBACK (on_auto_update_clicked), self);
-
- /* Connected via */
-
- /* Note: This ModestPairList* must exist for as long as the picker
- * that uses it, because the ModestSelectorPicker uses the ID opaquely,
- * so it can't know how to manage its memory. */
- ppriv->connect_via_list = _modest_global_settings_dialog_get_connected_via ();
- ppriv->connect_via = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- ppriv->connect_via_list, g_int_equal);
- modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_fi_options_connectiontype"),
- ppriv->connect_via);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->connect_via, FALSE, FALSE, 0);
-
- /* Update interval */
-
- /* Note: This ModestPairList* must exist for as long as the picker
- * that uses it, because the ModestSelectorPicker uses the ID opaquely,
- * so it can't know how to manage its memory. */
- ppriv->update_interval_list = _modest_global_settings_dialog_get_update_interval ();
- ppriv->update_interval = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- ppriv->update_interval_list, g_int_equal);
- modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_fi_options_updateinterval"),
- ppriv->update_interval);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->update_interval, FALSE, FALSE, 0);
-
/* Default account selector */
ppriv->accounts_list = get_accounts_list ();
ppriv->default_account_selector = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
ppriv->initial_state.default_account = default_account;
}
}
- modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_ti_default_account"),
+ modest_maemo_utils_set_vbutton_layout (title_size_group,
+ _("mcen_ti_default_account"),
ppriv->default_account_selector);
- gtk_box_pack_start (GTK_BOX (vbox_update), ppriv->default_account_selector,
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->default_account_selector,
FALSE, FALSE, 0);
- /* Add to vbox */
- gtk_box_pack_start (GTK_BOX (vbox), vbox_update, FALSE, FALSE, 0);
+ /* Message format */
+ /* Note: This ModestPairList* must exist for as long as the picker
+ * that uses it, because the ModestSelectorPicker uses the ID opaquely,
+ * so it can't know how to manage its memory. */
+ ppriv->msg_format_list = _modest_global_settings_dialog_get_msg_formats ();
+ ppriv->msg_format = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ ppriv->msg_format_list, g_int_equal);
+ modest_maemo_utils_set_vbutton_layout (title_size_group,
+ _("mcen_fi_options_messageformat"),
+ ppriv->msg_format);
- g_object_unref (title_size_group);
- g_object_unref (value_size_group);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->msg_format, FALSE, FALSE, 0);
- /* Limits */
- vbox_limit = gtk_vbox_new (FALSE, 0);
- title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- value_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ /* Separator label */
+ separator = gtk_label_new (_("mcen_ti_updating"));
+ gtk_label_set_justify ((GtkLabel *) separator, GTK_JUSTIFY_CENTER);
+ gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, MODEST_MARGIN_DEFAULT);
- /* Size limit */
- ppriv->size_limit = modest_number_editor_new (MSG_SIZE_MIN_VAL, MSG_SIZE_MAX_VAL);
- modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->size_limit), MSG_SIZE_DEF_VAL);
- g_signal_connect (ppriv->size_limit, "range_error", G_CALLBACK (on_range_error), self);
- g_signal_connect (ppriv->size_limit, "notify", G_CALLBACK (on_size_notify), self);
- label = gtk_label_new (_("mcen_fi_advsetup_sizelimit"));
- align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
- gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, MODEST_MARGIN_DOUBLE, MODEST_MARGIN_TRIPLE);
- hbox = gtk_hbox_new (FALSE, MODEST_MARGIN_HALF);
- gtk_container_add (GTK_CONTAINER (align), label);
- gtk_box_pack_start (GTK_BOX (hbox), align, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), ppriv->size_limit, TRUE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (vbox_limit), hbox, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), vbox_limit, FALSE, FALSE, 0);
- gtk_widget_show_all (vbox_limit);
+ /* Auto update */
+ ppriv->auto_update = hildon_check_button_new (MODEST_EDITABLE_SIZE);
+ gtk_button_set_label (GTK_BUTTON (ppriv->auto_update), _("mcen_fi_options_autoupdate"));
+ gtk_button_set_alignment (GTK_BUTTON (ppriv->auto_update), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->auto_update, FALSE, FALSE, 0);
+ g_signal_connect (ppriv->auto_update, "clicked", G_CALLBACK (on_auto_update_clicked), self);
+
+ /* Connected via */
/* Note: This ModestPairList* must exist for as long as the picker
* that uses it, because the ModestSelectorPicker uses the ID opaquely,
* so it can't know how to manage its memory. */
- ppriv->msg_format_list = _modest_global_settings_dialog_get_msg_formats ();
- ppriv->msg_format = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL,
- ppriv->msg_format_list, g_int_equal);
+ ppriv->connect_via_list = _modest_global_settings_dialog_get_connected_via ();
+ ppriv->connect_via = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ ppriv->connect_via_list, g_int_equal);
modest_maemo_utils_set_vbutton_layout (title_size_group,
- _("mcen_fi_options_messageformat"),
- ppriv->msg_format);
+ _("mcen_fi_options_connectiontype"),
+ ppriv->connect_via);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->connect_via, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), ppriv->msg_format, FALSE, FALSE, 0);
+ /* Update interval */
+
+ /* Note: This ModestPairList* must exist for as long as the picker
+ * that uses it, because the ModestSelectorPicker uses the ID opaquely,
+ * so it can't know how to manage its memory. */
+ ppriv->update_interval_list = _modest_global_settings_dialog_get_update_interval ();
+ ppriv->update_interval = modest_selector_picker_new (MODEST_EDITABLE_SIZE,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ ppriv->update_interval_list, g_int_equal);
+ modest_maemo_utils_set_vbutton_layout (title_size_group,
+ _("mcen_fi_options_updateinterval"),
+ ppriv->update_interval);
+ gtk_box_pack_start (GTK_BOX (vbox), ppriv->update_interval, FALSE, FALSE, 0);
pannable = g_object_new (HILDON_TYPE_PANNABLE_AREA, "initial-hint", TRUE, NULL);
g_return_if_fail (MODEST_IS_GLOBAL_SETTINGS_DIALOG (user_data));
update_sensitive ((ModestGlobalSettingsDialog *) user_data);
}
-static gboolean
-on_range_error (ModestNumberEditor *editor,
- ModestNumberEditorErrorType type,
- gpointer user_data)
-{
- gchar *msg;
- gint new_val;
-
- switch (type) {
- case MODEST_NUMBER_EDITOR_ERROR_MAXIMUM_VALUE_EXCEED:
- msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_maximum_value"), MSG_SIZE_MAX_VAL);
- new_val = MSG_SIZE_MAX_VAL;
- break;
- case MODEST_NUMBER_EDITOR_ERROR_MINIMUM_VALUE_EXCEED:
- msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_minimum_value"), MSG_SIZE_MIN_VAL);
- new_val = MSG_SIZE_MIN_VAL;
- break;
- case MODEST_NUMBER_EDITOR_ERROR_ERRONEOUS_VALUE:
- msg = g_strdup_printf (dgettext("hildon-libs", "ckct_ib_set_a_value_within_range"),
- MSG_SIZE_MIN_VAL,
- MSG_SIZE_MAX_VAL);
- /* FIXME: use the previous */
- new_val = MSG_SIZE_DEF_VAL;
- break;
- default:
- g_return_val_if_reached (FALSE);
- }
-
- /* Restore value */
- modest_number_editor_set_value (editor, new_val);
-
- /* Show error */
- hildon_banner_show_information (GTK_WIDGET (user_data), NULL, msg);
-
- /* Free */
- g_free (msg);
-
- return TRUE;
-}
-
-static void
-on_size_notify (ModestNumberEditor *editor,
- GParamSpec *arg1,
- gpointer user_data)
-{
- ModestHildon2GlobalSettingsDialog *dialog = MODEST_HILDON2_GLOBAL_SETTINGS_DIALOG (user_data);
- gint value = modest_number_editor_get_value (editor);
-
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, value > 0);
-}
static ModestConnectedVia
current_connection (void)
{
ModestConf *conf;
gboolean checked;
- gint combo_id, value;
+ gint combo_id;
GError *error = NULL;
ModestGlobalSettingsDialogPrivate *ppriv;
(gpointer) &combo_id);
ppriv->initial_state.connect_via = combo_id;
- /* Emit toggled to update the visibility of connect_by caption */
- gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (ppriv->auto_update));
-
/* Update interval */
combo_id = modest_conf_get_int (conf, MODEST_CONF_UPDATE_INTERVAL, &error);
if (error) {
(gpointer) &combo_id);
ppriv->initial_state.update_interval = combo_id;
- /* Size limit */
- value = modest_conf_get_int (conf, MODEST_CONF_MSG_SIZE_LIMIT, &error);
- if (error) {
- g_error_free (error);
- error = NULL;
- value = 1000;
- }
- /* It's better to do this in the subclasses, but it's just one
- line, so we'll leave it here for the moment */
- modest_number_editor_set_value (MODEST_NUMBER_EDITOR (ppriv->size_limit), value);
- ppriv->initial_state.size_limit = value;
-
/* Play sound */
checked = modest_conf_get_bool (conf, MODEST_CONF_PLAY_SOUND_MSG_ARRIVE, &error);
if (error) {
error = NULL;
checked = FALSE;
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ppriv->play_sound), checked);
ppriv->initial_state.play_sound = checked;
/* Msg format */
static ModestWindow *modest_hildon2_window_mgr_show_initial_window (ModestWindowMgr *self);
static ModestWindow *modest_hildon2_window_mgr_get_current_top (ModestWindowMgr *self);
static gboolean modest_hildon2_window_mgr_screen_is_on (ModestWindowMgr *self);
+static void modest_hildon2_window_mgr_create_caches (ModestWindowMgr *self);
static void osso_display_event_cb (osso_display_state_t state,
gpointer data);
static void on_account_removed (TnyAccountStore *acc_store,
mgr_class->show_initial_window = modest_hildon2_window_mgr_show_initial_window;
mgr_class->get_current_top = modest_hildon2_window_mgr_get_current_top;
mgr_class->screen_is_on = modest_hildon2_window_mgr_screen_is_on;
+ mgr_class->create_caches = modest_hildon2_window_mgr_create_caches;
g_type_class_add_private (gobject_class, sizeof(ModestHildon2WindowMgrPrivate));
return (priv->display_state == OSSO_DISPLAY_ON) ? TRUE : FALSE;
}
+static void
+modest_hildon2_window_mgr_create_caches (ModestWindowMgr *self)
+{
+ g_return_if_fail (MODEST_IS_HILDON2_WINDOW_MGR (self));
+
+ modest_accounts_window_pre_create ();
+
+ MODEST_WINDOW_MGR_CLASS(parent_class)->create_caches (self);
+
+}
+
static void
osso_display_event_cb (osso_display_state_t state,
gpointer data)
+++ /dev/null
-/* Copyright (c) 2007, 2008, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "modest-limit-retrieve-picker.h"
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkcelllayout.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <glib/gi18n.h>
-
-#include <stdlib.h>
-#include <string.h> /* For memcpy() */
-
-/* Include config.h so that _() works: */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-G_DEFINE_TYPE (ModestLimitRetrievePicker, modest_limit_retrieve_picker, HILDON_TYPE_PICKER_BUTTON);
-
-#define MODEST_LIMIT_RETRIEVE_PICKER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_LIMIT_RETRIEVE_PICKER, ModestLimitRetrievePickerPrivate))
-
-typedef struct _ModestLimitRetrievePickerPrivate ModestLimitRetrievePickerPrivate;
-
-struct _ModestLimitRetrievePickerPrivate
-{
- GtkTreeModel *model;
-};
-
-static void
-modest_limit_retrieve_picker_finalize (GObject *object)
-{
- ModestLimitRetrievePickerPrivate *priv = MODEST_LIMIT_RETRIEVE_PICKER_GET_PRIVATE (object);
-
- g_object_unref (G_OBJECT (priv->model));
-
- G_OBJECT_CLASS (modest_limit_retrieve_picker_parent_class)->finalize (object);
-}
-
-static void
-modest_limit_retrieve_picker_class_init (ModestLimitRetrievePickerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (ModestLimitRetrievePickerPrivate));
-
- object_class->finalize = modest_limit_retrieve_picker_finalize;
-}
-
-enum MODEL_COLS {
- MODEL_COL_NAME = 0, /* a string */
- MODEL_COL_NUM = 1 /* an int */
-};
-
-static void modest_limit_retrieve_picker_fill (ModestLimitRetrievePicker *picker);
-
-static gchar *
-touch_selector_print_func (HildonTouchSelector *selector, gpointer userdata)
-{
- GtkTreeIter iter;
- if (hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &iter)) {
- GtkTreeModel *model;
- GValue value = {0,};
-
- model = hildon_touch_selector_get_model (HILDON_TOUCH_SELECTOR (selector), 0);
- gtk_tree_model_get_value (model, &iter, MODEL_COL_NAME, &value);
- return g_value_dup_string (&value);
- }
- return NULL;
-}
-
-static void
-modest_limit_retrieve_picker_init (ModestLimitRetrievePicker *self)
-{
- ModestLimitRetrievePickerPrivate *priv = MODEST_LIMIT_RETRIEVE_PICKER_GET_PRIVATE (self);
-
- priv->model = NULL;
-}
-
-ModestLimitRetrievePicker*
-modest_limit_retrieve_picker_new (HildonSizeType size,
- HildonButtonArrangement arrangement)
-{
- ModestLimitRetrievePicker *self;
- ModestLimitRetrievePickerPrivate *priv;
- GtkCellRenderer *renderer;
- GtkWidget *selector;
-
- self = g_object_new (MODEST_TYPE_LIMIT_RETRIEVE_PICKER,
- "arrangement", arrangement,
- "size", size,
- NULL);
- priv = MODEST_LIMIT_RETRIEVE_PICKER_GET_PRIVATE (self);
-
- /* Create a tree model,
- * with a string for the name, and an ID for the servertype.
- * This must match our MODEL_COLS enum constants.
- */
- priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
-
- selector = hildon_touch_selector_new ();
- hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector), GTK_TREE_MODEL (priv->model),
- renderer, "text", MODEL_COL_NAME, NULL);
-
- hildon_touch_selector_set_model (HILDON_TOUCH_SELECTOR (selector), 0, GTK_TREE_MODEL (priv->model));
- hildon_touch_selector_set_print_func (HILDON_TOUCH_SELECTOR (selector), (HildonTouchSelectorPrintFunc) touch_selector_print_func);
-
- hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector));
-
- modest_limit_retrieve_picker_fill (self);
-
- return self;
-}
-
-/* Fill the picker box with appropriate choices.
- * #picker: The picker box.
- * @protocol: IMAP or POP.
- */
-static void modest_limit_retrieve_picker_fill (ModestLimitRetrievePicker *picker)
-{
- ModestLimitRetrievePickerPrivate *priv = MODEST_LIMIT_RETRIEVE_PICKER_GET_PRIVATE (picker);
-
- /* Remove any existing rows: */
- GtkListStore *liststore = GTK_LIST_STORE (priv->model);
- gtk_list_store_clear (liststore);
-
- GtkTreeIter iter;
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_NUM, 0, MODEL_COL_NAME, _("mcen_fi_advsetup_retrieve_nolimit"), -1);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_NUM, 200, MODEL_COL_NAME, _("mcen_fi_advsetup_retrieve_200"), -1);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_NUM, 100, MODEL_COL_NAME, _("mcen_fi_advsetup_retrieve_100"), -1);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_NUM, 50, MODEL_COL_NAME, _("mcen_fi_advsetup_retrieve_50"), -1);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter, MODEL_COL_NUM, 20, MODEL_COL_NAME, _("mcen_fi_advsetup_retrieve_20"), -1);
-}
-
-/**
- * Returns the selected limit_retrieve,
- * or 0 if no limit_retrieve was selected.
- */
-gint
-modest_limit_retrieve_picker_get_active_limit_retrieve (ModestLimitRetrievePicker *picker)
-{
- GtkTreeIter active;
- gboolean found;
- GtkWidget *selector;
-
- selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (picker)));
- found = hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &active);
- if (found) {
- ModestLimitRetrievePickerPrivate *priv = MODEST_LIMIT_RETRIEVE_PICKER_GET_PRIVATE (picker);
-
- gint limit_retrieve = 0;
- gtk_tree_model_get (priv->model, &active, MODEL_COL_NUM, &limit_retrieve, -1);
- return limit_retrieve;
- }
-
- return 0; /* Failed. */
-}
-
-/* This allows us to pass more than one piece of data to the signal handler,
- * and get a result: */
-typedef struct
-{
- ModestLimitRetrievePicker* self;
- gint num;
- gboolean found;
-} ForEachData;
-
-static gboolean
-on_model_foreach_select_id(GtkTreeModel *model,
- GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
-{
- ForEachData *state = (ForEachData*)(user_data);
-
- gboolean result = FALSE;
-
- /* Select the item if it has the matching name: */
- gint num = 0;
- gtk_tree_model_get (model, iter, MODEL_COL_NUM, &num, -1);
- if(num == state->num) {
- GtkWidget *selector;
- selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (state->self)));
- hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, iter, TRUE);
- hildon_button_set_value (HILDON_BUTTON (state->self),
- hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector)));
-
- state->found = TRUE;
- return TRUE; /* Stop walking the tree. */
- }
-
- return result; /* Whether we keep walking the tree. */
-}
-
-/**
- * Selects the specified limit_retrieve,
- * or FALSE if no limit_retrieve was selected.
- */
-gboolean
-modest_limit_retrieve_picker_set_active_limit_retrieve (ModestLimitRetrievePicker *picker, gint limit_retrieve)
-{
- ModestLimitRetrievePickerPrivate *priv = MODEST_LIMIT_RETRIEVE_PICKER_GET_PRIVATE (picker);
-
- /* Create a state instance so we can send two items of data to the signal handler: */
- ForEachData *state = g_new0 (ForEachData, 1);
- state->self = picker;
- state->num = limit_retrieve;
- state->found = FALSE;
-
- /* Look at each item, and select the one with the correct ID: */
- gtk_tree_model_foreach (priv->model, &on_model_foreach_select_id, state);
-
- const gboolean result = state->found;
-
- /* Free the state instance: */
- g_free(state);
-
- return result;
-}
-
+++ /dev/null
-/* Copyright (c) 2007, 2008, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MODEST_LIMIT_RETRIEVE_PICKER
-#define _MODEST_LIMIT_RETRIEVE_PICKER
-
-#include <hildon/hildon-picker-button.h>
-
-G_BEGIN_DECLS
-
-#define MODEST_TYPE_LIMIT_RETRIEVE_PICKER modest_limit_retrieve_picker_get_type()
-
-#define MODEST_LIMIT_RETRIEVE_PICKER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MODEST_TYPE_LIMIT_RETRIEVE_PICKER, ModestLimitRetrievePicker))
-
-#define MODEST_LIMIT_RETRIEVE_PICKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MODEST_TYPE_LIMIT_RETRIEVE_PICKER, ModestLimitRetrievePickerClass))
-
-#define MODEST_IS_LIMIT_RETRIEVE_PICKER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MODEST_TYPE_LIMIT_RETRIEVE_PICKER))
-
-#define MODEST_IS_LIMIT_RETRIEVE_PICKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MODEST_TYPE_LIMIT_RETRIEVE_PICKER))
-
-#define MODEST_LIMIT_RETRIEVE_PICKER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MODEST_TYPE_LIMIT_RETRIEVE_PICKER, ModestLimitRetrievePickerClass))
-
-typedef struct {
- HildonPickerButton parent;
-} ModestLimitRetrievePicker;
-
-typedef struct {
- HildonPickerButtonClass parent_class;
-} ModestLimitRetrievePickerClass;
-
-GType modest_limit_retrieve_picker_get_type (void);
-
-ModestLimitRetrievePicker* modest_limit_retrieve_picker_new (HildonSizeType size,
- HildonButtonArrangement arrangement);
-
-gint modest_limit_retrieve_picker_get_active_limit_retrieve (ModestLimitRetrievePicker *picker);
-
-gboolean modest_limit_retrieve_picker_set_active_limit_retrieve (ModestLimitRetrievePicker *picker, gint limit_retrieve);
-
-
-G_END_DECLS
-
-#endif /* _MODEST_LIMIT_RETRIEVE_PICKER */
HILDON_BUTTON_ARRANGEMENT_HORIZONTAL));
modest_serversecurity_picker_fill (MODEST_SERVERSECURITY_PICKER (ppriv->security_view),
modest_protocol_registry_get_pop_type_id ());
- modest_maemo_utils_set_hbutton_layout (title_size_group,
+ modest_maemo_utils_set_hbutton_layout (title_size_group,
value_size_group,
_("mcen_li_emailsetup_secure_connection"),
ppriv->security_view);
- if (ppriv->full) {
- ppriv->port_view = GTK_WIDGET (modest_number_editor_new (PORT_MIN, PORT_MAX));
- entry_caption = modest_maemo_utils_create_captioned (title_size_group,
- value_size_group,
- _("mcen_fi_emailsetup_port"),
- FALSE,
- ppriv->port_view);
- }
-
ppriv->auth_view = hildon_check_button_new (MODEST_EDITABLE_SIZE);
gtk_button_set_label (GTK_BUTTON (ppriv->auth_view), _("mcen_li_emailsetup_secure_authentication"));
gtk_button_set_alignment (GTK_BUTTON (ppriv->auth_view), 0.0, 0.5);
- /* Track changes in UI */
+ /* Track changes in UI */
g_signal_connect (G_OBJECT (ppriv->security_view), "value-changed",
G_CALLBACK (on_security_changed), self);
- /* Pack into container */
- gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view,
- FALSE, FALSE, 0);
- if (ppriv->full)
- gtk_box_pack_start (GTK_BOX (self), entry_caption,
- FALSE, FALSE, MODEST_MARGIN_HALF);
- gtk_box_pack_start (GTK_BOX (self), ppriv->security_view,
- FALSE, FALSE, 0);
+ /* Pack into container & show */
+ gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, 0);
+ gtk_widget_show (ppriv->security_view);
+ gtk_widget_show (ppriv->auth_view);
- /* Show widgets */
if (ppriv->full) {
+ ppriv->port_view = GTK_WIDGET (modest_number_editor_new (PORT_MIN, PORT_MAX));
+ entry_caption = modest_maemo_utils_create_captioned (title_size_group,
+ value_size_group,
+ _("mcen_fi_emailsetup_port"),
+ FALSE,
+ ppriv->port_view);
+ /* Pack & show widgets */
+ gtk_box_pack_start (GTK_BOX (self), entry_caption, FALSE, FALSE, 0);
gtk_widget_show (ppriv->port_view);
gtk_widget_show (entry_caption);
}
- gtk_widget_show (ppriv->security_view);
- gtk_widget_show (ppriv->auth_view);
}
static void
modest_maemo_utils_get_osso_context (void)
{
if (!__osso_context)
- g_debug ("%s: __osso_context == NULL", __FUNCTION__);
+ __osso_context = osso_initialize(PACKAGE,PACKAGE_VERSION,
+ FALSE, NULL);
return __osso_context;
}
-void
-modest_maemo_utils_set_osso_context (osso_context_t *osso_context)
-{
- g_return_if_fail (osso_context);
- __osso_context = osso_context;
-}
-
static void
get_properties_cb (DBusMessage *message)
{
GtkWidget *brand_icon;
GtkWidget *brand_label;
+ GtkWidget *brand_container;
};
#define MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->brand_icon = gtk_image_new ();
gtk_misc_set_alignment (GTK_MISC (priv->brand_icon), 0.5, 0.5);
priv->brand_label = gtk_label_new (NULL);
+ hildon_helper_set_logical_font (priv->brand_label, "SmallSystemFont");
gtk_misc_set_alignment (GTK_MISC (priv->brand_label), 0.0, 0.5);
gtk_widget_set_no_show_all (priv->brand_icon, TRUE);
gtk_widget_set_no_show_all (priv->brand_label, TRUE);
gtk_box_pack_start (GTK_BOX (from_send_hbox), priv->send_button, FALSE, FALSE, 0);
branding_box = gtk_hbox_new (FALSE, MODEST_MARGIN_DEFAULT);
+ gtk_widget_show (branding_box);
+ gtk_box_pack_start (GTK_BOX (branding_box), priv->brand_label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (branding_box), priv->brand_icon, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (branding_box), priv->brand_label, TRUE, TRUE, 0);
+
+ priv->brand_container = gtk_alignment_new (0.0, 0.5, 0.0, 1.0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (priv->brand_container), 0, 0, MODEST_MARGIN_DOUBLE, 0);
+ gtk_container_add (GTK_CONTAINER (priv->brand_container), branding_box);
+ gtk_widget_set_no_show_all (priv->brand_container, TRUE);
gtk_box_pack_start (GTK_BOX (priv->header_box), from_send_hbox, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->header_box), priv->bcc_caption, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->header_box), subject_caption, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (priv->header_box), priv->attachments_caption, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (priv->header_box), branding_box, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->header_box), priv->brand_container, FALSE, FALSE, 0);
gtk_widget_set_no_show_all (priv->attachments_caption, TRUE);
init_wp_text_view_style ();
g_free (priv->last_search);
g_free (priv->references);
g_free (priv->in_reply_to);
- g_object_unref (priv->faces_model);
- g_object_unref (priv->sizes_model);
g_object_unref (priv->attachments);
g_object_unref (priv->images);
info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) {
size = info->size;
if (size > allowed_size) {
- modest_platform_information_banner (NULL, NULL,
- _FM("sfil_ib_opening_not_allowed"));
+ modest_platform_information_banner (NULL, NULL,
+ _("mail_ib_error_attachment_size"));
g_free (filename);
return 0;
}
}
}
-static void update_signature (ModestMsgEditWindow *self,
- const gchar *old_account,
- const gchar *new_account)
+static void
+update_signature (ModestMsgEditWindow *self,
+ const gchar *old_account,
+ const gchar *new_account)
{
ModestMsgEditWindowPrivate *priv;
gboolean has_old_signature, has_new_signature;
GtkTextIter iter;
- GtkTextIter match_start, match_end;
ModestAccountMgr *mgr;
gchar *signature;
- gchar *full_signature;
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
if (old_account) {
signature = modest_account_mgr_get_signature_from_recipient (mgr, old_account, &has_old_signature);
if (has_old_signature) {
- full_signature = g_strconcat ("\n--\n", signature, NULL);
- if (gtk_text_iter_forward_search (&iter, full_signature, 0, &match_start, &match_end, NULL)) {
+ GtkTextIter match_start, match_end;
+ /* We cannot use
+ MODEST_TEXT_UTILS_SIGNATURE_MARKER as it
+ seems that the search has some problems
+ with the blank space at the end */
+ if (gtk_text_iter_forward_search (&iter, "--",
+ GTK_TEXT_SEARCH_TEXT_ONLY,
+ &match_start, NULL, NULL)) {
+ gtk_text_buffer_get_end_iter (priv->text_buffer ,&match_end);
gtk_text_buffer_delete (priv->text_buffer, &match_start, &match_end);
iter = match_start;
} else if (gtk_text_iter_forward_search (&iter, _("mcen_ia_editor_original_message"), 0,
&match_start, &match_end, NULL)) {
iter = match_start;
}
- g_free (full_signature);
}
g_free (signature);
}
priv->last_from_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
signature = modest_account_mgr_get_signature_from_recipient (mgr, new_account, &has_new_signature);
if (has_new_signature) {
- full_signature = g_strconcat ("\n--\n", signature, NULL);
+ gchar *full_signature = g_strconcat (MODEST_TEXT_UTILS_SIGNATURE_MARKER, "\n",
+ signature, NULL);
gtk_text_buffer_insert (priv->text_buffer, &iter, full_signature, -1);
g_free (full_signature);
}
ModestAccountMgr *mgr;
const GdkPixbuf *new_icon = NULL;
gchar *new_label = NULL;
+ gboolean show = FALSE;
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
if (new_icon) {
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->brand_icon), (GdkPixbuf *) new_icon);
gtk_widget_show (priv->brand_icon);
+ show = TRUE;
} else {
gtk_widget_hide (priv->brand_icon);
}
gtk_label_set_text (GTK_LABEL (priv->brand_label), new_label);
gtk_widget_show (priv->brand_label);
g_free (new_label);
+ show = TRUE;
} else {
gtk_widget_hide (priv->brand_label);
}
+
+ if (show)
+ gtk_widget_show (priv->brand_container);
+ else
+ gtk_widget_hide (priv->brand_container);
}
static void
priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
old_account = priv->last_from_account;
- priv->last_from_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
- new_account = priv->last_from_account;
+ new_account = modest_selector_picker_get_active_id (MODEST_SELECTOR_PICKER (priv->from_field));
+
+ if (!new_account) {
+ g_warning ("%s, could not get the new account", __FUNCTION__);
+ return;
+ }
+
+ /* If the From is the same do nothing */
+ if (old_account && new_account && !strcmp (old_account, new_account))
+ return;
+
+ priv->last_from_account = new_account;
update_signature (self, old_account, new_account);
update_branding (self, new_account);
static gboolean
idle_save_mime_part_show_result (SaveMimePartInfo *info)
{
- if (info->pairs != NULL) {
- save_mime_part_to_file (info);
- } else {
- /* This is a GDK lock because we are an idle callback and
- * hildon_banner_show_information is or does Gtk+ code */
+ /* This is a GDK lock because we are an idle callback and
+ * hildon_banner_show_information is or does Gtk+ code */
- gdk_threads_enter (); /* CHECKED */
- save_mime_part_info_free (info, TRUE);
- if (info->result == GNOME_VFS_OK) {
- hildon_banner_show_information (NULL, NULL, _CS("sfil_ib_saved"));
- } else if (info->result == GNOME_VFS_ERROR_NO_SPACE) {
- gchar *msg = g_strdup_printf (_KR("cerm_device_memory_full"), "");
- modest_platform_information_banner (NULL, NULL, msg);
- g_free (msg);
- } else {
- hildon_banner_show_information (NULL, NULL, _("mail_ib_file_operation_failed"));
- }
- gdk_threads_leave (); /* CHECKED */
+ gdk_threads_enter (); /* CHECKED */
+ if (info->result == GNOME_VFS_OK) {
+ hildon_banner_show_information (NULL, NULL, _CS("sfil_ib_saved"));
+ } else if (info->result == GNOME_VFS_ERROR_NO_SPACE) {
+ gchar *msg = g_strdup_printf (_KR("cerm_device_memory_full"), "");
+ modest_platform_information_banner (NULL, NULL, msg);
+ g_free (msg);
+ } else {
+ hildon_banner_show_information (NULL, NULL, _("mail_ib_file_operation_failed"));
}
+ save_mime_part_info_free (info, FALSE);
+ gdk_threads_leave (); /* CHECKED */
return FALSE;
}
}
}
g_object_unref (G_OBJECT (stream));
- g_object_unref (pair->part);
- g_slice_free (SaveMimePartPair, pair);
- info->pairs = g_list_delete_link (info->pairs, info->pairs);
} else {
- g_warning ("Could not create save attachment %s: %s\n", pair->filename, gnome_vfs_result_to_string (info->result));
- save_mime_part_info_free (info, FALSE);
+ g_warning ("Could not create save attachment %s: %s\n",
+ pair->filename, gnome_vfs_result_to_string (info->result));
+ }
+
+ /* Go on saving remaining files */
+ info->pairs = g_list_remove_link (info->pairs, info->pairs);
+ if (info->pairs != NULL) {
+ save_mime_part_to_file (info);
+ } else {
+ g_idle_add ((GSourceFunc) idle_save_mime_part_show_result, info);
}
- g_idle_add ((GSourceFunc) idle_save_mime_part_show_result, info);
return NULL;
}
/* Numeric input mode */
hildon_gtk_entry_set_input_mode (GTK_ENTRY (editor),
HILDON_GTK_INPUT_MODE_NUMERIC);
+ hildon_gtk_widget_set_theme_size ((GtkWidget *) editor,
+ HILDON_SIZE_FINGER_HEIGHT);
/* Set user inputted range to editor */
modest_number_editor_set_range (editor, min, max);
-
return GTK_WIDGET (editor);
}
#define COMMON_FOLDER_DIALOG_ENTRY "entry"
#define COMMON_FOLDER_DIALOG_ACCOUNT_PICKER "account-picker"
#define FOLDER_PICKER_CURRENT_FOLDER "current-folder"
+#define FOLDER_PICKER_ORIGINAL_ACCOUNT "original-account"
#define MODEST_ALARMD_APPID PACKAGE_NAME
+static ca_context *ca_con = NULL;
+
static void modest_platform_play_email_tone (void);
modest_platform_init (int argc, char *argv[])
{
osso_context_t *osso_context;
-
osso_hw_state_t hw_state = { 0 };
- DBusConnection *con;
+ DBusConnection *con;
GSList *acc_names;
-
+
if (!check_required_files ()) {
g_printerr ("modest: missing required files\n");
return FALSE;
}
-
- osso_context = osso_initialize(PACKAGE,PACKAGE_VERSION,
- FALSE, NULL);
- if (!osso_context) {
- g_printerr ("modest: failed to acquire osso context\n");
- return FALSE;
- }
- modest_maemo_utils_set_osso_context (osso_context);
+
+ osso_context = modest_maemo_utils_get_osso_context();
if ((con = osso_get_dbus_connection (osso_context)) == NULL) {
g_printerr ("modest: could not get dbus connection\n");
static TnyFolderStore *
folder_chooser_dialog_run (ModestFolderView *original,
- TnyFolderStore *current)
+ TnyFolderStore *current,
+ GtkButton *picker)
{
GtkWidget *folder_view;
FolderChooserData userdata = {NULL, NULL};
GtkWidget *pannable;
- gchar *visible_id = NULL;
+ const gchar *visible_id = NULL;
userdata.dialog = hildon_dialog_new ();
pannable = hildon_pannable_area_new ();
along with the currently visible server account */
if (modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (current)) ||
modest_tny_account_is_memory_card_account (TNY_ACCOUNT (current)))
- visible_id =
- g_strdup (modest_folder_view_get_account_id_of_visible_server_account (MODEST_FOLDER_VIEW (original)));
+ visible_id = g_object_get_data ((GObject *) picker, FOLDER_PICKER_ORIGINAL_ACCOUNT);
else
- visible_id = g_strdup (tny_account_get_id (TNY_ACCOUNT (current)));
+ visible_id = tny_account_get_id (TNY_ACCOUNT (current));
} else if (TNY_IS_FOLDER (current)) {
TnyAccount *account;
- account = tny_folder_get_account (TNY_FOLDER (current));
+ account = modest_tny_folder_get_account ((TnyFolder *) current);
if (account) {
if (modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (account)) ||
modest_tny_account_is_memory_card_account (TNY_ACCOUNT (account))) {
- visible_id =
- g_strdup (modest_folder_view_get_account_id_of_visible_server_account (MODEST_FOLDER_VIEW (original)));
+ visible_id = g_object_get_data ((GObject *) picker, FOLDER_PICKER_ORIGINAL_ACCOUNT);
} else {
- visible_id = g_strdup (tny_account_get_id (account));
+ visible_id = tny_account_get_id (account);
}
g_object_unref (account);
}
} else {
- visible_id = g_strdup (
- modest_folder_view_get_account_id_of_visible_server_account (MODEST_FOLDER_VIEW(original)));
+ visible_id =
+ modest_folder_view_get_account_id_of_visible_server_account (MODEST_FOLDER_VIEW(original));
}
modest_folder_view_set_account_id_of_visible_server_account (MODEST_FOLDER_VIEW(folder_view),
visible_id);
- g_free (visible_id);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (userdata.dialog)->vbox), pannable);
gtk_container_add (GTK_CONTAINER (pannable), folder_view);
current = g_object_get_data (G_OBJECT (button), FOLDER_PICKER_CURRENT_FOLDER);
- store = folder_chooser_dialog_run (helper->folder_view, current);
+ store = folder_chooser_dialog_run (helper->folder_view, current, button);
if (store) {
const gchar *current_name;
gboolean exists = FALSE;
hildon_button_set_alignment (HILDON_BUTTON (button), 0.0, 0.5, 1.0, 1.0);
- if (suggested)
+ if (suggested) {
+ const gchar *acc_id = NULL;
+
folder_picker_set_store (GTK_BUTTON (button), suggested);
+ if (TNY_IS_ACCOUNT (suggested)) {
+ acc_id = tny_account_get_id ((TnyAccount *) suggested);
+ } else {
+ TnyAccount *account = modest_tny_folder_get_account ((TnyFolder *) suggested);
+ if (account) {
+ acc_id = tny_account_get_id ((TnyAccount *) account);
+ g_object_unref (account);
+ }
+ }
+
+ if (!acc_id)
+ modest_folder_view_get_account_id_of_visible_server_account (MODEST_FOLDER_VIEW(helper->folder_view));
+
+ g_object_set_data_full (G_OBJECT (button), FOLDER_PICKER_ORIGINAL_ACCOUNT,
+ g_strdup (acc_id), (GDestroyNotify) g_free);
+ }
+
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (folder_picker_clicked),
helper);
gchar *mail_tone;
gint mail_volume_int;
int ret;
- ca_context *ca_con = NULL;
ca_proplist *pl = NULL;
#ifdef MODEST_USE_PROFILE
if (mail_volume_int > 0) {
- if ((ret = ca_context_create(&ca_con)) != CA_SUCCESS) {
- g_warning("ca_context_create: %s\n", ca_strerror(ret));
- return;
+ if (ca_con == NULL) {
+ if ((ret = ca_context_create (&ca_con)) != CA_SUCCESS) {
+ g_warning("ca_context_create: %s\n", ca_strerror(ret));
+ return;
+ }
}
if ((ret = ca_context_open(ca_con)) != CA_SUCCESS) {
g_warning("ca_context_open: %s\n", ca_strerror(ret));
- ca_context_destroy(ca_con);
return;
}
g_debug("ca_context_play_full (vol %f): %s\n", (gfloat) mail_volume_int, ca_strerror(ret));
ca_proplist_destroy(pl);
- ca_context_destroy(ca_con);
}
g_free (mail_tone);
selected = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
if (selected) {
- gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+ /* It's not possible to select root folders as
+ targets unless they're the local account or
+ the memory card account */
+ if ((TNY_IS_FOLDER (selected) && !TNY_IS_MERGE_FOLDER (selected)) ||
+ (TNY_IS_ACCOUNT (selected) &&
+ (modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (selected)) ||
+ modest_tny_account_is_memory_card_account (TNY_ACCOUNT (selected)))))
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
g_object_unref (selected);
}
}
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector));
modest_provider_picker_set_others_provider (MODEST_PROVIDER_PICKER (self));
+ /* For theming purpouses. Widget name must end in Button-finger */
+ gtk_widget_set_name ((GtkWidget *) self, "ModestProviderPickerButton-finger");
+
return self;
}
+++ /dev/null
-/* Copyright (c) 2007, 2008, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "modest-retrieve-picker.h"
-#include "modest-defs.h" /* For the conf names. */
-#include "modest-account-settings.h"
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkcelllayout.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <glib/gi18n.h>
-
-#include <stdlib.h>
-#include <string.h> /* For memcpy() */
-
-/* Include config.h so that _() works: */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-G_DEFINE_TYPE (ModestRetrievePicker, modest_retrieve_picker, HILDON_TYPE_PICKER_BUTTON);
-
-#define MODEST_RETRIEVE_PICKER_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), MODEST_TYPE_RETRIEVE_PICKER, ModestRetrievePickerPrivate))
-
-typedef struct _ModestRetrievePickerPrivate ModestRetrievePickerPrivate;
-
-struct _ModestRetrievePickerPrivate
-{
- GtkTreeModel *model;
-};
-
-enum MODEL_COLS {
- MODEL_COL_NAME = 0, /* a string */
- MODEL_COL_RETRIEVE_TYPE = 1 /* a gint (a ModestAccountRetrieveType) */
-};
-
-void modest_retrieve_picker_fill (ModestRetrievePicker *picker, ModestProtocolType protocol);
-
-static gchar *
-touch_selector_print_func (HildonTouchSelector *selector, gpointer userdata)
-{
- GtkTreeIter iter;
- if (hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &iter)) {
- GtkTreeModel *model;
- GValue value = {0,};
-
- model = hildon_touch_selector_get_model (HILDON_TOUCH_SELECTOR (selector), 0);
- gtk_tree_model_get_value (model, &iter, MODEL_COL_NAME, &value);
- return g_value_dup_string (&value);
- }
- return NULL;
-}
-
-static void
-modest_retrieve_picker_finalize (GObject *object)
-{
- ModestRetrievePickerPrivate *priv = MODEST_RETRIEVE_PICKER_GET_PRIVATE (object);
-
- g_object_unref (G_OBJECT (priv->model));
-
- G_OBJECT_CLASS (modest_retrieve_picker_parent_class)->finalize (object);
-}
-
-static void
-modest_retrieve_picker_class_init (ModestRetrievePickerClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (ModestRetrievePickerPrivate));
-
- object_class->finalize = modest_retrieve_picker_finalize;
-}
-
-static void
-modest_retrieve_picker_init (ModestRetrievePicker *self)
-{
- ModestRetrievePickerPrivate *priv = MODEST_RETRIEVE_PICKER_GET_PRIVATE (self);
-
- priv->model = NULL;
-}
-
-
-
-ModestRetrievePicker*
-modest_retrieve_picker_new (HildonSizeType size,
- HildonButtonArrangement arrangement)
-{
- ModestRetrievePicker *self;
- ModestRetrievePickerPrivate *priv;
- GtkCellRenderer *renderer;
- GtkWidget *selector;
-
- self = g_object_new (MODEST_TYPE_RETRIEVE_PICKER,
- "arrangement", arrangement,
- "size", size,
- NULL);
- priv = MODEST_RETRIEVE_PICKER_GET_PRIVATE (self);
-
- /* Create a tree model,
- * with a string for the name, and an ID for the servertype.
- * This must match our MODEL_COLS enum constants.
- */
- priv->model = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT));
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
-
- selector = hildon_touch_selector_new ();
- hildon_touch_selector_append_column (HILDON_TOUCH_SELECTOR (selector), GTK_TREE_MODEL (priv->model),
- renderer, "text", MODEL_COL_NAME, NULL);
-
- hildon_touch_selector_set_model (HILDON_TOUCH_SELECTOR (selector), 0, GTK_TREE_MODEL (priv->model));
- hildon_touch_selector_set_print_func (HILDON_TOUCH_SELECTOR (selector),
- (HildonTouchSelectorPrintFunc) touch_selector_print_func);
-
- hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector));
-
- return self;
-}
-
-/* Fill the picker box with appropriate choices.
- * #picker: The picker box.
- * @protocol: IMAP or POP.
- */
-void modest_retrieve_picker_fill (ModestRetrievePicker *picker, ModestProtocolType protocol)
-{
- ModestRetrievePickerPrivate *priv = MODEST_RETRIEVE_PICKER_GET_PRIVATE (picker);
-
- /* Remove any existing rows: */
- GtkListStore *liststore = GTK_LIST_STORE (priv->model);
- gtk_list_store_clear (liststore);
-
- GtkTreeIter iter;
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter,
- MODEL_COL_RETRIEVE_TYPE, MODEST_ACCOUNT_RETRIEVE_HEADERS_ONLY,
- MODEL_COL_NAME, _("mcen_fi_advsetup_retrievetype_headers"), -1);
-
- gtk_list_store_append (liststore, &iter);
- gtk_list_store_set (liststore, &iter,
- MODEL_COL_RETRIEVE_TYPE, MODEST_ACCOUNT_RETRIEVE_MESSAGES_AND_ATTACHMENTS,
- MODEL_COL_NAME, _("mcen_fi_advsetup_retrievetype_messages_attachments"), -1);
-}
-
-/**
- * Returns the selected retrieve.
- * or NULL if no retrieve was selected. The result must be freed with g_free().
- */
-ModestAccountRetrieveType
-modest_retrieve_picker_get_active_retrieve_conf (ModestRetrievePicker *picker)
-{
- GtkTreeIter active;
- GtkWidget *selector;
- gboolean found;
-
- selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (picker)));
- found = hildon_touch_selector_get_selected (HILDON_TOUCH_SELECTOR (selector), 0, &active);
- if (found) {
- ModestRetrievePickerPrivate *priv = MODEST_RETRIEVE_PICKER_GET_PRIVATE (picker);
-
- ModestAccountRetrieveType retrieve_type = MODEST_ACCOUNT_RETRIEVE_HEADERS_ONLY;
- gtk_tree_model_get (priv->model, &active, MODEL_COL_RETRIEVE_TYPE, &retrieve_type, -1);
- return retrieve_type;
- }
-
- return MODEST_ACCOUNT_RETRIEVE_HEADERS_ONLY; /* Failed. */
-}
-
-/* This allows us to pass more than one piece of data to the signal handler,
- * and get a result: */
-typedef struct
-{
- ModestRetrievePicker* self;
- ModestAccountRetrieveType retrieve_type;
- gboolean found;
-} ForEachData;
-
-static gboolean
-on_model_foreach_select_id(GtkTreeModel *model,
- GtkTreePath *path, GtkTreeIter *iter, gpointer user_data)
-{
- ForEachData *state = (ForEachData*)(user_data);
-
- gboolean result = FALSE;
-
- /* Select the item if it has the matching name: */
- ModestAccountRetrieveType retrieve_type;
- gtk_tree_model_get (model, iter, MODEL_COL_RETRIEVE_TYPE, &retrieve_type, -1);
- if (retrieve_type == state->retrieve_type) {
- GtkWidget *selector;
- selector = GTK_WIDGET (hildon_picker_button_get_selector (HILDON_PICKER_BUTTON (state->self)));
- hildon_touch_selector_select_iter (HILDON_TOUCH_SELECTOR (selector), 0, iter, TRUE);
- hildon_button_set_value (HILDON_BUTTON (state->self),
- hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector)));
-
- state->found = TRUE;
- return TRUE; /* Stop walking the tree. */
- }
-
- return result; /* Whether we keep walking the tree. */
-}
-
-/**
- * Selects the specified retrieve,
- * or FALSE if no retrieve was selected.
- */
-gboolean
-modest_retrieve_picker_set_active_retrieve_conf (ModestRetrievePicker *picker,
- ModestAccountRetrieveType retrieve_type)
-{
- ModestRetrievePickerPrivate *priv = MODEST_RETRIEVE_PICKER_GET_PRIVATE (picker);
-
- /* Create a state instance so we can send two items of data to the signal handler: */
- ForEachData *state = g_new0 (ForEachData, 1);
- state->self = picker;
- state->retrieve_type = retrieve_type;
- state->found = FALSE;
-
- /* Look at each item, and select the one with the correct ID: */
- gtk_tree_model_foreach (priv->model, &on_model_foreach_select_id, state);
-
- const gboolean result = state->found;
-
- /* Free the state instance: */
- g_free(state);
-
- return result;
-}
-
+++ /dev/null
-/* Copyright (c) 2007, 2008, Nokia Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Nokia Corporation nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _MODEST_RETRIEVE_PICKER
-#define _MODEST_RETRIEVE_PICKER
-
-#include <hildon/hildon-picker-button.h>
-#include "modest-protocol-registry.h"
-#include <modest-account-settings.h>
-
-G_BEGIN_DECLS
-
-#define MODEST_TYPE_RETRIEVE_PICKER modest_retrieve_picker_get_type()
-
-#define MODEST_RETRIEVE_PICKER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- MODEST_TYPE_RETRIEVE_PICKER, ModestRetrievePicker))
-
-#define MODEST_RETRIEVE_PICKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- MODEST_TYPE_RETRIEVE_PICKER, ModestRetrievePickerClass))
-
-#define MODEST_IS_RETRIEVE_PICKER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- MODEST_TYPE_RETRIEVE_PICKER))
-
-#define MODEST_IS_RETRIEVE_PICKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- MODEST_TYPE_RETRIEVE_PICKER))
-
-#define MODEST_RETRIEVE_PICKER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- MODEST_TYPE_RETRIEVE_PICKER, ModestRetrievePickerClass))
-
-typedef struct {
- HildonPickerButton parent;
-} ModestRetrievePicker;
-
-typedef struct {
- HildonPickerButtonClass parent_class;
-} ModestRetrievePickerClass;
-
-GType modest_retrieve_picker_get_type (void);
-
-ModestRetrievePicker* modest_retrieve_picker_new (HildonSizeType size,
- HildonButtonArrangement arrangement);
-
-void modest_retrieve_picker_fill (ModestRetrievePicker *picker, ModestProtocolType protocol);
-
-ModestAccountRetrieveType modest_retrieve_picker_get_active_retrieve_conf (ModestRetrievePicker *picker);
-
-gboolean modest_retrieve_picker_set_active_retrieve_conf (ModestRetrievePicker *picker,
- ModestAccountRetrieveType retrieve_type);
-
-
-G_END_DECLS
-
-#endif /* _MODEST_RETRIEVE_PICKER */
modest_secureauth_picker_fill (self);
+ /* For theming purpouses. Widget name must end in Button-finger */
+ gtk_widget_set_name ((GtkWidget *) self, "ModestSecureauthPickerButton-finger");
+
return self;
}
priv->id_equal_func = id_equal_func;
else
priv->id_equal_func = g_direct_equal; /* compare the ptr values */
-
+
+ /* For theming purpouses. Widget name must end in Button-finger */
+ gtk_widget_set_name ((GtkWidget *) obj, "ModestSelectorPickerButton-finger");
+
return GTK_WIDGET(obj);
}
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (self), HILDON_TOUCH_SELECTOR (selector));
+ /* For theming purpouses. Widget name must end in Button-finger */
+ gtk_widget_set_name ((GtkWidget *) self, "ModestServersecurityPickerButton-finger");
+
return self;
}
/* Fill the model */
modest_servertype_picker_fill (self, filter_providers);
+ /* For theming purpouses. Widget name must end in Button-finger */
+ gtk_widget_set_name ((GtkWidget *) self, "ModestServertypePickerButton-finger");
+
return self;
}
static gboolean resolve_address (const gchar *address, GSList **resolved_addresses, gchar **contact_id);
static gchar *unquote_string (const gchar *str);
-
static void
unref_gobject (GObject *obj)
{
if (obj)
g_object_unref (obj);
}
-
static void
get_book_view_cb (EBook *book, EBookStatus status, EBookView *bookview, gpointer data)
/* There is no support to get my own contact in this version */
return NULL;
}
+
+
+void
+modest_address_book_init (void)
+{
+ open_addressbook ();
+}
info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_SIZE) {
size = info->size;
if (size > allowed_size) {
- modest_platform_information_banner (NULL, NULL,
- _FM("sfil_ib_opening_not_allowed"));
+ modest_platform_information_banner (NULL, NULL,
+ _("mail_ib_error_attachment_size"));
return 0;
}
} else
#include <widgets/modest-recpt-editor.h>
/**
+ * modest_address_book_init:
+ *
+ * initializes the addressbook
+ */
+void
+modest_address_book_init (void);
+
+/**
* modest_address_book_add_address:
* @address: a string
*
#include <modest-runtime-priv.h>
#include <modest-init.h>
#include <modest-defs.h>
+#include "modest-address-book.h"
#include <modest-singletons.h>
#include <widgets/modest-header-view.h>
#include <widgets/modest-folder-view.h>
return FALSE;
}
+ /* Initialize addressbook */
+ modest_address_book_init ();
+
reset = modest_runtime_get_debug_flags () & MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS;
if (!init_header_columns(modest_runtime_get_conf(), reset)) {
modest_init_uninit ();
GError *error;
GOptionContext *context;
+ ModestWindowMgr *mgr;
+
context = g_option_context_new ("- Modest email client");
g_option_context_add_main_entries (context, option_entries, GETTEXT_PACKAGE);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
G_CALLBACK (modest_ui_actions_on_password_requested),
NULL);
+ /* Create cached windows */
+ mgr = modest_runtime_get_window_mgr ();
+ modest_window_mgr_create_caches (mgr);
+
/* Usually, we only show the UI when we get the "top_application" D-Bus method.
* This allows modest to start via D-Bus activation to provide a service,
* without showing the UI.
*/
if (show_ui_without_top_application_method) {
ModestWindow *window;
- ModestWindowMgr *mgr;
modest_runtime_set_allow_shutdown (TRUE);
mgr = modest_runtime_get_window_mgr();
}
static void
-show_password_warning_only (const gchar *msg)
-{
- /* Show an explanatory temporary banner: */
- if (modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ()))
- modest_platform_information_banner (NULL, NULL, msg);
-}
-
-static void
show_wrong_password_dialog (TnyAccount *account,
gboolean show_banner)
{
if (modest_protocol_registry_protocol_type_has_tag(modest_runtime_get_protocol_registry (),
protocol_type, MODEST_PROTOCOL_REGISTRY_TRANSPORT_PROTOCOLS)) {
gchar *username = NULL, *msg = NULL;
+ gboolean is_banner = FALSE;
username = modest_account_mgr_get_server_account_username (priv->account_mgr,
server_account_name);
if (!username || strlen(username) == 0) {
password = modest_account_mgr_get_server_account_password (priv->account_mgr,
server_account_name);
- if (already_asked)
- msg = g_strdup (_("mcen_ib_username_pw_incorrect"));
- else if (!password || strlen(password) == 0)
+ if (already_asked) {
+ msg = g_strdup (_CS("ecdg_ib_set_password_incorrect"));
+ is_banner = TRUE;
+ } else if (!password || strlen(password) == 0) {
msg = g_strdup_printf (_("emev_ni_ui_smtp_passwd_invalid"),
tny_account_get_name (account),
tny_account_get_hostname (account));
- else
+ } else {
msg = g_strdup_printf (_("emev_ni_ui_smtp_authentication_fail_error"),
tny_account_get_hostname (account));
+ }
if (password)
g_free (password);
}
if (msg) {
- modest_platform_run_information_dialog (NULL, msg, TRUE);
+ if (is_banner)
+ modest_platform_information_banner (NULL, NULL, msg);
+ else
+ modest_platform_run_information_dialog (NULL, msg, TRUE);
g_free (msg);
}
if (username)
g_free (username);
+ } else {
+ if (already_asked) {
+ const gchar *msg;
+ gboolean username_known =
+ modest_account_mgr_get_server_account_username_has_succeeded(priv->account_mgr,
+ server_account_name);
+ /* If the login has ever succeeded then show a specific message */
+ if (username_known)
+ msg = _CS ("ecdg_ib_set_password_incorrect");
+ else
+ msg = _("mcen_ib_username_pw_incorrect");
+ if (modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ()))
+ modest_platform_information_banner (NULL, NULL, msg);
+ }
}
if (settings_have_password) {
}
/* we don't have it yet. Get the password from the user */
+ pwd = NULL;
const gchar* account_id = tny_account_get_id (account);
gboolean remember = FALSE;
- pwd = NULL;
-
- if (already_asked) {
- const gchar *msg;
- gboolean username_known =
- modest_account_mgr_get_server_account_username_has_succeeded(priv->account_mgr,
- server_account_name);
- /* If the login has ever succeeded then show a specific message */
- if (username_known)
- msg = _CS ("ecdg_ib_set_password_incorrect");
- else
- msg = _("mcen_ib_username_pw_incorrect");
- show_password_warning_only (msg);
- }
-
- /* Request password */
g_signal_emit (G_OBJECT (self), signals[PASSWORD_REQUESTED_SIGNAL], 0,
account_id, /* server_account_name */
&username, &pwd, cancel, &remember);
-
if (!*cancel) {
/* The password will be returned as the result,
* but we need to tell tinymail about the username too: */
tny_mime_part_set_header_pair (attachment_part, "Content-Disposition",
"attachment");
}
- tny_mime_part_set_transfer_encoding (TNY_MIME_PART (attachment_part), "base64");
+ if (!TNY_IS_MSG (old_attachment)) {
+ tny_mime_part_set_transfer_encoding (TNY_MIME_PART (attachment_part), "base64");
+ }
ret = tny_mime_part_add_part (TNY_MIME_PART (part), attachment_part);
attached++;
if (old_cid)
gchar *old_subject;
gchar *new_subject;
TnyMimePart *body = NULL;
+ TnyMimePart *html_body = NULL;
ModestFormatter *formatter;
gchar *subject_prefix;
gboolean no_text_part;
gchar *parent_uid;
+ gboolean forward_as_attach = FALSE;
if (header)
g_object_ref (header);
/* Get body from original msg. Always look for the text/plain
part of the message to create the reply/forwarded mail */
- if (msg != NULL)
+ if (msg != NULL) {
body = modest_tny_msg_find_body_part (msg, FALSE);
+ html_body = modest_tny_msg_find_body_part (msg, TRUE);
+ }
if (modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_PREFER_FORMATTED_TEXT,
NULL))
new_msg = modest_formatter_quote (formatter, no_text_part ? NULL: body, header,
attachments);
else {
- /* for attachements; inline if there is a text part, and include the
- * full old mail if there was none */
- if (no_text_part) {
+ if (no_text_part || (html_body && (strcmp (tny_mime_part_get_content_type (html_body), "text/html")==0))) {
+ forward_as_attach = TRUE;
new_msg = modest_formatter_attach (formatter, msg, header);
- } else {
+ } else {
+ forward_as_attach = FALSE;
new_msg = modest_formatter_inline (formatter, body, header,
attachments);
}
g_object_unref (G_OBJECT(formatter));
if (body)
g_object_unref (G_OBJECT(body));
+ if (html_body)
+ g_object_unref (G_OBJECT(html_body));
/* Fill the header */
new_header = tny_msg_get_header (new_msg);
g_object_unref (G_OBJECT (header));
/* ugly to unref it here instead of in the calling func */
- if (!is_reply & !no_text_part) {
+ if (!is_reply & !forward_as_attach) {
add_attachments (TNY_MIME_PART (new_msg), attachments, FALSE, NULL);
}
static TnyFolder* modest_tny_send_queue_get_outbox (TnySendQueue *self);
static TnyFolder* modest_tny_send_queue_get_sentbox (TnySendQueue *self);
+static void modest_tny_send_queue_cancel (TnySendQueue *self,
+ TnySendQueueCancelAction cancel_action,
+ GError **err);
/* list my signals */
enum {
/* last was send receive operation?*/
gboolean requested_send_receive;
-
gboolean sending;
+ gboolean suspend;
GSList *sighandlers;
};
return g_object_ref (priv->outbox);
}
+static void
+modest_tny_send_queue_cancel (TnySendQueue *self,
+ TnySendQueueCancelAction cancel_action,
+ GError **err)
+{
+ ModestTnySendQueuePrivate *priv;
+
+ g_return_if_fail (self);
+
+ priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
+
+ /* Call the parent */
+ TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->cancel (self, cancel_action, err);
+
+ if (cancel_action == TNY_SEND_QUEUE_CANCEL_ACTION_SUSPEND && (err == NULL || *err == NULL))
+ priv->suspend = TRUE;
+}
+
GType
modest_tny_send_queue_get_type (void)
{
TNY_CAMEL_SEND_QUEUE_CLASS(klass)->add_async = modest_tny_send_queue_add_async;
TNY_CAMEL_SEND_QUEUE_CLASS(klass)->get_outbox = modest_tny_send_queue_get_outbox;
TNY_CAMEL_SEND_QUEUE_CLASS(klass)->get_sentbox = modest_tny_send_queue_get_sentbox;
+ TNY_CAMEL_SEND_QUEUE_CLASS(klass)->cancel = modest_tny_send_queue_cancel;
klass->status_changed = NULL;
signals[STATUS_CHANGED_SIGNAL] =
priv->outbox = NULL;
priv->sentbox = NULL;
priv->sending = FALSE;
+ priv->suspend = FALSE;
priv->sighandlers = NULL;
}
priv->sending = TRUE;
}
-static void
+static void
+on_queue_stop_get_headers_async_cb (TnyFolder *folder,
+ gboolean cancelled,
+ TnyList *headers,
+ GError *err,
+ gpointer user_data)
+{
+ ModestTnySendQueue *self = (ModestTnySendQueue *) user_data;
+ TnyIterator *iter;
+
+ if (cancelled || err)
+ goto end;
+
+ /* Update the info about headers */
+ iter = tny_list_create_iterator (headers);
+ while (!tny_iterator_is_done (iter)) {
+ TnyHeader *header;
+
+ header = (TnyHeader *) tny_iterator_get_current (iter);
+ if (header) {
+ gchar *msg_id = NULL;
+ GList *item = NULL;
+
+ /* Get message uid */
+ msg_id = modest_tny_send_queue_get_msg_id (header);
+ if (msg_id)
+ item = modest_tny_send_queue_lookup_info (MODEST_TNY_SEND_QUEUE (self), msg_id);
+ else
+ g_warning ("%s: could not get msg-id for header", __FUNCTION__);
+
+ if (item) {
+ SendInfo *info;
+ /* Set current status item */
+ info = item->data;
+ if (tny_header_get_flags (header) & TNY_HEADER_FLAG_SUSPENDED) {
+ info->status = MODEST_TNY_SEND_QUEUE_SUSPENDED;
+ g_signal_emit (self, signals[STATUS_CHANGED_SIGNAL], 0,
+ info->msg_id, info->status);
+ }
+ } else {
+ g_warning ("%s: could not find item with id '%s'", __FUNCTION__, msg_id);
+ }
+ g_object_unref (header);
+ }
+ tny_iterator_next (iter);
+ }
+ g_object_unref (iter);
+
+ end:
+ /* Unrefs */
+ g_object_unref (headers);
+ g_object_unref (self);
+}
+
+static void
_on_queue_stop (TnySendQueue *self,
gpointer data)
{
priv = MODEST_TNY_SEND_QUEUE_GET_PRIVATE (self);
priv->sending = FALSE;
+
+ if (priv->suspend) {
+ TnyList *headers;
+ priv->suspend = FALSE;
+
+ /* Update the state of messages in the queue */
+ headers = tny_simple_list_new ();
+ tny_folder_get_headers_async (priv->outbox, headers, TRUE,
+ on_queue_stop_get_headers_async_cb,
+ NULL, g_object_ref (self));
+ }
}
-static void
+static void
fill_list_of_caches (gpointer key, gpointer value, gpointer userdata)
{
GSList **send_queues = (GSList **) userdata;
ModestTnySendQueueStatus queue_status = MODEST_TNY_SEND_QUEUE_UNKNOWN;
gchar *msg_uid = NULL;
ModestTnySendQueue *send_queue = NULL;
-
+
g_return_val_if_fail (TNY_IS_HEADER(header), MODEST_TNY_SEND_QUEUE_UNKNOWN);
msg_uid = modest_tny_send_queue_get_msg_id (header);
cache_mgr = modest_runtime_get_cache_mgr ();
send_queue_cache = modest_cache_mgr_get_cache (cache_mgr,
MODEST_CACHE_MGR_CACHE_TYPE_SEND_QUEUE);
-
+
g_hash_table_foreach (send_queue_cache, (GHFunc) fill_list_of_caches, &send_queues);
if (send_queues == NULL) {
accounts = tny_simple_list_new ();
tny_account_store_get_accounts (TNY_ACCOUNT_STORE(accounts_store),
accounts,
TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS);
-
+
iter = tny_list_create_iterator (accounts);
- while (!tny_iterator_is_done (iter)) {
+ while (!tny_iterator_is_done (iter)) {
account = TNY_TRANSPORT_ACCOUNT(tny_iterator_get_current (iter));
send_queue = modest_runtime_get_send_queue(TNY_TRANSPORT_ACCOUNT(account), TRUE);
g_object_unref(account);
else {
for (node = send_queues; node != NULL; node = g_slist_next (node)) {
send_queue = MODEST_TNY_SEND_QUEUE (node->data);
-
+
queue_status = modest_tny_send_queue_get_msg_status (send_queue, msg_uid);
if (queue_status != MODEST_TNY_SEND_QUEUE_UNKNOWN) {
status = queue_status;
if (expected_size > MODEST_MAX_ATTACHMENT_SIZE) {
modest_platform_run_information_dialog (
GTK_WINDOW(win),
- _FM("sfil_ib_opening_not_allowed"),
+ _("mail_ib_error_attachment_size"),
TRUE);
return;
}
/* Create reply mail */
switch (rf_helper->action) {
+ /* Use the msg_header to ensure that we have all the
+ information. The summary can lack some data */
+ TnyHeader *msg_header;
case ACTION_REPLY:
+ msg_header = tny_msg_get_header (msg);
new_msg =
- modest_tny_msg_create_reply_msg (msg, header, from,
+ modest_tny_msg_create_reply_msg (msg, msg_header, from,
(use_signature) ? signature : NULL,
rf_helper->reply_forward_type,
MODEST_TNY_MSG_REPLY_MODE_SENDER);
+ g_object_unref (msg_header);
break;
case ACTION_REPLY_TO_ALL:
+ msg_header = tny_msg_get_header (msg);
new_msg =
- modest_tny_msg_create_reply_msg (msg, header, from,
+ modest_tny_msg_create_reply_msg (msg, msg_header, from,
(use_signature) ? signature : NULL,
rf_helper->reply_forward_type,
MODEST_TNY_MSG_REPLY_MODE_ALL);
edit_type = MODEST_EDIT_TYPE_REPLY;
+ g_object_unref (msg_header);
break;
case ACTION_FORWARD:
new_msg =
if (!acc_name)
acc_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());
if (!acc_name) {
- g_printerr ("modest: cannot get default account\n");
+ modest_platform_information_banner (NULL, NULL, _("emev_ni_internal_error"));
return;
}
} else {
acc_store = modest_runtime_get_account_store ();
account = modest_tny_account_store_get_server_account (acc_store, acc_name, TNY_ACCOUNT_TYPE_STORE);
+ if (!account) {
+ g_free (acc_name);
+ modest_platform_information_banner (NULL, NULL, _("emev_ni_internal_error"));
+ return;
+ }
+
/* Do not automatically refresh accounts that are flagged as
NO_AUTO_UPDATE. This could be useful for accounts that
handle their own update times */
if (expected_size > MODEST_MAX_ATTACHMENT_SIZE) {
modest_platform_run_information_dialog (
GTK_WINDOW(edit_window),
- _FM("sfil_ib_opening_not_allowed"),
+ _("mail_ib_error_attachment_size"),
TRUE);
return FALSE;
}
{
GObject *win = NULL;
const GError *error;
- TnyAccount *account;
+ TnyAccount *account = NULL;
#ifndef MODEST_TOOLKIT_HILDON2
ModestWindow *main_window = NULL;
#endif
win = modest_mail_operation_get_source (mail_op);
error = modest_mail_operation_get_error (mail_op);
- account = modest_mail_operation_get_account (mail_op);
+
+ if (TNY_IS_FOLDER (user_data))
+ account = modest_tny_folder_get_account (TNY_FOLDER (user_data));
+ else if (TNY_IS_ACCOUNT (user_data))
+ account = g_object_ref (user_data);
/* If it's not a disk full error then show a generic error */
if (!modest_tny_account_store_check_disk_full_error (modest_runtime_get_account_store(),
mail_op =
modest_mail_operation_new_with_error_handling (G_OBJECT(parent_window),
- modest_ui_actions_move_folder_error_handler,
- info->src_folder, NULL);
+ modest_ui_actions_move_folder_error_handler,
+ g_object_ref (info->dst_folder), g_object_unref);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
- mail_op);
-
- /* Select *after* the changes */
- /* TODO: this function hangs UI after transfer */
- /* modest_folder_view_select_folder (MODEST_FOLDER_VIEW(folder_view), */
- /* TNY_FOLDER (src_folder), TRUE); */
+ mail_op);
if (MODEST_IS_MAIN_WINDOW (parent_window)) {
modest_folder_view_select_folder (MODEST_FOLDER_VIEW(info->folder_view),
break;
}
- from =
- modest_account_mgr_get_from_string (mgr, node->data, NULL);
-
- if (from) {
- gchar *from_email =
- modest_text_utils_get_email_address (from);
- gchar *from_header_email =
- modest_text_utils_get_email_address (from_header);
-
- if (from_email && from_header_email) {
- if (!modest_text_utils_utf8_strcmp (from_header_email, from_email, TRUE)) {
- account_name = g_strdup (node->data);
- g_free (from);
- g_free (from_email);
- break;
- }
- }
- g_free (from_email);
- g_free (from_header_email);
- g_free (from);
- }
-
transport_account = modest_account_mgr_get_server_account_name (modest_runtime_get_account_mgr (),
(const gchar *) node->data,
TNY_ACCOUNT_TYPE_TRANSPORT);
}
if (mailbox && *mailbox)
break;
+
+ from =
+ modest_account_mgr_get_from_string (mgr, node->data, NULL);
+
+ if (from) {
+ gchar *from_email =
+ modest_text_utils_get_email_address (from);
+ gchar *from_header_email =
+ modest_text_utils_get_email_address (from_header);
+
+ if (from_email && from_header_email) {
+ if (!modest_text_utils_utf8_strcmp (from_header_email, from_email, TRUE)) {
+ account_name = g_strdup (node->data);
+ g_free (from);
+ g_free (from_email);
+ break;
+ }
+ }
+ g_free (from_email);
+ g_free (from_header_email);
+ g_free (from);
+ }
+
}
g_slist_foreach (accounts, (GFunc) g_free, NULL);
gchar *header_content_type;
header_content_type = modest_tny_mime_part_get_content_type (mime_part);
if ((g_str_has_prefix (header_content_type, "message/rfc822") ||
- g_str_has_prefix (header_content_type, "multipart/") ||
- g_str_has_prefix (header_content_type, "text/"))) {
+ g_str_has_prefix (header_content_type, "multipart/"))) {
+ file_icon_name =
+ modest_platform_get_file_icon_name (
+ NULL, "message/rfc822", NULL);
+ } else if (g_str_has_prefix (header_content_type, "text/")) {
file_icon_name =
modest_platform_get_file_icon_name (
NULL, tny_mime_part_get_content_type (mime_part), NULL);
#include <modest-datetime-formatter.h>
#ifdef MODEST_TOOLKIT_HILDON2
#include <hildon/hildon-gtk.h>
+#include <hildon/hildon-helper.h>
#endif
static GObjectClass *parent_class = NULL;
gtk_misc_set_padding (GTK_MISC (priv->time_label), MODEST_MARGIN_DOUBLE, 0);
priv->brand_label = gtk_label_new (NULL);
+#ifdef MODEST_TOOLKIT_HILDON2
+ hildon_helper_set_logical_font (priv->brand_label, "SmallSystemFont");
+#endif
gtk_label_set_justify (GTK_LABEL (priv->brand_label), GTK_JUSTIFY_RIGHT);
gtk_misc_set_alignment (GTK_MISC (priv->brand_label), 1.0, 0.5);
gtk_misc_set_padding (GTK_MISC (priv->brand_label), MODEST_MARGIN_DOUBLE, 0);
#ifdef MODEST_TOOLKIT_HILDON2
TnyGtkFolderListStoreFlags flags;
flags = TNY_GTK_FOLDER_LIST_STORE_FLAG_SHOW_PATH;
- if (!priv->do_refresh)
- flags &= TNY_GTK_FOLDER_LIST_STORE_FLAG_NO_REFRESH;
+ if (priv->do_refresh)
+ flags |= TNY_GTK_FOLDER_LIST_STORE_FLAG_DELAYED_REFRESH;
+ else
+ flags |= TNY_GTK_FOLDER_LIST_STORE_FLAG_NO_REFRESH;
model = tny_gtk_folder_list_store_new_with_flags (NULL,
flags);
tny_gtk_folder_list_store_set_path_separator (TNY_GTK_FOLDER_LIST_STORE (model),
#endif
state->connect_via = *id;
#ifndef MODEST_TOOLKIT_GTK
-#ifdef MODEST_TOOLKIT_HILDON2
- state->size_limit = modest_number_editor_get_value (MODEST_NUMBER_EDITOR (priv->size_limit));
-#else
+#ifndef MODEST_TOOLKIT_HILDON2
state->size_limit = hildon_number_editor_get_value (HILDON_NUMBER_EDITOR (priv->size_limit));
#endif
#else
modest_global_settings_dialog_save_settings_default (ModestGlobalSettingsDialog *self)
{
ModestConf *conf;
- ModestGlobalSettingsState current_state;
+ ModestGlobalSettingsState current_state = {0,};
GError *error = NULL;
ModestGlobalSettingsDialogPrivate *priv;
gpointer user_data)
{
ModestGlobalSettingsDialogPrivate *priv;
- ModestGlobalSettingsState current_state;
- gboolean changed;
+ ModestGlobalSettingsState current_state = {0,};
+ gboolean changed = FALSE;
priv = MODEST_GLOBAL_SETTINGS_DIALOG_GET_PRIVATE (user_data);
void
modest_header_view_refilter (ModestHeaderView *header_view)
{
- GtkTreeModel *model = NULL;
+ GtkTreeModel *model, *sortable = NULL;
ModestHeaderViewPrivate *priv = NULL;
g_return_if_fail (header_view && MODEST_IS_HEADER_VIEW (header_view));
priv = MODEST_HEADER_VIEW_GET_PRIVATE(header_view);
/* Hide cut headers */
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (header_view));
- if (GTK_IS_TREE_MODEL_FILTER (model)) {
- priv->status = HEADER_VIEW_INIT;
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
+ sortable = gtk_tree_view_get_model (GTK_TREE_VIEW (header_view));
+ if (GTK_IS_TREE_MODEL_SORT (sortable)) {
+ model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (sortable));
+ if (GTK_IS_TREE_MODEL_FILTER (model)) {
+ priv->status = HEADER_VIEW_INIT;
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
+ }
}
}
ModestHeaderViewFilter filter)
{
ModestHeaderViewPrivate *priv;
- GtkTreeModel *filter_model;
g_return_if_fail (MODEST_IS_HEADER_VIEW (self));
priv = MODEST_HEADER_VIEW_GET_PRIVATE (self);
priv->filter |= filter;
- filter_model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
- if (GTK_IS_TREE_MODEL_FILTER(filter_model)) {
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
- }
+ modest_header_view_refilter (self);
}
void
ModestHeaderViewFilter filter)
{
ModestHeaderViewPrivate *priv;
- GtkTreeModel *filter_model;
g_return_if_fail (MODEST_IS_HEADER_VIEW (self));
priv = MODEST_HEADER_VIEW_GET_PRIVATE (self);
priv->filter &= ~filter;
- filter_model = gtk_tree_view_get_model (GTK_TREE_VIEW (self));
- if (GTK_IS_TREE_MODEL_FILTER(filter_model)) {
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (filter_model));
- }
+ modest_header_view_refilter (self);
}
static void
/* TOOLBAR ACTIONS */
#ifndef MODEST_TOOLKIT_HILDON2
- /* Find in page. This is a normal menu option in Hildon2, and a checkbox in the others */
- { "FindInMessage", NULL, N_("mcen_me_viewer_find"), "<CTRL>F", NULL, G_CALLBACK (modest_ui_actions_on_toggle_find_in_page)},
{ "ToolbarSend", MODEST_TOOLBAR_ICON_MAIL_SEND, N_("mcen_me_editor_send"), "<Control>Return", NULL, G_CALLBACK (modest_ui_actions_on_send) },
#endif
#ifdef MODEST_TOOLKIT_GTK
{ "ActionsBold", MODEST_TOOLBAR_ICON_BOLD, MODEST_TOOLBAR_ICON_BOLD, NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_bold), FALSE },
{ "ActionsItalics", MODEST_TOOLBAR_ICON_ITALIC, MODEST_TOOLBAR_ICON_ITALIC, NULL, NULL, G_CALLBACK (modest_ui_actions_on_toggle_italics), FALSE },
-#ifndef MODEST_TOOLKIT_HILDON2
/* Find in page */
{ "FindInMessage", NULL, N_("mcen_me_viewer_find"), "<CTRL>F", NULL, G_CALLBACK (modest_ui_actions_on_toggle_find_in_page), FALSE },
-#endif
};
static const GtkRadioActionEntry modest_msg_edit_alignment_radio_action_entries [] = {
static ModestWindow *modest_window_mgr_show_initial_window_default (ModestWindowMgr *self);
static ModestWindow *modest_window_mgr_get_current_top_default (ModestWindowMgr *self);
static gboolean modest_window_mgr_screen_is_on_default (ModestWindowMgr *self);
+static void modest_window_mgr_create_caches_default (ModestWindowMgr *self);
static void modest_window_mgr_on_queue_changed (ModestMailOperationQueue *queue,
ModestMailOperation *mail_op,
ModestMailOperationQueueNotification type,
mgr_class->show_initial_window = modest_window_mgr_show_initial_window_default;
mgr_class->get_current_top = modest_window_mgr_get_current_top_default;
mgr_class->screen_is_on = modest_window_mgr_screen_is_on_default;
+ mgr_class->create_caches = modest_window_mgr_create_caches_default;
g_type_class_add_private (gobject_class, sizeof(ModestWindowMgrPrivate));
{
ModestWindowMgrPrivate *priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
if ((priv->cached_view == NULL) && (priv->idle_load_view_id == 0))
- priv->idle_load_view_id = g_idle_add ((GSourceFunc) idle_load_view, self);
+ priv->idle_load_view_id = g_timeout_add (2500, (GSourceFunc) idle_load_view, self);
}
static void
{
ModestWindowMgrPrivate *priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
if ((priv->cached_editor == NULL) && (priv->idle_load_editor_id == 0))
- priv->idle_load_editor_id = g_idle_add ((GSourceFunc) idle_load_editor, self);
+ priv->idle_load_editor_id = g_timeout_add (5000, (GSourceFunc) idle_load_editor, self);
}
static void
return FALSE;
} else {
priv->main_window = window;
- load_new_view (self);
- load_new_editor (self);
}
}
return TRUE;
}
+void
+modest_window_mgr_create_caches (ModestWindowMgr *mgr)
+{
+ MODEST_WINDOW_MGR_GET_CLASS (mgr)->create_caches (mgr);
+}
+
+static void
+modest_window_mgr_create_caches_default (ModestWindowMgr *self)
+{
+ load_new_editor (self);
+ load_new_view (self);
+}
+
static gboolean
tny_list_find (TnyList *list, GObject *item)
{
return account_ops;
}
+
ModestWindow * (*show_initial_window) (ModestWindowMgr *self);
ModestWindow * (*get_current_top) (ModestWindowMgr *self);
gboolean (*screen_is_on) (ModestWindowMgr *self);
+ void (*create_caches) (ModestWindowMgr *self);
/* Signals */
void (*window_list_empty) (ModestWindowMgr *self);
void (*progress_list_changed) (ModestWindowMgr *self);
gboolean modest_window_mgr_has_progress_operation_on_account (ModestWindowMgr *self,
const gchar *account_name);
+/**
+ * modest_window_mgr_create_caches:
+ * @self: a #ModestWindowMgr
+ *
+ * creates cached windows. This is called in modest main, just before the show-ui
+ * code. So it should be valid for the two startup ways (with --show-ui and without).
+ */
+void modest_window_mgr_create_caches (ModestWindowMgr *self);
+
G_END_DECLS
#endif /* __MODEST_WINDOW_MGR_H__ */