* only change the window title if the new title is different from
[modest] / src / modest-ui-actions.c
index 8d9161f..aae822b 100644 (file)
@@ -743,8 +743,7 @@ modest_ui_actions_compose_msg(ModestWindow *win,
        ModestAccountMgr *mgr = modest_runtime_get_account_mgr();
        ModestTnyAccountStore *store = modest_runtime_get_account_store();
 
-       if (win) account_name = g_strdup (modest_window_get_active_account (win));
-       if (!account_name) account_name = modest_account_mgr_get_default_account(mgr);
+       account_name = modest_account_mgr_get_default_account(mgr);
        if (!account_name) {
                g_printerr ("modest: no account found\n");
                goto cleanup;
@@ -1640,17 +1639,21 @@ new_messages_arrived (ModestMailOperation *self,
                      gpointer user_data)
 {
        GObject *source;
+       gboolean show_visual_notifications;
 
        source = modest_mail_operation_get_source (self);
-
-       /* Notify new messages have been downloaded. Do not notify if
-          the send&receive was invoked by the user, i.e, if the mail
-          operation has a source (the main window) */
-       if ((new_headers != NULL) && (tny_list_get_length (new_headers) > 0) && !source)
-               modest_platform_on_new_headers_received (new_headers);
-
+       show_visual_notifications = (source) ? FALSE : TRUE;
        if (source)
                g_object_unref (source);
+
+       /* Notify new messages have been downloaded. If the
+          send&receive was invoked by the user then do not show any
+          visual notification, only play a sound and activate the LED
+          (for the Maemo version) */
+       if ((new_headers != NULL) && (tny_list_get_length (new_headers) > 0))
+               modest_platform_on_new_headers_received (new_headers, 
+                                                        show_visual_notifications);
+
 }
 
 gboolean
@@ -3772,11 +3775,19 @@ modest_ui_actions_msg_edit_on_select_font (GtkAction *action,
        modest_msg_edit_window_select_font (window);
 }
 
+
 void
 modest_ui_actions_on_folder_display_name_changed (ModestFolderView *folder_view,
                                                  const gchar *display_name,
                                                  GtkWindow *window)
 {
+       /* don't update the display name if it was already set;
+        * updating the display name apparently is expensive */
+       const gchar* old_name = gtk_window_get_title (window);
+
+       if (old_name && display_name && strcmp (old_name, display_name) == 0)
+               return; /* don't do anything */
+
        /* This is usually used to change the title of the main window, which
         * is the one that holds the folder view. Note that this change can
         * happen even when the widget doesn't have the focus. */
@@ -3784,6 +3795,7 @@ modest_ui_actions_on_folder_display_name_changed (ModestFolderView *folder_view,
                gtk_window_set_title (window, display_name);
        else
                gtk_window_set_title (window, " ");
+
 }
 
 void