Continue grey out, same mailbox opened many times



Two things here:

1) While adding code to grey out buttons when no msg is selected, you might as
well grey out the "Continue" button if there are no messages to continue.

main-window.c:739 
end of enable_message_menus(LibBalsaMessage *message)
-----------------------------------------------------
  /* If draftbox is not open, open it to get a msg count */
  if (balsa_app.draftbox->open_ref == 0)
  {
     /* 
      * Need a better way to get a msg count from draftbox
      * without having to open the mailbox
      */
      balsa_window_open_mailbox (balsa_app.main_window, balsa_app.draftbox);
  }

  /* Check msg count in draftbox */
  if (balsa_app.draftbox && balsa_app.draftbox->total_messages > 0)
        gtk_widget_set_sensitive ( main_toolbar[TOOLBAR_CONTINUE_POS].widget, TRUE);
  else
        gtk_widget_set_sensitive ( main_toolbar[TOOLBAR_CONTINUE_POS].widget, FALSE);

Note:
 * enable_message_menus(NULL); needs to be called when a msg is postponed.

2) Also, you'll notice that if you keep selecting the "Continue" button while in
another mailbox, the draftbox is opened several times.  You can restrict this
by checking draftbox->open_ref's, but then it just doesn't open the mailbox
because there are only two paths to get to the draftbox: 
 - opening another draftbox
 - having a msg selected to continue
If you don't have a msg selected, and open_ref's is greater than zero, you just
want to change to the draftbox, not open another one...

main-window.c:
-----------
static void
continue_message_cb (GtkWidget * widget, gpointer data)
{
  GtkWidget *index;

  index = balsa_window_find_current_index (BALSA_WINDOW (data));
  if (index && BALSA_INDEX(index)->mailbox == balsa_app.draftbox)
     balsa_message_continue (widget, BALSA_INDEX(index) );
  else
     balsa_window_open_mailbox( BALSA_WINDOW(data), balsa_app.draftbox );
}

The real problem is that the balsa_window_open_mailbox(...) call will always
open up a new one, shoudl the definition be changed to...

main-window.c:
-----------
void balsa_window_open_mailbox(BalsaWindow *window, LibBalsaMailbox *mailbox)
{
  g_return_if_fail(window != NULL);
  g_return_if_fail(BALSA_IS_WINDOW(window));
  if (mailbox->open_ref == 0) 
      gtk_signal_emit(GTK_OBJECT(window), window_signals[OPEN_MAILBOX], mailbox);
  else 
      mblist_open_mailbox (mailbox);
}

These changes work great on my machine!  Let me know what you think...
-James

================================
  James A. Laska
  email: jal233@psu.edu
================================




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]