commit a80d0752548890b9f9beba6032da439bf73bdc04
parent eef80ebe430c6b4f835f0068c03002b2d44e627d
Author: Oliver Lowe <o@olowe.co>
Date: Tue, 30 Dec 2025 18:47:08 +1100
replace noticeview with a basic error dialog
Only ever used to display the message "Broken MIME part" after PGP
support dropped. The broken MIME message can be done fine with
statdard GTK stuff.
Diffstat:
14 files changed, 12 insertions(+), 465 deletions(-)
diff --git a/src/mainwindow.c b/src/mainwindow.c
@@ -2826,10 +2826,10 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
prefs_common.mainwin_x,
prefs_common.mainwin_y);
- /* CLAWS: previous "gtk_widget_show_all" makes noticeview
- * and mimeview icon list/ctree lose track of their visibility states */
- if (!noticeview_is_visible(mainwin->messageview->noticeview))
- gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
+ /*
+ * previous "gtk_widget_show_all" makes mimeview
+ * icon list/ctree lose track of their visibility states.
+ */
if (mainwin->messageview->mimeview->ctree_mode)
gtk_widget_hide(mainwin->messageview->mimeview->icon_mainbox);
else
diff --git a/src/messageview.c b/src/messageview.c
@@ -317,25 +317,15 @@ static GtkRadioActionEntry msgview_radio_dec_entries[] =
MessageView *messageview_create(MainWindow *mainwin)
{
- MessageView *messageview;
- GtkWidget *vbox;
- MimeView *mimeview;
- NoticeView *noticeview;
-
- debug_print("Creating message view...\n");
- messageview = g_new0(MessageView, 1);
+ MessageView *messageview = g_new0(MessageView, 1);
- noticeview = noticeview_create(mainwin);
-
- mimeview = mimeview_create(mainwin);
+ MimeView *mimeview = mimeview_create(mainwin);
mimeview->textview = textview_create();
mimeview->textview->messageview = messageview;
mimeview->messageview = messageview;
- vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name(GTK_WIDGET(vbox), "messageview");
- gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET_PTR(noticeview),
- FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox),
GTK_WIDGET_PTR(mimeview), TRUE, TRUE, 0);
gtk_widget_show(vbox);
@@ -344,7 +334,6 @@ MessageView *messageview_create(MainWindow *mainwin)
messageview->new_window = FALSE;
messageview->window = NULL;
messageview->mimeview = mimeview;
- messageview->noticeview = noticeview;
messageview->mainwin = mainwin;
messageview->statusbar = NULL;
@@ -639,7 +628,6 @@ MessageView *messageview_create_with_new_window(MainWindow *mainwin)
void messageview_init(MessageView *messageview)
{
mimeview_init(messageview->mimeview);
- noticeview_hide(messageview->noticeview);
}
static gboolean find_broken_func(GNode *node, gpointer data)
@@ -826,7 +814,6 @@ static void messageview_find_part_depth_first(MimeInfoSearch *context, MimeMedia
gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
gboolean all_headers)
{
- gchar *text = NULL;
gchar *file;
MimeInfo *mimeinfo, *root;
gchar *subject = NULL;
@@ -841,7 +828,6 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
return 0;
}
- noticeview_hide(messageview->noticeview);
mimeview_clear(messageview->mimeview);
messageview->updating = TRUE;
@@ -928,23 +914,10 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
main_create_mailing_list_menu(messageview->mainwin, messageview->msginfo);
if (find_broken_part(mimeinfo) != NULL) {
- noticeview_set_icon(messageview->noticeview,
- STOCK_PIXMAP_NOTICE_WARN);
- if (!noticeview_is_visible(messageview->noticeview)) {
- noticeview_set_text(messageview->noticeview, _("Message doesn't conform to MIME standard. "
- "It may render wrongly."));
- gtk_widget_hide(messageview->noticeview->button);
- gtk_widget_hide(messageview->noticeview->button2);
- } else {
- gchar *full = g_strconcat(
- gtk_label_get_text(GTK_LABEL(messageview->noticeview->text)),
- "\n",
- _("Message doesn't conform to MIME standard. "
- "It may render wrongly."), NULL);
- noticeview_set_text(messageview->noticeview, full);
- g_free(full);
- }
- noticeview_show(messageview->noticeview);
+ GtkDialogFlags flag = GTK_DIALOG_DESTROY_WITH_PARENT;
+ GtkWidget *dialog = gtk_message_dialog_new(messageview->mainwin, flag, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Broken MIME part");
+ g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
+ gtk_widget_show(dialog);
}
root = mimeinfo;
@@ -1025,7 +998,6 @@ void messageview_clear(MessageView *messageview)
}
mimeview_clear(messageview->mimeview);
- noticeview_hide(messageview->noticeview);
}
void messageview_destroy(MessageView *messageview)
@@ -1062,7 +1034,6 @@ void messageview_destroy(MessageView *messageview)
}
mimeview_destroy(messageview->mimeview);
- noticeview_destroy(messageview->noticeview);
procmsg_msginfo_free(&(messageview->msginfo));
toolbar_clear_list(TOOLBAR_MSGVIEW);
diff --git a/src/messageview.h b/src/messageview.h
@@ -41,7 +41,6 @@ struct _MessageView
GtkWidget *menubar;
MimeView *mimeview;
- NoticeView *noticeview;
GtkWidget *statusbar;
gint statusbar_cid;
diff --git a/src/mimeview.h b/src/mimeview.h
@@ -30,7 +30,6 @@ typedef struct _MimeViewer MimeViewer;
#include "textview.h"
#include "messageview.h"
#include "procmime.h"
-#include "noticeview.h"
typedef enum
{
diff --git a/src/noticeview.c b/src/noticeview.c
@@ -1,300 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2025 the Claws Mail 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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "defs.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.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);
-static void noticeview_2ndbutton_pressed(GtkButton *button, NoticeView *noticeview);
-static gboolean noticeview_icon_pressed (GtkWidget *widget, GdkEventButton *evt,
- NoticeView *noticeview);
-static gboolean noticeview_visi_notify(GtkWidget *widget,
- GdkEventVisibility *event,
- NoticeView *noticeview);
-static gboolean noticeview_leave_notify(GtkWidget *widget,
- GdkEventCrossing *event,
- NoticeView *textview);
-static gboolean noticeview_enter_notify(GtkWidget *widget,
- GdkEventCrossing *event,
- NoticeView *textview);
-
-static GdkCursor *hand_cursor = NULL;
-
-static void set_hand_cursor(GdkWindow *window)
-{
- cm_return_if_fail(window != NULL);
-
- if (!hand_cursor) {
- hand_cursor = gdk_cursor_new_for_display(
- gdk_window_get_display(window), GDK_HAND2);
- }
-}
-
-NoticeView *noticeview_create(MainWindow *mainwin)
-{
- NoticeView *noticeview;
- GtkWidget *vgrid;
- GtkWidget *hsep;
- GtkWidget *hgrid;
- GtkWidget *icon;
- GtkWidget *text;
- GtkWidget *widget;
- GtkWidget *widget2;
- GtkWidget *evtbox;
-
- debug_print("Creating notice view...\n");
- noticeview = g_new0(NoticeView, 1);
-
- noticeview->window = mainwin->window;
-
- vgrid = gtk_grid_new();
- gtk_widget_set_name(GTK_WIDGET(vgrid), "noticeview");
- gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
- GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing(GTK_GRID(vgrid), 4);
- gtk_widget_show(vgrid);
- hsep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
- g_object_set(hsep, "margin", 1, NULL);
- gtk_container_add(GTK_CONTAINER(vgrid), hsep);
-
- hgrid = gtk_grid_new();
- gtk_orientable_set_orientation(GTK_ORIENTABLE(hgrid),
- GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show(hgrid);
- g_object_set(hgrid, "margin", 1, NULL);
- gtk_container_add(GTK_CONTAINER(vgrid), hgrid);
-
- evtbox = gtk_event_box_new();
- gtk_event_box_set_visible_window(GTK_EVENT_BOX(evtbox), FALSE);
- gtk_widget_show(evtbox);
-
- icon = stock_pixmap_widget(STOCK_PIXMAP_NOTICE_WARN);
-
- gtk_widget_show(icon);
- g_signal_connect(G_OBJECT(evtbox), "button-press-event",
- G_CALLBACK(noticeview_icon_pressed),
- (gpointer) noticeview);
- g_signal_connect(G_OBJECT(evtbox), "motion-notify-event",
- G_CALLBACK(noticeview_visi_notify), noticeview);
- g_signal_connect(G_OBJECT(evtbox), "leave-notify-event",
- G_CALLBACK(noticeview_leave_notify), noticeview);
- g_signal_connect(G_OBJECT(evtbox), "enter-notify-event",
- G_CALLBACK(noticeview_enter_notify), noticeview);
-
- gtk_container_add(GTK_CONTAINER(evtbox), icon);
- gtk_container_add(GTK_CONTAINER(hgrid), evtbox);
-
- text = gtk_label_new("");
- gtk_widget_show(text);
- gtk_container_add(GTK_CONTAINER(hgrid), text);
-
- widget = gtk_button_new_with_label("");
- g_signal_connect(G_OBJECT(widget), "clicked",
- G_CALLBACK(noticeview_button_pressed),
- (gpointer) noticeview);
- g_object_set(widget, "margin-right", 4, NULL);
- gtk_container_add(GTK_CONTAINER(hgrid), widget);
-
- widget2 = gtk_button_new_with_label("");
- g_signal_connect(G_OBJECT(widget2), "clicked",
- G_CALLBACK(noticeview_2ndbutton_pressed),
- (gpointer) noticeview);
- gtk_container_add(GTK_CONTAINER(hgrid), widget2);
-
- noticeview->vgrid = vgrid;
- noticeview->hsep = hsep;
- noticeview->hgrid = hgrid;
- noticeview->icon = icon;
- noticeview->text = text;
- noticeview->button = widget;
- noticeview->button2= widget2;
- noticeview->evtbox = evtbox;
- noticeview->visible= TRUE;
- return noticeview;
-}
-
-void noticeview_destroy(NoticeView *noticeview)
-{
- g_free(noticeview);
-}
-
-gboolean noticeview_is_visible(NoticeView *noticeview)
-{
- return noticeview->visible;
-}
-
-void noticeview_show(NoticeView *noticeview)
-{
- if (!noticeview->visible) {
- gtk_widget_show(GTK_WIDGET_PTR(noticeview));
- noticeview->visible = TRUE;
- }
-}
-
-void noticeview_hide(NoticeView *noticeview)
-{
- if (noticeview && noticeview->visible) {
- gtk_widget_hide(GTK_WIDGET_PTR(noticeview));
- noticeview->visible = FALSE;
- }
-}
-
-void noticeview_set_text(NoticeView *noticeview, const char *text)
-{
- cm_return_if_fail(noticeview);
- gtk_label_set_text(GTK_LABEL(noticeview->text), text);
-}
-
-void noticeview_set_button_text(NoticeView *noticeview, const char *text)
-{
- cm_return_if_fail(noticeview);
-
- if (text != NULL) {
- gtk_label_set_text
- (GTK_LABEL(gtk_bin_get_child(GTK_BIN((noticeview->button)))), text);
- gtk_widget_show(noticeview->button);
- } else
- gtk_widget_hide(noticeview->button);
-
- /* Callers defining only one button don't have to mind
- * resetting the second one. Callers defining two have
- * to define the second button after the first one.
- */
- gtk_widget_hide(noticeview->button2);
-}
-
-void noticeview_set_button_press_callback(NoticeView *noticeview,
- void (*callback)(void),
- 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);
- }
-}
-
-static gboolean noticeview_icon_pressed(GtkWidget *widget, GdkEventButton *evt,
- NoticeView *noticeview)
-{
- if (evt && evt->button == 1 && noticeview->icon_clickable) {
- noticeview_button_pressed(NULL, noticeview);
- }
- return FALSE;
-}
-
-static gboolean noticeview_visi_notify(GtkWidget *widget,
- GdkEventVisibility *event,
- NoticeView *noticeview)
-{
- GdkWindow *window = gtk_widget_get_window(noticeview->evtbox);
-
- if (noticeview->icon_clickable) {
- set_hand_cursor(window);
- gdk_window_set_cursor(window, hand_cursor);
- }
- return FALSE;
-}
-
-static gboolean noticeview_leave_notify(GtkWidget *widget,
- GdkEventCrossing *event,
- NoticeView *noticeview)
-{
- gdk_window_set_cursor(gtk_widget_get_window(noticeview->evtbox), NULL);
- return FALSE;
-}
-
-static gboolean noticeview_enter_notify(GtkWidget *widget,
- GdkEventCrossing *event,
- NoticeView *noticeview)
-{
- GdkWindow *window = gtk_widget_get_window(noticeview->evtbox);
-
- if (noticeview->icon_clickable) {
- set_hand_cursor(window);
- gdk_window_set_cursor(window, hand_cursor);
- }
- return FALSE;
-}
-
-void noticeview_set_2ndbutton_text(NoticeView *noticeview, const char *text)
-{
- cm_return_if_fail(noticeview);
-
- if (text != NULL) {
- gtk_label_set_text
- (GTK_LABEL(gtk_bin_get_child(GTK_BIN((noticeview->button2)))), text);
- gtk_widget_show(noticeview->button2);
- } else
- gtk_widget_hide(noticeview->button2);
-}
-
-void noticeview_set_2ndbutton_press_callback(NoticeView *noticeview,
- void (*callback)(void),
- gpointer *user_data)
-{
- noticeview->press2 = (void (*) (NoticeView *, gpointer)) callback;
- noticeview->user_data2 = user_data;
-}
-
-static void noticeview_2ndbutton_pressed(GtkButton *button, NoticeView *noticeview)
-{
- if (noticeview->press2) {
- noticeview->press2(noticeview, noticeview->user_data2);
- }
-}
-
-void noticeview_set_icon(NoticeView *noticeview, StockPixmap icon)
-{
- GdkPixbuf *pixbuf;
-
- if (stock_pixbuf_gdk(icon, &pixbuf) < 0)
- return;
-
- gtk_image_set_from_pixbuf(GTK_IMAGE(noticeview->icon), pixbuf);
-}
-
-void noticeview_set_icon_clickable(NoticeView *noticeview, gboolean setting)
-{
- noticeview->icon_clickable = setting;
-}
-
-void noticeview_set_tooltip (NoticeView *noticeview, const gchar *text)
-{
- CLAWS_SET_TIP(noticeview->evtbox,
- text);
-
-}
diff --git a/src/noticeview.h b/src/noticeview.h
@@ -1,76 +0,0 @@
-/*
- * Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 Hiroyuki Yamamoto & The Claws Mail 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 3 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, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef NOTICEVIEW_H__
-#define NOTICEVIEW_H__
-
-#include "viewtypes.h"
-#include "stock_pixmap.h"
-
-struct _NoticeView
-{
- GtkWidget *vgrid;
- GtkWidget *hsep;
- GtkWidget *hgrid;
- GtkWidget *icon;
- GtkWidget *text;
- GtkWidget *button;
- GtkWidget *button2;
- GtkWidget *window;
- gboolean visible;
- gpointer user_data;
- gpointer user_data2;
- void (*press) (NoticeView *, gpointer user_data);
- void (*press2) (NoticeView *, gpointer user_data);
- gboolean icon_clickable;
- GtkWidget *evtbox;
-};
-
-NoticeView *noticeview_create (MainWindow *mainwin);
-void noticeview_destroy (NoticeView *noticeview);
-void noticeview_init (NoticeView *noticeview);
-void noticeview_set_icon (NoticeView *noticeview,
- StockPixmap icon);
-void noticeview_set_text (NoticeView *noticeview,
- const gchar *text);
-void noticeview_set_button_text
- (NoticeView *noticeview,
- const gchar *text);
-void noticeview_set_2ndbutton_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,
- void (*callback)(void),
- gpointer *user_data);
-void noticeview_set_2ndbutton_press_callback
- (NoticeView *noticeview,
- void (*callback)(void),
- gpointer *user_data);
-void noticeview_set_icon_clickable
- (NoticeView *noticeview,
- gboolean setting);
-void noticeview_set_tooltip
- (NoticeView *noticeview,
- const gchar *text);
-#endif /* NOTICEVIEW_H__ */
diff --git a/src/prefs_common.h b/src/prefs_common.h
@@ -96,14 +96,6 @@ typedef enum
typedef enum
{
- AVATARS_DISABLE = 0,
- AVATARS_ENABLE_CAPTURE = 1,
- AVATARS_ENABLE_RENDER = 2,
- AVATARS_ENABLE_BOTH = 3
-} EnableAvatars;
-
-typedef enum
-{
COL_MISSPELLED,
COL_QUOTE_LEVEL1,
COL_QUOTE_LEVEL2,
diff --git a/src/procheader.c b/src/procheader.c
@@ -774,18 +774,6 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
default:
break;
}
- /* to avoid performance penalty hooklist is invoked only for
- headers known to be able to generate avatars */
- if (hnum == H_FROM || hnum == H_X_FACE || hnum == H_FACE) {
- AvatarCaptureData *acd = g_new0(AvatarCaptureData, 1);
- /* no extra memory is wasted, hooks are expected to
- take care of copying members when needed */
- acd->msginfo = msginfo;
- acd->header = hentry_full[hnum].name;
- acd->content = hp;
- hooks_invoke(AVATAR_HEADER_UPDATE_HOOKLIST, (gpointer)acd);
- g_free(acd);
- }
g_free(buf);
buf = NULL;
}
diff --git a/src/procheader.h b/src/procheader.h
@@ -14,7 +14,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
#ifndef __PROCHEADER_H__
@@ -26,8 +26,6 @@
#include "proctypes.h"
-#define AVATAR_HEADER_UPDATE_HOOKLIST "avatar_header_update"
-
struct _HeaderEntry
{
gchar *name;
diff --git a/src/procmsg.h b/src/procmsg.h
@@ -230,8 +230,6 @@ struct _MsgInfo
struct _MsgInfoExtraData
{
- GSList *avatars;
-
gchar *dispositionnotificationto;
gchar *returnreceiptto;
@@ -263,13 +261,6 @@ struct _MsgInfoUpdate {
MsgInfoUpdateFlags flags;
};
-struct _AvatarCaptureData
-{
- MsgInfo *msginfo;
- const gchar *header;
- const gchar *content;
-};
-
GSList *procmsg_read_cache (FolderItem *item,
gboolean scan_file);
void procmsg_msg_list_free (MsgInfoList *mlist);
diff --git a/src/proctypes.h b/src/proctypes.h
@@ -37,25 +37,18 @@ typedef struct _MsgFileInfo MsgFileInfo;
struct _MsgInfoUpdate;
typedef struct _MsgInfoUpdate MsgInfoUpdate;
-struct _AvatarCaptureData;
-typedef struct _AvatarCaptureData AvatarCaptureData;
-
struct _MsgInfoExtraData;
typedef struct _MsgInfoExtraData MsgInfoExtraData;
typedef GSList MsgInfoList;
typedef GSList MsgNumberList;
-
-
struct _HeaderEntry;
typedef struct _HeaderEntry HeaderEntry;
struct _Header;
typedef struct _Header Header;
-
-
struct _MimeType;
typedef struct _MimeType MimeType;
@@ -65,6 +58,4 @@ typedef struct _MimeInfo MimeInfo;
struct _MimeParser;
typedef struct _MimeParser MimeParser;
-
-
#endif
diff --git a/src/textview.c b/src/textview.c
@@ -1391,7 +1391,6 @@ void textview_clear(TextView *textview)
textview->prev_quote_level = -1;
textview->body_pos = 0;
- textview->avatar_type = 0;
if (textview->messageview->mainwin->cursor_count == 0) {
textview_set_cursor(window, text_cursor);
diff --git a/src/textview.h b/src/textview.h
@@ -75,7 +75,6 @@ struct _TextView
GtkTextIter uri_hover_start_iter;
GtkTextIter uri_hover_end_iter;
GtkWidget *image;
- gint avatar_type;
gboolean loading;
gboolean stop_loading;
gint prev_quote_level;
diff --git a/src/viewtypes.h b/src/viewtypes.h
@@ -34,8 +34,4 @@ typedef struct _TextView TextView;
struct _MimeView;
typedef struct _MimeView MimeView;
-
-struct _NoticeView;
-typedef struct _NoticeView NoticeView;
-
#endif