talons

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

commit 14f1e8bb6a968698e6ef6b93a3f723d39492bcff
parent 8889f77355843df2a36d17c7a3a43277e6493de3
Author: paul <paul@claws-mail.org>
Date:   Thu, 24 Mar 2022 10:49:46 +0000

prevent claws-mail logo from being themed

Diffstat:
Msrc/gtk/about.c | 2+-
Msrc/gtk/gtkutils.c | 6+++---
Msrc/main.c | 2+-
Msrc/plugins/notification/notification_pixbuf.c | 4++--
Msrc/stock_pixmap.c | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
Msrc/stock_pixmap.h | 18++++++++++++++----
Msrc/wizard.c | 8++++----
7 files changed, 97 insertions(+), 23 deletions(-)

diff --git a/src/gtk/about.c b/src/gtk/about.c @@ -830,7 +830,7 @@ static void about_create(void) gtk_grid_set_column_spacing(GTK_GRID(grid1), 8); gtk_container_add(GTK_CONTAINER(window), grid1); - image = stock_pixmap_widget(STOCK_PIXMAP_CLAWS_MAIL_LOGO); + image = priv_pixmap_widget(PRIV_PIXMAP_CLAWS_MAIL_LOGO); gtk_widget_set_halign(image, GTK_ALIGN_CENTER); gtk_widget_set_valign(image, GTK_ALIGN_CENTER); gtk_grid_attach(GTK_GRID(grid1), image, 0, row, 1, 1); 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 + * 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 @@ -696,8 +696,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 @@ -1346,7 +1346,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/plugins/notification/notification_pixbuf.c b/src/plugins/notification/notification_pixbuf.c @@ -1,5 +1,5 @@ /* Notification plugin for Claws Mail - * Copyright (C) 2005-2007 Holger Berndt + * Copyright (C) 2005-2022 Holger Berndt and 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 @@ -28,7 +28,7 @@ GdkPixbuf* notification_pixbuf_get(NotificationPixbuf wanted) if(!notification_pixbuf[wanted]) { switch(wanted) { case NOTIFICATION_CM_LOGO_64x64: - stock_pixbuf_gdk(STOCK_PIXMAP_CLAWS_MAIL_ICON_64, &(notification_pixbuf[wanted])); + priv_pixbuf_gdk(PRIV_PIXMAP_CLAWS_MAIL_ICON_64, &(notification_pixbuf[wanted])); g_object_ref(notification_pixbuf[wanted]); break; case NOTIFICATION_TRAYICON_NEWMAIL: 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 + * 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 @@ -267,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}, @@ -408,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}, @@ -487,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; @@ -676,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; @@ -878,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 + * 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 + * 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_box_new(GTK_ORIENTATION_HORIZONTAL, 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); @@ -1862,7 +1862,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); @@ -1940,7 +1940,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);