/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto 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
- * the Free Software Foundation; either version 2 of the License, or
+ * 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,
* 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
#include "defs.h"
#include "utils.h"
#include "prefs_common.h"
+#include "pixmaps/addr_one.xpm"
+#include "pixmaps/addr_two.xpm"
#include "pixmaps/address.xpm"
+#include "pixmaps/anonymous.xpm"
#include "pixmaps/book.xpm"
#include "pixmaps/category.xpm"
#include "pixmaps/checkbox_off.xpm"
#include "pixmaps/continue.xpm"
#include "pixmaps/deleted.xpm"
#include "pixmaps/error.xpm"
+#include "pixmaps/edit_extern.xpm"
#include "pixmaps/forwarded.xpm"
#include "pixmaps/group.xpm"
+#include "pixmaps/insert_file.xpm"
#include "pixmaps/interface.xpm"
#include "pixmaps/jpilot.xpm"
#include "pixmaps/key.xpm"
+#include "pixmaps/key_gpg_signed.xpm"
#include "pixmaps/ldap.xpm"
#include "pixmaps/linewrap.xpm"
#include "pixmaps/linewrapcurrent.xpm"
#include "pixmaps/mail_reply.xpm"
#include "pixmaps/mail_reply_to_all.xpm"
#include "pixmaps/mail_reply_to_author.xpm"
+#include "pixmaps/mail_reply_to_list.xpm"
#include "pixmaps/mail_send.xpm"
#include "pixmaps/mail_send_queue.xpm"
+#include "pixmaps/mail_sign.xpm"
+#include "pixmaps/open_mail.xpm"
#include "pixmaps/news_compose.xpm"
#include "pixmaps/paste.xpm"
#include "pixmaps/preferences.xpm"
#include "pixmaps/properties.xpm"
-#include "pixmaps/sylpheed_icon.xpm"
-#include "pixmaps/sylpheed_logo.xpm"
+#include "pixmaps/queue_close.xpm"
+#include "pixmaps/queue_close_hrm.xpm"
+#include "pixmaps/queue_open.xpm"
+#include "pixmaps/queue_open_hrm.xpm"
+#include "pixmaps/claws-mail_icon.xpm"
+#ifndef GENERIC_UMPC
+#include "pixmaps/claws-mail_logo.xpm"
+#else
+#include "pixmaps/claws-mail_logo-small.xpm"
+#endif
#include "pixmaps/address_book.xpm"
#include "pixmaps/unread.xpm"
#include "pixmaps/read.xpm"
#include "pixmaps/quicksearch.xpm"
#include "pixmaps/clip_gpg_signed.xpm"
#include "pixmaps/gpg_signed.xpm"
+#include "pixmaps/go_folders.xpm"
#include "pixmaps/mime_text_plain.xpm"
#include "pixmaps/mime_text_html.xpm"
+#include "pixmaps/mime_text_patch.xpm"
#include "pixmaps/mime_application.xpm"
#include "pixmaps/mime_image.xpm"
#include "pixmaps/mime_audio.xpm"
#include "pixmaps/mime_text_enriched.xpm"
#include "pixmaps/mime_unknown.xpm"
+#include "pixmaps/mime_pdf.xpm"
+#include "pixmaps/mime_ps.xpm"
+#include "pixmaps/mime_calendar.xpm"
+#include "pixmaps/mime_pgpsig.xpm"
+#include "pixmaps/printer.xpm"
#include "pixmaps/privacy_signed.xpm"
#include "pixmaps/privacy_passed.xpm"
#include "pixmaps/privacy_failed.xpm"
#include "pixmaps/check_spelling.xpm"
#include "pixmaps/dir_close.xpm"
+#include "pixmaps/dir_close_hrm.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/inbox_open.xpm"
+#include "pixmaps/inbox_open_hrm.xpm"
+#include "pixmaps/inbox_close.xpm"
+#include "pixmaps/inbox_close_hrm.xpm"
+#include "pixmaps/outbox_open.xpm"
+#include "pixmaps/outbox_open_hrm.xpm"
+#include "pixmaps/outbox_close.xpm"
+#include "pixmaps/outbox_close_hrm.xpm"
#include "pixmaps/trash.xpm"
+#include "pixmaps/delete_btn.xpm"
+#include "pixmaps/cancel.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_close_hrm_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/inbox_open_mark.xpm"
+#include "pixmaps/inbox_open_hrm_mark.xpm"
+#include "pixmaps/inbox_close_mark.xpm"
+#include "pixmaps/inbox_close_hrm_mark.xpm"
+#include "pixmaps/outbox_open_mark.xpm"
+#include "pixmaps/outbox_open_hrm_mark.xpm"
+#include "pixmaps/outbox_close_mark.xpm"
+#include "pixmaps/outbox_close_hrm_mark.xpm"
#include "pixmaps/trash_mark.xpm"
+#include "pixmaps/queue_close_mark.xpm"
+#include "pixmaps/queue_close_hrm_mark.xpm"
+#include "pixmaps/queue_open_mark.xpm"
+#include "pixmaps/queue_open_hrm_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/moved.xpm"
+#include "pixmaps/copied.xpm"
+#include "pixmaps/selection.xpm"
+#include "pixmaps/watchthread.xpm"
+#include "pixmaps/empty.xpm"
+#include "pixmaps/tray_newmail.offline.xpm"
+#include "pixmaps/tray_newmail.xpm"
+#include "pixmaps/tray_newmarkedmail.offline.xpm"
+#include "pixmaps/tray_newmarkedmail.xpm"
+#include "pixmaps/tray_nomail.offline.xpm"
+#include "pixmaps/tray_nomail.xpm"
+#include "pixmaps/tray_unreadmail.offline.xpm"
+#include "pixmaps/tray_unreadmail.xpm"
+#include "pixmaps/tray_unreadmarkedmail.offline.xpm"
+#include "pixmaps/tray_unreadmarkedmail.xpm"
typedef struct _StockPixmapData StockPixmapData;
struct _OverlayData
{
+ gboolean is_pixmap;
GdkPixmap *base_pixmap;
GdkBitmap *base_mask;
GdkPixmap *overlay_pixmap;
GdkBitmap *overlay_mask;
+
+ GdkPixbuf *base_pixbuf;
+ GdkPixbuf *overlay_pixbuf;
+
guint base_height;
guint base_width;
guint overlay_height;
OverlayPosition position;
gint border_x;
gint border_y;
+ gboolean highlight;
};
static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname);
static StockPixmapData pixmaps[] =
{
+ {addr_one_xpm , NULL, NULL, "addr_one", NULL},
+ {addr_two_xpm , NULL, NULL, "addr_two", NULL},
{address_xpm , NULL, NULL, "address", NULL},
{address_book_xpm , NULL, NULL, "address_book", NULL},
{address_search_xpm , NULL, NULL, "address_search", NULL},
+ {anonymous_xpm , NULL, NULL, "anonymous", NULL},
{book_xpm , NULL, NULL, "book", NULL},
{category_xpm , NULL, NULL, "category", NULL},
{checkbox_off_xpm , NULL, NULL, "checkbox_off", NULL},
{continue_xpm , NULL, NULL, "continue", NULL},
{deleted_xpm , NULL, NULL, "deleted", NULL},
{dir_close_xpm , NULL, NULL, "dir_close", NULL},
- {dir_close_xpm , NULL, NULL, "dir_close_hrm", NULL},
+ {dir_close_hrm_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_mark_hrm", NULL},
+ {dir_close_hrm_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_mark_hrm", 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},
+ {edit_extern_xpm , NULL, NULL, "edit_extern", NULL},
{error_xpm , NULL, NULL, "error", NULL},
{exec_xpm , NULL, NULL, "exec", NULL},
{forwarded_xpm , NULL, NULL, "forwarded", NULL},
{group_xpm , NULL, NULL, "group", NULL},
{ignorethread_xpm , NULL, NULL, "ignorethread", NULL},
- {inbox_xpm , NULL, NULL, "inbox_close", 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_mark_hrm", NULL},
- {inbox_mark_xpm , NULL, NULL, "inbox_open_mark", NULL},
- {inbox_hrm_mark_xpm , NULL, NULL, "inbox_open_mark_hrm", NULL},
- {paste_xpm , NULL, NULL, "insert_file", NULL},
+ {inbox_close_xpm , NULL, NULL, "inbox_close", NULL},
+ {inbox_close_hrm_xpm , NULL, NULL, "inbox_close_hrm", NULL},
+ {inbox_open_xpm , NULL, NULL, "inbox_open", NULL},
+ {inbox_open_hrm_xpm , NULL, NULL, "inbox_open_hrm", NULL},
+ {inbox_close_mark_xpm , NULL, NULL, "inbox_close_mark", NULL},
+ {inbox_close_hrm_mark_xpm , NULL, NULL, "inbox_close_hrm_mark", NULL},
+ {inbox_open_mark_xpm , NULL, NULL, "inbox_open_mark", NULL},
+ {inbox_open_hrm_mark_xpm , NULL, NULL, "inbox_open_hrm_mark", NULL},
+ {insert_file_xpm , NULL, NULL, "insert_file", NULL},
{interface_xpm , NULL, NULL, "interface", NULL},
{jpilot_xpm , NULL, NULL, "jpilot", NULL},
{key_xpm , NULL, NULL, "key", NULL},
+ {key_gpg_signed_xpm , NULL, NULL, "key_gpg_signed_xpm", NULL},
{ldap_xpm , NULL, NULL, "ldap", NULL},
{linewrapcurrent_xpm , NULL, NULL, "linewrapcurrent", NULL},
{linewrap_xpm , NULL, NULL, "linewrap", NULL},
{mail_reply_xpm , NULL, NULL, "mail_reply", NULL},
{mail_reply_to_all_xpm , NULL, NULL, "mail_reply_to_all", NULL},
{mail_reply_to_author_xpm , NULL, NULL, "mail_reply_to_author", NULL},
+ {mail_reply_to_list_xpm , NULL, NULL, "mail_reply_to_list", NULL},
{mail_send_xpm , NULL, NULL, "mail_send", NULL},
{mail_send_queue_xpm , NULL, NULL, "mail_send_queue", NULL},
- {mail_xpm , NULL, NULL, "mail_sign", NULL},
+ {mail_sign_xpm , NULL, NULL, "mail_sign", NULL},
+ {open_mail_xpm , NULL, NULL, "open_mail", NULL},
{mark_xpm , NULL, NULL, "mark", NULL},
{new_xpm , NULL, NULL, "new", NULL},
{news_compose_xpm , NULL, NULL, "news_compose", NULL},
- {outbox_xpm , NULL, NULL, "outbox_close", 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_mark_hrm", NULL},
- {outbox_mark_xpm , NULL, NULL, "outbox_open_mark", NULL},
- {outbox_hrm_mark_xpm , NULL, NULL, "outbox_open_mark_hrm", NULL},
+ {outbox_close_xpm , NULL, NULL, "outbox_close", NULL},
+ {outbox_close_hrm_xpm , NULL, NULL, "outbox_close_hrm", NULL},
+ {outbox_open_xpm , NULL, NULL, "outbox_open", NULL},
+ {outbox_open_hrm_xpm , NULL, NULL, "outbox_open_hrm", NULL},
+ {outbox_close_mark_xpm , NULL, NULL, "outbox_close_mark", NULL},
+ {outbox_close_hrm_mark_xpm , NULL, NULL, "outbox_close_hrm_mark", NULL},
+ {outbox_open_mark_xpm , NULL, NULL, "outbox_open_mark", NULL},
+ {outbox_open_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},
{properties_xpm , NULL, NULL, "properties", NULL},
- {outbox_xpm , NULL, NULL, "queue_close", NULL},
- {outbox_hrm_xpm , NULL, NULL, "queue_close_hrm", NULL},
- {outbox_xpm , NULL, NULL, "queue_open", NULL},
- {outbox_hrm_xpm , NULL, NULL, "queue_open_hrm", NULL},
+ {queue_close_xpm , NULL, NULL, "queue_close", NULL},
+ {queue_close_hrm_xpm , NULL, NULL, "queue_close_hrm", NULL},
+ {queue_open_xpm , NULL, NULL, "queue_open", NULL},
+ {queue_open_hrm_xpm , NULL, NULL, "queue_open_hrm", NULL},
{trash_xpm , NULL, NULL, "trash_open", 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_mark_hrm", NULL},
- {outbox_mark_xpm , NULL, NULL, "queue_open_mark", NULL},
- {outbox_hrm_mark_xpm , NULL, NULL, "queue_open_mark_hrm", NULL},
+ {queue_close_mark_xpm , NULL, NULL, "queue_close_mark", NULL},
+ {queue_close_hrm_mark_xpm , NULL, NULL, "queue_close_hrm_mark", NULL},
+ {queue_open_mark_xpm , NULL, NULL, "queue_open_mark", NULL},
+ {queue_open_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_mark_hrm", 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_mark_hrm", 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},
{notice_note_xpm , NULL, NULL, "notice_note", NULL},
{quicksearch_xpm , NULL, NULL, "quicksearch", NULL},
{gpg_signed_xpm , NULL, NULL, "gpg_signed", NULL},
+ {go_folders_xpm , NULL, NULL, "go_folders", 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_text_patch_xpm , NULL, NULL, "mime_text_patch", NULL},
{mime_application_xpm , NULL, NULL, "mime_application", NULL},
{mime_image_xpm , NULL, NULL, "mime_image", NULL},
{mime_audio_xpm , NULL, NULL, "mime_audio", NULL},
{mime_text_enriched_xpm , NULL, NULL, "mime_text_enriched", NULL},
{mime_unknown_xpm , NULL, NULL, "mime_unknown", NULL},
+ {mime_pdf_xpm , NULL, NULL, "mime_pdf", NULL},
+ {mime_ps_xpm , NULL, NULL, "mime_ps", NULL},
+ {mime_calendar_xpm , NULL, NULL, "mime_calendar", NULL},
+ {mime_pgpsig_xpm , NULL, NULL, "mime_pgpsig", NULL},
+ {printer_xpm , NULL, NULL, "printer", NULL},
{privacy_signed_xpm , NULL, NULL, "privacy_signed", NULL},
{privacy_passed_xpm , NULL, NULL, "privacy_passed", NULL},
{privacy_failed_xpm , NULL, NULL, "privacy_failed", NULL},
{privacy_emblem_failed_xpm , NULL, NULL, "privacy_emblem_failed", NULL},
{privacy_emblem_warn_xpm , NULL, NULL, "privacy_emblem_warn", NULL},
{mime_message_xpm , NULL, NULL, "mime_message", NULL},
- {sylpheed_icon_xpm , NULL, NULL, "sylpheed_icon", NULL},
+ {claws_mail_icon_xpm , NULL, NULL, "claws_mail_icon", NULL},
{read_xpm , NULL, NULL, "read", NULL},
- {sylpheed_logo_xpm , NULL, NULL, "sylpheed_logo", NULL},
- {dir_noselect_xpm , NULL, NULL, "dir_noselect" , NULL}
+ {delete_btn_xpm , NULL, NULL, "delete_btn", NULL},
+ {cancel_xpm , NULL, NULL, "cancel", NULL},
+ {trash_btn_xpm , NULL, NULL, "trash_btn", NULL},
+#ifndef GENERIC_UMPC
+ {claws_mail_logo_xpm , NULL, NULL, "claws_mail_logo", NULL},
+#else
+ {claws_mail_logo_small_xpm , NULL, NULL, "claws_mail_logo_small", NULL},
+#endif
+ {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},
+ {moved_xpm , NULL, NULL, "moved", NULL},
+ {copied_xpm , NULL, NULL, "copied", NULL},
+ {selection_xpm , NULL, NULL, "selection", NULL},
+ {watchthread_xpm , NULL, NULL, "watchthread", NULL},
+ {tray_newmail_offline_xpm , NULL, NULL, "tray_newmail.offline", NULL},
+ {tray_newmail_xpm , NULL, NULL, "tray_newmail", NULL},
+ {tray_newmarkedmail_offline_xpm , NULL, NULL, "tray_newmarkedmail.offline", NULL},
+ {tray_newmarkedmail_xpm , NULL, NULL, "tray_newmarkedmail", NULL},
+ {tray_nomail_offline_xpm , NULL, NULL, "tray_nomail.offline", NULL},
+ {tray_nomail_xpm , NULL, NULL, "tray_nomail", NULL},
+ {tray_unreadmail_offline_xpm , NULL, NULL, "tray_unreadmail.offline", NULL},
+ {tray_unreadmail_xpm , NULL, NULL, "tray_unreadmail", NULL},
+ {tray_unreadmarkedmail_offline_xpm , NULL, NULL, "tray_unreadmarkedmail.offline", NULL},
+ {tray_unreadmarkedmail_xpm , NULL, NULL, "tray_unreadmarkedmail", NULL},
+ {empty_xpm , NULL, NULL, "empty" , NULL}
};
/* return newly constructed GtkPixmap from GdkPixmap */
GtkWidget *stock_pixmap_widget(GtkWidget *window, StockPixmap icon)
{
- GdkPixmap *pixmap;
- GdkBitmap *mask;
+ GdkPixbuf *pixbuf;
g_return_val_if_fail(window != NULL, NULL);
g_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, NULL);
- if (stock_pixmap_gdk(window, icon, &pixmap, &mask) != -1)
- return gtk_image_new_from_pixmap(pixmap, mask);
+ if (stock_pixbuf_gdk(window, icon, &pixbuf) != -1)
+ return gtk_image_new_from_pixbuf(pixbuf);
return NULL;
}
gint stock_pixbuf_gdk(GtkWidget *window, StockPixmap icon, GdkPixbuf **pixbuf)
{
StockPixmapData *pix_d;
+ static const char *extension[]={".png", ".xpm", NULL};
+ int i = 0;
+ gboolean theme_changed = FALSE;
- g_return_val_if_fail(window != NULL, -1);
- g_return_val_if_fail(icon >= 0 && icon < N_STOCK_PIXMAPS, -1);
-
- if (pixbuf)
+ 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)) {
+ theme_changed = (strcmp2(pix_d->icon_path, prefs_common.pixmap_theme_path) != 0);
+ if (!pix_d->pixbuf || theme_changed) {
GdkPixbuf *pix = NULL;
-
+
+ if (theme_changed && pix_d->pixmap) {
+ g_object_unref(pix_d->pixmap);
+ pix_d->pixmap = 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;
-
+try_next_extension:
icon_file_name = g_strconcat(prefs_common.pixmap_theme_path,
G_DIR_SEPARATOR_S,
pix_d->file,
- ".xpm",
+ extension[i],
NULL);
if (is_file_exist(icon_file_name)) {
GError *err = NULL;
if (err) g_error_free(err);
}
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) {
+ i++;
+ if (extension[i])
+ goto try_next_extension;
+ }
} else {
/* even the path does not exist (deleted between two sessions), so
set the preferences to the internal theme */
if (!pix_d->pixbuf) {
pix_d->pixbuf = gdk_pixbuf_new_from_xpm_data((const gchar **) pix_d->data);
if (pix_d->pixbuf) {
- 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);
}
}
GdkPixmap **pixmap, GdkBitmap **mask)
{
StockPixmapData *pix_d;
+ static const char *extension[]={".png", ".xpm", NULL};
+ int i = 0;
+ gboolean theme_changed = FALSE;
if (pixmap) *pixmap = NULL;
if (mask) *mask = NULL;
pix_d = &pixmaps[icon];
- if (!pix_d->pixmap || (strcmp2(pix_d->icon_path, prefs_common.pixmap_theme_path) != 0)) {
+ theme_changed = (strcmp2(pix_d->icon_path, prefs_common.pixmap_theme_path) != 0);
+ if (!pix_d->pixmap || theme_changed) {
GdkPixmap *pix = NULL;
-
+
+ if (theme_changed && pix_d->pixbuf) {
+ g_object_unref(pix_d->pixbuf);
+ pix_d->pixbuf = 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;
-
+try_next_extension:
icon_file_name = g_strconcat(prefs_common.pixmap_theme_path,
G_DIR_SEPARATOR_S,
pix_d->file,
- ".xpm",
+ extension[i],
NULL);
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) {
+ i++;
+ if (extension[i])
+ goto try_next_extension;
+ }
} else {
/* even the path does not exist (deleted between two sessions), so
set the preferences to the internal theme */
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);
}
}
{
struct dirent *d;
DIR *dp;
+ static const char *extension[]={".png", ".xpm", NULL};
if ((dp = opendir(dirname)) == NULL) {
- debug_print("dir %s not found, skipping theme scan", dirname);
+ debug_print("dir %s not found, skipping theme scan", dirname?dirname:"(null)");
return;
}
if (strcmp(entry, ".") != 0 && strcmp(entry, "..") != 0 && is_dir_exist(fullentry)) {
gchar *filetoexist;
+ gboolean found = FALSE;
int i;
-
- for (i = 0; i < N_STOCK_PIXMAPS; i++) {
- filetoexist = g_strconcat(fullentry, G_DIR_SEPARATOR_S, pixmaps[i].file, ".xpm", NULL);
- if (is_file_exist(filetoexist)) {
- *list = g_list_append(*list, fullentry);
- break;
+ int j;
+ for (i = 0; i < N_STOCK_PIXMAPS && !found; i++) {
+ for (j = 0; extension[j] && !found; j++) {
+ filetoexist = g_strconcat(fullentry, G_DIR_SEPARATOR_S, pixmaps[i].file, extension[j], NULL);
+ if (is_file_exist(filetoexist)) {
+ *list = g_list_append(*list, fullentry);
+ found = TRUE;
+ }
+ g_free(filetoexist);
}
}
- g_free(filetoexist);
if (i == N_STOCK_PIXMAPS)
g_free(fullentry);
} else
GList *list = NULL;
defaulttheme = g_strdup(DEFAULT_PIXMAP_THEME);
- userthemes = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S,
- RC_DIR, G_DIR_SEPARATOR_S,
+ userthemes = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
PIXMAP_THEME_DIR, NULL);
systemthemes = g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
PIXMAP_THEME_DIR, NULL);
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);
}
gint left = 0;
gint top = 0;
- g_return_val_if_fail(data->base_pixmap != NULL, FALSE);
- g_return_val_if_fail(data->base_mask != NULL, FALSE);
-
+ if (data->is_pixmap) {
+ g_return_val_if_fail(data->base_pixmap != NULL, FALSE);
+ g_return_val_if_fail(data->base_mask != NULL, FALSE);
+ } else {
+ g_return_val_if_fail(data->base_pixbuf != NULL, FALSE);
+ }
gc_pix = gdk_gc_new((GdkWindow *)drawable);
gdk_window_clear_area (drawable, expose->area.x, expose->area.y,
expose->area.width, expose->area.height);
- gdk_gc_set_tile(gc_pix, data->base_pixmap);
- gdk_gc_set_ts_origin(gc_pix, data->border_x, data->border_y);
- gdk_gc_set_clip_mask(gc_pix, data->base_mask);
- gdk_gc_set_clip_origin(gc_pix, data->border_x, data->border_y);
- gdk_gc_set_fill(gc_pix, GDK_TILED);
+ if (data->highlight) {
+ MainWindow *mw = NULL;
+
+ mw = mainwindow_get_mainwindow();
+ if (mw != NULL && mw->menubar != NULL) {
+ GdkGC *gc_frame = gdk_gc_new((GdkWindow *)drawable);
+ GdkColor color = gtk_widget_get_style(mw->menubar)->base[GTK_STATE_SELECTED];
- gdk_draw_rectangle(drawable, gc_pix, TRUE, data->border_x, data->border_y,
+ gdk_gc_set_foreground(gc_frame, &color);
+ gdk_gc_set_line_attributes(gc_frame, 1, GDK_LINE_SOLID,
+ GDK_CAP_BUTT, GDK_JOIN_BEVEL);
+ gdk_draw_rectangle(drawable, gc_frame, FALSE, data->border_x-2, data->border_y-2,
+ data->base_width+3, data->base_height+3);
+ g_object_unref(gc_frame);
+ }
+ }
+
+ if (data->is_pixmap) {
+ gdk_gc_set_tile(gc_pix, data->base_pixmap);
+ gdk_gc_set_ts_origin(gc_pix, data->border_x, data->border_y);
+ gdk_gc_set_clip_mask(gc_pix, data->base_mask);
+ gdk_gc_set_clip_origin(gc_pix, data->border_x, data->border_y);
+ gdk_gc_set_fill(gc_pix, GDK_TILED);
+ gdk_draw_rectangle(drawable, gc_pix, TRUE, data->border_x, data->border_y,
data->base_width, data->base_height);
+ } else {
+ gdk_draw_pixbuf(drawable, gc_pix, data->base_pixbuf,
+ 0, 0, data->border_x, data->border_y,
+ -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
+ }
- if (data->position != OVERLAY_NONE) {
- g_return_val_if_fail(data->overlay_pixmap != NULL, FALSE);
- g_return_val_if_fail(data->overlay_mask != NULL, FALSE);
- gdk_gc_set_tile(gc_pix, data->overlay_pixmap);
- gdk_gc_set_clip_mask(gc_pix, data->overlay_mask);
+ if (data->position != OVERLAY_NONE) {
switch (data->position) {
case OVERLAY_TOP_LEFT:
default:
break;
}
-
- gdk_gc_set_ts_origin(gc_pix, left, top);
- gdk_gc_set_clip_origin(gc_pix, left, top);
- gdk_gc_set_fill(gc_pix, GDK_TILED);
- gdk_draw_rectangle(drawable, gc_pix, TRUE, left, top,
+ }
+ if (data->position != OVERLAY_NONE) {
+ if (data->is_pixmap) {
+ g_return_val_if_fail(data->overlay_pixmap != NULL, FALSE);
+ g_return_val_if_fail(data->overlay_mask != NULL, FALSE);
+ gdk_gc_set_tile(gc_pix, data->overlay_pixmap);
+ gdk_gc_set_clip_mask(gc_pix, data->overlay_mask);
+
+ gdk_gc_set_ts_origin(gc_pix, left, top);
+ gdk_gc_set_clip_origin(gc_pix, left, top);
+ gdk_gc_set_fill(gc_pix, GDK_TILED);
+ gdk_draw_rectangle(drawable, gc_pix, TRUE, left, top,
data->overlay_width, data->overlay_height);
+ } else {
+ g_return_val_if_fail(data->overlay_pixbuf != NULL, FALSE);
+ gdk_draw_pixbuf(drawable, gc_pix, data->overlay_pixbuf,
+ 0, 0, left, top,
+ -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
+
+ }
}
- gdk_gc_destroy(gc_pix);
+ g_object_unref(gc_pix);
return TRUE;
}
static void pixmap_with_overlay_destroy_cb(GtkObject *object, OverlayData *data)
{
- g_object_unref(data->base_pixmap);
- g_object_unref(data->base_mask);
- if (data->position != OVERLAY_NONE) {
- g_object_unref(data->overlay_pixmap);
- g_object_unref(data->overlay_mask);
+ if (data->is_pixmap) {
+ g_object_unref(data->base_pixmap);
+ g_object_unref(data->base_mask);
+ if (data->position != OVERLAY_NONE) {
+ g_object_unref(data->overlay_pixmap);
+ g_object_unref(data->overlay_mask);
+ }
+ } else {
+ g_object_unref(data->base_pixbuf);
+ if (data->position != OVERLAY_NONE) {
+ g_object_unref(data->overlay_pixbuf);
+ }
}
g_free(data);
}
StockPixmap overlay, OverlayPosition pos,
gint border_x, gint border_y)
{
- GdkPixmap *stock_pixmap;
- GdkBitmap *stock_mask;
- GtkWidget *widget;
- GtkWidget *stock_wid;
- OverlayData *data;
+ GdkPixmap *stock_pixmap = NULL;
+ GdkBitmap *stock_mask = NULL;
+ GdkPixbuf *stock_pixbuf = NULL;
+ GtkWidget *widget = NULL;
+ GtkWidget *stock_wid = NULL;
+ OverlayData *data = NULL;
data = g_new0(OverlayData, 1);
stock_wid = stock_pixmap_widget(window, icon);
- gtk_image_get_pixmap(GTK_IMAGE(stock_wid), &stock_pixmap, &stock_mask);
- g_object_ref(stock_pixmap);
- g_object_ref(stock_mask);
- data->base_pixmap = stock_pixmap;
- data->base_mask = stock_mask;
- data->base_height = stock_wid->requisition.height;
- data->base_width = stock_wid->requisition.width;
- gtk_widget_destroy(stock_wid);
-
- if (pos == OVERLAY_NONE) {
- data->overlay_pixmap = NULL;
- data->overlay_mask = NULL;
- } else {
- stock_wid = stock_pixmap_widget(window, overlay);
+
+ if (gtk_image_get_storage_type(GTK_IMAGE(stock_wid)) == GTK_IMAGE_PIXMAP)
+ data->is_pixmap = TRUE;
+ else
+ data->is_pixmap = FALSE;
+
+ if (data->is_pixmap) {
gtk_image_get_pixmap(GTK_IMAGE(stock_wid), &stock_pixmap, &stock_mask);
g_object_ref(stock_pixmap);
g_object_ref(stock_mask);
- data->overlay_pixmap = stock_pixmap;
- data->overlay_mask = stock_mask;
- data->overlay_height = stock_wid->requisition.height;
- data->overlay_width = stock_wid->requisition.width;
+ data->base_pixmap = stock_pixmap;
+ data->base_mask = stock_mask;
+ data->base_height = stock_wid->requisition.height;
+ data->base_width = stock_wid->requisition.width;
+ gtk_widget_destroy(stock_wid);
+ if (pos == OVERLAY_NONE) {
+ data->overlay_pixmap = NULL;
+ data->overlay_mask = NULL;
+ } else {
+ stock_wid = stock_pixmap_widget(window, overlay);
+ gtk_image_get_pixmap(GTK_IMAGE(stock_wid), &stock_pixmap, &stock_mask);
+ g_object_ref(stock_pixmap);
+ g_object_ref(stock_mask);
+ data->overlay_pixmap = stock_pixmap;
+ data->overlay_mask = stock_mask;
+ data->overlay_height = stock_wid->requisition.height;
+ data->overlay_width = stock_wid->requisition.width;
+
+ gtk_widget_destroy(stock_wid);
+ }
+ } else {
+ data->is_pixmap = FALSE;
+ stock_pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(stock_wid));
+ g_object_ref(stock_pixbuf);
+ data->base_pixbuf = stock_pixbuf;
+ data->base_height = stock_wid->requisition.height;
+ data->base_width = stock_wid->requisition.width;
gtk_widget_destroy(stock_wid);
+ if (pos == OVERLAY_NONE) {
+ data->overlay_pixmap = NULL;
+ data->overlay_mask = NULL;
+ } else {
+ stock_wid = stock_pixmap_widget(window, overlay);
+ stock_pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(stock_wid));
+ g_object_ref(stock_pixbuf);
+ data->overlay_pixbuf = stock_pixbuf;
+ data->overlay_height = stock_wid->requisition.height;
+ data->overlay_width = stock_wid->requisition.width;
+
+ gtk_widget_destroy(stock_wid);
+ }
}
-
data->position = pos;
data->border_x = border_x;
data->border_y = border_y;
+ data->highlight = FALSE;
widget = gtk_drawing_area_new();
- gtk_drawing_area_size(GTK_DRAWING_AREA(widget), data->base_width + border_x * 2,
+ gtk_widget_set_size_request(widget, data->base_width + border_x * 2,
data->base_height + border_y * 2);
g_signal_connect(G_OBJECT(widget), "expose_event",
G_CALLBACK(pixmap_with_overlay_expose_event_cb), data);
g_signal_connect(G_OBJECT(widget), "destroy",
G_CALLBACK(pixmap_with_overlay_destroy_cb), data);
+ g_object_set_data(G_OBJECT(widget), "highlight", &(data->highlight));
return widget;
}