diff options
author | JP Rosevear <jpr@ximian.com> | 2001-10-31 00:09:14 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-10-31 00:09:14 +0800 |
commit | b57629aa8243f9123706c770843e99fefced824c (patch) | |
tree | c26157218acb1f18b79ce8a57c83b9adb6bfcbc6 /calendar/gui | |
parent | 4ec29933d911ca99f4d762747224c89bffce9c1b (diff) | |
download | gsoc2013-evolution-b57629aa8243f9123706c770843e99fefced824c.tar gsoc2013-evolution-b57629aa8243f9123706c770843e99fefced824c.tar.gz gsoc2013-evolution-b57629aa8243f9123706c770843e99fefced824c.tar.bz2 gsoc2013-evolution-b57629aa8243f9123706c770843e99fefced824c.tar.lz gsoc2013-evolution-b57629aa8243f9123706c770843e99fefced824c.tar.xz gsoc2013-evolution-b57629aa8243f9123706c770843e99fefced824c.tar.zst gsoc2013-evolution-b57629aa8243f9123706c770843e99fefced824c.zip |
count the actual attendees (doesn't include people delegating
2001-10-30 JP Rosevear <jpr@ximian.com>
* gui/e-meeting-model.c (e_meeting_model_count_actual_attendees):
count the actual attendees (doesn't include people delegating
* gui/e-meeting-time-sel.c: use
e_meeting_model_count_actual_attendees (renamed)
* gui/e-meeting-time-sel-item.c: use
e_meeting_model_etable_view_to_model_row calls instead of calling
on the model directly, use e_meeting_model_count_actual_attendees
* gui/e-meeting-model.c
(e_meeting_model_etable_model_to_view_row): get the real mapping
(e_meeting_model_etable_view_to_model_row): ditto
(get_key): e-table-without callback
(duplicate_key): ditto
(free_gotten_key): ditto
(free_duplicated_key): ditto
(init): create without model
(e_meeting_model_etable_from_model): build etable from without
model
* gui/e-meeting-model.h: update protos
* gui/dialogs/meeting-page.c (right_click_cb): convert row from
view to model row
svn path=/trunk/; revision=14462
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 8 | ||||
-rw-r--r-- | calendar/gui/e-meeting-model.c | 94 | ||||
-rw-r--r-- | calendar/gui/e-meeting-model.h | 4 | ||||
-rw-r--r-- | calendar/gui/e-meeting-time-sel-item.c | 18 | ||||
-rw-r--r-- | calendar/gui/e-meeting-time-sel.c | 4 |
5 files changed, 108 insertions, 20 deletions
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index f4324cc2dd..d3e126e003 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -438,7 +438,7 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp) g_free (cn); } - if (e_meeting_model_count_attendees (priv->model) < 1) { + if (e_meeting_model_count_actual_attendees (priv->model) < 1) { e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, "Atleast one attendee is required."); return FALSE; @@ -592,6 +592,7 @@ init_widgets (MeetingPage *mpage) GTK_SIGNAL_FUNC (invite_cb), mpage); } +#if 0 static void popup_delegate_cb (GtkWidget *widget, gpointer data) { @@ -650,6 +651,7 @@ popup_delegate_cb (GtkWidget *widget, gpointer data) g_free (address); gtk_object_unref (GTK_OBJECT (edd)); } +#endif static void popup_delete_cb (GtkWidget *widget, gpointer data) @@ -692,10 +694,12 @@ enum { }; static EPopupMenu context_menu[] = { +#if 0 { N_("_Delegate To..."), NULL, GTK_SIGNAL_FUNC (popup_delegate_cb),NULL, CAN_DELEGATE }, E_POPUP_SEPARATOR, +#endif { N_("_Delete"), GNOME_STOCK_MENU_TRASH, GTK_SIGNAL_FUNC (popup_delete_cb), NULL, CAN_DELETE }, @@ -714,7 +718,7 @@ right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer da priv = mpage->priv; - priv->row = row; + priv->row = e_meeting_model_etable_view_to_model_row (priv->model, row); menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, data); e_auto_kill_popup_menu_on_hide (menu); diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index d57da3b78a..e6ecadbf46 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -33,6 +33,7 @@ #include <libgnome/gnome-i18n.h> #include <libgnome/gnome-util.h> #include <libgnomevfs/gnome-vfs.h> +#include <gal/e-table/e-table-without.h> #include <gal/e-table/e-cell-text.h> #include <gal/e-table/e-cell-popup.h> #include <gal/e-table/e-cell-combo.h> @@ -71,7 +72,8 @@ enum columns { struct _EMeetingModelPrivate { GPtrArray *attendees; - + ETableWithout *without; + CalClient *client; EBook *ebook; @@ -573,6 +575,40 @@ value_to_string (ETableModel *etm, int col, const void *val) return g_strdup (val); } +static void * +get_key (ETableModel *source, int row, gpointer data) +{ + EMeetingModel *im; + EMeetingModelPrivate *priv; + char *str; + + im = E_MEETING_MODEL (source); + priv = im->priv; + + str = value_at (source, ITIP_DELTO_COL, row); + if (str && *str) + return g_strdup ("delegator"); + + return g_strdup ("none"); +} + +static void * +duplicate_key (const void *key, gpointer data) +{ + return g_strdup (key); +} + +static void +free_gotten_key (void *key, gpointer data) +{ + g_free (key); +} + +static void +free_duplicated_key (void *key, gpointer data) +{ + g_free (key); +} static void class_init (EMeetingModelClass *klass) @@ -611,6 +647,16 @@ init (EMeetingModel *im) im->priv = priv; priv->attendees = g_ptr_array_new (); + + priv->without = E_TABLE_WITHOUT (e_table_without_new (E_TABLE_MODEL (im), + g_str_hash, + g_str_equal, + get_key, + duplicate_key, + free_gotten_key, + free_duplicated_key, + NULL)); + e_table_without_hide (priv->without, g_strdup ("delegator")); priv->client = NULL; @@ -892,20 +938,25 @@ EMeetingAttendee * e_meeting_model_find_attendee_at_row (EMeetingModel *im, gint row) { EMeetingModelPrivate *priv; - + + g_return_val_if_fail (im != NULL, NULL); + g_return_val_if_fail (E_IS_MEETING_MODEL (im), NULL); + g_return_val_if_fail (row >= 0, NULL); + priv = im->priv; - + g_return_val_if_fail (row < priv->attendees->len, NULL); + return g_ptr_array_index (priv->attendees, row); } gint -e_meeting_model_count_attendees (EMeetingModel *im) +e_meeting_model_count_actual_attendees (EMeetingModel *im) { EMeetingModelPrivate *priv; priv = im->priv; - return priv->attendees->len; + return e_table_model_row_count (E_TABLE_MODEL (priv->without)); } const GPtrArray * @@ -1330,12 +1381,43 @@ e_meeting_model_refresh_busy_periods (EMeetingModel *im, EMeetingModelRefreshCal ETableScrolled * e_meeting_model_etable_from_model (EMeetingModel *im, const gchar *spec_file, const gchar *state_file) { + EMeetingModelPrivate *priv; + g_return_val_if_fail (im != NULL, NULL); g_return_val_if_fail (E_IS_MEETING_MODEL (im), NULL); - return build_etable (E_TABLE_MODEL (im), spec_file, state_file); + priv = im->priv; + + return build_etable (E_TABLE_MODEL (priv->without), spec_file, state_file); +} + +int +e_meeting_model_etable_model_to_view_row (EMeetingModel *im, int model_row) +{ + EMeetingModelPrivate *priv; + + g_return_val_if_fail (im != NULL, -1); + g_return_val_if_fail (E_IS_MEETING_MODEL (im), -1); + + priv = im->priv; + + return e_table_subset_model_to_view_row (priv->without, model_row); +} + +int +e_meeting_model_etable_view_to_model_row (EMeetingModel *im, int view_row) +{ + EMeetingModelPrivate *priv; + + g_return_val_if_fail (im != NULL, -1); + g_return_val_if_fail (E_IS_MEETING_MODEL (im), -1); + + priv = im->priv; + + return e_table_subset_view_to_model_row (priv->without, view_row); } + static void add_section (GNOME_Evolution_Addressbook_SelectNames corba_select_names, const char *name) { diff --git a/calendar/gui/e-meeting-model.h b/calendar/gui/e-meeting-model.h index 3e8e39b25e..562ddd82af 100644 --- a/calendar/gui/e-meeting-model.h +++ b/calendar/gui/e-meeting-model.h @@ -77,12 +77,14 @@ void e_meeting_model_remove_all_attendees (EMeetingModel *im); EMeetingAttendee *e_meeting_model_find_attendee (EMeetingModel *im, const gchar *address, gint *row); EMeetingAttendee *e_meeting_model_find_attendee_at_row (EMeetingModel *im, gint row); -gint e_meeting_model_count_attendees (EMeetingModel *im); +gint e_meeting_model_count_actual_attendees (EMeetingModel *im); const GPtrArray *e_meeting_model_get_attendees (EMeetingModel *im); void e_meeting_model_refresh_busy_periods (EMeetingModel *im, EMeetingModelRefreshCallback call_back, gpointer data); /* Helpful functions */ ETableScrolled *e_meeting_model_etable_from_model (EMeetingModel *im, const gchar *spec_file, const gchar *state_file); +int e_meeting_model_etable_model_to_view_row (EMeetingModel *im, int model_row); +int e_meeting_model_etable_view_to_model_row (EMeetingModel *im, int view_row); void e_meeting_model_invite_others_dialog (EMeetingModel *im); diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c index 88147d306e..136b43e408 100644 --- a/calendar/gui/e-meeting-time-sel-item.c +++ b/calendar/gui/e-meeting-time-sel-item.c @@ -334,9 +334,9 @@ e_meeting_time_selector_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable, gdk_gc_set_fill (stipple_gc, GDK_OPAQUE_STIPPLED); row = y / mts->row_height; row_y = row * mts->row_height - y; - while (row < e_meeting_model_count_attendees (mts->model) && row_y < height) { + while (row < e_meeting_model_count_actual_attendees (mts->model) && row_y < height) { ETable *real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (mts->etable)); - gint model_row = e_table_view_to_model_row (real_table, row); + gint model_row = e_meeting_model_etable_view_to_model_row (mts->model, row); ia = e_meeting_model_find_attendee_at_row (mts->model, model_row); @@ -530,8 +530,8 @@ e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelec y = 2 * mts->row_height - scroll_y - 1; /* Get the first visible busy periods for all the attendees. */ - first_periods = g_new (gint, e_meeting_model_count_attendees (mts->model)); - for (row = 0; row < e_meeting_model_count_attendees (mts->model); row++) { + first_periods = g_new (gint, e_meeting_model_count_actual_attendees (mts->model)); + for (row = 0; row < e_meeting_model_count_actual_attendees (mts->model); row++) { ia = e_meeting_model_find_attendee_at_row (mts->model, row); first_periods[row] = e_meeting_time_selector_item_find_first_busy_period (mts_item, date, row); } @@ -540,7 +540,7 @@ e_meeting_time_selector_item_paint_all_attendees_busy_periods (EMeetingTimeSelec busy_type < E_MEETING_FREE_BUSY_LAST; busy_type++) { gdk_gc_set_foreground (gc, &mts->busy_colors[busy_type]); - for (row = 0; row < e_meeting_model_count_attendees (mts->model); row++) { + for (row = 0; row < e_meeting_model_count_actual_attendees (mts->model); row++) { if (first_periods[row] == -1) continue; e_meeting_time_selector_item_paint_attendee_busy_periods (mts_item, drawable, x, y, width, row, first_periods[row], busy_type); @@ -577,7 +577,7 @@ e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item, grid_y < height; grid_y += mts->row_height) { - if (attendee_index <= e_meeting_model_count_attendees (mts->model)) { + if (attendee_index <= e_meeting_model_count_actual_attendees (mts->model)) { gdk_gc_set_foreground (gc, &mts->grid_color); gdk_draw_line (drawable, gc, 0, grid_y, width, grid_y); @@ -590,7 +590,7 @@ e_meeting_time_selector_item_paint_day (EMeetingTimeSelectorItem *mts_item, } /* Draw the vertical grid lines. */ - unused_y = (e_meeting_model_count_attendees (mts->model) * mts->row_height) - scroll_y; + unused_y = (e_meeting_model_count_actual_attendees (mts->model) * mts->row_height) - scroll_y; if (unused_y >= 0) { gdk_gc_set_foreground (gc, &mts->grid_color); for (grid_x = mts->col_width - 1; @@ -648,8 +648,8 @@ e_meeting_time_selector_item_paint_busy_periods (EMeetingTimeSelectorItem *mts_i y = row * mts->row_height - scroll_y; /* Step through the attendees painting the busy periods. */ - while (y < height && row < e_meeting_model_count_attendees (mts->model)) { - model_row = e_table_view_to_model_row (real_table, row); + while (y < height && row < e_meeting_model_count_actual_attendees (mts->model)) { + model_row = e_meeting_model_etable_view_to_model_row (mts->model, row); /* Find the first visible busy period. */ first_period = e_meeting_time_selector_item_find_first_busy_period (mts_item, date, model_row); diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index 2358ef2be8..25a2bbc22d 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -1511,7 +1511,7 @@ e_meeting_time_selector_autopick (EMeetingTimeSelector *mts, /* Step through each attendee, checking if the meeting time intersects one of the attendees busy periods. */ - for (row = 0; row < e_meeting_model_count_attendees (mts->model); row++) { + for (row = 0; row < e_meeting_model_count_actual_attendees (mts->model); row++) { attendee = e_meeting_model_find_attendee_at_row (mts->model, row); /* Skip optional people if they don't matter. */ @@ -2200,7 +2200,7 @@ e_meeting_time_selector_update_main_canvas_scroll_region (EMeetingTimeSelector * { gint height, canvas_height; - height = mts->row_height * (e_meeting_model_count_attendees (mts->model) + 2); + height = mts->row_height * (e_meeting_model_count_actual_attendees (mts->model) + 2); canvas_height = GTK_WIDGET (mts->display_main)->allocation.height; height = MAX (height, canvas_height); |