2 * Claws Mail -- a GTK based, lightweight, and fast e-mail client
3 * Copyright (C) 2005-2022 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>
34 #include "prefs_common.h"
35 #include "prefs_gtk.h"
36 #include "prefs_summary_open.h"
37 #include "prefs_summary_column.h"
38 #include "prefs_folder_column.h"
41 #include "gtk/gtkutils.h"
42 #include "gtk/prefswindow.h"
43 #include "gtk/combobox.h"
45 #include "manage_window.h"
47 typedef struct _SummariesPage
53 GtkWidget
*optmenu_folder_unread
;
54 GtkWidget
*spinbtn_ng_abbrev_len
;
55 GtkWidget
*checkbtn_useaddrbook
;
56 GtkWidget
*checkbtn_show_tooltips
;
57 GtkWidget
*checkbtn_threadsubj
;
58 GtkWidget
*button_datefmt
;
59 GtkWidget
*entry_datefmt
;
61 GtkWidget
*checkbtn_reopen_last_folder
;
62 GtkWidget
*checkbtn_always_show_msg
;
63 GtkWidget
*checkbtn_show_on_folder_open
;
64 GtkWidget
*checkbtn_show_on_search_results
;
65 GtkWidget
*checkbtn_show_on_prevnext
;
66 GtkWidget
*checkbtn_show_on_deletemove
;
67 GtkWidget
*checkbtn_show_on_directional
;
68 GtkWidget
*checkbtn_mark_as_read_on_newwin
;
69 GtkWidget
*spinbtn_mark_as_read_delay
;
70 GtkWidget
*checkbtn_immedexec
;
71 GtkWidget
*checkbtn_ask_mark_all_read
;
72 GtkWidget
*checkbtn_run_processingrules_mark_all_read
;
73 GtkWidget
*checkbtn_ask_override_colorlabel
;
74 GtkWidget
*optmenu_sort_key
;
75 GtkWidget
*optmenu_sort_type
;
76 GtkWidget
*optmenu_summaryfromshow
;
77 GtkWidget
*optmenu_nextunreadmsgdialog
;
78 GtkWidget
*checkbtn_folder_default_thread
;
79 GtkWidget
*checkbtn_folder_default_thread_collapsed
;
80 GtkWidget
*checkbtn_folder_default_hide_read_threads
;
81 GtkWidget
*checkbtn_folder_default_hide_read_msgs
;
82 GtkWidget
*checkbtn_folder_default_hide_del_msgs
;
83 GtkWidget
*checkbtn_summary_col_lock
;
93 static void date_format_ok_btn_clicked (GtkButton
*button
,
95 static void date_format_cancel_btn_clicked (GtkButton
*button
,
97 static gboolean
date_format_key_pressed (GtkWidget
*keywidget
,
100 static gboolean
date_format_on_delete (GtkWidget
*dialogwidget
,
103 static void date_format_entry_on_change (GtkEditable
*editable
,
105 static void date_format_select_row (GtkTreeView
*list_view
,
107 GtkTreeViewColumn
*column
,
108 GtkWidget
*date_format
);
109 static void mark_as_read_toggled (GtkToggleButton
*button
,
111 static void always_show_msg_toggled (GtkToggleButton
*button
,
114 static GtkWidget
*date_format_create(GtkButton
*button
, void *data
)
116 static GtkWidget
*datefmt_win
= NULL
;
119 GtkWidget
*scrolledwindow1
;
120 GtkWidget
*datefmt_list_view
;
125 GtkWidget
*confirm_area
;
127 GtkWidget
*cancel_btn
;
128 GtkWidget
*datefmt_entry
;
157 const gint TIME_FORMAT_ELEMS
=
158 sizeof time_format
/ sizeof time_format
[0];
160 GtkCellRenderer
*renderer
;
161 GtkTreeViewColumn
*column
;
162 GtkTreeSelection
*selection
;
164 time_format
[0].txt
= _("the abbreviated weekday name");
165 time_format
[1].txt
= _("the full weekday name");
166 time_format
[2].txt
= _("the abbreviated month name");
167 time_format
[3].txt
= _("the full month name");
168 time_format
[4].txt
= _("the preferred date and time for the current locale");
169 time_format
[5].txt
= _("the century number (year/100)");
170 time_format
[6].txt
= _("the day of the month as a decimal number");
171 time_format
[7].txt
= _("the hour as a decimal number using a 24-hour clock");
172 time_format
[8].txt
= _("the hour as a decimal number using a 12-hour clock");
173 time_format
[9].txt
= _("the day of the year as a decimal number");
174 time_format
[10].txt
= _("the month as a decimal number");
175 time_format
[11].txt
= _("the minute as a decimal number");
176 time_format
[12].txt
= _("either AM or PM");
177 time_format
[13].txt
= _("the second as a decimal number");
178 time_format
[14].txt
= _("the day of the week as a decimal number");
179 time_format
[15].txt
= _("the preferred date for the current locale");
180 time_format
[16].txt
= _("the last two digits of a year");
181 time_format
[17].txt
= _("the year as a decimal number");
182 time_format
[18].txt
= _("the time zone or name or abbreviation");
184 if (datefmt_win
) return datefmt_win
;
186 store
= gtk_list_store_new(N_DATEFMT_COLUMNS
,
191 for (i
= 0; i
< TIME_FORMAT_ELEMS
; i
++) {
194 gtk_list_store_append(store
, &iter
);
195 gtk_list_store_set(store
, &iter
,
196 DATEFMT_FMT
, time_format
[i
].fmt
,
197 DATEFMT_TXT
, time_format
[i
].txt
,
201 datefmt_win
= gtkut_window_new(GTK_WINDOW_TOPLEVEL
, "prefs_summaries");
202 gtk_container_set_border_width(GTK_CONTAINER(datefmt_win
), 8);
203 gtk_window_set_title(GTK_WINDOW(datefmt_win
), _("Date format"));
204 gtk_window_set_position(GTK_WINDOW(datefmt_win
), GTK_WIN_POS_CENTER
);
205 gtk_window_set_type_hint(GTK_WINDOW(datefmt_win
), GDK_WINDOW_TYPE_HINT_DIALOG
);
206 gtk_widget_set_size_request(datefmt_win
, 440, 280);
208 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, 10);
209 gtk_widget_show(vbox1
);
210 gtk_container_add(GTK_CONTAINER(datefmt_win
), vbox1
);
212 scrolledwindow1
= gtk_scrolled_window_new(NULL
, NULL
);
213 gtk_scrolled_window_set_policy
214 (GTK_SCROLLED_WINDOW(scrolledwindow1
),
215 GTK_POLICY_AUTOMATIC
, GTK_POLICY_AUTOMATIC
);
216 gtk_widget_show(scrolledwindow1
);
217 gtk_box_pack_start(GTK_BOX(vbox1
), scrolledwindow1
, TRUE
, TRUE
, 0);
219 datefmt_list_view
= gtk_tree_view_new_with_model(GTK_TREE_MODEL(store
));
220 g_object_unref(G_OBJECT(store
));
221 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(datefmt_list_view
),
222 prefs_common
.use_stripes_everywhere
);
223 gtk_widget_show(datefmt_list_view
);
224 gtk_container_add(GTK_CONTAINER(scrolledwindow1
), datefmt_list_view
);
226 renderer
= gtk_cell_renderer_text_new();
227 column
= gtk_tree_view_column_new_with_attributes
228 (_("Specifier"), renderer
, "text", DATEFMT_FMT
,
230 gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view
), column
);
232 renderer
= gtk_cell_renderer_text_new();
233 column
= gtk_tree_view_column_new_with_attributes
234 (_("Description"), renderer
, "text", DATEFMT_TXT
,
236 gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view
), column
);
238 /* gtk_cmclist_set_column_width(GTK_CMCLIST(datefmt_clist), 0, 80); */
239 selection
= gtk_tree_view_get_selection(GTK_TREE_VIEW(datefmt_list_view
));
240 gtk_tree_selection_set_mode(selection
, GTK_SELECTION_BROWSE
);
242 g_signal_connect(G_OBJECT(datefmt_list_view
), "row_activated",
243 G_CALLBACK(date_format_select_row
),
246 table
= gtk_grid_new();
247 gtk_widget_show(table
);
248 gtk_box_pack_start(GTK_BOX(vbox1
), table
, FALSE
, FALSE
, 0);
249 gtk_grid_set_row_spacing(GTK_GRID(table
), 4);
250 gtk_grid_set_column_spacing(GTK_GRID(table
), 8);
252 label1
= gtk_label_new(_("Date format"));
253 gtk_widget_show(label1
);
254 gtk_label_set_justify(GTK_LABEL(label1
), GTK_JUSTIFY_LEFT
);
255 gtk_label_set_xalign(GTK_LABEL(label1
), 0.0);
256 gtk_grid_attach(GTK_GRID(table
), label1
, 0, 0, 1, 1);
258 datefmt_entry
= gtk_entry_new();
259 gtk_entry_set_max_length(GTK_ENTRY(datefmt_entry
), 256);
260 gtk_widget_show(datefmt_entry
);
261 gtk_grid_attach(GTK_GRID(table
), datefmt_entry
, 1, 0, 1, 1);
262 gtk_widget_set_hexpand(datefmt_entry
, TRUE
);
263 gtk_widget_set_halign(datefmt_entry
, GTK_ALIGN_FILL
);
265 /* we need the "sample" entry box; add it as data so callbacks can
266 * get the entry box */
267 g_object_set_data(G_OBJECT(datefmt_win
), "datefmt_sample",
270 label2
= gtk_label_new(_("Example"));
271 gtk_widget_show(label2
);
272 gtk_label_set_justify(GTK_LABEL(label2
), GTK_JUSTIFY_LEFT
);
273 gtk_label_set_xalign(GTK_LABEL(label2
), 0.0);
274 gtk_grid_attach(GTK_GRID(table
), label2
, 0, 1, 1, 1);
276 label3
= gtk_label_new("");
277 gtk_widget_show(label3
);
278 gtk_label_set_justify(GTK_LABEL(label3
), GTK_JUSTIFY_LEFT
);
279 gtk_label_set_xalign(GTK_LABEL(label3
), 0.0);
280 gtk_grid_attach(GTK_GRID(table
), label3
, 1, 1, 1, 1);
281 gtk_widget_set_hexpand(label3
, TRUE
);
282 gtk_widget_set_halign(label3
, GTK_ALIGN_FILL
);
284 gtkut_stock_button_set_create(&confirm_area
, &cancel_btn
, NULL
, _("_Cancel"),
285 &ok_btn
, NULL
, _("_OK"), NULL
, NULL
, NULL
);
287 gtk_box_pack_start(GTK_BOX(vbox1
), confirm_area
, FALSE
, FALSE
, 0);
288 gtk_widget_show(confirm_area
);
289 gtk_widget_grab_default(ok_btn
);
291 /* set the current format */
292 gtk_entry_set_text(GTK_ENTRY(datefmt_entry
), prefs_common
.date_format
);
293 date_format_entry_on_change(GTK_EDITABLE(datefmt_entry
),
296 g_signal_connect(G_OBJECT(ok_btn
), "clicked",
297 G_CALLBACK(date_format_ok_btn_clicked
),
299 g_signal_connect(G_OBJECT(cancel_btn
), "clicked",
300 G_CALLBACK(date_format_cancel_btn_clicked
),
302 g_signal_connect(G_OBJECT(datefmt_win
), "key_press_event",
303 G_CALLBACK(date_format_key_pressed
),
305 g_signal_connect(G_OBJECT(datefmt_win
), "delete_event",
306 G_CALLBACK(date_format_on_delete
),
308 g_signal_connect(G_OBJECT(datefmt_entry
), "changed",
309 G_CALLBACK(date_format_entry_on_change
),
312 gtk_widget_show(datefmt_win
);
313 manage_window_set_transient(GTK_WINDOW(datefmt_win
));
314 gtk_window_set_modal(GTK_WINDOW(datefmt_win
), TRUE
);
316 gtk_widget_grab_focus(ok_btn
);
321 static void prefs_summaries_create_widget(PrefsPage
*_page
, GtkWindow
*window
,
324 SummariesPage
*prefs_summaries
= (SummariesPage
*) _page
;
327 GtkWidget
*hbox0
, *hbox1
, *hbox2
;
328 GtkWidget
*vbox1
, *vbox2
, *vbox3
, *vbox4
;
329 GtkWidget
*frame_new_folders
;
330 GtkWidget
*optmenu_folder_unread
;
331 GtkWidget
*label_ng_abbrev
;
332 GtkWidget
*spinbtn_ng_abbrev_len
;
333 GtkAdjustment
*spinbtn_ng_abbrev_len_adj
;
334 GtkWidget
*checkbtn_useaddrbook
;
335 GtkWidget
*checkbtn_show_tooltips
;
336 GtkWidget
*checkbtn_threadsubj
;
337 GtkWidget
*label_datefmt
;
338 GtkWidget
*button_datefmt
;
339 GtkWidget
*entry_datefmt
;
340 GtkWidget
*button_dispitem
;
341 GtkWidget
*checkbtn_reopen_last_folder
;
342 GtkWidget
*checkbtn_always_show_msg
;
343 GtkWidget
*checkbtn_show_on_folder_open
;
344 GtkWidget
*checkbtn_show_on_search_results
;
345 GtkWidget
*checkbtn_show_on_prevnext
;
346 GtkWidget
*checkbtn_show_on_deletemove
;
347 GtkWidget
*checkbtn_show_on_directional
;
348 GtkWidget
*spinbtn_mark_as_read_delay
;
349 GtkAdjustment
*spinbtn_mark_as_read_delay_adj
;
350 GtkWidget
*checkbtn_immedexec
;
351 GtkWidget
*checkbtn_ask_mark_all_read
;
352 GtkWidget
*checkbtn_run_processingrules_mark_all_read
;
353 GtkWidget
*checkbtn_ask_override_colorlabel
;
354 GtkWidget
*label
, *label_fill
;
357 GtkWidget
*optmenu_summaryfromshow
;
358 GtkWidget
*optmenu_nextunreadmsgdialog
;
359 GtkWidget
*button_edit_actions
;
360 GtkWidget
*radio_mark_as_read_on_select
;
361 GtkWidget
*radio_mark_as_read_on_new_win
;
362 GtkWidget
*optmenu_sort_key
;
363 GtkWidget
*optmenu_sort_type
;
364 GtkWidget
*checkbtn_folder_default_thread
;
365 GtkWidget
*checkbtn_folder_default_thread_collapsed
;
366 GtkWidget
*checkbtn_folder_default_hide_read_threads
;
367 GtkWidget
*checkbtn_folder_default_hide_read_msgs
;
368 GtkWidget
*checkbtn_folder_default_hide_del_msgs
;
369 GtkWidget
*checkbtn_summary_col_lock
;
371 notebook
= gtk_notebook_new();
372 gtk_widget_show(notebook
);
374 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
375 gtk_widget_show (vbox1
);
376 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
377 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
378 gtk_label_new(_("Folder list")));
380 hbox0
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
381 gtk_widget_show (hbox0
);
382 gtk_box_pack_start(GTK_BOX(vbox1
), hbox0
, FALSE
, TRUE
, 0);
384 label
= gtk_label_new(_("Displayed columns"));
385 gtk_widget_show(label
);
386 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
387 button_dispitem
= gtk_button_new_with_mnemonic("_Edit");
388 gtk_widget_show (button_dispitem
);
389 gtk_box_pack_start (GTK_BOX (hbox0
), button_dispitem
, FALSE
, FALSE
, 0);
390 g_signal_connect (G_OBJECT (button_dispitem
), "clicked",
391 G_CALLBACK (prefs_folder_column_open
),
394 hbox0
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
395 gtk_widget_show (hbox0
);
396 gtk_box_pack_start(GTK_BOX (vbox1
), hbox0
, FALSE
, FALSE
, 0);
398 label
= gtk_label_new (_("Display message count next to folder name"));
399 gtk_widget_show (label
);
400 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
402 optmenu_folder_unread
= gtkut_sc_combobox_create(NULL
, FALSE
);
403 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
404 GTK_COMBO_BOX(optmenu_folder_unread
)));
405 gtk_widget_show (optmenu_folder_unread
);
407 COMBOBOX_ADD (menu
, _("No"), 0);
408 COMBOBOX_ADD (menu
, _("Unread messages"), 1);
409 COMBOBOX_ADD (menu
, _("Unread and Total messages"), 2);
411 gtk_box_pack_start(GTK_BOX(hbox0
), optmenu_folder_unread
, FALSE
, FALSE
, 0);
414 (vbox1
, checkbtn_reopen_last_folder
,
415 _("Open last opened folder at start-up"));
418 (vbox1
, checkbtn_run_processingrules_mark_all_read
,
419 _("Run processing rules before marking all messages in a folder as read or unread"));
421 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
422 gtk_widget_show (hbox1
);
423 gtk_box_pack_start(GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
425 label_ng_abbrev
= gtk_label_new
426 (_("Abbreviate newsgroup names longer than"));
427 gtk_widget_show (label_ng_abbrev
);
428 gtk_box_pack_start (GTK_BOX (hbox1
), label_ng_abbrev
, FALSE
, FALSE
, 0);
430 spinbtn_ng_abbrev_len_adj
= GTK_ADJUSTMENT(gtk_adjustment_new (16, 0, 999, 1, 10, 0));
431 spinbtn_ng_abbrev_len
= gtk_spin_button_new
432 (GTK_ADJUSTMENT (spinbtn_ng_abbrev_len_adj
), 1, 0);
433 gtk_widget_show (spinbtn_ng_abbrev_len
);
434 gtk_box_pack_start (GTK_BOX (hbox1
), spinbtn_ng_abbrev_len
,
436 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_ng_abbrev_len
),
439 label_ng_abbrev
= gtk_label_new (_("letters"));
440 gtk_widget_show (label_ng_abbrev
);
441 gtk_box_pack_start (GTK_BOX (hbox1
), label_ng_abbrev
, FALSE
, FALSE
, 0);
443 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
444 gtk_widget_show (vbox1
);
445 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
446 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
447 gtk_label_new(_("Message list")));
449 hbox0
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
450 gtk_widget_show (hbox0
);
451 gtk_box_pack_start(GTK_BOX(vbox1
), hbox0
, FALSE
, TRUE
, 0);
453 label
= gtk_label_new(_("Displayed columns"));
454 gtk_widget_show(label
);
455 gtk_box_pack_start(GTK_BOX(hbox0
), label
, FALSE
, FALSE
, 0);
456 button_dispitem
= gtk_button_new_with_mnemonic("_Edit");
457 gtk_widget_show (button_dispitem
);
458 gtk_box_pack_start (GTK_BOX (hbox0
), button_dispitem
, FALSE
, FALSE
, 0);
459 g_signal_connect (G_OBJECT (button_dispitem
), "clicked",
460 G_CALLBACK (prefs_summary_column_open
),
463 PACK_SPACER(hbox0
, hbox1
, 4);
464 PACK_CHECK_BUTTON(hbox0
, checkbtn_summary_col_lock
, _("Lock column headers"));
466 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
467 gtk_widget_show (hbox1
);
468 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
470 label
= gtk_label_new (_("Displayed in From column"));
471 gtk_widget_show (label
);
472 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
474 optmenu_summaryfromshow
= gtkut_sc_combobox_create(NULL
, FALSE
);
475 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
476 GTK_COMBO_BOX(optmenu_summaryfromshow
)));
477 gtk_widget_show (optmenu_summaryfromshow
);
479 COMBOBOX_ADD (menu
, _("Name"), SHOW_NAME
);
480 COMBOBOX_ADD (menu
, _("Address"), SHOW_ADDR
);
481 COMBOBOX_ADD (menu
, _("Name and Address"), SHOW_BOTH
);
483 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_summaryfromshow
, FALSE
, FALSE
, 0);
484 hbox2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
485 gtk_widget_show (hbox2
);
486 gtk_box_pack_start (GTK_BOX (vbox1
), hbox2
, FALSE
, TRUE
, 0);
488 label_datefmt
= gtk_label_new (_("Date format"));
489 gtk_widget_show (label_datefmt
);
490 gtk_box_pack_start (GTK_BOX (hbox2
), label_datefmt
, FALSE
, FALSE
, 0);
492 entry_datefmt
= gtk_entry_new ();
493 gtk_widget_show (entry_datefmt
);
494 gtk_box_pack_start (GTK_BOX (hbox2
), entry_datefmt
, FALSE
, FALSE
, 0);
496 button_datefmt
= gtkut_stock_button("dialog-information", _("_Information"));
498 gtk_widget_show (button_datefmt
);
499 gtk_box_pack_start (GTK_BOX (hbox2
), button_datefmt
, FALSE
, FALSE
, 0);
500 g_signal_connect (G_OBJECT (button_datefmt
), "clicked",
501 G_CALLBACK (date_format_create
), NULL
);
503 label_fill
= gtk_label_new(" ");
504 gtk_box_pack_start(GTK_BOX(hbox2
), label_fill
, TRUE
, FALSE
, 0);
506 CLAWS_SET_TIP(button_datefmt
,
507 _("Date format help"));
509 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
510 gtk_widget_show (hbox1
);
511 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, TRUE
, 0);
513 button_edit_actions
= gtk_button_new_with_label(_("Set message selection when entering a folder"));
514 gtk_widget_show (button_edit_actions
);
515 gtk_box_pack_start (GTK_BOX (hbox1
), button_edit_actions
,
517 g_signal_connect (G_OBJECT (button_edit_actions
), "clicked",
518 G_CALLBACK (prefs_summary_open_open
),
521 /* Open message on select policy */
522 vbox4
= gtkut_get_options_frame(vbox1
, NULL
, _("Open message when selected"));
524 PACK_CHECK_BUTTON(vbox4
, checkbtn_always_show_msg
,
526 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_folder_open
,
527 _("When opening a folder"));
528 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_search_results
,
529 _("When displaying search results"));
530 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_prevnext
,
531 _("When selecting next or previous message using shortcuts"));
532 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_deletemove
,
533 _("When deleting or moving messages"));
534 PACK_CHECK_BUTTON(vbox4
, checkbtn_show_on_directional
,
535 _("When using directional keys"));
537 vbox3
= gtkut_get_options_frame(vbox1
, NULL
, _("Mark message as read"));
539 radio_mark_as_read_on_select
= gtk_radio_button_new_with_label(NULL
,
540 _("when selected, after"));
542 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
543 gtk_box_pack_start (GTK_BOX (hbox1
), radio_mark_as_read_on_select
, FALSE
, FALSE
, 0);
545 spinbtn_mark_as_read_delay_adj
= GTK_ADJUSTMENT(gtk_adjustment_new (0, 0, 60, 1, 10, 0));
546 spinbtn_mark_as_read_delay
= gtk_spin_button_new
547 (GTK_ADJUSTMENT (spinbtn_mark_as_read_delay_adj
), 1, 0);
548 gtk_box_pack_start (GTK_BOX (hbox1
), spinbtn_mark_as_read_delay
,
550 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_mark_as_read_delay
),
552 gtk_box_pack_start (GTK_BOX (hbox1
), gtk_label_new
553 (_("seconds")), FALSE
, FALSE
, 0);
555 gtk_box_pack_start (GTK_BOX (vbox3
), hbox1
, FALSE
, FALSE
, 0);
557 radio_mark_as_read_on_new_win
= gtk_radio_button_new_with_label_from_widget(
558 GTK_RADIO_BUTTON(radio_mark_as_read_on_select
),
559 _("only when opened in a new window, or replied to"));
560 gtk_box_pack_start (GTK_BOX (vbox3
), radio_mark_as_read_on_new_win
,
562 gtk_widget_show_all(vbox3
);
564 /* Next Unread Message Dialog */
565 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
566 gtk_widget_show (hbox1
);
567 gtk_box_pack_start (GTK_BOX (vbox1
), hbox1
, FALSE
, FALSE
, 0);
569 label
= gtk_label_new (_("Show \"no unread (or new) message\" dialog"));
570 gtk_widget_show (label
);
571 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
573 optmenu_nextunreadmsgdialog
= gtkut_sc_combobox_create(NULL
, FALSE
);
574 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(
575 GTK_COMBO_BOX(optmenu_nextunreadmsgdialog
)));
576 gtk_widget_show (optmenu_nextunreadmsgdialog
);
578 COMBOBOX_ADD (menu
, _("Always"), NEXTUNREADMSGDIALOG_ALWAYS
);
579 COMBOBOX_ADD (menu
, _("Assume 'Yes'"), NEXTUNREADMSGDIALOG_ASSUME_YES
);
580 COMBOBOX_ADD (menu
, _("Assume 'No'"), NEXTUNREADMSGDIALOG_ASSUME_NO
);
582 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_nextunreadmsgdialog
, FALSE
, FALSE
, 0);
585 (vbox1
, checkbtn_useaddrbook
,
586 _("Display sender using address book"));
589 (vbox1
, checkbtn_threadsubj
,
590 _("Thread using subject in addition to standard headers"));
593 (vbox1
, checkbtn_immedexec
,
594 _("Execute immediately when moving or deleting messages"));
595 CLAWS_SET_TIP(checkbtn_immedexec
,
596 _("When unchecked moving, copying and deleting of messages"
597 " is deferred until you use 'Tools/Execute'"));
600 (vbox1
, checkbtn_ask_mark_all_read
,
601 _("Confirm when marking all messages as read or unread"));
603 (vbox1
, checkbtn_ask_override_colorlabel
,
604 _("Confirm when changing color labels"));
607 (vbox1
, checkbtn_show_tooltips
,
610 hbox2
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 8);
611 gtk_widget_show (hbox2
);
612 gtk_box_pack_start (GTK_BOX (vbox1
), hbox2
, FALSE
, FALSE
, 0);
614 vbox1
= gtk_box_new(GTK_ORIENTATION_VERTICAL
, VSPACING
);
615 gtk_widget_show (vbox1
);
616 gtk_container_set_border_width (GTK_CONTAINER (vbox1
), VBOX_BORDER
);
617 gtk_notebook_append_page(GTK_NOTEBOOK(notebook
), vbox1
,
618 gtk_label_new(_("Defaults")));
620 vbox2
= gtkut_get_options_frame(vbox1
, &frame_new_folders
, _("New folders"));
622 hbox1
= gtk_box_new(GTK_ORIENTATION_HORIZONTAL
, 10);
623 gtk_widget_show(hbox1
);
624 gtk_box_pack_start(GTK_BOX (vbox2
), hbox1
, FALSE
, FALSE
, 0);
626 label
= gtk_label_new(_("Sort by"));
627 gtk_widget_show(label
);
628 gtk_box_pack_start(GTK_BOX(hbox1
), label
, FALSE
, FALSE
, 0);
630 optmenu_sort_key
= gtkut_sc_combobox_create(NULL
, FALSE
);
631 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_key
)));
632 gtk_widget_show(optmenu_sort_key
);
634 COMBOBOX_ADD(menu
, _("Number"), SORT_BY_NUMBER
);
635 COMBOBOX_ADD(menu
, _("Size"), SORT_BY_SIZE
);
636 COMBOBOX_ADD(menu
, _("Date"), SORT_BY_DATE
);
637 COMBOBOX_ADD(menu
, _("Thread date"), SORT_BY_THREAD_DATE
);
638 COMBOBOX_ADD(menu
, _("From"), SORT_BY_FROM
);
639 COMBOBOX_ADD(menu
, _("To"), SORT_BY_TO
);
640 COMBOBOX_ADD(menu
, _("Subject"), SORT_BY_SUBJECT
);
641 COMBOBOX_ADD(menu
, _("Color label"), SORT_BY_LABEL
);
642 COMBOBOX_ADD(menu
, _("Tag"), SORT_BY_TAGS
);
643 COMBOBOX_ADD(menu
, _("Mark"), SORT_BY_MARK
);
644 COMBOBOX_ADD(menu
, _("Status"), SORT_BY_STATUS
);
645 COMBOBOX_ADD(menu
, _("Attachment"), SORT_BY_MIME
);
646 COMBOBOX_ADD(menu
, _("Score"), SORT_BY_SCORE
);
647 COMBOBOX_ADD(menu
, _("Locked"), SORT_BY_LOCKED
);
648 COMBOBOX_ADD(menu
, _("Don't sort"), SORT_BY_NONE
);
650 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_sort_key
, FALSE
, FALSE
, 0);
652 optmenu_sort_type
= gtkut_sc_combobox_create(NULL
, FALSE
);
653 menu
= GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu_sort_type
)));
654 gtk_widget_show(optmenu_sort_type
);
656 COMBOBOX_ADD(menu
, _("Ascending"), SORT_ASCENDING
);
657 COMBOBOX_ADD(menu
, _("Descending"), SORT_DESCENDING
);
659 gtk_box_pack_start(GTK_BOX(hbox1
), optmenu_sort_type
, FALSE
, FALSE
, 0);
662 (vbox2
, checkbtn_folder_default_thread
,
665 (vbox2
, checkbtn_folder_default_thread_collapsed
,
666 _("Collapse all threads"));
668 (vbox2
, checkbtn_folder_default_hide_read_threads
,
669 _("Hide read threads"));
671 (vbox2
, checkbtn_folder_default_hide_read_msgs
,
672 _("Hide read messages"));
674 (vbox2
, checkbtn_folder_default_hide_del_msgs
,
675 _("Hide deleted messages"));
677 prefs_summaries
->optmenu_folder_unread
= optmenu_folder_unread
;
678 prefs_summaries
->spinbtn_ng_abbrev_len
= spinbtn_ng_abbrev_len
;
679 prefs_summaries
->checkbtn_useaddrbook
= checkbtn_useaddrbook
;
680 prefs_summaries
->checkbtn_show_tooltips
= checkbtn_show_tooltips
;
681 prefs_summaries
->checkbtn_threadsubj
= checkbtn_threadsubj
;
682 prefs_summaries
->entry_datefmt
= entry_datefmt
;
683 prefs_summaries
->checkbtn_reopen_last_folder
= checkbtn_reopen_last_folder
;
685 prefs_summaries
->checkbtn_always_show_msg
= checkbtn_always_show_msg
;
686 prefs_summaries
->checkbtn_show_on_folder_open
= checkbtn_show_on_folder_open
;
687 prefs_summaries
->checkbtn_show_on_search_results
= checkbtn_show_on_search_results
;
688 prefs_summaries
->checkbtn_show_on_prevnext
= checkbtn_show_on_prevnext
;
689 prefs_summaries
->checkbtn_show_on_deletemove
= checkbtn_show_on_deletemove
;
690 prefs_summaries
->checkbtn_show_on_directional
= checkbtn_show_on_directional
;
692 prefs_summaries
->checkbtn_mark_as_read_on_newwin
= radio_mark_as_read_on_new_win
;
693 prefs_summaries
->spinbtn_mark_as_read_delay
= spinbtn_mark_as_read_delay
;
694 prefs_summaries
->checkbtn_immedexec
= checkbtn_immedexec
;
695 prefs_summaries
->checkbtn_ask_mark_all_read
= checkbtn_ask_mark_all_read
;
696 prefs_summaries
->checkbtn_run_processingrules_mark_all_read
= checkbtn_run_processingrules_mark_all_read
;
697 prefs_summaries
->checkbtn_ask_override_colorlabel
= checkbtn_ask_override_colorlabel
;
698 prefs_summaries
->optmenu_sort_key
= optmenu_sort_key
;
699 prefs_summaries
->optmenu_sort_type
= optmenu_sort_type
;
700 prefs_summaries
->optmenu_nextunreadmsgdialog
= optmenu_nextunreadmsgdialog
;
701 prefs_summaries
->optmenu_summaryfromshow
= optmenu_summaryfromshow
;
703 prefs_summaries
->checkbtn_folder_default_thread
= checkbtn_folder_default_thread
;
704 prefs_summaries
->checkbtn_folder_default_thread_collapsed
= checkbtn_folder_default_thread_collapsed
;
705 prefs_summaries
->checkbtn_folder_default_hide_read_threads
= checkbtn_folder_default_hide_read_threads
;
706 prefs_summaries
->checkbtn_folder_default_hide_read_msgs
= checkbtn_folder_default_hide_read_msgs
;
707 prefs_summaries
->checkbtn_folder_default_hide_del_msgs
= checkbtn_folder_default_hide_del_msgs
;
708 prefs_summaries
->checkbtn_summary_col_lock
= checkbtn_summary_col_lock
;
710 prefs_summaries
->page
.widget
= vbox1
;
711 g_signal_connect(G_OBJECT(checkbtn_always_show_msg
), "toggled",
712 G_CALLBACK(always_show_msg_toggled
), prefs_summaries
);
714 g_signal_connect(G_OBJECT(radio_mark_as_read_on_select
), "toggled",
715 G_CALLBACK(mark_as_read_toggled
),
716 spinbtn_mark_as_read_delay
);
718 prefs_summaries
->window
= GTK_WIDGET(window
);
720 combobox_select_by_data(GTK_COMBO_BOX(optmenu_folder_unread
),
721 prefs_common
.display_folder_unread
);
722 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_useaddrbook
),
723 prefs_common
.use_addr_book
);
724 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_tooltips
),
725 prefs_common
.show_tooltips
);
726 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_threadsubj
),
727 prefs_common
.thread_by_subject
);
728 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_ng_abbrev_len
),
729 prefs_common
.ng_abbrev_len
);
730 gtk_entry_set_text(GTK_ENTRY(entry_datefmt
),
731 prefs_common
.date_format
?prefs_common
.date_format
:"");
732 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_reopen_last_folder
),
733 prefs_common
.goto_last_folder_on_startup
);
735 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_always_show_msg
),
736 prefs_common
.always_show_msg
);
737 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_folder_open
),
738 prefs_common
.open_selected_on_folder_open
);
739 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_search_results
),
740 prefs_common
.open_selected_on_search_results
);
741 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_prevnext
),
742 prefs_common
.open_selected_on_prevnext
);
743 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_deletemove
),
744 prefs_common
.open_selected_on_deletemove
);
745 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_on_directional
),
746 prefs_common
.open_selected_on_directional
);
748 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio_mark_as_read_on_new_win
),
749 prefs_common
.mark_as_read_on_new_window
);
750 gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_mark_as_read_delay
),
751 prefs_common
.mark_as_read_delay
);
752 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_immedexec
),
753 prefs_common
.immediate_exec
);
754 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_mark_all_read
),
755 prefs_common
.ask_mark_all_read
);
756 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_run_processingrules_mark_all_read
),
757 prefs_common
.run_processingrules_before_mark_all
);
758 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_ask_override_colorlabel
),
759 prefs_common
.ask_override_colorlabel
);
761 combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_key
),
762 prefs_common
.default_sort_key
);
763 combobox_select_by_data(GTK_COMBO_BOX(optmenu_sort_type
),
764 prefs_common
.default_sort_type
);
766 combobox_select_by_data(GTK_COMBO_BOX(optmenu_summaryfromshow
),
767 prefs_common
.summary_from_show
);
769 combobox_select_by_data(GTK_COMBO_BOX(optmenu_nextunreadmsgdialog
),
770 prefs_common
.next_unread_msg_dialog
);
772 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_thread
),
773 prefs_common
.folder_default_thread
);
774 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_thread_collapsed
),
775 prefs_common
.folder_default_thread_collapsed
);
776 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_read_threads
),
777 prefs_common
.folder_default_hide_read_threads
);
778 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_read_msgs
),
779 prefs_common
.folder_default_hide_read_msgs
);
780 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_default_hide_del_msgs
),
781 prefs_common
.folder_default_hide_del_msgs
);
782 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_summary_col_lock
),
783 prefs_common
.summary_col_lock
);
785 gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook
), 0);
787 prefs_summaries
->page
.widget
= notebook
;
790 static void prefs_summaries_save(PrefsPage
*_page
)
792 SummariesPage
*page
= (SummariesPage
*) _page
;
794 prefs_common
.display_folder_unread
= combobox_get_active_data(
795 GTK_COMBO_BOX(page
->optmenu_folder_unread
));
797 prefs_common
.use_addr_book
= gtk_toggle_button_get_active(
798 GTK_TOGGLE_BUTTON(page
->checkbtn_useaddrbook
));
799 prefs_common
.show_tooltips
= gtk_toggle_button_get_active(
800 GTK_TOGGLE_BUTTON(page
->checkbtn_show_tooltips
));
801 prefs_common
.thread_by_subject
= gtk_toggle_button_get_active(
802 GTK_TOGGLE_BUTTON(page
->checkbtn_threadsubj
));
803 prefs_common
.ng_abbrev_len
= gtk_spin_button_get_value_as_int(
804 GTK_SPIN_BUTTON(page
->spinbtn_ng_abbrev_len
));
806 g_free(prefs_common
.date_format
);
807 prefs_common
.date_format
= gtk_editable_get_chars(
808 GTK_EDITABLE(page
->entry_datefmt
), 0, -1);
810 prefs_common
.goto_last_folder_on_startup
= gtk_toggle_button_get_active(
811 GTK_TOGGLE_BUTTON(page
->checkbtn_reopen_last_folder
));
813 prefs_common
.always_show_msg
= gtk_toggle_button_get_active(
814 GTK_TOGGLE_BUTTON(page
->checkbtn_always_show_msg
));
815 prefs_common
.open_selected_on_folder_open
= gtk_toggle_button_get_active(
816 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_folder_open
));
817 prefs_common
.open_selected_on_search_results
= gtk_toggle_button_get_active(
818 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_search_results
));
819 prefs_common
.open_selected_on_prevnext
= gtk_toggle_button_get_active(
820 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_prevnext
));
821 prefs_common
.open_selected_on_deletemove
= gtk_toggle_button_get_active(
822 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_deletemove
));
823 prefs_common
.open_selected_on_directional
= gtk_toggle_button_get_active(
824 GTK_TOGGLE_BUTTON(page
->checkbtn_show_on_directional
));
826 prefs_common
.mark_as_read_on_new_window
= gtk_toggle_button_get_active(
827 GTK_TOGGLE_BUTTON(page
->checkbtn_mark_as_read_on_newwin
));
828 prefs_common
.immediate_exec
= gtk_toggle_button_get_active(
829 GTK_TOGGLE_BUTTON(page
->checkbtn_immedexec
));
830 prefs_common
.ask_mark_all_read
= gtk_toggle_button_get_active(
831 GTK_TOGGLE_BUTTON(page
->checkbtn_ask_mark_all_read
));
832 prefs_common
.run_processingrules_before_mark_all
= gtk_toggle_button_get_active(
833 GTK_TOGGLE_BUTTON(page
->checkbtn_run_processingrules_mark_all_read
));
834 prefs_common
.ask_override_colorlabel
= gtk_toggle_button_get_active(
835 GTK_TOGGLE_BUTTON(page
->checkbtn_ask_override_colorlabel
));
836 prefs_common
.mark_as_read_delay
= gtk_spin_button_get_value_as_int(
837 GTK_SPIN_BUTTON(page
->spinbtn_mark_as_read_delay
));
838 prefs_common
.summary_col_lock
= gtk_toggle_button_get_active(
839 GTK_TOGGLE_BUTTON(page
->checkbtn_summary_col_lock
));
841 prefs_common
.default_sort_key
= combobox_get_active_data(
842 GTK_COMBO_BOX(page
->optmenu_sort_key
));
843 prefs_common
.default_sort_type
= combobox_get_active_data(
844 GTK_COMBO_BOX(page
->optmenu_sort_type
));
845 prefs_common
.summary_from_show
= combobox_get_active_data(
846 GTK_COMBO_BOX(page
->optmenu_summaryfromshow
));
847 prefs_common
.next_unread_msg_dialog
= combobox_get_active_data(
848 GTK_COMBO_BOX(page
->optmenu_nextunreadmsgdialog
));
849 prefs_common
.folder_default_thread
= gtk_toggle_button_get_active(
850 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_thread
));
851 prefs_common
.folder_default_thread_collapsed
= gtk_toggle_button_get_active(
852 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_thread_collapsed
));
853 prefs_common
.folder_default_hide_read_threads
= gtk_toggle_button_get_active(
854 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_read_threads
));
855 prefs_common
.folder_default_hide_read_msgs
= gtk_toggle_button_get_active(
856 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_read_msgs
));
857 prefs_common
.folder_default_hide_del_msgs
= gtk_toggle_button_get_active(
858 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_del_msgs
));
859 prefs_common
.folder_default_hide_del_msgs
= gtk_toggle_button_get_active(
860 GTK_TOGGLE_BUTTON(page
->checkbtn_folder_default_hide_del_msgs
));
862 main_window_reflect_prefs_all();
865 static void prefs_summaries_destroy_widget(PrefsPage
*_page
)
869 SummariesPage
*prefs_summaries
;
871 void prefs_summaries_init(void)
874 static gchar
*path
[3];
876 path
[0] = _("Display");
877 path
[1] = _("Summaries");
880 page
= g_new0(SummariesPage
, 1);
881 page
->page
.path
= path
;
882 page
->page
.create_widget
= prefs_summaries_create_widget
;
883 page
->page
.destroy_widget
= prefs_summaries_destroy_widget
;
884 page
->page
.save_page
= prefs_summaries_save
;
885 page
->page
.weight
= 140.0;
886 prefs_gtk_register_page((PrefsPage
*) page
);
887 prefs_summaries
= page
;
890 void prefs_summaries_done(void)
892 prefs_gtk_unregister_page((PrefsPage
*) prefs_summaries
);
893 g_free(prefs_summaries
);
896 static void date_format_ok_btn_clicked(GtkButton
*button
, GtkWidget
**widget
)
898 GtkWidget
*datefmt_sample
= NULL
;
901 cm_return_if_fail(widget
!= NULL
);
902 cm_return_if_fail(*widget
!= NULL
);
903 cm_return_if_fail(prefs_summaries
->entry_datefmt
!= NULL
);
905 datefmt_sample
= GTK_WIDGET(g_object_get_data
906 (G_OBJECT(*widget
), "datefmt_sample"));
907 cm_return_if_fail(datefmt_sample
!= NULL
);
909 text
= gtk_editable_get_chars(GTK_EDITABLE(datefmt_sample
), 0, -1);
910 g_free(prefs_common
.date_format
);
911 prefs_common
.date_format
= text
;
912 gtk_entry_set_text(GTK_ENTRY(prefs_summaries
->entry_datefmt
), text
);
914 gtk_widget_destroy(*widget
);
918 static void date_format_cancel_btn_clicked(GtkButton
*button
,
921 cm_return_if_fail(widget
!= NULL
);
922 cm_return_if_fail(*widget
!= NULL
);
924 gtk_widget_destroy(*widget
);
928 static gboolean
date_format_key_pressed(GtkWidget
*keywidget
, GdkEventKey
*event
,
931 if (event
&& event
->keyval
== GDK_KEY_Escape
)
932 date_format_cancel_btn_clicked(NULL
, widget
);
936 static gboolean
date_format_on_delete(GtkWidget
*dialogwidget
,
937 GdkEventAny
*event
, GtkWidget
**widget
)
939 cm_return_val_if_fail(widget
!= NULL
, FALSE
);
940 cm_return_val_if_fail(*widget
!= NULL
, FALSE
);
946 static void date_format_entry_on_change(GtkEditable
*editable
,
955 cur_time
= time(NULL
);
956 cal_time
= localtime_r(&cur_time
, <
);
958 text
= gtk_editable_get_chars(editable
, 0, -1);
960 fast_strftime(buffer
, sizeof buffer
, text
, cal_time
);
962 gtk_label_set_text(example
, buffer
);
967 static void date_format_select_row(GtkTreeView
*list_view
,
969 GtkTreeViewColumn
*column
,
970 GtkWidget
*date_format
)
974 const gchar
*old_format
;
976 GtkWidget
*datefmt_sample
;
980 cm_return_if_fail(date_format
!= NULL
);
982 /* only on double click */
983 datefmt_sample
= GTK_WIDGET(g_object_get_data(G_OBJECT(date_format
),
986 cm_return_if_fail(datefmt_sample
!= NULL
);
988 model
= gtk_tree_view_get_model(list_view
);
990 /* get format from list */
991 if (!gtk_tree_model_get_iter(model
, &iter
, path
))
994 gtk_tree_model_get(model
, &iter
, DATEFMT_FMT
, &format
, -1);
996 cur_pos
= gtk_editable_get_position(GTK_EDITABLE(datefmt_sample
));
997 old_format
= gtk_entry_get_text(GTK_ENTRY(datefmt_sample
));
999 /* insert the format into the text entry */
1000 new_format
= g_malloc(strlen(old_format
) + 3);
1002 strncpy(new_format
, old_format
, cur_pos
);
1003 new_format
[cur_pos
] = '\0';
1004 strcat(new_format
, format
);
1006 strcat(new_format
, &old_format
[cur_pos
]);
1008 gtk_entry_set_text(GTK_ENTRY(datefmt_sample
), new_format
);
1009 gtk_editable_set_position(GTK_EDITABLE(datefmt_sample
), cur_pos
+ 2);
1014 static void always_show_msg_toggled(GtkToggleButton
*button
,
1017 const SummariesPage
*prefs_summaries
= (SummariesPage
*)user_data
;
1020 cm_return_if_fail(prefs_summaries
!= NULL
);
1022 state
= gtk_toggle_button_get_active(button
);
1024 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_folder_open
, !state
);
1025 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_search_results
, !state
);
1026 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_prevnext
, !state
);
1027 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_deletemove
, !state
);
1028 gtk_widget_set_sensitive(prefs_summaries
->checkbtn_show_on_directional
, !state
);
1031 static void mark_as_read_toggled(GtkToggleButton
*button
, GtkWidget
*spinbtn
)
1033 gtk_widget_set_sensitive(spinbtn
,
1034 gtk_toggle_button_get_active(button
));