summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xChangeLog8
-rwxr-xr-xsrc/calendar.c14
-rwxr-xr-xsrc/calendar.h4
-rwxr-xr-xsrc/custom.c10
-rwxr-xr-xsrc/custom.h3
-rwxr-xr-xsrc/io.c6
6 files changed, 39 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3dc5e5c..5336544 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,14 @@
* src/help.c: description of the scroll keys added to the generic
keys help screen
+
+ * src/custom.c (custom_load_conf): new configuration variable
+ added to define the default calendar view
+
+ * src/calendar.c (calendar_set_view, calendar_get_view): new
+ functions
+
+ * src/io.c (io_save_conf): save the calendar default view
2009-10-16 Frederic Culot <frederic@culot.org>
diff --git a/src/calendar.c b/src/calendar.c
index 811d23c..84dd207 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,4 +1,4 @@
-/* $calcurse: calendar.c,v 1.29 2009/10/16 15:52:00 culot Exp $ */
+/* $calcurse: calendar.c,v 1.30 2009/10/28 15:15:43 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -101,6 +101,18 @@ calendar_view_prev (void)
calendar_view--;
}
+void
+calendar_set_view (int view)
+{
+ calendar_view = (view < 0 || view >= CAL_VIEWS) ? CAL_MONTH_VIEW : view;
+}
+
+int
+calendar_get_view (void)
+{
+ return (int)calendar_view;
+}
+
/* Thread needed to update current date in calendar. */
/* ARGSUSED0 */
static void *
diff --git a/src/calendar.h b/src/calendar.h
index 5b20238..60499a7 100755
--- a/src/calendar.h
+++ b/src/calendar.h
@@ -1,4 +1,4 @@
-/* $calcurse: calendar.h,v 1.17 2009/08/25 14:51:42 culot Exp $ */
+/* $calcurse: calendar.h,v 1.18 2009/10/28 15:15:43 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -106,6 +106,8 @@ move_t;
void calendar_view_next (void);
void calendar_view_prev (void);
+void calendar_set_view (int);
+int calendar_get_view (void);
void calendar_start_date_thread (void);
void calendar_stop_date_thread (void);
void calendar_set_current_date (void);
diff --git a/src/custom.c b/src/custom.c
index 21211cd..34470c9 100755
--- a/src/custom.c
+++ b/src/custom.c
@@ -1,4 +1,4 @@
-/* $calcurse: custom.c,v 1.44 2009/08/02 09:29:24 culot Exp $ */
+/* $calcurse: custom.c,v 1.45 2009/10/28 15:15:44 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -273,6 +273,10 @@ custom_load_conf (conf_t *conf, int background)
conf->skip_progress_bar = fill_config_var (e_conf);
var = 0;
break;
+ case CUSTOM_CONF_CALENDAR_DEFAULTVIEW:
+ calendar_set_view (atoi (e_conf));
+ var = 0;
+ break;
case CUSTOM_CONF_WEEKBEGINSONMONDAY:
if (fill_config_var (e_conf))
calendar_set_first_day_of_week (MONDAY);
@@ -344,7 +348,9 @@ custom_load_conf (conf_t *conf, int background)
var = CUSTOM_CONF_SKIPSYSTEMDIALOGS;
else if (strncmp (e_conf, "skip_progress_bar=", 18) == 0)
var = CUSTOM_CONF_SKIPPROGRESSBAR;
- else if (strncmp (e_conf, "week_begins_on_monday=", 23) == 0)
+ else if (strncmp (e_conf, "calendar_default_view=", 22) == 0)
+ var = CUSTOM_CONF_CALENDAR_DEFAULTVIEW;
+ else if (strncmp (e_conf, "week_begins_on_monday=", 22) == 0)
var = CUSTOM_CONF_WEEKBEGINSONMONDAY;
else if (strncmp (e_conf, "color-theme=", 12) == 0)
var = CUSTOM_CONF_COLORTHEME;
diff --git a/src/custom.h b/src/custom.h
index 04909fc..bedcdc9 100755
--- a/src/custom.h
+++ b/src/custom.h
@@ -1,4 +1,4 @@
-/* $calcurse: custom.h,v 1.18 2009/08/02 09:29:24 culot Exp $ */
+/* $calcurse: custom.h,v 1.19 2009/10/28 15:15:44 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -66,6 +66,7 @@ enum
CUSTOM_CONF_CONFIRMDELETE,
CUSTOM_CONF_SKIPSYSTEMDIALOGS,
CUSTOM_CONF_SKIPPROGRESSBAR,
+ CUSTOM_CONF_CALENDAR_DEFAULTVIEW,
CUSTOM_CONF_WEEKBEGINSONMONDAY,
CUSTOM_CONF_COLORTHEME,
CUSTOM_CONF_LAYOUT,
diff --git a/src/io.c b/src/io.c
index e563d71..059fc6d 100755
--- a/src/io.c
+++ b/src/io.c
@@ -1,4 +1,4 @@
-/* $calcurse: io.c,v 1.78 2009/08/09 16:00:02 culot Exp $ */
+/* $calcurse: io.c,v 1.79 2009/10/28 15:15:44 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -883,6 +883,10 @@ io_save_conf (conf_t *conf)
"when saving data will not be displayed\n");
(void)fprintf (fp, "skip_progress_bar=\n");
(void)fprintf (fp, "%s\n", (conf->skip_progress_bar) ? "yes" : "no");
+
+ (void)fprintf (fp, "\n# Default calendar view (0)monthly (1)weekly:\n");
+ (void)fprintf (fp, "calendar_default_view=\n");
+ (void)fprintf (fp, "%d\n", calendar_get_view ());
(void)fprintf (fp, "\n# If this option is set to yes, "
"monday is the first day of the week, else it is sunday\n");