aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs/task-editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/dialogs/task-editor.c')
-rw-r--r--calendar/gui/dialogs/task-editor.c674
1 files changed, 333 insertions, 341 deletions
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 6a95013370..89b77ab011 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -1,471 +1,463 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* Evolution calendar - Task editor dialog
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Authors: Miguel de Icaza <miguel@ximian.com>
- * Federico Mena-Quintero <federico@ximian.com>
- * Seth Alves <alves@hungry.com>
- * JP Rosevear <jpr@ximian.com>
+/*
+ * Evolution calendar - Task editor dialog
*
* This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
*
* 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Authors:
+ * Miguel de Icaza <miguel@ximian.com>
+ * Federico Mena-Quintero <federico@ximian.com>
+ * Seth Alves <alves@hungry.com>
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
*
- * 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.
*/
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
+
#include <string.h>
-#include <glade/glade.h>
-#include <gal/widgets/e-unicode.h>
-#include <libgnome/gnome-i18n.h>
+#include <glib/gi18n.h>
#include "task-page.h"
-#include "task-details-page.h"
-#include "meeting-page.h"
#include "cancel-comp.h"
#include "task-editor.h"
+#define TASK_EDITOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), TYPE_TASK_EDITOR, TaskEditorPrivate))
+
struct _TaskEditorPrivate {
TaskPage *task_page;
- TaskDetailsPage *task_details_page;
- MeetingPage *meet_page;
- EMeetingModel *model;
-
+ EMeetingStore *model;
gboolean assignment_shown;
- gboolean updating;
+ gboolean updating;
};
-
+/* Extends the UI definition in CompEditor */
+static const gchar *ui =
+"<ui>"
+" <menubar action='main-menu'>"
+" <menu action='view-menu'>"
+" <menuitem action='view-type'/>"
+" <menuitem action='view-status'/>"
+" <menuitem action='view-role'/>"
+" <menuitem action='view-rsvp'/>"
+" <separator/>"
+" <menuitem action='view-time-zone'/>"
+" <menuitem action='view-categories'/>"
+" </menu>"
+" <menu action='insert-menu'>"
+" <menuitem action='send-options'/>"
+" </menu>"
+" </menubar>"
+" <toolbar name='main-toolbar'>"
+" <placeholder name='content'>"
+" <toolitem action='view-time-zone'/>"
+" </placeholder>"
+" </toolbar>"
+"</ui>";
+
+static void task_editor_edit_comp (CompEditor *editor,
+ ECalComponent *comp);
+static gboolean task_editor_send_comp (CompEditor *editor,
+ ECalComponentItipMethod method,
+ gboolean strip_alarms);
+
+G_DEFINE_TYPE (TaskEditor, task_editor, TYPE_COMP_EDITOR)
-static void task_editor_class_init (TaskEditorClass *class);
-static void task_editor_init (TaskEditor *te);
-static void task_editor_edit_comp (CompEditor *editor, CalComponent *comp);
-static gboolean task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method);
-static void task_editor_destroy (GtkObject *object);
+static void
+action_send_options_cb (GtkAction *action,
+ TaskEditor *editor)
+{
+ task_page_send_options_clicked_cb (editor->priv->task_page);
+}
-static void assign_task_cmd (GtkWidget *widget, gpointer data);
-static void refresh_task_cmd (GtkWidget *widget, gpointer data);
-static void cancel_task_cmd (GtkWidget *widget, gpointer data);
-static void forward_cmd (GtkWidget *widget, gpointer data);
+static GtkActionEntry assigned_task_entries[] = {
-static void model_row_changed_cb (ETableModel *etm, int row, gpointer data);
-static void row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data);
+ { "send-options",
+ NULL,
+ N_("_Send Options"),
+ NULL,
+ N_("Insert advanced send options"),
+ G_CALLBACK (action_send_options_cb) }
+};
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_UNSAFE_VERB ("ActionAssignTask", assign_task_cmd),
- BONOBO_UI_UNSAFE_VERB ("ActionRefreshTask", refresh_task_cmd),
- BONOBO_UI_UNSAFE_VERB ("ActionCancelTask", cancel_task_cmd),
- BONOBO_UI_UNSAFE_VERB ("ActionForward", forward_cmd),
+static void
+task_editor_model_changed_cb (TaskEditor *te)
+{
+ if (!te->priv->updating) {
+ comp_editor_set_changed (COMP_EDITOR (te), TRUE);
+ comp_editor_set_needs_send (COMP_EDITOR (te), TRUE);
+ }
+}
- BONOBO_UI_VERB_END
-};
+static void
+task_editor_dispose (GObject *object)
+{
+ TaskEditorPrivate *priv;
-static CompEditorClass *parent_class;
+ priv = TASK_EDITOR_GET_PRIVATE (object);
-
+ if (priv->task_page) {
+ g_object_unref (priv->task_page);
+ priv->task_page = NULL;
+ }
-/**
- * task_editor_get_type:
- *
- * Registers the #TaskEditor class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #TaskEditor class.
- **/
-GtkType
-task_editor_get_type (void)
-{
- static GtkType task_editor_type = 0;
-
- if (!task_editor_type) {
- static const GtkTypeInfo task_editor_info = {
- "TaskEditor",
- sizeof (TaskEditor),
- sizeof (TaskEditorClass),
- (GtkClassInitFunc) task_editor_class_init,
- (GtkObjectInitFunc) task_editor_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- task_editor_type = gtk_type_unique (TYPE_COMP_EDITOR,
- &task_editor_info);
+ if (priv->model) {
+ g_object_unref (priv->model);
+ priv->model = NULL;
}
- return task_editor_type;
+ /* Chain up to parent's dispose() method. */
+ G_OBJECT_CLASS (task_editor_parent_class)->dispose (object);
}
-/* Class initialization function for the event editor */
static void
-task_editor_class_init (TaskEditorClass *klass)
+task_editor_constructed (GObject *object)
{
- GtkObjectClass *object_class;
- CompEditorClass *editor_class;
+ TaskEditorPrivate *priv;
+ CompEditor *editor;
+ CompEditorFlags flags;
+ GtkActionGroup *action_group;
+ gboolean is_assigned;
- object_class = (GtkObjectClass *) klass;
- editor_class = (CompEditorClass *) klass;
+ priv = TASK_EDITOR_GET_PRIVATE (object);
+ editor = COMP_EDITOR (object);
- parent_class = gtk_type_class (TYPE_COMP_EDITOR);
+ flags = comp_editor_get_flags (editor);
+ is_assigned = flags & COMP_EDITOR_IS_ASSIGNED;
- editor_class->edit_comp = task_editor_edit_comp;
- editor_class->send_comp = task_editor_send_comp;
+ priv->task_page = task_page_new (priv->model, editor);
+ task_page_set_assignment (priv->task_page, is_assigned);
+ comp_editor_append_page (
+ editor, COMP_EDITOR_PAGE (priv->task_page),
+ _("Task"), TRUE);
+
+ action_group = comp_editor_get_action_group (editor, "coordinated");
+ gtk_action_group_set_visible (action_group, is_assigned);
- object_class->destroy = task_editor_destroy;
+ if (is_assigned) {
+ ECalClient *client;
+
+ client = comp_editor_get_client (editor);
+
+ if (e_client_check_capability (
+ E_CLIENT (client),
+ CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
+ task_page_show_options (priv->task_page);
+ comp_editor_set_group_item (editor, TRUE);
+ }
+
+ g_object_bind_property (
+ object, "client",
+ priv->model, "client",
+ G_BINDING_SYNC_CREATE);
+
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (task_editor_parent_class)->constructed (object);
}
static void
-set_menu_sens (TaskEditor *te)
+task_editor_show_categories (CompEditor *editor,
+ gboolean visible)
{
- TaskEditorPrivate *priv;
- gboolean sens, existing, user, read_only;
-
- priv = te->priv;
-
- existing = comp_editor_get_existing_org (COMP_EDITOR (te));
- user = comp_editor_get_user_org (COMP_EDITOR (te));
- read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)));
-
- sens = priv->assignment_shown || read_only;
- comp_editor_set_ui_prop (COMP_EDITOR (te),
- "/commands/ActionAssignTask",
- "sensitive", sens ? "0" : "1");
-
- sens = priv->assignment_shown && existing && !user && !read_only;
- comp_editor_set_ui_prop (COMP_EDITOR (te),
- "/commands/ActionRefreshTask",
- "sensitive", sens ? "1" : "0");
-
- sens = priv->assignment_shown && existing && user && !read_only;
- comp_editor_set_ui_prop (COMP_EDITOR (te),
- "/commands/ActionCancelTask",
- "sensitive", sens ? "1" : "0");
-
- comp_editor_set_ui_prop (COMP_EDITOR (te),
- "/commands/FileSave",
- "sensitive", read_only ? "0" : "1");
- comp_editor_set_ui_prop (COMP_EDITOR (te),
- "/commands/FileSaveAndClose",
- "sensitive", read_only ? "0" : "1");
- comp_editor_set_ui_prop (COMP_EDITOR (te),
- "/commands/FileDelete",
- "sensitive", read_only ? "0" : "1");
+ TaskEditor *task_editor = TASK_EDITOR (editor);
+
+ task_page_set_show_categories (task_editor->priv->task_page, visible);
}
static void
-init_widgets (TaskEditor *te)
+task_editor_show_role (CompEditor *editor,
+ gboolean visible)
{
- TaskEditorPrivate *priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- priv = te->priv;
+ task_page_set_view_role (task_editor->priv->task_page, visible);
+}
+
+static void
+task_editor_show_rsvp (CompEditor *editor,
+ gboolean visible)
+{
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed",
- GTK_SIGNAL_FUNC (model_row_changed_cb), te);
- gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted",
- GTK_SIGNAL_FUNC (row_count_changed_cb), te);
- gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted",
- GTK_SIGNAL_FUNC (row_count_changed_cb), te);
+ task_page_set_view_rsvp (task_editor->priv->task_page, visible);
}
-/* Object initialization function for the task editor */
static void
-task_editor_init (TaskEditor *te)
+task_editor_show_status (CompEditor *editor,
+ gboolean visible)
{
- TaskEditorPrivate *priv;
-
- priv = g_new0 (TaskEditorPrivate, 1);
- te->priv = priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
+
+ task_page_set_view_status (task_editor->priv->task_page, visible);
+}
- priv->model = E_MEETING_MODEL (e_meeting_model_new ());
- priv->assignment_shown = TRUE;
- priv->updating = FALSE;
+static void
+task_editor_show_time_zone (CompEditor *editor,
+ gboolean visible)
+{
+ TaskEditor *task_editor = TASK_EDITOR (editor);
+ task_page_set_show_timezone (task_editor->priv->task_page, visible);
}
-TaskEditor *
-task_editor_construct (TaskEditor *te, CalClient *client)
+static void
+task_editor_show_type (CompEditor *editor,
+ gboolean visible)
{
- TaskEditorPrivate *priv;
-
- priv = te->priv;
+ TaskEditor *task_editor = TASK_EDITOR (editor);
- priv->task_page = task_page_new ();
- comp_editor_append_page (COMP_EDITOR (te),
- COMP_EDITOR_PAGE (priv->task_page),
- _("Basic"));
+ task_page_set_view_type (task_editor->priv->task_page, visible);
+}
- priv->task_details_page = task_details_page_new ();
- comp_editor_append_page (COMP_EDITOR (te),
- COMP_EDITOR_PAGE (priv->task_details_page),
- _("Details"));
+static void
+task_editor_class_init (TaskEditorClass *class)
+{
+ GObjectClass *object_class;
+ CompEditorClass *editor_class;
- priv->meet_page = meeting_page_new (priv->model, client);
- comp_editor_append_page (COMP_EDITOR (te),
- COMP_EDITOR_PAGE (priv->meet_page),
- _("Assignment"));
+ g_type_class_add_private (class, sizeof (TaskEditorPrivate));
- comp_editor_set_cal_client (COMP_EDITOR (te), client);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->dispose = task_editor_dispose;
+ object_class->constructed = task_editor_constructed;
- comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs, NULL);
+ editor_class = COMP_EDITOR_CLASS (class);
+ editor_class->help_section = "tasks-usage";
+ editor_class->edit_comp = task_editor_edit_comp;
+ editor_class->send_comp = task_editor_send_comp;
+ editor_class->show_categories = task_editor_show_categories;
+ editor_class->show_role = task_editor_show_role;
+ editor_class->show_rsvp = task_editor_show_rsvp;
+ editor_class->show_status = task_editor_show_status;
+ editor_class->show_time_zone = task_editor_show_time_zone;
+ editor_class->show_type = task_editor_show_type;
+}
- init_widgets (te);
- set_menu_sens (te);
+static void
+task_editor_init (TaskEditor *te)
+{
+ CompEditor *editor = COMP_EDITOR (te);
+ GtkUIManager *ui_manager;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ const gchar *id;
+ GError *error = NULL;
+
+ te->priv = TASK_EDITOR_GET_PRIVATE (te);
+ te->priv->model = E_MEETING_STORE (e_meeting_store_new ());
+ te->priv->assignment_shown = TRUE;
+ te->priv->updating = FALSE;
+
+ action_group = comp_editor_get_action_group (editor, "coordinated");
+ gtk_action_group_add_actions (
+ action_group, assigned_task_entries,
+ G_N_ELEMENTS (assigned_task_entries), te);
+
+ ui_manager = comp_editor_get_ui_manager (editor);
+ gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error);
+
+ id = "org.gnome.evolution.task-editor";
+ e_plugin_ui_register_manager (ui_manager, id, te);
+ e_plugin_ui_enable_manager (ui_manager, id);
+
+ if (error != NULL) {
+ g_critical ("%s: %s", G_STRFUNC, error->message);
+ g_error_free (error);
+ }
- return te;
+ action = comp_editor_get_action (editor, "print");
+ gtk_action_set_tooltip (action, _("Print this task"));
+
+ g_signal_connect_swapped (
+ te->priv->model, "row_changed",
+ G_CALLBACK (task_editor_model_changed_cb), te);
+ g_signal_connect_swapped (
+ te->priv->model, "row_inserted",
+ G_CALLBACK (task_editor_model_changed_cb), te);
+ g_signal_connect_swapped (
+ te->priv->model, "row_deleted",
+ G_CALLBACK (task_editor_model_changed_cb), te);
}
static void
-task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
+task_editor_edit_comp (CompEditor *editor,
+ ECalComponent *comp)
{
- TaskEditor *te;
TaskEditorPrivate *priv;
- CalComponentOrganizer organizer;
+ ECalComponentOrganizer organizer;
+ ECalClient *client;
GSList *attendees = NULL;
-
- te = TASK_EDITOR (editor);
- priv = te->priv;
+ ESourceRegistry *registry;
+ EShell *shell;
+
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
priv->updating = TRUE;
- if (parent_class->edit_comp)
- parent_class->edit_comp (editor, comp);
+ if (COMP_EDITOR_CLASS (task_editor_parent_class)->edit_comp)
+ COMP_EDITOR_CLASS (task_editor_parent_class)->edit_comp (editor, comp);
- /* Get meeting related stuff */
- cal_component_get_organizer (comp, &organizer);
- cal_component_get_attendee_list (comp, &attendees);
+ shell = comp_editor_get_shell (editor);
+ client = comp_editor_get_client (editor);
+
+ registry = e_shell_get_registry (shell);
- /* Clear things up */
- e_meeting_model_restricted_clear (priv->model);
- e_meeting_model_remove_all_attendees (priv->model);
+ /* Get meeting related stuff */
+ e_cal_component_get_organizer (comp, &organizer);
+ e_cal_component_get_attendee_list (comp, &attendees);
- if (attendees == NULL) {
- comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page));
- priv->assignment_shown = FALSE;
- } else {
+ if (attendees != NULL) {
GSList *l;
+ gint row;
- if (!priv->assignment_shown)
- comp_editor_append_page (COMP_EDITOR (te),
- COMP_EDITOR_PAGE (priv->meet_page),
- _("Assignment"));
+ task_page_hide_options (priv->task_page);
+ task_page_set_assignment (priv->task_page, TRUE);
for (l = attendees; l != NULL; l = l->next) {
- CalComponentAttendee *ca = l->data;
- EMeetingAttendee *ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
-
- e_meeting_model_add_attendee (priv->model, ia);
- gtk_object_unref (GTK_OBJECT (ia));
+ ECalComponentAttendee *ca = l->data;
+ EMeetingAttendee *ia;
+
+ ia = E_MEETING_ATTENDEE (
+ e_meeting_attendee_new_from_e_cal_component_attendee (ca));
+ /* If we aren't the organizer or the attendee is just
+ * delegating, don't allow editing. */
+ if (!comp_editor_get_user_org (editor) ||
+ e_meeting_attendee_is_set_delto (ia))
+ e_meeting_attendee_set_edit_level (
+ ia, E_MEETING_ATTENDEE_EDIT_NONE);
+ comp_editor_page_add_attendee (
+ COMP_EDITOR_PAGE (priv->task_page), ia);
+
+ g_object_unref (ia);
+ }
+
+ /* If we aren't the organizer we can still change our own status */
+ if (!comp_editor_get_user_org (editor)) {
+ EMeetingAttendee *ia;
+
+ ia = e_meeting_store_find_self (priv->model, &row);
+
+ if (ia != NULL)
+ e_meeting_attendee_set_edit_level (
+ ia, E_MEETING_ATTENDEE_EDIT_STATUS);
+ } else if (e_cal_client_check_organizer_must_attend (client)) {
+ EMeetingAttendee *ia;
+
+ ia = e_meeting_store_find_attendee (priv->model, organizer.value, &row);
+ if (ia != NULL)
+ e_meeting_attendee_set_edit_level (
+ ia, E_MEETING_ATTENDEE_EDIT_NONE);
}
- if (organizer.value != NULL) {
- GList *addresses, *l;
- const char *strip;
- int row;
-
- strip = itip_strip_mailto (organizer.value);
-
- addresses = itip_addresses_get ();
- for (l = addresses; l != NULL; l = l->next) {
- ItipAddress *a = l->data;
-
- if (e_meeting_model_find_attendee (priv->model, a->address, &row))
- e_meeting_model_restricted_add (priv->model, row);
- }
- itip_addresses_free (addresses);
- }
-
- if (comp_editor_get_user_org (editor))
- e_meeting_model_restricted_clear (priv->model);
-
- priv->assignment_shown = TRUE;
+ comp_editor_set_group_item (editor, TRUE);
+ priv->assignment_shown = TRUE;
}
- cal_component_free_attendee_list (attendees);
+ e_cal_component_free_attendee_list (attendees);
- set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown && itip_organizer_is_user (comp));
+ comp_editor_set_needs_send (
+ editor, priv->assignment_shown &&
+ itip_organizer_is_user (registry, comp, client));
priv->updating = FALSE;
}
static gboolean
-task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
+task_editor_send_comp (CompEditor *editor,
+ ECalComponentItipMethod method,
+ gboolean strip_alarms)
{
- TaskEditor *te = TASK_EDITOR (editor);
TaskEditorPrivate *priv;
- CalComponent *comp = NULL;
+ EShell *shell;
+ ESourceRegistry *registry;
+ ECalComponent *comp = NULL;
- priv = te->priv;
+ priv = TASK_EDITOR_GET_PRIVATE (editor);
/* Don't cancel more than once or when just publishing */
- if (method == CAL_COMPONENT_METHOD_PUBLISH ||
- method == CAL_COMPONENT_METHOD_CANCEL)
+ if (method == E_CAL_COMPONENT_METHOD_PUBLISH ||
+ method == E_CAL_COMPONENT_METHOD_CANCEL)
goto parent;
-
- comp = meeting_page_get_cancel_comp (priv->meet_page);
+
+ shell = comp_editor_get_shell (editor);
+ registry = e_shell_get_registry (shell);
+
+ comp = task_page_get_cancel_comp (priv->task_page);
if (comp != NULL) {
- CalClient *client;
+ ECalClient *client;
gboolean result;
-
- client = e_meeting_model_get_cal_client (priv->model);
- result = itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
- gtk_object_unref (GTK_OBJECT (comp));
+
+ client = e_meeting_store_get_client (priv->model);
+ result = itip_send_comp (
+ registry, E_CAL_COMPONENT_METHOD_CANCEL, comp,
+ client, NULL, NULL, NULL, strip_alarms, FALSE);
+ g_object_unref (comp);
if (!result)
return FALSE;
}
parent:
- if (parent_class->send_comp)
- return parent_class->send_comp (editor, method);
+ if (COMP_EDITOR_CLASS (task_editor_parent_class)->send_comp)
+ return COMP_EDITOR_CLASS (task_editor_parent_class)->
+ send_comp (editor, method, strip_alarms);
return FALSE;
}
-/* Destroy handler for the event editor */
-static void
-task_editor_destroy (GtkObject *object)
-{
- TaskEditor *te;
- TaskEditorPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_TASK_EDITOR (object));
-
- te = TASK_EDITOR (object);
- priv = te->priv;
-
- gtk_object_unref (GTK_OBJECT (priv->task_page));
- gtk_object_unref (GTK_OBJECT (priv->task_details_page));
- gtk_object_unref (GTK_OBJECT (priv->meet_page));
-
- gtk_object_unref (GTK_OBJECT (priv->model));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
/**
* task_editor_new:
- * @client: a CalClient
+ * @client: a ECalClient
*
* Creates a new event editor dialog.
*
* Return value: A newly-created event editor dialog, or NULL if the event
* editor could not be created.
**/
-TaskEditor *
-task_editor_new (CalClient *client)
-{
- TaskEditor *te;
-
- te = TASK_EDITOR (gtk_type_new (TYPE_TASK_EDITOR));
- return task_editor_construct (te, client);
-}
-
-static void
-show_assignment (TaskEditor *te)
+CompEditor *
+task_editor_new (ECalClient *client,
+ EShell *shell,
+ CompEditorFlags flags)
{
- TaskEditorPrivate *priv;
-
- priv = te->priv;
-
- if (!priv->assignment_shown) {
- comp_editor_append_page (COMP_EDITOR (te),
- COMP_EDITOR_PAGE (priv->meet_page),
- _("Assignment"));
- priv->assignment_shown = TRUE;
-
- set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
- comp_editor_set_changed (COMP_EDITOR (te), TRUE);
- }
+ g_return_val_if_fail (E_IS_CAL_CLIENT (client), NULL);
+ g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- comp_editor_show_page (COMP_EDITOR (te),
- COMP_EDITOR_PAGE (priv->meet_page));
+ return g_object_new (
+ TYPE_TASK_EDITOR,
+ "client", client, "flags", flags, "shell", shell, NULL);
}
void
task_editor_show_assignment (TaskEditor *te)
{
- g_return_if_fail (te != NULL);
- g_return_if_fail (IS_TASK_EDITOR (te));
-
- show_assignment (te);
-}
-
-static void
-assign_task_cmd (GtkWidget *widget, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
-
- show_assignment (te);
-}
+ CompEditor *editor;
-static void
-refresh_task_cmd (GtkWidget *widget, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
+ g_return_if_fail (IS_TASK_EDITOR (te));
- comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_REFRESH);
-}
+ editor = COMP_EDITOR (te);
-static void
-cancel_task_cmd (GtkWidget *widget, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
- CalComponent *comp;
-
- comp = comp_editor_get_current_comp (COMP_EDITOR (te));
- if (cancel_component_dialog (comp, FALSE)) {
- comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_CANCEL);
- comp_editor_delete_comp (COMP_EDITOR (te));
+ task_page_set_assignment (te->priv->task_page, TRUE);
+ if (!te->priv->assignment_shown) {
+ te->priv->assignment_shown = TRUE;
+ comp_editor_set_needs_send (editor, TRUE);
+ comp_editor_set_changed (editor, FALSE);
}
-}
-
-static void
-forward_cmd (GtkWidget *widget, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
-
- if (comp_editor_save_comp (COMP_EDITOR (te), TRUE))
- comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_PUBLISH);
-}
-
-static void
-model_row_changed_cb (ETableModel *etm, int row, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
- TaskEditorPrivate *priv;
-
- priv = te->priv;
- if (!priv->updating) {
- comp_editor_set_changed (COMP_EDITOR (te), TRUE);
- comp_editor_set_needs_send (COMP_EDITOR (te), TRUE);
- }
}
-static void
-row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
- TaskEditorPrivate *priv;
-
- priv = te->priv;
-
- if (!priv->updating) {
- comp_editor_set_changed (COMP_EDITOR (te), TRUE);
- comp_editor_set_needs_send (COMP_EDITOR (te), TRUE);
- }
-}