diff options
author | JP Rosevear <jpr@ximian.com> | 2002-06-25 21:11:47 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-06-25 21:11:47 +0800 |
commit | 5ab2df3c08cfc14b0388e5042fa4221f81ac54a5 (patch) | |
tree | 707fc122106a769a3350d216c81567e7b62d1f02 /calendar/gui/dialogs | |
parent | af877240e40f2eb12fc49fcc4639a4bd5d78a112 (diff) | |
download | gsoc2013-evolution-5ab2df3c08cfc14b0388e5042fa4221f81ac54a5.tar.gz gsoc2013-evolution-5ab2df3c08cfc14b0388e5042fa4221f81ac54a5.tar.zst gsoc2013-evolution-5ab2df3c08cfc14b0388e5042fa4221f81ac54a5.zip |
add back proto
2002-06-25 JP Rosevear <jpr@ximian.com>
* gui/dialogs/comp-editor-page.h: add back proto
* gui/dialogs/comp-editor-page.c
(comp_editor_page_notify_needs_send): add page needs_send signal
* gui/e-meeting-time-sel.c
(e_meeting_time_selector_on_invite_others_button_draw): check to
see if the button should be sensitive when drawing
(e_meeting_time_selector_construct): listen for the button draw
signal
* cal-util/cal-component.c (cal_component_strip_errors): remove
X-LIC-ERROR x properties
* cal-util/cal-component.h: new proto
* gui/dialogs/meeting-page.c (change_clicked_cb): set needs_send
to true
(meeting_page_fill_widgets): set up gui based on if the user or
someone else is the organizer
(meeting_page_construct): read the addresses here for the combo
box
(get_widgets): explicitly set the value in list values
* gui/dialogs/event-editor.c (set_menu_sens): base this on the
exist org and user org values of the comp editor
(event_editor_edit_comp): set up editable row restrictions on the
meeting model if the user is not an organizer, and don't set needs
send if we aren't the organizer initially
(model_row_changed_cb): set needs_send to true
(row_count_changed_cb): ditto
* gui/dialogs/meeting-page.glade: update gui
* gui/dialogs/comp-editor.c (save_comp_with_send): if the user is
not the organizer, REPLY rather than REQUEST
(comp_editor_set_existing_org): accessor
(comp_editor_get_existing_org): ditto
(comp_editor_set_user_org): ditto
(comp_editor_get_user_org): ditto
(real_edit_comp): determine if there is an existing organizer and
if the organizers is a user
(page_changed_cb): warn the user that changes may be discarded
(page_summary_changed_cb): ditto
(page_dates_changed_cb): ditto
* gui/dialogs/comp-editor.h: new protos
* gui/itip-utils.c (itip_organizer_is_user): determine if the
organizer of a component is a user
(itip_sentby_is_user): same for sentby field of organizer
(comp_sentby): use above routines instead
(comp_compliant): strip all X-LIC-ERROR fields generated by
libical
* gui/e-meeting-model.c (is_cell_editable): if there is a list of
editable rows, allow only the status column of those rows to be
edited
(init): init edit_rows
(e_meeting_model_restricted_add): add an editable row to the model
(e_meeting_model_restricted_remove): remove an editable row
(e_meeting_model_restricted_clear): clear all editable rows
(e_meeting_model_etable_click_to_add): set the click to add arg on
all tables
(e_meeting_model_etable_from_model): track the tables
(table_destroy_list_cb): remove the table being destroyed from the
list
(table_destroy_state_cb): remove the table being destroyed from
the list
* gui/e-meeting-model.h: new protos
* gui/e-itip-control.c (update_attendee_status): kill warning
svn path=/trunk/; revision=17274
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.c | 25 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-page.h | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 109 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 59 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 162 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.glade | 82 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 81 |
8 files changed, 313 insertions, 212 deletions
diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c index 0d7f315837..b1fabf28be 100644 --- a/calendar/gui/dialogs/comp-editor-page.c +++ b/calendar/gui/dialogs/comp-editor-page.c @@ -37,6 +37,7 @@ static GtkObjectClass *parent_class = NULL; enum { CHANGED, + NEEDS_SEND, SUMMARY_CHANGED, DATES_CHANGED, LAST_SIGNAL @@ -100,6 +101,15 @@ comp_editor_page_class_init (CompEditorPageClass *class) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); + comp_editor_page_signals[NEEDS_SEND] = + gtk_signal_new ("needs_send", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CompEditorPageClass, + needs_send), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + comp_editor_page_signals[SUMMARY_CHANGED] = gtk_signal_new ("summary_changed", GTK_RUN_FIRST, @@ -322,6 +332,21 @@ comp_editor_page_notify_changed (CompEditorPage *page) } /** + * comp_editor_page_notify_needs_send: + * @page: + * + * + **/ +void +comp_editor_page_notify_needs_send (CompEditorPage *page) +{ + g_return_if_fail (page != NULL); + g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); + + gtk_signal_emit (GTK_OBJECT (page), comp_editor_page_signals[NEEDS_SEND]); +} + +/** * comp_editor_page_notify_summary_changed: * @page: An editor page. * diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index 6ef5549219..1b84cb16b7 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -95,6 +95,7 @@ void comp_editor_page_set_summary (CompEditorPage *page, void comp_editor_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); void comp_editor_page_notify_changed (CompEditorPage *page); +void comp_editor_page_notify_needs_send (CompEditorPage *page); void comp_editor_page_notify_summary_changed (CompEditorPage *page, const char *summary); void comp_editor_page_notify_dates_changed (CompEditorPage *page, diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 3e245a0c98..1179453aff 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -35,9 +35,11 @@ #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-stock.h> #include <libgnomeui/gnome-window-icon.h> +#include <libgnomeui/gnome-messagebox.h> #include <bonobo/bonobo-ui-container.h> #include <bonobo/bonobo-ui-util.h> #include <gal/widgets/e-unicode.h> +#include <gal/widgets/e-gui-utils.h> #include <e-util/e-dialog-utils.h> #include <evolution-shell-component-utils.h> #include "../print.h" @@ -70,7 +72,12 @@ struct _CompEditorPrivate { gboolean changed; gboolean needs_send; - gboolean needs_send_new; + + gboolean existing_org; + gboolean user_org; + + gboolean warned; + gboolean updating; }; @@ -240,7 +247,9 @@ comp_editor_init (CompEditor *editor) priv->pages = NULL; priv->changed = FALSE; priv->needs_send = FALSE; - priv->needs_send_new = FALSE; + priv->existing_org = FALSE; + priv->user_org = FALSE; + priv->warned = FALSE; } @@ -311,7 +320,13 @@ save_comp (CompEditor *editor) return FALSE; } } - cal_component_commit_sequence (clone); + + /* If we are not the organizer, we don't update the sequence number */ + if (!cal_component_has_organizer (clone) || itip_organizer_is_user (clone)) + cal_component_commit_sequence (clone); + else + cal_component_abort_sequence (clone); + gtk_object_unref (GTK_OBJECT (priv->comp)); priv->comp = clone; @@ -364,8 +379,12 @@ save_comp_with_send (CompEditor *editor) if (!save_comp (editor)) return FALSE; - if (send && send_component_dialog (priv->comp, priv->needs_send_new)) - comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); + if (send && send_component_dialog (priv->comp, priv->existing_org)) { + if (itip_organizer_is_user (priv->comp)) + comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); + else + comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REPLY); + } return TRUE; } @@ -437,6 +456,59 @@ close_dialog (CompEditor *editor) +void +comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org) +{ + CompEditorPrivate *priv; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + priv->existing_org = existing_org; +} + +gboolean +comp_editor_get_existing_org (CompEditor *editor) +{ + CompEditorPrivate *priv; + + g_return_val_if_fail (editor != NULL, FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + + priv = editor->priv; + + return priv->existing_org; +} + +void +comp_editor_set_user_org (CompEditor *editor, gboolean user_org) +{ + CompEditorPrivate *priv; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + priv->user_org = user_org; +} + +gboolean +comp_editor_get_user_org (CompEditor *editor) +{ + CompEditorPrivate *priv; + + g_return_val_if_fail (editor != NULL, FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + + priv = editor->priv; + + return priv->user_org; +} + + /** * comp_editor_set_changed: * @editor: A component editor @@ -853,7 +925,7 @@ static void real_edit_comp (CompEditor *editor, CalComponent *comp) { CompEditorPrivate *priv; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); @@ -867,8 +939,10 @@ real_edit_comp (CompEditor *editor, CalComponent *comp) if (comp) priv->comp = cal_component_clone (comp); - priv->needs_send_new = !priv->needs_send; - + priv->existing_org = cal_component_has_organizer (comp); + priv->user_org = itip_organizer_is_user (comp); + priv->warned = FALSE; + set_title_from_comp (editor); set_icon_from_comp (editor); fill_widgets (editor); @@ -1219,6 +1293,13 @@ page_changed_cb (GtkObject *obj, gpointer data) priv = editor->priv; priv->changed = TRUE; + + if (!priv->warned && priv->existing_org && !priv->user_org) { + e_notice (NULL, GNOME_MESSAGE_BOX_INFO, + _("Changes made to this item may be discarded if an update arrives via email")); + priv->warned = TRUE; + } + } /* Page signal callbacks */ @@ -1236,6 +1317,12 @@ page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data) comp_editor_page_set_summary (l->data, summary); priv->changed = TRUE; + + if (!priv->warned && priv->existing_org && !priv->user_org) { + e_notice (NULL, GNOME_MESSAGE_BOX_INFO, + _("Changes made to this item may be discarded if an update arrives via email")); + priv->warned = TRUE; + } } static void @@ -1254,6 +1341,12 @@ page_dates_changed_cb (GtkObject *obj, comp_editor_page_set_dates (l->data, dates); priv->changed = TRUE; + + if (!priv->warned && priv->existing_org && !priv->user_org) { + e_notice (NULL, GNOME_MESSAGE_BOX_INFO, + _("Changes made to this item may be discarded if an update arrives via email")); + priv->warned = TRUE; + } } static void diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 6772f135e8..18fcd473b7 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -65,6 +65,12 @@ gboolean comp_editor_get_changed (CompEditor *editor); void comp_editor_set_needs_send (CompEditor *editor, gboolean needs_send); gboolean comp_editor_get_needs_send (CompEditor *editor); +void comp_editor_set_existing_org (CompEditor *editor, + gboolean existing_org); +gboolean comp_editor_get_existing_org (CompEditor *editor); +void comp_editor_set_user_org (CompEditor *editor, + gboolean user_org); +gboolean comp_editor_get_user_org (CompEditor *editor); void comp_editor_append_page (CompEditor *editor, CompEditorPage *page, const char *label); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 08c98dfaba..7c020caff0 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -48,7 +48,6 @@ struct _EventEditorPrivate { EMeetingModel *model; gboolean meeting_shown; - gboolean existing_org; gboolean updating; }; @@ -142,19 +141,24 @@ static void set_menu_sens (EventEditor *ee) { EventEditorPrivate *priv; - gboolean sens; + gboolean sens, existing, user; priv = ee->priv; + existing = comp_editor_get_existing_org (COMP_EDITOR (ee)); + user = comp_editor_get_user_org (COMP_EDITOR (ee)); + sens = priv->meeting_shown; comp_editor_set_ui_prop (COMP_EDITOR (ee), "/commands/ActionScheduleMeeting", "sensitive", sens ? "0" : "1"); - sens = sens && priv->existing_org; + sens = priv->meeting_shown && existing && !user; comp_editor_set_ui_prop (COMP_EDITOR (ee), "/commands/ActionRefreshMeeting", "sensitive", sens ? "1" : "0"); + + sens = priv->meeting_shown && existing && user; comp_editor_set_ui_prop (COMP_EDITOR (ee), "/commands/ActionCancelMeeting", "sensitive", sens ? "1" : "0"); @@ -214,7 +218,6 @@ event_editor_init (EventEditor *ee) comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs, pixmaps); priv->meeting_shown = TRUE; - priv->existing_org = FALSE; priv->updating = FALSE; init_widgets (ee); @@ -241,17 +244,26 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) { EventEditor *ee; EventEditorPrivate *priv; + CalComponentOrganizer organizer; GSList *attendees = NULL; ee = EVENT_EDITOR (editor); priv = ee->priv; priv->updating = TRUE; + + if (parent_class->edit_comp) + parent_class->edit_comp (editor, comp); - priv->existing_org = cal_component_has_organizer (comp); + /* Get meeting related stuff */ + cal_component_get_organizer (comp, &organizer); cal_component_get_attendee_list (comp, &attendees); + /* Clear things up */ + e_meeting_model_restricted_clear (priv->model); e_meeting_model_remove_all_attendees (priv->model); + + /* Set up the attendees */ if (attendees == NULL) { comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->sched_page)); @@ -267,26 +279,45 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) COMP_EDITOR_PAGE (priv->meet_page), _("Meeting")); } - + for (l = attendees; l != NULL; l = l->next) { CalComponentAttendee *ca = l->data; EMeetingAttendee *ia; ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca)); e_meeting_model_add_attendee (priv->model, ia); + gtk_object_unref (GTK_OBJECT (ia)); } + + if (organizer.value != NULL) { + GList *addresses, *l; + const char *strip; + int row; + + strip = itip_strip_mailto (organizer.value); + + addresses = itip_addresses_get (); + for (l = addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + + if (e_meeting_model_find_attendee (priv->model, a->address, &row)) + e_meeting_model_restricted_add (priv->model, row); + } + itip_addresses_free (addresses); + } + + if (comp_editor_get_user_org (editor)) + e_meeting_model_restricted_clear (priv->model); + priv->meeting_shown = TRUE; } cal_component_free_attendee_list (attendees); set_menu_sens (ee); - comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown); + comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown && itip_organizer_is_user (comp)); priv->updating = FALSE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); } static void @@ -438,8 +469,10 @@ model_row_changed_cb (ETableModel *etm, int row, gpointer data) priv = ee->priv; - if (!priv->updating) + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (ee), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (ee), TRUE); + } } static void @@ -450,6 +483,8 @@ row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data) priv = ee->priv; - if (!priv->updating) + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (ee), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (ee), TRUE); + } } diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index 2504ed3993..554afd2ecd 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -26,6 +26,7 @@ #endif #include <glib.h> +#include <gtk/gtkcombo.h> #include <gtk/gtksignal.h> #include <gtk/gtktogglebutton.h> #include <gtk/gtkvbox.h> @@ -87,10 +88,6 @@ struct _MeetingPagePrivate { GtkWidget *main; GtkWidget *organizer_table; GtkWidget *organizer; - GtkWidget *organizer_lbl; - GtkWidget *other_organizer; - GtkWidget *other_organizer_lbl; - GtkWidget *other_organizer_btn; GtkWidget *existing_organizer_table; GtkWidget *existing_organizer; GtkWidget *existing_organizer_btn; @@ -102,8 +99,8 @@ struct _MeetingPagePrivate { gint row; /* For handling who the organizer is */ - gboolean other; gboolean existing; + gboolean updating; }; @@ -184,13 +181,16 @@ static void meeting_page_init (MeetingPage *mpage) { MeetingPagePrivate *priv; - + priv = g_new0 (MeetingPagePrivate, 1); mpage->priv = priv; - + priv->deleted_attendees = g_ptr_array_new (); priv->comp = NULL; + + priv->addresses = NULL; + priv->address_strings = NULL; priv->xml = NULL; priv->main = NULL; @@ -254,8 +254,6 @@ meeting_page_destroy (GtkObject *object) g_ptr_array_free (priv->deleted_attendees, FALSE); itip_addresses_free (priv->addresses); - g_list_foreach (priv->address_strings, (GFunc) g_free, NULL); - g_list_free (priv->address_strings); gtk_object_unref (GTK_OBJECT (priv->model)); @@ -308,17 +306,12 @@ clear_widgets (MeetingPage *mpage) priv = mpage->priv; gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), ""); - gtk_entry_set_text (GTK_ENTRY (priv->other_organizer), ""); gtk_label_set_text (GTK_LABEL (priv->existing_organizer), _("None")); gtk_widget_show (priv->organizer_table); gtk_widget_hide (priv->existing_organizer_table); - gtk_widget_hide (priv->other_organizer_lbl); - gtk_widget_hide (priv->other_organizer); - priv->existing = FALSE; - priv->other = FALSE; } /* fill_widgets handler for the meeting page */ @@ -328,7 +321,6 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp) MeetingPage *mpage; MeetingPagePrivate *priv; CalComponentOrganizer organizer; - GList *l; mpage = MEETING_PAGE (page); priv = mpage->priv; @@ -348,45 +340,41 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp) /* Component for cancellation */ priv->comp = cal_component_clone (comp); - /* Organizer */ - cal_component_get_organizer (comp, &organizer); - priv->addresses = itip_addresses_get (); - for (l = priv->addresses; l != NULL; l = l->next) { - ItipAddress *a = l->data; - char *s; - - s = e_utf8_to_gtk_string (GTK_COMBO (priv->organizer)->entry, a->full); - priv->address_strings = g_list_append (priv->address_strings, s); - if (a->default_address) - priv->default_address = s; - } + /* List the user identities for default organizers */ gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - if (organizer.value != NULL) { - const gchar *strip = itip_strip_mailto (organizer.value); - gchar *s, *string; - - gtk_widget_hide (priv->organizer_table); - gtk_widget_show (priv->existing_organizer_table); - gtk_widget_hide (priv->invite); - - if (organizer.cn != NULL) - string = g_strdup_printf ("%s <%s>", organizer.cn, strip); - else - string = g_strdup (strip); - s = e_utf8_to_gtk_string (priv->existing_organizer, string); - gtk_label_set_text (GTK_LABEL (priv->existing_organizer), s); - g_free (s); - g_free (string); - - priv->existing = TRUE; + /* If there is an existing organizer show it properly */ + if (cal_component_has_organizer (comp)) { + cal_component_get_organizer (comp, &organizer); + if (organizer.value != NULL) { + const gchar *strip = itip_strip_mailto (organizer.value); + gchar *s, *string; + + gtk_widget_hide (priv->organizer_table); + gtk_widget_show (priv->existing_organizer_table); + if (itip_organizer_is_user (comp)) { + gtk_widget_show (priv->invite); + e_meeting_model_etable_click_to_add (priv->model, TRUE); + } else { + gtk_widget_hide (priv->invite); + e_meeting_model_etable_click_to_add (priv->model, FALSE); + } + + if (organizer.cn != NULL) + string = g_strdup_printf ("%s <%s>", organizer.cn, strip); + else + string = g_strdup (strip); + s = e_utf8_to_gtk_string (priv->existing_organizer, string); + gtk_label_set_text (GTK_LABEL (priv->existing_organizer), s); + g_free (s); + g_free (string); + + priv->existing = TRUE; + } } else { - gtk_widget_hide (priv->other_organizer_lbl); - gtk_widget_hide (priv->other_organizer); - e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address); } - + priv->updating = FALSE; } @@ -402,24 +390,24 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp) priv = mpage->priv; if (!priv->existing) { - gchar *addr = NULL, *cn = NULL; + gchar *addr = NULL, *cn = NULL, *sentby = NULL, *str; GList *l; + + str = e_dialog_editable_get (GTK_COMBO (priv->organizer)->entry); - if (priv->other) { - addr = e_dialog_editable_get (priv->other_organizer); - } else { - gchar *str = e_dialog_editable_get (GTK_COMBO (priv->organizer)->entry); - for (l = priv->addresses; l != NULL; l = l->next) { - ItipAddress *a = l->data; + /* Find the identity for the organizer or sentby field */ + for (l = priv->addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; - if (!strcmp (a->full, str)) { + if (!strcmp (a->full, str)) { addr = g_strdup (a->address); cn = g_strdup (a->name); - } } - g_free (str); } + + g_free (str); + /* Sanity Check */ if (addr == NULL || strlen (addr) == 0) { e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, _("An organizer is required.")); @@ -436,9 +424,12 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp) organizer.value = addr; organizer.cn = cn; + organizer.sentby = sentby; cal_component_set_organizer (comp, &organizer); + g_free (addr); g_free (cn); + g_free (sentby); } if (e_meeting_model_count_actual_attendees (priv->model) < 1) { @@ -482,12 +473,12 @@ get_widgets (MeetingPage *mpage) gtk_widget_ref (priv->main); gtk_widget_unparent (priv->main); + /* For making the user the organizer */ priv->organizer_table = GW ("organizer-table"); priv->organizer = GW ("organizer"); - priv->organizer_lbl = GW ("organizer-label"); - priv->other_organizer = GW ("other-organizer"); - priv->other_organizer_lbl = GW ("other-organizer-label"); - priv->other_organizer_btn = GW ("other-organizer-button"); + gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), TRUE, FALSE); + + /* For showing existing organizers */ priv->existing_organizer_table = GW ("existing-organizer-table"); priv->existing_organizer = GW ("existing-organizer"); priv->existing_organizer_btn = GW ("existing-organizer-button"); @@ -498,10 +489,6 @@ get_widgets (MeetingPage *mpage) return (priv->invite && priv->organizer_table && priv->organizer - && priv->organizer_lbl - && priv->other_organizer - && priv->other_organizer_lbl - && priv->other_organizer_btn && priv->existing_organizer_table && priv->existing_organizer && priv->existing_organizer_btn); @@ -517,29 +504,10 @@ field_changed_cb (GtkWidget *widget, gpointer data) mpage = MEETING_PAGE (data); priv = mpage->priv; - if (!priv->updating) + if (!priv->updating) comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); } -/* Function called to make the organizer other than the user */ -static void -other_clicked_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - gtk_widget_hide (priv->organizer_lbl); - gtk_widget_hide (priv->organizer); - gtk_widget_hide (priv->other_organizer_btn); - gtk_widget_show (priv->other_organizer_lbl); - gtk_widget_show (priv->other_organizer); - - priv->other = TRUE; -} - /* Function called to change the organizer */ static void change_clicked_cb (GtkWidget *widget, gpointer data) @@ -553,10 +521,11 @@ change_clicked_cb (GtkWidget *widget, gpointer data) gtk_widget_show (priv->organizer_table); gtk_widget_hide (priv->existing_organizer_table); gtk_widget_show (priv->invite); + e_meeting_model_etable_click_to_add (priv->model, TRUE); - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address); - + comp_editor_page_notify_needs_send (COMP_EDITOR_PAGE (mpage)); + priv->existing = FALSE; } @@ -585,8 +554,6 @@ init_widgets (MeetingPage *mpage) gtk_signal_connect (GTK_OBJECT (GTK_COMBO (priv->organizer)->entry), "changed", GTK_SIGNAL_FUNC (field_changed_cb), mpage); - gtk_signal_connect (GTK_OBJECT (priv->other_organizer_btn), "clicked", - GTK_SIGNAL_FUNC (other_clicked_cb), mpage); gtk_signal_connect (GTK_OBJECT (priv->existing_organizer_btn), "clicked", GTK_SIGNAL_FUNC (change_clicked_cb), mpage); @@ -770,6 +737,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm) MeetingPagePrivate *priv; ETable *real_table; gchar *filename; + GList *l; priv = mpage->priv; @@ -786,6 +754,18 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm) "Could not find all widgets in the XML file!"); return NULL; } + + /* Address information */ + priv->addresses = itip_addresses_get (); + for (l = priv->addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + char *s; + + s = e_utf8_to_gtk_string (GTK_COMBO (priv->organizer)->entry, a->full); + priv->address_strings = g_list_append (priv->address_strings, s); + if (a->default_address) + priv->default_address = s; + } /* The etable displaying attendees and their status */ gtk_object_ref (GTK_OBJECT (emm)); diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade index f06f457d16..7a4b53dd5d 100644 --- a/calendar/gui/dialogs/meeting-page.glade +++ b/calendar/gui/dialogs/meeting-page.glade @@ -46,15 +46,15 @@ <class>GtkTable</class> <name>organizer-table</name> <border_width>4</border_width> - <rows>2</rows> + <rows>1</rows> <columns>3</columns> <homogeneous>False</homogeneous> <row_spacing>0</row_spacing> <column_spacing>4</column_spacing> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> <widget> @@ -94,52 +94,6 @@ </widget> <widget> - <class>GtkButton</class> - <name>other-organizer-button</name> - <can_focus>True</can_focus> - <label>_Other Organizer</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>other-organizer</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> <class>GtkLabel</class> <name>organizer-label</name> <label>Organizer:</label> @@ -164,32 +118,6 @@ <yfill>False</yfill> </child> </widget> - - <widget> - <class>GtkLabel</class> - <name>other-organizer-label</name> - <label>Organizer:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> </widget> <widget> @@ -203,8 +131,8 @@ <column_spacing>4</column_spacing> <child> <padding>0</padding> - <expand>True</expand> - <fill>True</fill> + <expand>False</expand> + <fill>False</fill> </child> <widget> diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index e3acaaf13a..b712e07135 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -43,7 +43,6 @@ struct _TaskEditorPrivate { EMeetingModel *model; gboolean assignment_shown; - gboolean existing_org; gboolean updating; }; @@ -130,22 +129,27 @@ static void set_menu_sens (TaskEditor *te) { TaskEditorPrivate *priv; - gboolean sens; + gboolean sens, existing, user; priv = te->priv; - sens = priv->assignment_shown; - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionAssignTask", - "sensitive", sens ? "0" : "1"); - - sens = sens && priv->existing_org; - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionRefreshTask", - "sensitive", sens ? "1" : "0"); - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionCancelTask", - "sensitive", sens ? "1" : "0"); + existing = comp_editor_get_existing_org (COMP_EDITOR (te)); + user = comp_editor_get_user_org (COMP_EDITOR (te)); + + sens = priv->assignment_shown; + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionAssignTask", + "sensitive", sens ? "0" : "1"); + + sens = priv->assignment_shown && existing && !user; + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionRefreshTask", + "sensitive", sens ? "1" : "0"); + + sens = priv->assignment_shown && existing && user; + comp_editor_set_ui_prop (COMP_EDITOR (te), + "/commands/ActionCancelTask", + "sensitive", sens ? "1" : "0"); } static void @@ -192,7 +196,6 @@ task_editor_init (TaskEditor *te) comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs, NULL); priv->assignment_shown = TRUE; - priv->existing_org = FALSE; priv->updating = FALSE; init_widgets (te); @@ -204,6 +207,7 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) { TaskEditor *te; TaskEditorPrivate *priv; + CalComponentOrganizer organizer; GSList *attendees = NULL; te = TASK_EDITOR (editor); @@ -211,10 +215,17 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) priv->updating = TRUE; - priv->existing_org = cal_component_has_organizer (comp); + if (parent_class->edit_comp) + parent_class->edit_comp (editor, comp); + + /* Get meeting related stuff */ + cal_component_get_organizer (comp, &organizer); cal_component_get_attendee_list (comp, &attendees); + /* Clear things up */ + e_meeting_model_restricted_clear (priv->model); e_meeting_model_remove_all_attendees (priv->model); + if (attendees == NULL) { comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); priv->assignment_shown = FALSE; @@ -233,17 +244,35 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) e_meeting_model_add_attendee (priv->model, ia); gtk_object_unref (GTK_OBJECT (ia)); } + + if (organizer.value != NULL) { + GList *addresses, *l; + const char *strip; + int row; + + strip = itip_strip_mailto (organizer.value); + + addresses = itip_addresses_get (); + for (l = addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + + if (e_meeting_model_find_attendee (priv->model, a->address, &row)) + e_meeting_model_restricted_add (priv->model, row); + } + itip_addresses_free (addresses); + } + + if (comp_editor_get_user_org (editor)) + e_meeting_model_restricted_clear (priv->model); + priv->assignment_shown = TRUE; } cal_component_free_attendee_list (attendees); set_menu_sens (te); - comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown); + comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown && itip_organizer_is_user (comp)); priv->updating = FALSE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); } static void @@ -387,9 +416,11 @@ model_row_changed_cb (ETableModel *etm, int row, gpointer data) TaskEditorPrivate *priv; priv = te->priv; - - if (!priv->updating) + + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (te), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (te), TRUE); + } } static void @@ -399,7 +430,9 @@ row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data) TaskEditorPrivate *priv; priv = te->priv; - - if (!priv->updating) + + if (!priv->updating) { comp_editor_set_changed (COMP_EDITOR (te), TRUE); + comp_editor_set_needs_send (COMP_EDITOR (te), TRUE); + } } |