/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and 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
*
* 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "defs.h"
#include "pixmaps/complete.xpm"
#include "pixmaps/continue.xpm"
#include "pixmaps/deleted.xpm"
-#include "pixmaps/dir_close.xpm"
-#include "pixmaps/dir_open.xpm"
-#include "pixmaps/dir_open_hrm.xpm"
#include "pixmaps/error.xpm"
#include "pixmaps/forwarded.xpm"
#include "pixmaps/group.xpm"
-#include "pixmaps/inbox.xpm"
-#include "pixmaps/inbox_hrm.xpm"
#include "pixmaps/interface.xpm"
#include "pixmaps/jpilot.xpm"
#include "pixmaps/key.xpm"
#include "pixmaps/mark.xpm"
#include "pixmaps/locked.xpm"
#include "pixmaps/new.xpm"
-#include "pixmaps/outbox.xpm"
-#include "pixmaps/outbox_hrm.xpm"
#include "pixmaps/replied.xpm"
#include "pixmaps/close.xpm"
#include "pixmaps/down_arrow.xpm"
#include "pixmaps/sylpheed_icon.xpm"
#include "pixmaps/sylpheed_logo.xpm"
#include "pixmaps/address_book.xpm"
-#include "pixmaps/trash.xpm"
-#include "pixmaps/trash_hrm.xpm"
#include "pixmaps/unread.xpm"
#include "pixmaps/read.xpm"
#include "pixmaps/vcard.xpm"
#include "pixmaps/notice_error.xpm"
#include "pixmaps/notice_note.xpm"
#include "pixmaps/quicksearch.xpm"
+#include "pixmaps/clip_gpg_signed.xpm"
#include "pixmaps/gpg_signed.xpm"
-#include "pixmaps/drafts_close.xpm"
-#include "pixmaps/drafts_open.xpm"
#include "pixmaps/mime_text_plain.xpm"
#include "pixmaps/mime_text_html.xpm"
#include "pixmaps/mime_application.xpm"
#include "pixmaps/address_search.xpm"
#include "pixmaps/check_spelling.xpm"
+#include "pixmaps/dir_close.xpm"
+#include "pixmaps/dir_open.xpm"
+#include "pixmaps/dir_open_hrm.xpm"
+#include "pixmaps/inbox.xpm"
+#include "pixmaps/inbox_hrm.xpm"
+#include "pixmaps/outbox.xpm"
+#include "pixmaps/outbox_hrm.xpm"
+#include "pixmaps/trash.xpm"
+#include "pixmaps/trash_btn.xpm"
+#include "pixmaps/trash_hrm.xpm"
+#include "pixmaps/drafts_close.xpm"
+#include "pixmaps/drafts_open.xpm"
+#include "pixmaps/dir_close_mark.xpm"
+#include "pixmaps/dir_open_mark.xpm"
+#include "pixmaps/dir_open_hrm_mark.xpm"
+#include "pixmaps/inbox_mark.xpm"
+#include "pixmaps/inbox_hrm_mark.xpm"
+#include "pixmaps/outbox_mark.xpm"
+#include "pixmaps/outbox_hrm_mark.xpm"
+#include "pixmaps/trash_mark.xpm"
+#include "pixmaps/trash_hrm_mark.xpm"
+#include "pixmaps/drafts_close_mark.xpm"
+#include "pixmaps/drafts_open_mark.xpm"
+#include "pixmaps/dir_noselect.xpm"
+#include "pixmaps/spam.xpm"
+#include "pixmaps/spam_btn.xpm"
+#include "pixmaps/ham_btn.xpm"
+#include "pixmaps/empty.xpm"
+
typedef struct _StockPixmapData StockPixmapData;
struct _StockPixmapData
GdkBitmap *mask;
gchar *file;
gchar *icon_path;
+ GdkPixbuf *pixbuf;
};
typedef struct _OverlayData OverlayData;
{check_spelling_xpm , NULL, NULL, "check_spelling", NULL},
{clip_xpm , NULL, NULL, "clip", NULL},
{clipkey_xpm , NULL, NULL, "clipkey", NULL},
+ {clip_gpg_signed_xpm , NULL, NULL, "clip_gpg_signed", NULL},
{close_xpm , NULL, NULL, "close", NULL},
{complete_xpm , NULL, NULL, "complete", NULL},
{continue_xpm , NULL, NULL, "continue", NULL},
{dir_close_xpm , NULL, NULL, "dir_close_hrm", NULL},
{dir_open_xpm , NULL, NULL, "dir_open", NULL},
{dir_open_hrm_xpm , NULL, NULL, "dir_open_hrm", NULL},
+ {dir_close_mark_xpm , NULL, NULL, "dir_close_mark", NULL},
+ {dir_close_mark_xpm , NULL, NULL, "dir_close_hrm_mark", NULL},
+ {dir_open_mark_xpm , NULL, NULL, "dir_open_mark", NULL},
+ {dir_open_hrm_mark_xpm , NULL, NULL, "dir_open_hrm_mark", NULL},
{down_arrow_xpm , NULL, NULL, "down_arrow", NULL},
{up_arrow_xpm , NULL, NULL, "up_arrow", NULL},
{mail_compose_xpm , NULL, NULL, "edit_extern", NULL},
{inbox_hrm_xpm , NULL, NULL, "inbox_close_hrm", NULL},
{inbox_xpm , NULL, NULL, "inbox_open", NULL},
{inbox_hrm_xpm , NULL, NULL, "inbox_open_hrm", NULL},
+ {inbox_mark_xpm , NULL, NULL, "inbox_close_mark", NULL},
+ {inbox_hrm_mark_xpm , NULL, NULL, "inbox_close_hrm_mark", NULL},
+ {inbox_mark_xpm , NULL, NULL, "inbox_open_mark", NULL},
+ {inbox_hrm_mark_xpm , NULL, NULL, "inbox_open_hrm_mark", NULL},
{paste_xpm , NULL, NULL, "insert_file", NULL},
{interface_xpm , NULL, NULL, "interface", NULL},
{jpilot_xpm , NULL, NULL, "jpilot", NULL},
{outbox_hrm_xpm , NULL, NULL, "outbox_close_hrm", NULL},
{outbox_xpm , NULL, NULL, "outbox_open", NULL},
{outbox_hrm_xpm , NULL, NULL, "outbox_open_hrm", NULL},
+ {outbox_mark_xpm , NULL, NULL, "outbox_close_mark", NULL},
+ {outbox_hrm_mark_xpm , NULL, NULL, "outbox_close_hrm_mark", NULL},
+ {outbox_mark_xpm , NULL, NULL, "outbox_open_mark", NULL},
+ {outbox_hrm_mark_xpm , NULL, NULL, "outbox_open_hrm_mark", NULL},
{replied_xpm , NULL, NULL, "replied", NULL},
{paste_xpm , NULL, NULL, "paste", NULL},
{preferences_xpm , NULL, NULL, "preferences", NULL},
{trash_hrm_xpm , NULL, NULL, "trash_open_hrm", NULL},
{trash_xpm , NULL, NULL, "trash_close", NULL},
{trash_hrm_xpm , NULL, NULL, "trash_close_hrm", NULL},
+ {outbox_mark_xpm , NULL, NULL, "queue_close_mark", NULL},
+ {outbox_hrm_mark_xpm , NULL, NULL, "queue_close_hrm_mark", NULL},
+ {outbox_mark_xpm , NULL, NULL, "queue_open_mark", NULL},
+ {outbox_hrm_mark_xpm , NULL, NULL, "queue_open_hrm_mark", NULL},
+ {trash_mark_xpm , NULL, NULL, "trash_open_mark", NULL},
+ {trash_hrm_mark_xpm , NULL, NULL, "trash_open_hrm_mark", NULL},
+ {trash_mark_xpm , NULL, NULL, "trash_close_mark", NULL},
+ {trash_hrm_mark_xpm , NULL, NULL, "trash_close_hrm_mark", NULL},
{unread_xpm , NULL, NULL, "unread", NULL},
{vcard_xpm , NULL, NULL, "vcard", NULL},
{online_xpm , NULL, NULL, "online", NULL},
{gpg_signed_xpm , NULL, NULL, "gpg_signed", NULL},
{drafts_close_xpm , NULL, NULL, "drafts_close", NULL},
{drafts_open_xpm , NULL, NULL, "drafts_open", NULL},
+ {drafts_close_mark_xpm , NULL, NULL, "drafts_close_mark", NULL},
+ {drafts_open_mark_xpm , NULL, NULL, "drafts_open_mark", NULL},
{mime_text_plain_xpm , NULL, NULL, "mime_text_plain", NULL},
{mime_text_html_xpm , NULL, NULL, "mime_text_html", NULL},
{mime_application_xpm , NULL, NULL, "mime_application", NULL},
{mime_message_xpm , NULL, NULL, "mime_message", NULL},
{sylpheed_icon_xpm , NULL, NULL, "sylpheed_icon", NULL},
{read_xpm , NULL, NULL, "read", NULL},
+ {trash_btn_xpm , NULL, NULL, "trash_btn", NULL},
{sylpheed_logo_xpm , NULL, NULL, "sylpheed_logo", NULL},
+ {dir_noselect_xpm , NULL, NULL, "dir_noselect" , NULL},
+ {spam_xpm , NULL, NULL, "spam" , NULL},
+ {spam_btn_xpm , NULL, NULL, "spam_btn" , NULL},
+ {ham_btn_xpm , NULL, NULL, "ham_btn" , NULL},
+ {empty_xpm , NULL, NULL, "empty" , NULL}
};
/* return newly constructed GtkPixmap from GdkPixmap */
return NULL;
}
+/*!
+ *\brief
+ */
+gint stock_pixbuf_gdk(GtkWidget *window, StockPixmap icon, GdkPixbuf **pixbuf)
+{
+ StockPixmapData *pix_d;
+
+ if (pixbuf)
+ *pixbuf = NULL;
+
+ g_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, -1);
+
+ pix_d = &pixmaps[icon];
+
+ if (!pix_d->pixbuf || (strcmp2(pix_d->icon_path, prefs_common.pixmap_theme_path) != 0)) {
+ GdkPixbuf *pix = NULL;
+
+ if (strcmp(prefs_common.pixmap_theme_path, DEFAULT_PIXMAP_THEME) != 0) {
+ if (is_dir_exist(prefs_common.pixmap_theme_path)) {
+ char *icon_file_name;
+
+ icon_file_name = g_strconcat(prefs_common.pixmap_theme_path,
+ G_DIR_SEPARATOR_S,
+ pix_d->file,
+ ".xpm",
+ NULL);
+ if (is_file_exist(icon_file_name)) {
+ GError *err = NULL;
+ pix = gdk_pixbuf_new_from_file(icon_file_name, &err);
+ if (err) g_error_free(err);
+ }
+ if (pix) {
+ g_free(pix_d->icon_path);
+ pix_d->icon_path = g_strdup(prefs_common.pixmap_theme_path);
+ }
+ g_free(icon_file_name);
+ } else {
+ /* even the path does not exist (deleted between two sessions), so
+ set the preferences to the internal theme */
+ prefs_common.pixmap_theme_path = g_strdup(DEFAULT_PIXMAP_THEME);
+ }
+ }
+ pix_d->pixbuf = pix;
+ }
+
+ if (!pix_d->pixbuf) {
+ pix_d->pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) pix_d->data);
+ if (pix_d->pixbuf) {
+ g_free(pix_d->icon_path);
+ pix_d->icon_path = g_strdup(DEFAULT_PIXMAP_THEME);
+ }
+ }
+
+ g_return_val_if_fail(pix_d->pixbuf != NULL, -1);
+
+ if (pixbuf)
+ *pixbuf = pix_d->pixbuf;
+
+ /* pixbuf should have one ref outstanding */
+
+ return 0;
+}
+
/* create GdkPixmap if it has not created yet */
gint stock_pixmap_gdk(GtkWidget *window, StockPixmap icon,
GdkPixmap **pixmap, GdkBitmap **mask)
if (is_file_exist(icon_file_name))
PIXMAP_CREATE_FROM_FILE(window, pix, pix_d->mask, icon_file_name);
if (pix) {
- if (pix_d->icon_path != NULL) g_free(pix_d->icon_path);
+ g_free(pix_d->icon_path);
pix_d->icon_path = g_strdup(prefs_common.pixmap_theme_path);
}
g_free(icon_file_name);
if (!pix_d->pixmap) {
PIXMAP_CREATE(window, pix_d->pixmap, pix_d->mask, pix_d->data);
if (pix_d->pixmap) {
- if (pix_d->icon_path != NULL) g_free(pix_d->icon_path);
+ g_free(pix_d->icon_path);
pix_d->icon_path = g_strdup(DEFAULT_PIXMAP_THEME);
}
}
GList *ptr;
for (ptr = g_list_first(list); ptr != NULL; ptr = g_list_next(ptr))
- if (ptr->data)
- g_free(ptr->data);
+ g_free(ptr->data);
g_list_free(list);
}
gdk_draw_rectangle(drawable, gc_pix, TRUE, left, top,
data->overlay_width, data->overlay_height);
}
- gdk_gc_destroy(gc_pix);
+ g_object_unref(gc_pix);
return TRUE;
}