From 84109d4a12a97358dbb4029aaaae7c1326dd02d0 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Tue, 24 Sep 2002 12:10:26 +0000 Subject: [PATCH] * src/compose.[ch] Disable user actions when sending --- ChangeLog.claws | 5 +++++ configure.in | 2 +- src/compose.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++--- src/compose.h | 2 ++ 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/ChangeLog.claws b/ChangeLog.claws index 97fc7dfcd..672a7a062 100644 --- a/ChangeLog.claws +++ b/ChangeLog.claws @@ -1,3 +1,8 @@ +2002-09-24 [colin] 0.8.3claws18 + + * src/compose.[ch] + Disable user actions when sending + 2002-09-24 [colin] 0.8.3claws17 * src/procmime.c diff --git a/configure.in b/configure.in index ab7a2beeb..ae9137006 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ MINOR_VERSION=8 MICRO_VERSION=3 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws17 +EXTRA_VERSION=claws18 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/compose.c b/src/compose.c index 201f04a3f..5805df052 100644 --- a/src/compose.c +++ b/src/compose.c @@ -167,6 +167,8 @@ static Compose *compose_create (PrefsAccount *account, static void compose_toolbar_create (Compose *compose, GtkWidget *container); static void compose_toolbar_update (Compose *compose); +static void compose_toolbar_set_sensitive (Compose *compose, + gboolean sensitive); static GtkWidget *compose_account_option_menu_create (Compose *compose); @@ -5209,6 +5211,33 @@ static void compose_toolbar_create(Compose *compose, gtk_widget_show_all(toolbar); } +static void compose_toolbar_set_sensitive (Compose * compose, gboolean sensitive) +{ + GSList *items = compose->toolbar->t_action_list; + if (compose->toolbar->send_btn) + gtk_widget_set_sensitive(compose->toolbar->send_btn, sensitive); + if (compose->toolbar->sendl_btn) + gtk_widget_set_sensitive(compose->toolbar->sendl_btn, sensitive); + if (compose->toolbar->draft_btn ) + gtk_widget_set_sensitive(compose->toolbar->draft_btn , sensitive); + if (compose->toolbar->insert_btn ) + gtk_widget_set_sensitive(compose->toolbar->insert_btn , sensitive); + if (compose->toolbar->attach_btn) + gtk_widget_set_sensitive(compose->toolbar->attach_btn, sensitive); + if (compose->toolbar->sig_btn) + gtk_widget_set_sensitive(compose->toolbar->sig_btn, sensitive); + if (compose->toolbar->exteditor_btn) + gtk_widget_set_sensitive(compose->toolbar->exteditor_btn, sensitive); + if (compose->toolbar->linewrap_btn) + gtk_widget_set_sensitive(compose->toolbar->linewrap_btn, sensitive); + if (compose->toolbar->addrbook_btn) + gtk_widget_set_sensitive(compose->toolbar->addrbook_btn, sensitive); + for (; items != NULL; items = g_slist_next(items)) { + ToolbarSylpheedActions *item = (ToolbarSylpheedActions *)items->data; + gtk_widget_set_sensitive(item->widget, sensitive); + } +} + static GtkWidget *compose_account_option_menu_create(Compose *compose) { GList *accounts; @@ -6226,6 +6255,17 @@ static void attach_key_pressed(GtkWidget *widget, GdkEventKey *event, } } +static void compose_allow_user_actions (Compose *compose, gboolean allow) +{ + GtkItemFactory *ifactory = gtk_item_factory_from_widget(compose->menubar); + compose_toolbar_set_sensitive(compose, allow); + menu_set_sensitive(ifactory, "/File", allow); + menu_set_sensitive(ifactory, "/Edit", allow); + menu_set_sensitive(ifactory, "/Message", allow); + menu_set_sensitive(ifactory, "/Tools", allow); + menu_set_sensitive(ifactory, "/Help", allow); +} + static void compose_send_cb(gpointer data, guint action, GtkWidget *widget) { Compose *compose = (Compose *)data; @@ -6235,9 +6275,13 @@ static void compose_send_cb(gpointer data, guint action, GtkWidget *widget) if (alertpanel(_("Offline warning"), _("You're working offline. Override?"), _("Yes"), _("No"), NULL) != G_ALERTDEFAULT) - return; - + return; + + compose_allow_user_actions (compose, FALSE); + compose->sending = TRUE; val = compose_send(compose); + compose_allow_user_actions (compose, TRUE); + compose->sending = FALSE; if (val == 0) gtk_widget_destroy(compose->window); } @@ -6375,7 +6419,10 @@ static void compose_insert_file_cb(gpointer data, guint action, static gint compose_delete_cb(GtkWidget *widget, GdkEventAny *event, gpointer data) { - compose_close_cb(data, 0, NULL); + Compose *compose = (Compose *)data; + if (compose->sending) + return TRUE; + compose_close_cb(compose, 0, NULL); return TRUE; } @@ -6449,6 +6496,8 @@ static void compose_ext_editor_cb(gpointer data, guint action, static void compose_destroy_cb(GtkWidget *widget, Compose *compose) { + if (compose->sending) + return; compose_destroy(compose); } diff --git a/src/compose.h b/src/compose.h index 651e00505..ae330beb0 100644 --- a/src/compose.h +++ b/src/compose.h @@ -168,6 +168,8 @@ struct _Compose gboolean modified; + gboolean sending; + gboolean return_receipt; gboolean paste_as_quotation; -- 2.25.1