aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/Makefile.am5
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.c351
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.glade120
-rw-r--r--calendar/gui/dialogs/e-delegate-dialog.h70
-rw-r--r--calendar/gui/dialogs/meeting-page.c134
5 files changed, 642 insertions, 38 deletions
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index f9c95f3341..a56cf18d76 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -25,6 +25,8 @@ INCLUDES = \
-I$(top_builddir)/libical/src/libical \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
+ -I$(top_srcdir)/addressbook/backend/ebook \
+ -I$(top_builddir)/addressbook/backend/ebook \
-I$(includedir) \
$(EXTRA_GNOME_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
@@ -55,6 +57,8 @@ libcal_dialogs_a_SOURCES = \
comp-editor-util.h \
delete-comp.c \
delete-comp.h \
+ e-delegate-dialog.c \
+ e-delegate-dialog.h \
e-timezone-dialog.c \
e-timezone-dialog.h \
event-editor.c \
@@ -81,6 +85,7 @@ glade_DATA = \
alarm-options.glade \
alarm-page.glade \
cal-prefs-dialog.glade \
+ e-delegate-dialog.glade \
e-timezone-dialog.glade \
event-page.glade \
meeting-page.glade \
diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c
new file mode 100644
index 0000000000..beb93d5dc8
--- /dev/null
+++ b/calendar/gui/dialogs/e-delegate-dialog.c
@@ -0,0 +1,351 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* Evolution calendar - Delegate selector dialog
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: Damon Chaplin <damon@ximian.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 <liboaf/liboaf.h>
+#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-widget.h>
+#include <gtk/gtksignal.h>
+#include <gtk/gtkcombo.h>
+#include <gtk/gtkentry.h>
+#include <gtk/gtklabel.h>
+#include <gnome.h>
+#include <ical.h>
+#include <glade/glade.h>
+#include <widgets/misc/e-map.h>
+#include <e-destination.h>
+#include "Evolution-Addressbook-SelectNames.h"
+#include "e-delegate-dialog.h"
+
+struct _EDelegateDialogPrivate {
+ char *name;
+ char *address;
+
+ /* Glade XML data */
+ GladeXML *xml;
+
+ /* Widgets from the Glade file */
+ GtkWidget *app;
+ GtkWidget *hbox;
+ GtkWidget *addressbook;
+
+ GNOME_Evolution_Addressbook_SelectNames corba_select_names;
+ GtkWidget *entry;
+};
+
+#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames"
+static const char *section_name = "Delegate To";
+
+static void e_delegate_dialog_class_init (EDelegateDialogClass *class);
+static void e_delegate_dialog_init (EDelegateDialog *edd);
+static void e_delegate_dialog_destroy (GtkObject *object);
+
+static gboolean get_widgets (EDelegateDialog *edd);
+static void addressbook_clicked_cb (GtkWidget *widget, gpointer data);
+
+static GtkObjectClass *parent_class;
+
+
+GtkType
+e_delegate_dialog_get_type (void)
+{
+ static GtkType e_delegate_dialog_type = 0;
+
+ if (!e_delegate_dialog_type) {
+ static const GtkTypeInfo e_delegate_dialog_info = {
+ "EDelegateDialog",
+ sizeof (EDelegateDialog),
+ sizeof (EDelegateDialogClass),
+ (GtkClassInitFunc) e_delegate_dialog_class_init,
+ (GtkObjectInitFunc) e_delegate_dialog_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ e_delegate_dialog_type = gtk_type_unique (GTK_TYPE_OBJECT,
+ &e_delegate_dialog_info);
+ }
+
+ return e_delegate_dialog_type;
+}
+
+/* Class initialization function for the event editor */
+static void
+e_delegate_dialog_class_init (EDelegateDialogClass *class)
+{
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass *) class;
+
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
+
+ object_class->destroy = e_delegate_dialog_destroy;
+}
+
+/* Object initialization function for the event editor */
+static void
+e_delegate_dialog_init (EDelegateDialog *edd)
+{
+ EDelegateDialogPrivate *priv;
+
+ priv = g_new0 (EDelegateDialogPrivate, 1);
+ edd->priv = priv;
+
+ priv->address = NULL;
+}
+
+/* Destroy handler for the event editor */
+static void
+e_delegate_dialog_destroy (GtkObject *object)
+{
+ EDelegateDialog *edd;
+ EDelegateDialogPrivate *priv;
+ GtkWidget *dialog;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (E_IS_DELEGATE_DIALOG (object));
+
+ edd = E_DELEGATE_DIALOG (object);
+ priv = edd->priv;
+
+ /* Destroy the actual dialog. */
+ dialog = e_delegate_dialog_get_toplevel (edd);
+ gtk_widget_destroy (dialog);
+
+ g_free (priv->address);
+ priv->address = NULL;
+
+ g_free (priv);
+ edd->priv = NULL;
+
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+
+EDelegateDialog *
+e_delegate_dialog_construct (EDelegateDialog *edd)
+{
+ EDelegateDialogPrivate *priv;
+ Bonobo_Control corba_control;
+ CORBA_Environment ev;
+
+ g_return_val_if_fail (edd != NULL, NULL);
+ g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
+
+ priv = edd->priv;
+
+ /* Load the content widgets */
+
+ priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/e-delegate-dialog.glade",
+ NULL);
+ if (!priv->xml) {
+ g_message ("e_delegate_dialog_construct(): Could not load the Glade XML file!");
+ goto error;
+ }
+
+ if (!get_widgets (edd)) {
+ g_message ("e_delegate_dialog_construct(): Could not find all widgets in the XML file!");
+ goto error;
+ }
+
+ CORBA_exception_init (&ev);
+
+ priv->corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
+ GNOME_Evolution_Addressbook_SelectNames_addSectionWithLimit (priv->corba_select_names,
+ section_name,
+ section_name,
+ 1, &ev);
+
+ if (BONOBO_EX (&ev)) {
+ g_message ("e_delegate_dialog_construct(): Unable to add section!");
+ goto error;
+ }
+
+ corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (priv->corba_select_names,
+ section_name, &ev);
+
+ if (BONOBO_EX (&ev)) {
+ g_message ("e_delegate_dialog_construct(): Unable to get addressbook entry!");
+ goto error;
+ }
+
+ CORBA_exception_free (&ev);
+
+ priv->entry = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
+ gtk_widget_show (priv->entry);
+ gtk_box_pack_start (GTK_BOX (priv->hbox), priv->entry, TRUE, TRUE, 0);
+
+
+ gtk_signal_connect (GTK_OBJECT (priv->addressbook), "clicked",
+ GTK_SIGNAL_FUNC (addressbook_clicked_cb), edd);
+
+ return edd;
+
+ error:
+
+ gtk_object_unref (GTK_OBJECT (edd));
+ return NULL;
+}
+
+static gboolean
+get_widgets (EDelegateDialog *edd)
+{
+ EDelegateDialogPrivate *priv;
+
+ priv = edd->priv;
+
+#define GW(name) glade_xml_get_widget (priv->xml, name)
+
+ priv->app = GW ("delegate-dialog");
+ priv->hbox = GW ("delegate-hbox");
+ priv->addressbook = GW ("addressbook");
+
+ return (priv->app
+ && priv->hbox
+ && priv->addressbook);
+}
+
+static void
+addressbook_clicked_cb (GtkWidget *widget, gpointer data)
+{
+ EDelegateDialog *edd = data;
+ EDelegateDialogPrivate *priv;
+ CORBA_Environment ev;
+
+ priv = edd->priv;
+
+ CORBA_exception_init (&ev);
+
+ GNOME_Evolution_Addressbook_SelectNames_activateDialog (priv->corba_select_names, section_name, &ev);
+
+ CORBA_exception_free (&ev);
+}
+
+
+/**
+ * e_delegate_dialog_new:
+ *
+ * Creates a new event editor dialog.
+ *
+ * Return value: A newly-created event editor dialog, or NULL if the event
+ * editor could not be created.
+ **/
+EDelegateDialog *
+e_delegate_dialog_new (void)
+{
+ EDelegateDialog *edd;
+
+ edd = E_DELEGATE_DIALOG (gtk_type_new (E_TYPE_DELEGATE_DIALOG));
+ return e_delegate_dialog_construct (E_DELEGATE_DIALOG (edd));
+}
+
+char *
+e_delegate_dialog_get_delegate (EDelegateDialog *edd)
+{
+ EDelegateDialogPrivate *priv;
+ EDestination **destv;
+ char *string = NULL;
+
+ g_return_val_if_fail (edd != NULL, NULL);
+ g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
+
+ priv = edd->priv;
+
+ bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "text", &string, NULL);
+ destv = e_destination_importv (string);
+
+ g_message ("importv: [%s]", string);
+
+ if (destv && destv[0] != NULL) {
+ g_free (priv->address);
+ priv->address = g_strdup (e_destination_get_email (destv[0]));
+ g_free (destv);
+ }
+
+ g_free (string);
+
+ return g_strdup (priv->address);
+}
+
+
+char *
+e_delegate_dialog_get_delegate_name (EDelegateDialog *edd)
+{
+ EDelegateDialogPrivate *priv;
+ EDestination **destv;
+ char *string = NULL;
+
+ g_return_val_if_fail (edd != NULL, NULL);
+ g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
+
+ priv = edd->priv;
+
+ bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "text", &string, NULL);
+ destv = e_destination_importv (string);
+
+ g_message ("importv: [%s]", string);
+
+ if (destv && destv[0] != NULL) {
+ g_free (priv->name);
+ priv->name = g_strdup (e_destination_get_name (destv[0]));
+ g_free (destv);
+ }
+
+ g_free (string);
+
+ return g_strdup (priv->name);
+}
+
+void
+e_delegate_dialog_set_delegate (EDelegateDialog *edd,
+ const char *address)
+{
+ EDelegateDialogPrivate *priv;
+
+ g_return_if_fail (edd != NULL);
+ g_return_if_fail (E_IS_DELEGATE_DIALOG (edd));
+
+ priv = edd->priv;
+
+ if (priv->address)
+ g_free (priv->address);
+
+ priv->address = g_strdup (address);
+}
+
+
+GtkWidget*
+e_delegate_dialog_get_toplevel (EDelegateDialog *edd)
+{
+ EDelegateDialogPrivate *priv;
+
+ g_return_val_if_fail (edd != NULL, NULL);
+ g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL);
+
+ priv = edd->priv;
+
+ return priv->app;
+}
+
diff --git a/calendar/gui/dialogs/e-delegate-dialog.glade b/calendar/gui/dialogs/e-delegate-dialog.glade
new file mode 100644
index 0000000000..394c191682
--- /dev/null
+++ b/calendar/gui/dialogs/e-delegate-dialog.glade
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>timezone-dialog</name>
+ <program_name>timezone-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>GnomeDialog</class>
+ <name>delegate-dialog</name>
+ <visible>False</visible>
+ <title>Enter Delegate</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>True</auto_close>
+ <hide_on_close>True</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_END</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>ok-button</name>
+ <can_default>True</can_default>
+ <has_default>True</has_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>cancel-button</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>delegate-hbox</name>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label3</name>
+ <label>Delegate To:</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>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>addressbook</name>
+ <can_focus>True</can_focus>
+ <label>Addressbook...</label>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h
new file mode 100644
index 0000000000..971751828b
--- /dev/null
+++ b/calendar/gui/dialogs/e-delegate-dialog.h
@@ -0,0 +1,70 @@
+/* Evolution calendar - Delegate selector dialog
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Authors: JP Rosevear <jpr@ximian.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_DELEGATE_DIALOG_H__
+#define __E_DELEGATE_DIALOG_H__
+
+#include <libgnome/gnome-defs.h>
+#include <gtk/gtkwidget.h>
+
+
+
+#define E_TYPE_DELEGATE_DIALOG (e_delegate_dialog_get_type ())
+#define E_DELEGATE_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialog))
+#define E_DELEGATE_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_DELEGATE_DIALOG, \
+ EDelegateDialogClass))
+#define E_IS_DELEGATE_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_DELEGATE_DIALOG))
+#define E_IS_DELEGATE_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_DELEGATE_DIALOG))
+
+
+typedef struct _EDelegateDialog EDelegateDialog;
+typedef struct _EDelegateDialogClass EDelegateDialogClass;
+typedef struct _EDelegateDialogPrivate EDelegateDialogPrivate;
+
+struct _EDelegateDialog {
+ GtkObject object;
+
+ /* Private data */
+ EDelegateDialogPrivate *priv;
+};
+
+struct _EDelegateDialogClass {
+ GtkObjectClass parent_class;
+};
+
+
+GtkType e_delegate_dialog_get_type (void);
+EDelegateDialog* e_delegate_dialog_construct (EDelegateDialog *etd);
+
+EDelegateDialog* e_delegate_dialog_new (void);
+
+char* e_delegate_dialog_get_delegate (EDelegateDialog *etd);
+
+char* e_delegate_dialog_get_delegate_name (EDelegateDialog *etd);
+
+void e_delegate_dialog_set_delegate (EDelegateDialog *etd,
+ const char *address);
+
+GtkWidget* e_delegate_dialog_get_toplevel (EDelegateDialog *etd);
+
+
+
+#endif /* __E_DELEGATE_DIALOG_H__ */
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 3b7b9e72a9..99c5cf37c6 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -27,15 +27,17 @@
#endif
#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock.h>
#include <liboaf/liboaf.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
#include <gtk/gtksignal.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkvbox.h>
+#include <gtk/gtkwindow.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-stock.h>
+#include <libgnomeui/gnome-dialog-util.h>
#include <glade/glade.h>
#include <gal/e-table/e-cell-combo.h>
#include <gal/e-table/e-cell-text.h>
@@ -50,6 +52,7 @@
#include "../component-factory.h"
#include "../itip-utils.h"
#include "comp-editor-util.h"
+#include "e-delegate-dialog.h"
#include "meeting-page.h"
@@ -123,8 +126,6 @@ struct _MeetingPagePrivate {
/* For handling the invite button */
GNOME_Evolution_Addressbook_SelectNames corba_select_names;
-
-
};
@@ -361,17 +362,17 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
CalComponentAttendee *att = l->data;
struct attendee *attendee = g_new0 (struct attendee, 1);
- attendee->address = g_strdup (att->value);
- attendee->member = g_strdup (att->member);
+ attendee->address = att->value ? g_strdup (att->value) : g_strdup ("");
+ attendee->member = att->member ? g_strdup (att->member) : g_strdup ("");
attendee->cutype= att->cutype;
attendee->role = att->role;
attendee->status = att->status;
attendee->rsvp = att->rsvp;
- attendee->delto = g_strdup (att->delto);
- attendee->delfrom = g_strdup (att->delfrom);
- attendee->sentby = g_strdup (att->sentby);
- attendee->cn = g_strdup (att->cn);
- attendee->language = g_strdup (att->language);
+ attendee->delto = att->delto ? g_strdup (att->delto) : g_strdup ("");
+ attendee->delfrom = att->delto ? g_strdup (att->delfrom) : g_strdup ("");
+ attendee->sentby = att->sentby ? g_strdup (att->sentby) : g_strdup ("");
+ attendee->cn = att->cn ? g_strdup (att->cn) : g_strdup ("");
+ attendee->language = att->language ? g_strdup (att->language) : g_strdup ("");
priv->attendees = g_slist_prepend (priv->attendees, attendee);
@@ -452,7 +453,7 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
att->rsvp = attendee->rsvp;
att->delto = (attendee->delto && *attendee->delto) ? attendee->delto : NULL;
att->delfrom = (attendee->delfrom && *attendee->delfrom) ? attendee->delfrom : NULL;
- att->sentby = attendee->sentby;
+ att->sentby = (attendee->sentby && *attendee->sentby) ? attendee->sentby : NULL;
att->cn = (attendee->cn && *attendee->cn) ? attendee->cn : NULL;
att->language = (attendee->language && *attendee->language) ? attendee->language : NULL;
@@ -515,19 +516,21 @@ invite_entry_changed (BonoboListener *listener,
CORBA_Environment *ev,
gpointer user_data)
{
- g_message ("event: \"%s\", section \"%s\"", event_name, BONOBO_ARG_GET_STRING (arg));
+ g_message ("event: \"%s\", section \"%s\"", event_name, BONOBO_ARG_GET_STRING (arg));
}
static void
-add_section (GNOME_Evolution_Addressbook_SelectNames corba_select_names, const char *name)
+add_section (GNOME_Evolution_Addressbook_SelectNames corba_select_names, const char *name, int limit)
{
Bonobo_Control corba_control;
CORBA_Environment ev;
- GtkWidget *control_widget;
- BonoboControlFrame *cf;
- Bonobo_PropertyBag pb = CORBA_OBJECT_NIL;
+
CORBA_exception_init (&ev);
+ if (limit != 0)
+ GNOME_Evolution_Addressbook_SelectNames_addSectionWithLimit (corba_select_names,
+ name, name, limit, &ev);
+ else
GNOME_Evolution_Addressbook_SelectNames_addSection (corba_select_names,
name, name, &ev);
@@ -542,18 +545,10 @@ add_section (GNOME_Evolution_Addressbook_SelectNames corba_select_names, const c
CORBA_exception_free (&ev);
-#if 0
- control_widget = bonobo_widget_new_control_from_objref (
- corba_control, CORBA_OBJECT_NIL);
-
- cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (control_widget));
- pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
-
- bonobo_event_source_client_add_listener (
- pb, invite_entry_changed,
- "Bonobo/Property:change:entry_changed",
- NULL, NULL);
-#endif
+ bonobo_event_source_client_add_listener (corba_control,
+ invite_entry_changed,
+ "changed:working_copy",
+ NULL, NULL);
}
static gboolean
@@ -571,9 +566,9 @@ get_select_name_dialog (MeetingPage *mpage)
priv->corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
- add_section (priv->corba_select_names, "Required Participants");
- add_section (priv->corba_select_names, "Optional Participants");
- add_section (priv->corba_select_names, "Non-Participants");
+ add_section (priv->corba_select_names, "Required Participants", 0);
+ add_section (priv->corba_select_names, "Optional Participants", 0);
+ add_section (priv->corba_select_names, "Non-Participants", 0);
bonobo_event_source_client_add_listener (priv->corba_select_names,
invite_entry_changed,
@@ -854,7 +849,7 @@ append_row (ETableModel *etm, ETableModel *model, int row, void *data)
attendee = g_new0 (struct attendee, 1);
- attendee->address = g_strdup_printf ("MAILTO:%s", e_table_model_value_at (model, MEETING_ATTENDEE_COL, row));
+ attendee->address = g_strdup_printf ("MAILTO:%s", (char *) e_table_model_value_at (model, MEETING_ATTENDEE_COL, row));
attendee->member = g_strdup (e_table_model_value_at (model, MEETING_MEMBER_COL, row));
attendee->cutype = text_to_type (e_table_model_value_at (model, MEETING_TYPE_COL, row));
attendee->role = text_to_role (e_table_model_value_at (model, MEETING_ROLE_COL, row));
@@ -898,9 +893,9 @@ value_at (ETableModel *etm, int col, int row, void *data)
case MEETING_RSVP_COL:
return boolean_to_text (attendee->rsvp);
case MEETING_DELTO_COL:
- return attendee->delto;
+ return itip_strip_mailto (attendee->delto);
case MEETING_DELFROM_COL:
- return attendee->delfrom;
+ return itip_strip_mailto (attendee->delfrom);
case MEETING_STATUS_COL:
return partstat_to_text (attendee->status);
case MEETING_CN_COL:
@@ -928,7 +923,7 @@ set_value_at (ETableModel *etm, int col, int row, const void *val, void *data)
case MEETING_ATTENDEE_COL:
if (attendee->address)
g_free (attendee->address);
- attendee->address = g_strdup_printf ("MAILTO:%s", val);
+ attendee->address = g_strdup_printf ("MAILTO:%s", (char *) val);
break;
case MEETING_MEMBER_COL:
if (attendee->member)
@@ -1170,10 +1165,72 @@ popup_delegate_cb (GtkWidget *widget, gpointer data)
{
MeetingPage *mpage = MEETING_PAGE (data);
MeetingPagePrivate *priv;
+ EDelegateDialog *edd;
+ GtkWidget *dialog;
+ char *address = NULL, *name = NULL;
+ gint row_cnt;
priv = mpage->priv;
- e_table_model_row_changed (priv->model, priv->row);
+ /* Show dialog. */
+ edd = e_delegate_dialog_new ();
+ dialog = e_delegate_dialog_get_toplevel (edd);
+
+ if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == 0){
+ struct attendee *a;
+ char *str;
+ GSList *l;
+
+ name = e_delegate_dialog_get_delegate_name (edd);
+ address = e_delegate_dialog_get_delegate (edd);
+
+ for (l = priv->attendees; l != NULL; l = l->next) {
+ a = l->data;
+
+ if (a->address != NULL && !g_strcasecmp (itip_strip_mailto (a->address), address)) {
+ GtkWidget *dlg = gnome_error_dialog ("That person is already attending the meeting!");
+ gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
+ goto cleanup;
+ }
+ }
+
+ a = g_slist_nth_data (priv->attendees, priv->row);
+ if (a->delto)
+ g_free (a->delto);
+ a->delto = g_strdup_printf ("MAILTO:%s", address);
+
+ a = g_new0 (struct attendee, 1);
+
+ a->address = g_strdup_printf ("MAILTO:%s", address);
+ a->member = init_value (NULL, MEETING_MEMBER_COL, mpage);
+ str = init_value (NULL, MEETING_TYPE_COL, mpage);
+ a->cutype = text_to_type (str);
+ g_free (str);
+ str = init_value (NULL, MEETING_ROLE_COL, mpage);
+ a->role = text_to_role (str);
+ g_free (str);
+ str = init_value (NULL, MEETING_RSVP_COL, mpage);
+ a->rsvp = text_to_boolean (str);
+ g_free (str);
+ a->delto = init_value (NULL, MEETING_DELTO_COL, mpage);
+ a->delfrom = g_strdup_printf ("MAILTO:%s", (char *) value_at (NULL, MEETING_ATTENDEE_COL, priv->row, mpage));
+ str = init_value (NULL, MEETING_STATUS_COL, mpage);
+ a->status = text_to_partstat (str);
+ g_free (str);
+ a->cn = name ? g_strdup (name) : g_strdup ("");
+ a->language = init_value (NULL, MEETING_LANG_COL, mpage);
+
+ priv->attendees = g_slist_append (priv->attendees, a);
+
+ row_cnt = row_count (priv->model, mpage) - 1;
+ e_table_model_row_changed (priv->model, priv->row);
+ e_table_model_row_inserted (priv->model, row_cnt);
+ }
+
+ cleanup:
+ g_free (name);
+ g_free (address);
+ gtk_object_unref (GTK_OBJECT (edd));
}
static void
@@ -1294,3 +1351,4 @@ meeting_page_new (void)
return mpage;
}
+