Revision 3284

View differences:

src/main.c
226 226
	GObject *syl_app;
227 227
	PrefsAccount *new_account = NULL;
228 228
	gboolean first_run = FALSE;
229
	gchar *path;
229 230

  
230 231
	app_init();
231 232
	parse_cmd_opt(argc, argv);
......
296 297

  
297 298
	gtkut_widget_init();
298 299

  
300
	path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "icons", NULL);
301
	if (is_dir_exist(path)) {
302
		debug_print("icon theme dir: %s\n", path);
303
		stock_pixbuf_set_theme_dir(path);
304
	} else {
305
		g_free(path);
306
		if (g_path_is_absolute(THEMEDIR))
307
			path = g_strconcat(THEMEDIR, NULL);
308
		else
309
			path = g_strconcat(get_startup_dir(), G_DIR_SEPARATOR_S, THEMEDIR, NULL);
310
		if (is_dir_exist(path)) {
311
			debug_print("icon theme dir: %s\n", path);
312
			stock_pixbuf_set_theme_dir(path);
313
		}
314
	}
315
	g_free(path);
316

  
299 317
#ifdef G_OS_WIN32
300 318
	stock_pixbuf_gdk(NULL, STOCK_PIXMAP_SYLPHEED_32, &icon);
301 319
	iconlist = g_list_append(iconlist, icon);
src/Makefile.am
167 167
	-DMANUALDIR=\""$(manualdir)"\" \
168 168
	-DFAQDIR=\""$(faqdir)"\" \
169 169
	-DPLUGINDIR=\""$(plugindir)"\" \
170
	-DTHEMEDIR=\""$(themedir)"\" \
170 171
	-DTARGET_ALIAS=\""$(target_triplet)"\" \
171 172
	-DSYSCONFDIR=\""$(sysconfdir)"\"
172 173

  
src/stock_pixmap.c
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2009 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
25 25

  
26 26
#include "stock_pixmap.h"
27 27
#include "gtkutils.h"
28
#include "utils.h"
28 29

  
29 30
#include "icons/address.xpm"
30 31
#include "icons/category.xpm"
......
89 90
	gchar **data;
90 91
	GdkPixmap *pixmap;
91 92
	GdkBitmap *mask;
93

  
92 94
	GdkPixbuf *pixbuf;
93 95
	const guint8 *pixbuf_data;
94 96
	gint pixbuf_data_len;
97

  
95 98
	gchar *icon_name;
96 99
	gint size;
100

  
101
	gchar *icon_file;
97 102
};
98 103

  
99 104
static StockPixmapData pixmaps[] =
100 105
{
101
	{address_xpm	 , NULL, NULL},
102
	{NULL, NULL, NULL, NULL, stock_book, sizeof(stock_book), "stock_book", 16},
103
	{category_xpm	 , NULL, NULL},
104
	{clip_xpm	 , NULL, NULL},
105
	{complete_xpm	 , NULL, NULL},
106
	{continue_xpm	 , NULL, NULL},
107
	{deleted_xpm	 , NULL, NULL},
108
	{NULL, NULL, NULL, NULL, folder_close, sizeof(folder_close), "folder-close", 0},
109
	{NULL, NULL, NULL, NULL, folder_open, sizeof(folder_open), "folder-open", 0},
110
	{NULL, NULL, NULL, NULL, folder_noselect, sizeof(folder_noselect), "folder-noselect", 0},
111
	{error_xpm	 , NULL, NULL},
112
	{forwarded_xpm	 , NULL, NULL},
113
	{NULL, NULL, NULL, NULL, group, sizeof(group), "group", 0},
114
	{NULL, NULL, NULL, NULL, html, sizeof(html), "html", 0},
115
	{interface_xpm	 , NULL, NULL},
116
	{jpilot_xpm	 , NULL, NULL},
117
	{ldap_xpm	 , NULL, NULL},
118
	{linewrap_xpm	 , NULL, NULL},
119
	{mark_xpm	 , NULL, NULL},
120
	{new_xpm	 , NULL, NULL},
121
	{replied_xpm	 , NULL, NULL},
122
	{unread_xpm	 , NULL, NULL},
123
	{vcard_xpm	 , NULL, NULL},
124
	{online_xpm	 , NULL, NULL},
125
	{offline_xpm	 , NULL, NULL},
126
	{mail_xpm	 , NULL, NULL},
106
	{address_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "address.png"},
107
	{NULL, NULL, NULL, NULL, stock_book, sizeof(stock_book), "stock_book", 16, "book.png"},
108
	{category_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "category.png"},
109
	{clip_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "clip.png"},
110
	{complete_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "complete.png"},
111
	{continue_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "continue.png"},
112
	{deleted_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "deleted.png"},
113
	{NULL, NULL, NULL, NULL, folder_close, sizeof(folder_close), "folder-close", 0, "folder-close.png"},
114
	{NULL, NULL, NULL, NULL, folder_open, sizeof(folder_open), "folder-open", 0, "folder-open.png"},
115
	{NULL, NULL, NULL, NULL, folder_noselect, sizeof(folder_noselect), "folder-noselect", 0, "folder-noselect.png"},
116
	{error_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "error.png"},
117
	{forwarded_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "forwarded.png"},
118
	{NULL, NULL, NULL, NULL, group, sizeof(group), "group", 0, "group.png"},
119
	{NULL, NULL, NULL, NULL, html, sizeof(html), "html", 0, "html.png"},
120
	{interface_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "interface.png"},
121
	{jpilot_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "jpilot.png"},
122
	{ldap_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "ldap.png"},
123
	{linewrap_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "linewrap.png"},
124
	{mark_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "mark.png"},
125
	{new_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "new.png"},
126
	{replied_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "replied.png"},
127
	{unread_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "unread.png"},
128
	{vcard_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "vcard.png"},
129
	{online_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "online.png"},
130
	{offline_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "offline.png"},
131
	{mail_xpm	 , NULL, NULL, NULL, NULL, 0, NULL, 0, "mail.png"},
127 132

  
128
	{NULL, NULL, NULL, NULL, stock_inbox, sizeof(stock_inbox), "stock_inbox", 16},
129
	{NULL, NULL, NULL, NULL, stock_outbox, sizeof(stock_outbox), "stock_outbox", 16},
130
	{NULL, NULL, NULL, NULL, stock_mail_compose_16, sizeof(stock_mail_compose_16), "stock_mail-compose", 16},
131
	{NULL, NULL, NULL, NULL, stock_delete_16, sizeof(stock_delete_16), GTK_STOCK_DELETE, 16},
132
	{NULL, NULL, NULL, NULL, stock_mail, sizeof(stock_mail), "stock_mail", 24},
133
	{NULL, NULL, NULL, NULL, stock_attach, sizeof(stock_attach), "stock_attach", 24},
134
	{NULL, NULL, NULL, NULL, stock_mail_compose, sizeof(stock_mail_compose), "stock_mail-compose", 24},
135
	{NULL, NULL, NULL, NULL, stock_mail_forward, sizeof(stock_mail_forward), "stock_mail-forward", 24},
136
	{NULL, NULL, NULL, NULL, stock_mail_receive, sizeof(stock_mail_receive), "stock_mail-receive", 24},
137
	{NULL, NULL, NULL, NULL, stock_mail_receive_all, sizeof(stock_mail_receive_all), NULL, 0},
138
	{NULL, NULL, NULL, NULL, stock_mail_reply, sizeof(stock_mail_reply), "stock_mail-reply", 24},
139
	{NULL, NULL, NULL, NULL, stock_mail_reply_to_all, sizeof(stock_mail_reply_to_all), "stock_mail-reply-to-all", 24},
140
	{NULL, NULL, NULL, NULL, stock_mail_send, sizeof(stock_mail_send), "stock_mail-send", 24},
141
	{NULL, NULL, NULL, NULL, stock_mail_send_queue, sizeof(stock_mail_send_queue), NULL, 0},
142
	{NULL, NULL, NULL, NULL, stock_insert_file, sizeof(stock_insert_file), "stock_insert-file", 24},
143
	{NULL, NULL, NULL, NULL, stock_addressbook, sizeof(stock_addressbook), "stock_addressbook", 24},
144
	{NULL, NULL, NULL, NULL, stock_delete, sizeof(stock_delete), GTK_STOCK_DELETE, 24},
145
	{NULL, NULL, NULL, NULL, stock_spam, sizeof(stock_spam), "stock_spam", 24},
146
	{NULL, NULL, NULL, NULL, stock_notspam, sizeof(stock_notspam), "stock_notspam", 24},
147
	{NULL, NULL, NULL, NULL, stock_hand_signed, sizeof(stock_hand_signed), "stock_hand-signed", 24},
148
	{NULL, NULL, NULL, NULL, stock_sylpheed, sizeof(stock_sylpheed), NULL, 0},
149
	{NULL, NULL, NULL, NULL, stock_sylpheed_16, sizeof(stock_sylpheed_16), NULL, 0},
150
	{NULL, NULL, NULL, NULL, stock_sylpheed_32, sizeof(stock_sylpheed_32), NULL, 0},
151
	{NULL, NULL, NULL, NULL, stock_sylpheed_newmail, sizeof(stock_sylpheed_newmail), NULL, 0},
152
	{NULL, NULL, NULL, NULL, stock_sylpheed_newmail_16, sizeof(stock_sylpheed_newmail_16), NULL, 0},
153
	{NULL, NULL, NULL, NULL, sylpheed_logo, sizeof(sylpheed_logo), NULL, 0},
154
	{NULL, NULL, NULL, NULL, stock_person, sizeof(stock_person), "stock_person", 16},
155
	{NULL, NULL, NULL, NULL, folder_search, sizeof(folder_search), "folder-search", 0},
156
	{NULL, NULL, NULL, NULL, stock_spam_16, sizeof(stock_spam_16), "stock_spam", 16},
133
	{NULL, NULL, NULL, NULL, stock_inbox, sizeof(stock_inbox), "stock_inbox", 16, "stock_inbox.png"},
134
	{NULL, NULL, NULL, NULL, stock_outbox, sizeof(stock_outbox), "stock_outbox", 16, "stock_outbox.png"},
135
	{NULL, NULL, NULL, NULL, stock_mail_compose_16, sizeof(stock_mail_compose_16), "stock_mail-compose", 16, "stock_mail-compose_16.png"},
136
	{NULL, NULL, NULL, NULL, stock_delete_16, sizeof(stock_delete_16), GTK_STOCK_DELETE, 16, "stock_delete_16.png"},
137
	{NULL, NULL, NULL, NULL, stock_mail, sizeof(stock_mail), "stock_mail", 24, "stock_mail.png"},
138
	{NULL, NULL, NULL, NULL, stock_attach, sizeof(stock_attach), "stock_attach", 24, "stock_attach.png"},
139
	{NULL, NULL, NULL, NULL, stock_mail_compose, sizeof(stock_mail_compose), "stock_mail-compose", 24, "stock_mail-compose.png"},
140
	{NULL, NULL, NULL, NULL, stock_mail_forward, sizeof(stock_mail_forward), "stock_mail-forward", 24, "stock_mail-forward.png"},
141
	{NULL, NULL, NULL, NULL, stock_mail_receive, sizeof(stock_mail_receive), "stock_mail-receive", 24, "stock_mail-receive.png"},
142
	{NULL, NULL, NULL, NULL, stock_mail_receive_all, sizeof(stock_mail_receive_all), NULL, 0, "stock_mail_receive_all.png"},
143
	{NULL, NULL, NULL, NULL, stock_mail_reply, sizeof(stock_mail_reply), "stock_mail-reply", 24, "stock_mail-reply.png"},
144
	{NULL, NULL, NULL, NULL, stock_mail_reply_to_all, sizeof(stock_mail_reply_to_all), "stock_mail-reply-to-all", 24, "stock_mail-reply-to-all.png"},
145
	{NULL, NULL, NULL, NULL, stock_mail_send, sizeof(stock_mail_send), "stock_mail-send", 24, "stock_mail-send.png"},
146
	{NULL, NULL, NULL, NULL, stock_mail_send_queue, sizeof(stock_mail_send_queue), NULL, 0, "stock_mail_send_queue.png"},
147
	{NULL, NULL, NULL, NULL, stock_insert_file, sizeof(stock_insert_file), "stock_insert-file", 24, "stock_insert-file.png"},
148
	{NULL, NULL, NULL, NULL, stock_addressbook, sizeof(stock_addressbook), "stock_addressbook", 24, "stock_addressbook.png"},
149
	{NULL, NULL, NULL, NULL, stock_delete, sizeof(stock_delete), GTK_STOCK_DELETE, 24, "stock_delete.png"},
150
	{NULL, NULL, NULL, NULL, stock_spam, sizeof(stock_spam), "stock_spam", 24, "stock_spam.png"},
151
	{NULL, NULL, NULL, NULL, stock_notspam, sizeof(stock_notspam), "stock_notspam", 24, "stock_notspam.png"},
152
	{NULL, NULL, NULL, NULL, stock_hand_signed, sizeof(stock_hand_signed), "stock_hand-signed", 24, "stock_hand-signed.png"},
153
	{NULL, NULL, NULL, NULL, stock_sylpheed, sizeof(stock_sylpheed), NULL, 0, "stock_sylpheed.png"},
154
	{NULL, NULL, NULL, NULL, stock_sylpheed_16, sizeof(stock_sylpheed_16), NULL, 0, "stock_sylpheed_16.png"},
155
	{NULL, NULL, NULL, NULL, stock_sylpheed_32, sizeof(stock_sylpheed_32), NULL, 0, "stock_sylpheed_32.png"},
156
	{NULL, NULL, NULL, NULL, stock_sylpheed_newmail, sizeof(stock_sylpheed_newmail), NULL, 0, "stock_sylpheed_newmail.png"},
157
	{NULL, NULL, NULL, NULL, stock_sylpheed_newmail_16, sizeof(stock_sylpheed_newmail_16), NULL, 0, "stock_sylpheed_newmail_16.png"},
158
	{NULL, NULL, NULL, NULL, sylpheed_logo, sizeof(sylpheed_logo), NULL, 0, "sylpheed-logo.png"},
159
	{NULL, NULL, NULL, NULL, stock_person, sizeof(stock_person), "stock_person", 16, "stock_person.png"},
160
	{NULL, NULL, NULL, NULL, folder_search, sizeof(folder_search), "folder-search", 0, "folder-search.png"},
161
	{NULL, NULL, NULL, NULL, stock_spam_16, sizeof(stock_spam_16), "stock_spam", 16, "stock_spam_16.png"},
157 162
};
158 163

  
164
static gchar *theme_dir = NULL;
159 165

  
166

  
160 167
GtkWidget *stock_pixbuf_widget(GtkWidget *window, StockPixmap icon)
161 168
{
162 169
	GdkPixbuf *pixbuf;
......
223 230

  
224 231
	pix_d = &pixmaps[icon];
225 232

  
233
	if (!pix_d->pixbuf && pix_d->icon_file && theme_dir) {
234
		gchar *path;
235

  
236
		path = g_strconcat(theme_dir, G_DIR_SEPARATOR_S,
237
				   pix_d->icon_file, NULL);
238
		if (is_file_exist(path)) {
239
			debug_print("stock_pixbuf_gdk: loading theme icon: %s\n", path);
240
			pix_d->pixbuf = gdk_pixbuf_new_from_file(path, NULL);
241
		}
242
		g_free(path);
243
	}
244

  
226 245
	if (!pix_d->pixbuf && pix_d->pixbuf_data)
227 246
		pix_d->pixbuf = gdk_pixbuf_new_from_inline
228 247
			(pix_d->pixbuf_data_len, pix_d->pixbuf_data,
......
244 263

  
245 264
	return 0;
246 265
}
266

  
267
gint stock_pixbuf_set_theme_dir(const gchar *dir)
268
{
269
	g_free(theme_dir);
270
	theme_dir = g_strdup(dir);
271

  
272
	return 0;
273
}
src/stock_pixmap.h
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2009 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
101 101
				 StockPixmap	  icon,
102 102
				 GdkPixbuf	**pixbuf);
103 103

  
104
gint stock_pixbuf_set_theme_dir	(const gchar	*dir);
105

  
104 106
#endif /* __STOCK_PIXMAP_H__ */
configure.in
146 146
	[plugindir="$withval"])
147 147
AC_SUBST(plugindir)
148 148

  
149
themedir='${datadir}/${PACKAGE}/icons'
150
AC_ARG_WITH(themedir,
151
	[  --with-themedir=DIR     Icon theme directory],
152
	[themedir="$withval"])
153
AC_SUBST(themedir)
154

  
149 155
dnl GPGME is used to support OpenPGP 
150 156
AC_ARG_ENABLE(gpgme,
151 157
	[  --disable-gpgme         Disable GnuPG support using GPGME],
ChangeLog
1 1
2013-09-17
2 2

  
3
	* src/main.c
4
	  src/Makefile.am
5
	  src/stock_pixmap.[ch]
6
	  configure.in: implemented icon theme feature (some icons on toolbars
7
	  are not themed yet).
8

  
9
2013-09-17
10

  
3 11
	* src/textview.c: modified debug output.
4 12

  
5 13
2013-09-13

Also available in: Unified diff