aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs/event-page.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/dialogs/event-page.c')
-rw-r--r--calendar/gui/dialogs/event-page.c103
1 files changed, 94 insertions, 9 deletions
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index bae084d526..a3947b1cba 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -69,7 +69,7 @@ struct _EventPagePrivate {
GtkWidget *show_time_as_busy;
GtkWidget *contacts_btn;
- GtkWidget *contacts;
+ GtkWidget *contacts_box;
GtkWidget *categories_btn;
GtkWidget *categories;
@@ -80,6 +80,11 @@ struct _EventPagePrivate {
start timezone is then changed, we updated the end timezone to the
same value, since 99% of events start and end in one timezone. */
gboolean sync_timezones;
+
+ /* The Corba component for selecting contacts, and the entry field
+ which we place in the dialog. */
+ GNOME_Evolution_Addressbook_SelectNames corba_select_names;
+ GtkWidget *contacts_entry;
};
@@ -178,12 +183,15 @@ event_page_init (EventPage *epage)
priv->show_time_as_free = NULL;
priv->show_time_as_busy = NULL;
priv->contacts_btn = NULL;
- priv->contacts = NULL;
+ priv->contacts_box = NULL;
priv->categories_btn = NULL;
priv->categories = NULL;
priv->updating = FALSE;
priv->sync_timezones = FALSE;
+
+ priv->corba_select_names = CORBA_OBJECT_NIL;
+ priv->contacts_entry = NULL;
}
/* Destroy handler for the event page */
@@ -199,6 +207,14 @@ event_page_destroy (GtkObject *object)
epage = EVENT_PAGE (object);
priv = epage->priv;
+ if (priv->corba_select_names != CORBA_OBJECT_NIL) {
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+ CORBA_Object_release (priv->corba_select_names, &ev);
+ CORBA_exception_free (&ev);
+ }
+
if (priv->xml) {
gtk_object_unref (GTK_OBJECT (priv->xml));
priv->xml = NULL;
@@ -324,6 +340,27 @@ clear_widgets (EventPage *epage)
e_dialog_editable_set (priv->categories, NULL);
}
+
+static void
+contacts_changed_cb (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *arg,
+ CORBA_Environment *ev,
+ gpointer data)
+{
+ EventPage *epage;
+ EventPagePrivate *priv;
+
+ epage = EVENT_PAGE (data);
+ priv = epage->priv;
+
+ g_print ("In contacts_changed_cb\n");
+
+ if (!priv->updating)
+ comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage));
+}
+
+
/* fill_widgets handler for the event page */
static void
event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
@@ -488,6 +525,17 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
cal_component_get_categories (comp, &categories);
e_dialog_editable_set (priv->categories, categories);
+ /* Contacts */
+ comp_editor_contacts_to_widget (priv->contacts_entry, comp);
+
+ /* We connect the contacts changed signal here, as we have to be a bit
+ more careful with it due to the use or Corba. The priv->updating
+ flag won't work as we won't get the changed event immediately.
+ FIXME: Unfortunately this doesn't work either. We never get the
+ changed event now. */
+ comp_editor_connect_contacts_changed (priv->contacts_entry,
+ contacts_changed_cb, epage);
+
priv->updating = FALSE;
}
@@ -612,6 +660,10 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
transparency = e_dialog_radio_get (priv->show_time_as_free,
transparency_map);
cal_component_set_transparency (comp, transparency);
+
+ /* Contacts */
+
+ comp_editor_contacts_to_component (priv->contacts_entry, comp);
}
/* set_summary handler for the event page */
@@ -672,7 +724,7 @@ get_widgets (EventPage *epage)
priv->show_time_as_busy = GW ("show-time-as-busy");
priv->contacts_btn = GW ("contacts-button");
- priv->contacts = GW ("contacts");
+ priv->contacts_box = GW ("contacts-box");
priv->categories_btn = GW ("categories-button");
priv->categories = GW ("categories");
@@ -692,7 +744,7 @@ get_widgets (EventPage *epage)
&& priv->show_time_as_free
&& priv->show_time_as_busy
&& priv->contacts_btn
- && priv->contacts
+ && priv->contacts_box
&& priv->categories_btn
&& priv->categories);
}
@@ -989,6 +1041,22 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data)
&dates);
}
+/* Callback used when the contacts button is clicked; we must bring up the
+ * contact list dialog.
+ */
+static void
+contacts_clicked_cb (GtkWidget *button, gpointer data)
+{
+ EventPage *epage;
+ EventPagePrivate *priv;
+
+ epage = EVENT_PAGE (data);
+ priv = epage->priv;
+
+ g_print ("In contacts_clicked_cb\n");
+ comp_editor_show_contacts_dialog (priv->corba_select_names);
+}
+
/* Callback used when the categories button is clicked; we must bring up the
* category list dialog.
*/
@@ -1021,7 +1089,7 @@ field_changed_cb (GtkWidget *widget, gpointer data)
}
/* Hooks the widget signals */
-static void
+static gboolean
init_widgets (EventPage *epage)
{
EventPagePrivate *priv;
@@ -1058,6 +1126,10 @@ init_widgets (EventPage *epage)
gtk_signal_connect (GTK_OBJECT (priv->all_day_event), "toggled",
GTK_SIGNAL_FUNC (all_day_event_toggled_cb), epage);
+ /* Contacts button */
+ gtk_signal_connect (GTK_OBJECT (priv->contacts_btn), "clicked",
+ GTK_SIGNAL_FUNC (contacts_clicked_cb), epage);
+
/* Categories button */
gtk_signal_connect (GTK_OBJECT (priv->categories_btn), "clicked",
GTK_SIGNAL_FUNC (categories_clicked_cb), epage);
@@ -1098,10 +1170,19 @@ init_widgets (EventPage *epage)
gtk_signal_connect (GTK_OBJECT (priv->categories), "changed",
GTK_SIGNAL_FUNC (field_changed_cb), epage);
- /* FIXME: we do not support these fields yet, so we disable them */
+ /* Create the contacts entry, a corba control from the address book. */
+ priv->corba_select_names = comp_editor_create_contacts_component ();
+ if (priv->corba_select_names == CORBA_OBJECT_NIL)
+ return FALSE;
- gtk_widget_set_sensitive (priv->contacts_btn, FALSE);
- gtk_widget_set_sensitive (priv->contacts, FALSE);
+ priv->contacts_entry = comp_editor_create_contacts_control (priv->corba_select_names);
+ if (priv->contacts_entry == NULL)
+ return FALSE;
+
+ gtk_container_add (GTK_CONTAINER (priv->contacts_box),
+ priv->contacts_entry);
+
+ return TRUE;
}
@@ -1136,7 +1217,11 @@ event_page_construct (EventPage *epage)
return NULL;
}
- init_widgets (epage);
+ if (!init_widgets (epage)) {
+ g_message ("event_page_construct(): "
+ "Could not initialize the widgets!");
+ return NULL;
+ }
return epage;
}