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/dialogs | |
parent | ff91646452fd4bcddbfc1d6acc5d18c99cf021f6 (diff) | |
download | gsoc2013-evolution-ea8185e64b61fd8d97ecd8e4745698d4020f2a5f.tar.gz 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/dialogs')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 177 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.glade | 252 |
3 files changed, 394 insertions, 38 deletions
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 <config.h> #endif +#include <glib.h> +#include <libgnome/gnome-defs.h> +#include <libgnome/gnome-i18n.h> #include <liboaf/liboaf.h> #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-widget.h> @@ -39,10 +42,10 @@ #include <gal/e-table/e-table-scrolled.h> #include <gal/widgets/e-unicode.h> #include <widgets/misc/e-dateedit.h> -#include <widgets/meeting-time-sel/e-meeting-time-sel.h> #include <e-util/e-dialog-widgets.h> -#include <addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.h> +#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 @@ <widget> <class>GtkVBox</class> <name>meeting-page</name> - <border_width>5</border_width> + <border_width>4</border_width> <homogeneous>False</homogeneous> <spacing>4</spacing> <widget> - <class>GtkHBox</class> - <name>hbox1</name> + <class>GtkVBox</class> + <name>vbox1</name> <homogeneous>False</homogeneous> - <spacing>4</spacing> + <spacing>0</spacing> <child> <padding>0</padding> <expand>False</expand> @@ -43,39 +43,241 @@ </child> <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>Organizer</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> + <class>GtkTable</class> + <name>organizer-table</name> + <border_width>4</border_width> + <rows>2</rows> + <columns>3</columns> + <homogeneous>False</homogeneous> + <row_spacing>0</row_spacing> + <column_spacing>4</column_spacing> <child> <padding>0</padding> - <expand>False</expand> - <fill>False</fill> + <expand>True</expand> + <fill>True</fill> </child> + + <widget> + <class>GtkCombo</class> + <name>organizer</name> + <value_in_list>True</value_in_list> + <ok_if_empty>False</ok_if_empty> + <case_sensitive>False</case_sensitive> + <use_arrows>True</use_arrows> + <use_arrows_always>False</use_arrows_always> + <items></items> + <child> + <left_attach>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</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> + <class>GtkEntry</class> + <child_name>GtkCombo:entry</child_name> + <name>entry2</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + </widget> + </widget> + + <widget> + <class>GtkButton</class> + <name>other-organizer-button</name> + <can_focus>True</can_focus> + <label>Other Organizer</label> + <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> + <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>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>True</xfill> + <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> - <class>GtkEntry</class> - <name>organizer</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> + <class>GtkTable</class> + <name>existing-organizer-table</name> + <border_width>4</border_width> + <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> </child> - </widget> - <widget> - <class>Placeholder</class> + <widget> + <class>GtkLabel</class> + <name>label1</name> + <label>Organizer:</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <left_attach>0</left_attach> + <right_attach>1</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>GtkButton</class> + <name>existing-organizer-button</name> + <can_focus>True</can_focus> + <label>Change Organizer</label> + <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>GtkLabel</class> + <name>existing-organizer</name> + <label>None</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>1</left_attach> + <right_attach>2</right_attach> + <top_attach>0</top_attach> + <bottom_attach>1</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> </widget> |