Postponing and such...
- From: Pawel Salek <pawsa theochem kth se>
- To: balsa-list gnome org
- Subject: Postponing and such...
- Date: Wed, 1 Mar 2000 17:02:43 +0100 (CET)
Hi,
I send a short patch for the message postponing I have broken some time
ago, and also neat graying of 'send' and 'postpone' menu entries and
toolbar buttons in the compose window. I wonder if the rules for graying
should be the same for both buttons but that's the way it has been
implemented so far.
Actually, I find continuation of postponed messages not very intuitive
but, well, don't see better solutions. Yet. Suggestions are welcome.
I have had a quick look over GtkExText and it seems that it would not
be too difficult to use it as replacement for GtkText. the only issues
I see are: a. we have one more dependency; this is what I am concerned
with, and b.GtkExText has still some rough edges in the API (but I hope
they can be smoothened).
/Pawel
PS.
Concerning my previous remarks on the notify window, I have noticed one
can swith off the fetching notify window in the preferences and it
really made me happy; I haven't been able to find corresponding setting
for sending...
? balsa
? sensitive.patch
? src/.libs
Index: src/sendmsg-window.c
===================================================================
RCS file: /cvs/gnome/balsa/src/sendmsg-window.c,v
retrieving revision 1.159
diff -c -r1.159 sendmsg-window.c
*** src/sendmsg-window.c 2000/03/01 01:02:34 1.159
--- src/sendmsg-window.c 2000/03/01 15:43:11
***************
*** 53,58 ****
--- 53,59 ----
void send_body_wrap (Body *body, GtkText *text);
+ static void check_readiness(GtkEditable *w, BalsaSendmsg *bsmsg);
static void set_menus(BalsaSendmsg*);
static gint toggle_from_cb (GtkWidget *, BalsaSendmsg *);
static gint toggle_to_cb (GtkWidget *, BalsaSendmsg *);
***************
*** 94,105 ****
--- 95,109 ----
static GnomeUIInfo main_toolbar[] =
{
+ #define TOOL_SEND_POS 0
GNOMEUIINFO_ITEM_STOCK (N_ ("Send"), N_ ("Send this mail"), send_message_cb,
GNOME_STOCK_PIXMAP_MAIL_SND),
GNOMEUIINFO_SEPARATOR,
+ #define TOOL_ATTACH_POS 2
GNOMEUIINFO_ITEM_STOCK (N_ ("Attach"),N_ ("Add attachments to this message"),
attach_clicked, GNOME_STOCK_PIXMAP_ATTACH),
GNOMEUIINFO_SEPARATOR,
+ #define TOOL_POSTPONE_POS 4
GNOMEUIINFO_ITEM_STOCK (N_ ("Postpone"), N_ ("Continue this message later"),
postpone_message_cb, GNOME_STOCK_PIXMAP_SAVE),
GNOMEUIINFO_SEPARATOR,
***************
*** 118,136 ****
static GnomeUIInfo file_menu[] =
{
GNOMEUIINFO_ITEM_STOCK(N_ ("_Include File..."), NULL,
include_file_cb, GNOME_STOCK_MENU_OPEN),
GNOMEUIINFO_ITEM_STOCK(N_ ("_Attach file..."), NULL,
attach_clicked, GNOME_STOCK_MENU_ATTACH),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK(N_ ("_Send"),N_ ("Send the currently edited message"),
send_message_cb, GNOME_STOCK_MENU_MAIL_SND),
GNOMEUIINFO_ITEM_STOCK(N_ ("_Postpone"), NULL,
postpone_message_cb, GNOME_STOCK_MENU_SAVE),
GNOMEUIINFO_ITEM_STOCK(N_ ("Print"), N_ ("Print the edited message"),
print_message_cb, GNOME_STOCK_PIXMAP_PRINT),
GNOMEUIINFO_SEPARATOR,
!
GNOMEUIINFO_MENU_CLOSE_ITEM(close_window, NULL),
GNOMEUIINFO_END
--- 122,145 ----
static GnomeUIInfo file_menu[] =
{
+ #define MENU_FILE_INCLUDE_POS 0
GNOMEUIINFO_ITEM_STOCK(N_ ("_Include File..."), NULL,
include_file_cb, GNOME_STOCK_MENU_OPEN),
+ #define MENU_FILE_ATTACH_POS 1
GNOMEUIINFO_ITEM_STOCK(N_ ("_Attach file..."), NULL,
attach_clicked, GNOME_STOCK_MENU_ATTACH),
GNOMEUIINFO_SEPARATOR,
+ #define MENU_FILE_SEND_POS 3
GNOMEUIINFO_ITEM_STOCK(N_ ("_Send"),N_ ("Send the currently edited message"),
send_message_cb, GNOME_STOCK_MENU_MAIL_SND),
+ #define MENU_FILE_POSTPONE_POS 4
GNOMEUIINFO_ITEM_STOCK(N_ ("_Postpone"), NULL,
postpone_message_cb, GNOME_STOCK_MENU_SAVE),
+ #define MENU_FILE_PRINT_POS 5
GNOMEUIINFO_ITEM_STOCK(N_ ("Print"), N_ ("Print the edited message"),
print_message_cb, GNOME_STOCK_PIXMAP_PRINT),
GNOMEUIINFO_SEPARATOR,
! #define MENU_FILE_PRINT_POS 7
GNOMEUIINFO_MENU_CLOSE_ITEM(close_window, NULL),
GNOMEUIINFO_END
***************
*** 496,502 ****
--- 505,514 ----
create_email_entry(table, _("From:"),0,GNOME_STOCK_MENU_BOOK_BLUE,msg->from);
/* To: */
create_email_entry(table, _("To:"), 1, GNOME_STOCK_MENU_BOOK_RED, msg->to );
+ gtk_signal_connect (GTK_OBJECT (msg->to[1]), "changed",
+ GTK_SIGNAL_FUNC (check_readiness), msg);
+
/* Subject: */
msg->subject[0] = gtk_label_new (_("Subject:"));
gtk_misc_set_alignment (GTK_MISC (msg->subject[0]), 0.0, 0.5);
***************
*** 629,651 ****
/* continueBody ---------------------------------------------------------
a short-circuit procedure for the 'Continue action'
*/
static void
continueBody(Message * message, BalsaSendmsg *msg)
{
GString *rbdy;
! g_return_if_fail(message->body_list != NULL); /* FIXME: is it needed? */
!
rbdy = content2reply (message, NULL);
gtk_text_insert (GTK_TEXT (msg->text), NULL, NULL, NULL, rbdy->str,
strlen (rbdy->str));
g_string_free (rbdy, TRUE);
}
/* quoteBody ------------------------------------------------------------
quotes properly the body of the message
- Continue basically copies the text over to the entry field.
*/
static void
quoteBody(Message * message, BalsaSendmsg *msg, SendType type)
--- 641,663 ----
/* continueBody ---------------------------------------------------------
a short-circuit procedure for the 'Continue action'
+ basically copies the text over to the entry field.
*/
static void
continueBody(Message * message, BalsaSendmsg *msg)
{
GString *rbdy;
! message_body_ref (message);
rbdy = content2reply (message, NULL);
gtk_text_insert (GTK_TEXT (msg->text), NULL, NULL, NULL, rbdy->str,
strlen (rbdy->str));
g_string_free (rbdy, TRUE);
+ message_body_unref (message);
}
/* quoteBody ------------------------------------------------------------
quotes properly the body of the message
*/
static void
quoteBody(Message * message, BalsaSendmsg *msg, SendType type)
***************
*** 653,662 ****
GString *rbdy;
gchar *str, *personStr;
! message_body_ref (message); /* avoid unexpected object vanishing(?) */
- //body = (Body *) message->body_list->data;
-
personStr = (message->from && message->from->personal) ?
message->from->personal : _("you");
--- 665,672 ----
GString *rbdy;
gchar *str, *personStr;
! message_body_ref (message);
personStr = (message->from && message->from->personal) ?
message->from->personal : _("you");
***************
*** 1043,1048 ****
--- 1053,1084 ----
}
+ static gint
+ is_ready_to_send(BalsaSendmsg * bsmsg) {
+ gchar *tmp;
+ size_t len;
+
+ tmp = gtk_entry_get_text (GTK_ENTRY (bsmsg->to[1]));
+ len = strlen (tmp);
+
+ if (len < 1) /* empty */
+ return FALSE;
+
+ if (tmp[len - 1] == '@') /* this shouldn't happen */
+ return FALSE;
+
+ if (len < 4)
+ {
+ if (strchr (tmp, '@')) /* you won't have an @ in an
+ address less than 4 characters */
+ return FALSE;
+
+ /* assume they are mailing it to someone in their local domain */
+ }
+ return TRUE;
+ }
+
+
static gint
send_message_cb (GtkWidget * widget, BalsaSendmsg * bsmsg)
{
***************
*** 1050,1077 ****
Body *body;
gchar *tmp;
gchar *def_charset;
-
- tmp = gtk_entry_get_text (GTK_ENTRY (bsmsg->to[1]));
- {
- size_t len;
- len = strlen (tmp);
-
- if (len < 1) /* empty */
- return FALSE;
-
- if (tmp[len - 1] == '@') /* this shouldn't happen */
- return FALSE;
! if (len < 4)
! {
! if (strchr (tmp, '@')) /* you won't have an @ in an
! address less than 4 characters */
! return FALSE;
- /* assume they are mailing it to someone in their local domain */
- }
- }
-
message = message_new ();
message->from = make_address_from_string(gtk_entry_get_text
--- 1086,1094 ----
Body *body;
gchar *tmp;
gchar *def_charset;
! if(! is_ready_to_send(bsmsg)) return FALSE;
message = message_new ();
message->from = make_address_from_string(gtk_entry_get_text
***************
*** 1186,1212 ****
Body *body;
gchar *tmp;
! tmp = gtk_entry_get_text (GTK_ENTRY (bsmsg->to[1]));
! {
! size_t len;
! len = strlen (tmp);
- if (len < 1) /* empty */
- return FALSE;
-
- if (tmp[len - 1] == '@') /* this shouldn't happen */
- return FALSE;
-
- if (len < 4)
- {
- if (strchr (tmp, '@')) /* you won't have an @ in an
- address less than 4 characters */
- return FALSE;
-
- /* assume they are mailing it to someone in their local domain */
- }
- }
-
message = message_new ();
message->from = make_address_from_string(gtk_entry_get_text
--- 1203,1210 ----
Body *body;
gchar *tmp;
! if(! is_ready_to_send(bsmsg) ) return FALSE;
message = message_new ();
message->from = make_address_from_string(gtk_entry_get_text
***************
*** 1227,1233 ****
message->reply_to = make_address_from_string(tmp);
-
body = body_new ();
body->buffer = gtk_editable_get_chars(GTK_EDITABLE (bsmsg->text), 0,
--- 1225,1230 ----
***************
*** 1424,1429 ****
--- 1421,1438 ----
}
+ static void
+ check_readiness(GtkEditable *w, BalsaSendmsg *bsmsg)
+ {
+ gint state = is_ready_to_send(bsmsg);
+
+ gtk_widget_set_sensitive(file_menu[MENU_FILE_SEND_POS ].widget, state);
+ gtk_widget_set_sensitive(file_menu[MENU_FILE_POSTPONE_POS].widget, state);
+
+ gtk_widget_set_sensitive(main_toolbar[TOOL_SEND_POS ].widget, state);
+ gtk_widget_set_sensitive(main_toolbar[TOOL_POSTPONE_POS].widget, state);
+ }
+
static gint
toggle_entry (GtkWidget *entry[], int pos, int cnt)
{
***************
*** 1505,1510 ****
--- 1514,1522 ----
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(
iso_charset_menu[i].widget), TRUE);
msg->charset_idx = i;
+
+ /* gray 'send' and 'postpone' */
+ check_readiness(GTK_EDITABLE(msg->to[1]), msg);
}
/* create_font_name returns iso8859 font name based on given font
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]