From ea8185e64b61fd8d97ecd8e4745698d4020f2a5f Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 6 Jul 2001 20:27:31 +0000 Subject: actually clear some widgets and hide/show widgets in the default setup 2001-07-06 JP Rosevear * gui/dialogs/meeting-page.c (clear_widgets): actually clear some widgets and hide/show widgets in the default setup (meeting_page_destroy): destroy the address lists (meeting_page_fill_widgets): allow the user to select among their identities as a new organizer, or show the existing organizer as label (meeting_page_fill_component): set the "MAILTO:" bit of the organizer to match spec, set CN properly if we know it (get_widgets): load new widgets (other_clicked_cb): handle "Other Organizer" click (change_clicked_cb): handle "Change Organizer" click (init_widgets): listen for clicks on new buttons * gui/dialogs/comp-editor.c (comp_editor_remove_page): remove the page from our internal list and unref it * gui/itip-utils.c (itip_addresses_get): get the configure mail identities (itip_addresses_free): free a list of identities returned by itip_addresses_get * gui/itip-utils.h: remove obsolete protos, and new protos * gui/gnome-cal.html: Remove ancient file svn path=/trunk/; revision=10856 --- calendar/ChangeLog | 27 ++++ calendar/gui/dialogs/comp-editor.c | 3 + calendar/gui/dialogs/meeting-page.c | 177 ++++++++++++++++++++-- calendar/gui/dialogs/meeting-page.glade | 252 ++++++++++++++++++++++++++++---- calendar/gui/gnome-cal.html | 44 ------ calendar/gui/itip-utils.c | 110 ++++++++++---- calendar/gui/itip-utils.h | 17 ++- 7 files changed, 511 insertions(+), 119 deletions(-) delete mode 100644 calendar/gui/gnome-cal.html (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 73f284ee82..4b6172ee1d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,30 @@ +2001-07-06 JP Rosevear + + * gui/dialogs/meeting-page.c (clear_widgets): actually clear some + widgets and hide/show widgets in the default setup + (meeting_page_destroy): destroy the address lists + (meeting_page_fill_widgets): allow the user to select among their + identities as a new organizer, or show the existing organizer as + label + (meeting_page_fill_component): set the "MAILTO:" bit of the + organizer to match spec, set CN properly if we know it + (get_widgets): load new widgets + (other_clicked_cb): handle "Other Organizer" click + (change_clicked_cb): handle "Change Organizer" click + (init_widgets): listen for clicks on new buttons + + * gui/dialogs/comp-editor.c (comp_editor_remove_page): remove the + page from our internal list and unref it + + * gui/itip-utils.c (itip_addresses_get): get the configure mail + identities + (itip_addresses_free): free a list of identities returned by + itip_addresses_get + + * gui/itip-utils.h: remove obsolete protos, and new protos + + * gui/gnome-cal.html: Remove ancient file + 2001-07-04 Federico Mena Quintero Fixes bug #4018 and what would be the analogous bugs for the other diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 829b536ded..9668e538aa 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -336,6 +336,9 @@ comp_editor_remove_page (CompEditor *editor, CompEditorPage *page) page_widget = comp_editor_page_get_widget (page); page_num = gtk_notebook_page_num (priv->notebook, page_widget); gtk_notebook_remove_page (priv->notebook, page_num); + + priv->pages = g_list_remove (priv->pages, page); + gtk_object_unref (GTK_OBJECT (page)); } /** diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index 9e9e3e96db..2c0dcc9fd5 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -26,6 +26,9 @@ #include #endif +#include +#include +#include #include #include #include @@ -39,10 +42,10 @@ #include #include #include -#include #include -#include +#include "../Evolution-Addressbook-SelectNames.h" #include "../component-factory.h" +#include "../itip-utils.h" #include "comp-editor-util.h" #include "meeting-page.h" @@ -119,19 +122,36 @@ struct attendee { struct _MeetingPagePrivate { /* List of attendees */ GSList *attendees; + + /* List of identities */ + GList *addresses; + GList *address_strings; + gchar *default_address; /* Glade XML data */ GladeXML *xml; /* Widgets from the Glade file */ 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; GtkWidget *invite; /* E Table stuff */ ETableModel *model; GtkWidget *etable; + /* For handling who the organizer is */ + gboolean other; + gboolean existing; + /* For handling the invite button */ GNOME_Evolution_Addressbook_SelectNames corba_select_names; @@ -245,6 +265,9 @@ meeting_page_destroy (GtkObject *object) mpage = MEETING_PAGE (object); priv = mpage->priv; + itip_addresses_free (priv->addresses); + g_list_free (priv->address_strings); + filename = g_strdup_printf ("%s/config/et-header-meeting-page", evolution_dir); real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (priv->etable)); @@ -298,6 +321,19 @@ clear_widgets (MeetingPage *mpage) MeetingPagePrivate *priv; 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 task page */ @@ -308,6 +344,7 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp) MeetingPagePrivate *priv; CalComponentOrganizer organizer; GSList *attendees, *l; + GList *l2; mpage = MEETING_PAGE (page); priv = mpage->priv; @@ -317,9 +354,37 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp) /* Clean the screen */ clear_widgets (mpage); + /* Organizer */ cal_component_get_organizer (comp, &organizer); - e_dialog_editable_set (priv->organizer, organizer.value); + priv->addresses = itip_addresses_get (); + for (l2 = priv->addresses; l2 != NULL; l2 = l2->next) { + ItipAddress *a = l2->data; + + priv->address_strings = g_list_append (priv->address_strings, a->full); + if (a->default_address) + priv->default_address = a->full; + } + gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); + + if (organizer.value != NULL) { + gchar *s = e_utf8_to_gtk_string (priv->existing_organizer, organizer.value); + + gtk_widget_hide (priv->organizer_table); + gtk_widget_show (priv->existing_organizer_table); + gtk_widget_hide (priv->invite); + + gtk_label_set_text (GTK_LABEL (priv->existing_organizer), s); + g_free (s); + + 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); + } + /* Attendees */ cal_component_get_attendee_list (comp, &attendees); for (l = attendees; l != NULL; l = l->next) { CalComponentAttendee *att = l->data; @@ -361,26 +426,53 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp) MeetingPagePrivate *priv; CalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; GSList *attendees = NULL, *l; - gchar *str; mpage = MEETING_PAGE (page); priv = mpage->priv; - str = e_dialog_editable_get (priv->organizer); - if (str == NULL || strlen (str) == 0) { - if (str != NULL) + if (!priv->existing) { + gchar *addr = NULL, *cn = NULL; + GList *l; + + 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; + + if (!strcmp (a->full, str)) { + addr = g_strdup (a->address); + cn = g_strdup (a->name); + } + } g_free (str); - return; - } + } + + if (addr == NULL || strlen (addr) == 0) { + g_free (addr); + g_free (cn); + return; + } else { + gchar *tmp; + + tmp = addr; + addr = g_strdup_printf ("MAILTO:%s", addr); + g_free (tmp); + } - organizer.value = str; - cal_component_set_organizer (comp, &organizer); - g_free (str); + organizer.value = addr; + organizer.cn = cn; + cal_component_set_organizer (comp, &organizer); + g_free (addr); + g_free (cn); + } for (l = priv->attendees; l != NULL; l = l->next) { struct attendee *attendee = l->data; CalComponentAttendee *att = g_new0 (CalComponentAttendee, 1); + att->value = attendee->address; att->member = (attendee->member && *attendee->member) ? attendee->member : NULL; att->cutype= attendee->cutype; @@ -420,13 +512,29 @@ get_widgets (MeetingPage *mpage) gtk_widget_ref (priv->main); gtk_widget_unparent (priv->main); + 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"); + priv->existing_organizer_table = GW ("existing-organizer-table"); + priv->existing_organizer = GW ("existing-organizer"); + priv->existing_organizer_btn = GW ("existing-organizer-button"); priv->invite = GW ("invite"); #undef GW return (priv->invite - && priv->organizer); + && 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); } static void @@ -520,6 +628,44 @@ field_changed_cb (GtkWidget *widget, gpointer data) 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_show (priv->other_organizer_lbl); + gtk_widget_show (priv->other_organizer); + + gtk_label_set_text (GTK_LABEL (priv->organizer_lbl), _("Sent By:")); + + priv->other = TRUE; +} + +/* Function called to change the organizer */ +static void +change_clicked_cb (GtkWidget *widget, gpointer data) +{ + MeetingPage *mpage; + MeetingPagePrivate *priv; + + mpage = MEETING_PAGE (data); + priv = mpage->priv; + + gtk_widget_show (priv->organizer_table); + gtk_widget_hide (priv->existing_organizer_table); + gtk_widget_show (priv->invite); + + gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); + e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address); + + priv->existing = FALSE; +} + /* Function called to invite more people */ static void invite_cb (GtkWidget *widget, gpointer data) @@ -554,6 +700,11 @@ init_widgets (MeetingPage *mpage) gtk_signal_connect (GTK_OBJECT (priv->organizer), "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); + /* Invite button */ gtk_signal_connect (GTK_OBJECT (priv->invite), "clicked", GTK_SIGNAL_FUNC (invite_cb), mpage); diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade index 4e23c16f67..de57779044 100644 --- a/calendar/gui/dialogs/meeting-page.glade +++ b/calendar/gui/dialogs/meeting-page.glade @@ -27,15 +27,15 @@ GtkVBox meeting-page - 5 + 4 False 4 - GtkHBox - hbox1 + GtkVBox + vbox1 False - 4 + 0 0 False @@ -43,39 +43,241 @@ - GtkLabel - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 + GtkTable + organizer-table + 4 + 2 + 3 + False + 0 + 4 0 - False - False + True + True + + + GtkCombo + organizer + True + False + False + True + False + + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + entry2 + True + True + True + 0 + + + + + + GtkButton + other-organizer-button + True + + + 2 + 3 + 0 + 1 + 0 + 0 + False + False + False + False + False + False + + + + + GtkEntry + other-organizer + True + True + True + 0 + + + 1 + 2 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + organizer-label + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + other-organizer-label + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + - GtkEntry - organizer - True - True - True - 0 - + GtkTable + existing-organizer-table + 4 + 1 + 3 + False + 0 + 4 0 True True - - - Placeholder + + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + False + False + + + + + GtkButton + existing-organizer-button + True + + + 2 + 3 + 0 + 1 + 0 + 0 + False + False + False + False + False + False + + + + + GtkLabel + existing-organizer + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + diff --git a/calendar/gui/gnome-cal.html b/calendar/gui/gnome-cal.html deleted file mode 100644 index 5a7d0a537f..0000000000 --- a/calendar/gui/gnome-cal.html +++ /dev/null @@ -1,44 +0,0 @@ - - - -

GNOME Calendar Documentation

-

-The GNOME calendar program is the calendaring program of the GNOME -system. It uses the vCalendar standard for transfering calendar -information (and is also the on-disk format used). - -

- - -

Command line options

- -Several options are available on the command line, they are: -
    -
  • --events Displays the events for the date - specified (or today, if no date is specified). - -
  • --from DATE Define the beginning of the range for - the event display, or the startup day on the calenday views. - By default, the event will span the whole day specified in - DATE. - -
  • --to DATE Define the range end for the event - display. If this is not specified, it will default to the end - of the day specified by the --from option. - -
  • --file FILE Set the calendar to the FILE - specified on the command line. - -
  • --todo Dumps the to-do values to standard output. -
- -

- -DATE is interpreted as being in the local time- zone, unless a -specific timezone is specified. Examples of valid date specifications -include: "1 month ago", "2 hours ago", "400000 seconds ago", "last -year", "last Monday", "yesterday", "a fortnight ago", "3/31/92 -10:00:07 PST", "January 23, 1987 10:05pm", "22:00 GMT". - - - diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index b3566e51cf..5c0f040812 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -21,8 +21,11 @@ * USA */ +#include #include #include +#include +#include #include #include #include @@ -56,48 +59,91 @@ static icalproperty_method itip_methods_enum[] = { ICAL_METHOD_DECLINECOUNTER, }; -gchar *partstat_values[] = { - "Needs action", - "Accepted", - "Declined", - "Tentative", - "Delegated", - "Completed", - "In Progress", - "Unknown" -}; +static void +error_dialog (gchar *str) +{ + GtkWidget *dlg; + + dlg = gnome_error_dialog (str); + gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); +} -gchar *role_values[] = { - "Chair", - "Required Participant", - "Optional Participant", - "Non-Participant" -}; +GList * +itip_addresses_get (void) +{ + static Bonobo_ConfigDatabase db = NULL; + CORBA_Environment ev; + GList *addresses = NULL; + gboolean have_default = FALSE; + gint len, i; + + if (db == NULL) { + CORBA_exception_init (&ev); + + db = bonobo_get_object ("wombat:", + "Bonobo/ConfigDatabase", + &ev); + + if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { + CORBA_exception_free (&ev); + return NULL; + } + + CORBA_exception_free (&ev); + } + + len = bonobo_config_get_long_with_default (db, "/Mail/Accounts/num", 0, NULL); + for (i = 0; i < len; i++) { + ItipAddress *a; + gchar *path; + + a = g_new0 (ItipAddress, 1); + /* get the identity info */ + path = g_strdup_printf ("/Mail/Accounts/identity_name_%d", i); + a->name = bonobo_config_get_string (db, path, NULL); + g_free (path); -/* Note that I have to iterate and check myself because - ical_property_get_xxx_parameter doesn't take into account the - kind of parameter for which you wish to search! */ -icalparameter * -get_icalparam_by_type (icalproperty *prop, icalparameter_kind kind) -{ - icalparameter *param; + path = g_strdup_printf ("/Mail/Accounts/identity_address_%d", i); + a->address = bonobo_config_get_string (db, path, NULL); + g_free (path); - for (param = icalproperty_get_first_parameter (prop, ICAL_ANY_PARAMETER); - param != NULL && icalparameter_isa (param) != kind; - param = icalproperty_get_next_parameter (prop, ICAL_ANY_PARAMETER) ); + path = g_strdup_printf ("/Mail/Accounts/account_is_default_%d", i); + a->default_address = !have_default && bonobo_config_get_boolean (db, path, NULL); - return param; + if (a->default_address) + have_default = TRUE; + g_free (path); + + a->full = g_strdup_printf ("%s <%s>", a->name, a->address); + addresses = g_list_append (addresses, a); + } + + /* If nothing was marked as default */ + if (!have_default && addresses != NULL) { + ItipAddress *a = addresses->data; + + a->default_address = TRUE; + } + + return addresses; } -static void -error_dialog (gchar *str) +void +itip_addresses_free (GList *addresses) { - GtkWidget *dlg; + GList *l; - dlg = gnome_error_dialog (str); - gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); + for (l = addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + + g_free (a->name); + g_free (a->address); + g_free (a->full); + g_free (a); + } + g_list_free (addresses); } void diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h index b51696876f..fcf53aada6 100644 --- a/calendar/gui/itip-utils.h +++ b/calendar/gui/itip-utils.h @@ -8,11 +8,6 @@ #include #include -extern gchar *partstat_values[]; -extern gchar *role_values[]; - -icalparameter * get_icalparam_by_type (icalproperty *prop, icalparameter_kind kind); - typedef enum { CAL_COMPONENT_METHOD_PUBLISH, CAL_COMPONENT_METHOD_REQUEST, @@ -24,6 +19,18 @@ typedef enum { CAL_COMPONENT_METHOD_DECLINECOUNTER } CalComponentItipMethod; +typedef struct { + gchar *name; + gchar *address; + gchar *full; + + gboolean default_address; +} ItipAddress; + +GList *itip_addresses_get (void); +void itip_addresses_free (GList *addresses); + void itip_send_comp (CalComponentItipMethod method, CalComponent *comp); + #endif -- cgit v1.2.3