Re: [Proposal] Improve IMAP folder parent selection, subscription management
Albrecht Dreß <[email protected]> Wed, 27 Mar 2019 21:59:17 +0100
| Newsgroups | gmane.comp.gnome.apps.balsa |
|---|---|
| Message-ID | <[email protected]> |
Hi Peter! Am 27.03.19 16:16 schrieb(en) Peter Bloomfield: > I have only one question: you use a series of defined constants to label the columns of the GtkTreeStore, where elsewhere Balsa (mostly?) uses an enumeration; the enumeration can be extended with a final *_N_COLS member which avoids hard-coding the column count. Any particular reason to prefer defined constants? You're of course right, and to be honest, I have to admit that I just forgot to fix the consts when cleaning up the patch for submission… Attached is a small patch, on top of the first one, fixing this. Thanks a lot for pointing me to that! Cheers, Albrecht. _______________________________________________ balsa-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/balsa-list
fix-imap-scanner-consts.diff
(text/x-patch, 1.6 KB)
diff --git a/libbalsa/folder-scanners.c b/libbalsa/folder-scanners.c
index c20d21af0..1788ac6c0 100644
--- a/libbalsa/folder-scanners.c
+++ b/libbalsa/folder-scanners.c
@@ -499,7 +499,8 @@ libbalsa_scanner_imap_tree(LibBalsaServer *server,
libbalsa_imap_server_release_handle(LIBBALSA_IMAP_SERVER(server), scan_data.handle);
/* create the resulting tree store */
- imap_store.store = gtk_tree_store_new(5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, PANGO_TYPE_STYLE);
+ imap_store.store = gtk_tree_store_new(LB_SCANNER_IMAP_N_COLS,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, PANGO_TYPE_STYLE);
g_hash_table_foreach(folders, (GHFunc) imap_tree_to_store, &imap_store);
g_hash_table_unref(folders);
} else {
diff --git a/libbalsa/folder-scanners.h b/libbalsa/folder-scanners.h
index b501d147e..857b55bfb 100644
--- a/libbalsa/folder-scanners.h
+++ b/libbalsa/folder-scanners.h
@@ -66,13 +66,16 @@ void libbalsa_scanner_imap_dir(gpointer rnode, LibBalsaServer * server,
GtkTreeStore *libbalsa_scanner_imap_tree(LibBalsaServer *server,
gboolean subscriptions,
GError **error)
-G_GNUC_WARN_UNUSED_RESULT;
+ G_GNUC_WARN_UNUSED_RESULT;
-#define LB_SCANNER_IMAP_FOLDER 0
-#define LB_SCANNER_IMAP_PATH 1
-#define LB_SCANNER_IMAP_SUBS_NEW 2
-#define LB_SCANNER_IMAP_SUBS_OLD 3
-#define LB_SCANNER_IMAP_STYLE 4
+typedef enum {
+ LB_SCANNER_IMAP_FOLDER = 0,
+ LB_SCANNER_IMAP_PATH,
+ LB_SCANNER_IMAP_SUBS_NEW,
+ LB_SCANNER_IMAP_SUBS_OLD,
+ LB_SCANNER_IMAP_STYLE,
+ LB_SCANNER_IMAP_N_COLS
+} lb_scanner_imap_tree_cols_t;
#endif /* __FOLDER_SCANNERS_H__ */
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlyb5CUACgkQTKlvDmfn 2fhw5gf/ZuviYE2mN6YC4EuQWKBB7td7siXzgOXe6zoMJGq/nahLIDe016vecAfS KbHa6dngZRm7i/HGUz+wnQe+v3jwXmlOAYw2MoluGLlR3TlEoMGse6/cAgpuDDE5 hlymhAkNVHQZQZWUtxLeEuAiXqT5ydGEbC6n2efkro+IaQkmHQ/iFxSefYBoM9RV 6uTfH0RtSNEtza3TY+yKRfKENO3CuoxZ3WGSgG4SjmIP+bjtvuaQ4r8FaZB1XmA3 NImqjB+fNz9JpJTgd1hXTaLfjZKe4txCakAtI6GUKPyadZ2IpHw3YhFPSR7Cnpep P6FCshKjsaPrfdFUb5tugFUMF1mAeg== =HtHD -----END PGP SIGNATURE-----