PATCH: Toolbar for message window



Here's another one. This one is to be applied _after_ the custom toolbars
patch. It adds a toolbar to the message window.

Some callbacks are empty, because I haven't figured out how to go about
updating the indexes in the main window when I delete / move a message.
The corresponding toolbar buttons are disabled for the time being.
diff -B -b -r -u ../balsa-cvs/src/message-window.c ./src/message-window.c
--- ../balsa-cvs/src/message-window.c	Fri Jul 13 02:26:33 2001
+++ ./src/message-window.c	Fri Jul 13 02:19:10 2001
@@ -24,9 +24,11 @@
 #include <gnome.h>
 #include "balsa-app.h"
 #include "balsa-message.h"
+#include "balsa-icons.h"
 #include "main-window.h"
 #include "sendmsg-window.h"
 #include "message-window.h"
+#include "toolbar-factory.h"
 
 #include "libbalsa.h"
 
@@ -52,6 +54,10 @@
 
 static void select_part_cb(BalsaMessage * bm, gpointer data);
 
+static void next_unread_cb(GtkWidget * widget, gpointer);
+static void print_cb(GtkWidget * widget, gpointer);
+static void trash_cb(GtkWidget * widget, gpointer);
+
 /*
  * The list of messages which are being displayed.
  */
@@ -154,6 +160,7 @@
 {
     MessageWindow *mw;
     GtkWidget *scroll;
+	GnomeIconList *gil;
 
     if (!message)
 	return;
@@ -189,6 +196,42 @@
 
     mw->window = gnome_app_new("balsa", "Message");
 
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_MAIL_RPL,
+			GTK_SIGNAL_FUNC(replyto_message_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, BALSA_PIXMAP_MAIL_RPL_ALL,
+			GTK_SIGNAL_FUNC(replytoall_message_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_MAIL_FWD,
+			GTK_SIGNAL_FUNC(forward_message_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_BACK,
+			GTK_SIGNAL_FUNC(previous_part_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_FORWARD,
+			GTK_SIGNAL_FUNC(next_part_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, BALSA_PIXMAP_NEXT_UNREAD,
+			GTK_SIGNAL_FUNC(next_unread_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_TRASH,
+			GTK_SIGNAL_FUNC(trash_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_PRINT,
+			GTK_SIGNAL_FUNC(print_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_SAVE,
+			GTK_SIGNAL_FUNC(save_current_part_cb), (gpointer)mw);
+	set_toolbar_button_callback(2, GNOME_STOCK_PIXMAP_CLOSE,
+			GTK_SIGNAL_FUNC(close_message_window), (gpointer)mw);
+
+	gnome_app_set_toolbar(GNOME_APP(mw->window),
+			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);
+
     gtk_window_set_wmclass(GTK_WINDOW(mw->window), "message", "Balsa");
 
     gtk_signal_connect(GTK_OBJECT(mw->window),
@@ -235,6 +278,19 @@
     gtk_widget_show(mw->window);
 
     balsa_message_set(BALSA_MESSAGE(mw->bmessage), message);
+
+	if(mw->bmessage != NULL &&
+			((BalsaMessage *)mw->bmessage)->part_list != NULL)
+	{
+		gil=GNOME_ICON_LIST(((BalsaMessage *)mw->bmessage)->part_list);
+		if(gil->icons >= 2)
+		{
+			set_toolbar_button_sensitive(mw->window, 2,
+					GNOME_STOCK_PIXMAP_BACK, TRUE);
+			set_toolbar_button_sensitive(mw->window, 2,
+					GNOME_STOCK_PIXMAP_FORWARD, TRUE);
+		}
+	}
 }
 
 static void
@@ -385,3 +441,16 @@
     if (mw->bmessage)
 	balsa_message_select_all(BALSA_MESSAGE(mw->bmessage));
 }
+
+static void next_unread_cb(GtkWidget * widget, gpointer data)
+{
+}
+
+static void print_cb(GtkWidget * widget, gpointer data)
+{
+}
+
+static void trash_cb(GtkWidget * widget, gpointer data)
+{
+}
+
diff -B -b -r -u ../balsa-cvs/src/toolbar-factory.c ./src/toolbar-factory.c
--- ../balsa-cvs/src/toolbar-factory.c	Fri Jul 13 02:26:51 2001
+++ ./src/toolbar-factory.c	Fri Jul 13 01:45:36 2001
@@ -106,7 +106,20 @@
 							GNOME_STOCK_PIXMAP_CLOSE,
 							NULL};
 
-static char **toolbar_legal[]={toolbar0_legal, toolbar1_legal};
+static char *toolbar2_legal[]={"",
+							GNOME_STOCK_PIXMAP_MAIL_RPL,
+							BALSA_PIXMAP_MAIL_RPL_ALL,
+							GNOME_STOCK_PIXMAP_MAIL_FWD,
+							GNOME_STOCK_PIXMAP_BACK,
+							GNOME_STOCK_PIXMAP_FORWARD,
+							BALSA_PIXMAP_NEXT_UNREAD,
+							GNOME_STOCK_PIXMAP_TRASH,
+							GNOME_STOCK_PIXMAP_PRINT,
+							GNOME_STOCK_PIXMAP_SAVE,
+							GNOME_STOCK_PIXMAP_CLOSE,
+							NULL};
+
+static char **toolbar_legal[]={toolbar0_legal, toolbar1_legal, toolbar2_legal};
 
 static void populate_stock_toolbar(int bar, int id);
 static int get_toolbar_button_slot(int toolbar, char *id);
@@ -209,6 +222,22 @@
 		balsa_app.toolbars[bar][10]=g_strdup(GNOME_STOCK_PIXMAP_PRINT);
 		balsa_app.toolbars[bar][11]=g_strdup("");
 		balsa_app.toolbars[bar][12]=g_strdup(GNOME_STOCK_PIXMAP_CLOSE);
+		balsa_app.toolbars[bar][13]=NULL;
+		break;
+	case 2:
+		balsa_app.toolbars[bar][0]=g_strdup(BALSA_PIXMAP_NEXT_UNREAD);
+		balsa_app.toolbars[bar][1]=g_strdup("");
+		balsa_app.toolbars[bar][2]=g_strdup(GNOME_STOCK_PIXMAP_MAIL_RPL);
+		balsa_app.toolbars[bar][3]=g_strdup(BALSA_PIXMAP_MAIL_RPL_ALL);
+		balsa_app.toolbars[bar][4]=g_strdup(GNOME_STOCK_PIXMAP_MAIL_FWD);
+		balsa_app.toolbars[bar][5]=g_strdup("");
+		balsa_app.toolbars[bar][6]=g_strdup(GNOME_STOCK_PIXMAP_BACK);
+		balsa_app.toolbars[bar][7]=g_strdup(GNOME_STOCK_PIXMAP_FORWARD);
+		balsa_app.toolbars[bar][8]=g_strdup(GNOME_STOCK_PIXMAP_SAVE);
+		balsa_app.toolbars[bar][9]=g_strdup("");
+		balsa_app.toolbars[bar][10]=g_strdup(GNOME_STOCK_PIXMAP_PRINT);
+		balsa_app.toolbars[bar][11]=g_strdup("");
+		balsa_app.toolbars[bar][12]=g_strdup(GNOME_STOCK_PIXMAP_TRASH);
 		balsa_app.toolbars[bar][13]=NULL;
 		break;
 	default:
diff -B -b -r -u ../balsa-cvs/src/toolbar-factory.h ./src/toolbar-factory.h
--- ../balsa-cvs/src/toolbar-factory.h	Fri Jul 13 02:26:51 2001
+++ ./src/toolbar-factory.h	Fri Jul 13 01:36:20 2001
@@ -1,4 +1,4 @@
-#define STOCK_TOOLBAR_COUNT 2
+#define STOCK_TOOLBAR_COUNT 3
 
 int create_stock_toolbar(int id);
 int get_toolbar_index(int id);
diff -B -b -r -u ../balsa-cvs/src/toolbar-prefs.c ./src/toolbar-prefs.c
--- ../balsa-cvs/src/toolbar-prefs.c	Fri Jul 13 02:26:51 2001
+++ ./src/toolbar-prefs.c	Fri Jul 13 01:46:44 2001
@@ -76,14 +76,14 @@
 	{BALSA_PIXMAP_MAIL_RPL_ALL, "Reply\nto all",
 					"Reply to all recipients of the current message"},
 	{GNOME_STOCK_PIXMAP_MAIL_FWD, "Forward", "Forward the current message"},
-	{GNOME_STOCK_PIXMAP_BACK, "Previous", "Open previous message"},
-	{GNOME_STOCK_PIXMAP_FORWARD, "Next", "Open next message"},
+	{GNOME_STOCK_PIXMAP_BACK, "Previous", "Open previous"},
+	{GNOME_STOCK_PIXMAP_FORWARD, "Next", "Open next"},
 	{BALSA_PIXMAP_NEXT_UNREAD, "Next\nunread", "Open next unread message"},
 	{GNOME_STOCK_PIXMAP_TRASH, "Trash /\nDelete", "Move the current message to trash"},
 	{GNOME_STOCK_PIXMAP_PRINT, "Print", "Print current message"},
 	{GNOME_STOCK_PIXMAP_MAIL_SND, "Send", "Send this message"},
 	{GNOME_STOCK_PIXMAP_ATTACH, "Attach", "Add attachments to this message"},
-	{GNOME_STOCK_PIXMAP_SAVE, "Postpone", "Continue this message later"},
+	{GNOME_STOCK_PIXMAP_SAVE, "Save", "Save the current item"},
 	{BALSA_PIXMAP_IDENTITY, "Select Identity",
 			"Set identity to use for this message"},
 	{GNOME_STOCK_PIXMAP_SPELLCHECK, "Spelling",
@@ -628,6 +628,10 @@
 	gnome_property_box_append_page(GNOME_PROPERTY_BOX(customize_widget),
 			create_toolbar_page(customize_widget, 1),
 			gtk_label_new(_("Compose window")));
+
+	gnome_property_box_append_page(GNOME_PROPERTY_BOX(customize_widget),
+			create_toolbar_page(customize_widget, 2),
+			gtk_label_new(_("Message window")));
 
 	gtk_widget_show_all(customize_widget);
 }


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