From e3e5b0a37cf90b6c7b04f9bd1266ea515cbe25ec Mon Sep 17 00:00:00 2001 From: Jesse Pavel Date: Mon, 6 Nov 2000 23:10:42 +0000 Subject: *gui/e-itip-control.c, gui/e-itip-control.glade: changed to GUI to accomodate dynamically generated buttons, which will be tailored to the type of iTip message that is incoming. *gui/e-meeting-dialog.glade gui/e-meeting-edit.c: added a new button to publish events, in addition to requesting meetings. svn path=/trunk/; revision=6463 --- calendar/ChangeLog | 9 +++ calendar/gui/e-itip-control.c | 85 +++++++++++++++++++++--- calendar/gui/e-itip-control.glade | 129 +++++++++++++++++++++++++++++------- calendar/gui/e-meeting-dialog.glade | 22 +++++- calendar/gui/e-meeting-edit.c | 68 +++++++++++++------ 5 files changed, 256 insertions(+), 57 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 426ee0b488..a7616b3728 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2000-11-06 Jesse Pavel + + *gui/e-itip-control.c, gui/e-itip-control.glade: changed to GUI to + accomodate dynamically generated buttons, which will be tailored to + the type of iTip message that is incoming. + + *gui/e-meeting-dialog.glade gui/e-meeting-edit.c: added a new button + to publish events, in addition to requesting meetings. + 2000-11-05 Federico Mena Quintero * gui/event-editor-dialog.glade: Removed the old recurrence page. diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 193667b9b7..b017678be3 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -22,26 +22,31 @@ #define DEFAULT_WIDTH 500 -#define DEFAULT_HEIGHT 400 +#define DEFAULT_HEIGHT 300 extern gchar *evolution_dir; typedef struct _EItipControlPrivate EItipControlPrivate; struct _EItipControlPrivate { - GladeXML *xml; + GladeXML *xml, *xml2; GtkWidget *main_frame; GtkWidget *text_box; GtkWidget *organizer_entry, *dtstart_label, *dtend_label; - GtkWidget *summary_entry, *description_box; + GtkWidget *summary_entry, *description_box, *type_entry; + GtkWidget *address_entry; GtkWidget *add_button; GtkWidget *loading_window; GtkWidget *loading_progress; icalcomponent *main_comp, *comp; CalComponent *cal_comp; + gchar *from_address; }; +enum E_ITIP_BONOBO_ARGS { + FROM_ADDRESS_ARG_ID +}; #if 0 static icalparameter * @@ -64,6 +69,8 @@ itip_control_destroy_cb (GtkObject *object, EItipControlPrivate *priv = data; gtk_object_unref (GTK_OBJECT (priv->xml)); + gtk_object_unref (GTK_OBJECT (priv->xml2)); + if (priv->main_comp != NULL) { icalcomponent_free (priv->main_comp); } @@ -71,6 +78,10 @@ itip_control_destroy_cb (GtkObject *object, if (priv->cal_comp != NULL) { gtk_object_unref (GTK_OBJECT (priv->cal_comp)); } + + if (priv->from_address != NULL) + g_free (priv->from_address); + g_free (priv); } @@ -338,6 +349,19 @@ pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream, gtk_label_set_text (GTK_LABEL (priv->dtstart_label), ctime (&tstart)); gtk_label_set_text (GTK_LABEL (priv->dtend_label), ctime (&tend)); + + prop = icalcomponent_get_first_property (priv->main_comp, ICAL_METHOD_PROPERTY); + switch (icalproperty_get_method (prop)) { + case ICAL_METHOD_PUBLISH: + gtk_entry_set_text (GTK_ENTRY (priv->type_entry), "Published information"); + break; + case ICAL_METHOD_REQUEST: + gtk_entry_set_text (GTK_ENTRY (priv->type_entry), "Meeting Request"); + break; + default: + gtk_entry_set_text (GTK_ENTRY (priv->type_entry), "Unknown"); + } + } pos = 0; @@ -404,10 +428,41 @@ pstream_get_content_types (BonoboPersistStream *ps, void *closure, return bonobo_persist_generate_content_types (2, "text/calendar", "text/x-calendar"); } +static void +get_prop ( BonoboPropertyBag *bag, BonoboArg *arg, + guint arg_id, gpointer user_data ) +{ + EItipControlPrivate *priv = user_data; + + BONOBO_ARG_SET_STRING (arg, priv->from_address); +} + +static void +set_prop ( BonoboPropertyBag *bag, const BonoboArg *arg, + guint arg_id, gpointer user_data ) +{ + EItipControlPrivate *priv = user_data; + + if (arg_id == FROM_ADDRESS_ARG_ID) { + if (priv->from_address) + g_free (priv->from_address); + + + priv->from_address = g_strdup (BONOBO_ARG_GET_STRING (arg)); + + /* Let's set the widget here, though I'm not sure if + it will work. */ + gtk_entry_set_text (GTK_ENTRY (priv->address_entry), priv->from_address); + + } +} + + static BonoboObject * e_itip_control_factory (BonoboGenericFactory *Factory, void *closure) { BonoboControl *control; + BonoboPropertyBag *prop_bag; BonoboPersistStream *stream; EItipControlPrivate *priv; @@ -423,9 +478,12 @@ e_itip_control_factory (BonoboGenericFactory *Factory, void *closure) priv->dtend_label = glade_xml_get_widget (priv->xml, "dtend_label"); priv->summary_entry = glade_xml_get_widget (priv->xml, "summary_entry"); priv->description_box = glade_xml_get_widget (priv->xml, "description_box"); - priv->add_button = glade_xml_get_widget (priv->xml, "add_button"); - priv->loading_progress = glade_xml_get_widget (priv->xml, "loading_progress"); - priv->loading_window = glade_xml_get_widget (priv->xml, "loading_window"); + /* priv->add_button = glade_xml_get_widget (priv->xml, "add_button"); */ + priv->address_entry = glade_xml_get_widget (priv->xml, "address_entry"); + + priv->xml2 = glade_xml_new (EVOLUTION_GLADEDIR "/" "e-itip-control.glade", "loading_window"); + priv->loading_progress = glade_xml_get_widget (priv->xml2, "loading_progress"); + priv->loading_window = glade_xml_get_widget (priv->xml2, "loading_window"); gtk_text_set_editable (GTK_TEXT (priv->text_box), FALSE); @@ -433,14 +491,25 @@ e_itip_control_factory (BonoboGenericFactory *Factory, void *closure) GTK_SIGNAL_FUNC (itip_control_destroy_cb), priv); gtk_signal_connect (GTK_OBJECT (priv->main_frame), "size_request", GTK_SIGNAL_FUNC (itip_control_size_request_cb), priv); - gtk_signal_connect (GTK_OBJECT (priv->add_button), "clicked", - GTK_SIGNAL_FUNC (add_button_clicked_cb), priv); + /******** + * gtk_signal_connect (GTK_OBJECT (priv->add_button), "clicked", + * GTK_SIGNAL_FUNC (add_button_clicked_cb), priv); + ********/ gtk_widget_show (priv->text_box); gtk_widget_show (priv->main_frame); control = bonobo_control_new (priv->main_frame); + /* create a property bag */ + prop_bag = bonobo_property_bag_new ( get_prop, set_prop, priv ); + bonobo_control_set_properties (control, prop_bag); + + bonobo_property_bag_add (prop_bag, "from_address", FROM_ADDRESS_ARG_ID, BONOBO_ARG_STRING, NULL, + "from_address", 0 ); + + bonobo_control_set_automerge (control, TRUE); + stream = bonobo_persist_stream_new (pstream_load, pstream_save, pstream_get_max_size, pstream_get_content_types, diff --git a/calendar/gui/e-itip-control.glade b/calendar/gui/e-itip-control.glade index e17d20190e..2eeb7cc63e 100644 --- a/calendar/gui/e-itip-control.glade +++ b/calendar/gui/e-itip-control.glade @@ -28,6 +28,7 @@ GtkFrame main_frame 4 + 231 0.11 GTK_SHADOW_ETCHED_IN @@ -54,7 +55,7 @@ GtkTable table1 - 4 + 6 2 False 0 @@ -328,11 +329,112 @@ + + + GtkLabel + label11 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + address_entry + True + False + True + 0 + + + 1 + 2 + 4 + 5 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label12 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + + + + GtkEntry + type_entry + True + True + True + 0 + + + 1 + 2 + 5 + 6 + 0 + 0 + True + False + False + False + True + False + + GtkHButtonBox - hbuttonbox1 + button_box + 35 GTK_BUTTONBOX_DEFAULT_STYLE 30 85 @@ -344,27 +446,6 @@ True True - - - GtkButton - add_button - True - True - - - - - - GtkText - text_box - True - False - - - 0 - True - True - @@ -430,7 +511,7 @@ GtkProgressBar - progressbar1 + loading_progress 0 0 100 diff --git a/calendar/gui/e-meeting-dialog.glade b/calendar/gui/e-meeting-dialog.glade index 96e6707013..5b9a057f46 100644 --- a/calendar/gui/e-meeting-dialog.glade +++ b/calendar/gui/e-meeting-dialog.glade @@ -50,9 +50,9 @@ GtkButton Toolbar:button - send_button - + publish_button + GNOME_STOCK_PIXMAP_MAIL_SND @@ -63,6 +63,22 @@ Updates 58 + + GtkButton + Toolbar:button + request_button + + GNOME_STOCK_PIXMAP_REFRESH + + + + GtkVSeparator + vseparator3 + 13 + 58 + + GtkButton Toolbar:button diff --git a/calendar/gui/e-meeting-edit.c b/calendar/gui/e-meeting-edit.c index 107dfc66a3..142e916997 100644 --- a/calendar/gui/e-meeting-edit.c +++ b/calendar/gui/e-meeting-edit.c @@ -44,7 +44,7 @@ struct _EMeetingEditorPrivate { GtkWidget *organizer_entry; GtkWidget *role_entry; GtkWidget *rsvp_check; - GtkWidget *send_button, *schedule_button; + GtkWidget *publish_button, *request_button, *schedule_button; gint changed_signal_id; @@ -500,21 +500,20 @@ schedule_button_clicked_cb (GtkWidget *widget, gpointer data) static gchar *itip_methods[] = { - "REQUEST" + "REQUEST", + "PUBLISH" }; enum itip_method_enum { - METHOD_REQUEST + METHOD_REQUEST, + METHOD_PUBLISH }; -/******** - * This routine is called when the send button is clicked. Duh. - * Actually, I'm just testing my commenting macros. - ********/ +typedef enum itip_method_enum itip_method_enum; + static void -send_button_clicked_cb (GtkWidget *widget, gpointer data) +send_calendar_info (itip_method_enum method, EMeetingEditorPrivate *priv) { - EMeetingEditorPrivate *priv; BonoboObjectClient *bonobo_server; Evolution_Composer composer_server; CORBA_Environment ev; @@ -529,13 +528,7 @@ send_button_clicked_cb (GtkWidget *widget, gpointer data) CORBA_boolean show_inline; CORBA_char tempstr[200]; - - /******** - * CODE - ********/ - - priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; - + CORBA_exception_init (&ev); /* First, I obtain an object reference that represents the Composer. */ @@ -581,7 +574,7 @@ send_button_clicked_cb (GtkWidget *widget, gpointer data) return; } - sprintf (tempstr, "text/calendar;METHOD=%s", itip_methods[METHOD_REQUEST]); + sprintf (tempstr, "text/calendar;METHOD=%s", itip_methods[method]); content_type = CORBA_string_alloc (strlen (tempstr)); strcpy (content_type, tempstr); filename = CORBA_string_alloc (0); @@ -614,7 +607,7 @@ send_button_clicked_cb (GtkWidget *widget, gpointer data) icalcomponent_add_property (comp, prop); prop = icalproperty_new (ICAL_METHOD_PROPERTY); - value = icalvalue_new_text ("REQUEST"); + value = icalvalue_new_text (itip_methods[method]); icalproperty_set_value (prop, value); icalcomponent_add_property (comp, prop); @@ -691,7 +684,35 @@ send_button_clicked_cb (GtkWidget *widget, gpointer data) /* bonobo_object_unref (BONOBO_OBJECT (bonobo_server)); */ } - +/******** + * This routine is called when the publish button is clicked. Duh. + * Actually, I'm just testing my commenting macros. + ********/ +static void +publish_button_clicked_cb (GtkWidget *widget, gpointer data) +{ + EMeetingEditorPrivate *priv; + + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; + + send_calendar_info (METHOD_PUBLISH, priv); + +} + +static void +request_button_clicked_cb (GtkWidget *widget, gpointer data) +{ + EMeetingEditorPrivate *priv; + + priv = (EMeetingEditorPrivate *) ((EMeetingEditor *)data)->priv; + + send_calendar_info (METHOD_REQUEST, priv); + +} + + + static void add_button_clicked_cb (GtkWidget *widget, gpointer data) { @@ -900,7 +921,8 @@ e_meeting_edit (EMeetingEditor *editor) priv->role_entry = glade_xml_get_widget (priv->xml, "role_entry"); priv->rsvp_check = glade_xml_get_widget (priv->xml, "rsvp_check"); priv->schedule_button = glade_xml_get_widget (priv->xml, "schedule_button"); - priv->send_button = glade_xml_get_widget (priv->xml, "send_button"); + priv->publish_button = glade_xml_get_widget (priv->xml, "publish_button"); + priv->request_button = glade_xml_get_widget (priv->xml, "request_button"); gtk_clist_set_column_justification (GTK_CLIST (priv->attendee_list), ROLE_COL, GTK_JUSTIFY_CENTER); gtk_clist_set_column_justification (GTK_CLIST (priv->attendee_list), RSVP_COL, GTK_JUSTIFY_CENTER); @@ -921,9 +943,11 @@ e_meeting_edit (EMeetingEditor *editor) gtk_signal_connect (GTK_OBJECT (priv->schedule_button), "clicked", GTK_SIGNAL_FUNC (schedule_button_clicked_cb), editor); - gtk_signal_connect (GTK_OBJECT (priv->send_button), "clicked", - GTK_SIGNAL_FUNC (send_button_clicked_cb), editor); + gtk_signal_connect (GTK_OBJECT (priv->publish_button), "clicked", + GTK_SIGNAL_FUNC (publish_button_clicked_cb), editor); + gtk_signal_connect (GTK_OBJECT (priv->request_button), "clicked", + GTK_SIGNAL_FUNC (request_button_clicked_cb), editor); add_button = glade_xml_get_widget (priv->xml, "add_button"); delete_button = glade_xml_get_widget (priv->xml, "delete_button"); -- cgit v1.2.3