aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-12-24 07:44:55 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-12-24 07:44:55 +0000
commitf0ded112875ffa7337d442bd05abdd97170d8dc1 (patch)
tree259b8bfc77fddba331500754053f09aebcb6b5b7
parent8e167b57790543c62623e5f477d225a52bf9f9c1 (diff)
made color label text customizable (~/.sylpheed-2.0/colorlabelrc).
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2406 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--src/colorlabel.c34
-rw-r--r--src/colorlabel.h3
-rw-r--r--src/main.c2
4 files changed, 45 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 393529d2..0c586289 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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__ */
diff --git a/src/main.c b/src/main.c
index aa69bc31..eb8cd860 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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
{