2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 2005-2023 the Claws Mail Team and Colin Leroy
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "claws-features.h"
30 #include <glib/gi18n.h>
32 #include <gdk/gdkkeysyms.h>
34 #include "foldersel.h"
35 #include "prefs_common.h"
36 #include "prefs_gtk.h"
37 #include "prefs_summary_open.h"
38 #include "prefs_summary_column.h"
39 #include "prefs_folder_column.h"
42 #include "gtk/gtkutils.h"
43 #include "gtk/prefswindow.h"
44 #include "gtk/combobox.h"
46 #include "manage_window.h"
48 typedef struct _SummariesPage
54 GtkWidget
*optmenu_folder_unread
;
55 GtkWidget
*spinbtn_ng_abbrev_len
;
56 GtkWidget
*checkbtn_useaddrbook
;
57 GtkWidget
*checkbtn_show_tooltips
;
58 GtkWidget
*checkbtn_threadsubj
;
59 GtkWidget
*button_datefmt
;
60 GtkWidget
*entry_datefmt
;
62 GtkWidget
*checkbtn_reopen_last_folder
;
63 GtkWidget
*checkbtn_startup_folder
;
64 GtkWidget
*startup_folder_entry
;
65 GtkWidget
*startup_folder_select
;
66 GtkWidget
*checkbtn_always_show_msg
;
67 GtkWidget
*checkbtn_show_on_folder_open
;
68 GtkWidget
*checkbtn_show_on_search_results
;
69 GtkWidget
*checkbtn_show_on_prevnext
;
70 GtkWidget
*checkbtn_show_on_deletemove
;
71 GtkWidget
*checkbtn_show_on_directional
;
72 GtkWidget
*checkbtn_mark_as_read_on_newwin
;
73 GtkWidget
*spinbtn_mark_as_read_delay
;
74 GtkWidget
*checkbtn_immedexec
;
75 GtkWidget
*checkbtn_ask_mark_all_read
;
76 GtkWidget
*checkbtn_run_processingrules_mark_all_read
;
77 GtkWidget
*checkbtn_ask_override_colorlabel
;
78 GtkWidget
*optmenu_sort_key
;
79 GtkWidget
*optmenu_sort_type
;
80 GtkWidget
*optmenu_summaryfromshow
;
81 GtkWidget
*optmenu_nextunreadmsgdialog
;
82 GtkWidget
*checkbtn_folder_default_thread
;
83 GtkWidget
*checkbtn_folder_default_thread_collapsed
;
84 GtkWidget
*checkbtn_folder_default_hide_read_threads
;
85 GtkWidget
*checkbtn_folder_default_hide_read_msgs
;
86 GtkWidget
*checkbtn_folder_default_hide_del_msgs
;
87 GtkWidget
*checkbtn_summary_col_lock
;
97 static void date_format_ok_btn_clicked (GtkButton
*button
,
99 static void date_format_cancel_btn_clicked (GtkButton
*button
,
101 static gboolean
date_format_key_pressed (GtkWidget
*keywidget
,
104 static gboolean
date_format_on_delete (GtkWidget
*dialogwidget
,
107 static void date_format_entry_on_change (GtkEditable
*editable
,
109 static void date_format_select_row (GtkTreeView
*list_view
,
111 GtkTreeViewColumn
*column
,
112 GtkWidget
*date_format
);
113 static void mark_as_read_toggled (GtkToggleButton
*button
,
115 static void always_show_msg_toggled (GtkToggleButton
*button
,
118 static void reopen_last_folder_toggled(GtkToggleButton
*toggle_btn
, GtkWidget
*widget
)
122 is_active
= gtk_toggle_button_get_active(toggle_btn
);
123 gtk_widget_set_sensitive(widget
, !is_active
);
125 prefs_common
.goto_folder_on_startup
= FALSE
;
128 static void startup_folder_toggled(GtkToggleButton
*toggle_btn
, GtkWidget
*widget
)
132 is_active
= gtk_toggle_button_get_active(toggle_btn
);
133 gtk_widget_set_sensitive(widget
, !is_active
);
135 prefs_common
.goto_last_folder_on_startup
= FALSE
;
138 static void foldersel_cb(GtkWidget
*widget
, gpointer data
)
140 GtkWidget
*entry
= (GtkWidget
*) data
;
145 item
= foldersel_folder_sel(NULL
, FOLDER_SEL_ALL
, NULL
, FALSE
, NULL
);
146 if (item
&& (item_id
= folder_item_get_identifier(item
)) != NULL
) {
147 gtk_editable_delete_text(GTK_EDITABLE(entry
), 0, -1);
148 gtk_editable_insert_text(GTK_EDITABLE(entry
), item_id
, strlen(item_id
), &newpos
);
153 static GtkWidget
*date_format_create(GtkButton
*button
, void *data
)
155 static GtkWidget
*datefmt_win
= NULL
;
158 GtkWidget
*scrolledwindow1
;
159 GtkWidget
*datefmt_list_view
;
164 GtkWidget
*confirm_area
;
166 GtkWidget
*cancel_btn
;
167 GtkWidget
*datefmt_entry
;
196 const gint TIME_FORMAT_ELEMS
=
197 sizeof time_format
/ sizeof time_format
[0];
199 GtkCellRenderer
*renderer
;
200 GtkTreeViewColumn
*column
;
201 GtkTreeSelection
*selection
;
203 time_format
[0].txt
= _("the abbreviated weekday name");
204 time_format
[1].txt
= _("the full weekday name");
205 time_format
[2].txt
= _("the abbreviated month name");
206 time_format
[3].txt
= _("the full month name");
207 time_format
[4].txt
= _("the preferred date and time for the current locale");
208 time_format
[5].txt
= _("the century number (year/100)");
209 time_format
[6].txt
= _("the day of the month as a decimal number");
210 time_format
[7].txt
= _("the hour as a decimal number using a 24-hour clock");
211 time_format
[8].txt
= _("the hour as a decimal number using a 12-hour clock");
212 time_format
[9].txt
= _("the day of the year as a decimal number");
213 time_format
[10].txt
= _("the month as a decimal number");
214 time_format
[11].txt
= _("the minute as a decimal number");
215 time_format
[12].txt
= _("either AM or PM");
216 time_format
[13].txt
= _("the second as a decimal number");
217 time_format
[14].txt
= _("the day of the week as a decimal number");
218 time_format
[15].txt
= _("the preferred date for the current locale");
219 time_format
[16].txt
= _("the last two digits of a year");
220 time_format
[17].txt
= _("the year as a decimal number");
221 time_format
[18].txt
= _("the time zone or name or abbreviation");
223 if (datefmt_win
) return datefmt_win
;
225 store
= gtk_list_store_new(N_DATEFMT_COLUMNS
,
230 for (i
= 0; i
< TIME_FORMAT_ELEMS
; i
++) {
233 gtk_list_store_append(store
, &iter
);
234 gtk_list_store_set(store
, &iter
,
235 DATEFMT_FMT
, time_format
[i
].fmt
,
236 DATEFMT_TXT
, time_format
[i
].txt
,
240 datefmt_win
= gtkut_window_new(GTK_WINDOW_TOPLEVEL
, "prefs_summaries");
241 gtk_container_set_border_width(GTK_CONTAINER(datefmt_win
), 8);
242 gtk_window_set_title(GTK_WINDOW(datefmt_win
), _("Date format"));
243 gtk_window_set_position(GTK_WINDOW(datefmt_win
), GTK_WIN_POS_CENTER
);
244 gtk_window_set_type_hint(GTK_WINDOW(datefmt_win
), GDK_WINDOW_TYPE_HINT_DIALOG
);
245 gtk_widget_set_size_request(datefmt_win
, 440, 280);
247 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 10);
248 gtk_widget_show(vbox1
);
249 gtk_container_add(GTK_CONTAINER(datefmt_win
), vbox1
);
251 scrolledwindow1
= gtk_scrolled_window_new(NULL
, NULL
);
252 gtk_scrolled_window_set_policy
253 (GTK_SCROLLED_WINDOW(scrolledwindow1
),
254 GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
255 gtk_widget_show(scrolledwindow1
);
256 gtk_box_pack_start(GTK_BOX(vbox1
), scrolledwindow1
, TRUE
, TRUE
, 0);
258 datefmt_list_view
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
259 g_object_unref(G_OBJECT(store
));
260 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(datefmt_list_view
),
261 prefs_common
.use_stripes_everywhere
);
262 gtk_widget_show(datefmt_list_view
);
263 gtk_container_add(GTK_CONTAINER(scrolledwindow1
), datefmt_list_view
);
265 renderer
= gtk_cell_renderer_text_new();
266 column
= gtk_tree_view_column_new_with_attributes
267 (_("Specifier"), renderer
, "text", DATEFMT_FMT
,
269 gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view
), column
);
271 renderer
= gtk_cell_renderer_text_new();
272 column
= gtk_tree_view_column_new_with_attributes
273 (_("Description"), renderer
, "text", DATEFMT_TXT
,
275 gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view
), column
);
277 /* gtk_cmclist_set_column_width(GTK_CMCLIST(datefmt_clist), 0, 80); */
278 selection
= gtk_tree_view_get_selection(GTK_TREE_VIEW(datefmt_list_view
));
279 gtk_tree_selection_set_mode(selection
, GTK_SELECTION_BROWSE
);
281 g_signal_connect(G_OBJECT(datefmt_list_view
), "row_activated",
282 G_CALLBACK(date_format_select_row
),
285 table
= gtk_grid_new();
286 gtk_widget_show(table
);
287 gtk_box_pack_start(GTK_BOX(vbox1
), table
, FALSE
, FALSE
, 0);
288 gtk_grid_set_row_spacing(GTK_GRID(table
), 4);
289 gtk_grid_set_column_spacing(GTK_GRID(table
), 8);
291 label1
= gtk_label_new(_("Date format"));
292 gtk_widget_show(label1
);
293 gtk_label_set_justify(GTK_LABEL(label1
), GTK_JUSTIFY_LEFT
);
294 gtk_label_set_xalign(GTK_LABEL(label1
), 0.0);
295 gtk_grid_attach(GTK_GRID(table
), label1
, 0, 0, 1, 1);
297 datefmt_entry
= gtk_entry_new();
298 gtk_entry_set_max_length(GTK_ENTRY(datefmt_entry
), 256);
299 gtk_widget_show(datefmt_entry
);
300 gtk_grid_attach(GTK_GRID(table
), datefmt_entry
, 1, 0, 1, 1);
301 gtk_widget_set_hexpand(datefmt_entry
, TRUE
);
302 gtk_widget_set_halign(datefmt_entry
, GTK_ALIGN_FILL
);
304 /* we need the "sample" entry box; add it as data so callbacks can
305 * get the entry box */
306 g_object_set_data(G_OBJECT(datefmt_win
), "datefmt_sample",
309 label2
= gtk_label_new(_("Example"));
310 gtk_widget_show(label2
);
311 gtk_label_set_justify(GTK_LABEL(label2
), GTK_JUSTIFY_LEFT
);
312 gtk_label_set_xalign(GTK_LABEL(label2
), 0.0);
313 gtk_grid_attach(GTK_GRID(table
), label2
, 0, 1, 1, 1);
315 label3
= gtk_label_new("");
316 gtk_widget_show(label3
);
317 gtk_label_set_justify(GTK_LABEL(label3
), GTK_JUSTIFY_LEFT
);
318 gtk_label_set_xalign(GTK_LABEL(label3
), 0.0);
319 gtk_grid_attach(GTK_GRID(table
), label3
, 1, 1, 1, 1);
320 gtk_widget_set_hexpand(label3
, TRUE
);
321 gtk_widget_set_halign(label3
, GTK_ALIGN_FILL
);
323 gtkut_stock_button_set_create(&confirm_area
, &cancel_btn
, NULL
, _("_Cancel"),
324 &ok_btn
, NULL
, _("_OK"), NULL
, NULL
, NULL
);
326 gtk_box_pack_start(GTK_BOX(vbox1
), confirm_area
, FALSE
, FALSE
, 0);
327 gtk_widget_show(confirm_area
);
328 gtk_widget_grab_default(ok_btn
);
330 /* set the current format */
331 gtk_entry_set_text(GTK_ENTRY(datefmt_entry
), prefs_common
.date_format
);
332 date_format_entry_on_change(GTK_EDITABLE(datefmt_entry
),
335 g_signal_connect(G_OBJECT(ok_btn
), "clicked",
336 G_CALLBACK(date_format_ok_btn_clicked
),
338 g_signal_connect(G_OBJECT(cancel_btn
), "clicked",
339 G_CALLBACK(date_format_cancel_btn_clicked
),
341 g_signal_connect(G_OBJECT(datefmt_win
), "key_press_event",
342 G_CALLBACK(date_format_key_pressed
),
344 g_signal_connect(G_OBJECT(datefmt_win
), "delete_event",
345 G_CALLBACK(date_format_on_delete
),
347 g_signal_connect(G_OBJECT(datefmt_entry
), "changed",
348 G_CALLBACK(date_format_entry_on_change
),
351 gtk_widget_show(datefmt_win
);
352 manage_window_set_transient(GTK_WINDOW(datefmt_win
));
353 gtk_window_set_modal(GTK_WINDOW(datefmt_win
), TRUE
);
355 gtk_widget_grab_focus(ok_btn
);
360 static void prefs_summaries_create_widget(PrefsPage
*_page
, GtkWindow
*window
,
363 SummariesPage
*prefs_summaries
= (SummariesPage
*) _page
;
366 GtkWidget
*hbox0
, *hbox1
, *hbox2
;
367 GtkWidget
*vbox1
, *vbox2
, *vbox3
, *vbox4
;
368 GtkWidget
*frame_new_folders
;
369 GtkWidget
*optmenu_folder_unread
;
370 GtkWidget
*label_ng_abbrev
;
371 GtkWidget
*spinbtn_ng_abbrev_len
;
372 GtkAdjustment
*spinbtn_ng_abbrev_len_adj
;
373 GtkWidget
*checkbtn_useaddrbook
;
374 GtkWidget
*checkbtn_show_tooltips
;
375 GtkWidget
*checkbtn_threadsubj
;
376 GtkWidget
*label_datefmt
;
377 GtkWidget
*button_datefmt
;
378 GtkWidget
*entry_datefmt
;
379 GtkWidget
*button_dispitem
;
380 GtkWidget
*checkbtn_reopen_last_folder
;
381 GtkWidget
*checkbtn_startup_folder
;
382 GtkWidget
*startup_folder_entry
;
383 GtkWidget
*startup_folder_select
;
384 GtkWidget
*checkbtn_always_show_msg
;
385 GtkWidget
*checkbtn_show_on_folder_open
;
386 GtkWidget
*checkbtn_show_on_search_results
;
387 GtkWidget
*checkbtn_show_on_prevnext
;
388 GtkWidget
*checkbtn_show_on_deletemove
;
389 GtkWidget
*checkbtn_show_on_directional
;
390 GtkWidget
*spinbtn_mark_as_read_delay
;
391 GtkAdjustment
*spinbtn_mark_as_read_delay_adj
;
392 GtkWidget
*checkbtn_immedexec
;
393 GtkWidget
*checkbtn_ask_mark_all_read
;
394 GtkWidget
*checkbtn_run_processingrules_mark_all_read
;
395 GtkWidget
*checkbtn_ask_override_colorlabel
;
396 GtkWidget
*label
, *label_fill
;
399 GtkWidget
*optmenu_summaryfromshow
;
400 GtkWidget
*optmenu_nextunreadmsgdialog
;
401 GtkWidget
*button_edit_actions
;
402 GtkWidget
*radio_mark_as_read_on_select
;
403 GtkWidget
*radio_mark_as_read_on_new_win
;
404 GtkWidget
*optmenu_sort_key
;
405 GtkWidget
*optmenu_sort_type
;
406 GtkWidget
*checkbtn_folder_default_thread
;
407 GtkWidget
*checkbtn_folder_default_thread_collapsed
;
408 GtkWidget
*checkbtn_folder_default_hide_read_threads
;
409 GtkWidget
*checkbtn_folder_default_hide_read_msgs
;
410 GtkWidget
*checkbtn_folder_default_hide_del_msgs
;
411 GtkWidget
*checkbtn_summary_col_lock
;
413 notebook
= gtk_notebook_new();
414 gtk_widget_show(notebook
);
416 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
417 gtk_widget_show (vbox1
);
418 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
419 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
420 gtk_label_new(_("Folder list")));
422 hbox0
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
423 gtk_widget_show (hbox0
);
424 gtk_box_pack_start(GTK_BOX(vbox1
), hbox0
, FALSE
, TRUE
, 0);
426 label
= gtk_label_new(_("Displayed columns"));
427 gtk_widget_show(label
);
428 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
429 button_dispitem
= gtk_button_new_with_mnemonic("_Edit");
430 gtk_widget_show (button_dispitem
);
431 gtk_box_pack_start (GTK_BOX (hbox0
), button_dispitem
, FALSE
, FALSE
, 0);
432 g_signal_connect (G_OBJECT (button_dispitem
), "clicked",
433 G_CALLBACK (prefs_folder_column_open
),
436 hbox0
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
437 gtk_widget_show (hbox0
);
438 gtk_box_pack_start(GTK_BOX (vbox1
), hbox0
, FALSE
, FALSE
, 0);
440 label
= gtk_label_new (_("Display message count next to folder name"));
441 gtk_widget_show (label
);
442 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
444 optmenu_folder_unread
= gtkut_sc_combobox_create(NULL
, FALSE
);
445 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
446 GTK_COMBO_BOX(optmenu_folder_unread
)));
447 gtk_widget_show (optmenu_folder_unread
);
449 COMBOBOX_ADD (menu
, _("No"), 0);
450 COMBOBOX_ADD (menu
, _("Unread messages"), 1);
451 COMBOBOX_ADD (menu
, _("Unread and Total messages"), 2);
453 gtk_box_pack_start(GTK_BOX(hbox0
), optmenu_folder_unread
, FALSE
, FALSE
, 0);
456 (vbox1
, checkbtn_reopen_last_folder
,
457 _("Open last opened folder at start-up"));
459 hbox0
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
460 gtk_widget_show(hbox0
);
461 gtk_box_pack_start(GTK_BOX(vbox1
), hbox0
, FALSE
, FALSE
, 0);
464 (hbox0
, checkbtn_startup_folder
,
465 _("Open selected folder at start-up"));
467 startup_folder_entry
= gtk_entry_new();
468 gtk_widget_show(startup_folder_entry
);
469 gtk_box_pack_start(GTK_BOX(hbox0
), startup_folder_entry
, TRUE
, TRUE
, 0);
470 startup_folder_select
= gtkut_get_browse_directory_btn(_("_Browse"));
471 gtk_widget_show(startup_folder_select
);
472 gtk_box_pack_start(GTK_BOX(hbox0
), startup_folder_select
, FALSE
, FALSE
, 0);
474 SET_TOGGLE_SENSITIVITY(checkbtn_startup_folder
, startup_folder_entry
)
475 SET_TOGGLE_SENSITIVITY(checkbtn_startup_folder
, startup_folder_select
)
477 g_signal_connect(G_OBJECT(checkbtn_reopen_last_folder
), "toggled",
478 G_CALLBACK(reopen_last_folder_toggled
), checkbtn_startup_folder
);
479 g_signal_connect(G_OBJECT(checkbtn_startup_folder
), "toggled",
480 G_CALLBACK(startup_folder_toggled
), checkbtn_reopen_last_folder
);
481 g_signal_connect(G_OBJECT(startup_folder_select
), "clicked",
482 G_CALLBACK(foldersel_cb
), startup_folder_entry
);
485 (vbox1
, checkbtn_run_processingrules_mark_all_read
,
486 _("Run processing rules before marking all messages in a folder as read or unread"));
488 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
489 gtk_widget_show (hbox1
);
490 gtk_box_pack_start(GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
492 label_ng_abbrev
= gtk_label_new
493 (_("Abbreviate newsgroup names longer than"));
494 gtk_widget_show (label_ng_abbrev
);
495 gtk_box_pack_start (GTK_BOX (hbox1
), label_ng_abbrev
, FALSE
, FALSE
, 0);
497 spinbtn_ng_abbrev_len_adj
= GTK_ADJUSTMENT(gtk_adjustment_new (16, 0, 999, 1, 10, 0));
498 spinbtn_ng_abbrev_len
= gtk_spin_button_new
499 (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj
), 1, 0);
500 gtk_widget_show (spinbtn_ng_abbrev_len
);
501 gtk_box_pack_start (GTK_BOX (hbox1
), spinbtn_ng_abbrev_len
,
503 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len
),
506 label_ng_abbrev
= gtk_label_new (_("letters"));
507 gtk_widget_show (label_ng_abbrev
);
508 gtk_box_pack_start (GTK_BOX (hbox1
), label_ng_abbrev
, FALSE
, FALSE
, 0);
510 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
511 gtk_widget_show (vbox1
);
512 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
513 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
514 gtk_label_new(_("Message list")));
516 hbox0
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
517 gtk_widget_show (hbox0
);
518 gtk_box_pack_start(GTK_BOX(vbox1
), hbox0
, FALSE
, TRUE
, 0);
520 label
= gtk_label_new(_("Displayed columns"));
521 gtk_widget_show(label
);
522 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
523 button_dispitem
= gtk_button_new_with_mnemonic("_Edit");
524 gtk_widget_show (button_dispitem
);
525 gtk_box_pack_start (GTK_BOX (hbox0
), button_dispitem
, FALSE
, FALSE
, 0);
526 g_signal_connect (G_OBJECT (button_dispitem
), "clicked",
527 G_CALLBACK (prefs_summary_column_open
),
530 PACK_SPACER(hbox0
, hbox1
, 4);
531 PACK_CHECK_BUTTON(hbox0
, checkbtn_summary_col_lock
, _("Lock column headers"));
533 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
534 gtk_widget_show (hbox1
);
535 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
537 label
= gtk_label_new (_("Displayed in From column"));
538 gtk_widget_show (label
);
539 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
541 optmenu_summaryfromshow
= gtkut_sc_combobox_create(NULL
, FALSE
);
542 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
543 GTK_COMBO_BOX(optmenu_summaryfromshow
)));
544 gtk_widget_show (optmenu_summaryfromshow
);
546 COMBOBOX_ADD (menu
, _("Name"), SHOW_NAME
);
547 COMBOBOX_ADD (menu
, _("Address"), SHOW_ADDR
);
548 COMBOBOX_ADD (menu
, _("Name and Address"), SHOW_BOTH
);
550 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_summaryfromshow
, FALSE
, FALSE
, 0);
551 hbox2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
552 gtk_widget_show (hbox2
);
553 gtk_box_pack_start (GTK_BOX (vbox1
), hbox2
, FALSE
, TRUE
, 0);
555 label_datefmt
= gtk_label_new (_("Date format"));
556 gtk_widget_show (label_datefmt
);
557 gtk_box_pack_start (GTK_BOX (hbox2
), label_datefmt
, FALSE
, FALSE
, 0);
559 entry_datefmt
= gtk_entry_new ();
560 gtk_widget_show (entry_datefmt
);
561 gtk_box_pack_start (GTK_BOX (hbox2
), entry_datefmt
, FALSE
, FALSE
, 0);
563 button_datefmt
= gtkut_stock_button("dialog-information", _("_Information"));
565 gtk_widget_show (button_datefmt
);
566 gtk_box_pack_start (GTK_BOX (hbox2
), button_datefmt
, FALSE
, FALSE
, 0);
567 g_signal_connect (G_OBJECT (button_datefmt
), "clicked",
568 G_CALLBACK (date_format_create
), NULL
);
570 label_fill
= gtk_label_new(" ");
571 gtk_box_pack_start(GTK_BOX(hbox2
), label_fill
, TRUE
, FALSE
, 0);
573 CLAWS_SET_TIP(button_datefmt
,
574 _("Date format help"));
576 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
577 gtk_widget_show (hbox1
);
578 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, TRUE
, 0);
580 button_edit_actions
= gtk_button_new_with_label(_("Set message selection when entering a folder"));
581 gtk_widget_show (button_edit_actions
);
582 gtk_box_pack_start (GTK_BOX (hbox1
), button_edit_actions
,
584 g_signal_connect (G_OBJECT (button_edit_actions
), "clicked",
585 G_CALLBACK (prefs_summary_open_open
),
588 /* Open message on select policy */
589 vbox4
= gtkut_get_options_frame(vbox1
, NULL
, _("Open message when selected"));
591 PACK_CHECK_BUTTON(vbox4
, checkbtn_always_show_msg
,
593 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_folder_open
,
594 _("When opening a folder"));
595 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_search_results
,
596 _("When displaying search results"));
597 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_prevnext
,
598 _("When selecting next or previous message using shortcuts"));
599 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_deletemove
,
600 _("When deleting or moving messages"));
601 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_directional
,
602 _("When using directional keys"));
604 vbox3
= gtkut_get_options_frame(vbox1
, NULL
, _("Mark message as read"));
606 radio_mark_as_read_on_select
= gtk_radio_button_new_with_label(NULL
,
607 _("when selected, after"));
609 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
610 gtk_box_pack_start (GTK_BOX (hbox1
), radio_mark_as_read_on_select
, FALSE
, FALSE
, 0);
612 spinbtn_mark_as_read_delay_adj
= GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 60, 1, 10, 0));
613 spinbtn_mark_as_read_delay
= gtk_spin_button_new
614 (GTK_ADJUSTMENT (spinbtn_mark_as_read_delay_adj
), 1, 0);
615 gtk_box_pack_start (GTK_BOX (hbox1
), spinbtn_mark_as_read_delay
,
617 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_mark_as_read_delay
),
619 gtk_box_pack_start (GTK_BOX (hbox1
), gtk_label_new
620 (_("seconds")), FALSE
, FALSE
, 0);
622 gtk_box_pack_start (GTK_BOX (vbox3
), hbox1
, FALSE
, FALSE
, 0);
624 radio_mark_as_read_on_new_win
= gtk_radio_button_new_with_label_from_widget(
625 GTK_RADIO_BUTTON(radio_mark_as_read_on_select
),
626 _("only when opened in a new window, or replied to"));
627 gtk_box_pack_start (GTK_BOX (vbox3
), radio_mark_as_read_on_new_win
,
629 gtk_widget_show_all(vbox3
);
631 /* Next Unread Message Dialog */
632 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
633 gtk_widget_show (hbox1
);
634 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
636 label
= gtk_label_new (_("Show \"no unread (or new) message\" dialog"));
637 gtk_widget_show (label
);
638 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
640 optmenu_nextunreadmsgdialog
= gtkut_sc_combobox_create(NULL
, FALSE
);
641 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
642 GTK_COMBO_BOX(optmenu_nextunreadmsgdialog
)));
643 gtk_widget_show (optmenu_nextunreadmsgdialog
);
645 COMBOBOX_ADD (menu
, _("Always"), NEXTUNREADMSGDIALOG_ALWAYS
);
646 COMBOBOX_ADD (menu
, _("Assume 'Yes'"), NEXTUNREADMSGDIALOG_ASSUME_YES
);
647 COMBOBOX_ADD (menu
, _("Assume 'No'"), NEXTUNREADMSGDIALOG_ASSUME_NO
);
649 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_nextunreadmsgdialog
, FALSE
, FALSE
, 0);
652 (vbox1
, checkbtn_useaddrbook
,
653 _("Display sender using address book"));
656 (vbox1
, checkbtn_threadsubj
,
657 _("Thread using subject in addition to standard headers"));
660 (vbox1
, checkbtn_immedexec
,
661 _("Execute immediately when moving or deleting messages"));
662 CLAWS_SET_TIP(checkbtn_immedexec
,
663 _("When unchecked moving, copying and deleting of messages"
664 " is deferred until you use 'Tools/Execute'"));
667 (vbox1
, checkbtn_ask_mark_all_read
,
668 _("Confirm when marking all messages as read or unread"));
670 (vbox1
, checkbtn_ask_override_colorlabel
,
671 _("Confirm when changing color labels"));
674 (vbox1
, checkbtn_show_tooltips
,
677 hbox2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
678 gtk_widget_show (hbox2
);
679 gtk_box_pack_start (GTK_BOX (vbox1
), hbox2
, FALSE
, FALSE
, 0);
681 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
682 gtk_widget_show (vbox1
);
683 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
684 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
685 gtk_label_new(_("Defaults")));
687 vbox2
= gtkut_get_options_frame(vbox1
, &frame_new_folders
, _("New folders"));
689 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
690 gtk_widget_show(hbox1
);
691 gtk_box_pack_start(GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
693 label
= gtk_label_new(_("Sort by"));
694 gtk_widget_show(label
);
695 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
697 optmenu_sort_key
= gtkut_sc_combobox_create(NULL
, FALSE
);
698 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_key
)));
699 gtk_widget_show(optmenu_sort_key
);
701 COMBOBOX_ADD(menu
, _("Number"), SORT_BY_NUMBER
);
702 COMBOBOX_ADD(menu
, _("Size"), SORT_BY_SIZE
);
703 COMBOBOX_ADD(menu
, _("Date"), SORT_BY_DATE
);
704 COMBOBOX_ADD(menu
, _("Thread date"), SORT_BY_THREAD_DATE
);
705 COMBOBOX_ADD(menu
, _("From"), SORT_BY_FROM
);
706 COMBOBOX_ADD(menu
, _("To"), SORT_BY_TO
);
707 COMBOBOX_ADD(menu
, _("Subject"), SORT_BY_SUBJECT
);
708 COMBOBOX_ADD(menu
, _("Color label"), SORT_BY_LABEL
);
709 COMBOBOX_ADD(menu
, _("Tag"), SORT_BY_TAGS
);
710 COMBOBOX_ADD(menu
, _("Mark"), SORT_BY_MARK
);
711 COMBOBOX_ADD(menu
, _("Status"), SORT_BY_STATUS
);
712 COMBOBOX_ADD(menu
, _("Attachment"), SORT_BY_MIME
);
713 COMBOBOX_ADD(menu
, _("Score"), SORT_BY_SCORE
);
714 COMBOBOX_ADD(menu
, _("Locked"), SORT_BY_LOCKED
);
715 COMBOBOX_ADD(menu
, _("Don't sort"), SORT_BY_NONE
);
717 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_sort_key
, FALSE
, FALSE
, 0);
719 optmenu_sort_type
= gtkut_sc_combobox_create(NULL
, FALSE
);
720 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_type
)));
721 gtk_widget_show(optmenu_sort_type
);
723 COMBOBOX_ADD(menu
, _("Ascending"), SORT_ASCENDING
);
724 COMBOBOX_ADD(menu
, _("Descending"), SORT_DESCENDING
);
726 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_sort_type
, FALSE
, FALSE
, 0);
729 (vbox2
, checkbtn_folder_default_thread
,
732 (vbox2
, checkbtn_folder_default_thread_collapsed
,
733 _("Collapse all threads"));
735 (vbox2
, checkbtn_folder_default_hide_read_threads
,
736 _("Hide read threads"));
738 (vbox2
, checkbtn_folder_default_hide_read_msgs
,
739 _("Hide read messages"));
741 (vbox2
, checkbtn_folder_default_hide_del_msgs
,
742 _("Hide deleted messages"));
744 prefs_summaries
->optmenu_folder_unread
= optmenu_folder_unread
;
745 prefs_summaries
->spinbtn_ng_abbrev_len
= spinbtn_ng_abbrev_len
;
746 prefs_summaries
->checkbtn_useaddrbook
= checkbtn_useaddrbook
;
747 prefs_summaries
->checkbtn_show_tooltips
= checkbtn_show_tooltips
;
748 prefs_summaries
->checkbtn_threadsubj
= checkbtn_threadsubj
;
749 prefs_summaries
->entry_datefmt
= entry_datefmt
;
750 prefs_summaries
->checkbtn_reopen_last_folder
= checkbtn_reopen_last_folder
;
751 prefs_summaries
->checkbtn_startup_folder
= checkbtn_startup_folder
;
752 prefs_summaries
->startup_folder_entry
= startup_folder_entry
;
754 prefs_summaries
->checkbtn_always_show_msg
= checkbtn_always_show_msg
;
755 prefs_summaries
->checkbtn_show_on_folder_open
= checkbtn_show_on_folder_open
;
756 prefs_summaries
->checkbtn_show_on_search_results
= checkbtn_show_on_search_results
;
757 prefs_summaries
->checkbtn_show_on_prevnext
= checkbtn_show_on_prevnext
;
758 prefs_summaries
->checkbtn_show_on_deletemove
= checkbtn_show_on_deletemove
;
759 prefs_summaries
->checkbtn_show_on_directional
= checkbtn_show_on_directional
;
761 prefs_summaries
->checkbtn_mark_as_read_on_newwin
= radio_mark_as_read_on_new_win
;
762 prefs_summaries
->spinbtn_mark_as_read_delay
= spinbtn_mark_as_read_delay
;
763 prefs_summaries
->checkbtn_immedexec
= checkbtn_immedexec
;
764 prefs_summaries
->checkbtn_ask_mark_all_read
= checkbtn_ask_mark_all_read
;
765 prefs_summaries
->checkbtn_run_processingrules_mark_all_read
= checkbtn_run_processingrules_mark_all_read
;
766 prefs_summaries
->checkbtn_ask_override_colorlabel
= checkbtn_ask_override_colorlabel
;
767 prefs_summaries
->optmenu_sort_key
= optmenu_sort_key
;
768 prefs_summaries
->optmenu_sort_type
= optmenu_sort_type
;
769 prefs_summaries
->optmenu_nextunreadmsgdialog
= optmenu_nextunreadmsgdialog
;
770 prefs_summaries
->optmenu_summaryfromshow
= optmenu_summaryfromshow
;
772 prefs_summaries
->checkbtn_folder_default_thread
= checkbtn_folder_default_thread
;
773 prefs_summaries
->checkbtn_folder_default_thread_collapsed
= checkbtn_folder_default_thread_collapsed
;
774 prefs_summaries
->checkbtn_folder_default_hide_read_threads
= checkbtn_folder_default_hide_read_threads
;
775 prefs_summaries
->checkbtn_folder_default_hide_read_msgs
= checkbtn_folder_default_hide_read_msgs
;
776 prefs_summaries
->checkbtn_folder_default_hide_del_msgs
= checkbtn_folder_default_hide_del_msgs
;
777 prefs_summaries
->checkbtn_summary_col_lock
= checkbtn_summary_col_lock
;
779 prefs_summaries
->page
.widget
= vbox1
;
780 g_signal_connect(G_OBJECT(checkbtn_always_show_msg
), "toggled",
781 G_CALLBACK(always_show_msg_toggled
), prefs_summaries
);
783 g_signal_connect(G_OBJECT(radio_mark_as_read_on_select
), "toggled",
784 G_CALLBACK(mark_as_read_toggled
),
785 spinbtn_mark_as_read_delay
);
787 prefs_summaries
->window
= GTK_WIDGET(window
);
789 combobox_select_by_data(GTK_COMBO_BOX(optmenu_folder_unread
),
790 prefs_common
.display_folder_unread
);
791 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_useaddrbook
),
792 prefs_common
.use_addr_book
);
793 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_tooltips
),
794 prefs_common
.show_tooltips
);
795 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_threadsubj
),
796 prefs_common
.thread_by_subject
);
797 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_ng_abbrev_len
),
798 prefs_common
.ng_abbrev_len
);
799 gtk_entry_set_text(GTK_ENTRY(entry_datefmt
),
800 prefs_common
.date_format
?prefs_common
.date_format
:"");
801 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_reopen_last_folder
),
802 prefs_common
.goto_last_folder_on_startup
);
803 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_startup_folder
),
804 prefs_common
.goto_folder_on_startup
);
805 gtk_entry_set_text(GTK_ENTRY(startup_folder_entry
),
806 prefs_common
.startup_folder
?prefs_common
.startup_folder
:"");
808 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_always_show_msg
),
809 prefs_common
.always_show_msg
);
810 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_folder_open
),
811 prefs_common
.open_selected_on_folder_open
);
812 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_search_results
),
813 prefs_common
.open_selected_on_search_results
);
814 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_prevnext
),
815 prefs_common
.open_selected_on_prevnext
);
816 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_deletemove
),
817 prefs_common
.open_selected_on_deletemove
);
818 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_directional
),
819 prefs_common
.open_selected_on_directional
);
821 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_mark_as_read_on_new_win
),
822 prefs_common
.mark_as_read_on_new_window
);
823 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_mark_as_read_delay
),
824 prefs_common
.mark_as_read_delay
);
825 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_immedexec
),
826 prefs_common
.immediate_exec
);
827 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_mark_all_read
),
828 prefs_common
.ask_mark_all_read
);
829 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_run_processingrules_mark_all_read
),
830 prefs_common
.run_processingrules_before_mark_all
);
831 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_override_colorlabel
),
832 prefs_common
.ask_override_colorlabel
);
834 combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_key
),
835 prefs_common
.default_sort_key
);
836 combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_type
),
837 prefs_common
.default_sort_type
);
839 combobox_select_by_data(GTK_COMBO_BOX(optmenu_summaryfromshow
),
840 prefs_common
.summary_from_show
);
842 combobox_select_by_data(GTK_COMBO_BOX(optmenu_nextunreadmsgdialog
),
843 prefs_common
.next_unread_msg_dialog
);
845 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_thread
),
846 prefs_common
.folder_default_thread
);
847 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_thread_collapsed
),
848 prefs_common
.folder_default_thread_collapsed
);
849 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_read_threads
),
850 prefs_common
.folder_default_hide_read_threads
);
851 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_read_msgs
),
852 prefs_common
.folder_default_hide_read_msgs
);
853 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_del_msgs
),
854 prefs_common
.folder_default_hide_del_msgs
);
855 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_summary_col_lock
),
856 prefs_common
.summary_col_lock
);
858 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook
), 0);
860 prefs_summaries
->page
.widget
= notebook
;
863 static void prefs_summaries_save(PrefsPage
*_page
)
865 SummariesPage
*page
= (SummariesPage
*) _page
;
867 prefs_common
.display_folder_unread
= combobox_get_active_data(
868 GTK_COMBO_BOX(page
->optmenu_folder_unread
));
870 prefs_common
.use_addr_book
= gtk_toggle_button_get_active(
871 GTK_TOGGLE_BUTTON(page
->checkbtn_useaddrbook
));
872 prefs_common
.show_tooltips
= gtk_toggle_button_get_active(
873 GTK_TOGGLE_BUTTON(page
->checkbtn_show_tooltips
));
874 prefs_common
.thread_by_subject
= gtk_toggle_button_get_active(
875 GTK_TOGGLE_BUTTON(page
->checkbtn_threadsubj
));
876 prefs_common
.ng_abbrev_len
= gtk_spin_button_get_value_as_int(
877 GTK_SPIN_BUTTON(page
->spinbtn_ng_abbrev_len
));
879 g_free(prefs_common
.date_format
);
880 prefs_common
.date_format
= gtk_editable_get_chars(
881 GTK_EDITABLE(page
->entry_datefmt
), 0, -1);
883 prefs_common
.goto_last_folder_on_startup
= gtk_toggle_button_get_active(
884 GTK_TOGGLE_BUTTON(page
->checkbtn_reopen_last_folder
));
885 prefs_common
.goto_folder_on_startup
= gtk_toggle_button_get_active(
886 GTK_TOGGLE_BUTTON(page
->checkbtn_startup_folder
));
887 prefs_common
.startup_folder
= gtk_editable_get_chars(
888 GTK_EDITABLE(page
->startup_folder_entry
), 0, -1);
890 prefs_common
.always_show_msg
= gtk_toggle_button_get_active(
891 GTK_TOGGLE_BUTTON(page
->checkbtn_always_show_msg
));
892 prefs_common
.open_selected_on_folder_open
= gtk_toggle_button_get_active(
893 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_folder_open
));
894 prefs_common
.open_selected_on_search_results
= gtk_toggle_button_get_active(
895 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_search_results
));
896 prefs_common
.open_selected_on_prevnext
= gtk_toggle_button_get_active(
897 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_prevnext
));
898 prefs_common
.open_selected_on_deletemove
= gtk_toggle_button_get_active(
899 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_deletemove
));
900 prefs_common
.open_selected_on_directional
= gtk_toggle_button_get_active(
901 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_directional
));
903 prefs_common
.mark_as_read_on_new_window
= gtk_toggle_button_get_active(
904 GTK_TOGGLE_BUTTON(page
->checkbtn_mark_as_read_on_newwin
));
905 prefs_common
.immediate_exec
= gtk_toggle_button_get_active(
906 GTK_TOGGLE_BUTTON(page
->checkbtn_immedexec
));
907 prefs_common
.ask_mark_all_read
= gtk_toggle_button_get_active(
908 GTK_TOGGLE_BUTTON(page
->checkbtn_ask_mark_all_read
));
909 prefs_common
.run_processingrules_before_mark_all
= gtk_toggle_button_get_active(
910 GTK_TOGGLE_BUTTON(page
->checkbtn_run_processingrules_mark_all_read
));
911 prefs_common
.ask_override_colorlabel
= gtk_toggle_button_get_active(
912 GTK_TOGGLE_BUTTON(page
->checkbtn_ask_override_colorlabel
));
913 prefs_common
.mark_as_read_delay
= gtk_spin_button_get_value_as_int(
914 GTK_SPIN_BUTTON(page
->spinbtn_mark_as_read_delay
));
915 prefs_common
.summary_col_lock
= gtk_toggle_button_get_active(
916 GTK_TOGGLE_BUTTON(page
->checkbtn_summary_col_lock
));
918 prefs_common
.default_sort_key
= combobox_get_active_data(
919 GTK_COMBO_BOX(page
->optmenu_sort_key
));
920 prefs_common
.default_sort_type
= combobox_get_active_data(
921 GTK_COMBO_BOX(page
->optmenu_sort_type
));
922 prefs_common
.summary_from_show
= combobox_get_active_data(
923 GTK_COMBO_BOX(page
->optmenu_summaryfromshow
));
924 prefs_common
.next_unread_msg_dialog
= combobox_get_active_data(
925 GTK_COMBO_BOX(page
->optmenu_nextunreadmsgdialog
));
926 prefs_common
.folder_default_thread
= gtk_toggle_button_get_active(
927 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_thread
));
928 prefs_common
.folder_default_thread_collapsed
= gtk_toggle_button_get_active(
929 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_thread_collapsed
));
930 prefs_common
.folder_default_hide_read_threads
= gtk_toggle_button_get_active(
931 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_read_threads
));
932 prefs_common
.folder_default_hide_read_msgs
= gtk_toggle_button_get_active(
933 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_read_msgs
));
934 prefs_common
.folder_default_hide_del_msgs
= gtk_toggle_button_get_active(
935 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_del_msgs
));
936 prefs_common
.folder_default_hide_del_msgs
= gtk_toggle_button_get_active(
937 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_del_msgs
));
939 main_window_reflect_prefs_all();
942 static void prefs_summaries_destroy_widget(PrefsPage
*_page
)
946 SummariesPage
*prefs_summaries
;
948 void prefs_summaries_init(void)
951 static gchar
*path
[3];
953 path
[0] = _("Display");
954 path
[1] = _("Summaries");
957 page
= g_new0(SummariesPage
, 1);
958 page
->page
.path
= path
;
959 page
->page
.create_widget
= prefs_summaries_create_widget
;
960 page
->page
.destroy_widget
= prefs_summaries_destroy_widget
;
961 page
->page
.save_page
= prefs_summaries_save
;
962 page
->page
.weight
= 140.0;
963 prefs_gtk_register_page((PrefsPage
*) page
);
964 prefs_summaries
= page
;
967 void prefs_summaries_done(void)
969 prefs_gtk_unregister_page((PrefsPage
*) prefs_summaries
);
970 g_free(prefs_summaries
);
973 static void date_format_ok_btn_clicked(GtkButton
*button
, GtkWidget
**widget
)
975 GtkWidget
*datefmt_sample
= NULL
;
978 cm_return_if_fail(widget
!= NULL
);
979 cm_return_if_fail(*widget
!= NULL
);
980 cm_return_if_fail(prefs_summaries
->entry_datefmt
!= NULL
);
982 datefmt_sample
= GTK_WIDGET(g_object_get_data
983 (G_OBJECT(*widget
), "datefmt_sample"));
984 cm_return_if_fail(datefmt_sample
!= NULL
);
986 text
= gtk_editable_get_chars(GTK_EDITABLE(datefmt_sample
), 0, -1);
987 g_free(prefs_common
.date_format
);
988 prefs_common
.date_format
= text
;
989 gtk_entry_set_text(GTK_ENTRY(prefs_summaries
->entry_datefmt
), text
);
991 gtk_widget_destroy(*widget
);
995 static void date_format_cancel_btn_clicked(GtkButton
*button
,
998 cm_return_if_fail(widget
!= NULL
);
999 cm_return_if_fail(*widget
!= NULL
);
1001 gtk_widget_destroy(*widget
);
1005 static gboolean
date_format_key_pressed(GtkWidget
*keywidget
, GdkEventKey
*event
,
1008 if (event
&& event
->keyval
== GDK_KEY_Escape
)
1009 date_format_cancel_btn_clicked(NULL
, widget
);
1013 static gboolean
date_format_on_delete(GtkWidget
*dialogwidget
,
1014 GdkEventAny
*event
, GtkWidget
**widget
)
1016 cm_return_val_if_fail(widget
!= NULL
, FALSE
);
1017 cm_return_val_if_fail(*widget
!= NULL
, FALSE
);
1023 static void date_format_entry_on_change(GtkEditable
*editable
,
1027 struct tm
*cal_time
;
1032 cur_time
= time(NULL
);
1033 cal_time
= localtime_r(&cur_time
, <
);
1035 text
= gtk_editable_get_chars(editable
, 0, -1);
1037 fast_strftime(buffer
, sizeof buffer
, text
, cal_time
);
1039 gtk_label_set_text(example
, buffer
);
1044 static void date_format_select_row(GtkTreeView
*list_view
,
1046 GtkTreeViewColumn
*column
,
1047 GtkWidget
*date_format
)
1051 const gchar
*old_format
;
1053 GtkWidget
*datefmt_sample
;
1055 GtkTreeModel
*model
;
1057 cm_return_if_fail(date_format
!= NULL
);
1059 /* only on double click */
1060 datefmt_sample
= GTK_WIDGET(g_object_get_data(G_OBJECT(date_format
),
1063 cm_return_if_fail(datefmt_sample
!= NULL
);
1065 model
= gtk_tree_view_get_model(list_view
);
1067 /* get format from list */
1068 if (!gtk_tree_model_get_iter(model
, &iter
, path
))
1071 gtk_tree_model_get(model
, &iter
, DATEFMT_FMT
, &format
, -1);
1073 cur_pos
= gtk_editable_get_position(GTK_EDITABLE(datefmt_sample
));
1074 old_format
= gtk_entry_get_text(GTK_ENTRY(datefmt_sample
));
1076 /* insert the format into the text entry */
1077 new_format
= g_malloc(strlen(old_format
) + 3);
1079 strncpy(new_format
, old_format
, cur_pos
);
1080 new_format
[cur_pos
] = '\0';
1081 strcat(new_format
, format
);
1083 strcat(new_format
, &old_format
[cur_pos
]);
1085 gtk_entry_set_text(GTK_ENTRY(datefmt_sample
), new_format
);
1086 gtk_editable_set_position(GTK_EDITABLE(datefmt_sample
), cur_pos
+ 2);
1091 static void always_show_msg_toggled(GtkToggleButton
*button
,
1094 const SummariesPage
*prefs_summaries
= (SummariesPage
*)user_data
;
1097 cm_return_if_fail(prefs_summaries
!= NULL
);
1099 state
= gtk_toggle_button_get_active(button
);
1101 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_folder_open
, !state
);
1102 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_search_results
, !state
);
1103 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_prevnext
, !state
);
1104 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_deletemove
, !state
);
1105 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_directional
, !state
);
1108 static void mark_as_read_toggled(GtkToggleButton
*button
, GtkWidget
*spinbtn
)
1110 gtk_widget_set_sensitive(spinbtn
,
1111 gtk_toggle_button_get_active(button
));