aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/prop.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/prop.c')
-rw-r--r--calendar/gui/prop.c127
1 files changed, 125 insertions, 2 deletions
diff --git a/calendar/gui/prop.c b/calendar/gui/prop.c
index 2f24f4551e..dd5130fa1a 100644
--- a/calendar/gui/prop.c
+++ b/calendar/gui/prop.c
@@ -20,7 +20,8 @@
/* These specify the page numbers in the preferences notebook */
enum {
PROP_TIME_DISPLAY,
- PROP_COLORS
+ PROP_COLORS,
+ PROP_TODO
};
static GtkWidget *prop_win; /* The preferences dialog */
@@ -41,7 +42,9 @@ static GtkWidget *end_items[24]; /* Menu items for end of day menu */
static GtkWidget *color_pickers[COLOR_PROP_LAST];
static GnomeCanvasItem *month_item;
-
+/* Widgets for the todo page */
+static GtkWidget *due_date_show_button;
+static GtkWidget *due_date_overdue_highlight;
/* Callback used when the property box is closed -- just sets the prop_win variable to null. */
static int
prop_cancel (void)
@@ -106,6 +109,24 @@ prop_apply_colors (void)
gnome_config_sync ();
colors_changed ();
}
+/* Applies the settings in the todo page (FIX THIS IF ITS NOT WRITTEN) */
+static void
+prop_apply_todo(void)
+{
+ todo_show_due_date = GTK_TOGGLE_BUTTON (due_date_show_button)->active;
+ todo_due_date_overdue_highlight = GTK_TOGGLE_BUTTON (due_date_overdue_highlight)->active;
+
+ /* storing the values */
+ gnome_config_set_bool("/calendar/Todo/show_due_date", todo_show_due_date);
+ gnome_config_set_bool("/calendar/Todo/highlight_overdue_tasks", todo_due_date_overdue_highlight);
+
+ /* need to sync our config changes. */
+ gnome_config_sync ();
+
+ /* apply the current changes */
+ todo_properties_changed();
+}
+
/* Callback used when the Apply button is clicked. */
static void
@@ -120,6 +141,10 @@ prop_apply (GtkWidget *w, int page)
prop_apply_colors ();
break;
+ case PROP_TODO:
+ prop_apply_todo();
+ break;
+
case -1:
break;
@@ -498,6 +523,103 @@ create_colors_page (void)
}
+
+static void
+set_todo_page_options(void)
+{
+ if(!GTK_TOGGLE_BUTTON (due_date_show_button)->active) {
+ /* disable everything */
+ gtk_widget_set_sensitive(due_date_overdue_highlight,0);
+ }
+ else
+ {
+ gtk_widget_set_sensitive(due_date_overdue_highlight,1);
+ }
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+}
+
+static void
+todo_option_set (void)
+{
+ prop_changed ();
+ set_todo_page_options ();
+}
+
+/* Creates the colors page in the preferences dialog */
+static GtkWidget *
+build_list_options_frame(void)
+{
+ GtkWidget *frame;
+ GtkWidget *vbox;
+ frame = gtk_frame_new (_("Show on TODO List:"));
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+
+ due_date_show_button = gtk_check_button_new_with_label (_("Summary"));
+ due_date_show_button = gtk_check_button_new_with_label (_("Due Date"));
+
+ gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_show_button), todo_show_due_date);
+ gtk_signal_connect (GTK_OBJECT(due_date_show_button),
+ "clicked",
+ (GtkSignalFunc) todo_option_set,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), due_date_show_button, FALSE, FALSE, 0);
+ return frame;
+}
+static GtkWidget *
+build_style_list_options_frame(void)
+{
+ GtkWidget *frame;
+ GtkWidget *vbox;
+
+ frame = gtk_frame_new (_("TODO List style options:"));
+
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
+
+ due_date_overdue_highlight = gtk_check_button_new_with_label (_("Highlight overdue items"));
+
+ gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(due_date_overdue_highlight), todo_due_date_overdue_highlight);
+ gtk_signal_connect (GTK_OBJECT(due_date_overdue_highlight),
+ "clicked",
+ (GtkSignalFunc) todo_option_set,
+ NULL);
+ gtk_box_pack_start (GTK_BOX (vbox), due_date_overdue_highlight, FALSE, FALSE, 0);
+ return frame;
+}
+static void
+create_todo_page (void)
+{
+ GtkWidget *frame;
+ GtkWidget *main_box;
+ GtkWidget *hbox;
+
+
+ frame = gtk_frame_new (_("Todo List Properties"));
+ gtk_container_set_border_width (GTK_CONTAINER (frame), GNOME_PAD_SMALL);
+ gnome_property_box_append_page (GNOME_PROPERTY_BOX (prop_win), frame,
+ gtk_label_new (_("Todo List")));
+
+ /* first vbox*/
+ main_box = gtk_vbox_new(FALSE, GNOME_PAD);
+ gtk_container_set_border_width (GTK_CONTAINER (main_box), GNOME_PAD_SMALL);
+ gtk_container_add (GTK_CONTAINER (frame), main_box);
+
+
+ /* first hbox*/
+ hbox = gtk_hbox_new (FALSE, GNOME_PAD);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), GNOME_PAD_SMALL);
+ gtk_container_add (GTK_CONTAINER (main_box), hbox);
+
+ gtk_box_pack_start (GTK_BOX(hbox), build_list_options_frame(), FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(hbox), build_style_list_options_frame(), FALSE, FALSE, 0);
+
+ set_todo_page_options();
+}
+
/* Creates and displays the preferences dialog for the whole application */
void
properties (GtkWidget *toplevel)
@@ -515,6 +637,7 @@ properties (GtkWidget *toplevel)
create_time_display_page ();
create_colors_page ();
+ create_todo_page();
gtk_signal_connect (GTK_OBJECT (prop_win), "destroy",
(GtkSignalFunc) prop_cancel, NULL);