0.9.3claws34
[claws.git] / src / prefs_folder_item.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2001 Hiroyuki Yamamoto
4  *
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 2 of the License, or
8  * (at your option) any later version.
9  *
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.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 /* alfons - all folder item specific settings should migrate into 
21  * folderlist.xml!!! the old folderitemrc file will only serve for a few 
22  * versions (for compatibility) */
23
24 #ifdef HAVE_CONFIG_H
25 #  include "config.h"
26 #endif
27
28 #include "intl.h"
29 #include "defs.h"
30 #include "folder.h"
31 #include "prefs_folder_item.h"
32 #include "folderview.h"
33 #include "summaryview.h"
34 #include "menu.h"
35 #include "account.h"
36 #include "prefs_gtk.h"
37 #include "manage_window.h"
38 #include "utils.h"
39 #include "addr_compl.h"
40 #include "prefs_scoring.h"
41 #include "gtkutils.h"
42 #include "filtering.h"
43 #include "folder_item_prefs.h"
44
45 struct FolderItemSettingsPage
46 {
47         PrefsPage page;
48
49         FolderItem *item;
50
51         GtkWidget *window;
52         GtkWidget *table;
53         GtkWidget *checkbtn_request_return_receipt;
54         GtkWidget *checkbtn_save_copy_to_folder;
55         GtkWidget *checkbtn_default_to;
56         GtkWidget *entry_default_to;
57         GtkWidget *checkbtn_default_reply_to;
58         GtkWidget *entry_default_reply_to;
59         GtkWidget *checkbtn_simplify_subject;
60         GtkWidget *entry_simplify_subject;
61         GtkWidget *checkbtn_folder_chmod;
62         GtkWidget *entry_folder_chmod;
63         GtkWidget *checkbtn_enable_default_account;
64         GtkWidget *optmenu_default_account;
65         GtkWidget *folder_color;
66         GtkWidget *folder_color_btn;
67
68         GtkWidget *color_dialog;
69 };
70
71
72 gint prefs_folder_item_chmod_mode               (gchar *folder_chmod);
73
74 static void set_button_color(guint rgbvalue, GtkWidget *button);
75 static void folder_color_set_dialog(GtkWidget *widget, gpointer data);
76 static void folder_color_set_dialog_ok(GtkWidget *widget, gpointer data);
77 static void folder_color_set_dialog_cancel(GtkWidget *widget, gpointer data);
78 static void folder_color_set_dialog_key_pressed(GtkWidget *widget,
79                                                 GdkEventKey *event,
80                                                 gpointer data);
81
82 #define SAFE_STRING(str) \
83         (str) ? (str) : ""
84
85 void prefs_folder_item_settings_create_widget_func(PrefsPage * _page,
86                                                    GtkWindow * window,
87                                                    gpointer data)
88 {
89         struct FolderItemSettingsPage *page = (struct FolderItemSettingsPage *) _page;
90         FolderItem *item = (FolderItem *) data;
91         guint rowcount;
92
93         GtkWidget *table;
94         
95         GtkWidget *checkbtn_request_return_receipt;
96         GtkWidget *checkbtn_save_copy_to_folder;
97         GtkWidget *checkbtn_default_to;
98         GtkWidget *entry_default_to;
99         GtkWidget *checkbtn_default_reply_to;
100         GtkWidget *entry_default_reply_to;
101         GtkWidget *checkbtn_simplify_subject;
102         GtkWidget *entry_simplify_subject;
103         GtkWidget *checkbtn_folder_chmod;
104         GtkWidget *entry_folder_chmod;
105         GtkWidget *checkbtn_enable_default_account;
106         GtkWidget *optmenu_default_account;
107         GtkWidget *optmenu_default_account_menu;
108         GtkWidget *optmenu_default_account_menuitem;
109         GtkWidget *folder_color;
110         GtkWidget *folder_color_btn;
111         GList *cur_ac;
112         GList *account_list;
113         PrefsAccount *ac_prefs;
114         GtkOptionMenu *optmenu;
115         GtkWidget *menu;
116         GtkWidget *menuitem;
117         gint account_index, index;
118
119         page->item         = item;
120
121         /* Table */
122         table = gtk_table_new(8, 2, FALSE);
123         gtk_widget_show(table);
124         gtk_table_set_row_spacings(GTK_TABLE(table), VSPACING_NARROW);
125         rowcount = 0;
126
127         /* Request Return Receipt */
128         checkbtn_request_return_receipt = gtk_check_button_new_with_label
129                 (_("Request Return Receipt"));
130         gtk_widget_show(checkbtn_request_return_receipt);
131         gtk_table_attach(GTK_TABLE(table), checkbtn_request_return_receipt, 
132                          0, 2, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, 
133                          GTK_SHRINK, 0, 0);
134         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
135                                      item->ret_rcpt ? TRUE : FALSE);
136
137         rowcount++;
138
139         /* Save Copy to Folder */
140         checkbtn_save_copy_to_folder = gtk_check_button_new_with_label
141                 (_("Save copy of outgoing messages to this folder instead of Sent"));
142         gtk_widget_show(checkbtn_save_copy_to_folder);
143         gtk_table_attach(GTK_TABLE(table), checkbtn_save_copy_to_folder, 0, 2, 
144                          rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
145         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_save_copy_to_folder),
146                                      item->prefs->save_copy_to_folder ? TRUE : FALSE);
147
148         rowcount++;
149
150         /* Default To */
151         checkbtn_default_to = gtk_check_button_new_with_label(_("Default To: "));
152         gtk_widget_show(checkbtn_default_to);
153         gtk_table_attach(GTK_TABLE(table), checkbtn_default_to, 0, 1, 
154                          rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
155         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_to), 
156                                      item->prefs->enable_default_to);
157
158         entry_default_to = gtk_entry_new();
159         gtk_widget_show(entry_default_to);
160         gtk_table_attach_defaults(GTK_TABLE(table), entry_default_to, 1, 2, rowcount, rowcount + 1);
161         SET_TOGGLE_SENSITIVITY(checkbtn_default_to, entry_default_to);
162         gtk_entry_set_text(GTK_ENTRY(entry_default_to), SAFE_STRING(item->prefs->default_to));
163         address_completion_register_entry(GTK_ENTRY(entry_default_to));
164
165         rowcount++;
166
167         /* Default address to reply to */
168         checkbtn_default_reply_to = gtk_check_button_new_with_label(_("Send replies to: "));
169         gtk_widget_show(checkbtn_default_reply_to);
170         gtk_table_attach(GTK_TABLE(table), checkbtn_default_reply_to, 0, 1, 
171                          rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
172         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_default_reply_to), 
173                                      item->prefs->enable_default_reply_to);
174
175         entry_default_reply_to = gtk_entry_new();
176         gtk_widget_show(entry_default_reply_to);
177         gtk_table_attach_defaults(GTK_TABLE(table), entry_default_reply_to, 1, 2, rowcount, rowcount + 1);
178         SET_TOGGLE_SENSITIVITY(checkbtn_default_reply_to, entry_default_reply_to);
179         gtk_entry_set_text(GTK_ENTRY(entry_default_reply_to), SAFE_STRING(item->prefs->default_reply_to));
180         address_completion_register_entry(GTK_ENTRY(entry_default_reply_to));
181
182         rowcount++;
183
184         /* Simplify Subject */
185         checkbtn_simplify_subject = gtk_check_button_new_with_label(_("Simplify Subject RegExp: "));
186         gtk_widget_show(checkbtn_simplify_subject);
187         gtk_table_attach(GTK_TABLE(table), checkbtn_simplify_subject, 0, 1, 
188                          rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
189         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_simplify_subject), 
190                                      item->prefs->enable_simplify_subject);
191
192         entry_simplify_subject = gtk_entry_new();
193         gtk_widget_show(entry_simplify_subject);
194         gtk_table_attach_defaults(GTK_TABLE(table), entry_simplify_subject, 1, 2, 
195                                   rowcount, rowcount + 1);
196         SET_TOGGLE_SENSITIVITY(checkbtn_simplify_subject, entry_simplify_subject);
197         gtk_entry_set_text(GTK_ENTRY(entry_simplify_subject), 
198                            SAFE_STRING(item->prefs->simplify_subject_regexp));
199
200         rowcount++;
201
202         /* Folder chmod */
203         checkbtn_folder_chmod = gtk_check_button_new_with_label(_("Folder chmod: "));
204         gtk_widget_show(checkbtn_folder_chmod);
205         gtk_table_attach(GTK_TABLE(table), checkbtn_folder_chmod, 0, 1, 
206                          rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
207
208         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_folder_chmod), 
209                                      item->prefs->enable_folder_chmod);
210
211         entry_folder_chmod = gtk_entry_new();
212         gtk_widget_show(entry_folder_chmod);
213         gtk_table_attach_defaults(GTK_TABLE(table), entry_folder_chmod, 1, 2, 
214                                   rowcount, rowcount + 1);
215         SET_TOGGLE_SENSITIVITY(checkbtn_folder_chmod, entry_folder_chmod);
216         if (item->prefs->folder_chmod) {
217                 gchar *buf;
218
219                 buf = g_strdup_printf("%o", item->prefs->folder_chmod);
220                 gtk_entry_set_text(GTK_ENTRY(entry_folder_chmod), buf);
221                 g_free(buf);
222         }
223         
224         rowcount++;
225
226         /* Default account */
227         checkbtn_enable_default_account = gtk_check_button_new_with_label(_("Default account: "));
228         gtk_widget_show(checkbtn_enable_default_account);
229         gtk_table_attach(GTK_TABLE(table), checkbtn_enable_default_account, 0, 1, 
230                          rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
231         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_enable_default_account), 
232                                      item->prefs->enable_default_account);
233
234         optmenu_default_account = gtk_option_menu_new ();
235         gtk_widget_show (optmenu_default_account);
236         gtk_table_attach_defaults(GTK_TABLE(table), optmenu_default_account, 1, 2, 
237                                   rowcount, rowcount + 1);
238         optmenu_default_account_menu = gtk_menu_new ();
239
240         account_list = account_get_list();
241         account_index = 0;
242         index = 0;
243         for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
244                 ac_prefs = (PrefsAccount *)cur_ac->data;
245                 MENUITEM_ADD (optmenu_default_account_menu, optmenu_default_account_menuitem,
246                                         ac_prefs->account_name?ac_prefs->account_name : _("Untitled"),
247                                         ac_prefs->account_id);
248                 /* get the index for menu's set_history (sad method?) */
249                 if (ac_prefs->account_id == item->prefs->default_account)
250                         account_index = index;
251                 index++;                        
252         }
253
254         page->item->prefs->default_account = item->prefs->default_account;
255
256         optmenu = GTK_OPTION_MENU(optmenu_default_account);
257         gtk_option_menu_set_menu(optmenu, optmenu_default_account_menu);
258
259         gtk_option_menu_set_history(optmenu, account_index);
260
261         menu = gtk_option_menu_get_menu(optmenu);
262         menuitem = gtk_menu_get_active(GTK_MENU(menu));
263         gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
264
265         SET_TOGGLE_SENSITIVITY(checkbtn_enable_default_account, optmenu_default_account);
266
267         rowcount++;
268
269         /* Folder color */
270         folder_color = gtk_label_new(_("Folder color: "));
271         gtk_misc_set_alignment(GTK_MISC(folder_color), 0, 0.5);
272         gtk_widget_show(folder_color);
273         gtk_table_attach_defaults(GTK_TABLE(table), folder_color, 0, 1, 
274                          rowcount, rowcount + 1);
275
276         folder_color_btn = gtk_button_new_with_label("");
277         gtk_widget_set_usize(folder_color_btn, 36, 26);
278         gtk_container_set_border_width(GTK_CONTAINER(folder_color_btn), 2);
279         gtk_widget_show(folder_color_btn);
280         gtk_table_attach(GTK_TABLE(table), folder_color_btn,
281                          1, 2, rowcount, rowcount + 1,
282                          GTK_SHRINK, 0, 0, 0);
283
284         page->item->prefs->color = item->prefs->color;
285
286         gtk_signal_connect(GTK_OBJECT(folder_color_btn), "clicked",
287                            GTK_SIGNAL_FUNC(folder_color_set_dialog),
288                            page);
289
290         set_button_color(item->prefs->color, folder_color_btn);
291
292         rowcount++;
293
294         page->window = GTK_WIDGET(window);
295         page->table = table;
296         page->checkbtn_request_return_receipt = checkbtn_request_return_receipt;
297         page->checkbtn_save_copy_to_folder = checkbtn_save_copy_to_folder;
298         page->checkbtn_default_to = checkbtn_default_to;
299         page->entry_default_to = entry_default_to;
300         page->checkbtn_default_reply_to = checkbtn_default_reply_to;
301         page->entry_default_reply_to = entry_default_reply_to;
302         page->checkbtn_simplify_subject = checkbtn_simplify_subject;
303         page->entry_simplify_subject = entry_simplify_subject;
304         page->checkbtn_folder_chmod = checkbtn_folder_chmod;
305         page->entry_folder_chmod = entry_folder_chmod;
306         page->checkbtn_enable_default_account = checkbtn_enable_default_account;
307         page->optmenu_default_account = optmenu_default_account;
308         page->folder_color = folder_color;
309         page->folder_color_btn = folder_color_btn;
310
311         address_completion_start(page->window);
312
313         page->page.widget = table;
314 }
315
316 void prefs_folder_item_settings_destroy_widget_func(PrefsPage *_page) 
317 {
318         struct FolderItemSettingsPage *page = (struct FolderItemSettingsPage *) _page;
319
320         address_completion_unregister_entry(GTK_ENTRY(page->entry_default_to));
321         address_completion_unregister_entry(GTK_ENTRY(page->entry_default_reply_to));
322         address_completion_end(page->window);
323 }
324
325 void prefs_folder_item_settings_save_func(PrefsPage *_page) 
326 {
327         gchar *buf;
328         struct FolderItemSettingsPage *page = (struct FolderItemSettingsPage *) _page;
329         FolderItemPrefs *prefs = page->item->prefs;
330         GtkWidget *menu;
331         GtkWidget *menuitem;
332         gboolean   old_simplify_val;
333         gchar     *old_simplify_str;
334
335         g_return_if_fail(prefs != NULL);
336
337         old_simplify_val = prefs->enable_simplify_subject;
338         old_simplify_str = prefs->simplify_subject_regexp;
339
340         prefs->request_return_receipt = 
341             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_request_return_receipt));
342         /* MIGRATION */    
343         page->item->ret_rcpt = prefs->request_return_receipt;
344
345         prefs->save_copy_to_folder = 
346             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_save_copy_to_folder));
347
348         prefs->enable_default_to = 
349             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_to));
350         g_free(prefs->default_to);
351         prefs->default_to = 
352             gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_to), 0, -1);
353
354         prefs->enable_default_reply_to = 
355             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_default_reply_to));
356         g_free(prefs->default_reply_to);
357         prefs->default_reply_to = 
358             gtk_editable_get_chars(GTK_EDITABLE(page->entry_default_reply_to), 0, -1);
359
360         prefs->enable_simplify_subject =
361             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_simplify_subject));
362         prefs->simplify_subject_regexp = 
363             gtk_editable_get_chars(GTK_EDITABLE(page->entry_simplify_subject), 0, -1);
364         
365 /*
366         if (page->item == page->folderview->summaryview->folder_item &&
367             (prefs->enable_simplify_subject != old_simplify_val ||  
368             0 != strcmp2(prefs->simplify_subject_regexp, old_simplify_str))) {
369                 summary_clear_all(page->folderview->summaryview);
370                 page->folderview->opened = NULL;
371                 page->folderview->selected = NULL;
372                 folderview_select(page->folderview, page->item);
373         }
374 */
375         if (old_simplify_str) g_free(old_simplify_str);
376
377         prefs->enable_folder_chmod = 
378             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_folder_chmod));
379         buf = gtk_editable_get_chars(GTK_EDITABLE(page->entry_folder_chmod), 0, -1);
380         prefs->folder_chmod = prefs_folder_item_chmod_mode(buf);
381         g_free(buf);
382
383         prefs->enable_default_account = 
384             gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_enable_default_account));
385         menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(page->optmenu_default_account));
386         menuitem = gtk_menu_get_active(GTK_MENU(menu));
387         prefs->default_account = GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(menuitem)));
388
389         prefs->color = page->item->prefs->color;
390         /* update folder view */
391         if (prefs->color > 0)
392                 folder_item_update(page->item, F_ITEM_UPDATE_MSGCNT);
393
394         folder_item_prefs_save_config(page->item);
395 }
396
397 gint prefs_folder_item_chmod_mode(gchar *folder_chmod) 
398 {
399         gint newmode = 0;
400         gchar *tmp;
401
402         if (folder_chmod) {
403                 newmode = strtol(folder_chmod, &tmp, 8);
404                 if (!(*(folder_chmod) && !(*tmp)))
405                         newmode = 0;
406         }
407
408         return newmode;
409 }
410
411 static void set_button_color(guint rgbvalue, GtkWidget *button)
412 {
413         GtkStyle *newstyle;
414         GdkColor gdk_color;
415
416         gtkut_convert_int_to_gdk_color(rgbvalue, &gdk_color);
417         newstyle = gtk_style_copy(gtk_widget_get_default_style());
418         newstyle->bg[GTK_STATE_NORMAL]   = gdk_color;
419         newstyle->bg[GTK_STATE_PRELIGHT] = gdk_color;
420         newstyle->bg[GTK_STATE_ACTIVE]   = gdk_color;
421         gtk_widget_set_style(GTK_WIDGET(button), newstyle);
422 }
423
424 static void folder_color_set_dialog(GtkWidget *widget, gpointer data)
425 {
426         struct FolderItemSettingsPage *page = (struct FolderItemSettingsPage *) data;
427         GtkColorSelectionDialog *dialog;
428         gdouble color[4] = {0.0, 0.0, 0.0, 0.0};
429         guint rgbcolor;
430
431         page->color_dialog = gtk_color_selection_dialog_new(_("Pick color for folder"));
432         gtk_window_set_position(GTK_WINDOW(page->color_dialog), GTK_WIN_POS_CENTER);
433         gtk_window_set_modal(GTK_WINDOW(page->color_dialog), TRUE);
434         gtk_window_set_policy(GTK_WINDOW(page->color_dialog), FALSE, FALSE, FALSE);
435         manage_window_set_transient(GTK_WINDOW(page->color_dialog));
436
437         gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(page->color_dialog)->ok_button),
438                            "clicked", GTK_SIGNAL_FUNC(folder_color_set_dialog_ok), data);
439         gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(page->color_dialog)->cancel_button),
440                            "clicked", GTK_SIGNAL_FUNC(folder_color_set_dialog_cancel), data);
441         gtk_signal_connect(GTK_OBJECT(page->color_dialog), "key_press_event",
442                            GTK_SIGNAL_FUNC(folder_color_set_dialog_key_pressed),
443                            data);
444
445         rgbcolor = page->item->prefs->color;
446         color[0] = (gdouble) ((rgbcolor & 0xff0000) >> 16) / 255.0;
447         color[1] = (gdouble) ((rgbcolor & 0x00ff00) >>  8) / 255.0;
448         color[2] = (gdouble)  (rgbcolor & 0x0000ff)        / 255.0;
449
450         dialog = GTK_COLOR_SELECTION_DIALOG(page->color_dialog);
451         gtk_color_selection_set_color(GTK_COLOR_SELECTION(dialog->colorsel), color);
452
453         gtk_widget_show(page->color_dialog);
454 }
455
456 static void folder_color_set_dialog_ok(GtkWidget *widget, gpointer data)
457 {
458         struct FolderItemSettingsPage *page = (struct FolderItemSettingsPage *) data;
459         GtkColorSelection *colorsel = (GtkColorSelection *)
460                                 ((GtkColorSelectionDialog *) page->color_dialog)->colorsel;
461         gdouble color[4];
462         guint red, green, blue, rgbvalue;
463
464         gtk_color_selection_get_color(colorsel, color);
465
466         red      = (guint) (color[0] * 255.0);
467         green    = (guint) (color[1] * 255.0);
468         blue     = (guint) (color[2] * 255.0);
469         rgbvalue = (guint) ((red * 0x10000) | (green * 0x100) | blue);
470
471         page->item->prefs->color = rgbvalue;
472         set_button_color(rgbvalue, page->folder_color_btn);
473
474         gtk_widget_destroy(page->color_dialog);
475 }
476
477 static void folder_color_set_dialog_cancel(GtkWidget *widget, gpointer data)
478 {
479         struct FolderItemSettingsPage *page = (struct FolderItemSettingsPage *) data;
480         gtk_widget_destroy(page->color_dialog);
481 }
482
483 static void folder_color_set_dialog_key_pressed(GtkWidget *widget,
484                                                 GdkEventKey *event,
485                                                 gpointer data)
486 {
487         struct FolderItemSettingsPage *page = (struct FolderItemSettingsPage *) data;
488         gtk_widget_destroy(page->color_dialog);
489 }
490
491 struct FolderItemSettingsPage folder_item_settings_page;
492
493 static void register_settings_page()
494 {
495         folder_item_settings_page.page.path = "Settings";
496         folder_item_settings_page.page.create_widget = prefs_folder_item_settings_create_widget_func;
497         folder_item_settings_page.page.destroy_widget = prefs_folder_item_settings_destroy_widget_func;
498         folder_item_settings_page.page.save_page = prefs_folder_item_settings_save_func;
499         
500         prefs_folder_item_register_page((PrefsPage *) &folder_item_settings_page);
501 }
502
503 static GSList *prefs_pages = NULL;
504
505 void prefs_folder_item_open(FolderItem *item)
506 {
507         if (prefs_pages == NULL) {
508                 register_settings_page();
509         }
510
511         prefswindow_open(_("Settings for folder"), prefs_pages, item);
512 }
513
514 void prefs_folder_item_register_page(PrefsPage *page)
515 {
516         prefs_pages = g_slist_append(prefs_pages, page);
517 }
518
519 void prefs_folder_item_unregister_page(PrefsPage *page)
520 {
521         prefs_pages = g_slist_remove(prefs_pages, page);
522 }