More plumbing: migrating request return receipt folder setting to folderlist.xml

This commit is contained in:
Alfons Hoogervorst 2001-09-23 01:19:22 +00:00
parent 0ea5c4e273
commit 7e48c3731a
5 changed files with 42 additions and 9 deletions

View file

@ -1,3 +1,9 @@
2001-09-23 [alfons]
* src/folder.[ch], prefs_folder_item.c, compose.c
migrate "request return receipt" folder property
to folderlist.xml
2001-09-22 [alfons]
* README.claws **NEW**

View file

@ -520,7 +520,7 @@ Compose * compose_generic_new(PrefsAccount *account, const gchar *to, FolderItem
gtk_widget_grab_focus(compose->header_last->entry);
}
}
if(item && item->prefs->request_return_receipt) {
if (item && item->ret_rcpt) {
GtkItemFactory *ifactory;
ifactory = gtk_item_factory_from_widget(compose->menubar);
@ -643,7 +643,7 @@ static void compose_generic_reply(MsgInfo *msginfo, gboolean quote,
compose->use_to = TRUE;
}
*/
if(msginfo->folder && msginfo->folder->prefs->request_return_receipt) {
if (msginfo->folder && msginfo->folder->ret_rcpt) {
GtkItemFactory *ifactory;
ifactory = gtk_item_factory_from_widget(compose->menubar);

View file

@ -157,6 +157,7 @@ FolderItem *folder_item_new(const gchar *name, const gchar *path)
item->no_select = FALSE;
item->collapsed = FALSE;
item->threaded = FALSE;
item->ret_rcpt = FALSE;
item->parent = NULL;
item->folder = NULL;
item->data = NULL;
@ -1040,7 +1041,8 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
const gchar *name = NULL;
const gchar *path = NULL;
PrefsAccount *account = NULL;
gboolean no_sub = FALSE, no_select = FALSE, collapsed = FALSE, threaded = FALSE;
gboolean no_sub = FALSE, no_select = FALSE, collapsed = FALSE,
threaded = FALSE, ret_rcpt = FALSE;
gint mtime = 0, new = 0, unread = 0, total = 0;
g_return_val_if_fail(node->data != NULL, FALSE);
@ -1094,6 +1096,8 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
collapsed = *attr->value == '1' ? TRUE : FALSE;
else if (!strcmp(attr->name, "threaded"))
threaded = *attr->value == '1' ? TRUE : FALSE;
else if (!strcmp(attr->name, "reqretrcpt"))
ret_rcpt = *attr->value == '1' ? TRUE : FALSE;
}
item = folder_item_new(name, path);
@ -1107,6 +1111,7 @@ static gboolean folder_build_tree(GNode *node, gpointer data)
item->no_select = no_select;
item->collapsed = collapsed;
item->threaded = threaded;
item->ret_rcpt = ret_rcpt;
item->parent = FOLDER_ITEM(node->parent->data);
item->folder = folder;
switch (stype) {
@ -1136,7 +1141,7 @@ static gboolean folder_read_folder_func(GNode *node, gpointer data)
const gchar *name = NULL;
const gchar *path = NULL;
PrefsAccount *account = NULL;
gboolean collapsed = FALSE, threaded = FALSE;
gboolean collapsed = FALSE, threaded = FALSE, ret_rcpt = FALSE;
if (g_node_depth(node) != 2) return FALSE;
g_return_val_if_fail(node->data != NULL, FALSE);
@ -1175,6 +1180,8 @@ static gboolean folder_read_folder_func(GNode *node, gpointer data)
collapsed = *attr->value == '1' ? TRUE : FALSE;
else if (!strcmp(attr->name, "threaded"))
threaded = *attr->value == '1' ? TRUE : FALSE;
else if (!strcmp(attr->name, "reqretrcpt"))
ret_rcpt = *attr->value == '1' ? TRUE : FALSE;
}
folder = folder_new(type, name, path);
@ -1188,6 +1195,7 @@ static gboolean folder_read_folder_func(GNode *node, gpointer data)
folder_add(folder);
FOLDER_ITEM(node->data)->collapsed = collapsed;
FOLDER_ITEM(node->data)->threaded = threaded;
FOLDER_ITEM(node->data)->ret_rcpt = ret_rcpt;
g_node_traverse(node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
folder_build_tree, folder);
@ -1243,6 +1251,8 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
fputs(" collapsed=\"1\"", fp);
if (item->threaded)
fputs(" threaded=\"1\"", fp);
if (item->ret_rcpt)
fputs(" reqretrcpt=\"1\"", fp);
} else {
fprintf(fp, "<folderitem type=\"%s\"",
folder_item_stype_str[item->stype]);
@ -1267,6 +1277,8 @@ static void folder_write_list_recursive(GNode *node, gpointer data)
fputs(" collapsed=\"1\"", fp);
if (item->threaded)
fputs(" threaded=\"1\"", fp);
if (item->ret_rcpt)
fputs(" reqretrcpt=\"1\"", fp);
fprintf(fp,
" mtime=\"%ld\" new=\"%d\" unread=\"%d\" total=\"%d\"",
item->mtime, item->new, item->unread, item->total);

View file

@ -216,10 +216,11 @@ struct _FolderItem
gint last_num;
/* special flags */
guint no_sub : 1; /* no child allowed? */
guint no_select : 1; /* not selectable? */
guint collapsed : 1; /* collapsed item */
guint no_sub : 1; /* no child allowed? */
guint no_select : 1; /* not selectable? */
guint collapsed : 1; /* collapsed item */
guint threaded : 1; /* threaded folder view */
guint ret_rcpt : 1; /* return receipt */
gint op_count;

View file

@ -17,6 +17,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* alfons - all folder item specific settings should migrate into
* folderlist.xml!!! the old folderitemrc file will only serve for a few
* versions (for compatibility) */
#include "intl.h"
#include "defs.h"
#include "folder.h"
@ -59,6 +63,7 @@ static PrefParam param[] = {
NULL, NULL, NULL},
{"important_score", "1", &tmp_prefs.important_score, P_INT,
NULL, NULL, NULL},
/* MIGRATION */
{"request_return_receipt", "", &tmp_prefs.request_return_receipt, P_BOOL,
NULL, NULL, NULL},
{"enable_default_to", "", &tmp_prefs.enable_default_to, P_BOOL,
@ -88,7 +93,10 @@ void prefs_folder_item_read_config(FolderItem * item)
prefs_read_config(param, id, FOLDERITEM_RC);
g_free(id);
* item->prefs = tmp_prefs;
*item->prefs = tmp_prefs;
/* MIGRATION */
item->ret_rcpt = tmp_prefs.request_return_receipt ? TRUE : FALSE;
}
void prefs_folder_item_save_config(FolderItem * item)
@ -101,6 +109,9 @@ void prefs_folder_item_save_config(FolderItem * item)
prefs_save_config(param, id, FOLDERITEM_RC);
g_free(id);
/* MIGRATION: make sure migrated items are not saved
*/
}
void prefs_folder_item_set_config(FolderItem * item,
@ -255,7 +266,7 @@ void prefs_folder_item_create(FolderItem *item) {
PACK_CHECK_BUTTON(vbox, checkbtn_request_return_receipt,
_("Request Return Receipt"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_request_return_receipt),
item->prefs->request_return_receipt);
item->ret_rcpt);
/* Default To */
hbox = gtk_hbox_new(FALSE, 8);
@ -333,6 +344,9 @@ void prefs_folder_item_ok_cb(GtkWidget *widget, struct PrefsFolderItemDialog *di
prefs->request_return_receipt =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_request_return_receipt));
/* MIGRATION */
dialog->item->ret_rcpt = prefs->request_return_receipt;
prefs->enable_default_to =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->checkbtn_default_to));
g_free(prefs->default_to);