aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog19
-rw-r--r--calendar/conduits/todo/todo-conduit.c29
-rw-r--r--calendar/gui/e-meeting-model.c1
-rw-r--r--calendar/gui/e-meeting-time-sel-item.c12
-rw-r--r--calendar/gui/e-meeting-time-sel.c84
-rw-r--r--calendar/gui/e-meeting-time-sel.h3
6 files changed, 127 insertions, 21 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index cad1384305..48b1693825 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,22 @@
+2001-10-24 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-meeting-time-sel.c (e_meeting_time_selector_construct):
+ track the spacer vbox
+ (e_meeting_time_selector_style_set): make sure the rows are the
+ correct size for the style
+
+ * gui/e-meeting-time-sel-item.c
+ (e_meeting_time_selector_item_paint_day_top): slight adjustments
+ to where the text is drawn
+
+ * gui/e-meeting-time-sel.h: new member
+
+ * gui/e-meeting-model.c (build_etable): ensure uniform row height
+
+ * conduits/todo/todo-conduit.c (comp_from_remote_record): mark
+ status as completed in appropriate places and don't overwrite
+ legitimate percentages and such
+
2001-10-24 Federico Mena Quintero <federico@ximian.com>
Fixes bug #5282.
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index ed039b10b7..930a5dfd96 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -359,7 +359,7 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
{
const char *uid;
int *priority;
- struct icaltimetype *completed;
+ icalproperty_status status;
CalComponentText summary;
GSList *d_list = NULL;
CalComponentText *description;
@@ -427,12 +427,12 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
}
cal_component_free_datetime (&due);
- cal_component_get_completed (comp, &completed);
- if (completed) {
+ cal_component_get_status (comp, &status);
+ if (status == ICAL_STATUS_COMPLETED)
local->todo->complete = 1;
- cal_component_free_icaltimetype (completed);
- }
-
+ else
+ local->todo->complete = 0;
+
cal_component_get_priority (comp, &priority);
if (priority && *priority != 0) {
if (*priority <= 3)
@@ -545,6 +545,23 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
cal_component_set_completed (comp, &now);
cal_component_set_percent (comp, &percent);
+ cal_component_set_status (comp, ICAL_STATUS_COMPLETED);
+ } else {
+ int *percent;
+ icalproperty_status status;
+
+ cal_component_set_completed (comp, NULL);
+
+ cal_component_get_percent (comp, &percent);
+ if (percent == NULL || *percent == 100) {
+ int p = 0;
+ cal_component_set_percent (comp, &p);
+ }
+ cal_component_free_percent (percent);
+
+ cal_component_get_status (comp, &status);
+ if (status == ICAL_STATUS_COMPLETED)
+ cal_component_set_status (comp, ICAL_STATUS_NEEDSACTION);
}
if (!is_empty_time (todo.due)) {
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index f787896801..24e8913431 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -740,6 +740,7 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil
etable = e_table_scrolled_new_from_spec_file (model, extras, spec_file, NULL);
real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (etable));
+ gtk_object_set (GTK_OBJECT (real_table), "uniform_row_height", TRUE, NULL);
e_table_load_state (real_table, state_file);
#if 0
diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c
index 9b6db87208..a16ed6fe52 100644
--- a/calendar/gui/e-meeting-time-sel-item.c
+++ b/calendar/gui/e-meeting-time-sel-item.c
@@ -488,22 +488,22 @@ e_meeting_time_selector_item_paint_day_top (EMeetingTimeSelectorItem *mts_item,
clip_rect.height = mts->row_height - 2;
gdk_gc_set_clip_rectangle (gc, &clip_rect);
gdk_draw_string (drawable, font, gc,
- x + 4, 4 + font->ascent - scroll_y, buffer);
+ x + 2, 4 + font->ascent - scroll_y, buffer);
gdk_gc_set_clip_rectangle (gc, NULL);
/* Draw the hours. */
hour = mts->first_hour_shown;
- hour_x = x;
+ hour_x = x + 2;
hour_y = mts->row_height + 4 + font->ascent - scroll_y;
while (hour < mts->last_hour_shown) {
if (calendar_config_get_24_hour_format ())
gdk_draw_string (drawable, font, gc,
- hour_x - (mts->hour_widths[hour] / 2),
- hour_y, EMeetingTimeSelectorHours[hour]);
+ hour_x, hour_y,
+ EMeetingTimeSelectorHours[hour]);
else
gdk_draw_string (drawable, font, gc,
- hour_x - (mts->hour_widths[hour] / 2),
- hour_y, EMeetingTimeSelectorHours12[hour]);
+ hour_x, hour_y,
+ EMeetingTimeSelectorHours12[hour]);
hour += mts->zoomed_out ? 3 : 1;
hour_x += mts->col_width;
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index 3e293b2bcd..ebfb05857b 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -55,10 +55,13 @@
#include <gal/widgets/e-canvas.h>
#include <gal/widgets/e-canvas-utils.h>
+#include <gal/widgets/e-font.h>
#include <gal/e-table/e-cell-combo.h>
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-table-simple.h>
#include <gal/e-table/e-table-scrolled.h>
+#include <gal/e-table/e-table-header-item.h>
+#include <gal/e-table/e-table-header-utils.h>
#include <widgets/misc/e-dateedit.h>
#include "component-factory.h"
@@ -109,6 +112,8 @@ static void e_meeting_time_selector_autopick_menu_detacher (GtkWidget *widget,
GtkMenu *menu);
static void e_meeting_time_selector_realize (GtkWidget *widget);
static void e_meeting_time_selector_unrealize (GtkWidget *widget);
+static void e_meeting_time_selector_style_set (GtkWidget *widget,
+ GtkStyle *previous_style);
static gint e_meeting_time_selector_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static void e_meeting_time_selector_draw (GtkWidget *widget,
@@ -178,7 +183,7 @@ static EMeetingFreeBusyPeriod* e_meeting_time_selector_find_time_clash (EMeeting
static void e_meeting_time_selector_recalc_grid (EMeetingTimeSelector *mts);
static void e_meeting_time_selector_recalc_date_format (EMeetingTimeSelector *mts);
static void e_meeting_time_selector_save_position (EMeetingTimeSelector *mts,
- EMeetingTime*mtstime);
+ EMeetingTime *mtstime);
static void e_meeting_time_selector_restore_position (EMeetingTimeSelector *mts,
EMeetingTime*mtstime);
static void e_meeting_time_selector_on_start_time_changed (GtkWidget *widget,
@@ -242,6 +247,7 @@ e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * klass)
widget_class->realize = e_meeting_time_selector_realize;
widget_class->unrealize = e_meeting_time_selector_unrealize;
+ widget_class->style_set = e_meeting_time_selector_style_set;
widget_class->expose_event = e_meeting_time_selector_expose_event;
widget_class->draw = e_meeting_time_selector_draw;
}
@@ -271,7 +277,7 @@ void
e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *emm)
{
GtkWidget *hbox, *vbox, *separator, *button, *label, *table;
- GtkWidget *alignment, *child_hbox, *child_vbox, *arrow, *menuitem;
+ GtkWidget *alignment, *child_hbox, *arrow, *menuitem;
GSList *group;
GdkVisual *visual;
GdkColormap *colormap;
@@ -313,10 +319,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *em
vbox, 0, 1, 0, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (vbox);
- child_vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_set_usize (child_vbox, 1, mts->row_height * 2 - 6);
- gtk_box_pack_start (GTK_BOX (vbox), child_vbox, FALSE, FALSE, 0);
- gtk_widget_show (child_vbox);
+ mts->attendees_vbox_spacer = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), mts->attendees_vbox_spacer, FALSE, FALSE, 0);
+ gtk_widget_show (mts->attendees_vbox_spacer);
mts->attendees_vbox = gtk_vbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), mts->attendees_vbox, TRUE, TRUE, 0);
@@ -344,7 +349,7 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *em
gtk_box_pack_start (GTK_BOX (mts->attendees_vbox), mts->etable, TRUE, TRUE, 2);
gtk_widget_show (mts->etable);
g_free (filename);
-
+
/* The free/busy information */
mts->display_top = gnome_canvas_new ();
gtk_widget_set_usize (mts->display_top, -1, mts->row_height * 3);
@@ -824,7 +829,6 @@ static void
e_meeting_time_selector_destroy (GtkObject *object)
{
EMeetingTimeSelector *mts;
- ETable *real_table;
mts = E_MEETING_TIME_SELECTOR (object);
@@ -866,6 +870,70 @@ e_meeting_time_selector_unrealize (GtkWidget *widget)
(*GTK_WIDGET_CLASS (parent_class)->unrealize)(widget);
}
+static void
+e_meeting_time_selector_style_set (GtkWidget *widget,
+ GtkStyle *previous_style)
+{
+ EMeetingTimeSelector *mts;
+ EMeetingTime saved_time;
+ ETable *real_table;
+ ETableHeader *eth;
+ GdkFont *font;
+ EFont *efont;
+ int hour, max_hour_width;
+ int numcols, col;
+ int maxheight;
+
+ if (GTK_WIDGET_CLASS (parent_class)->style_set)
+ (*GTK_WIDGET_CLASS (parent_class)->style_set)(widget, previous_style);
+
+ mts = E_MEETING_TIME_SELECTOR (widget);
+ font = widget->style->font;
+ efont = e_font_from_gdk_font (font);
+
+ /* Calculate the widths of the hour strings in the style's font. */
+ max_hour_width = 0;
+ for (hour = 0; hour < 24; hour++) {
+ if (calendar_config_get_24_hour_format ())
+ mts->hour_widths[hour] = gdk_string_width (font, EMeetingTimeSelectorHours[hour]);
+ else
+ mts->hour_widths[hour] = gdk_string_width (font, EMeetingTimeSelectorHours12[hour]);
+ max_hour_width = MAX (max_hour_width, mts->hour_widths[hour]);
+ }
+
+ /* FIXME the 5 is for the padding etable adds on */
+ mts->row_height = e_font_height (efont) + 5;
+ mts->col_width = max_hour_width + 6;
+
+ e_font_unref (efont);
+
+ e_meeting_time_selector_save_position (mts, &saved_time);
+ e_meeting_time_selector_recalc_grid (mts);
+ e_meeting_time_selector_restore_position (mts, &saved_time);
+
+ gtk_widget_set_usize (mts->display_top, -1, mts->row_height * 3);
+
+ /* Calculate header height */
+ real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (mts->etable));
+ eth = real_table->full_header;
+ numcols = e_table_header_count (eth);
+ maxheight = 0;
+ for (col = 0; col < numcols; col++) {
+ ETableCol *ecol = e_table_header_get_column (eth, col);
+ int height;
+
+ height = e_table_header_compute_height (ecol, widget->style, font);
+
+ if (height > maxheight)
+ maxheight = height;
+ }
+ /* FIXME the 5 is for the padding etable adds on */
+ gtk_widget_set_usize (mts->attendees_vbox_spacer, 1, mts->row_height * 3 - maxheight - 5);
+
+ GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->col_width;
+ GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height;
+}
+
/* This draws a shadow around the top display and main display. */
static gint
e_meeting_time_selector_expose_event (GtkWidget *widget,
diff --git a/calendar/gui/e-meeting-time-sel.h b/calendar/gui/e-meeting-time-sel.h
index 5d9911d24a..1e31d899ea 100644
--- a/calendar/gui/e-meeting-time-sel.h
+++ b/calendar/gui/e-meeting-time-sel.h
@@ -119,7 +119,8 @@ struct _EMeetingTimeSelector
title bar packed at the end. Extra widgets can be added here
with PACK_START if necessary. */
GtkWidget *attendees_vbox;
-
+ GtkWidget *attendees_vbox_spacer;
+
/* The etable and model */
EMeetingModel *model;
GtkWidget *etable;