aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/ChangeLog21
-rw-r--r--widgets/misc/e-calendar-item.c83
-rw-r--r--widgets/misc/e-calendar-item.h31
3 files changed, 125 insertions, 10 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 63a790ba23..afc608faa2 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,24 @@
+2000-12-22 JP Rosevear <jpr@helixcode.com>
+
+ * e-calendar-item.h: add prototypes
+
+ * e-calendar-item.c (e_calendar_item_init): Set max_days_selected to
+ 1 and days_to_start_week_selection to -1 as documented in header
+ (e_calendar_item_set_arg): use new accessor methods
+ (e_calendar_item_get_arg): ditto
+ (e_calendar_item_get_max_days_sel): accessor
+ (e_calendar_item_set_max_days_sel): ditto
+ (e_calendar_item_get_days_start_week_sel): ditto
+ (e_calendar_item_set_days_start_week_sel): ditto
+ (e_calendar_item_class_init): add display_popup argument
+ (e_calendar_item_init): initialize display_popup member
+ (e_calendar_item_get_arg): get display_popup member
+ (e_calendar_item_set_arg): set display_popup member
+ (e_calendar_item_button_press): only show the popup menu if the
+ member is set
+ (e_calendar_item_get_display_popup): acessor
+ (e_calendar_item_set_display_popup): ditto
+
2000-12-14 Federico Mena Quintero <federico@helixcode.com>
* e-dateedit.h: #include <time.h>
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 8e0ff1f604..6442d7d7a5 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -240,7 +240,8 @@ enum {
ARG_MAXIMUM_DAYS_SELECTED,
ARG_DAYS_TO_START_WEEK_SELECTION,
ARG_MOVE_SELECTION_WHEN_MOVING,
- ARG_ROUND_SELECTION_WHEN_MOVING
+ ARG_ROUND_SELECTION_WHEN_MOVING,
+ ARG_DISPLAY_POPUP
};
enum {
@@ -330,6 +331,9 @@ e_calendar_item_class_init (ECalendarItemClass *class)
gtk_object_add_arg_type ("ECalendarItem::round_selection_when_moving",
GTK_TYPE_BOOL, GTK_ARG_READWRITE,
ARG_ROUND_SELECTION_WHEN_MOVING);
+ gtk_object_add_arg_type ("ECalendarItem::display_popup",
+ GTK_TYPE_BOOL, GTK_ARG_READWRITE,
+ ARG_DISPLAY_POPUP);
e_calendar_item_signals[DATE_RANGE_CHANGED] =
gtk_signal_new ("date_range_changed",
@@ -393,11 +397,12 @@ e_calendar_item_init (ECalendarItem *calitem)
calitem->show_week_numbers = FALSE;
calitem->week_start_day = 0;
calitem->expand = TRUE;
- calitem->max_days_selected = 42;
- calitem->days_to_start_week_selection = 9;
+ calitem->max_days_selected = 1;
+ calitem->days_to_start_week_selection = -1;
calitem->move_selection_when_moving = TRUE;
calitem->round_selection_when_moving = FALSE;
-
+ calitem->display_popup = TRUE;
+
calitem->x1 = 0.0;
calitem->y1 = 0.0;
calitem->x2 = 0.0;
@@ -503,10 +508,10 @@ e_calendar_item_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
GTK_VALUE_BOOL (*arg) = calitem->show_week_numbers;
break;
case ARG_MAXIMUM_DAYS_SELECTED:
- GTK_VALUE_INT (*arg) = calitem->max_days_selected;
+ GTK_VALUE_INT (*arg) = e_calendar_item_get_max_days_sel (calitem);
break;
case ARG_DAYS_TO_START_WEEK_SELECTION:
- GTK_VALUE_INT (*arg) = calitem->days_to_start_week_selection;
+ GTK_VALUE_INT (*arg) = e_calendar_item_get_days_start_week_sel (calitem);
break;
case ARG_MOVE_SELECTION_WHEN_MOVING:
GTK_VALUE_BOOL (*arg) = calitem->move_selection_when_moving;
@@ -514,6 +519,11 @@ e_calendar_item_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_ROUND_SELECTION_WHEN_MOVING:
GTK_VALUE_BOOL (*arg) = calitem->round_selection_when_moving;
break;
+ case ARG_DISPLAY_POPUP:
+ GTK_VALUE_BOOL (*arg) = e_calendar_item_get_display_popup (calitem);
+ break;
+ default:
+ g_warning ("Invalid arg");
}
}
@@ -639,12 +649,11 @@ e_calendar_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
case ARG_MAXIMUM_DAYS_SELECTED:
ivalue = GTK_VALUE_INT (*arg);
- ivalue = MAX (1, ivalue);
- calitem->max_days_selected = ivalue;
+ e_calendar_item_set_max_days_sel (calitem, ivalue);
break;
case ARG_DAYS_TO_START_WEEK_SELECTION:
ivalue = GTK_VALUE_INT (*arg);
- calitem->days_to_start_week_selection = ivalue;
+ e_calendar_item_set_days_start_week_sel (calitem, ivalue);
break;
case ARG_MOVE_SELECTION_WHEN_MOVING:
bvalue = GTK_VALUE_BOOL (*arg);
@@ -654,6 +663,10 @@ e_calendar_item_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
bvalue = GTK_VALUE_BOOL (*arg);
calitem->round_selection_when_moving = bvalue;
break;
+ case ARG_DISPLAY_POPUP:
+ bvalue = GTK_VALUE_BOOL (*arg);
+ e_calendar_item_set_display_popup (calitem, bvalue);
+ break;
default:
g_warning ("Invalid arg");
}
@@ -1620,7 +1633,8 @@ e_calendar_item_button_press (ECalendarItem *calitem,
&all_week))
return FALSE;
- if (event->button.button == 3 && day == -1) {
+ if (event->button.button == 3 && day == -1
+ && e_calendar_item_get_display_popup (calitem)) {
e_calendar_item_show_popup_menu (calitem,
(GdkEventButton*) event,
month_offset);
@@ -2147,6 +2161,55 @@ e_calendar_item_set_first_month(ECalendarItem *calitem,
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (calitem));
}
+/* Get the maximum number of days selectable */
+gint
+e_calendar_item_get_max_days_sel (ECalendarItem *calitem)
+{
+ return calitem->max_days_selected;
+}
+
+
+/* Set the maximum number of days selectable */
+void
+e_calendar_item_set_max_days_sel (ECalendarItem *calitem,
+ gint days)
+{
+ calitem->max_days_selected = MAX (1, days);
+}
+
+
+/* Get the maximum number of days selectable */
+gint
+e_calendar_item_get_days_start_week_sel(ECalendarItem *calitem)
+{
+ return calitem->days_to_start_week_selection;
+}
+
+
+/* Set the maximum number of days selectable */
+void
+e_calendar_item_set_days_start_week_sel(ECalendarItem *calitem,
+ gint days)
+{
+ calitem->days_to_start_week_selection = days;
+}
+
+/* Set the maximum number of days before whole weeks are selected */
+gboolean
+e_calendar_item_get_display_popup (ECalendarItem *calitem)
+{
+ return calitem->display_popup;
+}
+
+
+/* Get the maximum number of days before whole weeks are selected */
+void
+e_calendar_item_set_display_popup (ECalendarItem *calitem,
+ gboolean display)
+{
+ calitem->display_popup = display;
+}
+
/* This will make sure that the given year & month are valid, i.e. if month
is < 0 or > 11 the year and month will be updated accordingly. */
diff --git a/widgets/misc/e-calendar-item.h b/widgets/misc/e-calendar-item.h
index a5a871228a..f638b16573 100644
--- a/widgets/misc/e-calendar-item.h
+++ b/widgets/misc/e-calendar-item.h
@@ -135,6 +135,9 @@ struct _ECalendarItem
move back/forward one month. Used for the week view. */
gboolean round_selection_when_moving;
+ /* Whether to display the pop-up, TRUE by default */
+ gboolean display_popup;
+
/*
* Internal stuff.
*/
@@ -230,6 +233,34 @@ void e_calendar_item_set_first_month (ECalendarItem *calitem,
gint year,
gint month);
+/* Get the maximum number of days selectable */
+gint e_calendar_item_get_max_days_sel (ECalendarItem *calitem);
+
+/* Set the maximum number of days selectable */
+void e_calendar_item_set_max_days_sel (ECalendarItem *calitem,
+ gint days);
+
+/* Get the maximum number of days selectable */
+gint e_calendar_item_get_days_start_week_sel(ECalendarItem *calitem);
+
+/* Get the maximum number of days before whole weeks are selected */
+void e_calendar_item_set_days_start_week_sel(ECalendarItem *calitem,
+ gint days);
+
+/* Set the maximum number of days before whole weeks are selected */
+gboolean e_calendar_item_get_display_popup (ECalendarItem *calitem);
+
+/* Get the maximum number of days before whole weeks are selected */
+void e_calendar_item_set_display_popup (ECalendarItem *calitem,
+ gboolean display);
+
+/* Set the maximum number of days before whole weeks are selected */
+gint e_calendar_item_get_days_start_week_sel(ECalendarItem *calitem);
+
+/* Set the maximum number of days selectable */
+void e_calendar_item_set_days_start_week_sel(ECalendarItem *calitem,
+ gint days);
+
/* Returns the range of dates actually shown. Months are 0 to 11.
This also includes the last days of the previous month and the first days
of the following month, which are normally shown in gray. */