2 * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2005-2018 Colin Leroy and The Claws Mail Team
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>
38 #include "prefs_common.h"
39 #include "prefs_gtk.h"
40 #include "prefs_summary_open.h"
41 #include "prefs_summary_column.h"
42 #include "prefs_folder_column.h"
45 #include "gtk/gtkutils.h"
46 #include "gtk/prefswindow.h"
47 #include "gtk/combobox.h"
49 #include "manage_window.h"
51 typedef struct _SummariesPage
57 GtkWidget
*optmenu_folder_unread
;
58 GtkWidget
*spinbtn_ng_abbrev_len
;
59 GtkWidget
*checkbtn_useaddrbook
;
60 GtkWidget
*checkbtn_show_tooltips
;
61 GtkWidget
*checkbtn_threadsubj
;
62 GtkWidget
*button_datefmt
;
63 GtkWidget
*entry_datefmt
;
65 GtkWidget
*checkbtn_reopen_last_folder
;
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_ask_override_colorlabel
;
77 GtkWidget
*optmenu_sort_key
;
78 GtkWidget
*optmenu_sort_type
;
79 GtkWidget
*optmenu_summaryfromshow
;
80 GtkWidget
*optmenu_nextunreadmsgdialog
;
81 GtkWidget
*checkbtn_folder_default_thread
;
82 GtkWidget
*checkbtn_folder_default_thread_collapsed
;
83 GtkWidget
*checkbtn_folder_default_hide_read_threads
;
84 GtkWidget
*checkbtn_folder_default_hide_read_msgs
;
85 GtkWidget
*checkbtn_folder_default_hide_del_msgs
;
86 GtkWidget
*checkbtn_summary_col_lock
;
96 static void date_format_ok_btn_clicked (GtkButton
*button
,
98 static void date_format_cancel_btn_clicked (GtkButton
*button
,
100 static gboolean
date_format_key_pressed (GtkWidget
*keywidget
,
103 static gboolean
date_format_on_delete (GtkWidget
*dialogwidget
,
106 static void date_format_entry_on_change (GtkEditable
*editable
,
108 static void date_format_select_row (GtkTreeView
*list_view
,
110 GtkTreeViewColumn
*column
,
111 GtkWidget
*date_format
);
112 static void mark_as_read_toggled (GtkToggleButton
*button
,
114 static void always_show_msg_toggled (GtkToggleButton
*button
,
117 static GtkWidget
*date_format_create(GtkButton
*button
, void *data
)
119 static GtkWidget
*datefmt_win
= NULL
;
122 GtkWidget
*scrolledwindow1
;
123 GtkWidget
*datefmt_list_view
;
128 GtkWidget
*confirm_area
;
130 GtkWidget
*cancel_btn
;
131 GtkWidget
*datefmt_entry
;
160 const gint TIME_FORMAT_ELEMS
=
161 sizeof time_format
/ sizeof time_format
[0];
163 GtkCellRenderer
*renderer
;
164 GtkTreeViewColumn
*column
;
165 GtkTreeSelection
*selection
;
167 time_format
[0].txt
= _("the abbreviated weekday name");
168 time_format
[1].txt
= _("the full weekday name");
169 time_format
[2].txt
= _("the abbreviated month name");
170 time_format
[3].txt
= _("the full month name");
171 time_format
[4].txt
= _("the preferred date and time for the current locale");
172 time_format
[5].txt
= _("the century number (year/100)");
173 time_format
[6].txt
= _("the day of the month as a decimal number");
174 time_format
[7].txt
= _("the hour as a decimal number using a 24-hour clock");
175 time_format
[8].txt
= _("the hour as a decimal number using a 12-hour clock");
176 time_format
[9].txt
= _("the day of the year as a decimal number");
177 time_format
[10].txt
= _("the month as a decimal number");
178 time_format
[11].txt
= _("the minute as a decimal number");
179 time_format
[12].txt
= _("either AM or PM");
180 time_format
[13].txt
= _("the second as a decimal number");
181 time_format
[14].txt
= _("the day of the week as a decimal number");
182 time_format
[15].txt
= _("the preferred date for the current locale");
183 time_format
[16].txt
= _("the last two digits of a year");
184 time_format
[17].txt
= _("the year as a decimal number");
185 time_format
[18].txt
= _("the time zone or name or abbreviation");
187 if (datefmt_win
) return datefmt_win
;
189 store
= gtk_list_store_new(N_DATEFMT_COLUMNS
,
194 for (i
= 0; i
< TIME_FORMAT_ELEMS
; i
++) {
197 gtk_list_store_append(store
, &iter
);
198 gtk_list_store_set(store
, &iter
,
199 DATEFMT_FMT
, time_format
[i
].fmt
,
200 DATEFMT_TXT
, time_format
[i
].txt
,
204 datefmt_win
= gtkut_window_new(GTK_WINDOW_TOPLEVEL
, "prefs_summaries");
205 gtk_container_set_border_width(GTK_CONTAINER(datefmt_win
), 8);
206 gtk_window_set_title(GTK_WINDOW(datefmt_win
), _("Date format"));
207 gtk_window_set_position(GTK_WINDOW(datefmt_win
), GTK_WIN_POS_CENTER
);
208 gtk_window_set_type_hint(GTK_WINDOW(datefmt_win
), GDK_WINDOW_TYPE_HINT_DIALOG
);
209 gtk_widget_set_size_request(datefmt_win
, 440, 280);
211 vbox1
= gtk_vbox_new(FALSE
, 10);
212 gtk_widget_show(vbox1
);
213 gtk_container_add(GTK_CONTAINER(datefmt_win
), vbox1
);
215 scrolledwindow1
= gtk_scrolled_window_new(NULL
, NULL
);
216 gtk_scrolled_window_set_policy
217 (GTK_SCROLLED_WINDOW(scrolledwindow1
),
218 GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
219 gtk_widget_show(scrolledwindow1
);
220 gtk_box_pack_start(GTK_BOX(vbox1
), scrolledwindow1
, TRUE
, TRUE
, 0);
222 datefmt_list_view
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
223 g_object_unref(G_OBJECT(store
));
224 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(datefmt_list_view
),
225 prefs_common
.use_stripes_everywhere
);
226 gtk_widget_show(datefmt_list_view
);
227 gtk_container_add(GTK_CONTAINER(scrolledwindow1
), datefmt_list_view
);
229 renderer
= gtk_cell_renderer_text_new();
230 column
= gtk_tree_view_column_new_with_attributes
231 (_("Specifier"), renderer
, "text", DATEFMT_FMT
,
233 gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view
), column
);
235 renderer
= gtk_cell_renderer_text_new();
236 column
= gtk_tree_view_column_new_with_attributes
237 (_("Description"), renderer
, "text", DATEFMT_TXT
,
239 gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view
), column
);
241 /* gtk_cmclist_set_column_width(GTK_CMCLIST(datefmt_clist), 0, 80); */
242 selection
= gtk_tree_view_get_selection(GTK_TREE_VIEW(datefmt_list_view
));
243 gtk_tree_selection_set_mode(selection
, GTK_SELECTION_BROWSE
);
245 g_signal_connect(G_OBJECT(datefmt_list_view
), "row_activated",
246 G_CALLBACK(date_format_select_row
),
249 table
= gtk_table_new(2, 2, FALSE
);
250 gtk_widget_show(table
);
251 gtk_box_pack_start(GTK_BOX(vbox1
), table
, FALSE
, FALSE
, 0);
252 gtk_table_set_row_spacings(GTK_TABLE(table
), 4);
253 gtk_table_set_col_spacings(GTK_TABLE(table
), 8);
255 label1
= gtk_label_new(_("Date format"));
256 gtk_widget_show(label1
);
257 gtk_table_attach(GTK_TABLE(table
), label1
, 0, 1, 0, 1,
259 gtk_label_set_justify(GTK_LABEL(label1
), GTK_JUSTIFY_LEFT
);
260 gtk_misc_set_alignment(GTK_MISC(label1
), 0, 0.5);
262 datefmt_entry
= gtk_entry_new();
263 gtk_entry_set_max_length(GTK_ENTRY(datefmt_entry
), 256);
264 gtk_widget_show(datefmt_entry
);
265 gtk_table_attach(GTK_TABLE(table
), datefmt_entry
, 1, 2, 0, 1,
266 (GTK_EXPAND
| GTK_FILL
), 0, 0, 0);
268 /* we need the "sample" entry box; add it as data so callbacks can
269 * get the entry box */
270 g_object_set_data(G_OBJECT(datefmt_win
), "datefmt_sample",
273 label2
= gtk_label_new(_("Example"));
274 gtk_widget_show(label2
);
275 gtk_table_attach(GTK_TABLE(table
), label2
, 0, 1, 1, 2,
277 gtk_label_set_justify(GTK_LABEL(label2
), GTK_JUSTIFY_LEFT
);
278 gtk_misc_set_alignment(GTK_MISC(label2
), 0, 0.5);
280 label3
= gtk_label_new("");
281 gtk_widget_show(label3
);
282 gtk_table_attach(GTK_TABLE(table
), label3
, 1, 2, 1, 2,
283 (GTK_EXPAND
| GTK_FILL
), 0, 0, 0);
284 gtk_label_set_justify(GTK_LABEL(label3
), GTK_JUSTIFY_LEFT
);
285 gtk_misc_set_alignment(GTK_MISC(label3
), 0, 0.5);
287 gtkut_stock_button_set_create(&confirm_area
, &cancel_btn
, GTK_STOCK_CANCEL
,
288 &ok_btn
, GTK_STOCK_OK
, NULL
, NULL
);
290 gtk_box_pack_start(GTK_BOX(vbox1
), confirm_area
, FALSE
, FALSE
, 0);
291 gtk_widget_show(confirm_area
);
292 gtk_widget_grab_default(ok_btn
);
294 /* set the current format */
295 gtk_entry_set_text(GTK_ENTRY(datefmt_entry
), prefs_common
.date_format
);
296 date_format_entry_on_change(GTK_EDITABLE(datefmt_entry
),
299 g_signal_connect(G_OBJECT(ok_btn
), "clicked",
300 G_CALLBACK(date_format_ok_btn_clicked
),
302 g_signal_connect(G_OBJECT(cancel_btn
), "clicked",
303 G_CALLBACK(date_format_cancel_btn_clicked
),
305 g_signal_connect(G_OBJECT(datefmt_win
), "key_press_event",
306 G_CALLBACK(date_format_key_pressed
),
308 g_signal_connect(G_OBJECT(datefmt_win
), "delete_event",
309 G_CALLBACK(date_format_on_delete
),
311 g_signal_connect(G_OBJECT(datefmt_entry
), "changed",
312 G_CALLBACK(date_format_entry_on_change
),
315 gtk_widget_show(datefmt_win
);
316 manage_window_set_transient(GTK_WINDOW(datefmt_win
));
317 gtk_window_set_modal(GTK_WINDOW(datefmt_win
), TRUE
);
319 gtk_widget_grab_focus(ok_btn
);
324 static void prefs_summaries_create_widget(PrefsPage
*_page
, GtkWindow
*window
,
327 SummariesPage
*prefs_summaries
= (SummariesPage
*) _page
;
330 GtkWidget
*hbox0
, *hbox1
, *hbox2
;
331 GtkWidget
*vbox1
, *vbox2
, *vbox3
, *vbox4
;
332 GtkWidget
*frame_new_folders
;
333 GtkWidget
*optmenu_folder_unread
;
334 GtkWidget
*label_ng_abbrev
;
335 GtkWidget
*spinbtn_ng_abbrev_len
;
336 GtkAdjustment
*spinbtn_ng_abbrev_len_adj
;
337 GtkWidget
*checkbtn_useaddrbook
;
338 GtkWidget
*checkbtn_show_tooltips
;
339 GtkWidget
*checkbtn_threadsubj
;
340 GtkWidget
*label_datefmt
;
341 GtkWidget
*button_datefmt
;
342 GtkWidget
*entry_datefmt
;
343 GtkWidget
*button_dispitem
;
344 GtkWidget
*checkbtn_reopen_last_folder
;
345 GtkWidget
*checkbtn_always_show_msg
;
346 GtkWidget
*checkbtn_show_on_folder_open
;
347 GtkWidget
*checkbtn_show_on_search_results
;
348 GtkWidget
*checkbtn_show_on_prevnext
;
349 GtkWidget
*checkbtn_show_on_deletemove
;
350 GtkWidget
*checkbtn_show_on_directional
;
351 GtkWidget
*spinbtn_mark_as_read_delay
;
352 GtkAdjustment
*spinbtn_mark_as_read_delay_adj
;
353 GtkWidget
*checkbtn_immedexec
;
354 GtkWidget
*checkbtn_ask_mark_all_read
;
355 GtkWidget
*checkbtn_ask_override_colorlabel
;
356 GtkWidget
*label
, *label_fill
;
359 GtkWidget
*optmenu_summaryfromshow
;
360 GtkWidget
*optmenu_nextunreadmsgdialog
;
361 GtkWidget
*button_edit_actions
;
362 GtkWidget
*radio_mark_as_read_on_select
;
363 GtkWidget
*radio_mark_as_read_on_new_win
;
364 GtkWidget
*optmenu_sort_key
;
365 GtkWidget
*optmenu_sort_type
;
366 GtkWidget
*checkbtn_folder_default_thread
;
367 GtkWidget
*checkbtn_folder_default_thread_collapsed
;
368 GtkWidget
*checkbtn_folder_default_hide_read_threads
;
369 GtkWidget
*checkbtn_folder_default_hide_read_msgs
;
370 GtkWidget
*checkbtn_folder_default_hide_del_msgs
;
371 GtkWidget
*checkbtn_summary_col_lock
;
373 notebook
= gtk_notebook_new();
374 gtk_widget_show(notebook
);
376 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
377 gtk_widget_show (vbox1
);
378 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
379 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
380 gtk_label_new(_("Folder list")));
382 hbox0
= gtk_hbox_new (FALSE
, 8);
383 gtk_widget_show (hbox0
);
384 gtk_box_pack_start(GTK_BOX(vbox1
), hbox0
, FALSE
, TRUE
, 0);
386 label
= gtk_label_new(_("Displayed columns"));
387 gtk_widget_show(label
);
388 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
389 button_dispitem
= gtk_button_new_from_stock(GTK_STOCK_EDIT
);
390 gtk_widget_show (button_dispitem
);
391 gtk_box_pack_start (GTK_BOX (hbox0
), button_dispitem
, FALSE
, FALSE
, 0);
392 g_signal_connect (G_OBJECT (button_dispitem
), "clicked",
393 G_CALLBACK (prefs_folder_column_open
),
396 hbox0
= gtk_hbox_new (FALSE
, 8);
397 gtk_widget_show (hbox0
);
398 gtk_box_pack_start(GTK_BOX (vbox1
), hbox0
, FALSE
, FALSE
, 0);
400 label
= gtk_label_new (_("Display message count next to folder name"));
401 gtk_widget_show (label
);
402 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
404 optmenu_folder_unread
= gtkut_sc_combobox_create(NULL
, FALSE
);
405 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
406 GTK_COMBO_BOX(optmenu_folder_unread
)));
407 gtk_widget_show (optmenu_folder_unread
);
409 COMBOBOX_ADD (menu
, _("No"), 0);
410 COMBOBOX_ADD (menu
, _("Unread messages"), 1);
411 COMBOBOX_ADD (menu
, _("Unread and Total messages"), 2);
413 gtk_box_pack_start(GTK_BOX(hbox0
), optmenu_folder_unread
, FALSE
, FALSE
, 0);
416 (vbox1
, checkbtn_reopen_last_folder
,
417 _("Open last opened folder at start-up"));
419 hbox1
= gtk_hbox_new (FALSE
, 8);
420 gtk_widget_show (hbox1
);
421 gtk_box_pack_start(GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
423 label_ng_abbrev
= gtk_label_new
424 (_("Abbreviate newsgroup names longer than"));
425 gtk_widget_show (label_ng_abbrev
);
426 gtk_box_pack_start (GTK_BOX (hbox1
), label_ng_abbrev
, FALSE
, FALSE
, 0);
428 spinbtn_ng_abbrev_len_adj
= GTK_ADJUSTMENT(gtk_adjustment_new (16, 0, 999, 1, 10, 0));
429 spinbtn_ng_abbrev_len
= gtk_spin_button_new
430 (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj
), 1, 0);
431 gtk_widget_show (spinbtn_ng_abbrev_len
);
432 gtk_box_pack_start (GTK_BOX (hbox1
), spinbtn_ng_abbrev_len
,
434 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len
),
437 label_ng_abbrev
= gtk_label_new (_("letters"));
438 gtk_widget_show (label_ng_abbrev
);
439 gtk_box_pack_start (GTK_BOX (hbox1
), label_ng_abbrev
, FALSE
, FALSE
, 0);
441 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
442 gtk_widget_show (vbox1
);
443 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
444 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
445 gtk_label_new(_("Message list")));
447 hbox0
= gtk_hbox_new (FALSE
, 8);
448 gtk_widget_show (hbox0
);
449 gtk_box_pack_start(GTK_BOX(vbox1
), hbox0
, FALSE
, TRUE
, 0);
451 label
= gtk_label_new(_("Displayed columns"));
452 gtk_widget_show(label
);
453 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
454 button_dispitem
= gtk_button_new_from_stock(GTK_STOCK_EDIT
);
455 gtk_widget_show (button_dispitem
);
456 gtk_box_pack_start (GTK_BOX (hbox0
), button_dispitem
, FALSE
, FALSE
, 0);
457 g_signal_connect (G_OBJECT (button_dispitem
), "clicked",
458 G_CALLBACK (prefs_summary_column_open
),
461 PACK_SPACER(hbox0
, hbox1
, 4);
462 PACK_CHECK_BUTTON(hbox0
, checkbtn_summary_col_lock
, _("Lock column headers"));
464 hbox1
= gtk_hbox_new (FALSE
, 10);
465 gtk_widget_show (hbox1
);
466 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
468 label
= gtk_label_new (_("Displayed in From column"));
469 gtk_widget_show (label
);
470 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
472 optmenu_summaryfromshow
= gtkut_sc_combobox_create(NULL
, FALSE
);
473 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
474 GTK_COMBO_BOX(optmenu_summaryfromshow
)));
475 gtk_widget_show (optmenu_summaryfromshow
);
477 COMBOBOX_ADD (menu
, _("Name"), SHOW_NAME
);
478 COMBOBOX_ADD (menu
, _("Address"), SHOW_ADDR
);
479 COMBOBOX_ADD (menu
, _("Name and Address"), SHOW_BOTH
);
481 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_summaryfromshow
, FALSE
, FALSE
, 0);
482 hbox2
= gtk_hbox_new (FALSE
, 8);
483 gtk_widget_show (hbox2
);
484 gtk_box_pack_start (GTK_BOX (vbox1
), hbox2
, FALSE
, TRUE
, 0);
486 label_datefmt
= gtk_label_new (_("Date format"));
487 gtk_widget_show (label_datefmt
);
488 gtk_box_pack_start (GTK_BOX (hbox2
), label_datefmt
, FALSE
, FALSE
, 0);
490 entry_datefmt
= gtk_entry_new ();
491 gtk_widget_show (entry_datefmt
);
492 gtk_box_pack_start (GTK_BOX (hbox2
), entry_datefmt
, FALSE
, FALSE
, 0);
494 button_datefmt
= gtk_button_new_from_stock(GTK_STOCK_INFO
);
496 gtk_widget_show (button_datefmt
);
497 gtk_box_pack_start (GTK_BOX (hbox2
), button_datefmt
, FALSE
, FALSE
, 0);
498 g_signal_connect (G_OBJECT (button_datefmt
), "clicked",
499 G_CALLBACK (date_format_create
), NULL
);
501 label_fill
= gtk_label_new(" ");
502 gtk_box_pack_start(GTK_BOX(hbox2
), label_fill
, TRUE
, FALSE
, 0);
504 CLAWS_SET_TIP(button_datefmt
,
505 _("Date format help"));
507 hbox1
= gtk_hbox_new (FALSE
, 10);
508 gtk_widget_show (hbox1
);
509 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, TRUE
, 0);
511 button_edit_actions
= gtk_button_new_with_label(_("Set message selection when entering a folder"));
512 gtk_widget_show (button_edit_actions
);
513 gtk_box_pack_start (GTK_BOX (hbox1
), button_edit_actions
,
515 g_signal_connect (G_OBJECT (button_edit_actions
), "clicked",
516 G_CALLBACK (prefs_summary_open_open
),
519 /* Open message on select policy */
520 vbox4
= gtkut_get_options_frame(vbox1
, NULL
, _("Open message when selected"));
522 PACK_CHECK_BUTTON(vbox4
, checkbtn_always_show_msg
,
524 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_folder_open
,
525 _("When opening a folder"));
526 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_search_results
,
527 _("When displaying search results"));
528 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_prevnext
,
529 _("When selecting next or previous message using shortcuts"));
530 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_deletemove
,
531 _("When deleting or moving messages"));
532 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_directional
,
533 _("When using directional keys"));
535 vbox3
= gtkut_get_options_frame(vbox1
, NULL
, _("Mark message as read"));
537 radio_mark_as_read_on_select
= gtk_radio_button_new_with_label(NULL
,
538 _("when selected, after"));
540 hbox1
= gtk_hbox_new (FALSE
, 8);
541 gtk_box_pack_start (GTK_BOX (hbox1
), radio_mark_as_read_on_select
, FALSE
, FALSE
, 0);
543 spinbtn_mark_as_read_delay_adj
= GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 60, 1, 10, 0));
544 spinbtn_mark_as_read_delay
= gtk_spin_button_new
545 (GTK_ADJUSTMENT (spinbtn_mark_as_read_delay_adj
), 1, 0);
546 gtk_box_pack_start (GTK_BOX (hbox1
), spinbtn_mark_as_read_delay
,
548 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_mark_as_read_delay
),
550 gtk_box_pack_start (GTK_BOX (hbox1
), gtk_label_new
551 (_("seconds")), FALSE
, FALSE
, 0);
553 gtk_box_pack_start (GTK_BOX (vbox3
), hbox1
, FALSE
, FALSE
, 0);
555 radio_mark_as_read_on_new_win
= gtk_radio_button_new_with_label_from_widget(
556 GTK_RADIO_BUTTON(radio_mark_as_read_on_select
),
557 _("only when opened in a new window, or replied to"));
558 gtk_box_pack_start (GTK_BOX (vbox3
), radio_mark_as_read_on_new_win
,
560 gtk_widget_show_all(vbox3
);
562 /* Next Unread Message Dialog */
563 hbox1
= gtk_hbox_new (FALSE
, 10);
564 gtk_widget_show (hbox1
);
565 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
567 label
= gtk_label_new (_("Show \"no unread (or new) message\" dialog"));
568 gtk_widget_show (label
);
569 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
571 optmenu_nextunreadmsgdialog
= gtkut_sc_combobox_create(NULL
, FALSE
);
572 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
573 GTK_COMBO_BOX(optmenu_nextunreadmsgdialog
)));
574 gtk_widget_show (optmenu_nextunreadmsgdialog
);
576 COMBOBOX_ADD (menu
, _("Always"), NEXTUNREADMSGDIALOG_ALWAYS
);
577 COMBOBOX_ADD (menu
, _("Assume 'Yes'"), NEXTUNREADMSGDIALOG_ASSUME_YES
);
578 COMBOBOX_ADD (menu
, _("Assume 'No'"), NEXTUNREADMSGDIALOG_ASSUME_NO
);
580 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_nextunreadmsgdialog
, FALSE
, FALSE
, 0);
583 (vbox1
, checkbtn_useaddrbook
,
584 _("Display sender using address book"));
587 (vbox1
, checkbtn_threadsubj
,
588 _("Thread using subject in addition to standard headers"));
591 (vbox1
, checkbtn_immedexec
,
592 _("Execute immediately when moving or deleting messages"));
593 CLAWS_SET_TIP(checkbtn_immedexec
,
594 _("When unchecked moving, copying and deleting of messages"
595 " is deferred until you use 'Tools/Execute'"));
598 (vbox1
, checkbtn_ask_mark_all_read
,
599 _("Confirm when marking all messages as read or unread"));
601 (vbox1
, checkbtn_ask_override_colorlabel
,
602 _("Confirm when changing color labels"));
605 (vbox1
, checkbtn_show_tooltips
,
608 hbox2
= gtk_hbox_new (FALSE
, 8);
609 gtk_widget_show (hbox2
);
610 gtk_box_pack_start (GTK_BOX (vbox1
), hbox2
, FALSE
, FALSE
, 0);
612 vbox1
= gtk_vbox_new (FALSE
, VSPACING
);
613 gtk_widget_show (vbox1
);
614 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
615 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
616 gtk_label_new(_("Defaults")));
618 vbox2
= gtkut_get_options_frame(vbox1
, &frame_new_folders
, _("New folders"));
620 hbox1
= gtk_hbox_new(FALSE
, 10);
621 gtk_widget_show(hbox1
);
622 gtk_box_pack_start(GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
624 label
= gtk_label_new(_("Sort by"));
625 gtk_widget_show(label
);
626 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
628 optmenu_sort_key
= gtkut_sc_combobox_create(NULL
, FALSE
);
629 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_key
)));
630 gtk_widget_show(optmenu_sort_key
);
632 COMBOBOX_ADD(menu
, _("Number"), SORT_BY_NUMBER
);
633 COMBOBOX_ADD(menu
, _("Size"), SORT_BY_SIZE
);
634 COMBOBOX_ADD(menu
, _("Date"), SORT_BY_DATE
);
635 COMBOBOX_ADD(menu
, _("Thread date"), SORT_BY_THREAD_DATE
);
636 COMBOBOX_ADD(menu
, _("From"), SORT_BY_FROM
);
637 COMBOBOX_ADD(menu
, _("To"), SORT_BY_TO
);
638 COMBOBOX_ADD(menu
, _("Subject"), SORT_BY_SUBJECT
);
639 COMBOBOX_ADD(menu
, _("Color label"), SORT_BY_LABEL
);
640 COMBOBOX_ADD(menu
, _("Tag"), SORT_BY_TAGS
);
641 COMBOBOX_ADD(menu
, _("Mark"), SORT_BY_MARK
);
642 COMBOBOX_ADD(menu
, _("Status"), SORT_BY_STATUS
);
643 COMBOBOX_ADD(menu
, _("Attachment"), SORT_BY_MIME
);
644 COMBOBOX_ADD(menu
, _("Score"), SORT_BY_SCORE
);
645 COMBOBOX_ADD(menu
, _("Locked"), SORT_BY_LOCKED
);
646 COMBOBOX_ADD(menu
, _("Don't sort"), SORT_BY_NONE
);
648 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_sort_key
, FALSE
, FALSE
, 0);
650 optmenu_sort_type
= gtkut_sc_combobox_create(NULL
, FALSE
);
651 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_type
)));
652 gtk_widget_show(optmenu_sort_type
);
654 COMBOBOX_ADD(menu
, _("Ascending"), SORT_ASCENDING
);
655 COMBOBOX_ADD(menu
, _("Descending"), SORT_DESCENDING
);
657 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_sort_type
, FALSE
, FALSE
, 0);
660 (vbox2
, checkbtn_folder_default_thread
,
663 (vbox2
, checkbtn_folder_default_thread_collapsed
,
664 _("Collapse all threads"));
666 (vbox2
, checkbtn_folder_default_hide_read_threads
,
667 _("Hide read threads"));
669 (vbox2
, checkbtn_folder_default_hide_read_msgs
,
670 _("Hide read messages"));
672 (vbox2
, checkbtn_folder_default_hide_del_msgs
,
673 _("Hide deleted messages"));
675 prefs_summaries
->optmenu_folder_unread
= optmenu_folder_unread
;
676 prefs_summaries
->spinbtn_ng_abbrev_len
= spinbtn_ng_abbrev_len
;
677 prefs_summaries
->checkbtn_useaddrbook
= checkbtn_useaddrbook
;
678 prefs_summaries
->checkbtn_show_tooltips
= checkbtn_show_tooltips
;
679 prefs_summaries
->checkbtn_threadsubj
= checkbtn_threadsubj
;
680 prefs_summaries
->entry_datefmt
= entry_datefmt
;
681 prefs_summaries
->checkbtn_reopen_last_folder
= checkbtn_reopen_last_folder
;
683 prefs_summaries
->checkbtn_always_show_msg
= checkbtn_always_show_msg
;
684 prefs_summaries
->checkbtn_show_on_folder_open
= checkbtn_show_on_folder_open
;
685 prefs_summaries
->checkbtn_show_on_search_results
= checkbtn_show_on_search_results
;
686 prefs_summaries
->checkbtn_show_on_prevnext
= checkbtn_show_on_prevnext
;
687 prefs_summaries
->checkbtn_show_on_deletemove
= checkbtn_show_on_deletemove
;
688 prefs_summaries
->checkbtn_show_on_directional
= checkbtn_show_on_directional
;
690 prefs_summaries
->checkbtn_mark_as_read_on_newwin
= radio_mark_as_read_on_new_win
;
691 prefs_summaries
->spinbtn_mark_as_read_delay
= spinbtn_mark_as_read_delay
;
692 prefs_summaries
->checkbtn_immedexec
= checkbtn_immedexec
;
693 prefs_summaries
->checkbtn_ask_mark_all_read
= checkbtn_ask_mark_all_read
;
694 prefs_summaries
->checkbtn_ask_override_colorlabel
= checkbtn_ask_override_colorlabel
;
695 prefs_summaries
->optmenu_sort_key
= optmenu_sort_key
;
696 prefs_summaries
->optmenu_sort_type
= optmenu_sort_type
;
697 prefs_summaries
->optmenu_nextunreadmsgdialog
= optmenu_nextunreadmsgdialog
;
698 prefs_summaries
->optmenu_summaryfromshow
= optmenu_summaryfromshow
;
700 prefs_summaries
->checkbtn_folder_default_thread
= checkbtn_folder_default_thread
;
701 prefs_summaries
->checkbtn_folder_default_thread_collapsed
= checkbtn_folder_default_thread_collapsed
;
702 prefs_summaries
->checkbtn_folder_default_hide_read_threads
= checkbtn_folder_default_hide_read_threads
;
703 prefs_summaries
->checkbtn_folder_default_hide_read_msgs
= checkbtn_folder_default_hide_read_msgs
;
704 prefs_summaries
->checkbtn_folder_default_hide_del_msgs
= checkbtn_folder_default_hide_del_msgs
;
705 prefs_summaries
->checkbtn_summary_col_lock
= checkbtn_summary_col_lock
;
707 prefs_summaries
->page
.widget
= vbox1
;
708 g_signal_connect(G_OBJECT(checkbtn_always_show_msg
), "toggled",
709 G_CALLBACK(always_show_msg_toggled
), prefs_summaries
);
711 g_signal_connect(G_OBJECT(radio_mark_as_read_on_select
), "toggled",
712 G_CALLBACK(mark_as_read_toggled
),
713 spinbtn_mark_as_read_delay
);
715 prefs_summaries
->window
= GTK_WIDGET(window
);
717 combobox_select_by_data(GTK_COMBO_BOX(optmenu_folder_unread
),
718 prefs_common
.display_folder_unread
);
719 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_useaddrbook
),
720 prefs_common
.use_addr_book
);
721 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_tooltips
),
722 prefs_common
.show_tooltips
);
723 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_threadsubj
),
724 prefs_common
.thread_by_subject
);
725 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_ng_abbrev_len
),
726 prefs_common
.ng_abbrev_len
);
727 gtk_entry_set_text(GTK_ENTRY(entry_datefmt
),
728 prefs_common
.date_format
?prefs_common
.date_format
:"");
729 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_reopen_last_folder
),
730 prefs_common
.goto_last_folder_on_startup
);
732 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_always_show_msg
),
733 prefs_common
.always_show_msg
);
734 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_folder_open
),
735 prefs_common
.open_selected_on_folder_open
);
736 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_search_results
),
737 prefs_common
.open_selected_on_search_results
);
738 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_prevnext
),
739 prefs_common
.open_selected_on_prevnext
);
740 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_deletemove
),
741 prefs_common
.open_selected_on_deletemove
);
742 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_directional
),
743 prefs_common
.open_selected_on_directional
);
745 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_mark_as_read_on_new_win
),
746 prefs_common
.mark_as_read_on_new_window
);
747 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_mark_as_read_delay
),
748 prefs_common
.mark_as_read_delay
);
749 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_immedexec
),
750 prefs_common
.immediate_exec
);
751 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_mark_all_read
),
752 prefs_common
.ask_mark_all_read
);
753 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_override_colorlabel
),
754 prefs_common
.ask_override_colorlabel
);
756 combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_key
),
757 prefs_common
.default_sort_key
);
758 combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_type
),
759 prefs_common
.default_sort_type
);
761 combobox_select_by_data(GTK_COMBO_BOX(optmenu_summaryfromshow
),
762 prefs_common
.summary_from_show
);
764 combobox_select_by_data(GTK_COMBO_BOX(optmenu_nextunreadmsgdialog
),
765 prefs_common
.next_unread_msg_dialog
);
767 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_thread
),
768 prefs_common
.folder_default_thread
);
769 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_thread_collapsed
),
770 prefs_common
.folder_default_thread_collapsed
);
771 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_read_threads
),
772 prefs_common
.folder_default_hide_read_threads
);
773 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_read_msgs
),
774 prefs_common
.folder_default_hide_read_msgs
);
775 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_del_msgs
),
776 prefs_common
.folder_default_hide_del_msgs
);
777 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_summary_col_lock
),
778 prefs_common
.summary_col_lock
);
780 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook
), 0);
782 prefs_summaries
->page
.widget
= notebook
;
785 static void prefs_summaries_save(PrefsPage
*_page
)
787 SummariesPage
*page
= (SummariesPage
*) _page
;
789 prefs_common
.display_folder_unread
= combobox_get_active_data(
790 GTK_COMBO_BOX(page
->optmenu_folder_unread
));
792 prefs_common
.use_addr_book
= gtk_toggle_button_get_active(
793 GTK_TOGGLE_BUTTON(page
->checkbtn_useaddrbook
));
794 prefs_common
.show_tooltips
= gtk_toggle_button_get_active(
795 GTK_TOGGLE_BUTTON(page
->checkbtn_show_tooltips
));
796 prefs_common
.thread_by_subject
= gtk_toggle_button_get_active(
797 GTK_TOGGLE_BUTTON(page
->checkbtn_threadsubj
));
798 prefs_common
.ng_abbrev_len
= gtk_spin_button_get_value_as_int(
799 GTK_SPIN_BUTTON(page
->spinbtn_ng_abbrev_len
));
801 g_free(prefs_common
.date_format
);
802 prefs_common
.date_format
= gtk_editable_get_chars(
803 GTK_EDITABLE(page
->entry_datefmt
), 0, -1);
805 prefs_common
.goto_last_folder_on_startup
= gtk_toggle_button_get_active(
806 GTK_TOGGLE_BUTTON(page
->checkbtn_reopen_last_folder
));
808 prefs_common
.always_show_msg
= gtk_toggle_button_get_active(
809 GTK_TOGGLE_BUTTON(page
->checkbtn_always_show_msg
));
810 prefs_common
.open_selected_on_folder_open
= gtk_toggle_button_get_active(
811 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_folder_open
));
812 prefs_common
.open_selected_on_search_results
= gtk_toggle_button_get_active(
813 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_search_results
));
814 prefs_common
.open_selected_on_prevnext
= gtk_toggle_button_get_active(
815 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_prevnext
));
816 prefs_common
.open_selected_on_deletemove
= gtk_toggle_button_get_active(
817 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_deletemove
));
818 prefs_common
.open_selected_on_directional
= gtk_toggle_button_get_active(
819 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_directional
));
821 prefs_common
.mark_as_read_on_new_window
= gtk_toggle_button_get_active(
822 GTK_TOGGLE_BUTTON(page
->checkbtn_mark_as_read_on_newwin
));
823 prefs_common
.immediate_exec
= gtk_toggle_button_get_active(
824 GTK_TOGGLE_BUTTON(page
->checkbtn_immedexec
));
825 prefs_common
.ask_mark_all_read
= gtk_toggle_button_get_active(
826 GTK_TOGGLE_BUTTON(page
->checkbtn_ask_mark_all_read
));
827 prefs_common
.ask_override_colorlabel
= gtk_toggle_button_get_active(
828 GTK_TOGGLE_BUTTON(page
->checkbtn_ask_override_colorlabel
));
829 prefs_common
.mark_as_read_delay
= gtk_spin_button_get_value_as_int(
830 GTK_SPIN_BUTTON(page
->spinbtn_mark_as_read_delay
));
831 prefs_common
.summary_col_lock
= gtk_toggle_button_get_active(
832 GTK_TOGGLE_BUTTON(page
->checkbtn_summary_col_lock
));
834 prefs_common
.default_sort_key
= combobox_get_active_data(
835 GTK_COMBO_BOX(page
->optmenu_sort_key
));
836 prefs_common
.default_sort_type
= combobox_get_active_data(
837 GTK_COMBO_BOX(page
->optmenu_sort_type
));
838 prefs_common
.summary_from_show
= combobox_get_active_data(
839 GTK_COMBO_BOX(page
->optmenu_summaryfromshow
));
840 prefs_common
.next_unread_msg_dialog
= combobox_get_active_data(
841 GTK_COMBO_BOX(page
->optmenu_nextunreadmsgdialog
));
842 prefs_common
.folder_default_thread
= gtk_toggle_button_get_active(
843 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_thread
));
844 prefs_common
.folder_default_thread_collapsed
= gtk_toggle_button_get_active(
845 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_thread_collapsed
));
846 prefs_common
.folder_default_hide_read_threads
= gtk_toggle_button_get_active(
847 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_read_threads
));
848 prefs_common
.folder_default_hide_read_msgs
= gtk_toggle_button_get_active(
849 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_read_msgs
));
850 prefs_common
.folder_default_hide_del_msgs
= gtk_toggle_button_get_active(
851 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_del_msgs
));
852 prefs_common
.folder_default_hide_del_msgs
= gtk_toggle_button_get_active(
853 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_del_msgs
));
855 main_window_reflect_prefs_all();
858 static void prefs_summaries_destroy_widget(PrefsPage
*_page
)
862 SummariesPage
*prefs_summaries
;
864 void prefs_summaries_init(void)
867 static gchar
*path
[3];
869 path
[0] = _("Display");
870 path
[1] = _("Summaries");
873 page
= g_new0(SummariesPage
, 1);
874 page
->page
.path
= path
;
875 page
->page
.create_widget
= prefs_summaries_create_widget
;
876 page
->page
.destroy_widget
= prefs_summaries_destroy_widget
;
877 page
->page
.save_page
= prefs_summaries_save
;
878 page
->page
.weight
= 140.0;
879 prefs_gtk_register_page((PrefsPage
*) page
);
880 prefs_summaries
= page
;
883 void prefs_summaries_done(void)
885 prefs_gtk_unregister_page((PrefsPage
*) prefs_summaries
);
886 g_free(prefs_summaries
);
889 static void date_format_ok_btn_clicked(GtkButton
*button
, GtkWidget
**widget
)
891 GtkWidget
*datefmt_sample
= NULL
;
894 cm_return_if_fail(widget
!= NULL
);
895 cm_return_if_fail(*widget
!= NULL
);
896 cm_return_if_fail(prefs_summaries
->entry_datefmt
!= NULL
);
898 datefmt_sample
= GTK_WIDGET(g_object_get_data
899 (G_OBJECT(*widget
), "datefmt_sample"));
900 cm_return_if_fail(datefmt_sample
!= NULL
);
902 text
= gtk_editable_get_chars(GTK_EDITABLE(datefmt_sample
), 0, -1);
903 g_free(prefs_common
.date_format
);
904 prefs_common
.date_format
= text
;
905 gtk_entry_set_text(GTK_ENTRY(prefs_summaries
->entry_datefmt
), text
);
907 gtk_widget_destroy(*widget
);
911 static void date_format_cancel_btn_clicked(GtkButton
*button
,
914 cm_return_if_fail(widget
!= NULL
);
915 cm_return_if_fail(*widget
!= NULL
);
917 gtk_widget_destroy(*widget
);
921 static gboolean
date_format_key_pressed(GtkWidget
*keywidget
, GdkEventKey
*event
,
924 if (event
&& event
->keyval
== GDK_KEY_Escape
)
925 date_format_cancel_btn_clicked(NULL
, widget
);
929 static gboolean
date_format_on_delete(GtkWidget
*dialogwidget
,
930 GdkEventAny
*event
, GtkWidget
**widget
)
932 cm_return_val_if_fail(widget
!= NULL
, FALSE
);
933 cm_return_val_if_fail(*widget
!= NULL
, FALSE
);
939 static void date_format_entry_on_change(GtkEditable
*editable
,
948 cur_time
= time(NULL
);
949 cal_time
= localtime_r(&cur_time
, <
);
951 text
= gtk_editable_get_chars(editable
, 0, -1);
953 fast_strftime(buffer
, sizeof buffer
, text
, cal_time
);
955 gtk_label_set_text(example
, buffer
);
960 static void date_format_select_row(GtkTreeView
*list_view
,
962 GtkTreeViewColumn
*column
,
963 GtkWidget
*date_format
)
967 const gchar
*old_format
;
969 GtkWidget
*datefmt_sample
;
973 cm_return_if_fail(date_format
!= NULL
);
975 /* only on double click */
976 datefmt_sample
= GTK_WIDGET(g_object_get_data(G_OBJECT(date_format
),
979 cm_return_if_fail(datefmt_sample
!= NULL
);
981 model
= gtk_tree_view_get_model(list_view
);
983 /* get format from list */
984 if (!gtk_tree_model_get_iter(model
, &iter
, path
))
987 gtk_tree_model_get(model
, &iter
, DATEFMT_FMT
, &format
, -1);
989 cur_pos
= gtk_editable_get_position(GTK_EDITABLE(datefmt_sample
));
990 old_format
= gtk_entry_get_text(GTK_ENTRY(datefmt_sample
));
992 /* insert the format into the text entry */
993 new_format
= g_malloc(strlen(old_format
) + 3);
995 strncpy(new_format
, old_format
, cur_pos
);
996 new_format
[cur_pos
] = '\0';
997 strcat(new_format
, format
);
999 strcat(new_format
, &old_format
[cur_pos
]);
1001 gtk_entry_set_text(GTK_ENTRY(datefmt_sample
), new_format
);
1002 gtk_editable_set_position(GTK_EDITABLE(datefmt_sample
), cur_pos
+ 2);
1007 static void always_show_msg_toggled(GtkToggleButton
*button
,
1010 const SummariesPage
*prefs_summaries
= (SummariesPage
*)user_data
;
1013 cm_return_if_fail(prefs_summaries
!= NULL
);
1015 state
= gtk_toggle_button_get_active(button
);
1017 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_folder_open
, !state
);
1018 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_search_results
, !state
);
1019 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_prevnext
, !state
);
1020 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_deletemove
, !state
);
1021 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_directional
, !state
);
1024 static void mark_as_read_toggled(GtkToggleButton
*button
, GtkWidget
*spinbtn
)
1026 gtk_widget_set_sensitive(spinbtn
,
1027 gtk_toggle_button_get_active(button
));