From 4882b9f898a1e44b7462f0eb1cdc0c8d11897c6a Mon Sep 17 00:00:00 2001 From: nobody Date: Mon, 6 Nov 2000 21:40:14 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'BONOBO_0_31'. svn path=/tags/BONOBO_0_31/; revision=6435 --- calendar/gui/dialogs/.cvsignore | 3 - calendar/gui/dialogs/Makefile.am | 37 - calendar/gui/dialogs/alarm-notify-dialog.c | 225 ---- calendar/gui/dialogs/alarm-notify-dialog.h | 44 - calendar/gui/dialogs/alarm-notify.glade | 230 ----- calendar/gui/dialogs/alarm-notify.glade.h | 10 - calendar/gui/dialogs/cal-prefs-dialog.c | 462 --------- calendar/gui/dialogs/cal-prefs-dialog.glade | 1243 ----------------------- calendar/gui/dialogs/cal-prefs-dialog.glade.h | 67 -- calendar/gui/dialogs/cal-prefs-dialog.h | 69 -- calendar/gui/dialogs/task-editor-dialog.glade | 706 ------------- calendar/gui/dialogs/task-editor-dialog.glade.h | 31 - calendar/gui/dialogs/task-editor.c | 1182 --------------------- calendar/gui/dialogs/task-editor.h | 68 -- calendar/gui/dialogs/task-page.glade | 706 ------------- 15 files changed, 5083 deletions(-) delete mode 100644 calendar/gui/dialogs/.cvsignore delete mode 100644 calendar/gui/dialogs/Makefile.am delete mode 100644 calendar/gui/dialogs/alarm-notify-dialog.c delete mode 100644 calendar/gui/dialogs/alarm-notify-dialog.h delete mode 100644 calendar/gui/dialogs/alarm-notify.glade delete mode 100644 calendar/gui/dialogs/alarm-notify.glade.h delete mode 100644 calendar/gui/dialogs/cal-prefs-dialog.c delete mode 100644 calendar/gui/dialogs/cal-prefs-dialog.glade delete mode 100644 calendar/gui/dialogs/cal-prefs-dialog.glade.h delete mode 100644 calendar/gui/dialogs/cal-prefs-dialog.h delete mode 100644 calendar/gui/dialogs/task-editor-dialog.glade delete mode 100644 calendar/gui/dialogs/task-editor-dialog.glade.h delete mode 100644 calendar/gui/dialogs/task-editor.c delete mode 100644 calendar/gui/dialogs/task-editor.h delete mode 100644 calendar/gui/dialogs/task-page.glade (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/.cvsignore b/calendar/gui/dialogs/.cvsignore deleted file mode 100644 index e995588475..0000000000 --- a/calendar/gui/dialogs/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -.deps -Makefile -Makefile.in diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am deleted file mode 100644 index 9b80e03f95..0000000000 --- a/calendar/gui/dialogs/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -gladedir = $(datadir)/evolution/glade - -INCLUDES = \ - -DG_LOG_DOMAIN=\"calendar-gui\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - -I$(includedir) \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - $(BONOBO_VFS_GNOME_CFLAGS) \ - -DGNOMELOCALEDIR=\""$(localedir)"\" - -noinst_LIBRARIES = libcal-dialogs.a - -libcal_dialogs_a_SOURCES = \ - alarm-notify-dialog.c \ - alarm-notify-dialog.h \ - cal-prefs-dialog.c \ - cal-prefs-dialog.h \ - task-editor.c \ - task-editor.h - -glade_DATA = \ - alarm-notify.glade \ - cal-prefs-dialog.glade \ - task-editor-dialog.glade - -glade_messages = \ - alarm-notify.glade.h \ - cal-prefs-dialog.glade.h \ - task-editor-dialog.glade.h - -EXTRA_DIST = \ - $(glade_DATA) \ - $(glade_messages) diff --git a/calendar/gui/dialogs/alarm-notify-dialog.c b/calendar/gui/dialogs/alarm-notify-dialog.c deleted file mode 100644 index 7d8357599c..0000000000 --- a/calendar/gui/dialogs/alarm-notify-dialog.c +++ /dev/null @@ -1,225 +0,0 @@ -/* Evolution calendar - alarm notification dialog - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 -#include -#include -#include "alarm-notify-dialog.h" - - - -/* The useful contents of the alarm notify dialog */ -typedef struct { - GladeXML *xml; - - GtkWidget *dialog; - GtkWidget *close; - GtkWidget *snooze; - GtkWidget *edit; - GtkWidget *heading; - GtkWidget *summary; - GtkWidget *snooze_time; - - AlarmNotifyFunc func; - gpointer func_data; -} AlarmNotify; - - - -/* Callback used when the notify dialog is destroyed */ -static void -dialog_destroy_cb (GtkObject *object, gpointer data) -{ - AlarmNotify *an; - - an = data; - gtk_object_unref (GTK_OBJECT (an->xml)); - g_free (an); -} - -/* Delete_event handler for the alarm notify dialog */ -static gint -delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_CLOSE, -1, an->func_data); - - gtk_widget_destroy (widget); - return TRUE; -} - -/* Callback for the close button */ -static void -close_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_CLOSE, -1, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/* Callback for the snooze button */ -static void -snooze_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - int snooze_time; - - an = data; - g_assert (an->func != NULL); - - snooze_time = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (an->snooze_time)); - (* an->func) (ALARM_NOTIFY_SNOOZE, snooze_time, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/* Callback for the edit button */ -static void -edit_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_EDIT, -1, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/** - * alarm_notify_dialog: - * @trigger: Trigger time for the alarm. - * @occur: Occurrence time for the event. - * @comp: Calendar component object which corresponds to the alarm. - * @func: Function to be called when a dialog action is invoked. - * @func_data: Closure data for @func. - * - * Runs the alarm notification dialog. The specified @func will be used to - * notify the client about result of the actions in the dialog. - * - * Return value: TRUE on success, FALSE if the dialog could not be created. - **/ -gboolean -alarm_notify_dialog (time_t trigger, time_t occur, CalComponent *comp, - AlarmNotifyFunc func, gpointer func_data) -{ - AlarmNotify *an; - char buf[256]; - struct tm tm_trigger; - struct tm tm_occur; - CalComponentText summary; - - g_return_val_if_fail (trigger != -1, FALSE); - g_return_val_if_fail (occur != -1, FALSE); - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - g_return_val_if_fail (func != NULL, FALSE); - - an = g_new0 (AlarmNotify, 1); - - an->func = func; - an->func_data = func_data; - - an->xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-notify.glade", NULL); - if (!an->xml) { - g_message ("alarm_notify_dialog(): Could not load the Glade XML file!"); - g_free (an); - return FALSE; - } - - an->dialog = glade_xml_get_widget (an->xml, "alarm-notify"); - an->close = glade_xml_get_widget (an->xml, "close"); - an->snooze = glade_xml_get_widget (an->xml, "snooze"); - an->edit = glade_xml_get_widget (an->xml, "edit"); - an->heading = glade_xml_get_widget (an->xml, "heading"); - an->summary = glade_xml_get_widget (an->xml, "summary"); - an->snooze_time = glade_xml_get_widget (an->xml, "snooze-time"); - - if (!(an->dialog && an->close && an->snooze && an->edit && an->heading && an->summary - && an->snooze_time)) { - g_message ("alarm_notify_dialog(): Could not find all widgets in Glade file!"); - gtk_object_unref (GTK_OBJECT (an->xml)); - g_free (an); - return FALSE; - } - - gtk_object_set_data (GTK_OBJECT (an->dialog), "alarm-notify", an); - gtk_signal_connect (GTK_OBJECT (an->dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), an); - - /* Title */ - - /* FIXME: use am_pm_flag or 24-hour time */ - - tm_trigger = *localtime (&trigger); - strftime (buf, sizeof (buf), _("Alarm on %A %b %d %Y %H:%M"), &tm_trigger); - gtk_window_set_title (GTK_WINDOW (an->dialog), buf); - - /* Heading */ - - tm_occur = *localtime (&occur); - strftime (buf, sizeof (buf), - _("Notification about your appointment on %A %b %d %Y %H:%M"), - &tm_occur); - gtk_label_set_text (GTK_LABEL (an->heading), buf); - - /* Summary */ - - cal_component_get_summary (comp, &summary); - - if (summary.value) - gtk_label_set_text (GTK_LABEL (an->summary), summary.value); - else - gtk_label_set_text (GTK_LABEL (an->summary), _("No summary available.")); - - /* Connect actions */ - - gtk_signal_connect (GTK_OBJECT (an->dialog), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->close), "clicked", - GTK_SIGNAL_FUNC (close_clicked_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->snooze), "clicked", - GTK_SIGNAL_FUNC (snooze_clicked_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->edit), "clicked", - GTK_SIGNAL_FUNC (edit_clicked_cb), - an); - - /* Run! */ - - gtk_widget_show (an->dialog); - return TRUE; -} diff --git a/calendar/gui/dialogs/alarm-notify-dialog.h b/calendar/gui/dialogs/alarm-notify-dialog.h deleted file mode 100644 index 1e56f1c586..0000000000 --- a/calendar/gui/dialogs/alarm-notify-dialog.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Evolution calendar - alarm notification dialog - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero - * - * 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 ALARM_NOTIFY_DIALOG_H -#define ALARM_NOTIFY_DIALOG_H - -#include -#include -#include - - - -typedef enum { - ALARM_NOTIFY_CLOSE, - ALARM_NOTIFY_SNOOZE, - ALARM_NOTIFY_EDIT -} AlarmNotifyResult; - -typedef void (* AlarmNotifyFunc) (AlarmNotifyResult result, int snooze_mins, gpointer data); - -gboolean alarm_notify_dialog (time_t trigger, time_t occur, CalComponent *comp, - AlarmNotifyFunc func, gpointer func_data); - - - -#endif diff --git a/calendar/gui/dialogs/alarm-notify.glade b/calendar/gui/dialogs/alarm-notify.glade deleted file mode 100644 index 32d7e03f8b..0000000000 --- a/calendar/gui/dialogs/alarm-notify.glade +++ /dev/null @@ -1,230 +0,0 @@ - - - - - Evolution Calendar - evolution-calendar - - src - pixmaps - C - True - True - False - True - True - True - True - interface.c - interface.h - callbacks.c - callbacks.h - support.c - support.h - True - alarm-notify.glade.h - - - - GtkWindow - alarm-notify - True - - GTK_WINDOW_DIALOG - GTK_WIN_POS_CENTER - False - False - False - False - - - GtkVBox - vbox2 - 4 - True - False - 4 - - - GtkHBox - hbox3 - True - False - 8 - - 0 - True - True - - - - GtkVBox - vbox5 - True - False - 4 - - 0 - True - True - - - - GtkLabel - heading - True - - GTK_JUSTIFY_LEFT - True - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkLabel - summary - True - - GTK_JUSTIFY_LEFT - True - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - GtkVBox - vbox4 - True - False - 4 - - 0 - True - True - - - - GtkButton - close - True - True - - - 0 - False - False - - - - - GtkButton - snooze - True - True - - - 0 - False - False - - - - - GtkButton - edit - True - True - - - 0 - False - False - - - - - - - GtkHSeparator - hseparator1 - True - - 0 - True - True - - - - - GtkHBox - hbox4 - True - False - 4 - - 0 - True - True - - - - GtkLabel - label4 - True - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkSpinButton - snooze-time - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 5 - 1 - 1440 - 1 - 5 - 5 - - 0 - False - False - - - - - - - diff --git a/calendar/gui/dialogs/alarm-notify.glade.h b/calendar/gui/dialogs/alarm-notify.glade.h deleted file mode 100644 index c7b8918e06..0000000000 --- a/calendar/gui/dialogs/alarm-notify.glade.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("Close"); -gchar *s = N_("Snooze"); -gchar *s = N_("Edit appointment"); -gchar *s = N_("Snooze time (minutes)"); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c deleted file mode 100644 index dd97690727..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ /dev/null @@ -1,462 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 2000, Helix Code, Inc. - * - * 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 - */ - -/* - * CalPrefsDialog - a GtkObject which handles a libglade-loaded dialog - * to edit the calendar preference settings. - */ - -#include -#include -#include -#include -#include -#include -#include "cal-prefs-dialog.h" -#include "../calendar-config.h" -#include "../calendar-commands.h" - - -typedef struct { - /* Glade XML data */ - GladeXML *xml; - - GtkWidget *dialog; - - GtkWidget *working_days[7]; - GtkWidget *week_start_day; - GtkWidget *start_of_day; - GtkWidget *end_of_day; - GtkWidget *use_12_hour; - GtkWidget *use_24_hour; - GtkWidget *time_divisions; - GtkWidget *show_end_times; - GtkWidget *compress_weekend; - GtkWidget *dnav_show_week_no; -} CalPrefsDialogPrivate; - -static const int week_start_day_map[] = { - 1, 2, 3, 4, 5, 6, 0, -1 -}; - -static const int time_division_map[] = { - 60, 30, 15, 10, 5, -1 -}; - -static void cal_prefs_dialog_class_init (CalPrefsDialogClass *class); -static void cal_prefs_dialog_init (CalPrefsDialog *prefs); -static gboolean get_widgets (CalPrefsDialog *prefs); -static void cal_prefs_dialog_destroy (GtkObject *object); -static void cal_prefs_dialog_init_widgets (CalPrefsDialog *prefs); -static void cal_prefs_dialog_button_clicked (GtkWidget *dialog, - gint button, - CalPrefsDialog *prefs); -static void cal_prefs_dialog_use_24_hour_toggled(GtkWidget *button, - CalPrefsDialog *prefs); -static void cal_prefs_dialog_show_config (CalPrefsDialog *prefs); -static void cal_prefs_dialog_update_config (CalPrefsDialog *prefs); - -GtkWidget* cal_prefs_dialog_create_time_edit (void); - -static GtkObjectClass *parent_class; - -E_MAKE_TYPE (cal_prefs_dialog, "CalPrefsDialog", CalPrefsDialog, - cal_prefs_dialog_class_init, cal_prefs_dialog_init, - GTK_TYPE_OBJECT) - - -static void -cal_prefs_dialog_class_init (CalPrefsDialogClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - object_class->destroy = cal_prefs_dialog_destroy; -} - - -static void -cal_prefs_dialog_init (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - - priv = g_new0 (CalPrefsDialogPrivate, 1); - prefs->priv = priv; - -} - - -/** - * cal_prefs_dialog_new: - * @Returns: a new #CalPrefsDialog. - * - * Creates a new #CalPrefsDialog. - **/ -CalPrefsDialog * -cal_prefs_dialog_new (void) -{ - CalPrefsDialog *prefs; - - prefs = CAL_PREFS_DIALOG (gtk_type_new (cal_prefs_dialog_get_type ())); - return cal_prefs_dialog_construct (prefs); -} - - -/** - * cal_prefs_dialog_construct: - * @prefs: A #CalPrefsDialog. - * - * Constructs a task editor by loading its Glade XML file. - * - * Return value: The same object as @prefs, or NULL if the widgets could not be - * created. In the latter case, the task editor will automatically be - * destroyed. - **/ -CalPrefsDialog * -cal_prefs_dialog_construct (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - - g_return_val_if_fail (IS_CAL_PREFS_DIALOG (prefs), NULL); - - priv = prefs->priv; - - /* Load the content widgets */ - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/cal-prefs-dialog.glade", NULL); - if (!priv->xml) { - g_message ("cal_prefs_dialog_construct(): Could not load the Glade XML file!"); - goto error; - } - - if (!get_widgets (prefs)) { - g_message ("cal_prefs_dialog_construct(): Could not find all widgets in the XML file!"); - goto error; - } - - cal_prefs_dialog_init_widgets (prefs); - - cal_prefs_dialog_show_config (prefs); - - gtk_widget_show (priv->dialog); - - return prefs; - - error: - - gtk_object_unref (GTK_OBJECT (prefs)); - return NULL; -} - - -/* Gets the widgets from the XML file and returns if they are all available. - */ -static gboolean -get_widgets (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - - priv = prefs->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->dialog = GW ("cal-prefs-dialog"); - - /* The indices must match the mktime() values. */ - priv->working_days[0] = GW ("sun_button"); - priv->working_days[1] = GW ("mon_button"); - priv->working_days[2] = GW ("tue_button"); - priv->working_days[3] = GW ("wed_button"); - priv->working_days[4] = GW ("thu_button"); - priv->working_days[5] = GW ("fri_button"); - priv->working_days[6] = GW ("sat_button"); - - priv->week_start_day = GW ("first_day_of_week"); - priv->start_of_day = GW ("start_of_day"); - priv->end_of_day = GW ("end_of_day"); - priv->use_12_hour = GW ("use_12_hour"); - priv->use_24_hour = GW ("use_24_hour"); - priv->time_divisions = GW ("time_divisions"); - priv->show_end_times = GW ("show_end_times"); - priv->compress_weekend = GW ("compress_weekend"); - priv->dnav_show_week_no = GW ("dnav_show_week_no"); - -#undef GW - - return (priv->dialog - && priv->working_days[0] - && priv->working_days[1] - && priv->working_days[2] - && priv->working_days[3] - && priv->working_days[4] - && priv->working_days[5] - && priv->working_days[6] - && priv->week_start_day - && priv->start_of_day - && priv->end_of_day - && priv->use_12_hour - && priv->use_24_hour - && priv->time_divisions - && priv->show_end_times - && priv->compress_weekend - && priv->dnav_show_week_no); -} - - -static void -cal_prefs_dialog_destroy (GtkObject *object) -{ - CalPrefsDialog *prefs; - CalPrefsDialogPrivate *priv; - - g_return_if_fail (IS_CAL_PREFS_DIALOG (object)); - - prefs = CAL_PREFS_DIALOG (object); - priv = prefs->priv; - - - g_free (priv); - prefs->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/* Called by libglade to create our custom EDateEdit widgets. */ -GtkWidget * -cal_prefs_dialog_create_time_edit (void) -{ - GtkWidget *dedit; - - dedit = e_date_edit_new (); - - e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 0, 24); - e_date_edit_set_show_date (E_DATE_EDIT (dedit), FALSE); - - return dedit; -} - - -void -cal_prefs_dialog_show (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - - g_return_if_fail (IS_CAL_PREFS_DIALOG (prefs)); - - priv = prefs->priv; - - /* If the dialog is already show just raise it, otherwise refresh the - config settings and show it. */ - if (GTK_WIDGET_MAPPED (priv->dialog)) { - gdk_window_raise (priv->dialog->window); - } else { - cal_prefs_dialog_show_config (prefs); - gtk_widget_show (priv->dialog); - } -} - - -/* Connects any necessary signal handlers. */ -static void -cal_prefs_dialog_init_widgets (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - - priv = prefs->priv; - - gtk_signal_connect (GTK_OBJECT (priv->dialog), "clicked", - GTK_SIGNAL_FUNC (cal_prefs_dialog_button_clicked), - prefs); - - gtk_signal_connect (GTK_OBJECT (priv->use_24_hour), "toggled", - GTK_SIGNAL_FUNC (cal_prefs_dialog_use_24_hour_toggled), - prefs); -} - - -static void -cal_prefs_dialog_button_clicked (GtkWidget *dialog, - gint button, - CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - - g_return_if_fail (IS_CAL_PREFS_DIALOG (prefs)); - - priv = prefs->priv; - - /* OK & Apply buttons update the config settings. */ - if (button == 0 || button == 1) - cal_prefs_dialog_update_config (prefs); - - /* OK & Close buttons close the dialog. */ - if (button == 0 || button == 2) - gtk_widget_hide (priv->dialog); -} - - -static void -cal_prefs_dialog_use_24_hour_toggled (GtkWidget *button, - CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - gboolean use_24_hour; - - priv = prefs->priv; - - use_24_hour = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_24_hour)); - - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (priv->start_of_day), - use_24_hour); - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (priv->end_of_day), - use_24_hour); -} - - -/* Shows the current config settings in the dialog. */ -static void -cal_prefs_dialog_show_config (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - CalWeekdays working_days; - gint mask, day, week_start_day, time_divisions; - - priv = prefs->priv; - - /* Working Days. */ - working_days = calendar_config_get_working_days (); - mask = 1 << 0; - for (day = 0; day < 7; day++) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->working_days[day]), (working_days & mask) ? TRUE : FALSE); - mask <<= 1; - } - - /* Week Start Day. */ - week_start_day = calendar_config_get_week_start_day (); - e_dialog_option_menu_set (priv->week_start_day, week_start_day, - week_start_day_map); - - /* Start of Day. */ - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_of_day), - calendar_config_get_day_start_hour (), - calendar_config_get_day_start_minute ()); - - /* End of Day. */ - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->end_of_day), - calendar_config_get_day_end_hour (), - calendar_config_get_day_end_minute ()); - - /* 12/24 Hour Format. */ - if (calendar_config_get_24_hour_format ()) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_24_hour), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->use_12_hour), TRUE); - - /* Time Divisions. */ - time_divisions = calendar_config_get_time_divisions (); - e_dialog_option_menu_set (priv->time_divisions, time_divisions, - time_division_map); - - /* Show Appointment End Times. */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->show_end_times), - calendar_config_get_show_event_end ()); - - /* Compress Weekend. */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->compress_weekend), calendar_config_get_compress_weekend ()); - - /* Date Navigator - Show Week Numbers. */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->dnav_show_week_no), calendar_config_get_dnav_show_week_no ()); -} - - -/* Updates the config values based on the settings in the dialog. */ -static void -cal_prefs_dialog_update_config (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - CalWeekdays working_days; - gint mask, day, week_start_day, time_divisions, hour, minute; - - priv = prefs->priv; - - /* Working Days. */ - working_days = 0; - mask = 1 << 0; - for (day = 0; day < 7; day++) { - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->working_days[day]))) - working_days |= mask; - mask <<= 1; - } - calendar_config_set_working_days (working_days); - - /* Week Start Day. */ - week_start_day = e_dialog_option_menu_get (priv->week_start_day, - week_start_day_map); - calendar_config_set_week_start_day (week_start_day); - - /* Start of Day. */ - if (e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_of_day), - &hour, &minute)) { - calendar_config_set_day_start_hour (hour); - calendar_config_set_day_start_minute (minute); - } else { - /* FIXME: Show error dialog? */ - g_warning ("Couldn't parse start of day"); - } - - /* End of Day. */ - if (e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_of_day), - &hour, &minute)) { - calendar_config_set_day_end_hour (hour); - calendar_config_set_day_end_minute (minute); - } else { - /* FIXME: Show error dialog? */ - g_warning ("Couldn't parse end of day"); - } - - /* 12/24 Hour Format. */ - calendar_config_set_24_hour_format (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->use_24_hour))); - - /* Time Divisions. */ - time_divisions = e_dialog_option_menu_get (priv->time_divisions, - time_division_map); - calendar_config_set_time_divisions (time_divisions); - - /* Show Appointment End Times. */ - calendar_config_set_show_event_end (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->show_end_times))); - - /* Compress Weekend. */ - calendar_config_set_compress_weekend (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->compress_weekend))); - - /* Date Navigator - Show Week Numbers. */ - calendar_config_set_dnav_show_week_no (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->dnav_show_week_no))); - - calendar_config_write (); - update_all_config_settings (); -} diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade deleted file mode 100644 index c0e225764b..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ /dev/null @@ -1,1243 +0,0 @@ - - - - - preferences - preferences - - src - pixmaps - C - True - True - True - cal-prefs-dialog.glade.h - - - - GnomeDialog - cal-prefs-dialog - Calendar Preferences - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - False - True - - - GtkVBox - GnomeDialog:vbox - vbox1 - False - 8 - - 4 - True - True - - - - GtkHButtonBox - GnomeDialog:action_area - hbuttonbox1 - GTK_BUTTONBOX_END - 8 - 85 - 27 - 7 - 0 - - 0 - False - True - GTK_PACK_END - - - - GtkButton - button1 - True - True - GNOME_STOCK_BUTTON_OK - - - - GtkButton - button2 - True - True - GNOME_STOCK_BUTTON_APPLY - - - - GtkButton - button3 - True - True - GNOME_STOCK_BUTTON_CLOSE - - - - - GtkNotebook - notebook1 - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - 0 - True - True - - - - GtkVBox - vbox8 - 4 - False - 6 - - - GtkFrame - frame9 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - False - True - - - - GtkVBox - vbox9 - 4 - False - 3 - - - GtkHBox - hbox8 - True - 0 - - 0 - False - True - - - - GtkCheckButton - mon_button - True - - False - True - - 0 - False - True - - - - - GtkCheckButton - tue_button - True - - False - True - - 0 - False - True - - - - - GtkCheckButton - wed_button - True - - False - True - - 0 - False - True - - - - - GtkCheckButton - thu_button - True - - False - True - - 0 - False - True - - - - - GtkCheckButton - fri_button - True - - False - True - - 0 - False - True - - - - - GtkCheckButton - sat_button - True - - False - True - - 0 - False - True - - - - - GtkCheckButton - sun_button - True - - False - True - - 0 - False - True - - - - - - GtkHBox - hbox9 - False - 4 - - 0 - False - False - - - - GtkLabel - label16 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - GtkOptionMenu - first_day_of_week - True - Monday -Tuesday -Wednesday -Thursday -Friday -Saturday -Sunday - - 0 - - 0 - False - False - - - - - - GtkHBox - hbox11 - False - 4 - - 0 - True - True - - - - GtkLabel - label17 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - Custom - start_of_day - cal_prefs_dialog_create_time_edit - 0 - 0 - Tue, 10 Oct 2000 15:12:12 GMT - - 0 - False - True - - - - - GtkLabel - label18 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - Custom - end_of_day - cal_prefs_dialog_create_time_edit - 0 - 0 - Tue, 10 Oct 2000 15:12:21 GMT - - 0 - False - True - - - - - - - - GtkFrame - frame10 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - False - True - - - - GtkTable - table4 - 4 - 4 - 3 - False - 0 - 4 - - - GtkLabel - label19 - - GTK_JUSTIFY_CENTER - False - 7.45058e-09 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label20 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkCheckButton - show_end_times - True - - False - True - - 0 - 3 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkCheckButton - compress_weekend - True - - False - True - - 0 - 3 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - - GtkHBox - hbox10 - True - 4 - - 1 - 3 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - GtkRadioButton - use_12_hour - True - - False - True - time_format_group - - 0 - False - True - - - - - GtkRadioButton - use_24_hour - True - - False - True - time_format_group - - 0 - False - True - - - - - - GtkAlignment - alignment4 - 7.45058e-09 - 0.5 - 0 - 1 - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - GtkOptionMenu - time_divisions - True - 60 minutes -30 minutes -15 minutes -10 minutes -05 minutes - - 0 - - - - - - - GtkFrame - frame11 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - False - True - - - - GtkCheckButton - dnav_show_week_no - 4 - True - - False - True - - - - - - GtkLabel - Notebook:tab - label7 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkVBox - vbox3 - 4 - False - 4 - - - GtkHBox - hbox4 - False - 0 - - 0 - True - True - - - - GtkFrame - frame3 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox4 - 4 - False - 0 - - - GtkCheckButton - checkbutton1 - True - - True - True - - 0 - False - False - - - - - GtkCheckButton - checkbutton2 - True - - True - True - - 0 - False - False - - - - - GtkCheckButton - checkbutton3 - True - - True - True - - 0 - False - False - - - - - - - GtkFrame - frame4 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkVBox - vbox5 - 4 - False - 0 - - - GtkCheckButton - checkbutton4 - True - - False - True - - 0 - False - False - - - - - GtkCheckButton - checkbutton5 - True - - False - True - - 0 - False - False - - - - - GtkCheckButton - checkbutton6 - True - - False - True - - 0 - False - False - - - - - - - - GtkFrame - frame5 - - 0 - GTK_SHADOW_ETCHED_IN - - 0 - True - True - - - - GtkTable - table3 - 4 - 3 - 2 - False - 4 - 4 - - - GnomeColorPicker - colorpicker1 - True - True - False - Pick a color - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GnomeColorPicker - colorpicker2 - True - True - False - Pick a color - - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - False - False - - - - - GnomeColorPicker - colorpicker3 - True - True - False - Pick a color - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - False - False - - - - - GtkAlignment - alignment1 - 1 - 0.5 - 1 - 1 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - True - - - - GtkLabel - label8 - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - - - - GtkAlignment - alignment2 - 1 - 0.5 - 1 - 1 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - True - - - - GtkLabel - label9 - - GTK_JUSTIFY_RIGHT - True - 1 - 0.5 - 0 - 0 - - - - - GtkAlignment - alignment3 - 1 - 0.5 - 1 - 1 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - True - - - - GtkLabel - label10 - - GTK_JUSTIFY_RIGHT - False - 1 - 0.5 - 0 - 0 - - - - - - - - GtkLabel - Notebook:tab - label11 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkVBox - vbox6 - False - 0 - - - GtkFrame - frame6 - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 4 - False - True - - - - GtkHBox - hbox5 - 4 - False - 0 - - - GtkCheckButton - checkbutton7 - 2 - True - - True - True - - 0 - False - False - - - - - GtkSpinButton - spinbutton1 - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 1 - 0 - 100 - 1 - 10 - 10 - - 0 - True - True - - - - - GtkLabel - label12 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 3 - 0 - - 0 - False - False - - - - - - - GtkFrame - frame7 - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 4 - False - True - - - - GtkCheckButton - checkbutton8 - 4 - True - - False - True - - - - - GtkFrame - frame8 - 4 - - 0 - GTK_SHADOW_ETCHED_IN - - 4 - False - True - - - - GtkVBox - vbox7 - 4 - False - 4 - - - GtkHBox - hbox6 - False - 0 - - 0 - False - True - - - - GtkCheckButton - checkbutton9 - True - - False - True - - 0 - False - False - - - - - GtkSpinButton - spinbutton2 - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 5 - 0 - 100 - 1 - 10 - 10 - - 0 - False - False - - - - - GtkLabel - label13 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - GtkHBox - hbox7 - False - 0 - - 0 - True - True - - - - GtkCheckButton - checkbutton10 - True - - False - True - - 0 - False - False - - - - - GtkSpinButton - spinbutton3 - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 600 - 0 - 1000 - 1 - 10 - 10 - - 0 - False - False - - - - - GtkLabel - label14 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - 0 - False - False - - - - - - - - - GtkLabel - Notebook:tab - label15 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade.h b/calendar/gui/dialogs/cal-prefs-dialog.glade.h deleted file mode 100644 index 0a29d11999..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("Calendar Preferences"); -gchar *s = N_("Work week"); -gchar *s = N_("Mon"); -gchar *s = N_("Tue"); -gchar *s = N_("Wed"); -gchar *s = N_("Thu"); -gchar *s = N_("Fri"); -gchar *s = N_("Sat"); -gchar *s = N_("Sun"); -gchar *s = N_("First day of week:"); -gchar *s = N_("Monday"); -gchar *s = N_("Tuesday"); -gchar *s = N_("Wednesday"); -gchar *s = N_("Thursday"); -gchar *s = N_("Friday"); -gchar *s = N_("Saturday"); -gchar *s = N_("Sunday"); -gchar *s = N_("Start of day:"); -gchar *s = N_("End of day:"); -gchar *s = N_("Display options"); -gchar *s = N_("Time divisions:"); -gchar *s = N_("Time format:"); -gchar *s = N_("Show appointment end times"); -gchar *s = N_("Compress weekends"); -gchar *s = N_("12 hour (am/pm)"); -gchar *s = N_("24 hour"); -gchar *s = N_("60 minutes"); -gchar *s = N_("30 minutes"); -gchar *s = N_("15 minutes"); -gchar *s = N_("10 minutes"); -gchar *s = N_("05 minutes"); -gchar *s = N_("Date navigator options"); -gchar *s = N_("Show week numbers"); -gchar *s = N_("Calendar"); -gchar *s = N_("Show"); -gchar *s = N_("Due Date"); -gchar *s = N_("Time Until Due"); -gchar *s = N_("Priority"); -gchar *s = N_("Highlight"); -gchar *s = N_("Overdue Items"); -gchar *s = N_("Items Due Today"); -gchar *s = N_("Items Not Yet Due"); -gchar *s = N_("Colors"); -gchar *s = N_("Pick a color"); -gchar *s = N_("Pick a color"); -gchar *s = N_("Pick a color"); -gchar *s = N_("Items Not Yet Due:"); -gchar *s = N_("Items Due Today:"); -gchar *s = N_("Overdue Items:"); -gchar *s = N_("TaskPad"); -gchar *s = N_("Defaults"); -gchar *s = N_("Remind me of all appointments"); -gchar *s = N_("minutes before they occur."); -gchar *s = N_("Visual Alarms"); -gchar *s = N_("Beep when alarm windows appear."); -gchar *s = N_("Audio Alarms"); -gchar *s = N_("Alarms timeout after"); -gchar *s = N_("seconds."); -gchar *s = N_("Enable snoozing for"); -gchar *s = N_("seconds."); -gchar *s = N_("Reminders"); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h deleted file mode 100644 index 52f115e0ac..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 2000, Helix Code, Inc. - * - * 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 - */ - -/* - * CalPrefsDialog - a GtkObject which handles a libglade-loaded dialog - * to edit the calendar preference settings. - */ - -#ifndef _CAL_PREFS_DIALOG_H_ -#define _CAL_PREFS_DIALOG_H_ - -#include -#include - -BEGIN_GNOME_DECLS - - -#define CAL_PREFS_DIALOG(obj) GTK_CHECK_CAST (obj, cal_prefs_dialog_get_type (), CalPrefsDialog) -#define CAL_PREFS_DIALOG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, cal_prefs_dialog_get_type (), CalPrefsDialogClass) -#define IS_CAL_PREFS_DIALOG(obj) GTK_CHECK_TYPE (obj, cal_prefs_dialog_get_type ()) - - -typedef struct _CalPrefsDialog CalPrefsDialog; -typedef struct _CalPrefsDialogClass CalPrefsDialogClass; - -struct _CalPrefsDialog -{ - GtkObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalPrefsDialogClass -{ - GtkObjectClass parent_class; -}; - - -GtkType cal_prefs_dialog_get_type (void); -CalPrefsDialog* cal_prefs_dialog_construct (CalPrefsDialog *prefs); -CalPrefsDialog* cal_prefs_dialog_new (void); - -void cal_prefs_dialog_show (CalPrefsDialog *prefs); - -END_GNOME_DECLS - -#endif /* _CAL_PREFS_DIALOG_H_ */ diff --git a/calendar/gui/dialogs/task-editor-dialog.glade b/calendar/gui/dialogs/task-editor-dialog.glade deleted file mode 100644 index bdde9ed091..0000000000 --- a/calendar/gui/dialogs/task-editor-dialog.glade +++ /dev/null @@ -1,706 +0,0 @@ - - - - - task-editor-dialog - task-editor-dialog - - src - pixmaps - C - True - True - True - task-editor-dialog.glade.h - - - - GnomeApp - task-editor-dialog - False - task-editor-dialog - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - True - - - GnomeDock - GnomeApp:dock - dock1 - True - - 0 - True - True - - - - GtkNotebook - GnomeDock:contents - notebook1 - 2 - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - - GtkVBox - vbox1 - 4 - False - 4 - - - GtkTable - table3 - 1 - 2 - False - 4 - 4 - - 0 - False - True - - - - GtkLabel - label3 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - summary - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GtkEntry - summary - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkHSeparator - hseparator1 - - 0 - False - True - - - - - GtkHBox - hbox4 - False - 0 - - 0 - False - True - - - - GtkTable - table1 - 2 - 4 - False - 2 - 4 - - 0 - False - True - - - - GtkLabel - label6 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label5 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label9 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - percent-complete - - 2 - 3 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GtkSpinButton - percent-complete - 60 - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 - 0 - 100 - 10 - 10 - 10 - - 3 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - Custom - due-date - task_editor_create_date_edit - 0 - 0 - Sun, 10 Sep 2000 17:32:18 GMT - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - Custom - start-date - task_editor_create_date_edit - 0 - 0 - Sun, 10 Sep 2000 17:33:31 GMT - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - - - GtkHSeparator - hseparator2 - - 0 - False - True - - - - - GtkHBox - hbox3 - False - 4 - - 0 - False - True - - - - GtkLabel - label7 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - status - - 0 - False - False - - - - - GtkOptionMenu - status - True - Not Started -In Progress -Completed -Cancelled - - 0 - - 0 - False - False - - - - - GtkLabel - label8 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - priority - - 0 - False - False - - - - - GtkOptionMenu - priority - True - High -Normal -Low - - 0 - - 0 - False - False - - - - - GtkLabel - label18 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - classification - - 0 - False - False - - - - - GtkOptionMenu - classification - True - None -Public -Private -Confidential - - 0 - - 0 - False - False - - - - - - GtkScrolledWindow - scrolledwindow1 - 150 - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - - - - GtkText - description - True - True - - - - - - GtkHBox - hbox2 - False - 2 - - 0 - False - True - - - - GtkButton - button3 - True - GTK_RELIEF_NORMAL - - 0 - False - False - - - - GtkLabel - label16 - False - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 4 - 0 - - - - - GtkEntry - contacts - False - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button4 - True - GTK_RELIEF_NORMAL - - 0 - False - False - - - - GtkLabel - label17 - False - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 4 - 0 - - - - - GtkEntry - categories - False - True - True - True - 0 - - - 0 - True - True - - - - - - - GtkLabel - Notebook:tab - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkTable - table4 - 4 - 2 - 2 - False - 2 - 4 - - - GtkLabel - label12 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label14 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - url - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - Custom - completed-date - task_editor_create_date_edit - 0 - 0 - Sun, 10 Sep 2000 17:34:07 GMT - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkLabel - Notebook:tab - label2 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - diff --git a/calendar/gui/dialogs/task-editor-dialog.glade.h b/calendar/gui/dialogs/task-editor-dialog.glade.h deleted file mode 100644 index 8ba4eea0a1..0000000000 --- a/calendar/gui/dialogs/task-editor-dialog.glade.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Translatable strings file generated by Glade. - * Add this file to your project's POTFILES.in. - * DO NOT compile it as part of your application. - */ - -gchar *s = N_("task-editor-dialog"); -gchar *s = N_("S_ummary"); -gchar *s = N_("Sta_rt Date:"); -gchar *s = N_("_Due Date:"); -gchar *s = N_("% Comp_lete:"); -gchar *s = N_("_Status:"); -gchar *s = N_("Not Started"); -gchar *s = N_("In Progress"); -gchar *s = N_("Completed"); -gchar *s = N_("Cancelled"); -gchar *s = N_("_Priority:"); -gchar *s = N_("High"); -gchar *s = N_("Normal"); -gchar *s = N_("Low"); -gchar *s = N_("C_lassification:"); -gchar *s = N_("None"); -gchar *s = N_("Public"); -gchar *s = N_("Private"); -gchar *s = N_("Confidential"); -gchar *s = N_("_Contacts..."); -gchar *s = N_("Ca_tegories..."); -gchar *s = N_("Task"); -gchar *s = N_("Date Completed:"); -gchar *s = N_("URL:"); -gchar *s = N_("Details"); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c deleted file mode 100644 index f26bae2e09..0000000000 --- a/calendar/gui/dialogs/task-editor.c +++ /dev/null @@ -1,1182 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 2000, Helix Code, Inc. - * - * 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 - */ - -/* - * TaskEditor - a GtkObject which handles a libglade-loaded dialog to edit - * tasks. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "task-editor.h" - - -typedef struct { - /* Glade XML data */ - GladeXML *xml; - - /* UI handler */ - BonoboUIComponent *uic; - - /* Client to use */ - CalClient *client; - - /* Calendar component we are editing; this is an internal copy and is - * not one of the read-only objects from the parent calendar. - */ - CalComponent *comp; - - - /* This is TRUE while we are setting the widget values. We just return - from any signal handlers. */ - gboolean ignore_callbacks; - - /* Widgets from the Glade file */ - - GtkWidget *app; - - GtkWidget *summary; - - GtkWidget *due_date; - GtkWidget *start_date; - - GtkWidget *percent_complete; - - GtkWidget *status; - GtkWidget *priority; - GtkWidget *classification; - - GtkWidget *description; - - GtkWidget *contacts; - GtkWidget *categories; - - GtkWidget *completed_date; - GtkWidget *url; -} TaskEditorPrivate; - - -/* Note that these two arrays must match. */ -static const int status_map[] = { - ICAL_STATUS_NEEDSACTION, - ICAL_STATUS_INPROCESS, - ICAL_STATUS_COMPLETED, - ICAL_STATUS_CANCELLED, - -1 -}; - -static const char* status_string_map[] = { - "NEEDS-ACTION", - "IN-PROCESS", - "COMPLETED", - "CANCELLED", - NULL -}; - - -typedef enum { - PRIORITY_HIGH, - PRIORITY_NORMAL, - PRIORITY_LOW, - PRIORITY_UNDEFINED, -} TaskEditorPriority; - -static const int priority_map[] = { - PRIORITY_HIGH, - PRIORITY_NORMAL, - PRIORITY_LOW, - PRIORITY_UNDEFINED, - -1 -}; - -static const int classification_map[] = { - CAL_COMPONENT_CLASS_NONE, - CAL_COMPONENT_CLASS_PUBLIC, - CAL_COMPONENT_CLASS_PRIVATE, - CAL_COMPONENT_CLASS_CONFIDENTIAL, - -1 -}; - - -static void task_editor_class_init (TaskEditorClass *class); -static void task_editor_init (TaskEditor *tedit); -static gint app_delete_event_cb (GtkWidget *widget, - GdkEvent *event, - gpointer data); -static void close_dialog (TaskEditor *tedit); -static gboolean get_widgets (TaskEditor *tedit); -static void init_widgets (TaskEditor *tedit); -static void task_editor_destroy (GtkObject *object); -static char * make_title_from_comp (CalComponent *comp); -static void clear_widgets (TaskEditor *tedit); -static void fill_widgets (TaskEditor *tedit); - -static void file_save_cb (GtkWidget *widget, gpointer data); -static void file_save_and_close_cb (GtkWidget *widget, gpointer data); -static void file_delete_cb (GtkWidget *widget, gpointer data); -static void file_close_cb (GtkWidget *widget, gpointer data); - -static void debug_xml_cb (GtkWidget *widget, gpointer data); - -static void save_todo_object (TaskEditor *tedit); -static void dialog_to_comp_object (TaskEditor *tedit); - -static void obj_updated_cb (CalClient *client, const char *uid, gpointer data); -static void obj_removed_cb (CalClient *client, const char *uid, gpointer data); -static void raise_and_focus (GtkWidget *widget); - -static TaskEditorPriority priority_value_to_index (int priority_value); -static int priority_index_to_value (TaskEditorPriority priority); - -static int status_string_to_value (const char *status_string); -static const char* status_value_to_string (int status); - -static void completed_changed (EDateEdit *dedit, - TaskEditor *tedit); -static void status_changed (GtkMenu *menu, - TaskEditor *tedit); -static void percent_complete_changed (GtkAdjustment *adj, - TaskEditor *tedit); - -GtkWidget * task_editor_create_date_edit (void); - -static GtkObjectClass *parent_class; - -E_MAKE_TYPE(task_editor, "TaskEditor", TaskEditor, - task_editor_class_init, task_editor_init, GTK_TYPE_OBJECT) - - -static void -task_editor_class_init (TaskEditorClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - object_class->destroy = task_editor_destroy; -} - - -static void -task_editor_init (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - - priv = g_new0 (TaskEditorPrivate, 1); - tedit->priv = priv; - - priv->ignore_callbacks = FALSE; -} - - -/** - * task_editor_new: - * @Returns: a new #TaskEditor. - * - * Creates a new #TaskEditor. - **/ -TaskEditor * -task_editor_new (void) -{ - TaskEditor *tedit; - - tedit = TASK_EDITOR (gtk_type_new (task_editor_get_type ())); - return task_editor_construct (tedit); -} - -static BonoboUIVerb verbs [] = { - - BONOBO_UI_UNSAFE_VERB ("FileSave", file_save_cb), - BONOBO_UI_UNSAFE_VERB ("FileDelete", file_delete_cb), - BONOBO_UI_UNSAFE_VERB ("FileClose", file_close_cb), - BONOBO_UI_UNSAFE_VERB ("FileSaveAndClose", file_save_and_close_cb), - - BONOBO_UI_UNSAFE_VERB ("DebugDumpXml", debug_xml_cb), - - BONOBO_UI_VERB_END -}; - -/** - * task_editor_construct: - * @tedit: A #TaskEditor. - * - * Constructs a task editor by loading its Glade XML file. - * - * Return value: The same object as @tedit, or NULL if the widgets could not be - * created. In the latter case, the task editor will automatically be - * destroyed. - **/ -TaskEditor * -task_editor_construct (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - GtkWidget *bonobo_win; - - g_return_val_if_fail (tedit != NULL, NULL); - g_return_val_if_fail (IS_TASK_EDITOR (tedit), NULL); - - priv = tedit->priv; - - /* Load the content widgets */ - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/task-editor-dialog.glade", NULL); - if (!priv->xml) { - g_message ("task_editor_construct(): Could not load the Glade XML file!"); - goto error; - } - - if (!get_widgets (tedit)) { - g_message ("task_editor_construct(): Could not find all widgets in the XML file!"); - goto error; - } - - init_widgets (tedit); - - /* Construct the app */ - - priv->uic = bonobo_ui_component_new ("task-editor-dialog"); - if (!priv->uic) { - g_message ("task_editor_construct(): Could not create the UI component"); - goto error; - } - - bonobo_win = bonobo_window_new ("event-editor-dialog", "Event Editor"); - - /* FIXME: The sucking bit */ - { - GtkWidget *contents; - - contents = gnome_dock_get_client_area ( - GNOME_DOCK (GNOME_APP (priv->app)->dock)); - if (!contents) { - g_message ("event_editor_construct(): Could not get contents"); - goto error; - } - gtk_widget_ref (contents); - gtk_container_remove (GTK_CONTAINER (contents->parent), contents); - bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents); - gtk_widget_destroy (priv->app); - priv->app = GTK_WIDGET (bonobo_win); - } - - { - BonoboUIContainer *container = bonobo_ui_container_new (); - bonobo_ui_container_set_win (container, BONOBO_WINDOW (priv->app)); - bonobo_ui_component_set_container ( - priv->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container))); - } - - bonobo_ui_component_add_verb_list_with_data ( - priv->uic, verbs, tedit); - - bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, - "evolution-task-editor-dialog.xml", - "evolution-task-editor"); - - /* Hook to destruction of the dialog */ - gtk_signal_connect (GTK_OBJECT (priv->app), "delete_event", - GTK_SIGNAL_FUNC (app_delete_event_cb), tedit); - - /* Show the dialog */ - gtk_widget_show (priv->app); - - return tedit; - - error: - - gtk_object_unref (GTK_OBJECT (tedit)); - return NULL; -} - - -/* Called by libglade to create our custom EDateEdit widgets. */ -GtkWidget * -task_editor_create_date_edit (void) -{ - GtkWidget *dedit; - - dedit = e_date_edit_new (); - /* FIXME: Set other options. */ - e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 8, 18); - e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); - return dedit; -} - - -/* Callback used when the dialog box is destroyed */ -static gint -app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - TaskEditor *tedit; - - /* FIXME: need to check for a dirty object */ - - tedit = TASK_EDITOR (data); - close_dialog (tedit); - - return TRUE; -} - - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - - priv = tedit->priv; - - g_assert (priv->app != NULL); - - gtk_object_destroy (GTK_OBJECT (tedit)); -} - - -/* Gets the widgets from the XML file and returns if they are all available. - * For the widgets whose values can be simply set with e-dialog-utils, it does - * that as well. - */ -static gboolean -get_widgets (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - - priv = tedit->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->app = GW ("task-editor-dialog"); - - priv->summary = GW ("summary"); - - priv->due_date = GW ("due-date"); - priv->start_date = GW ("start-date"); - - priv->percent_complete = GW ("percent-complete"); - - priv->status = GW ("status"); - priv->priority = GW ("priority"); - priv->classification = GW ("classification"); - - priv->description = GW ("description"); - - priv->contacts = GW ("contacts"); - priv->categories = GW ("categories"); - - priv->completed_date = GW ("completed-date"); - priv->url = GW ("url"); - -#undef GW - - return (priv->app - && priv->summary - && priv->due_date - && priv->start_date - && priv->percent_complete - && priv->status - && priv->priority - && priv->classification - && priv->description - && priv->contacts - && priv->categories - && priv->completed_date - && priv->url); -} - - -/* Hooks the widget signals */ -static void -init_widgets (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - - priv = tedit->priv; - - /* Connect signals. The Status, Percent Complete & Date Completed - properties are closely related so whenever one changes we may need - to update the other 2. */ - gtk_signal_connect (GTK_OBJECT (priv->completed_date), "changed", - GTK_SIGNAL_FUNC (completed_changed), tedit); - - gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->status)->menu), - "deactivate", - GTK_SIGNAL_FUNC (status_changed), tedit); - - gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), - "value_changed", - GTK_SIGNAL_FUNC (percent_complete_changed), tedit); -} - -static void -task_editor_destroy (GtkObject *object) -{ - TaskEditor *tedit; - TaskEditorPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_TASK_EDITOR (object)); - - tedit = TASK_EDITOR (object); - priv = tedit->priv; - - if (priv->uic) { - bonobo_object_unref (BONOBO_OBJECT (priv->uic)); - priv->uic = NULL; - } - - if (priv->app) { - gtk_widget_destroy (priv->app); - priv->app = NULL; - } - - if (priv->comp) { - gtk_object_unref (GTK_OBJECT (priv->comp)); - priv->comp = NULL; - } - - if (priv->client) { - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), - tedit); - gtk_object_unref (GTK_OBJECT (priv->client)); - priv->client = NULL; - } - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - g_free (priv); - tedit->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -void -task_editor_set_cal_client (TaskEditor *tedit, - CalClient *client) -{ - TaskEditorPrivate *priv; - - g_return_if_fail (tedit != NULL); - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - if (client == priv->client) - return; - - if (client) - g_return_if_fail (IS_CAL_CLIENT (client)); - - if (client) - g_return_if_fail (cal_client_is_loaded (client)); - - if (client) - gtk_object_ref (GTK_OBJECT (client)); - - if (priv->client) { - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), - tedit); - gtk_object_unref (GTK_OBJECT (priv->client)); - } - - priv->client = client; - - if (priv->client) { - gtk_signal_connect (GTK_OBJECT (priv->client), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated_cb), tedit); - gtk_signal_connect (GTK_OBJECT (priv->client), "obj_removed", - GTK_SIGNAL_FUNC (obj_removed_cb), tedit); - } -} - - -/* Callback used when the calendar client tells us that an object changed */ -static void -obj_updated_cb (CalClient *client, const char *uid, gpointer data) -{ - TaskEditor *tedit; - TaskEditorPrivate *priv; - CalComponent *comp; - CalClientGetStatus status; - const gchar *editing_uid; - - tedit = TASK_EDITOR (data); - - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - /* If we aren't showing the object which has been updated, return. */ - if (!priv->comp) - return; - cal_component_get_uid (priv->comp, &editing_uid); - if (strcmp (uid, editing_uid)) - return; - - - /* Get the task from the server. */ - status = cal_client_get_object (priv->client, uid, &comp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: - /* Everything is fine */ - break; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - g_message ("obj_updated_cb(): Syntax error when getting object `%s'", uid); - return; - - case CAL_CLIENT_GET_NOT_FOUND: - /* The object is no longer in the server, so do nothing */ - return; - - default: - g_assert_not_reached (); - return; - } - - raise_and_focus (priv->app); -} - -/* Callback used when the calendar client tells us that an object was removed */ -static void -obj_removed_cb (CalClient *client, const char *uid, gpointer data) -{ - TaskEditor *tedit; - TaskEditorPrivate *priv; - const gchar *editing_uid; - - tedit = TASK_EDITOR (data); - - g_return_if_fail (tedit != NULL); - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - /* If we aren't showing the object which has been updated, return. */ - if (!priv->comp) - return; - cal_component_get_uid (priv->comp, &editing_uid); - if (strcmp (uid, editing_uid)) - return; - - - raise_and_focus (priv->app); -} - - -/* Brings attention to a window by raising it and giving it focus */ -static void -raise_and_focus (GtkWidget *widget) -{ - g_assert (GTK_WIDGET_REALIZED (widget)); - gdk_window_show (widget->window); - gtk_widget_grab_focus (widget); -} - - -/** - * task_editor_set_todo_object: - * @tedit: A #TaskEditor. - * @comp: A todo object. - * - * Sets the todo object that a task editor dialog will manipulate. - **/ -void -task_editor_set_todo_object (TaskEditor *tedit, - CalComponent *comp) -{ - TaskEditorPrivate *priv; - char *title; - - g_return_if_fail (tedit != NULL); - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - if (priv->comp) { - gtk_object_unref (GTK_OBJECT (priv->comp)); - priv->comp = NULL; - } - - if (comp) - priv->comp = cal_component_clone (comp); - - title = make_title_from_comp (priv->comp); - gtk_window_set_title (GTK_WINDOW (priv->app), title); - g_free (title); - - fill_widgets (tedit); -} - - -/* Creates an appropriate title for the task editor dialog */ -static char * -make_title_from_comp (CalComponent *comp) -{ - const char *summary; - CalComponentVType type; - CalComponentText text; - - if (!comp) - return g_strdup (_("Edit Task")); - - cal_component_get_summary (comp, &text); - if (text.value) - summary = text.value; - else - summary = _("No summary"); - - - type = cal_component_get_vtype (comp); - switch (type) { - case CAL_COMPONENT_EVENT: - return g_strdup_printf (_("Appointment - %s"), summary); - - case CAL_COMPONENT_TODO: - return g_strdup_printf (_("Task - %s"), summary); - - case CAL_COMPONENT_JOURNAL: - return g_strdup_printf (_("Journal entry - %s"), summary); - - default: - g_message ("make_title_from_comp(): Cannot handle object of type %d", type); - return NULL; - } -} - - -/* Fills the widgets with default values */ -static void -clear_widgets (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - - priv = tedit->priv; - - -} - -/* Fills in the widgets with the proper values */ -static void -fill_widgets (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - CalComponentText text; - CalComponentDateTime d; - struct icaltimetype *completed; - CalComponentClassification classification; - GSList *l; - time_t t; - int *priority_value, *percent; - icalproperty_status status; - TaskEditorPriority priority; - const char *url, *status_string; - - priv = tedit->priv; - - clear_widgets (tedit); - - if (!priv->comp) - return; - - /* We want to ignore any signals emitted while changing fields. */ - priv->ignore_callbacks = TRUE; - - - cal_component_get_summary (priv->comp, &text); - e_dialog_editable_set (priv->summary, text.value); - - cal_component_get_description_list (priv->comp, &l); - if (l) { - text = *(CalComponentText *)l->data; - e_dialog_editable_set (priv->description, text.value); - } else { - e_dialog_editable_set (priv->description, NULL); - } - cal_component_free_text_list (l); - - /* Due Date. */ - cal_component_get_due (priv->comp, &d); - if (d.value) { - t = icaltime_as_timet (*d.value); - } else { - t = -1; - } - e_date_edit_set_time (E_DATE_EDIT (priv->due_date), t); - - /* Start Date. */ - cal_component_get_dtstart (priv->comp, &d); - if (d.value) { - t = icaltime_as_timet (*d.value); - } else { - t = -1; - } - e_date_edit_set_time (E_DATE_EDIT (priv->start_date), t); - - /* Completed Date. */ - cal_component_get_completed (priv->comp, &completed); - if (completed) { - t = icaltime_as_timet (*completed); - cal_component_free_icaltimetype (completed); - } else { - t = -1; - } - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), t); - - /* Percent Complete. */ - cal_component_get_percent (priv->comp, &percent); - if (percent) { - e_dialog_spin_set (priv->percent_complete, *percent); - cal_component_free_percent (percent); - } else { - /* FIXME: Could check if task is completed and set 100%. */ - e_dialog_spin_set (priv->percent_complete, 0); - } - - /* Status. */ - cal_component_get_status (priv->comp, &status_string); - if (status_string) { - status = status_string_to_value (status_string); - } else { - /* Try to user the percent value. */ - if (percent) { - if (*percent == 0) - status = ICAL_STATUS_NEEDSACTION; - else if (*percent == 100) - status = ICAL_STATUS_COMPLETED; - else - status = ICAL_STATUS_INPROCESS; - } else { - status = ICAL_STATUS_NEEDSACTION; - } - } - g_print ("Setting status\n"); - e_dialog_option_menu_set (priv->status, status, status_map); - - /* Priority. */ - cal_component_get_priority (priv->comp, &priority_value); - if (priority_value) { - priority = priority_value_to_index (*priority_value); - cal_component_free_priority (priority_value); - } else { - priority = PRIORITY_UNDEFINED; - } - g_print ("Setting priority\n"); - e_dialog_option_menu_set (priv->priority, priority, priority_map); - - - /* Classification. */ - cal_component_get_classification (priv->comp, &classification); - g_print ("Setting classification\n"); - e_dialog_option_menu_set (priv->classification, classification, - classification_map); - - - /* URL. */ - cal_component_get_url (priv->comp, &url); - e_dialog_editable_set (priv->url, url); - - priv->ignore_callbacks = FALSE; -} - - -static void -save_todo_object (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - char *title; - - priv = tedit->priv; - - g_return_if_fail (priv->client != NULL); - - if (!priv->comp) - return; - - dialog_to_comp_object (tedit); - - title = make_title_from_comp (priv->comp); - gtk_window_set_title (GTK_WINDOW (priv->app), title); - g_free (title); - - if (!cal_client_update_object (priv->client, priv->comp)) - g_message ("save_todo_object(): Could not update the object!"); -} - - -/* Get the values of the widgets in the event editor and put them in the iCalObject */ -static void -dialog_to_comp_object (TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - CalComponent *comp; - CalComponentText *text; - CalComponentDateTime date; - time_t t; - GSList *list; - icalproperty_status status; - TaskEditorPriority priority; - int priority_value, percent; - CalComponentClassification classification; - char *url; - const char *status_string; - - priv = tedit->priv; - comp = priv->comp; - - /* Summary. */ - text = g_new0 (CalComponentText, 1); - text->value = e_dialog_editable_get (priv->summary); - cal_component_set_summary (comp, text); - - /* Description. Note that we use the text variable again, and it is - freed in cal_component_free_text_list(). */ - list = NULL; - text->value = e_dialog_editable_get (priv->description); - list = g_slist_prepend (list, text); - cal_component_set_description_list (comp, list); - cal_component_free_text_list (list); - - - date.value = g_new (struct icaltimetype, 1); - date.tzid = NULL; - - /* Due Date. */ - t = e_date_edit_get_time (E_DATE_EDIT (priv->due_date)); - if (t != -1) { - *date.value = icaltime_from_timet (t, FALSE, FALSE); - cal_component_set_due (comp, &date); - } else { - cal_component_set_due (comp, NULL); - } - - /* Start Date. */ - t = e_date_edit_get_time (E_DATE_EDIT (priv->start_date)); - if (t != -1) { - *date.value = icaltime_from_timet (t, FALSE, FALSE); - cal_component_set_dtstart (comp, &date); - } else { - cal_component_set_dtstart (comp, NULL); - } - - /* Completed Date. */ - t = e_date_edit_get_time (E_DATE_EDIT (priv->completed_date)); - if (t != -1) { - *date.value = icaltime_from_timet (t, FALSE, FALSE); - cal_component_set_completed (comp, date.value); - } else { - cal_component_set_completed (comp, NULL); - } - - g_free (date.value); - - /* Percent Complete. */ - percent = e_dialog_spin_get_int (priv->percent_complete); - cal_component_set_percent (comp, &percent); - - /* Status. */ - status = e_dialog_option_menu_get (priv->status, status_map); - status_string = status_value_to_string (status); - cal_component_set_status (comp, status_string); - - /* Priority. */ - priority = e_dialog_option_menu_get (priv->priority, priority_map); - priority_value = priority_index_to_value (priority); - cal_component_set_priority (comp, &priority_value); - - /* Classification. */ - classification = e_dialog_option_menu_get (priv->classification, - classification_map); - cal_component_set_classification (comp, classification); - - - /* URL. */ - url = e_dialog_editable_get (priv->url); - cal_component_set_url (comp, url); - - - - - cal_component_commit_sequence (comp); -} - -static void -debug_xml_cb (GtkWidget *widget, gpointer data) -{ - TaskEditor *tedit = TASK_EDITOR (data); - TaskEditorPrivate *priv = tedit->priv; - - bonobo_window_dump (BONOBO_WINDOW (priv->app), "on demand"); -} - -/* File/Save callback */ -static void -file_save_cb (GtkWidget *widget, gpointer data) -{ - TaskEditor *tedit; - - tedit = TASK_EDITOR (data); - save_todo_object (tedit); -} - -/* File/Save and Close callback */ -static void -file_save_and_close_cb (GtkWidget *widget, gpointer data) -{ - TaskEditor *tedit; - - tedit = TASK_EDITOR (data); - save_todo_object (tedit); - close_dialog (tedit); -} - -/* File/Delete callback */ -static void -file_delete_cb (GtkWidget *widget, gpointer data) -{ - TaskEditor *tedit; - TaskEditorPrivate *priv; - const char *uid; - - tedit = TASK_EDITOR (data); - - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - g_return_if_fail (priv->comp); - - cal_component_get_uid (priv->comp, &uid); - - /* We don't check the return value; FALSE can mean the object was not in - * the server anyways. - */ - cal_client_remove_object (priv->client, uid); - - close_dialog (tedit); -} - -/* File/Close callback */ -static void -file_close_cb (GtkWidget *widget, gpointer data) -{ - TaskEditor *tedit; - - tedit = TASK_EDITOR (data); - - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - close_dialog (tedit); -} - - -static TaskEditorPriority -priority_value_to_index (int priority_value) -{ - TaskEditorPriority retval; - - if (priority_value == 0) - retval = PRIORITY_UNDEFINED; - else if (priority_value <= 4) - retval = PRIORITY_HIGH; - else if (priority_value == 5) - retval = PRIORITY_NORMAL; - else - retval = PRIORITY_LOW; - - return retval; -} - - -static int -priority_index_to_value (TaskEditorPriority priority) -{ - int retval; - - switch (priority) { - case PRIORITY_UNDEFINED: - retval = 0; - break; - case PRIORITY_HIGH: - retval = 3; - break; - case PRIORITY_NORMAL: - retval = 5; - break; - case PRIORITY_LOW: - retval = 7; - break; - default: - retval = -1; - g_assert_not_reached (); - break; - } - - return retval; -} - - -static int -status_string_to_value (const char *status_string) -{ - int i; - - for (i = 0; status_map[i] != -1; i++) { - if (!strcmp (status_string_map[i], status_string)) - return status_map[i]; - } - - g_warning ("Invalid todo status string"); - return ICAL_STATUS_NEEDSACTION; -} - - -static const char* -status_value_to_string (int status) -{ - int i; - - for (i = 0; status_map[i] != -1; i++) { - if (status_map[i] == status) - return status_string_map[i]; - } - - g_warning ("Invalid todo status value"); - return NULL; -} - - -static void -completed_changed (EDateEdit *dedit, - TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - time_t t; - - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - if (priv->ignore_callbacks) - return; - - t = e_date_edit_get_time (E_DATE_EDIT (priv->completed_date)); - priv->ignore_callbacks = TRUE; - if (t == -1) { - /* If the 'Completed Date' is set to 'None', we set the - status to 'Not Started' and the percent-complete to 0. - The task may actually be partially-complete, but we leave - it to the user to set those fields. */ - e_dialog_option_menu_set (priv->status, ICAL_STATUS_NEEDSACTION, - status_map); - e_dialog_spin_set (priv->percent_complete, 0); - } else { - e_dialog_option_menu_set (priv->status, ICAL_STATUS_COMPLETED, - status_map); - e_dialog_spin_set (priv->percent_complete, 100); - } - priv->ignore_callbacks = FALSE; -} - - -static void -status_changed (GtkMenu *menu, - TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - icalproperty_status status; - - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - if (priv->ignore_callbacks) - return; - - status = e_dialog_option_menu_get (priv->status, status_map); - priv->ignore_callbacks = TRUE; - if (status == ICAL_STATUS_NEEDSACTION) { - e_dialog_spin_set (priv->percent_complete, 0); - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), -1); - } else if (status == ICAL_STATUS_COMPLETED) { - e_dialog_spin_set (priv->percent_complete, 100); - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), - time (NULL)); - } - priv->ignore_callbacks = FALSE; -} - - -static void -percent_complete_changed (GtkAdjustment *adj, - TaskEditor *tedit) -{ - TaskEditorPrivate *priv; - gint percent; - icalproperty_status status; - time_t date_completed; - - g_return_if_fail (IS_TASK_EDITOR (tedit)); - - priv = tedit->priv; - - if (priv->ignore_callbacks) - return; - - percent = e_dialog_spin_get_int (priv->percent_complete); - priv->ignore_callbacks = TRUE; - - if (percent == 100) { - date_completed = time (NULL); - status = ICAL_STATUS_COMPLETED; - } else { - /* FIXME: Set to 'None'. */ - date_completed = time (NULL); - - if (percent == 0) - status = ICAL_STATUS_NEEDSACTION; - else - status = ICAL_STATUS_INPROCESS; - } - - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), - date_completed); - e_dialog_option_menu_set (priv->status, status, status_map); - - priv->ignore_callbacks = FALSE; -} - diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h deleted file mode 100644 index a53d29c2a2..0000000000 --- a/calendar/gui/dialogs/task-editor.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin - * - * Copyright 2000, Helix Code, Inc. - * - * 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 _TASK_EDITOR_H_ -#define _TASK_EDITOR_H_ - -#include -#include -#include - -BEGIN_GNOME_DECLS - - -#define TASK_EDITOR(obj) GTK_CHECK_CAST (obj, task_editor_get_type (), TaskEditor) -#define TASK_EDITOR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, task_editor_get_type (), TaskEditorClass) -#define IS_TASK_EDITOR(obj) GTK_CHECK_TYPE (obj, task_editor_get_type ()) - - -typedef struct _TaskEditor TaskEditor; -typedef struct _TaskEditorClass TaskEditorClass; - -struct _TaskEditor -{ - GtkObject object; - - /* Private data */ - gpointer priv; -}; - -struct _TaskEditorClass -{ - GtkObjectClass parent_class; -}; - - -GtkType task_editor_get_type (void); -TaskEditor* task_editor_construct (TaskEditor *tedit); -TaskEditor* task_editor_new (void); - -void task_editor_set_cal_client (TaskEditor *tedit, - CalClient *client); -void task_editor_set_todo_object (TaskEditor *tedit, - CalComponent *comp); - - -END_GNOME_DECLS - -#endif /* _TASK_EDITOR_H_ */ diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade deleted file mode 100644 index bdde9ed091..0000000000 --- a/calendar/gui/dialogs/task-page.glade +++ /dev/null @@ -1,706 +0,0 @@ - - - - - task-editor-dialog - task-editor-dialog - - src - pixmaps - C - True - True - True - task-editor-dialog.glade.h - - - - GnomeApp - task-editor-dialog - False - task-editor-dialog - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - True - False - True - - - GnomeDock - GnomeApp:dock - dock1 - True - - 0 - True - True - - - - GtkNotebook - GnomeDock:contents - notebook1 - 2 - True - True - True - GTK_POS_TOP - False - 2 - 2 - False - - - GtkVBox - vbox1 - 4 - False - 4 - - - GtkTable - table3 - 1 - 2 - False - 4 - 4 - - 0 - False - True - - - - GtkLabel - label3 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - summary - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GtkEntry - summary - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkHSeparator - hseparator1 - - 0 - False - True - - - - - GtkHBox - hbox4 - False - 0 - - 0 - False - True - - - - GtkTable - table1 - 2 - 4 - False - 2 - 4 - - 0 - False - True - - - - GtkLabel - label6 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label5 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label9 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - percent-complete - - 2 - 3 - 0 - 1 - 0 - 0 - False - False - False - False - False - False - - - - - GtkSpinButton - percent-complete - 60 - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 - 0 - 100 - 10 - 10 - 10 - - 3 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - Custom - due-date - task_editor_create_date_edit - 0 - 0 - Sun, 10 Sep 2000 17:32:18 GMT - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - Custom - start-date - task_editor_create_date_edit - 0 - 0 - Sun, 10 Sep 2000 17:33:31 GMT - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - - - GtkHSeparator - hseparator2 - - 0 - False - True - - - - - GtkHBox - hbox3 - False - 4 - - 0 - False - True - - - - GtkLabel - label7 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - status - - 0 - False - False - - - - - GtkOptionMenu - status - True - Not Started -In Progress -Completed -Cancelled - - 0 - - 0 - False - False - - - - - GtkLabel - label8 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - priority - - 0 - False - False - - - - - GtkOptionMenu - priority - True - High -Normal -Low - - 0 - - 0 - False - False - - - - - GtkLabel - label18 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - classification - - 0 - False - False - - - - - GtkOptionMenu - classification - True - None -Public -Private -Confidential - - 0 - - 0 - False - False - - - - - - GtkScrolledWindow - scrolledwindow1 - 150 - GTK_POLICY_NEVER - GTK_POLICY_ALWAYS - GTK_UPDATE_CONTINUOUS - GTK_UPDATE_CONTINUOUS - - 0 - True - True - - - - GtkText - description - True - True - - - - - - GtkHBox - hbox2 - False - 2 - - 0 - False - True - - - - GtkButton - button3 - True - GTK_RELIEF_NORMAL - - 0 - False - False - - - - GtkLabel - label16 - False - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 4 - 0 - - - - - GtkEntry - contacts - False - True - True - True - 0 - - - 0 - True - True - - - - - GtkButton - button4 - True - GTK_RELIEF_NORMAL - - 0 - False - False - - - - GtkLabel - label17 - False - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 4 - 0 - - - - - GtkEntry - categories - False - True - True - True - 0 - - - 0 - True - True - - - - - - - GtkLabel - Notebook:tab - label1 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - GtkTable - table4 - 4 - 2 - 2 - False - 2 - 4 - - - GtkLabel - label12 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label14 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - url - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - Custom - completed-date - task_editor_create_date_edit - 0 - 0 - Sun, 10 Sep 2000 17:34:07 GMT - - 1 - 2 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - - GtkLabel - Notebook:tab - label2 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - - - - - - -- cgit v1.2.3