From 98a3ac0e6c55a4bcb3c043b916c5df1faff98f7c Mon Sep 17 00:00:00 2001 From: Jesse Pavel Date: Wed, 27 Sep 2000 22:17:19 +0000 Subject: *** empty log message *** svn path=/trunk/; revision=5603 --- calendar/ChangeLog | 11 ++ calendar/gui/Makefile.am | 5 +- calendar/gui/e-meeting-dialog.glade | 300 ++++++++++++++++++++++++++++++++++++ calendar/gui/e-meeting-edit.c | 257 ++++++++++++++++++++++++++++++ calendar/gui/e-meeting-edit.h | 35 +++++ calendar/gui/event-editor.c | 26 +++- 6 files changed, 627 insertions(+), 7 deletions(-) create mode 100644 calendar/gui/e-meeting-dialog.glade create mode 100644 calendar/gui/e-meeting-edit.c create mode 100644 calendar/gui/e-meeting-edit.h 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 + + * 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 * 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 @@ + + + + + e-meeting-dialog + e-meeting-dialog + + src + pixmaps + C + True + True + + + + GtkWindow + meeting_window + 400 + 300 + False + Meeting Invitations + GTK_WINDOW_DIALOG + GTK_WIN_POS_NONE + True + False + True + False + + + GtkVBox + vbox1 + False + 0 + + + GtkToolbar + toolbar1 + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + 5 + GTK_TOOLBAR_SPACE_EMPTY + GTK_RELIEF_NORMAL + True + + 0 + False + False + + + + GtkButton + Toolbar:button + send_button + 64 + + GNOME_STOCK_PIXMAP_MAIL_SND + + + + GtkButton + Toolbar:button + cancel_button + + GNOME_STOCK_PIXMAP_CLOSE + + + + + GtkScrolledWindow + scrolledwindow1 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkCList + attendee_list + 3 + True + 2 + 222,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkLabel + CList:title + attendee_label + + GTK_JUSTIFY_LEFT + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + status_label + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkHBox + hbox1 + False + 0 + + 0 + False + False + GTK_PACK_END + + + + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 4 + False + False + + + + + GtkHButtonBox + hbuttonbox3 + GTK_BUTTONBOX_START + 0 + 83 + 29 + 8 + 1 + + 0 + True + True + + + + GtkButton + add_button + True + True + + + + + GtkButton + delete_button + True + True + + + + + GtkButton + edit_button + True + True + + + + + + + + + GnomeDialog + add_dialog + 344 + 115 + False + Attendee + GTK_WINDOW_DIALOG + GTK_WIN_POS_MOUSE + True + False + False + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_SPREAD + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button3 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkHBox + hbox2 + False + 0 + + 0 + True + True + + + + GtkLabel + label2 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 6 + 0 + + 0 + False + False + + + + + GtkEntry + address_entry + True + True + True + 0 + + + 0 + True + True + + + + + + + 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 + * + * 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 +#include +#include +#include +#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 + * + * 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 +#include +#include +#include +#include + +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 #include #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), -- cgit