talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 59cc913fa7c8ba77b3fec9f2c0ffdca324702c3d
parent 0dea882a3af437fb71a169445904966a758a7b3e
Author: Paul <paul@claws-mail.org>
Date:   Thu, 24 Mar 2022 11:28:17 +0000

prevent claws-mail logo from being themed

Diffstat:
Msrc/gtk/about.c | 4++--
Msrc/gtk/gtkutils.c | 8++++----
Msrc/main.c | 6+++---
Msrc/stock_pixmap.c | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
Msrc/stock_pixmap.h | 20+++++++++++++++-----
Msrc/wizard.c | 10+++++-----
6 files changed, 102 insertions(+), 32 deletions(-)

diff --git a/src/gtk/about.c b/src/gtk/about.c @@ -1,5 +1,5 @@ /* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client + * Claws Mail -- a GTK based, lightweight, and fast e-mail client * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify @@ -830,7 +830,7 @@ static void about_create(void) gtk_table_set_row_spacings (GTK_TABLE (table), 8); gtk_table_set_col_spacings (GTK_TABLE (table), 8); - image = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_LOGO); + image = priv_pixmap_widget(PRIV_PIXMAP_CLAWS_MAIL_LOGO); gtk_table_attach (GTK_TABLE (table), image, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND), (GtkAttachOptions) (0), 0, 0); diff --git a/src/gtk/gtkutils.c b/src/gtk/gtkutils.c @@ -1,6 +1,6 @@ /* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2021 the Claws Mail team and Hiroyuki Yamamoto + * Claws Mail -- a GTK based, lightweight, and fast e-mail client + * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto * * 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 @@ -714,8 +714,8 @@ void gtkut_widget_set_app_icon(GtkWidget *widget) cm_return_if_fail(gtk_widget_get_window(widget) != NULL); if (!icon_list) { GdkPixbuf *icon = NULL, *big_icon = NULL; - stock_pixbuf_gdk(STOCK_PIXMAP_CLAWS_MAIL_ICON, &icon); - stock_pixbuf_gdk(STOCK_PIXMAP_CLAWS_MAIL_LOGO, &big_icon); + priv_pixbuf_gdk(PRIV_PIXMAP_CLAWS_MAIL_ICON, &icon); + priv_pixbuf_gdk(PRIV_PIXMAP_CLAWS_MAIL_LOGO, &big_icon); if (icon) icon_list = g_list_append(icon_list, icon); if (big_icon) diff --git a/src/main.c b/src/main.c @@ -1,6 +1,6 @@ /* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team + * Claws Mail -- a GTK based, lightweight, and fast e-mail client + * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto * * 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 @@ -1362,7 +1362,7 @@ int main(int argc, char *argv[]) } #endif gtkut_widget_init(); - stock_pixbuf_gdk(STOCK_PIXMAP_CLAWS_MAIL_ICON, &icon); + priv_pixbuf_gdk(PRIV_PIXMAP_CLAWS_MAIL_ICON, &icon); gtk_window_set_default_icon(icon); folderview_initialize(); diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c @@ -1,6 +1,6 @@ /* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team + * Claws Mail -- a GTK based, lightweight, and fast e-mail client + * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto * * 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 @@ -236,6 +236,18 @@ #include "pixmaps/mark_read.xpm" #include "pixmaps/mark_unread.xpm" +typedef struct _PrivPixmapData PrivPixmapData; + +struct _PrivPixmapData +{ + gchar **data; + cairo_surface_t *pixmap; + cairo_pattern_t *mask; + gchar *file; + gchar *icon_path; + GdkPixbuf *pixbuf; +}; + typedef struct _StockPixmapData StockPixmapData; struct _StockPixmapData @@ -252,10 +264,6 @@ typedef struct _OverlayData OverlayData; struct _OverlayData { - gboolean is_pixmap; - cairo_surface_t *base_pixmap; - cairo_surface_t *overlay_pixmap; - GdkPixbuf *base_pixbuf; GdkPixbuf *overlay_pixbuf; @@ -271,6 +279,18 @@ struct _OverlayData static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname); +static PrivPixmapData privpixmaps[] = +{ + {claws_mail_icon_xpm , NULL, NULL, "claws_mail_icon", NULL, NULL}, + {claws_mail_icon_64_xpm , NULL, NULL, "claws_mail_icon_64", NULL, NULL}, +#ifndef GENERIC_UMPC + {claws_mail_logo_xpm , NULL, NULL, "claws_mail_logo", NULL, NULL}, +#else + {claws_mail_logo_small_xpm , NULL, NULL, "claws_mail_logo_small", NULL, NULL}, +#endif + {empty_xpm , NULL, NULL, "empty", NULL, NULL} +}; + static StockPixmapData pixmaps[] = { {addr_one_xpm , NULL, NULL, "addr_one", NULL, NULL}, @@ -412,19 +432,12 @@ static StockPixmapData pixmaps[] = {privacy_emblem_failed_xpm , NULL, NULL, "privacy_emblem_failed", NULL, NULL}, {privacy_emblem_warn_xpm , NULL, NULL, "privacy_emblem_warn", NULL, NULL}, {mime_message_xpm , NULL, NULL, "mime_message", NULL, NULL}, - {claws_mail_icon_xpm , NULL, NULL, "claws_mail_icon", NULL, NULL}, - {claws_mail_icon_64_xpm , NULL, NULL, "claws_mail_icon_64", NULL, NULL}, {read_xpm , NULL, NULL, "read", NULL, NULL}, {delete_btn_xpm , NULL, NULL, "delete_btn", NULL, NULL}, {delete_dup_btn_xpm , NULL, NULL, "delete_dup_btn", NULL, NULL}, {cancel_xpm , NULL, NULL, "cancel", NULL, NULL}, {trash_btn_xpm , NULL, NULL, "trash_btn", NULL, NULL}, {claws_mail_compose_logo_xpm , NULL, NULL, "claws_mail_compose_logo", NULL, NULL}, -#ifndef GENERIC_UMPC - {claws_mail_logo_xpm , NULL, NULL, "claws_mail_logo", NULL, NULL}, -#else - {claws_mail_logo_small_xpm , NULL, NULL, "claws_mail_logo_small", NULL, NULL}, -#endif {dir_noselect_close_xpm , NULL, NULL, "dir_noselect_close", NULL, NULL}, {dir_noselect_close_mark_xpm , NULL, NULL, "dir_noselect_close_mark", NULL, NULL}, {dir_noselect_open_xpm , NULL, NULL, "dir_noselect_open", NULL, NULL}, @@ -491,6 +504,18 @@ const char **stock_pixmap_theme_extensions(void) } /* return newly constructed GtkPixmap from GdkPixmap */ +GtkWidget *priv_pixmap_widget(PrivPixmap icon) +{ + GdkPixbuf *pixbuf; + + cm_return_val_if_fail(icon < N_PRIV_PIXMAPS, NULL); + + if (priv_pixbuf_gdk(icon, &pixbuf) != -1) + return gtk_image_new_from_pixbuf(pixbuf); + + return NULL; +} + GtkWidget *stock_pixmap_widget(StockPixmap icon) { GdkPixbuf *pixbuf; @@ -680,6 +705,30 @@ GdkPixbuf *pixbuf_from_svg_like_icon(char *filename, GError **error, StockPixmap /*! *\brief */ +gint priv_pixbuf_gdk(PrivPixmap icon, GdkPixbuf **pixbuf) +{ + PrivPixmapData *pix_d; + + if (pixbuf) + *pixbuf = NULL; + + cm_return_val_if_fail(icon < N_PRIV_PIXMAPS, -1); + + pix_d = &privpixmaps[icon]; + + if (!pix_d->pixbuf) + pix_d->pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) pix_d->data); + + cm_return_val_if_fail(pix_d->pixbuf != NULL, -1); + + if (pixbuf) + *pixbuf = pix_d->pixbuf; + + /* pixbuf should have one ref outstanding */ + + return 0; +} + gint stock_pixbuf_gdk(StockPixmap icon, GdkPixbuf **pixbuf) { StockPixmapData *pix_d; @@ -882,6 +931,17 @@ gchar *stock_pixmap_get_name (StockPixmap icon) } +PrivPixmap priv_pixmap_get_icon (gchar *file) +{ + gint i; + + for (i = 0; i < N_PRIV_PIXMAPS; i++) { + if (strcmp (pixmaps[i].file, file) == 0) + return i; + } + return -1; +} + StockPixmap stock_pixmap_get_icon (gchar *file) { gint i; diff --git a/src/stock_pixmap.h b/src/stock_pixmap.h @@ -1,6 +1,6 @@ /* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team + * Claws Mail -- a GTK based, lightweight, and fast e-mail client + * Copyright (C) 1999-2022 the Claws Mail team and Hiroyuki Yamamoto * * 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 @@ -24,6 +24,15 @@ typedef enum { + PRIV_PIXMAP_CLAWS_MAIL_ICON, + PRIV_PIXMAP_CLAWS_MAIL_ICON_64, + PRIV_PIXMAP_CLAWS_MAIL_LOGO, + PRIV_PIXMAP_EMPTY, /* last entry */ + N_PRIV_PIXMAPS +} PrivPixmap; + +typedef enum +{ STOCK_PIXMAP_ADDR_ONE, STOCK_PIXMAP_ADDR_TWO, STOCK_PIXMAP_ADDRESS, @@ -163,15 +172,12 @@ typedef enum STOCK_PIXMAP_PRIVACY_EMBLEM_FAILED, STOCK_PIXMAP_PRIVACY_EMBLEM_WARN, STOCK_PIXMAP_MIME_MESSAGE, - STOCK_PIXMAP_CLAWS_MAIL_ICON, - STOCK_PIXMAP_CLAWS_MAIL_ICON_64, STOCK_PIXMAP_READ, STOCK_PIXMAP_DELETE, STOCK_PIXMAP_DELETE_DUP, STOCK_PIXMAP_CANCEL, STOCK_PIXMAP_TRASH, STOCK_PIXMAP_MAIL_COMPOSE_LOGO, - STOCK_PIXMAP_CLAWS_MAIL_LOGO, STOCK_PIXMAP_DIR_NOSELECT_CLOSE, STOCK_PIXMAP_DIR_NOSELECT_CLOSE_MARK, STOCK_PIXMAP_DIR_NOSELECT_OPEN, @@ -235,6 +241,10 @@ typedef enum { OVERLAY_BOTTOM_RIGHT } OverlayPosition; +GtkWidget *priv_pixmap_widget (PrivPixmap icon); +PrivPixmap priv_pixmap_get_icon (gchar *file); +gint priv_pixbuf_gdk (PrivPixmap icon, GdkPixbuf **pixbuf); + GtkWidget *stock_pixmap_widget (StockPixmap icon); gint stock_pixbuf_gdk (StockPixmap icon, GdkPixbuf **pixbuf); diff --git a/src/wizard.c b/src/wizard.c @@ -1,6 +1,6 @@ /* - * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2021 the Claws Mail team and Colin Leroy + * Claws Mail -- a GTK based, lightweight, and fast e-mail client + * Copyright (C) 1999-2022 the Claws Mail team and Colin Leroy * * 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 @@ -848,7 +848,7 @@ static GtkWidget* create_page (WizardWindow *wizard, const char * title) /* create the titlebar */ hbox = gtk_hbox_new (FALSE, 12); - image = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_ICON); + image = priv_pixmap_widget(PRIV_PIXMAP_CLAWS_MAIL_ICON); gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 0); title_string = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">", title ? title : "", "</span>", NULL); w = gtk_label_new (title_string); @@ -1821,7 +1821,7 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) { page = create_page(wizard, _("Welcome to Claws Mail")); wizard->pages = g_slist_append(wizard->pages, page); - widget = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_LOGO); + widget = priv_pixmap_widget(PRIV_PIXMAP_CLAWS_MAIL_LOGO); gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0); @@ -1903,7 +1903,7 @@ gboolean run_wizard(MainWindow *mainwin, gboolean create_mailbox) { page = create_page(wizard, _("Configuration finished")); wizard->pages = g_slist_append(wizard->pages, page); - widget = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_LOGO); + widget = priv_pixmap_widget(PRIV_PIXMAP_CLAWS_MAIL_LOGO); gtk_box_pack_start (GTK_BOX(page), widget, FALSE, FALSE, 0);