diff options
author | JP Rosevear <jpr@ximian.com> | 2001-07-07 04:27:31 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-07-07 04:27:31 +0800 |
commit | ea8185e64b61fd8d97ecd8e4745698d4020f2a5f (patch) | |
tree | c1e0b30978bc10b0f26fe4cbfd72560596d243db /calendar/gui/itip-utils.c | |
parent | ff91646452fd4bcddbfc1d6acc5d18c99cf021f6 (diff) | |
download | gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.tar gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.tar.gz gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.tar.bz2 gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.tar.lz gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.tar.xz gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.tar.zst gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.zip |
actually clear some widgets and hide/show widgets in the default setup
2001-07-06 JP Rosevear <jpr@ximian.com>
* 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
Diffstat (limited to 'calendar/gui/itip-utils.c')
-rw-r--r-- | calendar/gui/itip-utils.c | 110 |
1 files changed, 78 insertions, 32 deletions
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 <bonobo/bonobo-exception.h> #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-object-client.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo-conf/bonobo-config-database.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-dialog.h> @@ -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 |