commit ffacaed0a533738fc25275773166d03d7ce0ffba
parent cc7bf782578e0af5e4543e6b1371b6c4d5b7db68
Author: Colin Leroy <colin@colino.net>
Date: Fri, 23 Nov 2012 19:29:16 +0000
2012-11-23 [colin] 3.9.0cvs20
* src/jpilot.c
* src/main.c
* src/mainwindow.c
* src/matcher.c
* src/prefs_common.c
* src/prefs_common.h
* src/procmsg.c
* src/common/socket.c
* src/common/socket.h
* src/common/ssl.c
* src/common/ssl_certificate.c
* src/common/ssl_certificate.h
* src/etpan/imap-thread.c
* src/etpan/nntp-thread.c
Cleanup some warnings and deprecated types. Patch by
Christian Hesse, fixing bug #2617. Thanks!
Diffstat:
17 files changed, 162 insertions(+), 112 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,22 @@
+2012-11-23 [colin] 3.9.0cvs20
+
+ * src/jpilot.c
+ * src/main.c
+ * src/mainwindow.c
+ * src/matcher.c
+ * src/prefs_common.c
+ * src/prefs_common.h
+ * src/procmsg.c
+ * src/common/socket.c
+ * src/common/socket.h
+ * src/common/ssl.c
+ * src/common/ssl_certificate.c
+ * src/common/ssl_certificate.h
+ * src/etpan/imap-thread.c
+ * src/etpan/nntp-thread.c
+ Cleanup some warnings and deprecated types. Patch by
+ Christian Hesse, fixing bug #2617. Thanks!
+
2012-11-23 [colin] 3.9.0cvs19
* AUTHORS
diff --git a/PATCHSETS b/PATCHSETS
@@ -4517,3 +4517,4 @@
( cvs diff -u -r 1.43.2.100 -r 1.43.2.101 src/prefs_matcher.c; ) > 3.9.0cvs17.patchset
( cvs diff -u -r 1.1.4.124 -r 1.1.4.125 src/etpan/imap-thread.c; ) > 3.9.0cvs18.patchset
( cvs diff -u -r 1.100.2.87 -r 1.100.2.88 AUTHORS; cvs diff -u -r 1.1.2.83 -r 1.1.2.84 src/gtk/authors.h; ) > 3.9.0cvs19.patchset
+( cvs diff -u -r 1.18.2.37 -r 1.18.2.38 src/jpilot.c; cvs diff -u -r 1.115.2.262 -r 1.115.2.263 src/main.c; cvs diff -u -r 1.274.2.355 -r 1.274.2.356 src/mainwindow.c; cvs diff -u -r 1.75.2.79 -r 1.75.2.80 src/matcher.c; cvs diff -u -r 1.204.2.212 -r 1.204.2.213 src/prefs_common.c; cvs diff -u -r 1.103.2.141 -r 1.103.2.142 src/prefs_common.h; cvs diff -u -r 1.150.2.131 -r 1.150.2.132 src/procmsg.c; cvs diff -u -r 1.13.2.51 -r 1.13.2.52 src/common/socket.c; cvs diff -u -r 1.13.2.27 -r 1.13.2.28 src/common/socket.h; cvs diff -u -r 1.9.2.57 -r 1.9.2.58 src/common/ssl.c; cvs diff -u -r 1.4.2.46 -r 1.4.2.47 src/common/ssl_certificate.c; cvs diff -u -r 1.1.4.20 -r 1.1.4.21 src/common/ssl_certificate.h; cvs diff -u -r 1.1.4.125 -r 1.1.4.126 src/etpan/imap-thread.c; cvs diff -u -r 1.1.2.22 -r 1.1.2.23 src/etpan/nntp-thread.c; ) > 3.9.0cvs20.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=9
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=19
+EXTRA_VERSION=20
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/common/socket.c b/src/common/socket.c
@@ -1388,7 +1388,7 @@ static gint fd_read(gint fd, gchar *buf, gint len)
}
#if USE_GNUTLS
-static gint ssl_read(gnutls_session ssl, gchar *buf, gint len)
+static gint ssl_read(gnutls_session_t ssl, gchar *buf, gint len)
{
gint r;
@@ -1453,7 +1453,7 @@ gint fd_write(gint fd, const gchar *buf, gint len)
}
#if USE_GNUTLS
-static gint ssl_write(gnutls_session ssl, const gchar *buf, gint len)
+static gint ssl_write(gnutls_session_t ssl, const gchar *buf, gint len)
{
gint ret;
@@ -1522,7 +1522,7 @@ gint fd_write_all(gint fd, const gchar *buf, gint len)
}
#ifdef USE_GNUTLS
-static gint ssl_write_all(gnutls_session ssl, const gchar *buf, gint len)
+static gint ssl_write_all(gnutls_session_t ssl, const gchar *buf, gint len)
{
gint n, wrlen = 0;
diff --git a/src/common/socket.h b/src/common/socket.h
@@ -59,10 +59,10 @@ struct _SockInfo
{
gint sock;
#if USE_GNUTLS
- gnutls_session ssl;
+ gnutls_session_t ssl;
gnutls_certificate_credentials_t xcred;
- gnutls_x509_crt client_crt;
- gnutls_x509_privkey client_key;
+ gnutls_x509_crt_t client_crt;
+ gnutls_x509_privkey_t client_key;
#endif
guint g_source;
GIOChannel *sock_ch;
diff --git a/src/common/ssl.c b/src/common/ssl.c
@@ -52,21 +52,21 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL;
#ifdef USE_PTHREAD
typedef struct _thread_data {
- gnutls_session ssl;
+ gnutls_session_t ssl;
gboolean done;
} thread_data;
#endif
-static int gnutls_client_cert_cb(gnutls_session session,
- const gnutls_datum *req_ca_rdn, int nreqs,
- const gnutls_pk_algorithm *sign_algos,
+static int gnutls_client_cert_cb(gnutls_session_t session,
+ const gnutls_datum_t *req_ca_rdn, int nreqs,
+ const gnutls_pk_algorithm_t *sign_algos,
int sign_algos_length, gnutls_retr_st *st)
{
SSLClientCertHookData hookdata;
SockInfo *sockinfo = (SockInfo *)gnutls_session_get_ptr(session);
- gnutls_certificate_type type = gnutls_certificate_type_get(session);
- gnutls_x509_crt crt;
- gnutls_x509_privkey key;
+ gnutls_certificate_type_t type = gnutls_certificate_type_get(session);
+ gnutls_x509_crt_t crt;
+ gnutls_x509_privkey_t key;
st->ncerts = 0;
@@ -190,7 +190,7 @@ static void *SSL_connect_thread(void *data)
}
#endif
-static gint SSL_connect_nb(gnutls_session ssl)
+static gint SSL_connect_nb(gnutls_session_t ssl)
{
int result;
#ifdef USE_PTHREAD
@@ -251,11 +251,11 @@ gboolean ssl_init_socket(SockInfo *sockinfo)
gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
{
- gnutls_session session;
+ gnutls_session_t session;
int r;
- const gnutls_datum *raw_cert_list;
+ const gnutls_datum_t *raw_cert_list;
unsigned int raw_cert_list_length;
- gnutls_x509_crt cert = NULL;
+ gnutls_x509_crt_t cert = NULL;
guint status;
gnutls_certificate_credentials_t xcred;
@@ -285,8 +285,11 @@ gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
}
gnutls_certificate_set_verify_flags (xcred, GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT);
- gnutls_transport_set_ptr(session, (gnutls_transport_ptr) GINT_TO_POINTER(sockinfo->sock));
+ gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) GINT_TO_POINTER(sockinfo->sock));
gnutls_session_set_ptr(session, sockinfo);
+ /* TODO: gnutls_certificate_client_set_retrieve_function() is deprecated and should be replaced with
+ * gnutls_certificate_set_retrieve_function() which was introduced in gnutls 2.12 in March 2011
+ * getting this right with defines is not easy, so how long do we need compatibility to gntls <= 2.10? */
gnutls_certificate_client_set_retrieve_function(xcred, gnutls_client_cert_cb);
gnutls_dh_set_prime_bits(session, 512);
diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
@@ -88,12 +88,12 @@ char * readable_fingerprint(unsigned char *src, int len)
}
#if USE_GNUTLS
-static gnutls_x509_crt x509_crt_copy(gnutls_x509_crt src)
+static gnutls_x509_crt_t x509_crt_copy(gnutls_x509_crt_t src)
{
int ret;
size_t size;
- gnutls_datum tmp;
- gnutls_x509_crt dest;
+ gnutls_datum_t tmp;
+ gnutls_x509_crt_t dest;
size = 0;
if (gnutls_x509_crt_init(&dest) != 0) {
@@ -130,7 +130,7 @@ static gnutls_x509_crt x509_crt_copy(gnutls_x509_crt src)
}
#endif
-static SSLCertificate *ssl_certificate_new(gnutls_x509_crt x509_cert, const gchar *host, gushort port)
+static SSLCertificate *ssl_certificate_new(gnutls_x509_crt_t x509_cert, const gchar *host, gushort port)
{
SSLCertificate *cert = g_new0(SSLCertificate, 1);
size_t n;
@@ -153,7 +153,7 @@ static SSLCertificate *ssl_certificate_new(gnutls_x509_crt x509_cert, const gcha
}
#ifdef USE_GNUTLS
-static void gnutls_i2d_X509_fp(FILE *fp, gnutls_x509_crt x509_cert)
+static void gnutls_i2d_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert)
{
char output[10*1024];
size_t cert_size = 10*1024;
@@ -169,7 +169,7 @@ static void gnutls_i2d_X509_fp(FILE *fp, gnutls_x509_crt x509_cert)
}
}
-size_t gnutls_i2d_X509(gnutls_x509_crt x509_cert, unsigned char **output)
+size_t gnutls_i2d_X509(gnutls_x509_crt_t x509_cert, unsigned char **output)
{
size_t cert_size = 10*1024;
int r;
@@ -188,7 +188,7 @@ size_t gnutls_i2d_X509(gnutls_x509_crt x509_cert, unsigned char **output)
return cert_size;
}
-size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey pkey, unsigned char **output)
+size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey_t pkey, unsigned char **output)
{
size_t key_size = 10*1024;
int r;
@@ -207,10 +207,10 @@ size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey pkey, unsigned char **output)
return key_size;
}
-static gnutls_x509_crt gnutls_d2i_X509_fp(FILE *fp, int format)
+static gnutls_x509_crt_t gnutls_d2i_X509_fp(FILE *fp, int format)
{
- gnutls_x509_crt cert = NULL;
- gnutls_datum tmp;
+ gnutls_x509_crt_t cert = NULL;
+ gnutls_datum_t tmp;
struct stat s;
int r;
if (fstat(fileno(fp), &s) < 0) {
@@ -237,10 +237,10 @@ static gnutls_x509_crt gnutls_d2i_X509_fp(FILE *fp, int format)
return cert;
}
-static gnutls_x509_privkey gnutls_d2i_key_fp(FILE *fp, int format)
+static gnutls_x509_privkey_t gnutls_d2i_key_fp(FILE *fp, int format)
{
- gnutls_x509_privkey key = NULL;
- gnutls_datum tmp;
+ gnutls_x509_privkey_t key = NULL;
+ gnutls_datum_t tmp;
struct stat s;
int r;
if (fstat(fileno(fp), &s) < 0) {
@@ -270,7 +270,7 @@ static gnutls_x509_privkey gnutls_d2i_key_fp(FILE *fp, int format)
static gnutls_pkcs12_t gnutls_d2i_PKCS12_fp(FILE *fp, int format)
{
gnutls_pkcs12_t p12 = NULL;
- gnutls_datum tmp;
+ gnutls_datum_t tmp;
struct stat s;
int r;
if (fstat(fileno(fp), &s) < 0) {
@@ -364,7 +364,7 @@ SSLCertificate *ssl_certificate_find (const gchar *host, gushort port, const gch
gchar *file = NULL;
gchar *buf;
SSLCertificate *cert = NULL;
- gnutls_x509_crt tmp_x509;
+ gnutls_x509_crt_t tmp_x509;
FILE *fp = NULL;
gboolean must_rename = FALSE;
@@ -469,12 +469,12 @@ static gboolean ssl_certificate_compare (SSLCertificate *cert_a, SSLCertificate
return TRUE;
}
-static guint check_cert(gnutls_x509_crt cert)
+static guint check_cert(gnutls_x509_crt_t cert)
{
- gnutls_x509_crt *ca_list;
+ gnutls_x509_crt_t *ca_list;
unsigned int max = 512;
unsigned int flags = 0;
- gnutls_datum tmp;
+ gnutls_datum_t tmp;
struct stat s;
int r, i;
unsigned int status;
@@ -527,7 +527,7 @@ static guint check_cert(gnutls_x509_crt cert)
}
-char *ssl_certificate_check_signer (gnutls_x509_crt cert, guint status)
+char *ssl_certificate_check_signer (gnutls_x509_crt_t cert, guint status)
{
if (status == (guint)-1) {
status = check_cert(cert);
@@ -549,7 +549,7 @@ char *ssl_certificate_check_signer (gnutls_x509_crt cert, guint status)
return NULL;
}
-gboolean ssl_certificate_check (gnutls_x509_crt x509_cert, guint status, const gchar *host, gushort port)
+gboolean ssl_certificate_check (gnutls_x509_crt_t x509_cert, guint status, const gchar *host, gushort port)
{
SSLCertificate *current_cert = NULL;
SSLCertificate *known_cert;
@@ -647,9 +647,9 @@ gboolean ssl_certificate_check (gnutls_x509_crt x509_cert, guint status, const g
return TRUE;
}
-gnutls_x509_crt ssl_certificate_get_x509_from_pem_file(const gchar *file)
+gnutls_x509_crt_t ssl_certificate_get_x509_from_pem_file(const gchar *file)
{
- gnutls_x509_crt x509 = NULL;
+ gnutls_x509_crt_t x509 = NULL;
if (!file)
return NULL;
@@ -670,9 +670,9 @@ gnutls_x509_crt ssl_certificate_get_x509_from_pem_file(const gchar *file)
return NULL;
}
-gnutls_x509_privkey ssl_certificate_get_pkey_from_pem_file(const gchar *file)
+gnutls_x509_privkey_t ssl_certificate_get_pkey_from_pem_file(const gchar *file)
{
- gnutls_x509_privkey key = NULL;
+ gnutls_x509_privkey_t key = NULL;
if (!file)
return NULL;
@@ -697,7 +697,7 @@ gnutls_x509_privkey ssl_certificate_get_pkey_from_pem_file(const gchar *file)
static int
parse_pkcs12 (gnutls_pkcs12_t p12,
const char *password,
- gnutls_x509_privkey * key,
+ gnutls_x509_privkey_t * key,
gnutls_x509_crt_t * cert)
{
gnutls_pkcs12_bag_t bag = NULL;
@@ -748,7 +748,7 @@ parse_pkcs12 (gnutls_pkcs12_t p12,
for (i = 0; i < elements_in_bag; i++)
{
int type;
- gnutls_datum data;
+ gnutls_datum_t data;
type = gnutls_pkcs12_bag_get_type (bag, i);
if (type < 0)
@@ -818,7 +818,7 @@ done:
return ret;
}
void ssl_certificate_get_x509_and_pkey_from_p12_file(const gchar *file, const gchar *password,
- gnutls_x509_crt *x509, gnutls_x509_privkey *pkey)
+ gnutls_x509_crt_t *x509, gnutls_x509_privkey_t *pkey)
{
gnutls_pkcs12_t p12 = NULL;
diff --git a/src/common/ssl_certificate.h b/src/common/ssl_certificate.h
@@ -39,7 +39,7 @@ typedef struct _SSLCertificate SSLCertificate;
struct _SSLCertificate
{
- gnutls_x509_crt x509_cert;
+ gnutls_x509_crt_t x509_cert;
gchar *host;
gushort port;
gchar *fingerprint;
@@ -57,18 +57,18 @@ struct _SSLCertHookData
};
SSLCertificate *ssl_certificate_find (const gchar *host, gushort port, const gchar *fingerprint);
-gboolean ssl_certificate_check (gnutls_x509_crt x509_cert, guint status, const gchar *host, gushort port);
+gboolean ssl_certificate_check (gnutls_x509_crt_t x509_cert, guint status, const gchar *host, gushort port);
void ssl_certificate_destroy(SSLCertificate *cert);
void ssl_certificate_delete_from_disk(SSLCertificate *cert);
char * readable_fingerprint(unsigned char *src, int len);
-char *ssl_certificate_check_signer (gnutls_x509_crt cert, guint status);
+char *ssl_certificate_check_signer (gnutls_x509_crt_t cert, guint status);
-gnutls_x509_crt ssl_certificate_get_x509_from_pem_file(const gchar *file);
-gnutls_x509_privkey ssl_certificate_get_pkey_from_pem_file(const gchar *file);
+gnutls_x509_crt_t ssl_certificate_get_x509_from_pem_file(const gchar *file);
+gnutls_x509_privkey_t ssl_certificate_get_pkey_from_pem_file(const gchar *file);
void ssl_certificate_get_x509_and_pkey_from_p12_file(const gchar *file,
- const gchar *password, gnutls_x509_crt *crt, gnutls_x509_privkey *key);
-size_t gnutls_i2d_X509(gnutls_x509_crt x509_cert, unsigned char **output);
-size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey pkey, unsigned char **output);
+ const gchar *password, gnutls_x509_crt_t *crt, gnutls_x509_privkey_t *key);
+size_t gnutls_i2d_X509(gnutls_x509_crt_t x509_cert, unsigned char **output);
+size_t gnutls_i2d_PrivateKey(gnutls_x509_privkey_t pkey, unsigned char **output);
gboolean ssl_certificate_check_subject_cn(SSLCertificate *cert);
gchar *ssl_certificate_get_subject_cn(SSLCertificate *cert);
#endif /* USE_GNUTLS */
diff --git a/src/etpan/imap-thread.c b/src/etpan/imap-thread.c
@@ -523,8 +523,8 @@ static int etpan_certificate_check(const unsigned char *certificate, int len, vo
{
#ifdef USE_GNUTLS
struct connect_param *param = (struct connect_param *)data;
- gnutls_x509_crt cert = NULL;
- gnutls_datum tmp;
+ gnutls_x509_crt_t cert = NULL;
+ gnutls_datum_t tmp;
if (certificate == NULL || len < 0) {
g_warning("no cert presented.\n");
@@ -556,8 +556,8 @@ static void connect_ssl_context_cb(struct mailstream_ssl_context * ssl_context,
PrefsAccount *account = (PrefsAccount *)data;
const gchar *cert_path = NULL;
const gchar *password = NULL;
- gnutls_x509_crt x509 = NULL;
- gnutls_x509_privkey pkey = NULL;
+ gnutls_x509_crt_t x509 = NULL;
+ gnutls_x509_privkey_t pkey = NULL;
if (account->in_ssl_client_cert_file && *account->in_ssl_client_cert_file)
cert_path = account->in_ssl_client_cert_file;
diff --git a/src/etpan/nntp-thread.c b/src/etpan/nntp-thread.c
@@ -374,8 +374,8 @@ static int etpan_certificate_check(const unsigned char *certificate, int len, vo
{
#ifdef USE_GNUTLS
struct connect_param *param = (struct connect_param *)data;
- gnutls_x509_crt cert = NULL;
- gnutls_datum tmp;
+ gnutls_x509_crt_t cert = NULL;
+ gnutls_datum_t tmp;
if (certificate == NULL || len < 0) {
g_warning("no cert presented.\n");
@@ -407,8 +407,8 @@ static void connect_ssl_context_cb(struct mailstream_ssl_context * ssl_context,
PrefsAccount *account = (PrefsAccount *)data;
const gchar *cert_path = NULL;
const gchar *password = NULL;
- gnutls_x509_crt x509 = NULL;
- gnutls_x509_privkey pkey = NULL;
+ gnutls_x509_crt_t x509 = NULL;
+ gnutls_x509_privkey_t pkey = NULL;
if (account->in_ssl_client_cert_file && *account->in_ssl_client_cert_file)
cert_path = account->in_ssl_client_cert_file;
diff --git a/src/jpilot.c b/src/jpilot.c
@@ -540,6 +540,8 @@ static int jpilot_get_info_size( FILE *in, int *size ) {
fseek(in, 0, SEEK_SET);
r = fread(&rdbh, sizeof(RawDBHeader), 1, in);
+ if (r < 1)
+ return MGU_ERROR_READ;
if (feof(in)) {
return MGU_EOF;
}
diff --git a/src/main.c b/src/main.c
@@ -94,6 +94,7 @@
#include "account.h"
#include "procmsg.h"
#include "inc.h"
+#include "imap.h"
#include "import.h"
#include "manage_window.h"
#include "alertpanel.h"
diff --git a/src/mainwindow.c b/src/mainwindow.c
@@ -274,6 +274,10 @@ static void sort_summary_type_cb (GtkAction *action, GtkRadioAction *current, gp
static void attract_by_subject_cb(GtkAction *action,
gpointer data);
+static void zoom_in_cb (GtkAction *action,
+ gpointer data);
+static void zoom_out_cb (GtkAction *action,
+ gpointer data);
static void delete_duplicated_cb (GtkAction *action,
gpointer data);
static void delete_duplicated_all_cb (GtkAction *action,
@@ -547,6 +551,9 @@ static GtkActionEntry mainwin_entries[] =
{"View/SetColumns/Folderlist", NULL, N_("In _folder list..."), NULL, NULL, G_CALLBACK(set_folder_display_item_cb) },
{"View/SetColumns/Messagelist", NULL, N_("In _message list..."), NULL, NULL, G_CALLBACK(set_summary_display_item_cb) },
{"View/---", NULL, "---" },
+ {"View/Zoom", NULL, N_("_Zoom") },
+ {"View/Zoom/In", NULL, N_("_In"), "<control>plus", NULL, G_CALLBACK(zoom_in_cb) },
+ {"View/Zoom/Out", NULL, N_("_Out"), "<control>minus", NULL, G_CALLBACK(zoom_out_cb) },
#ifndef GENERIC_UMPC
@@ -1350,6 +1357,25 @@ void mainwindow_show_error(void)
gtk_widget_show(mainwin->warning_btn);
}
+static void main_window_zoom(ZoomType type)
+{
+ static gboolean zooming = FALSE;
+
+ if (zooming)
+ return;
+ zooming = TRUE;
+
+ prefs_common_zoom_font(&prefs_common.textfont, type);
+ prefs_common_zoom_font(&prefs_common.printfont, type);
+ prefs_common_zoom_font(&prefs_common.boldfont, type);
+ prefs_common_zoom_font(&prefs_common.normalfont, type);
+ prefs_common_zoom_font(&prefs_common.smallfont, type);
+
+ main_window_reflect_prefs_all();
+
+ zooming = FALSE;
+}
+
void mainwindow_clear_error(MainWindow *mainwin)
{
gtk_widget_hide(mainwin->warning_btn);
@@ -1407,50 +1433,12 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
break;
case GDK_KEY_F7:
{
- PangoFontDescription *font_desc;
- int size;
- font_desc = pango_font_description_from_string(prefs_common.normalfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size < 30) {
- size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.normalfont);
- prefs_common.normalfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
- }
- pango_font_description_free(font_desc);
- font_desc = pango_font_description_from_string(prefs_common.textfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size < 30) {
- size++; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.textfont);
- prefs_common.textfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
- }
- pango_font_description_free(font_desc);
+ main_window_zoom(ZOOM_IN);
}
break;
case GDK_KEY_F8:
{
- PangoFontDescription *font_desc;
- int size;
- font_desc = pango_font_description_from_string(prefs_common.normalfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size > 5) {
- size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.normalfont);
- prefs_common.normalfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
- }
- pango_font_description_free(font_desc);
- font_desc = pango_font_description_from_string(prefs_common.textfont);
- size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
- if (size > 5) {
- size--; pango_font_description_set_size(font_desc, size*PANGO_SCALE);
- g_free(prefs_common.textfont);
- prefs_common.textfont = pango_font_description_to_string(font_desc);
- main_window_reflect_prefs_all();
- }
- pango_font_description_free(font_desc);
+ main_window_zoom(ZOOM_OUT);
}
break;
case GDK_KEY_Escape:
@@ -1719,6 +1707,11 @@ MainWindow *main_window_create()
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "SetColumns", "View/SetColumns", GTK_UI_MANAGER_MENU)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Folderlist", "View/SetColumns/Folderlist", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/SetColumns", "Messagelist", "View/SetColumns/Messagelist", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator0", "View/---", GTK_UI_MANAGER_SEPARATOR)
+
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Zoom", "View/Zoom", GTK_UI_MANAGER_MENU)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Zoom", "In", "View/Zoom/In", GTK_UI_MANAGER_MENUITEM)
+ MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Zoom", "Out", "View/Zoom/Out", GTK_UI_MANAGER_MENUITEM)
MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator1", "View/---", GTK_UI_MANAGER_SEPARATOR)
#ifndef MAEMO
@@ -4704,6 +4697,16 @@ static void collapse_threads_cb(GtkAction *action, gpointer data)
summary_collapse_threads(mainwin->summaryview);
}
+static void zoom_in_cb(GtkAction *action, gpointer data)
+{
+ main_window_zoom(ZOOM_IN);
+}
+
+static void zoom_out_cb(GtkAction *action, gpointer data)
+{
+ main_window_zoom(ZOOM_OUT);
+}
+
static void set_summary_display_item_cb(GtkAction *action, gpointer data)
{
prefs_summary_column_open();
diff --git a/src/matcher.c b/src/matcher.c
@@ -2429,6 +2429,7 @@ static void matcher_add_rulenames(const gchar *rcpath)
FILE *dst = g_fopen(newpath, "wb");
gchar buf[BUFFSIZE];
int r;
+
if (src == NULL) {
perror("fopen");
if (dst)
diff --git a/src/prefs_common.c b/src/prefs_common.c
@@ -95,8 +95,6 @@ static PrefParam param_os_specific[] = {
&prefs_common.newmail_notify_cmd, P_STRING, NULL, NULL, NULL},
/* new fonts */
- {"widget_font_gtk2", NULL,
- &prefs_common.widgetfont, P_STRING, NULL, NULL, NULL},
{"message_font_gtk2", "Monospace 9",
&prefs_common.textfont, P_STRING, NULL, NULL, NULL},
{"print_font_gtk2", "Monospace 9",
@@ -317,8 +315,6 @@ static PrefParam param[] = {
/* Display */
/* Obsolete fonts. For coexisting with Gtk+-1.2 version */
- {"widget_font", NULL,
- &prefs_common.widgetfont_gtk1, P_STRING, NULL, NULL, NULL},
{"message_font", "-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*",
&prefs_common.textfont_gtk1, P_STRING, NULL, NULL, NULL},
{"small_font", "-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*",
@@ -330,8 +326,6 @@ static PrefParam param[] = {
/* new fonts */
#ifndef GENERIC_UMPC
- {"widget_font_gtk2", NULL,
- &SPECIFIC_PREFS.widgetfont, P_STRING, NULL, NULL, NULL},
{"message_font_gtk2", "Monospace 9",
&SPECIFIC_PREFS.textfont, P_STRING, NULL, NULL, NULL},
{"print_font_gtk2", "Monospace 9",
@@ -343,8 +337,6 @@ static PrefParam param[] = {
{"bold_font_gtk2", "Sans Bold 9",
&SPECIFIC_PREFS.boldfont, P_STRING, NULL, NULL, NULL},
#else
- {"widget_font_gtk2", NULL,
- &SPECIFIC_PREFS.widgetfont, P_STRING, NULL, NULL, NULL},
{"message_font_gtk2", "Monospace 8",
&SPECIFIC_PREFS.textfont, P_STRING, NULL, NULL, NULL},
{"print_font_gtk2", "Monospace 8",
@@ -1632,3 +1624,26 @@ PrefsCommon *prefs_common_get_prefs(void)
{
return &prefs_common;
}
+
+void prefs_common_zoom_font(gchar **font, ZoomType type)
+{
+ PangoFontDescription *font_desc;
+ int size;
+
+ if (font == NULL || *font == '\0')
+ return;
+
+ font_desc = pango_font_description_from_string(*font);
+ size = pango_font_description_get_size(font_desc)/PANGO_SCALE;
+
+ if (type == ZOOM_IN && size < 30)
+ size++;
+ if (type == ZOOM_OUT && size > 5)
+ size--;
+
+ pango_font_description_set_size(font_desc, size*PANGO_SCALE);
+
+ g_free(*font);
+ *font = pango_font_description_to_string(font_desc);
+ pango_font_description_free(font_desc);
+}
diff --git a/src/prefs_common.h b/src/prefs_common.h
@@ -56,6 +56,11 @@ typedef enum {
CTE_8BIT
} TransferEncodingMethod;
+typedef enum {
+ ZOOM_IN,
+ ZOOM_OUT
+} ZoomType;
+
typedef enum
{
/* U = unread, N = new, M = marked */
@@ -195,13 +200,11 @@ struct _PrefsCommon
gchar *smallfont_gtk1;
/* new fonts */
- gchar *widgetfont;
gchar *textfont;
gchar *printfont;
gchar *boldfont;
gchar *normalfont;
gchar *smallfont;
- gchar *titlefont;
gboolean use_different_print_font;
gboolean derive_from_normal_font;
@@ -544,4 +547,5 @@ gchar *pref_get_pref_from_entry(GtkEntry *entry);
const gchar *prefs_common_translated_header_name(const gchar *header_name);
const gchar *prefs_common_get_uri_cmd(void);
const gchar *prefs_common_get_ext_editor_cmd(void);
+void prefs_common_zoom_font(gchar **font, ZoomType type);
#endif /* __PREFS_COMMON_H__ */
diff --git a/src/procmsg.c b/src/procmsg.c
@@ -1161,6 +1161,7 @@ void procmsg_print_message(MsgInfo *msginfo, const gchar *cmdline)
gchar buf[1024];
gchar *p;
int r;
+
cm_return_if_fail(msginfo);
if (procmime_msginfo_is_encrypted(msginfo))