peter newton cx, pavlov netscape com



Hey there,

I finally got it working. The included patch provides an extended context menu
which has been got to run by providing a new set of functions:

balsa_message_new, balsa_message_reply etc. (see balsa-index-page.h for details)

These have the calling widget as well as the related index page (clist) as parameters
I added those functions to balsa-index-page.c as I did not know where to put them
instead. In addition I reworked the functionality for setting status which is
actually commented out as it is only partially working - if you want to have a
look uncomment the related lines in balsa-index-page.c:create_menu.

Um and yeah, I also added macros for debugs and debug messages which reside in main-window.h and look like this:

BALSA_DEBUG prints: [time] file | function | line 
BALSA_DEBUG_MSG (msg) prints: [time] file | function | line: message

Have fun with it. 

Peter: could you test it and in case its working add it to cvs? Thanks

-Knut

--------------------------------------------------------------------------------
Knut Neumann                                     knut.neumann@uni-duesseldorf.de
--------------------------------------------------------------------------------
diff -ur balsa/src/balsa-index-page.c balsa.mine/src/balsa-index-page.c
--- balsa/src/balsa-index-page.c	Mon Dec 13 19:23:25 1999
+++ balsa.mine/src/balsa-index-page.c	Wed Dec 15 00:21:53 1999
@@ -71,8 +71,6 @@
 static void message_status_set_answered_cb (GtkWidget *, Message *);
 #endif
 
-static void delete_message_cb (GtkWidget *, BalsaIndex *);
-static void undelete_message_cb (GtkWidget *, BalsaIndex *);
 static void transfer_messages_cb (BalsaMBList *, Mailbox *, GtkCTreeNode *, GdkEventButton *, BalsaIndex *);
 
 
@@ -374,71 +372,113 @@
   }
 }
 
+
 /*
  * CLIST Callbacks
  */
+static void
+message_status_set_new_cb (GtkWidget * widget, BalsaIndex *bindex)
+{
+  GList *list;
+  Message *message;
+
+  g_return_if_fail (widget != NULL);
+ 
+  list = GTK_CLIST (bindex)->selection;
+
+  while (list)
+    {
+      message = gtk_clist_get_row_data (GTK_CLIST (bindex), 
+      					GPOINTER_TO_INT (list->data));
+      message_unread (message);
+      list = list->next;
+    }    	   
+}
+
+static void
+message_status_set_read_cb (GtkWidget * widget, BalsaIndex *bindex)
+{
+  GList *list;
+  Message *message;
+
+  g_return_if_fail (widget != NULL);
+ 
+  list = GTK_CLIST (bindex)->selection;
+
+  while (list)
+    {
+      message = gtk_clist_get_row_data (GTK_CLIST (bindex), 
+      					GPOINTER_TO_INT (list->data));
+      message_read (message);
+      list = list->next;
+    }
+}
+
+static void
+message_status_set_answered_cb (GtkWidget * widget, BalsaIndex *bindex)
+{
+  GList *list;
+  Message *message;
+
+  g_return_if_fail (widget != NULL);
+ 
+  list = GTK_CLIST (bindex)->selection;
+
+  while (list)
+    {
+      message = gtk_clist_get_row_data (GTK_CLIST (bindex), 
+      					GPOINTER_TO_INT (list->data));
+      message_reply (message);
+      list = list->next;
+    }
+}
+
 static GtkWidget *
 create_menu (BalsaIndex * bindex)
 {
   GtkWidget *menu, *menuitem, *submenu, *smenuitem;
   GtkWidget *bmbl;
 
+  BALSA_DEBUG ();
+  
   menu = gtk_menu_new ();
-  menuitem = gtk_menu_item_new_with_label (_ ("Transfer"));
-
-  submenu = gtk_menu_new ();
-  smenuitem = gtk_menu_item_new ();
-  bmbl = balsa_mblist_new ();
-  gtk_signal_connect (GTK_OBJECT (bmbl), "select_mailbox",
-		      (GtkSignalFunc) transfer_messages_cb,
-		      (gpointer) bindex);
-
-  gtk_widget_set_usize (GTK_WIDGET (bmbl), balsa_app.mblist_width, -1);
   
-  gtk_container_add (GTK_CONTAINER (smenuitem), bmbl);
-  gtk_menu_append (GTK_MENU (submenu), smenuitem);
-  gtk_widget_show (bmbl);
-  gtk_widget_show (smenuitem);
-
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+  menuitem = gnome_stock_menu_item (GNOME_STOCK_MENU_MAIL_NEW, _ ("New"));
+  gtk_signal_connect (GTK_OBJECT (menuitem),
+		      "activate",
+		      (GtkSignalFunc) balsa_message_new,
+		      NULL);
   gtk_menu_append (GTK_MENU (menu), menuitem);
   gtk_widget_show (menuitem);
 
-#if 0				/* FIXME */
-  menuitem = gtk_menu_item_new_with_label (_ ("Change Status"));
-
-  submenu = gtk_menu_new ();
-  smenuitem = gtk_menu_item_new_with_label (_ ("Unread"));
-  gtk_signal_connect (GTK_OBJECT (smenuitem), "activate",
-		      (GtkSignalFunc) message_status_set_new_cb, message);
-  gtk_menu_append (GTK_MENU (submenu), smenuitem);
-  gtk_widget_show (smenuitem);
-
-  smenuitem = gtk_menu_item_new_with_label (_ ("Read"));
-  gtk_signal_connect (GTK_OBJECT (smenuitem), "activate",
-		      (GtkSignalFunc) message_status_set_read_cb, message);
-  gtk_menu_append (GTK_MENU (submenu), smenuitem);
-  gtk_widget_show (smenuitem);
-
-  smenuitem = gtk_menu_item_new_with_label (_ ("Replied"));
-  gtk_signal_connect (GTK_OBJECT (smenuitem), "activate",
-		   (GtkSignalFunc) message_status_set_answered_cb, message);
-  gtk_menu_append (GTK_MENU (submenu), smenuitem);
-  gtk_widget_show (smenuitem);
+  menuitem = gnome_stock_menu_item (GNOME_STOCK_MENU_MAIL_RPL, _ ("Reply"));
+  gtk_signal_connect (GTK_OBJECT (menuitem),
+		      "activate",
+		      (GtkSignalFunc) balsa_message_reply,
+		      bindex);
+  gtk_menu_append (GTK_MENU (menu), menuitem);
+  gtk_widget_show (menuitem);
 
-  smenuitem = gtk_menu_item_new_with_label (_ ("Forwarded"));
-  gtk_menu_append (GTK_MENU (submenu), smenuitem);
-  gtk_widget_show (smenuitem);
+  menuitem = gnome_stock_menu_item (GNOME_STOCK_MENU_MAIL_RPL, _ ("Reply to all"));
+  gtk_signal_connect (GTK_OBJECT (menuitem),
+		      "activate",
+		      (GtkSignalFunc) balsa_message_replytoall,
+		      bindex);
+  gtk_menu_append (GTK_MENU (menu), menuitem);
+  gtk_widget_show (menuitem);
 
-  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+  menuitem = gnome_stock_menu_item (GNOME_STOCK_MENU_MAIL_FWD, _ ("Forward"));
+  gtk_signal_connect (GTK_OBJECT (menuitem),
+		      "activate",
+		      (GtkSignalFunc) balsa_message_forward,
+		      bindex);
   gtk_menu_append (GTK_MENU (menu), menuitem);
   gtk_widget_show (menuitem);
 
-#endif
   menuitem = gnome_stock_menu_item (GNOME_STOCK_MENU_TRASH, _ ("Delete"));
   gtk_signal_connect (GTK_OBJECT (menuitem),
 		      "activate",
-		      (GtkSignalFunc) delete_message_cb,
+		      (GtkSignalFunc) balsa_message_delete,
 		      bindex);
   gtk_menu_append (GTK_MENU (menu), menuitem);
   gtk_widget_show (menuitem);
@@ -446,42 +486,60 @@
   menuitem = gnome_stock_menu_item (GNOME_STOCK_MENU_UNDELETE, _ ("Undelete"));
   gtk_signal_connect (GTK_OBJECT (menuitem),
 		      "activate",
-		      (GtkSignalFunc) undelete_message_cb,
+		      (GtkSignalFunc) balsa_message_undelete,
 		      bindex);
   gtk_menu_append (GTK_MENU (menu), menuitem);
   gtk_widget_show (menuitem);
 
-  return menu;
-}
-
-#ifdef MSG_STATUS_USED
-static void
-message_status_set_new_cb (GtkWidget * widget, Message * message)
-{
-  g_return_if_fail (widget != NULL);
-
-  message_unread (message);
-  /* balsa_index_select_next (BALSA_INDEX (mainwindow->index)); */
-}
+  menuitem = gtk_menu_item_new_with_label (_ ("Transfer"));
+  submenu = gtk_menu_new ();
+  smenuitem = gtk_menu_item_new ();
+  bmbl = balsa_mblist_new ();
+  gtk_signal_connect (GTK_OBJECT (bmbl), "select_mailbox",
+		      (GtkSignalFunc) transfer_messages_cb,
+		      (gpointer) bindex); 
+ 
+  gtk_widget_set_usize (GTK_WIDGET (bmbl), balsa_app.mblist_width, -1);
+  gtk_container_add (GTK_CONTAINER (smenuitem), bmbl);
+  gtk_menu_append (GTK_MENU (submenu), smenuitem);
+  gtk_widget_show (bmbl);
+  gtk_widget_show (smenuitem);
+  gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
+  gtk_menu_append (GTK_MENU (menu), menuitem);
+  gtk_widget_show (menuitem);
 
-static void
-message_status_set_read_cb (GtkWidget * widget, Message * message)
-{
-  g_return_if_fail (widget != NULL);
+/* FIXME: Still does not work? Find out why. -Knut <knut.neumann@uni-duesseldorf.de> */
+/*    menuitem = gtk_menu_item_new_with_label (_ ("Change Status")); */
+/*    submenu = gtk_menu_new (); */
+  
+/*    smenuitem = gtk_menu_item_new_with_label (_ ("Unread")); */
+/*    gtk_signal_connect (GTK_OBJECT (smenuitem), "activate", */
+/*  		      (GtkSignalFunc) message_status_set_new_cb,  */
+/*  		      (gpointer) bindex); */
+/*    gtk_menu_append (GTK_MENU (submenu), smenuitem); */
+/*    gtk_widget_show (smenuitem); */
+
+/*    smenuitem = gtk_menu_item_new_with_label (_ ("Read")); */
+/*    gtk_signal_connect (GTK_OBJECT (smenuitem), "activate", */
+/*  		      (GtkSignalFunc) message_status_set_read_cb,  */
+/*  		      (gpointer) bindex); */
+/*    gtk_menu_append (GTK_MENU (submenu), smenuitem); */
+/*    gtk_widget_show (smenuitem); */
+
+/*    smenuitem = gtk_menu_item_new_with_label (_ ("Replied")); */
+/*    gtk_signal_connect (GTK_OBJECT (smenuitem), "activate", */
+/*  		      (GtkSignalFunc) message_status_set_answered_cb,  */
+/*  		      (gpointer) bindex); */
+/*    gtk_menu_append (GTK_MENU (submenu), smenuitem); */
+/*    gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu); */
+/*    gtk_menu_append (GTK_MENU (menu), menuitem); */
+/*    gtk_widget_show (smenuitem); */
 
-  message_read (message);
+/*    gtk_widget_show (menuitem); */
 
-  /* balsa_index_select_next (BALSA_INDEX (mainwindow->index)); */
+  return menu;
 }
 
-static void
-message_status_set_answered_cb (GtkWidget * widget, Message * message)
-{
-  g_return_if_fail (widget != NULL);
-
-  message_reply (message);
-}
-#endif
 
 static void
 transfer_messages_cb (BalsaMBList * bmbl, Mailbox * mailbox, GtkCTreeNode * row, GdkEventButton * event, BalsaIndex * bindex)
@@ -502,58 +560,6 @@
       list = list->next;
     }
 }
-
-
-static void
-delete_message_cb (GtkWidget * widget, BalsaIndex * bindex)
-{
-  GtkCList *clist;
-  GList *list;
-  Message *message;
-  gint i = 0;
-
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (bindex != NULL);
-
-  clist = GTK_CLIST (bindex);
-  list = clist->selection;
-  while (list)
-    {
-      message = gtk_clist_get_row_data (clist, GPOINTER_TO_INT (list->data));
-      message_delete (message);
-      i++;
-      list = list->next;
-    }
-
-  if (i == 1)
-    balsa_index_select_next (bindex);
-}
-
-static void
-undelete_message_cb (GtkWidget * widget, BalsaIndex * bindex)
-{
-  GtkCList *clist;
-  GList *list;
-  Message *message;
-  gint i = 0;
-
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (bindex != NULL);
-
-  clist = GTK_CLIST (bindex);
-  list = clist->selection;
-  while (list)
-    {
-      message = gtk_clist_get_row_data (clist, GPOINTER_TO_INT (list->data));
-      message_undelete (message);
-      list = list->next;
-    }
-
-  if (i == 1)
-    balsa_index_select_next (bindex);
-}
-
-
 /* DND features                                              */
 
 #ifdef DND_USED
@@ -645,5 +651,151 @@
   g_free( message_list );
   
 }
-
 #endif /*DND_USED*/
+
+/* New Stuff */
+
+void
+balsa_message_new (GtkWidget * widget)
+{
+  g_return_if_fail (widget != NULL);
+  sendmsg_window_new (widget, NULL, SEND_NORMAL);
+}
+
+
+void
+balsa_message_reply (GtkWidget * widget, gpointer index)
+{
+  GList     *list;
+  Message   *message;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail(index != NULL);
+
+  list = GTK_CLIST (index)->selection;
+  while (list)
+  {
+    message = gtk_clist_get_row_data(GTK_CLIST (index), GPOINTER_TO_INT(list->data));
+    sendmsg_window_new (widget, message, SEND_REPLY);
+    list = list->next;
+  }
+}
+
+void
+balsa_message_replytoall (GtkWidget * widget, gpointer index)
+{
+  GList     *list;
+  Message   *message;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail(index != NULL);
+
+  list = GTK_CLIST (index)->selection;
+  while (list)
+  {
+    message = gtk_clist_get_row_data(GTK_CLIST (index), GPOINTER_TO_INT(list->data));
+    sendmsg_window_new (widget, message, SEND_REPLY_ALL);
+    list = list->next;
+  }
+}
+
+void
+balsa_message_forward (GtkWidget * widget, gpointer index)
+{
+  GList     *list;
+  Message   *message;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail(index != NULL);
+
+  list = GTK_CLIST (index)->selection;
+  while (list)
+  {
+    message = gtk_clist_get_row_data(GTK_CLIST (index), GPOINTER_TO_INT(list->data));
+    sendmsg_window_new (widget, message, SEND_FORWARD);
+    list = list->next;
+  }
+}
+
+
+void
+balsa_message_continue (GtkWidget * widget, gpointer index)
+{
+  GList   *list;
+  Message *message;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail(index != NULL);
+
+  list = GTK_CLIST(index)->selection;
+  while (list)
+  {
+    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
+    sendmsg_window_new (widget, message, SEND_CONTINUE);
+    list = list->next;
+  } 
+}
+
+
+void
+balsa_message_next (GtkWidget * widget, gpointer index)
+{
+  g_return_if_fail(index != NULL);
+  balsa_index_select_next (index);
+}
+
+
+void
+balsa_message_previous (GtkWidget * widget, gpointer index)
+{
+  g_return_if_fail(index != NULL);
+  balsa_index_select_previous (index);
+}
+
+
+void
+balsa_message_delete (GtkWidget * widget, gpointer index)
+{
+  GList   *list;
+  Message *message;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail(index != NULL);
+
+  list = GTK_CLIST(index)->selection;
+  while (list)
+  {
+    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
+    message_delete(message);
+    list = list->next;
+  }
+  balsa_index_select_next (index);
+}
+
+
+void
+balsa_message_undelete (GtkWidget * widget, gpointer index)
+{
+  GList   *list;
+  Message *message;
+
+  g_return_if_fail (widget != NULL);
+  g_return_if_fail(index != NULL);
+
+  list = GTK_CLIST(index)->selection;
+  while (list)
+  {
+    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
+    message_undelete(message);
+    list = list->next;
+  }
+  balsa_index_select_next (index);
+}
+
+
+
+
+
+
+
+
diff -ur balsa/src/balsa-index-page.h balsa.mine/src/balsa-index-page.h
--- balsa/src/balsa-index-page.h	Mon Dec 13 19:23:25 1999
+++ balsa.mine/src/balsa-index-page.h	Tue Dec 14 21:09:58 1999
@@ -21,6 +21,8 @@
 
 #include "main-window.h"
 #include "libbalsa.h"
+#include "balsa-index.h"
+#include "sendmsg-window.h"
 
 GtkType balsa_index_page_get_type(void);
 
@@ -52,5 +54,15 @@
 GtkObject *balsa_index_page_new(BalsaWindow *window);
 void balsa_index_page_load_mailbox(BalsaIndexPage *page, Mailbox *mailbox);
 void balsa_index_page_close_and_destroy( GtkObject *obj );
+
+void balsa_message_new (GtkWidget * widget);
+void balsa_message_reply (GtkWidget * widget, gpointer index);
+void balsa_message_replytoall (GtkWidget * widget, gpointer index);
+void balsa_message_forward (GtkWidget * widget, gpointer index);
+void balsa_message_continue (GtkWidget * widget, gpointer index);
+void balsa_message_next (GtkWidget * widget, gpointer index);
+void balsa_message_previous (GtkWidget * widget, gpointer index);
+void balsa_message_delete (GtkWidget * widget, gpointer index);
+void balsa_message_undelete (GtkWidget * widget, gpointer index);
 
 #endif /* __INDEX_CHILD_H__ */
diff -ur balsa/src/balsa-message.c balsa.mine/src/balsa-message.c
--- balsa/src/balsa-message.c	Wed Dec  1 12:14:30 1999
+++ balsa.mine/src/balsa-message.c	Tue Dec 14 21:00:25 1999
@@ -255,7 +255,7 @@
 }
 
 GtkWidget *
-balsa_message_new (void)
+balsa_message_create (void)
 {
   BalsaMessage *bmessage;
   
diff -ur balsa/src/balsa-message.h balsa.mine/src/balsa-message.h
--- balsa/src/balsa-message.h	Mon Nov 22 11:48:33 1999
+++ balsa.mine/src/balsa-message.h	Tue Dec 14 20:57:43 1999
@@ -52,7 +52,7 @@
     };
 
   guint balsa_message_get_type (void);
-  GtkWidget *balsa_message_new (void);
+  GtkWidget *balsa_message_create (void);
   void balsa_message_clear (BalsaMessage * bmessage);
   void balsa_message_set (BalsaMessage * bmessage, Message * message);
 
diff -ur balsa/src/main-window.c balsa.mine/src/main-window.c
--- balsa/src/main-window.c	Mon Dec 13 19:23:26 1999
+++ balsa.mine/src/main-window.c	Tue Dec 14 21:09:16 1999
@@ -108,6 +108,7 @@
 /* callbacks */
 static void check_new_messages_cb (GtkWidget *, gpointer data);
 
+
 static void new_message_cb (GtkWidget * widget, gpointer data);
 static void replyto_message_cb (GtkWidget * widget, gpointer data);
 static void replytoall_message_cb (GtkWidget * widget, gpointer data);
@@ -120,6 +121,7 @@
 static void delete_message_cb (GtkWidget * widget, gpointer data);
 static void undelete_message_cb (GtkWidget * widget, gpointer data);
 
+
 static void filter_dlg_cb (GtkWidget * widget, gpointer data);
 
 static void mailbox_close_child (GtkWidget * widget, gpointer data);
@@ -588,7 +590,7 @@
   gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (sw),
 				 GTK_POLICY_AUTOMATIC,
 				 GTK_POLICY_AUTOMATIC);
-  message = balsa_message_new();
+  message = balsa_message_create();
   gtk_widget_set_usize(message, -1, 250);
   gtk_widget_show(message);
   gtk_container_add(GTK_CONTAINER(sw), message);
@@ -997,7 +999,7 @@
 }
 #endif USE_BALSA_THREADS
 
-//static
+
 GtkWidget *balsa_window_find_current_index(BalsaWindow *window)
 {
   GtkWidget *page;
@@ -1023,179 +1025,55 @@
 static void
 new_message_cb (GtkWidget * widget, gpointer data)
 {
-  g_return_if_fail (widget != NULL);
-
-  sendmsg_window_new (widget, NULL, SEND_NORMAL);
+  balsa_message_new (widget);
 }
 
-
 static void
 replyto_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-  GList *list;
-  Message *message;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  list = GTK_CLIST(index)->selection;
-  while (list)
-  {
-    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
-    sendmsg_window_new (widget, message, SEND_REPLY);
-    list = list->next;
-  }
+  balsa_message_reply (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
 static void
 replytoall_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-  GList *list;
-  Message *message;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  list = GTK_CLIST(index)->selection;
-  while (list)
-  {
-    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
-    sendmsg_window_new (widget, message, SEND_REPLY_ALL);
-    list = list->next;
-  }
+  balsa_message_replytoall (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
 static void
 forward_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-  GList *list;
-  Message *message;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  list = GTK_CLIST(index)->selection;
-  while (list)
-  {
-    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
-    sendmsg_window_new (widget, message, SEND_FORWARD);
-    list = list->next;
-  }
+  balsa_message_forward (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
-
 static void
 continue_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-  GList *list;
-  Message *message;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  list = GTK_CLIST(index)->selection;
-  while (list)
-  {
-    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
-    sendmsg_window_new (widget, message, SEND_CONTINUE);
-    list = list->next;
-  }
+  balsa_message_continue (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
-
 static void
 next_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  balsa_index_select_next(BALSA_INDEX(index));
+  balsa_message_next (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
-
 static void
 previous_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  balsa_index_select_previous(BALSA_INDEX(index));
+  balsa_message_previous (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
-
 static void
 delete_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-  GList *list;
-  Message *message;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  list = GTK_CLIST(index)->selection;
-  while (list)
-  {
-    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
-    message_delete(message);
-    list = list->next;
-  }
-
-  balsa_index_select_next(BALSA_INDEX(index));
+  balsa_message_delete (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
-
 static void
 undelete_message_cb (GtkWidget * widget, gpointer data)
 {
-  GtkWidget *index;
-  GList *list;
-  Message *message;
-
-  g_return_if_fail (widget != NULL);
-
-  index = balsa_window_find_current_index(BALSA_WINDOW(data));
-
-  g_return_if_fail(index != NULL);
-
-  list = GTK_CLIST(index)->selection;
-  while (list)
-  {
-    message = gtk_clist_get_row_data(GTK_CLIST(index), GPOINTER_TO_INT(list->data));
-    message_undelete(message);
-    list = list->next;
-  }
-
-  balsa_index_select_next(BALSA_INDEX(index));
+  balsa_message_undelete (widget, balsa_window_find_current_index (BALSA_WINDOW (data)));
 }
 
 static void
@@ -1327,3 +1205,4 @@
     balsa_app.mw_height = alloc->height;
     balsa_app.mw_width = alloc->width;
 }
+
diff -ur balsa/src/main-window.h balsa.mine/src/main-window.h
--- balsa/src/main-window.h	Mon Dec 13 19:23:26 1999
+++ balsa.mine/src/main-window.h	Wed Dec 15 00:22:40 1999
@@ -55,23 +55,28 @@
 
 };
 
-GtkType balsa_window_get_type (void);
+GtkType    balsa_window_get_type (void);
 GtkWidget *balsa_window_new(void);
-void balsa_window_set_cursor(BalsaWindow *window, GdkCursor *cursor);
+void       balsa_window_set_cursor(BalsaWindow *window, GdkCursor *cursor);
 GtkWidget *balsa_window_find_current_index(BalsaWindow *window);
-void balsa_window_refresh(BalsaWindow *window);
-void balsa_window_open_mailbox();
-void balsa_window_close_mailbox();
-gboolean mail_progress_notify_cb(void);
-gboolean send_progress_notify_cb(void);
-gint check_new_messages_auto_cb( gpointer data );
+void       balsa_window_refresh(BalsaWindow *window);
+void       balsa_window_open_mailbox();
+void       balsa_window_close_mailbox();
+gboolean   mail_progress_notify_cb(void);
+gboolean   send_progress_notify_cb(void);
+gint       check_new_messages_auto_cb( gpointer data );
+void       mblist_close_mailbox (Mailbox * mailbox);
 
-/*
-void close_main_window (void);
-void refresh_main_window (void);
-void main_window_set_mailbox (Mailbox * mailbox);
-void main_window_set_cursor (gint type);
-*/
-void mblist_close_mailbox (Mailbox * mailbox);
+#if defined(__FILE__) && defined(__LINE__)
+# ifdef __FUNCTION__
+#  define BALSA_DEBUG_MSG(message)  if (balsa_app.debug)  fprintf(stderr, "[%lu] %12s | %4d | %30s: %s\n", (unsigned long) time(NULL), __FILE__, __LINE__, __FUNCTION__, message)
+#  define BALSA_DEBUG() if (balsa_app.debug) fprintf (stderr, "[%lu] %12s | %4d | %30s\n", (unsigned long) time(NULL), __FILE__, __LINE__, __FUNCTION__)
+# else
+#  define BALSA_DEBUG_MSG(message)  if (balsa_app.debug)  fprintf(stderr, "[%lu] %12s | %4d: %s\n", (unsigned long) time(NULL), __FILE__, __LINE__, message)
+#  define BALSA_DEBUG() if (balsa_app.debug)  fprintf(stderr, "[%lu] %12s | %4d\n", (unsigned long) time(NULL), __FILE__, __LINE__)
+# endif
+#endif
 
 #endif /* __main_window_h__ */
+
+
diff -ur balsa/src/message-window.c balsa.mine/src/message-window.c
--- balsa/src/message-window.c	Mon Nov 22 11:48:34 1999
+++ balsa.mine/src/message-window.c	Tue Dec 14 20:59:02 1999
@@ -147,7 +147,7 @@
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                                    GTK_POLICY_AUTOMATIC,
                                    GTK_POLICY_AUTOMATIC);
-  mw->bmessage = balsa_message_new ();
+  mw->bmessage = balsa_message_create ();
   gtk_container_add(GTK_CONTAINER(sw), mw->bmessage);
 
   balsa_message_set (BALSA_MESSAGE (mw->bmessage), message);


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