aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs/task-page.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-08-15 09:13:37 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-08-15 09:13:37 +0800
commit6684b4627d4767f6ea5d2969d70ae6f2cf863a79 (patch)
tree89d7a6fba9713ff48fe44ed4bad3ee94471030e6 /calendar/gui/dialogs/task-page.c
parent84f12a913e4a46c198a951dd2b10512fb87ce0a3 (diff)
downloadgsoc2013-evolution-6684b4627d4767f6ea5d2969d70ae6f2cf863a79.tar
gsoc2013-evolution-6684b4627d4767f6ea5d2969d70ae6f2cf863a79.tar.gz
gsoc2013-evolution-6684b4627d4767f6ea5d2969d70ae6f2cf863a79.tar.bz2
gsoc2013-evolution-6684b4627d4767f6ea5d2969d70ae6f2cf863a79.tar.lz
gsoc2013-evolution-6684b4627d4767f6ea5d2969d70ae6f2cf863a79.tar.xz
gsoc2013-evolution-6684b4627d4767f6ea5d2969d70ae6f2cf863a79.tar.zst
gsoc2013-evolution-6684b4627d4767f6ea5d2969d70ae6f2cf863a79.zip
added support for the Contacts field. Note that I'm not sure what we
2001-08-14 Damon Chaplin <damon@ximian.com> * gui/dialogs/task-page.c: * gui/dialogs/event-page.c: added support for the Contacts field. Note that I'm not sure what we should put in the iCalendar CONTACT properties. Currently we put "name <email>", but it isn't recognized as a contact when we reopen the dialog, so we may need more info here. Also we currently use a simple parser to parse the above format, and we should maybe use some camel function. * gui/dialogs/task-page.glade: * gui/dialogs/event-page.glade: replaced the GtkEntry fields for the Contacts with a GtkEventBox which we put the BonoboControl in at runtime. * gui/dialogs/meeting-page.c (invite_entry_changed): added FIXMEs since it doesn't seem to be freeing the EDestination stuff. JP? * gui/dialogs/comp-editor-util.c: added bunch of utility functions to handle the Contacts field in the main Event and Task pages. * gui/gnome-cal.c: added visible_start and visible_end fields, so we only emit the 'dates-shown-changed' signal when really necessary. Currently changing the folder title bar label results in a complete redraw of the Evolution window (silly GtkLabel queueing a resize), so we want to avoid that as much as possible. (gnome_calendar_new_appointment_for): only move the event's end time to the end of the day if it is not already 00:00:00. * gui/e-week-view-event-item.c: * gui/e-week-view.c: * gui/e-day-view.c: added support for double-clicking on an event to open it, and for double-clicking on the background to create a new event. There is still a minor problem to sort out, but it basically works. * cal-util/cal-component.c: added support for CONTACT properties, mainly by copying the code for COMMENT properties which are exactly the same type. * gui/e-day-view.c (e_day_view_realize): use the same color for the top canvas background as the shortcut bar, to make it look a little nicer (I think). Although we still have the theme problem with hard-coded colors. svn path=/trunk/; revision=12039
Diffstat (limited to 'calendar/gui/dialogs/task-page.c')
-rw-r--r--calendar/gui/dialogs/task-page.c105
1 files changed, 93 insertions, 12 deletions
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index d2f4a557c2..f6ad6da413 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -66,12 +66,17 @@ struct _TaskPagePrivate {
GtkWidget *classification_confidential;
GtkWidget *contacts_btn;
- GtkWidget *contacts;
+ GtkWidget *contacts_box;
GtkWidget *categories_btn;
GtkWidget *categories;
gboolean updating;
+
+ /* 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;
};
static const int classification_map[] = {
@@ -174,11 +179,14 @@ task_page_init (TaskPage *tpage)
priv->classification_private = NULL;
priv->classification_confidential = NULL;
priv->contacts_btn = NULL;
- priv->contacts = NULL;
+ priv->contacts_box = NULL;
priv->categories_btn = NULL;
priv->categories = NULL;
priv->updating = FALSE;
+
+ priv->corba_select_names = CORBA_OBJECT_NIL;
+ priv->contacts_entry = NULL;
}
/* Destroy handler for the task page */
@@ -194,6 +202,14 @@ task_page_destroy (GtkObject *object)
tpage = TASK_PAGE (object);
priv = tpage->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;
@@ -265,6 +281,23 @@ classification_get (GtkWidget *widget)
return e_dialog_radio_get (widget, classification_map);
}
+static void
+contacts_changed_cb (BonoboListener *listener,
+ char *event_name,
+ CORBA_any *arg,
+ CORBA_Environment *ev,
+ gpointer data)
+{
+ TaskPage *tpage;
+ TaskPagePrivate *priv;
+
+ tpage = TASK_PAGE (data);
+ priv = tpage->priv;
+
+ if (!priv->updating)
+ comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage));
+}
+
/* fill_widgets handler for the task page */
static void
task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
@@ -384,6 +417,19 @@ task_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, tpage);
+
+
priv->updating = FALSE;
}
@@ -491,6 +537,9 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
if (cat)
g_free (cat);
+
+ /* Contacts */
+ comp_editor_contacts_to_component (priv->contacts_entry, comp);
}
/* set_summary handler for the task page */
@@ -558,7 +607,7 @@ get_widgets (TaskPage *tpage)
priv->classification_confidential = GW ("classification-confidential");
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");
@@ -575,7 +624,7 @@ get_widgets (TaskPage *tpage)
&& priv->classification_confidential
&& priv->description
&& priv->contacts_btn
- && priv->contacts
+ && priv->contacts_box
&& priv->categories_btn
&& priv->categories);
}
@@ -649,6 +698,22 @@ date_changed_cb (EDateEdit *dedit, 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)
+{
+ TaskPage *tpage;
+ TaskPagePrivate *priv;
+
+ tpage = TASK_PAGE (data);
+ priv = tpage->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.
*/
@@ -681,7 +746,7 @@ field_changed_cb (GtkWidget *widget, gpointer data)
}
/* Hooks the widget signals */
-static void
+static gboolean
init_widgets (TaskPage *tpage)
{
TaskPagePrivate *priv;
@@ -732,19 +797,31 @@ init_widgets (TaskPage *tpage)
field gets set whenever a field is changed. */
gtk_signal_connect (GTK_OBJECT (priv->description), "changed",
GTK_SIGNAL_FUNC (field_changed_cb), tpage);
- gtk_signal_connect (GTK_OBJECT (priv->contacts), "changed",
- GTK_SIGNAL_FUNC (field_changed_cb), tpage);
gtk_signal_connect (GTK_OBJECT (priv->categories), "changed",
GTK_SIGNAL_FUNC (field_changed_cb), tpage);
- /* Button clicks */
+ /* Contacts button */
+ gtk_signal_connect (GTK_OBJECT (priv->contacts_btn), "clicked",
+ GTK_SIGNAL_FUNC (contacts_clicked_cb), tpage);
+
+ /* Categories button */
gtk_signal_connect (GTK_OBJECT (priv->categories_btn), "clicked",
GTK_SIGNAL_FUNC (categories_clicked_cb), tpage);
- /* FIXME: we do not support these fields yet, so we disable them */
- gtk_widget_set_sensitive (priv->contacts_btn, FALSE);
- gtk_widget_set_sensitive (priv->contacts, FALSE);
+ /* 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;
+
+ 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;
}
@@ -779,7 +856,11 @@ task_page_construct (TaskPage *tpage)
return NULL;
}
- init_widgets (tpage);
+ if (!init_widgets (tpage)) {
+ g_message ("event_page_construct(): "
+ "Could not initialize the widgets!");
+ return NULL;
+ }
return tpage;
}