commit a80d0752548890b9f9beba6032da439bf73bdc04 from: Oliver Lowe date: Tue Dec 30 07:47:08 2025 UTC 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. commit - eef80ebe430c6b4f835f0068c03002b2d44e627d commit + a80d0752548890b9f9beba6032da439bf73bdc04 blob - e940a9380e5e0b14fa6fce17de795d508d893680 blob + 9a39b5760ead821db8d92708d1084b039366ee16 --- src/mainwindow.c +++ src/mainwindow.c @@ -2826,10 +2826,10 @@ static void main_window_set_widgets(MainWindow *mainwi 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 blob - acba62c760d7d0f74cd712e6f936f948862e9cd0 blob + 261de4fb5696e1bf56e2f9bc39f576859e0465d0 --- src/messageview.c +++ 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; + MessageView *messageview = g_new0(MessageView, 1); - debug_print("Creating message view...\n"); - 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(MainWi 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(MimeInfo 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, MsgInf return 0; } - noticeview_hide(messageview->noticeview); mimeview_clear(messageview->mimeview); messageview->updating = TRUE; @@ -928,23 +914,10 @@ gint messageview_show(MessageView *messageview, MsgInf 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); blob - 2ff07965593c99af0ff754d6f64ffd38d960e958 blob + 391e09f6c3a1f953869a248de170073f0187d043 --- src/messageview.h +++ src/messageview.h @@ -41,7 +41,6 @@ struct _MessageView GtkWidget *menubar; MimeView *mimeview; - NoticeView *noticeview; GtkWidget *statusbar; gint statusbar_cid; blob - 875ee32cd3bcdf17b021f5b9508e4a0857b693d3 blob + 565ab574ecfad621accae49270b616eccc7b0ab6 --- src/mimeview.h +++ 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 { blob - b4ae079109c0f81d20fbb00b7f9af89a9eee652e (mode 644) blob + /dev/null --- src/noticeview.c +++ /dev/null @@ -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 . - * - */ - -#include "defs.h" - -#include -#include -#include -#include -#include -#include - -#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); - -} blob - 7bd124d5ed87ca5192be5cf097fe5fe99541efd4 (mode 644) blob + /dev/null --- src/noticeview.h +++ /dev/null @@ -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 . - * - */ - -#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__ */ blob - 1dbecece7b4e8d0d68633e0721739a31847270d1 blob + 08ba425530831de503bcf416445d2a4d04148433 --- src/prefs_common.h +++ 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, blob - 4f3098ef8509b3259ebbbff28289f6fcda79a7bd blob + e65455c65827fc4de621cbad688c82205ba16405 --- src/procheader.c +++ src/procheader.c @@ -774,18 +774,6 @@ static MsgInfo *parse_stream(void *data, gboolean isst 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; } blob - a5c3201d0a9186187c9987a7df028d4a4753ed36 blob + db8a8863cb6367cb2edae6d1f00d1e5757d2d10a --- src/procheader.h +++ 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 . - * + * */ #ifndef __PROCHEADER_H__ @@ -26,8 +26,6 @@ #include "proctypes.h" -#define AVATAR_HEADER_UPDATE_HOOKLIST "avatar_header_update" - struct _HeaderEntry { gchar *name; blob - 1dbb8d58f7f8d2279a1cf4c67df6fe620f58b99e blob + 3840c37534f00c893f6556cc88d9ff7b42261f19 --- src/procmsg.h +++ 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); blob - 356a4a733d3ebd347ca2255e21b3107ea61756f6 blob + bc946a4ebdc63edfcac88601727327d747c41fcc --- src/proctypes.h +++ 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 blob - 918dfee20af7550444b760ad983680c6db7a4d9c blob + 04b9b53b4ac766960f3050429fd7f0c22c047919 --- src/textview.c +++ 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); blob - fc163c23838c4cde9501470d8b8ab2bc9cb7a199 blob + adf72459a38026750e69f79c6eab5b02c4fec0d0 --- src/textview.h +++ 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; blob - 6a3723644c7561c25bc9a275b2cc06d2a091d59a blob + 0f5e0ed68305bdedc3adae3c712b832e2cba65bc --- src/viewtypes.h +++ src/viewtypes.h @@ -34,8 +34,4 @@ typedef struct _TextView TextView; struct _MimeView; typedef struct _MimeView MimeView; - -struct _NoticeView; -typedef struct _NoticeView NoticeView; - #endif