+2002-07-21 [alfons] 0.7.8claws88
+
+ * po/POTFILES.in
+ * src/Makefile.am
+ * src/mainwindow.c
+ * src/messageview.[ch]
+ * src/noticeview.c ** NEW FILE **
+ * src/noticeview.h ** NEW FILE **
+ make return receipts work again
+ (UI idea by Leandro Pereira)
+
2002-07-21 [paul] 0.7.8claws87
* src/summaryview.c
MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws87
+EXTRA_VERSION=claws88
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
src/vcard.c
src/xml.c
src/xmlprops.c
+src/noticeview.c
matcher_parser_parse.y matcher_parser.h matcher_parser_parse.h \
string_match.h string_match.c \
selective_download.c selective_download.h \
- msgcache.h msgcache.c
+ msgcache.h msgcache.c \
+ noticeview.h noticeview.c
BUILT_SOURCES = \
quote_fmt_lex.c \
prefs_common.mainwin_height);
gtk_widget_show_all(vpaned);
+ /* CLAWS: previous "gtk_widget_show_all" makes noticeview
+ * lose track of its visibility state */
+ if (!noticeview_is_visible(mainwin->messageview->noticeview))
+ gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
+
mainwin->win.sep_none.hpaned = hpaned;
mainwin->win.sep_none.vpaned = vpaned;
break;
mainwin->win.sep_message.hpaned = hpaned;
gtk_widget_show_all(messagewin);
+
+ /* CLAWS: previous "gtk_widget_show_all" makes noticeview
+ * lose track of its visibility state */
+ if (!noticeview_is_visible(mainwin->messageview->noticeview))
+ gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
break;
case SEPARATE_BOTH:
gtk_box_pack_start(GTK_BOX(vbox_body),
gtk_widget_show_all(folderwin);
gtk_widget_show_all(messagewin);
+
+ /* CLAWS: previous "gtk_widget_show_all" makes noticeview
+ * lose track of its visibility state */
+ if (!noticeview_is_visible(mainwin->messageview->noticeview))
+ gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
break;
}
GdkEventKey *event,
MessageView *messageview);
+static void return_receipt_show (NoticeView *noticeview,
+ MsgInfo *msginfo);
+static void return_receipt_send_clicked (NoticeView *noticeview,
+ MsgInfo *msginfo);
+
MessageView *messageview_create(void)
{
MessageView *messageview;
TextView *textview;
ImageView *imageview;
MimeView *mimeview;
+ NoticeView *noticeview;
debug_print(_("Creating message view...\n"));
messageview = g_new0(MessageView, 1);
headerview = headerview_create();
+ noticeview = noticeview_create();
+
textview = textview_create();
textview->messageview = messageview;
vbox = gtk_vbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(headerview),
FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(noticeview),
+ FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(textview),
TRUE, TRUE, 0);
messageview->textview = textview;
messageview->imageview = imageview;
messageview->mimeview = mimeview;
+ messageview->noticeview = noticeview;
return messageview;
}
imageview_init(messageview->imageview);
mimeview_init(messageview->mimeview);
/*messageview_set_font(messageview);*/
+
+ noticeview_hide(messageview->noticeview);
}
static void notification_convert_header(gchar *dest, gint len,
(!msginfo->dispositionnotificationto))
return -1;
+ procmsg_msginfo_unset_flags(msginfo, MSG_RETRCPT_PENDING, 0);
+
/* write to temporary file */
g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg%d",
get_rc_dir(), G_DIR_SEPARATOR, (gint)msginfo);
notification_convert_header(buf, sizeof(buf), msginfo->subject,
strlen("Subject: "));
fprintf(fp, "Subject: Disposition notification: %s\n", buf);
+ debug_print("HEADER: Subject Disposition notification: %s\n", buf);
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmp, "fclose");
return;
}
- /* FIXME - doesn't tmpmsginfo->flags have the value
- * of msginfo->flags after procheader_parse()???
- * in any case, checking tmpmsginfo->flags for MSG_UNREAD
- * fixes the return-receipt-request bug */
-
tmpmsginfo = procheader_parse_file(file, msginfo->flags, TRUE, TRUE);
- if (MSG_IS_MIME(tmpmsginfo->flags))
- MSG_SET_TMP_FLAGS(msginfo->flags, MSG_MIME);
-
- if (prefs_common.return_receipt
- && (tmpmsginfo->dispositionnotificationto
- || tmpmsginfo->returnreceiptto)
- && (MSG_IS_UNREAD(tmpmsginfo->flags))
- && (MSG_IS_RETRCPT_PENDING(tmpmsginfo->flags))) {
- gint ok;
-
- if (alertpanel(_("Return Receipt"), _("Send return receipt ?"),
- _("Yes"), _("No"), NULL) == G_ALERTDEFAULT) {
- ok = disposition_notification_send(tmpmsginfo);
- if (ok < 0)
- alertpanel_error(_("Error occurred while sending notification."));
- }
- MSG_UNSET_PERM_FLAGS(tmpmsginfo->flags, MSG_RETRCPT_PENDING);
- }
headerview_show(messageview->headerview, tmpmsginfo);
procmsg_msginfo_free(tmpmsginfo);
procmime_mimeinfo_free(mimeinfo);
}
+ if (MSG_IS_RETRCPT_PENDING(msginfo->flags))
+ return_receipt_show(messageview->noticeview, msginfo);
+ else
+ noticeview_hide(messageview->noticeview);
+
g_free(file);
}
gtk_widget_grab_focus(GTK_WIDGET(mainwin->summaryview->ctree));
}
}
+
+static void return_receipt_show(NoticeView *noticeview, MsgInfo *msginfo)
+{
+ noticeview_set_text(noticeview, _("This messages asks for a return receipt."));
+ noticeview_set_button_text(noticeview, _("Send receipt"));
+ noticeview_set_button_press_callback(noticeview,
+ GTK_SIGNAL_FUNC(return_receipt_send_clicked),
+ (gpointer) msginfo);
+ noticeview_show(noticeview);
+}
+
+static void return_receipt_send_clicked(NoticeView *noticeview, MsgInfo *msginfo)
+{
+ if (disposition_notification_send(msginfo) >= 0)
+ noticeview_hide(noticeview);
+}
+
+
#include "textview.h"
#include "imageview.h"
#include "mimeview.h"
+#include "noticeview.h"
#include "procmsg.h"
typedef enum
TextView *textview;
ImageView *imageview;
MimeView *mimeview;
+ NoticeView *noticeview;
MainWindow *mainwin;
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2002 Hiroyuki Yamamoto & The Sylpheed Claws Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkpixmap.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#if HAVE_LIBCOMPFACE
+# include <compface.h>
+#endif
+
+#include "intl.h"
+#include "main.h"
+#include "headerview.h"
+#include "prefs_common.h"
+#include "gtkutils.h"
+#include "utils.h"
+#include "stock_pixmap.h"
+
+#include "noticeview.h"
+
+static void noticeview_button_pressed (GtkButton *button, NoticeView *noticeview);
+
+NoticeView *noticeview_create(void)
+{
+ NoticeView *noticeview;
+ GtkWidget *vbox;
+ GtkWidget *hsep;
+ GtkWidget *hbox;
+ GtkWidget *icon;
+ GtkWidget *text;
+ GtkWidget *widget;
+
+ debug_print(_("Creating notice view...\n"));
+ noticeview = g_new0(NoticeView, 1);
+
+ vbox = gtk_vbox_new(FALSE, 4);
+ gtk_widget_show(vbox);
+ hsep = gtk_hseparator_new();
+ gtk_box_pack_start(GTK_BOX(vbox), hsep, FALSE, TRUE, 0);
+
+ hbox = gtk_hbox_new(FALSE, 4);
+ gtk_widget_show(hbox);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
+
+ icon = stock_pixmap_widget(hbox, STOCK_PIXMAP_NOTICE_WARN);
+#if 0
+ /* also possible... */
+ icon = gtk_pixmap_new(NULL, NULL);
+#endif
+ gtk_widget_show(icon);
+
+ gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, TRUE, 0);
+
+ text = gtk_label_new("");
+ gtk_widget_show(text);
+ gtk_box_pack_start(GTK_BOX(hbox), text, FALSE, FALSE, 0);
+
+ widget = gtk_button_new_with_label("");
+ gtk_signal_connect(GTK_OBJECT(widget), "clicked",
+ GTK_SIGNAL_FUNC(noticeview_button_pressed),
+ (gpointer) noticeview);
+ gtk_widget_show(widget);
+ gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 4);
+
+ noticeview->vbox = vbox;
+ noticeview->hsep = hsep;
+ noticeview->hbox = hbox;
+ noticeview->icon = icon;
+ noticeview->text = text;
+ noticeview->button = widget;
+
+ noticeview->visible = TRUE;
+
+ return noticeview;
+}
+
+gboolean noticeview_is_visible(NoticeView *noticeview)
+{
+ return noticeview->visible;
+}
+
+void noticeview_show(NoticeView *noticeview)
+{
+ if (!noticeview->visible) {
+ gtk_widget_show_all(GTK_WIDGET_PTR(noticeview));
+ noticeview->visible = TRUE;
+ }
+}
+
+void noticeview_hide(NoticeView *noticeview)
+{
+ if (noticeview->visible) {
+ gtk_widget_hide(GTK_WIDGET_PTR(noticeview));
+ noticeview->visible = FALSE;
+ }
+}
+
+void noticeview_set_text(NoticeView *noticeview, const char *text)
+{
+ g_return_if_fail(noticeview);
+ gtk_label_set_text(GTK_LABEL(noticeview->text), text);
+}
+
+void noticeview_set_button_text(NoticeView *noticeview, const char *text)
+{
+ g_return_if_fail(noticeview);
+ gtk_label_set_text
+ (GTK_LABEL(GTK_BIN(noticeview->button)->child), text);
+}
+
+void noticeview_set_button_press_callback(NoticeView *noticeview,
+ GtkSignalFunc callback,
+ gpointer *user_data)
+{
+ noticeview->press = (void (*) (NoticeView *, gpointer)) callback;
+ noticeview->user_data = user_data;
+}
+
+static void noticeview_button_pressed(GtkButton *button, NoticeView *noticeview)
+{
+ if (noticeview->press) {
+ noticeview->press(noticeview, noticeview->user_data);
+ }
+}
+
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2002 Hiroyuki Yamamoto & The Sylpheed Claws Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef NOTICEVIEW_H__
+#define NOTICEVIEW_H__
+
+typedef struct _NoticeView NoticeView;
+
+struct _NoticeView
+{
+ GtkWidget *vbox;
+ GtkWidget *hsep;
+ GtkWidget *hbox;
+ GtkWidget *icon;
+ GtkWidget *text;
+ GtkWidget *button;
+ gboolean visible;
+ gpointer user_data;
+ void (*press) (NoticeView *, gpointer user_data);
+};
+
+NoticeView *noticeview_create (void);
+void noticeview_init (NoticeView *noticeview);
+void noticeview_set_icon (NoticeView *noticeview,
+ GtkWidget *icon);
+void noticeview_set_text (NoticeView *noticeview,
+ const gchar *text);
+void noticeview_set_button_text
+ (NoticeView *noticeview,
+ const gchar *text);
+gboolean noticeview_is_visible (NoticeView *noticeview);
+void noticeview_show (NoticeView *noticeview);
+void noticeview_hide (NoticeView *noticeview);
+
+void noticeview_set_button_press_callback
+ (NoticeView *noticeview,
+ GtkSignalFunc callback,
+ gpointer *user_data);
+
+#endif /* NOTICEVIEW_H__ */
+