From d5eabdd653f26bb912e24e79c7a5ff28686380f8 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Tue, 27 Nov 2012 10:12:11 +0000 Subject: [PATCH] 2012-11-27 [colin] 3.9.0cvs22 * src/mainwindow.c * src/prefs_common.c * src/prefs_common.h Unsneak a work-in-progress patch that I mistakengly commited with a cleanup --- ChangeLog | 8 +++++ PATCHSETS | 1 + configure.ac | 2 +- src/mainwindow.c | 83 ++++++++++++++++++++++------------------------ src/prefs_common.c | 31 +++++------------ src/prefs_common.h | 8 ++--- 6 files changed, 60 insertions(+), 73 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42802b0b2..74929616e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-11-27 [colin] 3.9.0cvs22 + + * src/mainwindow.c + * src/prefs_common.c + * src/prefs_common.h + Unsneak a work-in-progress patch that I mistakengly + commited with a cleanup + 2012-11-27 [wwp] 3.9.0cvs21 * doc/man/claws-mail.1 diff --git a/PATCHSETS b/PATCHSETS index 17abf095f..6c98742fe 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -4519,3 +4519,4 @@ ( 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 ( cvs diff -u -r 1.1.2.13 -r 1.1.2.14 doc/man/claws-mail.1; cvs diff -u -r 1.115.2.263 -r 1.115.2.264 src/main.c; cvs diff -u -r 1.17.2.65 -r 1.17.2.66 src/send_message.c; cvs diff -u -r 1.1.4.12 -r 1.1.4.13 src/send_message.h; ) > 3.9.0cvs21.patchset +( cvs diff -u -r 1.274.2.356 -r 1.274.2.357 src/mainwindow.c; cvs diff -u -r 1.204.2.213 -r 1.204.2.214 src/prefs_common.c; cvs diff -u -r 1.103.2.142 -r 1.103.2.143 src/prefs_common.h; ) > 3.9.0cvs22.patchset diff --git a/configure.ac b/configure.ac index a84f2b144..d2bfd35ed 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=9 MICRO_VERSION=0 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=21 +EXTRA_VERSION=22 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/mainwindow.c b/src/mainwindow.c index 4d580e716..ac02149bd 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -274,10 +274,6 @@ 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, @@ -551,9 +547,6 @@ 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"), "plus", NULL, G_CALLBACK(zoom_in_cb) }, - {"View/Zoom/Out", NULL, N_("_Out"), "minus", NULL, G_CALLBACK(zoom_out_cb) }, #ifndef GENERIC_UMPC @@ -1357,25 +1350,6 @@ 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); @@ -1433,12 +1407,50 @@ static gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event, break; case GDK_KEY_F7: { - main_window_zoom(ZOOM_IN); + 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); } break; case GDK_KEY_F8: { - main_window_zoom(ZOOM_OUT); + 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); } break; case GDK_KEY_Escape: @@ -1707,11 +1719,6 @@ 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 @@ -4697,16 +4704,6 @@ 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/prefs_common.c b/src/prefs_common.c index 21d886767..417be6237 100644 --- a/src/prefs_common.c +++ b/src/prefs_common.c @@ -95,6 +95,8 @@ 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", @@ -315,6 +317,8 @@ 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-*-*-*-*-*-*-*", @@ -326,6 +330,8 @@ 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", @@ -337,6 +343,8 @@ 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", @@ -1624,26 +1632,3 @@ 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 index d83ae4422..b144a1603 100644 --- a/src/prefs_common.h +++ b/src/prefs_common.h @@ -56,11 +56,6 @@ typedef enum { CTE_8BIT } TransferEncodingMethod; -typedef enum { - ZOOM_IN, - ZOOM_OUT -} ZoomType; - typedef enum { /* U = unread, N = new, M = marked */ @@ -200,11 +195,13 @@ 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; @@ -547,5 +544,4 @@ 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__ */ -- 2.25.1