diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/colorlabel.c | 34 | ||||
-rw-r--r-- | src/colorlabel.h | 3 | ||||
-rw-r--r-- | src/main.c | 2 |
4 files changed, 45 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2009-12-24 + + * src/colorlabel.[ch] + src/main.c: made color label text customizable + (~/.sylpheed-2.0/colorlabelrc). + 2009-12-22 * src/colorlabel.[ch]: implemented a feature to change color label diff --git a/src/colorlabel.c b/src/colorlabel.c index 6f742111..d1d0df0a 100644 --- a/src/colorlabel.c +++ b/src/colorlabel.c @@ -41,6 +41,7 @@ #include "colorlabel.h" #include "gtkutils.h" #include "utils.h" +#include "prefs.h" static gchar *labels[] = { N_("Orange"), @@ -356,3 +357,36 @@ void colorlabel_update_menu(void) } } } + +gint colorlabel_read_config(void) +{ + gchar *path; + FILE *fp; + gint i; + gchar buf[PREFSBUFSIZE]; + + path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "colorlabelrc", + NULL); + if ((fp = g_fopen(path, "rb")) == NULL) { + g_free(path); + return -1; + } + + for (i = 0; i < LABEL_COLORS_ELEMS; i++) { + if (fgets(buf, sizeof(buf), fp) == NULL) + break; + g_strstrip(buf); + if (buf[0] != '\0') { + colorlabel_set_color_text(i, buf); + } + } + + fclose(fp); + g_free(path); + + return 0; +} + +void colorlabel_write_config(void) +{ +} diff --git a/src/colorlabel.h b/src/colorlabel.h index 26f43d55..cf71df82 100644 --- a/src/colorlabel.h +++ b/src/colorlabel.h @@ -34,4 +34,7 @@ GtkWidget *colorlabel_create_color_menu (void); guint colorlabel_get_color_menu_active_item (GtkWidget *menu); void colorlabel_update_menu (void); +gint colorlabel_read_config (void); +void colorlabel_write_config (void); + #endif /* COLORLABEL_H__ */ @@ -85,6 +85,7 @@ #include "plugin_manager.h" #include "foldersel.h" #include "update_check.h" +#include "colorlabel.h" #if USE_GPGME # include "rfc2015.h" @@ -259,6 +260,7 @@ int main(int argc, char *argv[]) filter_read_config(); prefs_actions_read_config(); prefs_display_header_read_config(); + colorlabel_read_config(); #ifdef G_OS_WIN32 { |