diff options
Diffstat (limited to 'calendar/gui/e-meeting-model.c')
-rw-r--r-- | calendar/gui/e-meeting-model.c | 119 |
1 files changed, 114 insertions, 5 deletions
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index 6adfb9c1c9..7f1479f452 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -59,7 +59,10 @@ struct _EMeetingModelPrivate { GPtrArray *attendees; + GList *edit_rows; + ETableWithout *without; + GList *tables; CalClient *client; icaltimezone *zone; @@ -127,7 +130,8 @@ static void select_names_ok_cb (BonoboListener *listener, CORBA_Environment *ev, gpointer data); -static void table_destroy_cb (ETableScrolled *etable, gpointer data); +static void table_destroy_state_cb (ETableScrolled *etable, gpointer data); +static void table_destroy_list_cb (ETableScrolled *etable, gpointer data); static ETableModelClass *parent_class = NULL; @@ -498,6 +502,25 @@ set_value_at (ETableModel *etm, int col, int row, const void *val) static gboolean is_cell_editable (ETableModel *etm, int col, int row) { + EMeetingModel *im; + EMeetingModelPrivate *priv; + GList *l; + + im = E_MEETING_MODEL (etm); + priv = im->priv; + + if (priv->edit_rows != NULL) { + if (col != E_MEETING_MODEL_STATUS_COL) + return FALSE; + + for (l = priv->edit_rows; l != NULL; l = l->next) { + if (GPOINTER_TO_INT (l->data) == row) + return TRUE; + } + + return FALSE; + } + switch (col) { case E_MEETING_MODEL_DELTO_COL: case E_MEETING_MODEL_DELFROM_COL: @@ -648,6 +671,7 @@ init (EMeetingModel *im) im->priv = priv; priv->attendees = g_ptr_array_new (); + priv->edit_rows = NULL; priv->without = E_TABLE_WITHOUT (e_table_without_new (E_TABLE_MODEL (im), g_str_hash, @@ -658,7 +682,8 @@ init (EMeetingModel *im) free_duplicated_key, NULL)); e_table_without_hide (priv->without, g_strdup ("delegator")); - + priv->tables = NULL; + priv->client = NULL; priv->zone = icaltimezone_get_builtin_timezone (calendar_config_get_timezone ()); @@ -686,6 +711,8 @@ destroy (GtkObject *obj) gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->attendees, i))); g_ptr_array_free (priv->attendees, TRUE); + g_list_free (priv->tables); + if (priv->client != NULL) gtk_object_unref (GTK_OBJECT (priv->client)); @@ -851,7 +878,7 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil #endif gtk_signal_connect (GTK_OBJECT (etable), "destroy", - GTK_SIGNAL_FUNC (table_destroy_cb), g_strdup (state_file)); + GTK_SIGNAL_FUNC (table_destroy_state_cb), g_strdup (state_file)); gtk_object_unref (GTK_OBJECT (extras)); @@ -1022,6 +1049,47 @@ e_meeting_model_get_attendees (EMeetingModel *im) return priv->attendees; } +void +e_meeting_model_restricted_add (EMeetingModel *im, int row) +{ + EMeetingModelPrivate *priv; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + priv->edit_rows = g_list_append (priv->edit_rows, GINT_TO_POINTER (row)); +} + +void +e_meeting_model_restricted_remove (EMeetingModel *im, int row) +{ + EMeetingModelPrivate *priv; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + priv->edit_rows = g_list_remove (priv->edit_rows, GINT_TO_POINTER (row)); +} + +void +e_meeting_model_restricted_clear (EMeetingModel *im) +{ + EMeetingModelPrivate *priv; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + if (priv->edit_rows) + g_list_free (priv->edit_rows); + priv->edit_rows = NULL; +} + static icaltimezone * find_zone (icalproperty *ip, icalcomponent *tz_top_level) { @@ -1518,13 +1586,43 @@ ETableScrolled * e_meeting_model_etable_from_model (EMeetingModel *im, const gchar *spec_file, const gchar *state_file) { EMeetingModelPrivate *priv; + ETableScrolled *ets; g_return_val_if_fail (im != NULL, NULL); g_return_val_if_fail (E_IS_MEETING_MODEL (im), NULL); priv = im->priv; - return build_etable (E_TABLE_MODEL (priv->without), spec_file, state_file); + ets = build_etable (E_TABLE_MODEL (priv->without), spec_file, state_file); + + priv->tables = g_list_prepend (priv->tables, ets); + + gtk_signal_connect (GTK_OBJECT (ets), "destroy", + GTK_SIGNAL_FUNC (table_destroy_list_cb), im); + + return ets; +} + +void +e_meeting_model_etable_click_to_add (EMeetingModel *im, gboolean click_to_add) +{ + EMeetingModelPrivate *priv; + GList *l; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + for (l = priv->tables; l != NULL; l = l->next) { + ETableScrolled *ets; + ETable *real_table; + + ets = l->data; + real_table = e_table_scrolled_get_table (ets); + + gtk_object_set (GTK_OBJECT (real_table), "use_click_to_add", click_to_add, NULL); + } } int @@ -1735,7 +1833,7 @@ attendee_changed_cb (EMeetingAttendee *ia, gpointer data) } static void -table_destroy_cb (ETableScrolled *etable, gpointer data) +table_destroy_state_cb (ETableScrolled *etable, gpointer data) { ETable *real_table; char *filename = data; @@ -1746,3 +1844,14 @@ table_destroy_cb (ETableScrolled *etable, gpointer data) g_free (data); } +static void +table_destroy_list_cb (ETableScrolled *etable, gpointer data) +{ + EMeetingModel *im = E_MEETING_MODEL (data); + EMeetingModelPrivate *priv; + + priv = im->priv; + + priv->tables = g_list_remove (priv->tables, etable); +} + |