PATCH: More toolbar buttons



This patch, which depends on the custom toolbar and the message window
toolbar patch, adds some more buttons that can optionally be inserted into
the toolbars.
It also implements the functionality of the message window buttons that
weren't included in the previous message window toolbar patch to make all
buttons functional.
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/balsa-icons.c ./src/balsa-icons.c
--- ../balsa-cvs/src/balsa-icons.c	Fri Jul 13 14:07:13 2001
+++ ./src/balsa-icons.c	Fri Jul 13 13:46:33 2001
@@ -48,6 +48,8 @@
 #include "pixmaps/reply_to_all_menu.xpm"
 #include "pixmaps/next_unread.xpm"
 #include "pixmaps/next_unread_menu.xpm"
+#include "pixmaps/flag_new.xpm"
+#include "pixmaps/mark_all.xpm"
 
 #include "pixmaps/small-close.xpm"
 
@@ -213,4 +215,6 @@
 
     register_balsa_pixmap(BALSA_PIXMAP_IDENTITY, identity_xpm, 24, 24);
     register_balsa_pixmap(BALSA_PIXMAP_IDENTITY_MENU, identity_xpm, 16, 16);
+	register_balsa_pixmap(BALSA_PIXMAP_FLAG_UNREAD, flag_new_xpm, 24, 24);
+	register_balsa_pixmap(BALSA_PIXMAP_MARK_ALL_MSGS, mark_all_xpm, 24, 24);
 }
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/balsa-icons.h ./src/balsa-icons.h
--- ../balsa-cvs/src/balsa-icons.h	Fri Jul 13 14:07:13 2001
+++ ./src/balsa-icons.h	Fri Jul 13 13:44:55 2001
@@ -36,6 +36,9 @@
 #define BALSA_PIXMAP_IDENTITY "identity"
 #define BALSA_PIXMAP_IDENTITY_MENU "identity_menu"
 
+#define BALSA_PIXMAP_FLAG_UNREAD "flag_unread"
+#define BALSA_PIXMAP_MARK_ALL_MSGS "mark_all_msgs"
+
 typedef enum {
     BALSA_ICON_INBOX,
     BALSA_ICON_OUTBOX,
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/main-window.c ./src/main-window.c
--- ../balsa-cvs/src/main-window.c	Fri Jul 13 14:07:26 2001
+++ ./src/main-window.c	Fri Jul 13 13:54:38 2001
@@ -182,6 +182,7 @@
 
 static void copy_cb(GtkWidget * widget, gpointer data);
 static void select_all_cb(GtkWidget * widget, gpointer);
+static void mark_all_cb(GtkWidget * widget, gpointer);
 
 static void select_part_cb(BalsaMessage * bm, gpointer data);
 
@@ -672,6 +673,10 @@
 			next_unread_message_cb, window);
 	set_toolbar_button_callback(0, GNOME_STOCK_PIXMAP_PRINT,
 			message_print_cb, window);
+	set_toolbar_button_callback(0, BALSA_PIXMAP_FLAG_UNREAD,
+			toggle_new_message_cb, window);
+	set_toolbar_button_callback(0, BALSA_PIXMAP_MARK_ALL_MSGS,
+			mark_all_cb, window);
 
 	gnome_app_set_toolbar(GNOME_APP(window),
 			get_toolbar(GTK_WIDGET(window), 0));
@@ -921,6 +926,8 @@
 	set_toolbar_button_sensitive(GTK_WIDGET(balsa_app.main_window),
 			0, GNOME_STOCK_PIXMAP_MAIL_FWD, enable);
 	set_toolbar_button_sensitive(GTK_WIDGET(balsa_app.main_window),
+			0, BALSA_PIXMAP_FLAG_UNREAD, enable);
+	set_toolbar_button_sensitive(GTK_WIDGET(balsa_app.main_window),
 			0, GNOME_STOCK_PIXMAP_PRINT, enable);
 
     balsa_window_enable_continue();
@@ -2850,5 +2857,14 @@
     }
 }
 
+static void mark_all_cb(GtkWidget * widget, gpointer data)
+{
+    GtkCList *clist;
+	BalsaIndex *bindex;
 
+	bindex=BALSA_INDEX(balsa_window_find_current_index(balsa_app.main_window));
+    g_return_if_fail(bindex != NULL);
+    clist = GTK_CLIST(bindex->ctree);
 
+	gtk_clist_select_all(clist);
+}
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/message-window.c ./src/message-window.c
--- ../balsa-cvs/src/message-window.c	Fri Jul 13 14:07:30 2001
+++ ./src/message-window.c	Fri Jul 13 12:56:22 2001
@@ -28,6 +28,7 @@
 #include "main-window.h"
 #include "sendmsg-window.h"
 #include "message-window.h"
+#include "print.h"
 #include "toolbar-factory.h"
 
 #include "libbalsa.h"
@@ -221,13 +222,6 @@
 			get_toolbar(GTK_WIDGET(mw->window), 2));
 
 	set_toolbar_button_sensitive(mw->window, 2,
-			BALSA_PIXMAP_NEXT_UNREAD, FALSE);
-	set_toolbar_button_sensitive(mw->window, 2,
-			GNOME_STOCK_PIXMAP_PRINT, FALSE);
-	set_toolbar_button_sensitive(mw->window, 2,
-			GNOME_STOCK_PIXMAP_TRASH, FALSE);
-
-	set_toolbar_button_sensitive(mw->window, 2,
 			GNOME_STOCK_PIXMAP_BACK, FALSE);
 	set_toolbar_button_sensitive(mw->window, 2,
 			GNOME_STOCK_PIXMAP_FORWARD, FALSE);
@@ -446,13 +440,92 @@
 
 static void next_unread_cb(GtkWidget * widget, gpointer data)
 {
+    MessageWindow *mw = (MessageWindow *) (data);
+	BalsaIndex *idx;
+	GtkCList *list;
+	LibBalsaMessage *msg;
+
+	balsa_index_select_next_unread(
+			idx=BALSA_INDEX(
+			balsa_window_find_current_index(balsa_app.main_window)));
+	
+	list=GTK_CLIST(idx->ctree);
+	if(g_list_length(list->selection) != 1)
+		return;
+	
+	msg=LIBBALSA_MESSAGE(gtk_ctree_node_get_row_data(GTK_CTREE(list),
+			list->selection->data));
+	if(!msg)
+		return;
+	
+	gtk_widget_destroy(GTK_WIDGET(mw->window));
+	message_window_new(msg);
 }
 
 static void print_cb(GtkWidget * widget, gpointer data)
 {
+    MessageWindow *mw = (MessageWindow *) (data);
+	LibBalsaMessage *msg;
+
+	msg=mw->message;
+
+	message_print(msg);
 }
 
 static void trash_cb(GtkWidget * widget, gpointer data)
 {
+    MessageWindow *mw = (MessageWindow *) (data);
+	LibBalsaMessage *msg;
+	LibBalsaMailbox *mailbox;
+	BalsaIndex *index;
+	GtkCList *list;
+	int row, newrow;
+
+	msg=mw->message;
+
+	mailbox=msg->mailbox;
+
+	index=balsa_find_index_by_mailbox(mailbox);
+
+	if(index)
+	{
+		list=GTK_CLIST(index->ctree);
+		row=newrow=gtk_clist_find_row_from_data(list, msg);
+
+		/* If the current message is the only one selected in the index */
+		/* (common case) we want to move the current message down if */
+		/* possible, up otherwise so a message remains selected */
+		if(g_list_length(list->selection) == 1)
+		{
+			if(gtk_ctree_node_get_row_data(
+					GTK_CTREE(list), list->selection->data) == msg)
+			{
+				/* Clear the selection on the current row */
+				gtk_clist_unselect_row(list, row, 0);
+
+				if(list->rows > 1)
+				{
+					if(newrow >= list->rows-1) /* Must back up */
+						--newrow;
+					else
+						++newrow;
+					
+					if(newrow < 0)
+						newrow=0;
+
+					/* Set new selected row */
+					gtk_clist_select_row(list, newrow, 0);
+				}
+			}
+		}
+		gtk_clist_remove(list, row);
+	}
+
+	if(msg->mailbox != balsa_app.trash)
+		libbalsa_message_move(msg, balsa_app.trash);
+	else
+		libbalsa_message_delete(msg);
+
+	gtk_widget_destroy(GTK_WIDGET(mw->window));
 }
 
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/pixmaps/flag_new.xpm ./src/pixmaps/flag_new.xpm
--- ../balsa-cvs/src/pixmaps/flag_new.xpm	Thu Jan  1 01:00:00 1970
+++ ./src/pixmaps/flag_new.xpm	Fri Jul 13 13:30:35 2001
@@ -0,0 +1,139 @@
+/* XPM */
+static char * flag_new_xpm[] = {
+"24 24 112 2",
+"  	c None",
+". 	c #FFFF00",
+"+ 	c #FFFFFF",
+"@ 	c #000000",
+"# 	c #7B7B78",
+"$ 	c #C7C7C3",
+"% 	c #F1F0EB",
+"& 	c #BFBFBC",
+"* 	c #5F5E5E",
+"= 	c #E3E3DF",
+"- 	c #F3F3EF",
+"; 	c #F2F2EE",
+"> 	c #F1F1EC",
+", 	c #F0EFEB",
+"' 	c #D2D2CD",
+") 	c #969592",
+"! 	c #616060",
+"~ 	c #B5B5B4",
+"{ 	c #F8F8F6",
+"] 	c #F7F7F5",
+"^ 	c #F5F5F2",
+"/ 	c #F4F4F0",
+"( 	c #F2F1ED",
+"_ 	c #F1F0EC",
+": 	c #F0EFEA",
+"< 	c #EFEEE9",
+"[ 	c #4F4F4D",
+"} 	c #BDBCB8",
+"| 	c #A7A6A3",
+"1 	c #C6C6C4",
+"2 	c #525251",
+"3 	c #F5F4F1",
+"4 	c #F4F3F0",
+"5 	c #F3F2EE",
+"6 	c #999894",
+"7 	c #62625F",
+"8 	c #BCBCB6",
+"9 	c #EBE9E3",
+"0 	c #838381",
+"a 	c #A8A8A6",
+"b 	c #515150",
+"c 	c #7E7D7C",
+"d 	c #DAD9D5",
+"e 	c #EFEEE8",
+"f 	c #EEEDE7",
+"g 	c #4F4E4C",
+"h 	c #BCBBB6",
+"i 	c #EBE9E2",
+"j 	c #EAE8E1",
+"k 	c #F4F3EF",
+"l 	c #B5B4B1",
+"m 	c #9B9A97",
+"n 	c #646361",
+"o 	c #92918E",
+"p 	c #EEEDE8",
+"q 	c #EDECE6",
+"r 	c #4E4E4C",
+"s 	c #797976",
+"t 	c #797874",
+"u 	c #E9E8E1",
+"v 	c #E8E7DF",
+"w 	c #B4B3AF",
+"x 	c #D0D0CD",
+"y 	c #BFBEBA",
+"z 	c #BEBDB9",
+"A 	c #7A7A77",
+"B 	c #979691",
+"C 	c #EAE9E2",
+"D 	c #959590",
+"E 	c #787773",
+"F 	c #B8B7B0",
+"G 	c #E6E4DC",
+"H 	c #A9A9A6",
+"I 	c #626260",
+"J 	c #ECEBE4",
+"K 	c #EBEAE3",
+"L 	c #E9E7E0",
+"M 	c #E8E6DF",
+"N 	c #E7E5DD",
+"O 	c #777671",
+"P 	c #93918C",
+"Q 	c #BEBDB8",
+"R 	c #989793",
+"S 	c #ECEAE4",
+"T 	c #E8E6DE",
+"U 	c #E6E4DB",
+"V 	c #E4E3DA",
+"W 	c #75746F",
+"X 	c #91908A",
+"Y 	c #EEECE7",
+"Z 	c #62615F",
+"` 	c #EBEAE4",
+" .	c #E7E6DE",
+"..	c #E6E5DC",
+"+.	c #E5E4DB",
+"@.	c #E4E2DA",
+"#.	c #CCCBC4",
+"$.	c #A3A29D",
+"%.	c #B6B5B2",
+"&.	c #BCBCB7",
+"*.	c #CDCCC6",
+"=.	c #959490",
+"-.	c #ECEBE5",
+";.	c #61615E",
+">.	c #E9E8E0",
+",.	c #CECDC7",
+"'.	c #797875",
+").	c #969590",
+"!.	c #CFCEC8",
+"~.	c #AEADA8",
+"{.	c #585754",
+"].	c #7B7A76",
+"                                                ",
+"        .         +                             ",
+"+   .   +   .   .           @ @ @ @             ",
+"  .     .     +   @ @ @ @ @ # $ % & @           ",
+".   +   @ @ . @ @ * & = - ; > , ' ) @           ",
+"      . ! ~ { ] . ^ / - ( _ : < [ } | @         ",
+"+ . + @ 1 + 2 . 3 4 5 ( % : < 6 7 8 9 @         ",
+"      . 0 . a b c d ( % : e f g h i j @         ",
+".   +   @ . 3 k l m n o p q r s t u v w @       ",
+"  .     @ x . . _ , y z A r B C D E F G @       ",
+"        @ H ( _ : < I q J K j L M N O P @       ",
+"          @ % : e Q R S 9 j L T N U V W X @     ",
+"          @ , e Y Z ` C u v  ...+.@.#.$.@ @     ",
+"          @ %.q &.B C u v  .G *.=.@ @ @         ",
+"            @ -.;.C >.M ,.D @ @ @               ",
+"            @ '.).!.~.@ @ @                     ",
+"            @ {.].@ @                           ",
+"              @ @                               ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                ",
+"                                                "};
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/pixmaps/mark_all.xpm ./src/pixmaps/mark_all.xpm
--- ../balsa-cvs/src/pixmaps/mark_all.xpm	Thu Jan  1 01:00:00 1970
+++ ./src/pixmaps/mark_all.xpm	Fri Jul 13 13:42:10 2001
@@ -0,0 +1,147 @@
+/* XPM */
+static char * mark_all_xpm[] = {
+"33 30 114 2",
+"  	c None",
+". 	c #000000",
+"+ 	c #030303",
+"@ 	c #7B7B78",
+"# 	c #C7C7C3",
+"$ 	c #F1F0EB",
+"% 	c #BFBFBC",
+"& 	c #FF0000",
+"* 	c #5F5E5D",
+"= 	c #E3E3DC",
+"- 	c #F3F3EF",
+"; 	c #F2F2EE",
+"> 	c #F1F1EC",
+", 	c #F0EFEB",
+"' 	c #D2D2CD",
+") 	c #F8F8F6",
+"! 	c #F7F7F5",
+"~ 	c #FFFFFF",
+"{ 	c #F5F5F2",
+"] 	c #F4F4F0",
+"^ 	c #838381",
+"/ 	c #D0D0CD",
+"( 	c #B0B0AE",
+"_ 	c #F2F1ED",
+": 	c #5F5E5E",
+"< 	c #E3E3DF",
+"[ 	c #969592",
+"} 	c #F1F0EC",
+"| 	c #F0EFEA",
+"1 	c #EFEEE9",
+"2 	c #4F4F4D",
+"3 	c #BDBCB8",
+"4 	c #A7A6A3",
+"5 	c #525251",
+"6 	c #F5F4F1",
+"7 	c #F4F3F0",
+"8 	c #F3F2EE",
+"9 	c #999894",
+"0 	c #62625F",
+"a 	c #BCBCB6",
+"b 	c #EBE9E3",
+"c 	c #B6B5B2",
+"d 	c #EEEDD6",
+"e 	c #A8A8A6",
+"f 	c #515150",
+"g 	c #7E7D7C",
+"h 	c #DAD9D5",
+"i 	c #EFEEE8",
+"j 	c #EEEDE7",
+"k 	c #4F4E4C",
+"l 	c #BCBBB6",
+"m 	c #EBE9E2",
+"n 	c #EAE8E1",
+"o 	c #ECEBE5",
+"p 	c #F4F3EF",
+"q 	c #B5B4B1",
+"r 	c #9B9A97",
+"s 	c #646361",
+"t 	c #92918E",
+"u 	c #EEEDE8",
+"v 	c #EDECE6",
+"w 	c #4E4E4C",
+"x 	c #797976",
+"y 	c #797874",
+"z 	c #E9E8E1",
+"A 	c #E8E7DF",
+"B 	c #B4B3AF",
+"C 	c #797875",
+"D 	c #BFBEBA",
+"E 	c #BEBDB9",
+"F 	c #7A7A77",
+"G 	c #979691",
+"H 	c #EAE9E2",
+"I 	c #959590",
+"J 	c #787773",
+"K 	c #B8B7B0",
+"L 	c #E6E4DC",
+"M 	c #585754",
+"N 	c #7B7A76",
+"O 	c #A9A9A6",
+"P 	c #626260",
+"Q 	c #ECEBE4",
+"R 	c #EBEAE3",
+"S 	c #E9E7E0",
+"T 	c #E8E6DF",
+"U 	c #E7E5DD",
+"V 	c #777671",
+"W 	c #93918C",
+"X 	c #BEBDB8",
+"Y 	c #989793",
+"Z 	c #ECEAE4",
+"` 	c #E8E6DE",
+" .	c #E6E4DB",
+"..	c #E4E3DA",
+"+.	c #75746F",
+"@.	c #91908A",
+"#.	c #EEECE7",
+"$.	c #62615F",
+"%.	c #EBEAE4",
+"&.	c #E7E6DE",
+"*.	c #E6E5DC",
+"=.	c #E5E4DB",
+"-.	c #E4E2DA",
+";.	c #CCCBC4",
+">.	c #A3A29D",
+",.	c #BCBCB7",
+"'.	c #CDCCC6",
+").	c #959490",
+"!.	c #61615E",
+"~.	c #E9E8E0",
+"{.	c #CECDC7",
+"].	c #969590",
+"^.	c #CFCEC8",
+"/.	c #AEADA8",
+"                                                                  ",
+"                                                                  ",
+"                            . . . .                               ",
+"                  . . . + . @ # $ % .                             ",
+"      & & & & . . * % = - ; > , ' . . . .                         ",
+"      & & & ) ! ~ { ] - . . . + . @ # $ % .                       ",
+"      & & ~ & & & & . . * % = - ; > , ' . . . .                   ",
+"      & ^ ~ & & & ) ! ~ { ] - . . . + . @ # $ % .                 ",
+"        . ~ & & ~ & & & & . . * % = - ; > , ' . . . .             ",
+"        . / & ^ ~ & & & ) ! ~ { ] - . . . . . @ # $ % .           ",
+"        . ( _ . ~ & & ~ & & & & . . : % < - ; > , ' [ .           ",
+"          . $ . / & ^ ~ & & & ) ! ~ { ] - _ } | 1 2 3 4 .         ",
+"          . , . ( _ . ~ & & ~ 5 ~ 6 7 8 _ $ | 1 9 0 a b .         ",
+"          . c d . $ . / & ^ ~ e f g h _ $ | i j k l m n .         ",
+"            . o . , . ( _ . ~ 6 p q r s t u v w x y z A B .       ",
+"            . C . c d . $ . / ~ ~ } , D E F w G H I J K L .       ",
+"            . M N . o . , . O _ } | 1 P v Q R n S T U V W .       ",
+"              . . . C . c v . $ | i X Y Z b n S ` U  ...+.@..     ",
+"                  . M N . o . , i #.$.%.H z A &.*.=.-.;.>.. .     ",
+"                    . . . C . c v ,.G H z A &.L '.).. . .         ",
+"                        . M N . o !.H ~.T {.I . . .               ",
+"                          . . . C ].^./.. . .                     ",
+"                              . M N . .                           ",
+"                                . .                               ",
+"                                                                  ",
+"                                                                  ",
+"                                                                  ",
+"                                                                  ",
+"                                                                  ",
+"                                                                  "};
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/print.c ./src/print.c
--- ../balsa-cvs/src/print.c	Fri Jul 13 14:07:13 2001
+++ ./src/print.c	Fri Jul 13 12:38:28 2001
@@ -42,6 +42,13 @@
 	"This version of balsa is compiled without gnome-print support.\n"
 	"Printing is not possible."));
 }
+void
+message_print(LibBalsaMessage *msg)
+{
+    balsa_information(LIBBALSA_INFORMATION_ERROR, _(
+	"This version of balsa is compiled without gnome-print support.\n"
+	"Printing is not possible."));
+}
 #else
 
 #include <ctype.h>
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/toolbar-factory.c ./src/toolbar-factory.c
--- ../balsa-cvs/src/toolbar-factory.c	Fri Jul 13 14:07:30 2001
+++ ./src/toolbar-factory.c	Fri Jul 13 13:44:28 2001
@@ -94,6 +94,8 @@
 							GNOME_STOCK_PIXMAP_FORWARD,
 							BALSA_PIXMAP_NEXT_UNREAD,
 							GNOME_STOCK_PIXMAP_PRINT,
+							BALSA_PIXMAP_FLAG_UNREAD,
+							BALSA_PIXMAP_MARK_ALL_MSGS,
 							NULL};
 
 static char *toolbar1_legal[]={"",
diff -b -B -r -u -P -a --exclude-from=ignore ../balsa-cvs/src/toolbar-prefs.c ./src/toolbar-prefs.c
--- ../balsa-cvs/src/toolbar-prefs.c	Fri Jul 13 14:07:30 2001
+++ ./src/toolbar-prefs.c	Fri Jul 13 13:47:39 2001
@@ -88,7 +88,10 @@
 			"Set identity to use for this message"},
 	{GNOME_STOCK_PIXMAP_SPELLCHECK, "Spelling",
 			"Run a spell check on the current message"},
-	{GNOME_STOCK_PIXMAP_CLOSE, "Cancel", "Cancel this message"}
+	{GNOME_STOCK_PIXMAP_CLOSE, "Cancel", "Cancel this message"},
+	{BALSA_PIXMAP_FLAG_UNREAD, "Toggle\nnew", "Toggle new message flag"},
+	{BALSA_PIXMAP_MARK_ALL_MSGS, "Mark all",
+			"Mark all messages in current mailbox"}
 };
 
 int toolbar_button_count=sizeof(toolbar_buttons)/sizeof(button_data);


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