Startup strangeness

View: New views
17 Messages — Rating Filter:   Alert me  

Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Balsa 2.3.28 (although it was the same on several previous versions)  
balsa seems to have latched on to a particular mailbox to open at  
startup, no matter which one I'm in when I close, and whetner I close  
by closing the window or using Ctl-q.  "balsa -i" has no effect, and  
"balsa -o folder" gives me a popup 'Couldn't open mailbox "folder"' and  
I've tried several of my folders with the same result (all mbox  
format).  I'm on Gentoo Linux, and I can't find any mention of problems  
on their forum or bugzilla.

Any thoughts on how to troubleshoot or figure out what's going on?
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Pawel Salek-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 06/12/2009 10:52:33 PM, Jack Ostroff wrote:

> On Balsa 2.3.28 (although it was the same on several previous  
> versions) balsa seems to have latched on to a particular mailbox to  
> open at startup, no matter which one I'm in when I close, and whetner  
> I close by closing the window or using Ctl-q.  "balsa -i" has no  
> effect, and "balsa -o folder" gives me a popup 'Couldn't open mailbox  
> "folder"' and I've tried several of my folders with the same result  
> (all mbox format).  I'm on Gentoo Linux, and I can't find any mention  
> of problems on their forum or bugzilla.
>
> Any thoughts on how to troubleshoot or figure out what's going on?

What about Preferences/Startup/remember open mailboxes between  
sessions? Have you got it on?

This setting is saved as RememberOpenMailboxes in ~/.balsa/config

Pawel
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Pawel Salek-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 06/12/2009 10:52:33 PM, Jack Ostroff wrote:

> On Balsa 2.3.28 (although it was the same on several previous  
> versions) balsa seems to have latched on to a particular mailbox to  
> open at startup, no matter which one I'm in when I close, and whetner  
> I close by closing the window or using Ctl-q.  "balsa -i" has no  
> effect, and "balsa -o folder" gives me a popup 'Couldn't open mailbox  
> "folder"' and I've tried several of my folders with the same result  
> (all mbox format).  I'm on Gentoo Linux, and I can't find any mention  
> of problems on their forum or bugzilla.
>
> Any thoughts on how to troubleshoot or figure out what's going on?

There are three problems here:

1. the ordering of open mailboxes is not preserved.
2. -o option does not work as expected.
3. -i opens the inbox as far as I can see - but in your case, it is  
hidden by other open mailboxes...

Re 1: I have looked at the implementation. This changed order is a  
feature: the order in which the mailboxes are opened are determined by  
the iteration over a hash. Making the reopening code preserve the order  
as well requires some changes and understanding why less-than obvious  
way of storing the set of opened mailboxes is used... I am inclined  
actually to preserve only the most recently displayed mailbox, i.e. do  
not pre-open other mailboxes that were accessed recently. What do you  
think?

Re 2: Did you specify full URL of the mailbox, as described on the  
manual page (I can agree that specifying URLs is not exactly the  
obvious way but we could not think of better alternatives)...


Pawel
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009.06.14 13:24, Pawel Salek wrote:

> On 06/12/2009 10:52:33 PM, Jack Ostroff wrote:
>> On Balsa 2.3.28 (although it was the same on several previous  
>> versions) balsa seems to have latched on to a particular mailbox to  
>> open at startup, no matter which one I'm in when I close, and  
>> whetner I close by closing the window or using Ctl-q.  "balsa -i"  
>> has no effect, and "balsa -o folder" gives me a popup 'Couldn't open  
>> mailbox "folder"' and I've tried several of my folders with the same  
>> result (all mbox format).  I'm on Gentoo Linux, and I can't find any  
>> mention of problems on their forum or bugzilla.
>>
>> Any thoughts on how to troubleshoot or figure out what's going on?
>
> There are three problems here:
>
> 1. the ordering of open mailboxes is not preserved.
> 2. -o option does not work as expected.
> 3. -i opens the inbox as far as I can see - but in your case, it is  
> hidden by other open mailboxes...
>
> Re 1: I have looked at the implementation. This changed order is a  
> feature: the order in which the mailboxes are opened are determined  
> by the iteration over a hash. Making the reopening code preserve the  
> order as well requires some changes and understanding why less-than  
> obvious way of storing the set of opened mailboxes is used... I am  
> inclined actually to preserve only the most recently displayed  
> mailbox, i.e. do not pre-open other mailboxes that were accessed  
> recently. What do you think?
>
> Re 2: Did you specify full URL of the mailbox, as described on the  
> manual page (I can agree that specifying URLs is not exactly the  
> obvious way but we could not think of better alternatives)...
Ah - perhaps I really didn't explain properly.  My issue is really not  
which mailboxes are open, but which is the selected mailbox.  I have 33  
mbox mailboxes (including Inbox, Outbox, ...) tha largest is 22M, the  
rest well under 10M, and I keep them all open.  Startup is a few  
seconds at most - quite acceptable to me.  What I really want to  
control is which mailbox is displayed.  I would like it either to be  
the last selected one, or else the Inbox, but it always picks one  
called "house" alhtough I can't think of anything that distinguishes it  
from the others.

So - to your #1 - I don't really care about the order of opening them.  
However, if the one displayed is the last one opened, then I'd like it  
to just remember that one.  Perhaps -i would overwrite this and open  
Inbox last.

#2 no.  I just said "balsa -o balsa".  However, per your explanation, I  
don't think it would matter, since the mailbox IS open, just not  
selected.
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jack:

On 06/12/2009 04:52:33 PM Fri, Jack Ostroff wrote:

> On Balsa 2.3.28 (although it was the same on several previous versions)  
> balsa seems to have latched on to a particular mailbox to open at  
> startup, no matter which one I'm in when I close, and whetner I close by  
> closing the window or using Ctl-q.  "balsa -i" has no effect, and "balsa  
> -o folder" gives me a popup 'Couldn't open mailbox "folder"' and I've  
> tried several of my folders with the same result (all mbox format).  I'm  
> on Gentoo Linux, and I can't find any mention of problems on their forum  
> or bugzilla.
>
> Any thoughts on how to troubleshoot or figure out what's going on?
I just pushed to git-master some changes that should help.  Specifically,  
the mailbox that you are working in when you exit Balsa is the first  
opened when you restart it, and any others opened on restart will not  
flash by, so you can start work immediately.

If you don't have "View: Show Mailbox Tabs" checked, you might want to  
check it from time to time.  You may find that you're opening some  
mailboxes that haven't been used in a long time, which can only slow  
Balsa's response at open time.

Best,

Peter


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

attachment0 (197 bytes) Download Attachment

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009.09.11 20:11, Peter Bloomfield wrote:

> Hi Jack:
>
> On 06/12/2009 04:52:33 PM Fri, Jack Ostroff wrote:
>> On Balsa 2.3.28 (although it was the same on several previous  
>> versions) balsa seems to have latched on to a particular mailbox to  
>> open at startup, no matter which one I'm in when I close, and  
>> whetner I close by closing the window or using Ctl-q.  "balsa -i"  
>> has no effect, and "balsa -o folder" gives me a popup 'Couldn't open  
>> mailbox "folder"' and I've tried several of my folders with the same  
>> result (all mbox format).  I'm on Gentoo Linux, and I can't find any  
>> mention of problems on their forum or bugzilla.
>>
>> Any thoughts on how to troubleshoot or figure out what's going on?
>
> I just pushed to git-master some changes that should help.  
> Specifically, the mailbox that you are working in when you exit Balsa  
> is the first opened when you restart it, and any others opened on  
> restart will not flash by, so you can start work immediately.
>
> If you don't have "View: Show Mailbox Tabs" checked, you might want  
> to check it from time to time.  You may find that you're opening some  
> mailboxes that haven't been used in a long time, which can only slow  
> Balsa's response at open time.
>
> Best,
>
> Peter
I'll give it a try this week and let you know how it goes.  I generally  
stick to the Gentoo packaged version, so it may take me some reading to  
get connected to the git version.

Thanks.

Jack
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009.09.11 20:11, Peter Bloomfield wrote:

> Hi Jack:
>
> On 06/12/2009 04:52:33 PM Fri, Jack Ostroff wrote:
>> On Balsa 2.3.28 (although it was the same on several previous  
>> versions) balsa seems to have latched on to a particular mailbox to  
>> open at startup, no matter which one I'm in when I close, and  
>> whetner I close by closing the window or using Ctl-q.  "balsa -i"  
>> has no effect, and "balsa -o folder" gives me a popup 'Couldn't open  
>> mailbox "folder"' and I've tried several of my folders with the same  
>> result (all mbox format).  I'm on Gentoo Linux, and I can't find any  
>> mention of problems on their forum or bugzilla.
>>
>> Any thoughts on how to troubleshoot or figure out what's going on?
>
> I just pushed to git-master some changes that should help.  
> Specifically, the mailbox that you are working in when you exit Balsa  
> is the first opened when you restart it, and any others opened on  
> restart will not flash by, so you can start work immediately.
>
> If you don't have "View: Show Mailbox Tabs" checked, you might want  
> to check it from time to time.  You may find that you're opening some  
> mailboxes that haven't been used in a long time, which can only slow  
> Balsa's response at open time.
>
> Best,
>
> Peter

Thanks.  I finally got the git-master checked out and compiled.  The  
opening is certainly visually quieter (if that makes sense) - no  
flashing between open mailboxes.  However, it does not seem to remember  
which mailbox was the one displayed when I closed balsa.  (It IS  
supposed to do this, right?)  It also doesn't seem to remember the tab  
order of open mailboxes (if I drag a tab to a different position) but I  
don't know if it even tries to do that.  I'm not sure what order the  
tabs are in - but it's not alphabetical, and it seems to always display  
the mailbox on the first tab, with the exception that if I close Inbox  
before quitting, that is the last tab and the one displayed.  The -i  
tab seems irrelevant if it always opens the inbox.  The -o tab always  
says that it can't open that mailbox - even if that mailbox is already  
open (am I specifying the name incorrectly?).

Anything else I can test or try?

Jack
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Peter,

This is a follow-up/revision of my previous response to this.  I was  
going to response instead to your post with the original patch, since  
there were comments that explained some of the behavior better - but  
that was to me and balsa-maint, not the group.

First, now I understand that the order of tabs for the other open  
mailboxes is effectively random.  As a future enhancement, it would be  
nice if Balsa actually remembered the order - otherwise what is the  
point of being able to drag tabs to change the order?

The problem now is that it still does not seem to remember the last  
open mailbox.  I see "CurrentMailboxURL=" in the config file, but never  
with any value.  If the Inbox is open, that is what is displayed,  
whether or not the "open inbox on startup" is checked or not.  It is  
also displayed even if it was not open, if "open inbox on startup" IS  
checked.  If Inbox is not open, and not opened on startup, I can't tell  
how it chooses which mailbox to display.

However - only the one mailbox is displayed.  The other open mailboxes  
are opened without being displayed - so the startup appears much  
smoother, without the flickering.

Is there anything else I can test to help track down the problem?

Jack

On 2009.09.11 20:11, Peter Bloomfield wrote:

> Hi Jack:
>
> On 06/12/2009 04:52:33 PM Fri, Jack Ostroff wrote:
>> On Balsa 2.3.28 (although it was the same on several previous  
>> versions) balsa seems to have latched on to a particular mailbox to  
>> open at startup, no matter which one I'm in when I close, and  
>> whetner I close by closing the window or using Ctl-q.  "balsa -i"  
>> has no effect, and "balsa -o folder" gives me a popup 'Couldn't open  
>> mailbox "folder"' and I've tried several of my folders with the same  
>> result (all mbox format).  I'm on Gentoo Linux, and I can't find any  
>> mention of problems on their forum or bugzilla.
>>
>> Any thoughts on how to troubleshoot or figure out what's going on?
>
> I just pushed to git-master some changes that should help.  
> Specifically, the mailbox that you are working in when you exit Balsa  
> is the first opened when you restart it, and any others opened on  
> restart will not flash by, so you can start work immediately.
>
> If you don't have "View: Show Mailbox Tabs" checked, you might want  
> to check it from time to time.  You may find that you're opening some  
> mailboxes that haven't been used in a long time, which can only slow  
> Balsa's response at open time.
>
> Best,
>
> Peter

------quoted attachment------
> _______________________________________________
> balsa-list mailing list
> balsa-list@...
> http://mail.gnome.org/mailman/listinfo/balsa-list
>
>
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jack!

On 09/21/2009 06:23:26 PM Mon, Jack Ostroff wrote:

> Peter,
>
> This is a follow-up/revision of my previous response to this.  I was  
> going to response instead to your post with the original patch, since  
> there were comments that explained some of the behavior better - but  
> that was to me and balsa-maint, not the group.
>
> First, now I understand that the order of tabs for the other open  
> mailboxes is effectively random.  As a future enhancement, it would be  
> nice if Balsa actually remembered the order - otherwise what is the  
> point of being able to drag tabs to change the order?
Yes, it would; as it stands, it's just for the current session.  That's  
still worth something: if you have many mailboxes open and some scroll out  
of the window, you can drag the most interesting ones to the left and see  
all their tabs.  But remembering the order would let you establish a  
favorite order and be sure of seeing it.

> The problem now is that it still does not seem to remember the last open  
> mailbox.  I see "CurrentMailboxURL=" in the config file, but never with  
> any value.

I'm puzzled by "CurrentMailboxURL=".  I get that only if I manually close  
all mailboxes before quitting.  Perhaps Balsa is closing them all before  
saving the info to the config file--but I don't know how that would happen!

> If the Inbox is open, that is what is displayed, whether or not the  
> "open inbox on startup" is checked or not.  It is also displayed even if  
> it was not open, if "open inbox on startup" IS checked.  If Inbox is not  
> open, and not opened on startup, I can't tell how it chooses which  
> mailbox to display.

As it stands, "open inbox on startup" trumps the current mailbox code.  It  
runs after the task for "remember open mailboxes", and forces a  
switch-page to the inbox.  That was an oversight--but I guess it might  
also be the preferred action for a use who sets both options.

I'm not sure why Inbox is always the visible mailbox.  Perhaps it's always  
the first mailbox in the list of open mailboxes--that's the one that's  
shown by the "remember open mailboxes" code; when CurrentMailboxURL is set  
to something non-NULL, it gets forced to the front of the list and hence  
is (supposed to be) shown.

> However - only the one mailbox is displayed.  The other open mailboxes  
> are opened without being displayed - so the startup appears much  
> smoother, without the flickering.

Good--that's how it's supposed to work!

> Is there anything else I can test to help track down the problem?

Keep watching CurrentMailboxURL in your config file--at some point it  
should start being non-NULL, and then you should see the correct mailbox  
at start-up.

BTW: the -o option requires a full mailbox URL, not just a name--is that  
the issue?

Peter


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

attachment0 (197 bytes) Download Attachment

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As Alice said: Curiouser and curiouser.

On 2009.09.22 09:00, Peter Bloomfield wrote:

> On 09/21/2009 06:23:26 PM Mon, Jack Ostroff wrote:
>> This is a follow-up/revision of my previous response to this.  I was  
>> going to response instead to your post with the original patch,  
>> since there were comments that explained some of the behavior better  
>> - but that was to me and balsa-maint, not the group.
>>
>> First, now I understand that the order of tabs for the other open  
>> mailboxes is effectively random.  As a future enhancement, it would  
>> be nice if Balsa actually remembered the order - otherwise what is  
>> the point of being able to drag tabs to change the order?
> Yes, it would; as it stands, it's just for the current session.  
> That's still worth something: if you have many mailboxes open and  
> some scroll out of the window, you can drag the most interesting ones  
> to the left and see all their tabs.  But remembering the order would  
> let you establish a favorite order and be sure of seeing it.
>
>> The problem now is that it still does not seem to remember the last  
>> open mailbox.  I see "CurrentMailboxURL=" in the config file, but  
>> never with any value.
> I'm puzzled by "CurrentMailboxURL=".  I get that only if I manually  
> close all mailboxes before quitting.  Perhaps Balsa is closing them  
> all before saving the info to the config file--but I don't know how  
> that would happen!
I don't think it's closing them, because it's correctly remembering  
that they were open.  However, I have not yet seen any value for this  
string, and I've tried with various numbers of mailboxes left open.

>
>> If the Inbox is open, that is what is displayed, whether or not the  
>> "open inbox on startup" is checked or not.  It is also displayed  
>> even if it was not open, if "open inbox on startup" IS checked.  If  
>> Inbox is not open, and not opened on startup, I can't tell how it  
>> chooses which mailbox to display.
>
> As it stands, "open inbox on startup" trumps the current mailbox  
> code.  It runs after the task for "remember open mailboxes", and  
> forces a switch-page to the inbox.  That was an oversight--but I  
> guess it might also be the preferred action for a use who sets both  
> options.
Perhaps if "open inbox on startup" but not if that is not set and the  
Inbox just happens to be open.

> I'm not sure why Inbox is always the visible mailbox.  Perhaps it's  
> always the first mailbox in the list of open mailboxes--that's the  
> one that's shown by the "remember open mailboxes" code; when  
> CurrentMailboxURL is set to something non-NULL, it gets forced to the  
> front of the list and hence is (supposed to be) shown.
I have yet to figure out how it chooses which mailbox to display.  It  
is NOT consistantly the first or last mailbox marked as open in the  
config file.  (I am assuming that is done by the "Open=true' in the  
viewByUrl-file section for that mailbox, since the OpenMailboxes= seems  
to list the URL for every mailbox, not just the open ones.

>
>> However - only the one mailbox is displayed.  The other open  
>> mailboxes are opened without being displayed - so the startup  
>> appears much smoother, without the flickering.
> Good--that's how it's supposed to work!
>
>> Is there anything else I can test to help track down the problem?
> Keep watching CurrentMailboxURL in your config file--at some point it  
> should start being non-NULL, and then you should see the correct  
> mailbox at start-up.
I have not yet seen it non-NULL, which does seem strange.  Am I the  
only one having this problem?

> BTW: the -o option requires a full mailbox URL, not just a name--is  
> that the issue?
I finally figured that out, while trying various -o options.  That was  
getting the "couldn't find" messages.  I don't think it's part of the  
main issue here.

I'm also still curious about something I mentioned in an email  
off-list:  in main-window.c, in the function  
bw_notebook_switch_page_cb, the last two lines are
    g_free(balsa_app.current_mailbox_url);
    balsa_app.current_mailbox_url = g_strdup(mailbox->url);
Am I missing someting, or is it strange to set a value right after you  
have freed it?

I wonder if I would find anything by running balsa under a debugger,  
and putting a trace on balsa_app.current_mailbox_url.

Jack
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 09/22/2009 07:07:51 PM Tue, Jack wrote:
> As Alice said: Curiouser and curiouser.

Indeed!

> On 2009.09.22 09:00, Peter Bloomfield wrote:
>> On 09/21/2009 06:23:26 PM Mon, Jack Ostroff wrote:
[ snip ]
>> As it stands, "open inbox on startup" trumps the current mailbox code.  
>> It runs after the task for "remember open mailboxes", and forces a  
>> switch-page to the inbox.  That was an oversight--but I guess it might  
>> also be the preferred action for a use who sets both options.

> Perhaps if "open inbox on startup" but not if that is not set and the  
> Inbox just happens to be open.

Nah--it really was an oversight.  Anyone would expect the combination of  
"remember open mailboxes" and "open inbox on startup" to mean "add inbox  
to the list of open mailboxes, even if it wasn't"!  I'll fix it...

>> I'm not sure why Inbox is always the visible mailbox.  Perhaps it's  
>> always the first mailbox in the list of open mailboxes--that's the one  
>> that's shown by the "remember open mailboxes" code; when  
>> CurrentMailboxURL is set to something non-NULL, it gets forced to the  
>> front of the list and hence is (supposed to be) shown.

> I have yet to figure out how it chooses which mailbox to display.  It is  
> NOT consistently the first or last mailbox marked as open in the config  
> file.  (I am assuming that is done by the "Open=true' in the  
> viewByUrl-file section for that mailbox, since the OpenMailboxes= seems  
> to list the URL for every mailbox, not just the open ones.

??  Current code doesn't use "OpenMailboxes" (except as a substring of  
"RememberOpenMailboxes").  That must be a leftover from way back :)

Yes, it's   "Open=true" in the viewByUrl-file section that Balsa currently  
uses to track open mailboxes.  The list is put together by traversing the  
internal representation of the folder tree and noting which mailboxes have  
"Open=true", so the order is determined by all sorts of file-system  
issues, and network latency if you have IMAP folders.  But having Inbox  
first may be a sure thing.

[ snip ]
> I'm also still curious about something I mentioned in an email  
> off-list:  in main-window.c, in the function bw_notebook_switch_page_cb,  
> the last two lines are
>    g_free(balsa_app.current_mailbox_url);
>    balsa_app.current_mailbox_url = g_strdup(mailbox->url);
> Am I missing something, or is it strange to set a value right after you  
> have freed it?

That's just Balsa keeping track of the currently visible mailbox, using  
its own allocated copy of the URL: deallocate the memory holding the  
string identifying the previous mailbox, allocate memory for the URL of  
the new mailbox, and save it in BalsaApp.

> I wonder if I would find anything by running balsa under a debugger, and  
> putting a trace on balsa_app.current_mailbox_url.

Yes, that would be really helpful!  It /should/ be set each time you  
select a new mailbox, and then saved in the config file on exit.  If you  
apply the attached patch, it should save you the trouble--it'll record  
changes on the console, and also the value that gets saved to the config  
file.  It also fixes the "open inbox on startup" oversight and puts  
mailboxes listed with "-o" on the same footing as remembered open  
mailboxes, which might fix some of the issues you're seeing.

Thanks for helping out with this one!

Peter

[remember-open-mailboxes-debug-patch]

diff --git a/src/balsa-app.c b/src/balsa-app.c
index 1330d44..3c08313 100644
--- a/src/balsa-app.c
+++ b/src/balsa-app.c
@@ -518,11 +518,40 @@ append_url_if_open(const gchar * url, LibBalsaMailboxView * view,
     }
 }
 
+static void
+open_mailbox_by_url(const gchar * url)
+{
+    LibBalsaMailbox *mailbox;
+
+    mailbox = balsa_find_mailbox_by_url(url);
+    if (balsa_app.debug)
+        fprintf(stderr, "open_mailboxes_idle_cb: opening %s => %p..\n",
+                url, mailbox);
+    if (mailbox)
+        /* The first mailbox we open will be shown; later mailboxes will
+         * have notebook pages, but will not be shown. */
+        balsa_mblist_open_mailbox_hidden(mailbox);
+    else {
+        /* Do not try to open it next time. */
+        LibBalsaMailboxView *view =
+            g_hash_table_lookup(libbalsa_mailbox_view_table, url);
+        /* The mailbox may have been requested to be open because its
+         * stored view might say so or the user requested it from the
+         * command line - in which case, view may or may not be present.
+         * We will be careful here. */
+        if (view) {
+            view->open = FALSE;
+            view->in_sync = FALSE;
+        }
+        balsa_information(LIBBALSA_INFORMATION_WARNING,
+                          _("Couldn't open mailbox \"%s\""), url);
+    }
+}
+
 gboolean
 open_mailboxes_idle_cb(gchar ** urls)
 {
     gchar **tmp;
-    LibBalsaMailbox *mbox;
 
     gdk_threads_enter();
 
@@ -534,38 +563,18 @@ open_mailboxes_idle_cb(gchar ** urls)
             return FALSE;
         }
 
-        str = g_string_new(balsa_app.current_mailbox_url);
+        str = g_string_new(NULL);
         g_hash_table_foreach(libbalsa_mailbox_view_table,
                              (GHFunc) append_url_if_open, str);
         urls = g_strsplit(str->str, ";", 0);
         g_string_free(str, TRUE);
     }
 
-    for (tmp = urls; *tmp; ++tmp) {
-        mbox = balsa_find_mailbox_by_url(*tmp);
- if (balsa_app.debug)
-    fprintf(stderr, "open_mailboxes_idle_cb: opening %s => %p..\n",
-    *tmp, mbox);
- if (mbox)
-            /* The first mailbox we open will be shown; the others will
-             * have notebook pages, but will not be shown. */
-    balsa_mblist_open_mailbox_hidden(mbox);
-        else {
-    /* Do not try to open it next time. */
-    LibBalsaMailboxView *view =
- g_hash_table_lookup(libbalsa_mailbox_view_table, *tmp);
-            /* The mailbox may have bee requested to be open because
-               its stored view might say so or the user requested it
-               from the command line - in which case, view may or may
-               not be present. We will be careful here. */
-            if(view) {
-                view->open = FALSE;
-                view->in_sync = FALSE;
-            }
-            balsa_information(LIBBALSA_INFORMATION_WARNING,
-                              _("Couldn't open mailbox \"%s\""), *tmp);
- }
-    }
+    open_mailbox_by_url(balsa_app.current_mailbox_url);
+
+    for (tmp = urls; *tmp; ++tmp)
+        open_mailbox_by_url(*tmp);
+
     g_strfreev(urls);
 
     gdk_threads_leave();
diff --git a/src/main-window.c b/src/main-window.c
index 2e4cd1b..fcbc016 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2450,8 +2450,10 @@ balsa_window_real_close_mbnode(BalsaWindow * window,
             /* Just in case... */
             g_object_set_data(G_OBJECT(window), BALSA_INDEX_GRAB_FOCUS, NULL);
 
+g_print("%s from %s", __func__, balsa_app.current_mailbox_url);
             g_free(balsa_app.current_mailbox_url);
             balsa_app.current_mailbox_url = NULL;
+g_print(" to NULL\n");
         }
     }
 
@@ -4731,8 +4733,10 @@ bw_notebook_switch_page_cb(GtkWidget * notebook,
     bw_enable_part_menu_items(window);
 #endif /*ENABLE_TOUCH_UI */
 
+g_print("%s from %s", __func__, balsa_app.current_mailbox_url);
     g_free(balsa_app.current_mailbox_url);
     balsa_app.current_mailbox_url = g_strdup(mailbox->url);
+g_print(" to %s\n", balsa_app.current_mailbox_url);
 }
 
 static void
diff --git a/src/main.c b/src/main.c
index cef3448..7f7be0c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -723,7 +723,7 @@ initial_open_inbox()
 
     printf("opening %s..\n", balsa_app.inbox->name);
     gdk_threads_enter();
-    balsa_mblist_open_mailbox(balsa_app.inbox);
+    balsa_mblist_open_mailbox_hidden(balsa_app.inbox);
     gdk_threads_leave();
     
     return FALSE;
diff --git a/src/save-restore.c b/src/save-restore.c
index 7a32df9..d5e4ade 100644
--- a/src/save-restore.c
+++ b/src/save-restore.c
@@ -1448,6 +1448,7 @@ config_save(void)
 
     libbalsa_conf_set_bool("RememberOpenMailboxes",
   balsa_app.remember_open_mboxes);
+g_print("%s saving CurrentMailboxURL = %s\n", __func__, balsa_app.current_mailbox_url);
     libbalsa_conf_set_string("CurrentMailboxURL",
                              balsa_app.current_mailbox_url);
 




_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

attachment0 (197 bytes) Download Attachment

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009.09.22 19:53, Peter Bloomfield wrote:
> On 09/22/2009 07:07:51 PM Tue, Jack wrote:
[snipped most]

>> I wonder if I would find anything by running balsa under a debugger,  
>> and putting a trace on balsa_app.current_mailbox_url.
>
> Yes, that would be really helpful!  It /should/ be set each time you  
> select a new mailbox, and then saved in the config file on exit.  If  
> you apply the attached patch, it should save you the trouble--it'll  
> record changes on the console, and also the value that gets saved to  
> the config file.  It also fixes the "open inbox on startup" oversight  
> and puts mailboxes listed with "-o" on the same footing as remembered  
> open mailboxes, which might fix some of the issues you're seeing.
>
> Thanks for helping out with this one!

Patch applied with no problems.  Calling balsa from command line with  
no options or parameters first gives a popup 'Couldn't open mailbox  
""', which I suppose is due to the "CurrentMailboxURL=".

Terminal shows:
   bw_notebook_switch_page_cb from  to file:///var/mail/jack
   balsa_window_real_close_mbnode from file:///var/mail/jack to NULL
   config_save saving CurrentMailboxURL = (null)
which shows opening the inbox and then it seems something is forgetting  
the current mailbox before saving it when I exit (either with File/Quit  
or just closing the window).

Jack
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 23, 2009, at  1:58 PM, Jack wrote:
[snipped more]
> Patch applied with no problems.  Calling balsa from command line with no  
> options or parameters first gives a popup 'Couldn't open mailbox ""',  
> which I suppose is due to the "CurrentMailboxURL=".

Yes--shoulda skipped that when it's missing!

> Terminal shows:
>   bw_notebook_switch_page_cb from  to file:///var/mail/jack
>   balsa_window_real_close_mbnode from file:///var/mail/jack to NULL
>   config_save saving CurrentMailboxURL = (null)
> which shows opening the inbox and then it seems something is forgetting  
> the current mailbox before saving it when I exit (either with File/Quit  
> or just closing the window).

So the last two lines appear when you exit?  Somehow the processes  
involved in exiting seem to be carried out in a different order on your  
box from mine.

A simple fix would be to remove the code that clears  
balsa_app.current_mailbox_url in balsa_window_real_close_mbnode, although  
that would mean a small change in behavior: on restart, Balsa would show  
the last mailbox used, even if the user had closed them all before  
exiting--but that could always be documented as a design decision!

Peter


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

attachment0 (197 bytes) Download Attachment

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009.09.23 15:20, Peter Bloomfield wrote:
> On Sep 23, 2009, at  1:58 PM, Jack wrote:
[snipped even more]

>> Terminal shows:
>>   bw_notebook_switch_page_cb from  to file:///var/mail/jack
>>   balsa_window_real_close_mbnode from file:///var/mail/jack to NULL
>>   config_save saving CurrentMailboxURL = (null)
>> which shows opening the inbox and then it seems something is  
>> forgetting the current mailbox before saving it when I exit (either  
>> with File/Quit or just closing the window).
>
> So the last two lines appear when you exit?  Somehow the processes  
> involved in exiting seem to be carried out in a different order on  
> your box from mine.
Yes.  Is it worth figuring out what the difference is either in actual  
behavior or in the cause, or is it probably too convoluted and not  
worth the effort?
>
> A simple fix would be to remove the code that clears  
> balsa_app.current_mailbox_url in balsa_window_real_close_mbnode,  
> although that would mean a small change in behavior: on restart,  
> Balsa would show the last mailbox used, even if the user had closed  
> them all before exiting--but that could always be documented as a  
> design decision!

Wouldn't balsa_app.current_mailbox_url get cleared anyway when the user  
explicitly closes the last mailbox?

Can balsa tell whether it's trying to close the window due to explicit  
user action or program exit?

Anyway, that's probably a reasonable approach - and how often would  
someone close all mailboxes before exiting, but having "open inbox on  
startup" set so the inbox would be displayed anyway?  Actually, in that  
case, would the last viewed mailbox also get opened?  That might seem a  
bit stranger than simply not having Balsa ever start up without opening  
at least one mailbox.
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

Re: Startup strangeness

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sep 23, 2009, at  3:34 PM, Jack wrote:

> On 2009.09.23 15:20, Peter Bloomfield wrote:
>> On Sep 23, 2009, at  1:58 PM, Jack wrote:
> [snipped even more]
>>> Terminal shows:
>>>   bw_notebook_switch_page_cb from  to file:///var/mail/jack
>>>   balsa_window_real_close_mbnode from file:///var/mail/jack to NULL
>>>   config_save saving CurrentMailboxURL = (null)
>>> which shows opening the inbox and then it seems something is  
>>> forgetting the current mailbox before saving it when I exit (either  
>>> with File/Quit or just closing the window).
>>
>> So the last two lines appear when you exit?  Somehow the processes  
>> involved in exiting seem to be carried out in a different order on your  
>> box from mine.
> Yes.  Is it worth figuring out what the difference is either in actual  
> behavior or in the cause, or is it probably too convoluted and not worth  
> the effort?
:)  I'll take a quick look, and if any obvious leads jump out I'll follow  
them.  But time isn't unlimited...

>> A simple fix would be to remove the code that clears  
>> balsa_app.current_mailbox_url in balsa_window_real_close_mbnode,  
>> although that would mean a small change in behavior: on restart, Balsa  
>> would show the last mailbox used, even if the user had closed them all  
>> before exiting--but that could always be documented as a design  
>> decision!
>
> Wouldn't balsa_app.current_mailbox_url get cleared anyway when the user  
> explicitly closes the last mailbox?

No--the main place where balsa_app.current_mailbox_url gets updated is  
when the user *switches* notebook tabs (= mailboxes).  If a mailbox is  
closed when others are open, it results in a switch to one of them, so the  
change is noted.  But when the last mailbox is closed, there's no switch,  
so balsa_app.current_mailbox_url stays pointing to that last mailbox.  The  
code in balsa_window_real_close_mbnode was put in specifically to catch  
that event.

> Can balsa tell whether it's trying to close the window due to explicit  
> user action or program exit?

I'm not sure how reliably it can tell the difference :(

> Anyway, that's probably a reasonable approach - and how often would  
> someone close all mailboxes before exiting, but having "open inbox on  
> startup" set so the inbox would be displayed anyway?

:)

> Actually, in that case, would the last viewed mailbox also get opened?  
> That might seem a bit stranger than simply not having Balsa ever start  
> up without opening at least one mailbox.

I guess the philosophy should be that CurrentMailboxURL has an effect only  
when "remember open mailboxes" is set (or the -o | --open-mailbox= command  
line option is used).  So no, if "open inbox on startup" is set but  
"remember open mailboxes" isn't, then only the inbox is opened (or should  
be--I haven't checked the patch to see if that's how it currently works!).

But your last point is a good one.  If *neither* is set, should Balsa open  
anything, and if so, which?  Inbox or last viewed?  Currently (w/o the  
patch, that is), it's nothing.

Best,

Peter


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

attachment0 (197 bytes) Download Attachment

Re: Startup strangeness

by Peter Bloomfield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 09/23/2009 01:58:55 PM Wed, Jack wrote:
[ snip ]
> Terminal shows:
>   bw_notebook_switch_page_cb from  to file:///var/mail/jack
>   balsa_window_real_close_mbnode from file:///var/mail/jack to NULL
>   config_save saving CurrentMailboxURL = (null)
> which shows opening the inbox and then it seems something is forgetting  
> the current mailbox before saving it when I exit (either with File/Quit  
> or just closing the window).

OK, I see that now!  I'd been testing those changes with an IMAP mailbox  
open, and closing that seems to take long enough that the config gets  
saved before CurrentMailboxURL gets cleared.  If the IMAP mailbox isn't  
open when I quit, it happens in the order you've been seeing.

I just removed the two lines that clear CurrentMailboxURL when the last  
mailbox is closed.  If no mailbox was open when Balsa was closed, no  
mailbox is opened on startup (unless "open inbox" is checked, of course).

Thanks for staying with this!

Peter


_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list

attachment0 (197 bytes) Download Attachment

Re: Startup strangeness

by Jack Ostroff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 2009.09.24 07:33, Peter Bloomfield wrote:

> On 09/23/2009 01:58:55 PM Wed, Jack wrote:
> [ snip ]
>> Terminal shows:
>>   bw_notebook_switch_page_cb from  to file:///var/mail/jack
>>   balsa_window_real_close_mbnode from file:///var/mail/jack to NULL
>>   config_save saving CurrentMailboxURL = (null)
>> which shows opening the inbox and then it seems something is  
>> forgetting the current mailbox before saving it when I exit (either  
>> with File/Quit or just closing the window).
>
> OK, I see that now!  I'd been testing those changes with an IMAP  
> mailbox open, and closing that seems to take long enough that the  
> config gets saved before CurrentMailboxURL gets cleared.  If the IMAP  
> mailbox isn't open when I quit, it happens in the order you've been  
> seeing.
>
> I just removed the two lines that clear CurrentMailboxURL when the  
> last mailbox is closed.  If no mailbox was open when Balsa was  
> closed, no mailbox is opened on startup (unless "open inbox" is  
> checked, of course).
>
> Thanks for staying with this!

I only have local mbox and maildir mailboxes, so everything happens  
pretty quickly for me.

Thanks for being puzzled enough to track it down.
_______________________________________________
balsa-list mailing list
balsa-list@...
http://mail.gnome.org/mailman/listinfo/balsa-list