diff options
-rw-r--r-- | calendar/ChangeLog | 11 | ||||
-rw-r--r-- | calendar/gui/Makefile.am | 5 | ||||
-rw-r--r-- | calendar/gui/e-meeting-dialog.glade | 300 | ||||
-rw-r--r-- | calendar/gui/e-meeting-edit.c | 257 | ||||
-rw-r--r-- | calendar/gui/e-meeting-edit.h | 35 | ||||
-rw-r--r-- | calendar/gui/event-editor.c | 26 |
6 files changed, 627 insertions, 7 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 0f2a1f8960..f8d5f360b7 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +2000-09-27 Jesse Pavel <jpavel@helixcode.com> + + * gui/event-editor.c: changed a menu entry so that it will invoke + my meeting editor. + + * gui/e-meeting-edit.[ch]: added these files to provide preliminary + support for iTIP meeting scheduling. Currently, only the GUI works; + there is not yet any backend support. + + * gui/Makefile.am: added entries for e-meeting-edit.[ch] + 2000-09-24 Damon Chaplin <damon@helixcode.com> * gui/dialogs/task-editor-dialog.glade: set the height of the scrolled diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 8e01952739..6c46f05d4e 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -38,7 +38,8 @@ LINK_FLAGS = \ gladedir = $(datadir)/evolution/glade glade_DATA = \ - event-editor-dialog.glade + event-editor-dialog.glade \ + e-meeting-dialog.glade glade_messages = event-editor-dialog.glade.h @@ -71,6 +72,8 @@ evolution_calendar_SOURCES = \ e-week-view-titles-item.h \ e-week-view.c \ e-week-view.h \ + e-meeting-edit.h \ + e-meeting-edit.c \ event-editor.c \ event-editor.h \ getdate.y \ diff --git a/calendar/gui/e-meeting-dialog.glade b/calendar/gui/e-meeting-dialog.glade new file mode 100644 index 0000000000..7dee1b9166 --- /dev/null +++ b/calendar/gui/e-meeting-dialog.glade @@ -0,0 +1,300 @@ +<?xml version="1.0"?> +<GTK-Interface> + +<project> + <name>e-meeting-dialog</name> + <program_name>e-meeting-dialog</program_name> + <directory></directory> + <source_directory>src</source_directory> + <pixmaps_directory>pixmaps</pixmaps_directory> + <language>C</language> + <gnome_support>True</gnome_support> + <gettext_support>True</gettext_support> +</project> + +<widget> + <class>GtkWindow</class> + <name>meeting_window</name> + <width>400</width> + <height>300</height> + <visible>False</visible> + <title>Meeting Invitations</title> + <type>GTK_WINDOW_DIALOG</type> + <position>GTK_WIN_POS_NONE</position> + <modal>True</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>True</allow_grow> + <auto_shrink>False</auto_shrink> + + <widget> + <class>GtkVBox</class> + <name>vbox1</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + + <widget> + <class>GtkToolbar</class> + <name>toolbar1</name> + <orientation>GTK_ORIENTATION_HORIZONTAL</orientation> + <type>GTK_TOOLBAR_BOTH</type> + <space_size>5</space_size> + <space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style> + <relief>GTK_RELIEF_NORMAL</relief> + <tooltips>True</tooltips> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + + <widget> + <class>GtkButton</class> + <child_name>Toolbar:button</child_name> + <name>send_button</name> + <width>64</width> + <label>Send</label> + <stock_pixmap>GNOME_STOCK_PIXMAP_MAIL_SND</stock_pixmap> + </widget> + + <widget> + <class>GtkButton</class> + <child_name>Toolbar:button</child_name> + <name>cancel_button</name> + <label>Cancel</label> + <stock_pixmap>GNOME_STOCK_PIXMAP_CLOSE</stock_pixmap> + </widget> + </widget> + + <widget> + <class>GtkScrolledWindow</class> + <name>scrolledwindow1</name> + <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy> + <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> + <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> + <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkCList</class> + <name>attendee_list</name> + <border_width>3</border_width> + <can_focus>True</can_focus> + <columns>2</columns> + <column_widths>222,80</column_widths> + <selection_mode>GTK_SELECTION_SINGLE</selection_mode> + <show_titles>True</show_titles> + <shadow_type>GTK_SHADOW_IN</shadow_type> + + <widget> + <class>GtkLabel</class> + <child_name>CList:title</child_name> + <name>attendee_label</name> + <label>Attendee</label> + <justify>GTK_JUSTIFY_LEFT</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + + <widget> + <class>GtkLabel</class> + <child_name>CList:title</child_name> + <name>status_label</name> + <label>Status</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + </widget> + </widget> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox1</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkLabel</class> + <name>label1</name> + <label>Attendees: </label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>4</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkHButtonBox</class> + <name>hbuttonbox3</name> + <layout_style>GTK_BUTTONBOX_START</layout_style> + <spacing>0</spacing> + <child_min_width>83</child_min_width> + <child_min_height>29</child_min_height> + <child_ipad_x>8</child_ipad_x> + <child_ipad_y>1</child_ipad_y> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkButton</class> + <name>add_button</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>Add</label> + </widget> + + <widget> + <class>GtkButton</class> + <name>delete_button</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>Delete</label> + </widget> + + <widget> + <class>GtkButton</class> + <name>edit_button</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <label>Edit</label> + </widget> + </widget> + </widget> + </widget> +</widget> + +<widget> + <class>GnomeDialog</class> + <name>add_dialog</name> + <width>344</width> + <height>115</height> + <visible>False</visible> + <title>Attendee</title> + <type>GTK_WINDOW_DIALOG</type> + <position>GTK_WIN_POS_MOUSE</position> + <modal>True</modal> + <allow_shrink>False</allow_shrink> + <allow_grow>False</allow_grow> + <auto_shrink>False</auto_shrink> + <auto_close>False</auto_close> + <hide_on_close>False</hide_on_close> + + <widget> + <class>GtkVBox</class> + <child_name>GnomeDialog:vbox</child_name> + <name>dialog-vbox1</name> + <homogeneous>False</homogeneous> + <spacing>8</spacing> + <child> + <padding>4</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkHButtonBox</class> + <child_name>GnomeDialog:action_area</child_name> + <name>dialog-action_area1</name> + <layout_style>GTK_BUTTONBOX_SPREAD</layout_style> + <spacing>8</spacing> + <child_min_width>85</child_min_width> + <child_min_height>27</child_min_height> + <child_ipad_x>7</child_ipad_x> + <child_ipad_y>0</child_ipad_y> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>True</fill> + <pack>GTK_PACK_END</pack> + </child> + + <widget> + <class>GtkButton</class> + <name>button1</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> + </widget> + + <widget> + <class>GtkButton</class> + <name>button3</name> + <can_default>True</can_default> + <can_focus>True</can_focus> + <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> + </widget> + </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox2</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + + <widget> + <class>GtkLabel</class> + <name>label2</name> + <label>Attendee address</label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>6</xpad> + <ypad>0</ypad> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkEntry</class> + <name>address_entry</name> + <can_focus>True</can_focus> + <editable>True</editable> + <text_visible>True</text_visible> + <text_max_length>0</text_max_length> + <text></text> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + </widget> + </widget> +</widget> + +</GTK-Interface> diff --git a/calendar/gui/e-meeting-edit.c b/calendar/gui/e-meeting-edit.c new file mode 100644 index 0000000000..4b0499542a --- /dev/null +++ b/calendar/gui/e-meeting-edit.c @@ -0,0 +1,257 @@ +/* Evolution calendar - Meeting editor dialog + * + * Copyright (C) 2000 Helix Code, Inc. + * + * Authors: Jesse Pavel <jpavel@helixcode.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <config.h> +#include <gnome.h> +#include <glade/glade.h> +#include <icaltypes.h> +#include "e-meeting-edit.h" + +#define E_MEETING_GLADE_XML "e-meeting-dialog.glade" + +#define E_MEETING_DEBUG + +/* These are the widgets to be used in the GUI. */ +static GladeXML *xml; +static GtkWidget *meeting_window; +static GtkWidget *attendee_list; +static GtkWidget *address_entry; +static GtkWidget *add_dialog; +static gint selected_row; + + +static gboolean +window_delete_cb (GtkWidget *widget, + GdkEvent *event, + gpointer data) +{ + +#ifdef E_MEETING_DEBUG + g_print ("e-meeting-edit.c: The main window received a delete event.\n"); +#endif + + return (FALSE); +} + +static void +window_destroy_cb (GtkWidget *widget, + gpointer data) +{ +#ifdef E_MEETING_DEBUG + g_print ("e-meeting-edit.c: The main window received a destroy event.\n"); +#endif + gtk_main_quit (); + return; +} + +static void +add_button_clicked_cb (GtkWidget *widget, gpointer data) +{ + gint button_num; + +#ifdef E_MEETING_DEBUG + g_print ("e-meeting-edit.c: the add button was clicked.\n"); +#endif + if (add_dialog == NULL || address_entry == NULL) { + add_dialog = glade_xml_get_widget (xml, "add_dialog"); + address_entry = glade_xml_get_widget (xml, "address_entry"); + + gnome_dialog_set_close (GNOME_DIALOG (add_dialog), TRUE); + gnome_dialog_editable_enters (GNOME_DIALOG (add_dialog), GTK_EDITABLE (address_entry)); + gnome_dialog_close_hides (GNOME_DIALOG (add_dialog), TRUE); + gnome_dialog_set_default (GNOME_DIALOG (add_dialog), 0); + } + + g_return_if_fail (add_dialog != NULL); + g_return_if_fail (address_entry != NULL); + + gtk_widget_show (add_dialog); + + button_num = gnome_dialog_run (GNOME_DIALOG (add_dialog)); + + if (button_num == 0) { + /* The user pressed Okay--let's add it to our list. */ + gchar temp_stat[] = "Needs action"; + gchar *address; + gchar * row_text[2]; + + address = gtk_entry_get_text (GTK_ENTRY (address_entry)); + row_text[0] = address; + row_text[1] = temp_stat; + + gtk_clist_append (GTK_CLIST (attendee_list), row_text); + } + + gtk_entry_set_text (GTK_ENTRY (address_entry), ""); +} + +static void +delete_button_clicked_cb (GtkWidget *widget, gpointer data) +{ + if (selected_row < 0) { + GtkWidget *dialog; + + dialog = gnome_warning_dialog_parented ("You must select an entry to delete.", + GTK_WINDOW (add_dialog)); + gnome_dialog_run (GNOME_DIALOG(dialog)); + } + else { + gtk_clist_remove (GTK_CLIST (attendee_list), selected_row); + selected_row = -1; + } +} + +static void +edit_button_clicked_cb (GtkWidget *widget, gpointer data) +{ + if (selected_row < 0) { + GtkWidget *dialog; + + dialog = gnome_warning_dialog_parented ("You must select an entry to edit.", + GTK_WINDOW (add_dialog)); + gnome_dialog_run (GNOME_DIALOG(dialog)); + return; + } + else { + gchar *text[2]; + gint cntr; + gint button_num; + + for (cntr = 0; cntr < 2; cntr++) { + gtk_clist_get_text (GTK_CLIST (attendee_list), + selected_row, + cntr, + &text[cntr]); + } + + if (add_dialog == NULL || address_entry == NULL) { + add_dialog = glade_xml_get_widget (xml, "add_dialog"); + address_entry = glade_xml_get_widget (xml, "address_entry"); + + gnome_dialog_set_close (GNOME_DIALOG (add_dialog), TRUE); + gnome_dialog_editable_enters (GNOME_DIALOG (add_dialog), GTK_EDITABLE (address_entry)); + gnome_dialog_close_hides (GNOME_DIALOG (add_dialog), TRUE); + gnome_dialog_set_default (GNOME_DIALOG (add_dialog), 0); + } + + gtk_entry_set_text (GTK_ENTRY (address_entry), text[0]); + + gtk_widget_show (add_dialog); + + button_num = gnome_dialog_run (GNOME_DIALOG (add_dialog)); + + if (button_num == 0) { + gchar *new_text; + + new_text = gtk_entry_get_text (GTK_ENTRY (address_entry)); + + gtk_clist_set_text (GTK_CLIST (attendee_list), + selected_row, + 0, + new_text); + } + + gtk_entry_set_text (GTK_ENTRY (address_entry), ""); + } +} + + + + + + +static void list_row_select_cb (GtkWidget *widget, + gint row, + gint column, + GdkEventButton *event, + gpointer data) +{ + selected_row = row; +} + +static void +reset_widgets (void) +{ + xml = NULL; + meeting_window = NULL; + attendee_list = NULL; + address_entry = NULL; + add_dialog = NULL; + selected_row = -1; +} + +void +e_meeting_edit (CalComponent *comp, CalClient *client) +{ + GtkWidget *add_button, *delete_button, *edit_button; + + reset_widgets (); + + xml = glade_xml_new (EVOLUTION_GLADEDIR "/" E_MEETING_GLADE_XML, NULL); + + meeting_window = glade_xml_get_widget (xml, "meeting_window"); + attendee_list = glade_xml_get_widget (xml, "attendee_list"); + + gtk_clist_set_column_justification (GTK_CLIST (attendee_list), 1, GTK_JUSTIFY_CENTER); + + gtk_signal_connect (GTK_OBJECT (meeting_window), "delete_event", + GTK_SIGNAL_FUNC (window_delete_cb), NULL); + + gtk_signal_connect_after (GTK_OBJECT (meeting_window), "delete_event", + GTK_SIGNAL_FUNC (window_destroy_cb), NULL); + + gtk_signal_connect (GTK_OBJECT (meeting_window), "destroy_event", + GTK_SIGNAL_FUNC (window_destroy_cb), NULL); + + gtk_signal_connect (GTK_OBJECT (attendee_list), "select_row", + GTK_SIGNAL_FUNC (list_row_select_cb), NULL); + + add_button = glade_xml_get_widget (xml, "add_button"); + delete_button = glade_xml_get_widget (xml, "delete_button"); + edit_button = glade_xml_get_widget (xml, "edit_button"); + + gtk_signal_connect (GTK_OBJECT (add_button), "clicked", + GTK_SIGNAL_FUNC (add_button_clicked_cb), NULL); + + gtk_signal_connect (GTK_OBJECT (delete_button), "clicked", + GTK_SIGNAL_FUNC (delete_button_clicked_cb), NULL); + + gtk_signal_connect (GTK_OBJECT (edit_button), "clicked", + GTK_SIGNAL_FUNC (edit_button_clicked_cb), NULL); + + gtk_widget_show (meeting_window); + + gtk_main (); + +#ifdef E_MEETING_DEBUG + g_print ("e-meeting-edit.c: We've terminated the subsidiary gtk_main().\n"); +#endif + + if (meeting_window != NULL) + gtk_widget_destroy (meeting_window); + + if (add_dialog != NULL) + gtk_widget_destroy (add_dialog); + + + + gtk_object_destroy (GTK_OBJECT (xml)); +} diff --git a/calendar/gui/e-meeting-edit.h b/calendar/gui/e-meeting-edit.h new file mode 100644 index 0000000000..82b2af9288 --- /dev/null +++ b/calendar/gui/e-meeting-edit.h @@ -0,0 +1,35 @@ +/* Evolution calendar - Meeting editor dialog + * + * Copyright (C) 2000 Helix Code, Inc. + * + * Authors: Jesse Pavel <jpavel@helixcode.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __E_MEETING_EDIT_H__ +#define __E_MEETING_EDIT_H__ + +#include <config.h> +#include <gnome.h> +#include <glade/glade.h> +#include <cal-util/cal-component.h> +#include <cal-client/cal-client.h> + +void e_meeting_edit (CalComponent *comp, CalClient *client); + + +#endif /* __E_MEETING_EDIT_H__ */ + diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index 92d843ce89..5f7b693be3 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -29,6 +29,7 @@ #include <gal/widgets/e-unicode.h> #include <cal-util/timeutil.h> #include "event-editor.h" +#include "e-meeting-edit.h" @@ -1147,14 +1148,28 @@ file_close_cb (GtkWidget *widget, gpointer data) close_dialog (ee); } - +static void +schedule_meeting_cb (GtkWidget *widget, gpointer data) +{ + EventEditor *ee; + EventEditorPrivate *priv; + + ee = EVENT_EDITOR (data); + + g_return_if_fail (IS_EVENT_EDITOR (ee)); + + priv = (EventEditorPrivate *)ee->priv; + + e_meeting_edit (priv->comp, priv->client); +} + + + + /* Menu bar */ static GnomeUIInfo file_new_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Appointment"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Meeting Re_quest"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Mail Message"), NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Contact"), NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Task"), NULL, NULL), @@ -1297,8 +1312,7 @@ static GnomeUIInfo actions_menu[] = { GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_NONE (N_("FIXME: Rec_urrence..."), NULL, NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Invite _Attendees..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: C_ancel Invitation..."), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("Schedule _Meeting..."), NULL, schedule_meeting_cb), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_NONE (N_("FIXME: Forward as v_Calendar"), NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: For_ward"), NULL, NULL), |