diff options
Diffstat (limited to 'calendar/gui/dialogs')
53 files changed, 0 insertions, 18405 deletions
diff --git a/calendar/gui/dialogs/.cvsignore b/calendar/gui/dialogs/.cvsignore deleted file mode 100644 index 3b97f6881d..0000000000 --- a/calendar/gui/dialogs/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -Makefile -Makefile.in -Evolution-Addressbook-SelectNames.h -Evolution-Addressbook-SelectNames-stubs.c -Evolution-Addressbook-SelectNames-skels.c -Evolution-Addressbook-SelectNames-common.c diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am deleted file mode 100644 index 54a793fdb5..0000000000 --- a/calendar/gui/dialogs/Makefile.am +++ /dev/null @@ -1,106 +0,0 @@ -IDLS = $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl - -IDL_GENERATED = \ - Evolution-Addressbook-SelectNames.h \ - Evolution-Addressbook-SelectNames-common.c \ - Evolution-Addressbook-SelectNames-skels.c \ - Evolution-Addressbook-SelectNames-stubs.c - -$(IDL_GENERATED): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl - -BUILT_SOURCES = $(IDL_GENERATED) - -INCLUDES = \ - -DG_LOG_DOMAIN=\"calendar-gui\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I$(top_srcdir)/calendar/cal-client \ - -I$(top_builddir)/calendar/cal-client \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/shell \ - -I$(top_srcdir)/addressbook/backend/ebook \ - -I$(top_builddir)/addressbook/backend/ebook \ - -I$(includedir) \ - $(EXTRA_GNOME_CFLAGS) \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - $(BONOBO_VFS_GNOME_CFLAGS) \ - -DGNOMELOCALEDIR=\""$(localedir)"\" - -noinst_LIBRARIES = libcal-dialogs.a - -libcal_dialogs_a_SOURCES = \ - $(IDL_GENERATED) \ - alarm-options.c \ - alarm-options.h \ - alarm-page.c \ - alarm-page.h \ - cal-prefs-dialog.c \ - cal-prefs-dialog.h \ - cancel-comp.c \ - cancel-comp.h \ - changed-comp.c \ - changed-comp.h \ - comp-editor.c \ - comp-editor.h \ - comp-editor-page.c \ - comp-editor-page.h \ - comp-editor-util.c \ - comp-editor-util.h \ - delete-comp.c \ - delete-comp.h \ - e-delegate-dialog.c \ - e-delegate-dialog.h \ - event-editor.c \ - event-editor.h \ - event-page.c \ - event-page.h \ - meeting-page.c \ - meeting-page.h \ - recurrence-page.c \ - recurrence-page.h \ - save-comp.c \ - save-comp.h \ - schedule-page.c \ - schedule-page.h \ - send-comp.c \ - send-comp.h \ - task-editor.c \ - task-editor.h \ - task-details-page.c \ - task-details-page.h \ - task-page.c \ - task-page.h - -iconsdir = $(datadir)/images/evolution - -gladedir = $(datadir)/evolution/glade -glade_DATA = \ - alarm-options.glade \ - alarm-page.glade \ - cal-prefs-dialog.glade \ - e-delegate-dialog.glade \ - event-page.glade \ - meeting-page.glade \ - recurrence-page.glade \ - schedule-page.glade \ - task-details-page.glade \ - task-page.glade - -etspecdir = $(datadir)/evolution/etspec/ -etspec_DATA = meeting-page.etspec - -CLEANFILES = $(BUILT_SOURCES) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) - -EXTRA_DIST = \ - $(glade_DATA) \ - $(etspec_DATA) diff --git a/calendar/gui/dialogs/alarm-options.c b/calendar/gui/dialogs/alarm-options.c deleted file mode 100644 index 2ea6938633..0000000000 --- a/calendar/gui/dialogs/alarm-options.c +++ /dev/null @@ -1,585 +0,0 @@ -/* Evolution calendar - Alarm options dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <gtk/gtkmain.h> -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkwindow.h> -#include <glade/glade.h> -#include "e-util/e-dialog-widgets.h" -#include "alarm-options.h" - - - -typedef struct { - /* Whether the dialog was accepted or canceled */ - gboolean canceled; - - /* Glade XML data */ - GladeXML *xml; - - /* Toplevel */ - GtkWidget *toplevel; - - /* Buttons */ - GtkWidget *button_ok; - GtkWidget *button_cancel; - - /* Alarm repeat widgets */ - GtkWidget *repeat_toggle; - GtkWidget *repeat_group; - GtkWidget *repeat_quantity; - GtkWidget *repeat_value; - GtkWidget *repeat_unit; - - /* Display alarm widgets */ - GtkWidget *dalarm_group; - GtkWidget *dalarm_description; - - /* Audio alarm widgets */ - GtkWidget *aalarm_group; - GtkWidget *aalarm_attach; - - /* FIXME: Mail alarm widgets */ - GtkWidget *malarm_group; - - /* Procedure alarm widgets */ - GtkWidget *palarm_group; - GtkWidget *palarm_program; - GtkWidget *palarm_args; -} Dialog; - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (Dialog *dialog) -{ -#define GW(name) glade_xml_get_widget (dialog->xml, name) - - dialog->toplevel = GW ("alarm-options-toplevel"); - - dialog->button_ok = GW ("button-ok"); - dialog->button_cancel = GW ("button-cancel"); - - dialog->repeat_toggle = GW ("repeat-toggle"); - dialog->repeat_group = GW ("repeat-group"); - dialog->repeat_quantity = GW ("repeat-quantity"); - dialog->repeat_value = GW ("repeat-value"); - dialog->repeat_unit = GW ("repeat-unit"); - - dialog->dalarm_group = GW ("dalarm-group"); - dialog->dalarm_description = GW ("dalarm-description"); - - dialog->aalarm_group = GW ("aalarm-group"); - dialog->aalarm_attach = GW ("aalarm-attach"); - - dialog->malarm_group = GW ("malarm-group"); - - dialog->palarm_group = GW ("palarm-group"); - dialog->palarm_program = GW ("palarm-program"); - dialog->palarm_args = GW ("palarm-args"); - - return (dialog->toplevel - && dialog->button_ok - && dialog->button_cancel - && dialog->repeat_toggle - && dialog->repeat_group - && dialog->repeat_quantity - && dialog->repeat_value - && dialog->repeat_unit - && dialog->dalarm_group - && dialog->dalarm_description - && dialog->aalarm_group - && dialog->aalarm_attach - && dialog->malarm_group - && dialog->palarm_group - && dialog->palarm_program - && dialog->palarm_args); -} - -/* Closes the dialog by terminating its main loop */ -static void -close_dialog (Dialog *dialog, gboolean canceled) -{ - dialog->canceled = canceled; - gtk_main_quit (); -} - -/* Callback used when the toplevel window is deleted */ -static guint -toplevel_delete_event_cb (GtkWidget *widget, GdkEventAny *event, gpointer data) -{ - Dialog *dialog; - - dialog = data; - close_dialog (dialog, TRUE); - return TRUE; -} - -/* Callback used when the OK button is clicked */ -static void -button_ok_clicked_cb (GtkWidget *button, gpointer data) -{ - Dialog *dialog; - - dialog = data; - close_dialog (dialog, FALSE); -} - -/* Callback used when the Cancel button is clicked */ -static void -button_cancel_clicked_cb (GtkWidget *button, gpointer data) -{ - Dialog *dialog; - - dialog = data; - close_dialog (dialog, TRUE); -} - -/* Callback used when the repeat toggle button is toggled. We sensitize the - * repeat group options as appropriate. - */ -static void -repeat_toggle_toggled_cb (GtkToggleButton *toggle, gpointer data) -{ - Dialog *dialog; - gboolean active; - - dialog = data; - - active = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (dialog->repeat_group, active); -} - -/* Hooks the widget signals */ -static void -init_widgets (Dialog *dialog) -{ - /* Toplevel, buttons */ - - dialog->canceled = TRUE; - - gtk_signal_connect (GTK_OBJECT (dialog->toplevel), "delete_event", - GTK_SIGNAL_FUNC (toplevel_delete_event_cb), dialog); - - gtk_signal_connect (GTK_OBJECT (dialog->button_ok), "clicked", - GTK_SIGNAL_FUNC (button_ok_clicked_cb), dialog); - - gtk_signal_connect (GTK_OBJECT (dialog->button_cancel), "clicked", - GTK_SIGNAL_FUNC (button_cancel_clicked_cb), dialog); - - /* Alarm repeat */ - - gtk_signal_connect (GTK_OBJECT (dialog->repeat_toggle), "toggled", - GTK_SIGNAL_FUNC (repeat_toggle_toggled_cb), dialog); -} - -/* Fills the audio alarm widgets with the values from the alarm component */ -static void -alarm_to_aalarm_widgets (Dialog *dialog, CalComponentAlarm *alarm) -{ - icalattach *attach; - const char *url; - - cal_component_alarm_get_attach (alarm, &attach); - - if (!attach) { - e_dialog_editable_set (dialog->aalarm_attach, NULL); - return; - } - - /* FIXME: this does not support inline data */ - - url = NULL; - - if (icalattach_get_is_url (attach)) - url = icalattach_get_url (attach); - else - g_message ("alarm_to_aalarm_widgets(): FIXME: we don't support inline data yet"); - - e_dialog_editable_set (dialog->aalarm_attach, url); - - icalattach_unref (attach); -} - -/* Fills the display alarm widgets with the values from the alarm component */ -static void -alarm_to_dalarm_widgets (Dialog *dialog, CalComponentAlarm *alarm) -{ - CalComponentText description; - - cal_component_alarm_get_description (alarm, &description); - - e_dialog_editable_set (dialog->dalarm_description, description.value); -} - -/* Fills the mail alarm widgets with the values from the alarm component */ -static void -alarm_to_malarm_widgets (Dialog *dialog, CalComponentAlarm *alarm) -{ - /* FIXME: nothing for now; we don't support mail alarms */ -} - -/* Fills the procedure alarm widgets with the values from the alarm component */ -static void -alarm_to_palarm_widgets (Dialog *dialog, CalComponentAlarm *alarm) -{ - icalattach *attach; - CalComponentText description; - - cal_component_alarm_get_attach (alarm, &attach); - cal_component_alarm_get_description (alarm, &description); - - if (attach) { - const char *url; - - if (icalattach_get_is_url (attach)) { - url = icalattach_get_url (attach); - e_dialog_editable_set (dialog->palarm_program, url); - } else - g_message ("alarm_to_palarm_widgets(): Don't know what to do with non-URL " - "attachments"); - - icalattach_unref (attach); - } - - e_dialog_editable_set (dialog->palarm_args, description.value); -} - -enum duration_units { - DUR_MINUTES, - DUR_HOURS, - DUR_DAYS -}; - -static const int duration_units_map[] = { - DUR_MINUTES, - DUR_HOURS, - DUR_DAYS, - -1 -}; - -/* Sigh. Takes an overcomplicated duration value and reduces it to its lowest - * common denominator. - */ -static void -normalize_duration (struct icaldurationtype dur, int *value, enum duration_units *units) -{ - if (dur.seconds != 0 || dur.minutes != 0) { - *value = ((((dur.weeks * 7 + dur.days) * 24 + dur.hours) * 60) + dur.minutes - + dur.seconds / 60 + ((dur.seconds % 60) >= 30 ? 1 : 0)); - *units = DUR_MINUTES; - } else if (dur.hours) { - *value = ((dur.weeks * 7) + dur.days) * 24 + dur.hours; - *units = DUR_HOURS; - } else if (dur.days != 0 || dur.weeks != 0) { - *value = dur.weeks * 7 + dur.days; - *units = DUR_DAYS; - } else { - *value = 0; - *units = DUR_MINUTES; - } -} - -/* Fills the repeat widgets with the values from the alarm component */ -static void -alarm_to_repeat_widgets (Dialog *dialog, CalComponentAlarm *alarm) -{ - CalAlarmRepeat repeat; - int value; - enum duration_units units; - - cal_component_alarm_get_repeat (alarm, &repeat); - - /* Sensitivity */ - - if (repeat.repetitions == 0) { - gtk_widget_set_sensitive (dialog->repeat_group, FALSE); - e_dialog_toggle_set (dialog->repeat_toggle, FALSE); - return; - } - - gtk_widget_set_sensitive (dialog->repeat_group, TRUE); - e_dialog_toggle_set (dialog->repeat_toggle, TRUE); - - /* Repetitions */ - e_dialog_spin_set (dialog->repeat_quantity, repeat.repetitions); - - /* Duration */ - - normalize_duration (repeat.duration, &value, &units); - - e_dialog_spin_set (dialog->repeat_value, value); - e_dialog_option_menu_set (dialog->repeat_unit, units, duration_units_map); -} - -/* Fills the widgets with the values from the alarm component */ -static void -alarm_to_dialog (Dialog *dialog, CalComponentAlarm *alarm) -{ - CalAlarmAction action; - - alarm_to_repeat_widgets (dialog, alarm); - - cal_component_alarm_get_action (alarm, &action); - - switch (action) { - case CAL_ALARM_NONE: - g_assert_not_reached (); - return; - - case CAL_ALARM_AUDIO: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Audio Alarm Options")); - gtk_widget_show (dialog->aalarm_group); - gtk_widget_hide (dialog->dalarm_group); - gtk_widget_hide (dialog->malarm_group); - gtk_widget_hide (dialog->palarm_group); - alarm_to_aalarm_widgets (dialog, alarm); - break; - - case CAL_ALARM_DISPLAY: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Message Alarm Options")); - gtk_widget_hide (dialog->aalarm_group); - gtk_widget_show (dialog->dalarm_group); - gtk_widget_hide (dialog->malarm_group); - gtk_widget_hide (dialog->palarm_group); - alarm_to_dalarm_widgets (dialog, alarm); - break; - - case CAL_ALARM_EMAIL: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Mail Alarm Options")); - gtk_widget_hide (dialog->aalarm_group); - gtk_widget_hide (dialog->dalarm_group); - gtk_widget_show (dialog->malarm_group); - gtk_widget_hide (dialog->palarm_group); - alarm_to_malarm_widgets (dialog, alarm); - break; - - case CAL_ALARM_PROCEDURE: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Program Alarm Options")); - gtk_widget_hide (dialog->aalarm_group); - gtk_widget_hide (dialog->dalarm_group); - gtk_widget_hide (dialog->malarm_group); - gtk_widget_show (dialog->palarm_group); - alarm_to_palarm_widgets (dialog, alarm); - break; - - case CAL_ALARM_UNKNOWN: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Unknown Alarm Options")); - break; - - default: - g_assert_not_reached (); - return; - } -} - - - -/* Fills the alarm data with the values from the repeat/duration widgets */ -static void -repeat_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) -{ - CalAlarmRepeat repeat; - - if (!e_dialog_toggle_get (dialog->repeat_toggle)) { - repeat.repetitions = 0; - - cal_component_alarm_set_repeat (alarm, repeat); - return; - } - - repeat.repetitions = e_dialog_spin_get_int (dialog->repeat_quantity); - - memset (&repeat.duration, 0, sizeof (repeat.duration)); - switch (e_dialog_option_menu_get (dialog->repeat_unit, duration_units_map)) { - case DUR_MINUTES: - repeat.duration.minutes = e_dialog_spin_get_int (dialog->repeat_value); - break; - - case DUR_HOURS: - repeat.duration.hours = e_dialog_spin_get_int (dialog->repeat_value); - break; - - case DUR_DAYS: - repeat.duration.days = e_dialog_spin_get_int (dialog->repeat_value); - break; - - default: - g_assert_not_reached (); - } - - cal_component_alarm_set_repeat (alarm, repeat); - -} - -/* Fills the audio alarm data with the values from the widgets */ -static void -aalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) -{ - char *url; - icalattach *attach; - - url = e_dialog_editable_get (dialog->aalarm_attach); - attach = icalattach_new_from_url (url ? url : ""); - g_free (url); - - cal_component_alarm_set_attach (alarm, attach); - icalattach_unref (attach); -} - -/* Fills the display alarm data with the values from the widgets */ -static void -dalarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) -{ - char *str; - CalComponentText description; - - str = e_dialog_editable_get (dialog->dalarm_description); - description.value = str; - description.altrep = NULL; - - cal_component_alarm_set_description (alarm, &description); - g_free (str); -} - -/* Fills the mail alarm data with the values from the widgets */ -static void -malarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) -{ - /* FIXME: nothing for now; we don't support mail alarms */ -} - -/* Fills the procedure alarm data with the values from the widgets */ -static void -palarm_widgets_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) -{ - char *program; - icalattach *attach; - char *str; - CalComponentText description; - - program = e_dialog_editable_get (dialog->palarm_program); - attach = icalattach_new_from_url (program ? program : ""); - g_free (program); - - cal_component_alarm_set_attach (alarm, attach); - icalattach_unref (attach); - - str = e_dialog_editable_get (dialog->palarm_args); - description.value = str; - description.altrep = NULL; - - cal_component_alarm_set_description (alarm, &description); - g_free (str); -} - -/* Fills the alarm data with the values from the widgets */ -static void -dialog_to_alarm (Dialog *dialog, CalComponentAlarm *alarm) -{ - CalAlarmAction action; - - repeat_widgets_to_alarm (dialog, alarm); - - cal_component_alarm_get_action (alarm, &action); - - switch (action) { - case CAL_ALARM_NONE: - g_assert_not_reached (); - break; - - case CAL_ALARM_AUDIO: - aalarm_widgets_to_alarm (dialog, alarm); - break; - - case CAL_ALARM_DISPLAY: - dalarm_widgets_to_alarm (dialog, alarm); - break; - - case CAL_ALARM_EMAIL: - malarm_widgets_to_alarm (dialog, alarm); - break; - - case CAL_ALARM_PROCEDURE: - palarm_widgets_to_alarm (dialog, alarm); - break; - - case CAL_ALARM_UNKNOWN: - break; - - default: - g_assert_not_reached (); - } -} - - - -/** - * alarm_options_dialog_run: - * @alarm: Alarm that is to be edited. - * - * Runs an alarm options dialog modally. - * - * Return value: TRUE if the dialog could be created, FALSE otherwise. - **/ -gboolean -alarm_options_dialog_run (CalComponentAlarm *alarm) -{ - Dialog dialog; - - g_return_val_if_fail (alarm != NULL, FALSE); - - dialog.xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-options.glade", NULL); - if (!dialog.xml) { - g_message ("alarm_options_dialog_new(): Could not load the Glade XML file!"); - return FALSE; - } - - if (!get_widgets (&dialog)) { - gtk_object_unref (GTK_OBJECT (dialog.xml)); - return FALSE; - } - - init_widgets (&dialog); - - alarm_to_dialog (&dialog, alarm); - - gtk_widget_show (dialog.toplevel); - gtk_main (); - - if (!dialog.canceled) - dialog_to_alarm (&dialog, alarm); - - gtk_widget_destroy (dialog.toplevel); - gtk_object_unref (GTK_OBJECT (dialog.xml)); - - return TRUE; -} diff --git a/calendar/gui/dialogs/alarm-options.glade b/calendar/gui/dialogs/alarm-options.glade deleted file mode 100644 index 02c5d3f953..0000000000 --- a/calendar/gui/dialogs/alarm-options.glade +++ /dev/null @@ -1,398 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Dialogs</name> - <program_name>dialogs</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>alarm-options-toplevel</name> - <title></title> - <type>GTK_WINDOW_DIALOG</type> - <position>GTK_WIN_POS_NONE</position> - <modal>True</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>True</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>vbox1</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkFrame</class> - <name>frame1</name> - <label>Alarm Repeat</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox1</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkCheckButton</class> - <name>repeat-toggle</name> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <label>Repeat the alarm</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>repeat-group</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkSpinButton</class> - <name>repeat-quantity</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>1</value> - <lower>0</lower> - <upper>999</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>extra times every</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>repeat-value</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>1</value> - <lower>0</lower> - <upper>999</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>repeat-unit</name> - <can_focus>True</can_focus> - <items>minutes -hours -days -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>dalarm-group</name> - <visible>False</visible> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label2</name> - <label>Message to Display</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkText</class> - <name>dalarm-description</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>aalarm-group</name> - <visible>False</visible> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label3</name> - <label>Play sound:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GnomeFileEntry</class> - <name>file-entry1</name> - <max_saved>10</max_saved> - <directory>False</directory> - <modal>False</modal> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GnomeEntry:entry</child_name> - <name>aalarm-attach</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>malarm-group</name> - <visible>False</visible> - <label>This is an email reminder, but Evolution does not yet support this kind of reminders. You will not be able to edit the options for this reminder.</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>True</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>palarm-group</name> - <visible>False</visible> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>Run program:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>palarm-program</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label6</name> - <label>With these arguments:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>palarm-args</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHButtonBox</class> - <name>hbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>30</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-ok</name> - <can_default>True</can_default> - <has_default>True</has_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-cancel</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - <relief>GTK_RELIEF_NORMAL</relief> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/alarm-options.h b/calendar/gui/dialogs/alarm-options.h deleted file mode 100644 index 388b737541..0000000000 --- a/calendar/gui/dialogs/alarm-options.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Evolution calendar - Alarm options dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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_OPTIONS_H -#define ALARM_OPTIONS_H - -#include <cal-util/cal-component.h> - -gboolean alarm_options_dialog_run (CalComponentAlarm *alarm); - -#endif diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c deleted file mode 100644 index c06e975ed7..0000000000 --- a/calendar/gui/dialogs/alarm-page.c +++ /dev/null @@ -1,869 +0,0 @@ -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include "e-util/e-dialog-widgets.h" -#include "e-util/e-time-utils.h" -#include "cal-util/cal-util.h" -#include "cal-util/timeutil.h" -#include "../calendar-config.h" -#include "comp-editor-util.h" -#include "alarm-options.h" -#include "alarm-page.h" - - - -/* Private part of the AlarmPage structure */ -struct _AlarmPagePrivate { - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - - GtkWidget *main; - - GtkWidget *summary; - GtkWidget *date_time; - - GtkWidget *list; - GtkWidget *add; - GtkWidget *delete; - - GtkWidget *action; - GtkWidget *interval_value; - GtkWidget *value_units; - GtkWidget *relative; - GtkWidget *time; - - GtkWidget *button_options; - - /* Alarm options dialog and the alarm we maintain */ - CalComponentAlarm *alarm; - - gboolean updating; -}; - -/* "relative" types */ -enum { - BEFORE, - AFTER -}; - -/* Time units */ -enum { - MINUTES, - HOURS, - DAYS -}; - -/* Option menu maps */ -static const int action_map[] = { - CAL_ALARM_DISPLAY, - CAL_ALARM_AUDIO, - CAL_ALARM_PROCEDURE, - -1 -}; - -static const int value_map[] = { - MINUTES, - HOURS, - DAYS, - -1 -}; - -static const int relative_map[] = { - BEFORE, - AFTER, - -1 -}; - -static const int time_map[] = { - CAL_ALARM_TRIGGER_RELATIVE_START, - CAL_ALARM_TRIGGER_RELATIVE_END, - -1 -}; - - - -static void alarm_page_class_init (AlarmPageClass *class); -static void alarm_page_init (AlarmPage *apage); -static void alarm_page_destroy (GtkObject *object); - -static GtkWidget *alarm_page_get_widget (CompEditorPage *page); -static void alarm_page_focus_main_widget (CompEditorPage *page); -static void alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp); -static gboolean alarm_page_fill_component (CompEditorPage *page, CalComponent *comp); -static void alarm_page_set_summary (CompEditorPage *page, const char *summary); -static void alarm_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); - -static CompEditorPageClass *parent_class = NULL; - - - -/** - * alarm_page_get_type: - * - * Registers the #AlarmPage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #AlarmPage class. - **/ -GtkType -alarm_page_get_type (void) -{ - static GtkType alarm_page_type; - - if (!alarm_page_type) { - static const GtkTypeInfo alarm_page_info = { - "AlarmPage", - sizeof (AlarmPage), - sizeof (AlarmPageClass), - (GtkClassInitFunc) alarm_page_class_init, - (GtkObjectInitFunc) alarm_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - alarm_page_type = gtk_type_unique (TYPE_COMP_EDITOR_PAGE, - &alarm_page_info); - } - - return alarm_page_type; -} - -/* Class initialization function for the alarm page */ -static void -alarm_page_class_init (AlarmPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GtkObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); - - editor_page_class->get_widget = alarm_page_get_widget; - editor_page_class->focus_main_widget = alarm_page_focus_main_widget; - editor_page_class->fill_widgets = alarm_page_fill_widgets; - editor_page_class->fill_component = alarm_page_fill_component; - editor_page_class->set_summary = alarm_page_set_summary; - editor_page_class->set_dates = alarm_page_set_dates; - - object_class->destroy = alarm_page_destroy; -} - -/* Object initialization function for the alarm page */ -static void -alarm_page_init (AlarmPage *apage) -{ - AlarmPagePrivate *priv; - - priv = g_new0 (AlarmPagePrivate, 1); - apage->priv = priv; - - priv->xml = NULL; - - priv->main = NULL; - priv->summary = NULL; - priv->date_time = NULL; - priv->list = NULL; - priv->add = NULL; - priv->delete = NULL; - priv->action = NULL; - priv->interval_value = NULL; - priv->value_units = NULL; - priv->relative = NULL; - priv->time = NULL; - priv->button_options = NULL; - - priv->alarm = cal_component_alarm_new (); - - priv->updating = FALSE; -} - -/* Destroy handler for the alarm page */ -static void -alarm_page_destroy (GtkObject *object) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ALARM_PAGE (object)); - - apage = ALARM_PAGE (object); - priv = apage->priv; - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - if (priv->alarm) { - cal_component_alarm_free (priv->alarm); - priv->alarm = NULL; - } - - g_free (priv); - apage->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* get_widget handler for the alarm page */ -static GtkWidget * -alarm_page_get_widget (CompEditorPage *page) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - - apage = ALARM_PAGE (page); - priv = apage->priv; - - return priv->main; -} - -/* focus_main_widget handler for the alarm page */ -static void -alarm_page_focus_main_widget (CompEditorPage *page) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - - apage = ALARM_PAGE (page); - priv = apage->priv; - - gtk_widget_grab_focus (priv->action); -} - -/* Fills the widgets with default values */ -static void -clear_widgets (AlarmPage *apage) -{ - AlarmPagePrivate *priv; - - priv = apage->priv; - - /* Summary */ - gtk_label_set_text (GTK_LABEL (priv->summary), ""); - - /* Start date */ - gtk_label_set_text (GTK_LABEL (priv->date_time), ""); - - /* Sane defaults */ - e_dialog_option_menu_set (priv->action, CAL_ALARM_DISPLAY, action_map); - e_dialog_spin_set (priv->interval_value, 15); - e_dialog_option_menu_set (priv->value_units, MINUTES, value_map); - e_dialog_option_menu_set (priv->relative, BEFORE, relative_map); - e_dialog_option_menu_set (priv->time, CAL_ALARM_TRIGGER_RELATIVE_START, time_map); - - /* List data */ - gtk_clist_clear (GTK_CLIST (priv->list)); -} - -/* Builds a string for the duration of the alarm. If the duration is zero, returns NULL. */ -static char * -get_alarm_duration_string (struct icaldurationtype *duration) -{ - GString *string = g_string_new (NULL); - char *ret; - gboolean have_something; - - have_something = FALSE; - - if (duration->days > 1) { - g_string_sprintf (string, _("%d days"), duration->days); - have_something = TRUE; - } else if (duration->days == 1) { - g_string_append (string, _("1 day")); - have_something = TRUE; - } - - if (duration->weeks > 1) { - g_string_sprintf (string, _("%d weeks"), duration->weeks); - have_something = TRUE; - } else if (duration->weeks == 1) { - g_string_append (string, _("1 week")); - have_something = TRUE; - } - - if (duration->hours > 1) { - g_string_sprintf (string, _("%d hours"), duration->hours); - have_something = TRUE; - } else if (duration->hours == 1) { - g_string_append (string, _("1 hour")); - have_something = TRUE; - } - - if (duration->minutes > 1) { - g_string_sprintf (string, _("%d minutes"), duration->minutes); - have_something = TRUE; - } else if (duration->minutes == 1) { - g_string_append (string, _("1 minute")); - have_something = TRUE; - } - - if (duration->seconds > 1) { - g_string_sprintf (string, _("%d seconds"), duration->seconds); - have_something = TRUE; - } else if (duration->seconds == 1) { - g_string_append (string, _("1 second")); - have_something = TRUE; - } - - if (have_something) { - ret = string->str; - g_string_free (string, FALSE); - return ret; - } else { - g_string_free (string, TRUE); - return NULL; - } -} - -static char * -get_alarm_string (CalComponentAlarm *alarm) -{ - CalAlarmAction action; - CalAlarmTrigger trigger; - char string[256]; - char *base, *str = NULL, *dur; - - string [0] = '\0'; - - cal_component_alarm_get_action (alarm, &action); - cal_component_alarm_get_trigger (alarm, &trigger); - - switch (action) { - case CAL_ALARM_AUDIO: - base = _("Play a sound"); - break; - - case CAL_ALARM_DISPLAY: - base = _("Display a message"); - break; - - case CAL_ALARM_EMAIL: - base = _("Send an email"); - break; - - case CAL_ALARM_PROCEDURE: - base = _("Run a program"); - break; - - case CAL_ALARM_NONE: - case CAL_ALARM_UNKNOWN: - default: - base = _("Unknown action to be performed"); - break; - } - - /* FIXME: This does not look like it will localize correctly. */ - - switch (trigger.type) { - case CAL_ALARM_TRIGGER_RELATIVE_START: - dur = get_alarm_duration_string (&trigger.u.rel_duration); - - if (dur) { - if (trigger.u.rel_duration.is_neg) - str = g_strdup_printf (_("%s %s before the start of the appointment"), - base, dur); - else - str = g_strdup_printf (_("%s %s after the start of the appointment"), - base, dur); - - g_free (dur); - } else - str = g_strdup_printf (_("%s at the start of the appointment"), base); - - break; - - case CAL_ALARM_TRIGGER_RELATIVE_END: - dur = get_alarm_duration_string (&trigger.u.rel_duration); - - if (dur) { - if (trigger.u.rel_duration.is_neg) - str = g_strdup_printf (_("%s %s before the end of the appointment"), - base, dur); - else - str = g_strdup_printf (_("%s %s after the end of the appointment"), - base, dur); - - g_free (dur); - } else - str = g_strdup_printf (_("%s at the end of the appointment"), base); - - break; - - case CAL_ALARM_TRIGGER_ABSOLUTE: { - struct icaltimetype itt; - icaltimezone *utc_zone, *current_zone; - char *location; - struct tm tm; - char buf[256]; - - /* Absolute triggers come in UTC, so convert them to the local timezone */ - - itt = trigger.u.abs_time; - - utc_zone = icaltimezone_get_utc_timezone (); - location = calendar_config_get_timezone (); - current_zone = icaltimezone_get_builtin_timezone (location); - - tm = icaltimetype_to_tm_with_zone (&itt, utc_zone, current_zone); - - e_time_format_date_and_time (&tm, calendar_config_get_24_hour_format (), - FALSE, FALSE, buf, sizeof (buf)); - - str = g_strdup_printf (_("%s at %s"), base, buf); - - break; } - - case CAL_ALARM_TRIGGER_NONE: - default: - str = g_strdup_printf (_("%s for an unknown trigger type"), base); - break; - } - - return str; -} - -/* Appends an alarm to the list */ -static void -append_reminder (AlarmPage *apage, CalComponentAlarm *alarm) -{ - AlarmPagePrivate *priv; - GtkCList *clist; - char *c[1]; - int i; - - priv = apage->priv; - - clist = GTK_CLIST (priv->list); - - c[0] = get_alarm_string (alarm); - i = gtk_clist_append (clist, c); - - gtk_clist_set_row_data_full (clist, i, alarm, (GtkDestroyNotify) cal_component_alarm_free); - gtk_clist_select_row (clist, i, 0); - g_free (c[0]); - - gtk_widget_set_sensitive (priv->delete, TRUE); -} - -/* fill_widgets handler for the alarm page */ -static void -alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - CalComponentText text; - GList *alarms, *l; - GtkCList *clist; - CompEditorPageDates dates; - - apage = ALARM_PAGE (page); - priv = apage->priv; - - /* Don't send off changes during this time */ - priv->updating = TRUE; - - /* Clean the page */ - clear_widgets (apage); - - /* Summary */ - cal_component_get_summary (comp, &text); - alarm_page_set_summary (page, text.value); - - /* Dates */ - comp_editor_dates (&dates, comp); - alarm_page_set_dates (page, &dates); - comp_editor_free_dates (&dates); - - /* List */ - if (!cal_component_has_alarms (comp)) - goto out; - - alarms = cal_component_get_alarm_uids (comp); - - clist = GTK_CLIST (priv->list); - for (l = alarms; l != NULL; l = l->next) { - CalComponentAlarm *ca, *ca_copy; - const char *auid; - - auid = l->data; - ca = cal_component_get_alarm (comp, auid); - g_assert (ca != NULL); - - ca_copy = cal_component_alarm_clone (ca); - cal_component_alarm_free (ca); - - append_reminder (apage, ca_copy); - } - cal_obj_uid_list_free (alarms); - - out: - - priv->updating = FALSE; -} - -/* fill_component handler for the alarm page */ -static gboolean -alarm_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - GList *list, *l; - GtkCList *clist; - int i; - - apage = ALARM_PAGE (page); - priv = apage->priv; - - /* Remove all the alarms from the component */ - - list = cal_component_get_alarm_uids (comp); - for (l = list; l; l = l->next) { - const char *auid; - - auid = l->data; - cal_component_remove_alarm (comp, auid); - } - cal_obj_uid_list_free (list); - - /* Add the new alarms */ - - clist = GTK_CLIST (priv->list); - for (i = 0; i < clist->rows; i++) { - CalComponentAlarm *alarm, *alarm_copy; - - alarm = gtk_clist_get_row_data (clist, i); - g_assert (alarm != NULL); - - /* We clone the alarm to maintain the invariant that the alarm - * structures in the list did *not* come from the component. - */ - - alarm_copy = cal_component_alarm_clone (alarm); - cal_component_add_alarm (comp, alarm_copy); - cal_component_alarm_free (alarm_copy); - } - - return TRUE; -} - -/* set_summary handler for the alarm page */ -static void -alarm_page_set_summary (CompEditorPage *page, const char *summary) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - gchar *s; - - apage = ALARM_PAGE (page); - priv = apage->priv; - - s = e_utf8_to_gtk_string (priv->summary, summary); - gtk_label_set_text (GTK_LABEL (priv->summary), s); - g_free (s); -} - -/* set_dates handler for the alarm page */ -static void -alarm_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - - apage = ALARM_PAGE (page); - priv = apage->priv; - - comp_editor_date_label (dates, priv->date_time); -} - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (AlarmPage *apage) -{ - CompEditorPage *page = COMP_EDITOR_PAGE (apage); - AlarmPagePrivate *priv; - GSList *accel_groups; - GtkWidget *toplevel; - - priv = apage->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->main = GW ("alarm-page"); - if (!priv->main) - return FALSE; - - /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ - toplevel = gtk_widget_get_toplevel (priv->main); - accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_widget_unparent (priv->main); - - priv->summary = GW ("summary"); - priv->date_time = GW ("date-time"); - - priv->list = GW ("list"); - priv->add = GW ("add"); - priv->delete = GW ("delete"); - - priv->action = GW ("action"); - priv->interval_value = GW ("interval-value"); - priv->value_units = GW ("value-units"); - priv->relative = GW ("relative"); - priv->time = GW ("time"); - - priv->button_options = GW ("button-options"); - -#undef GW - - return (priv->summary - && priv->date_time - && priv->list - && priv->add - && priv->delete - && priv->action - && priv->interval_value - && priv->value_units - && priv->relative - && priv->time - && priv->button_options); -} - -/* This is called when any field is changed; it notifies upstream. */ -static void -field_changed_cb (GtkWidget *widget, gpointer data) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - - apage = ALARM_PAGE (data); - priv = apage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (apage)); -} - -/* Callback used for the "add reminder" button */ -static void -add_clicked_cb (GtkButton *button, gpointer data) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - CalComponentAlarm *alarm; - CalAlarmTrigger trigger; - - apage = ALARM_PAGE (data); - priv = apage->priv; - - alarm = cal_component_alarm_clone (priv->alarm); - - memset (&trigger, 0, sizeof (CalAlarmTrigger)); - trigger.type = e_dialog_option_menu_get (priv->time, time_map); - if (e_dialog_option_menu_get (priv->relative, relative_map) == BEFORE) - trigger.u.rel_duration.is_neg = 1; - else - trigger.u.rel_duration.is_neg = 0; - - switch (e_dialog_option_menu_get (priv->value_units, value_map)) { - case MINUTES: - trigger.u.rel_duration.minutes = - e_dialog_spin_get_int (priv->interval_value); - break; - - case HOURS: - trigger.u.rel_duration.hours = - e_dialog_spin_get_int (priv->interval_value); - break; - - case DAYS: - trigger.u.rel_duration.days = - e_dialog_spin_get_int (priv->interval_value); - break; - - default: - g_assert_not_reached (); - } - cal_component_alarm_set_trigger (alarm, trigger); - - cal_component_alarm_set_action (alarm, e_dialog_option_menu_get (priv->action, action_map)); - - append_reminder (apage, alarm); -} - -/* Callback used for the "delete reminder" button */ -static void -delete_clicked_cb (GtkButton *button, gpointer data) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - GtkCList *clist; - int sel; - - apage = ALARM_PAGE (data); - priv = apage->priv; - - clist = GTK_CLIST (priv->list); - if (!clist->selection) - return; - - sel = GPOINTER_TO_INT (clist->selection->data); - - gtk_clist_remove (clist, sel); - if (sel >= clist->rows) - sel--; - - if (clist->rows > 0) - gtk_clist_select_row (clist, sel, 0); - else - gtk_widget_set_sensitive (priv->delete, FALSE); -} - -/* Callback used when the alarm options button is clicked */ -static void -button_options_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmPage *apage; - AlarmPagePrivate *priv; - - apage = ALARM_PAGE (data); - priv = apage->priv; - - cal_component_alarm_set_action (priv->alarm, - e_dialog_option_menu_get (priv->action, action_map)); - - if (!alarm_options_dialog_run (priv->alarm)) - g_message ("button_options_clicked_cb(): Could not create the alarm options dialog"); -} - -/* Hooks the widget signals */ -static void -init_widgets (AlarmPage *apage) -{ - AlarmPagePrivate *priv; - - priv = apage->priv; - - /* Reminder buttons */ - gtk_signal_connect (GTK_OBJECT (priv->add), "clicked", - GTK_SIGNAL_FUNC (add_clicked_cb), apage); - gtk_signal_connect (GTK_OBJECT (priv->delete), "clicked", - GTK_SIGNAL_FUNC (delete_clicked_cb), apage); - - /* Connect the default signal handler to use to make sure we notify - * upstream of changes to the widget values. - */ - gtk_signal_connect (GTK_OBJECT (priv->add), "clicked", - GTK_SIGNAL_FUNC (field_changed_cb), apage); - gtk_signal_connect (GTK_OBJECT (priv->delete), "clicked", - GTK_SIGNAL_FUNC (field_changed_cb), apage); - - /* Options button */ - gtk_signal_connect (GTK_OBJECT (priv->button_options), "clicked", - GTK_SIGNAL_FUNC (button_options_clicked_cb), apage); -} - - - -/** - * alarm_page_construct: - * @apage: An alarm page. - * - * Constructs an alarm page by loading its Glade data. - * - * Return value: The same object as @apage, or NULL if the widgets could not be - * created. - **/ -AlarmPage * -alarm_page_construct (AlarmPage *apage) -{ - AlarmPagePrivate *priv; - - priv = apage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-page.glade", - NULL); - if (!priv->xml) { - g_message ("alarm_page_construct(): " - "Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (apage)) { - g_message ("alarm_page_construct(): " - "Could not find all widgets in the XML file!"); - return NULL; - } - - init_widgets (apage); - - return apage; -} - -/** - * alarm_page_new: - * - * Creates a new alarm page. - * - * Return value: A newly-created alarm page, or NULL if the page could not be - * created. - **/ -AlarmPage * -alarm_page_new (void) -{ - AlarmPage *apage; - - apage = gtk_type_new (TYPE_ALARM_PAGE); - if (!alarm_page_construct (apage)) { - gtk_object_unref (GTK_OBJECT (apage)); - return NULL; - } - - return apage; -} diff --git a/calendar/gui/dialogs/alarm-page.glade b/calendar/gui/dialogs/alarm-page.glade deleted file mode 100644 index 56c6f6ada1..0000000000 --- a/calendar/gui/dialogs/alarm-page.glade +++ /dev/null @@ -1,381 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>alarm-page</name> - <program_name>alarm-page</program_name> - <directory></directory> - <source_directory>.</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> -</project> - -<widget> - <class>GtkWindow</class> - <name>alarm-toplevel</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>alarm-page</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkFrame</class> - <name>frame33</name> - <label>Basics</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table13</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>2</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label62</name> - <label>Summary:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label63</name> - <label>Date/Time:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>summary</name> - <width>10</width> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>date-time</name> - <width>10</width> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame34</name> - <label>Reminders</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox53</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox54</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkOptionMenu</class> - <name>action</name> - <can_focus>True</can_focus> - <items>Display a message -Play a sound -Run a program -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>interval-value</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>True</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>1</value> - <lower>0</lower> - <upper>999</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>value-units</name> - <can_focus>True</can_focus> - <items>minute(s) -hour(s) -day(s) -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>relative</name> - <can_focus>True</can_focus> - <items>before -after -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>time</name> - <can_focus>True</can_focus> - <items>start of appointment -end of appointment -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-options</name> - <can_focus>True</can_focus> - <label>_Options...</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox55</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow13</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCList</class> - <name>list</name> - <can_focus>True</can_focus> - <columns>1</columns> - <column_widths>80</column_widths> - <selection_mode>GTK_SELECTION_BROWSE</selection_mode> - <show_titles>False</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label64</name> - <label>label55</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVButtonBox</class> - <name>vbuttonbox2</name> - <layout_style>GTK_BUTTONBOX_START</layout_style> - <spacing>10</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>add</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Add</label> - </widget> - - <widget> - <class>GtkButton</class> - <name>delete</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <label>_Delete</label> - </widget> - </widget> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/alarm-page.h b/calendar/gui/dialogs/alarm-page.h deleted file mode 100644 index aa1a6be26b..0000000000 --- a/calendar/gui/dialogs/alarm-page.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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_PAGE_H -#define ALARM_PAGE_H - -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_ALARM_PAGE (alarm_page_get_type ()) -#define ALARM_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_ALARM_PAGE, AlarmPage)) -#define ALARM_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_ALARM_PAGE, AlarmPageClass)) -#define IS_ALARM_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_ALARM_PAGE)) -#define IS_ALARM_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_ALARM_PAGE)) - -typedef struct _AlarmPagePrivate AlarmPagePrivate; - -typedef struct { - CompEditorPage page; - - /* Private data */ - AlarmPagePrivate *priv; -} AlarmPage; - -typedef struct { - CompEditorPageClass parent_class; -} AlarmPageClass; - - -GtkType alarm_page_get_type (void); -AlarmPage *alarm_page_construct (AlarmPage *apage); -AlarmPage *alarm_page_new (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c deleted file mode 100644 index fc8d7b0c91..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ /dev/null @@ -1,686 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin <damon@ximian.com> - * - * Copyright 2000, Ximian, Inc. - * Copyright 2000, Ximian, Inc. - * - * 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. - * - * 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 <config.h> -#include <libgnomeui/gnome-color-picker.h> -#include <glade/glade.h> -#include <gal/util/e-util.h> -#include <e-util/e-dialog-widgets.h> -#include <widgets/misc/e-dateedit.h> -#include "../e-timezone-entry.h" -#include "cal-prefs-dialog.h" -#include "../calendar-config.h" -#include "../calendar-commands.h" -#include "../e-tasks.h" - - -struct _CalPrefsDialogPrivate { - /* Glade XML data */ - GladeXML *xml; - - GtkWidget *dialog; - - GtkWidget *toplevel_notebook; - - GtkWidget *timezone; - 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; - - /* Widgets for the task list options */ - GtkWidget *tasks_due_today_color; - GtkWidget *tasks_overdue_color; - - GtkWidget *tasks_hide_completed_checkbutton; - GtkWidget *tasks_hide_completed_spinbutton; - GtkWidget *tasks_hide_completed_optionmenu; - - /* Other page options */ - GtkWidget *confirm_delete; - GtkWidget *default_reminder; - GtkWidget *default_reminder_interval; - GtkWidget *default_reminder_units; -}; - -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 -}; - -/* The following two are kept separate in case we need to re-order each menu individually */ -static const int hide_completed_units_map[] = { - CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1 -}; - -static const int default_reminder_units_map[] = { - CAL_MINUTES, CAL_HOURS, CAL_DAYS, -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_hide_completed_tasks_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: - * @page: Page to show when the dialog is popped up. - * - * Creates a new #CalPrefsDialog. - * - * Return value: a new #CalPrefsDialog. - **/ -CalPrefsDialog * -cal_prefs_dialog_new (CalPrefsDialogPage page) -{ - CalPrefsDialog *prefs; - - prefs = CAL_PREFS_DIALOG (gtk_type_new (cal_prefs_dialog_get_type ())); - return cal_prefs_dialog_construct (prefs, page); -} - - -/** - * cal_prefs_dialog_construct: - * @prefs: A #CalPrefsDialog. - * @page: Page to show when the dialog is popped up. - * - * 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, CalPrefsDialogPage page) -{ - 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); - - cal_prefs_dialog_show (prefs, page); - - 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"); - - priv->toplevel_notebook = GW ("toplevel-notebook"); - - /* The indices must be 0 (Sun) to 6 (Sat). */ - 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->timezone = GW ("timezone"); - 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"); - - priv->tasks_due_today_color = GW ("tasks_due_today_color"); - priv->tasks_overdue_color = GW ("tasks_overdue_color"); - - priv->tasks_hide_completed_checkbutton = GW ("tasks-hide-completed-checkbutton"); - priv->tasks_hide_completed_spinbutton = GW ("tasks-hide-completed-spinbutton"); - priv->tasks_hide_completed_optionmenu = GW ("tasks-hide-completed-optionmenu"); - - priv->confirm_delete = GW ("confirm-delete"); - priv->default_reminder = GW ("default-reminder"); - priv->default_reminder_interval = GW ("default-reminder-interval"); - priv->default_reminder_units = GW ("default-reminder-units"); - -#undef GW - - return (priv->dialog - && priv->toplevel_notebook - && priv->timezone - && 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 - && priv->tasks_due_today_color - && priv->tasks_overdue_color - && priv->tasks_hide_completed_checkbutton - && priv->tasks_hide_completed_spinbutton - && priv->tasks_hide_completed_optionmenu - && priv->confirm_delete - && priv->default_reminder - && priv->default_reminder_interval - && priv->default_reminder_units); -} - - -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, CalPrefsDialogPage page) -{ - CalPrefsDialogPrivate *priv; - int page_num; - - 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); - } - - switch (page) { - case CAL_PREFS_DIALOG_PAGE_CALENDAR: - page_num = 0; - break; - - case CAL_PREFS_DIALOG_PAGE_TASKS: - page_num = 2; - break; - - default: - g_assert_not_reached (); - return; - } - - gtk_notebook_set_page (GTK_NOTEBOOK (priv->toplevel_notebook), page_num); -} - - -/* 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); - - gtk_signal_connect (GTK_OBJECT (priv->tasks_hide_completed_checkbutton), - "toggled", - GTK_SIGNAL_FUNC (cal_prefs_dialog_hide_completed_tasks_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); - - /* FIXME: Handle button 3 (Help). */ - -} - - -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); -} - -static void -cal_prefs_dialog_hide_completed_tasks_toggled (GtkWidget *button, - CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - gboolean hide_completed_tasks; - - priv = prefs->priv; - - hide_completed_tasks = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->tasks_hide_completed_checkbutton)); - - gtk_widget_set_sensitive (priv->tasks_hide_completed_spinbutton, - hide_completed_tasks); - gtk_widget_set_sensitive (priv->tasks_hide_completed_optionmenu, - hide_completed_tasks); -} - -/* Sets the color in a color picker from an X color spec */ -static void -set_color_picker (GtkWidget *picker, const char *spec) -{ - GdkColor color; - - g_assert (spec != NULL); - - if (!gdk_color_parse (spec, &color)) { - color.red = color.green = color.blue = 0; - return; - } - - gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (picker), - color.red, - color.green, - color.blue, - 65535); -} - -/* Shows the current task list settings in the dialog */ -static void -show_task_list_config (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - CalUnits units; - gboolean hide_completed_tasks; - - priv = prefs->priv; - - set_color_picker (priv->tasks_due_today_color, calendar_config_get_tasks_due_today_color ()); - set_color_picker (priv->tasks_overdue_color, calendar_config_get_tasks_overdue_color ()); - - /* Hide Completed Tasks. */ - hide_completed_tasks = calendar_config_get_hide_completed_tasks (); - e_dialog_toggle_set (priv->tasks_hide_completed_checkbutton, - hide_completed_tasks); - - /* Hide Completed Tasks Units. */ - units = calendar_config_get_hide_completed_tasks_units (); - e_dialog_option_menu_set (priv->tasks_hide_completed_optionmenu, - units, hide_completed_units_map); - - /* Hide Completed Tasks Value. */ - e_dialog_spin_set (priv->tasks_hide_completed_spinbutton, - calendar_config_get_hide_completed_tasks_value ()); - - gtk_widget_set_sensitive (priv->tasks_hide_completed_spinbutton, - hide_completed_tasks); - gtk_widget_set_sensitive (priv->tasks_hide_completed_optionmenu, - hide_completed_tasks); -} - -/* 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; - char *zone_name; - icaltimezone *zone; - gboolean sensitive; - - priv = prefs->priv; - - /* Timezone. */ - zone_name = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (zone_name); - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->timezone), - zone); - - /* Working Days. */ - working_days = calendar_config_get_working_days (); - mask = 1 << 0; - for (day = 0; day < 7; day++) { - e_dialog_toggle_set (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 ()) - e_dialog_toggle_set (priv->use_24_hour, TRUE); - else - e_dialog_toggle_set (priv->use_12_hour, TRUE); - - sensitive = calendar_config_locale_supports_12_hour_format (); - gtk_widget_set_sensitive (priv->use_12_hour, sensitive); - gtk_widget_set_sensitive (priv->use_24_hour, sensitive); - - - /* 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. */ - e_dialog_toggle_set (priv->show_end_times, calendar_config_get_show_event_end ()); - - /* Compress Weekend. */ - e_dialog_toggle_set (priv->compress_weekend, calendar_config_get_compress_weekend ()); - - /* Date Navigator - Show Week Numbers. */ - e_dialog_toggle_set (priv->dnav_show_week_no, calendar_config_get_dnav_show_week_no ()); - - /* Task list */ - - show_task_list_config (prefs); - - /* Other page */ - - e_dialog_toggle_set (priv->confirm_delete, calendar_config_get_confirm_delete ()); - - e_dialog_toggle_set (priv->default_reminder, - calendar_config_get_use_default_reminder ()); - e_dialog_spin_set (priv->default_reminder_interval, - calendar_config_get_default_reminder_interval ()); - e_dialog_option_menu_set (priv->default_reminder_units, - calendar_config_get_default_reminder_units (), - default_reminder_units_map); -} - -/* Returns a pointer to a static string with an X color spec for the current - * value of a color picker. - */ -static const char * -spec_from_picker (GtkWidget *picker) -{ - static char spec[8]; - guint8 r, g, b; - - gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (picker), &r, &g, &b, NULL); - g_snprintf (spec, sizeof (spec), "#%02x%02x%02x", r, g, b); - - return spec; -} - -/* Updates the task list config values from the settings in the dialog */ -static void -update_task_list_config (CalPrefsDialog *prefs) -{ - CalPrefsDialogPrivate *priv; - - priv = prefs->priv; - - calendar_config_set_tasks_due_today_color (spec_from_picker (priv->tasks_due_today_color)); - calendar_config_set_tasks_overdue_color (spec_from_picker (priv->tasks_overdue_color)); - - calendar_config_set_hide_completed_tasks (e_dialog_toggle_get (priv->tasks_hide_completed_checkbutton)); - calendar_config_set_hide_completed_tasks_units (e_dialog_option_menu_get (priv->tasks_hide_completed_optionmenu, hide_completed_units_map)); - calendar_config_set_hide_completed_tasks_value (e_dialog_spin_get_int (priv->tasks_hide_completed_spinbutton)); -} - -/* 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; - icaltimezone *zone; - - priv = prefs->priv; - - /* Timezone. */ - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->timezone)); - calendar_config_set_timezone (icaltimezone_get_location (zone)); - - /* Working Days. */ - working_days = 0; - mask = 1 << 0; - for (day = 0; day < 7; day++) { - if (e_dialog_toggle_get (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. */ - 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); - - /* End of Day. */ - 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); - - /* 12/24 Hour Format. */ - calendar_config_set_24_hour_format (e_dialog_toggle_get (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 (e_dialog_toggle_get (priv->show_end_times)); - - /* Compress Weekend. */ - calendar_config_set_compress_weekend (e_dialog_toggle_get (priv->compress_weekend)); - - /* Date Navigator - Show Week Numbers. */ - calendar_config_set_dnav_show_week_no (e_dialog_toggle_get (priv->dnav_show_week_no)); - - /* Task list */ - update_task_list_config (prefs); - - /* Other page */ - - calendar_config_set_confirm_delete (e_dialog_toggle_get (priv->confirm_delete)); - - calendar_config_set_use_default_reminder (e_dialog_toggle_get (priv->default_reminder)); - - calendar_config_set_default_reminder_interval ( - e_dialog_spin_get_int (priv->default_reminder_interval)); - - calendar_config_set_default_reminder_units ( - e_dialog_option_menu_get (priv->default_reminder_units, default_reminder_units_map)); - - /* Done */ - - calendar_config_write (); - update_all_config_settings (); - e_tasks_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 6a14f50ec3..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ /dev/null @@ -1,976 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>preferences</name> - <program_name>preferences</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GnomeDialog</class> - <name>cal-prefs-dialog</name> - <title>Calendar and Tasks Settings</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>False</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>True</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>hbuttonbox1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button3</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button> - </widget> - </widget> - - <widget> - <class>GtkNotebook</class> - <name>toplevel-notebook</name> - <can_focus>True</can_focus> - <show_tabs>True</show_tabs> - <show_border>True</show_border> - <tab_pos>GTK_POS_TOP</tab_pos> - <scrollable>False</scrollable> - <tab_hborder>2</tab_hborder> - <tab_vborder>2</tab_vborder> - <popup_enable>False</popup_enable> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox10</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkFrame</class> - <name>frame12</name> - <label>Time</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table5</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label22</name> - <label>Time _zone:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>timezone</name> - <creation_function>make_timezone_entry</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Wed, 20 Jun 2001 02:22:46 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label20</name> - <label>Time format:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox10</name> - <homogeneous>True</homogeneous> - <spacing>4</spacing> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>use_12_hour</name> - <can_focus>True</can_focus> - <label>_12 hour (AM/PM)</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>time_format_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>use_24_hour</name> - <can_focus>True</can_focus> - <label>_24 hour</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>time_format_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame9</name> - <label>Work Week</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox9</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>3</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox8</name> - <homogeneous>True</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>mon_button</name> - <can_focus>True</can_focus> - <label>_Mon</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>tue_button</name> - <can_focus>True</can_focus> - <label>T_ue</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>wed_button</name> - <can_focus>True</can_focus> - <label>_Wed</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>thu_button</name> - <can_focus>True</can_focus> - <label>T_hu</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>fri_button</name> - <can_focus>True</can_focus> - <label>_Fri</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>sat_button</name> - <can_focus>True</can_focus> - <label>_Sat</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>sun_button</name> - <can_focus>True</can_focus> - <label>Su_n</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox9</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label16</name> - <label>First day of wee_k:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>first_day_of_week</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>first_day_of_week</name> - <can_focus>True</can_focus> - <items>Monday -Tuesday -Wednesday -Thursday -Friday -Saturday -Sunday -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox11</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label17</name> - <label>Sta_rt of day:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>start_of_day</name> - <creation_function>cal_prefs_dialog_create_time_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 10 Oct 2000 15:12:12 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label18</name> - <label>_End of day:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>end_of_day</name> - <creation_function>cal_prefs_dialog_create_time_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 10 Oct 2000 15:12:21 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label21</name> - <label>_General</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox8</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox12</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label25</name> - <label>Time di_visions:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>time_divisions</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>time_divisions</name> - <can_focus>True</can_focus> - <items>60 minutes -30 minutes -15 minutes -10 minutes -05 minutes -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>show_end_times</name> - <can_focus>True</can_focus> - <label>Show appointment _end times in week and month views</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>compress_weekend</name> - <can_focus>True</can_focus> - <label>_Compress weekends in month view</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>dnav_show_week_no</name> - <can_focus>True</can_focus> - <label>Show week _numbers in date navigator</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label7</name> - <label>_Display</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox3</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - - <widget> - <class>GtkTable</class> - <name>table6</name> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label23</name> - <label>Tas_ks due today:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>tasks_due_today_color</default_focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label24</name> - <label>O_verdue tasks:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>tasks_overdue_color</default_focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GnomeColorPicker</class> - <name>tasks_due_today_color</name> - <can_focus>True</can_focus> - <dither>True</dither> - <use_alpha>False</use_alpha> - <title>Color for tasks due today</title> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GnomeColorPicker</class> - <name>tasks_overdue_color</name> - <can_focus>True</can_focus> - <dither>True</dither> - <use_alpha>False</use_alpha> - <title>Color for overdue tasks</title> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox14</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>tasks-hide-completed-checkbutton</name> - <can_focus>True</can_focus> - <label>_Hide completed tasks after</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>tasks-hide-completed-spinbutton</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>0</value> - <lower>0</lower> - <upper>9999</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>tasks-hide-completed-optionmenu</name> - <can_focus>True</can_focus> - <items>Minutes -Hours -Days -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label11</name> - <label>_Task List</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox11</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkCheckButton</class> - <name>confirm-delete</name> - <can_focus>True</can_focus> - <label>_Ask for confirmation when deleting items</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>default-reminder</name> - <can_focus>True</can_focus> - <label>Create new appointments with a default _reminder</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox13</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkAlignment</class> - <name>alignment1</name> - <width>17</width> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>default-reminder-interval</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>0</value> - <lower>0</lower> - <upper>9999</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>default-reminder-units</name> - <can_focus>True</can_focus> - <items>Minutes -Hours -Days -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label27</name> - <label>before the start of the appointment</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label26</name> - <label>_Other</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h deleted file mode 100644 index 063341c18a..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin <damon@ximian.com> - * - * Copyright 2000, Ximian, Inc. - * Copyright 2000, Ximian, Inc. - * - * 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. - * - * 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 <gtk/gtkobject.h> -#include <libgnome/gnome-defs.h> - -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; - -typedef struct _CalPrefsDialogPrivate CalPrefsDialogPrivate; - -typedef enum { - CAL_PREFS_DIALOG_PAGE_CALENDAR, - CAL_PREFS_DIALOG_PAGE_TASKS -} CalPrefsDialogPage; - -struct _CalPrefsDialog -{ - GtkObject object; - - /*< private >*/ - CalPrefsDialogPrivate *priv; -}; - -struct _CalPrefsDialogClass -{ - GtkObjectClass parent_class; -}; - - -GtkType cal_prefs_dialog_get_type (void); -CalPrefsDialog* cal_prefs_dialog_construct (CalPrefsDialog *prefs, CalPrefsDialogPage page); -CalPrefsDialog* cal_prefs_dialog_new (CalPrefsDialogPage page); - -void cal_prefs_dialog_show (CalPrefsDialog *prefs, CalPrefsDialogPage page); - -END_GNOME_DECLS - -#endif /* _CAL_PREFS_DIALOG_H_ */ diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c deleted file mode 100644 index 92590cfa40..0000000000 --- a/calendar/gui/dialogs/cancel-comp.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-uidefs.h> -#include <gal/widgets/e-unicode.h> -#include "cancel-comp.h" - - - -/** - * cancel_component_dialog: - * - * Pops up a dialog box asking the user whether he wants to send a - * cancel and delete an iTip/iMip message - * - * Return value: TRUE if the user clicked Yes, FALSE otherwise. - **/ -gboolean -cancel_component_dialog (CalComponent *comp) -{ - GtkWidget *dialog; - CalComponentVType vtype; - char *str; - - str = _("The meeting status has changed. Send an updated version?"); - - vtype = cal_component_get_vtype (comp); - - switch (vtype) { - case CAL_COMPONENT_EVENT: - str = g_strdup_printf (_("Are you sure you want to cancel " - "and delete this meeting?")); - break; - - case CAL_COMPONENT_TODO: - str = g_strdup_printf (_("Are you sure you want to cancel " - "and delete this task?")); - break; - - case CAL_COMPONENT_JOURNAL: - str = g_strdup_printf (_("Are you sure you want to cancel " - "and delete this journal entry?")); - break; - - default: - g_message ("send_component_dialog(): " - "Cannot handle object of type %d", vtype); - return FALSE; - } - - dialog = gnome_question_dialog_modal (str, NULL, NULL); - - if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_YES) - return TRUE; - else - return FALSE; -} diff --git a/calendar/gui/dialogs/cancel-comp.h b/calendar/gui/dialogs/cancel-comp.h deleted file mode 100644 index d12466ffa1..0000000000 --- a/calendar/gui/dialogs/cancel-comp.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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 CANCEL_COMP_H -#define CANCEL_COMP_H - -#include <glib.h> -#include <cal-util/cal-component.h> - -gboolean cancel_component_dialog (CalComponent *comp); - -#endif diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c deleted file mode 100644 index 4282307859..0000000000 --- a/calendar/gui/dialogs/changed-comp.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-uidefs.h> -#include <gal/widgets/e-unicode.h> -#include "changed-comp.h" - - - -/** - * changed_component_dialog: - * @comp: A calendar component - * @deleted: Whether the object is being deleted or updated - * @changed: Whether or not the user has made changes - * - * Pops up a dialog box asking the user whether changes made (if any) - * should be thrown away because the item has been updated elsewhere - * - * Return value: TRUE if the user clicked Yes, FALSE otherwise. - **/ -gboolean -changed_component_dialog (CalComponent *comp, gboolean deleted, gboolean changed) -{ - GtkWidget *dialog; - CalComponentVType vtype; - char *str; - - vtype = cal_component_get_vtype (comp); - - if (deleted) { - switch (vtype) { - case CAL_COMPONENT_EVENT: - str = _("This event has been deleted."); - break; - - case CAL_COMPONENT_TODO: - str = _("This task has been deleted."); - break; - - case CAL_COMPONENT_JOURNAL: - str = _("This journal entry has been deleted."); - break; - - default: - g_message ("changed_component_dialog(): " - "Cannot handle object of type %d", vtype); - return FALSE; - } - if (changed) - str = g_strdup_printf (_("%s You have made changes. Forget those changes and close the editor?"), str); - else - str = g_strdup_printf (_("%s You have made no changes, close the editor?"), str); - - } else { - switch (vtype) { - case CAL_COMPONENT_EVENT: - str = _("This event has been changed."); - break; - - case CAL_COMPONENT_TODO: - str = _("This task has been changed."); - break; - - case CAL_COMPONENT_JOURNAL: - str = _("This journal entry has been changed."); - break; - - default: - g_message ("changed_component_dialog(): " - "Cannot handle object of type %d", vtype); - return FALSE; - } - if (changed) - str = g_strdup_printf (_("%s You have made changes. Forget those changes and update the editor?"), str); - else - str = g_strdup_printf (_("%s You have made no changes, update the editor?"), str); - } - - dialog = gnome_question_dialog_modal (str, NULL, NULL); - - if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_YES) - return TRUE; - else - return FALSE; -} diff --git a/calendar/gui/dialogs/changed-comp.h b/calendar/gui/dialogs/changed-comp.h deleted file mode 100644 index 915d7a5372..0000000000 --- a/calendar/gui/dialogs/changed-comp.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Evolution calendar - Changed calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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 CHANGED_COMP_H -#define CHANGED_COMP_H - -#include <glib.h> -#include <cal-util/cal-component.h> - -gboolean changed_component_dialog (CalComponent *comp, gboolean deleted, gboolean changed); - -#endif diff --git a/calendar/gui/dialogs/comp-editor-page.c b/calendar/gui/dialogs/comp-editor-page.c deleted file mode 100644 index 0d7f315837..0000000000 --- a/calendar/gui/dialogs/comp-editor-page.c +++ /dev/null @@ -1,361 +0,0 @@ -/* Evolution calendar - Base class for calendar component editor pages - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtksignal.h> -#include "comp-editor-page.h" - - - -static void comp_editor_page_class_init (CompEditorPageClass *class); -static void comp_editor_page_init (CompEditorPage *page); -static void comp_editor_page_destroy (GtkObject *object); - -static GtkObjectClass *parent_class = NULL; - -/* Signal IDs */ - -enum { - CHANGED, - SUMMARY_CHANGED, - DATES_CHANGED, - LAST_SIGNAL -}; - -static guint comp_editor_page_signals[LAST_SIGNAL]; - -#define CLASS(page) (COMP_EDITOR_PAGE_CLASS (GTK_OBJECT (page)->klass)) - - - -/** - * comp_editor_page_get_type: - * - * Registers the #CompEditorPage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CompEditorPage class. - **/ -GtkType -comp_editor_page_get_type (void) -{ - static GtkType comp_editor_page_type = 0; - - if (!comp_editor_page_type) { - static const GtkTypeInfo comp_editor_page_info = { - "CompEditorPage", - sizeof (CompEditorPage), - sizeof (CompEditorPageClass), - (GtkClassInitFunc) comp_editor_page_class_init, - (GtkObjectInitFunc) comp_editor_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - comp_editor_page_type = - gtk_type_unique (GTK_TYPE_OBJECT, - &comp_editor_page_info); - } - - return comp_editor_page_type; -} - -/* Class initialization function for the abstract editor page */ -static void -comp_editor_page_class_init (CompEditorPageClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - comp_editor_page_signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CompEditorPageClass, - changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - comp_editor_page_signals[SUMMARY_CHANGED] = - gtk_signal_new ("summary_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CompEditorPageClass, - summary_changed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - comp_editor_page_signals[DATES_CHANGED] = - gtk_signal_new ("dates_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CompEditorPageClass, - dates_changed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, - comp_editor_page_signals, - LAST_SIGNAL); - - class->changed = NULL; - class->summary_changed = NULL; - class->dates_changed = NULL; - - class->get_widget = NULL; - class->focus_main_widget = NULL; - class->fill_widgets = NULL; - class->fill_component = NULL; - class->set_summary = NULL; - class->set_dates = NULL; - - object_class->destroy = comp_editor_page_destroy; -} - - - -static void -comp_editor_page_init (CompEditorPage *page) -{ - page->client = NULL; - page->accel_group = NULL; -} - - -static void -comp_editor_page_destroy (GtkObject *object) -{ - CompEditorPage *page; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (object)); - - page = COMP_EDITOR_PAGE (object); - - if (page->client) { - gtk_object_ref (GTK_OBJECT (page->client)); - page->client = NULL; - } - - if (page->accel_group) { - gtk_accel_group_unref (page->accel_group); - page->accel_group = NULL; - } - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -/** - * comp_editor_page_get_widget: - * @page: An editor page. - * - * Queries the main widget of an editor page. - * - * Return value: The widget that is the page's upper container. It should - * normally be inserted in a notebook widget. - **/ -GtkWidget * -comp_editor_page_get_widget (CompEditorPage *page) -{ - g_return_val_if_fail (page != NULL, NULL); - g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), NULL); - - g_assert (CLASS (page)->get_widget != NULL); - return (* CLASS (page)->get_widget) (page); -} - -/** - * comp_editor_page_focus_main_widget: - * @page: An editor page. - * - * Makes an editor page focus its main widget. This is used by the component - * editor when it first pops up so that it can focus the main widget in the - * first page. - **/ -void -comp_editor_page_focus_main_widget (CompEditorPage *page) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - g_assert (CLASS (page)->focus_main_widget != NULL); - (* CLASS (page)->focus_main_widget) (page); -} - -/** - * comp_editor_page_fill_widgets: - * @page: An editor page. - * @comp: A calendar component. - * - * Fills the widgets of an editor page with the data from a calendar component. - **/ -void -comp_editor_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - g_return_if_fail (comp != NULL); - - g_assert (CLASS (page)->fill_widgets != NULL); - (* CLASS (page)->fill_widgets) (page, comp); -} - -/** - * comp_editor_page_fill_component: - * @page: An editor page. - * @comp: A calendar component. - * - * Takes the data from the widgets of an editor page and sets it on a calendar - * component, replacing the contents of the properties that the editor page - * knows how to manipulate. - * - * Returns: TRUE if the component could be filled, FALSE otherwise - **/ -gboolean -comp_editor_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - g_return_val_if_fail (page != NULL, FALSE); - g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE); - g_return_val_if_fail (comp != NULL, FALSE); - - if (CLASS (page)->fill_component != NULL) - return (* CLASS (page)->fill_component) (page, comp); - - return TRUE; -} - -/** - * comp_editor_page_set_cal_client: - * @page: An editor page - * @client: A #CalClient object - * - * Sets the #CalClient for the dialog page to use. - **/ -void -comp_editor_page_set_cal_client (CompEditorPage *page, CalClient *client) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - if (page->client) - gtk_object_unref (GTK_OBJECT (client)); - - page->client = client; - if (page->client) - gtk_object_ref (GTK_OBJECT (client)); -} - -/** - * comp_editor_page_set_summary: - * @page: An editor page - * @summary: The text of the new summary value - * - * Sets the summary value for this group of widgets - **/ -void -comp_editor_page_set_summary (CompEditorPage *page, const char *summary) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - if (CLASS (page)->set_summary != NULL) - (* CLASS (page)->set_summary) (page, summary); -} - -/** - * comp_editor_page_set_dates: - * @page: An editor page - * @dates: A collection of various dates in time_t format - * - * Sets the date values for this group of widgets - **/ -void -comp_editor_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - if (CLASS (page)->set_dates != NULL) - (* CLASS (page)->set_dates) (page, dates); -} - -/** - * comp_editor_page_notify_changed: - * @page: An editor page. - * - * Makes an editor page emit the "changed" signal. This is meant to be - * used only by page implementations. - **/ -void -comp_editor_page_notify_changed (CompEditorPage *page) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - gtk_signal_emit (GTK_OBJECT (page), comp_editor_page_signals[CHANGED]); -} - -/** - * comp_editor_page_notify_summary_changed: - * @page: An editor page. - * - * Makes an editor page emit the "summary_changed" signal. This is meant to be - * used only by page implementations. - **/ -void -comp_editor_page_notify_summary_changed (CompEditorPage *page, - const char *summary) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - - gtk_signal_emit (GTK_OBJECT (page), - comp_editor_page_signals[SUMMARY_CHANGED], - summary); -} - -/** - * comp_editor_page_notify_dates_changed: - * @page: An editor page. - * - * Makes an editor page emit the "dates_changed" signal. This is meant to be - * used only by page implementations. - **/ -void -comp_editor_page_notify_dates_changed (CompEditorPage *page, - CompEditorPageDates *dates) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - gtk_signal_emit (GTK_OBJECT (page), - comp_editor_page_signals[DATES_CHANGED], - dates); -} diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h deleted file mode 100644 index 6ef5549219..0000000000 --- a/calendar/gui/dialogs/comp-editor-page.h +++ /dev/null @@ -1,108 +0,0 @@ -/* Evolution calendar - Base class for calendar component editor pages - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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 COMP_EDITOR_PAGE_H -#define COMP_EDITOR_PAGE_H - -#include <time.h> -#include <libgnome/gnome-defs.h> -#include <gtk/gtkwidget.h> -#include <cal-util/cal-component.h> -#include "cal-client.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_COMP_EDITOR_PAGE (comp_editor_page_get_type ()) -#define COMP_EDITOR_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_COMP_EDITOR_PAGE, CompEditorPage)) -#define COMP_EDITOR_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_COMP_EDITOR_PAGE, CompEditorPageClass)) -#define IS_COMP_EDITOR_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_COMP_EDITOR_PAGE)) -#define IS_COMP_EDITOR_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_COMP_EDITOR_PAGE)) - -typedef struct { - CalComponentDateTime *start; - CalComponentDateTime *end; - CalComponentDateTime *due; - struct icaltimetype *complete; -} CompEditorPageDates; - -typedef struct { - GtkObject object; - - /* Some of the pages need the CalClient to access timezone data. */ - CalClient *client; - - /* The GtkAccelGroup for the page. We install this when the page is - mapped, and uninstall when it is unmapped. libglade would do this - normally, but we create our pages individually so have to do it - ourselves. */ - GtkAccelGroup *accel_group; -} CompEditorPage; - -typedef struct { - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* changed) (CompEditorPage *page); - void (* needs_send) (CompEditorPage *page); - - void (* summary_changed) (CompEditorPage *page, const char *summary); - void (* dates_changed) (CompEditorPage *page, const char *dates); - - /* Virtual methods */ - - GtkWidget *(* get_widget) (CompEditorPage *page); - void (* focus_main_widget) (CompEditorPage *page); - - void (* fill_widgets) (CompEditorPage *page, CalComponent *comp); - gboolean (* fill_component) (CompEditorPage *page, CalComponent *comp); - - void (* set_summary) (CompEditorPage *page, const char *summary); - void (* set_dates) (CompEditorPage *page, CompEditorPageDates *dates); -} CompEditorPageClass; - - -GtkType comp_editor_page_get_type (void); -GtkWidget *comp_editor_page_get_widget (CompEditorPage *page); -void comp_editor_page_focus_main_widget (CompEditorPage *page); -void comp_editor_page_fill_widgets (CompEditorPage *page, - CalComponent *comp); -gboolean comp_editor_page_fill_component (CompEditorPage *page, - CalComponent *comp); -void comp_editor_page_set_cal_client (CompEditorPage *page, - CalClient *client); -void comp_editor_page_set_summary (CompEditorPage *page, - const char *summary); -void comp_editor_page_set_dates (CompEditorPage *page, - CompEditorPageDates *dates); -void comp_editor_page_notify_changed (CompEditorPage *page); -void comp_editor_page_notify_summary_changed (CompEditorPage *page, - const char *summary); -void comp_editor_page_notify_dates_changed (CompEditorPage *page, - CompEditorPageDates *dates); - - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c deleted file mode 100644 index 34d4e71e81..0000000000 --- a/calendar/gui/dialogs/comp-editor-util.c +++ /dev/null @@ -1,590 +0,0 @@ -/* Evolution calendar - Widget utilities - * - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <ctype.h> -#include <string.h> -#include <ical.h> -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <liboaf/liboaf.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-widget.h> -#include <gal/unicode/gunicode.h> -#include <e-destination.h> -#include <e-util/e-time-utils.h> -#include <cal-util/timeutil.h> -#include "../calendar-config.h" -#include "comp-editor-util.h" - - - -/** - * comp_editor_dates: - * @dates: A structure to be filled out with dates of a component - * @comp: The component to extract the dates from - * - * Extracts the dates from the calendar component into the - * CompEditorPageDates structure. Call comp_editor_free_dates() to free the - * results. - **/ -void -comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp) -{ - CalComponentDateTime dt; - - dates->start = NULL; - dates->end = NULL; - dates->due = NULL; - dates->complete = NULL; - - /* Note that the CalComponentDateTime's returned contain allocated - icaltimetype and tzid values, so we just take over ownership of - those. */ - cal_component_get_dtstart (comp, &dt); - if (dt.value) { - dates->start = g_new (CalComponentDateTime, 1); - *dates->start = dt; - } - - cal_component_get_dtend (comp, &dt); - if (dt.value) { - dates->end = g_new (CalComponentDateTime, 1); - *dates->end = dt; - } - - cal_component_get_due (comp, &dt); - if (dt.value) { - dates->due = g_new (CalComponentDateTime, 1); - *dates->due = dt; - } - - cal_component_get_completed (comp, &dates->complete); -} - - -/* This frees the dates in the CompEditorPageDates struct. But it doesn't free - * the struct (as that is usually static). - */ -void -comp_editor_free_dates (CompEditorPageDates *dates) -{ - /* Note that cal_component_free_datetime() only frees the fields in - the struct. It doesn't free the struct itself, so we do that. */ - if (dates->start) { - cal_component_free_datetime (dates->start); - g_free (dates->start); - } - - if (dates->end) { - cal_component_free_datetime (dates->end); - g_free (dates->end); - } - - if (dates->due) { - cal_component_free_datetime (dates->due); - g_free (dates->due); - } - - if (dates->complete) - cal_component_free_icaltimetype (dates->complete); -} - - -/* dtstart is only passed in if tt is the dtend. */ -static void -write_label_piece (struct icaltimetype *tt, char *buffer, int size, - char *stext, char *etext, struct icaltimetype *dtstart) -{ - struct tm tmp_tm = { 0 }; - struct icaltimetype tt_copy = *tt; - int len; - - /* FIXME: May want to convert the time to an appropriate zone. */ - - if (stext != NULL) - strcat (buffer, stext); - - /* If we are writing the DTEND (i.e. DTSTART is set), and - DTEND > DTSTART, subtract 1 day. The DTEND date is not inclusive. */ - if (tt_copy.is_date && dtstart - && icaltime_compare_date_only (tt_copy, *dtstart) > 0) { - icaltime_adjust (&tt_copy, -1, 0, 0, 0); - } - - tmp_tm.tm_year = tt_copy.year - 1900; - tmp_tm.tm_mon = tt_copy.month - 1; - tmp_tm.tm_mday = tt_copy.day; - tmp_tm.tm_hour = tt_copy.hour; - tmp_tm.tm_min = tt_copy.minute; - tmp_tm.tm_sec = tt_copy.second; - tmp_tm.tm_isdst = -1; - - tmp_tm.tm_wday = time_day_of_week (tt_copy.day, tt_copy.month - 1, - tt_copy.year); - - len = strlen (buffer); - e_time_format_date_and_time (&tmp_tm, - calendar_config_get_24_hour_format (), - !tt_copy.is_date, FALSE, - &buffer[len], size - len); - if (etext != NULL) - strcat (buffer, etext); -} - -/** - * comp_editor_date_label: - * @dates: The dates to use in constructing a label - * @label: The label whose text is to be set - * - * Set the text of a label based on the dates available and the user's - * formatting preferences - **/ -void -comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) -{ - char buffer[1024]; - gboolean start_set = FALSE, end_set = FALSE; - gboolean complete_set = FALSE, due_set = FALSE; - - buffer[0] = '\0'; - - if (dates->start && !icaltime_is_null_time (*dates->start->value)) - start_set = TRUE; - if (dates->end && !icaltime_is_null_time (*dates->end->value)) - end_set = TRUE; - if (dates->complete && !icaltime_is_null_time (*dates->complete)) - complete_set = TRUE; - if (dates->due && !icaltime_is_null_time (*dates->due->value)) - due_set = TRUE; - - if (start_set) - write_label_piece (dates->start->value, buffer, 1024, - NULL, NULL, NULL); - - if (start_set && end_set) - write_label_piece (dates->end->value, buffer, 1024, - _(" to "), NULL, dates->start->value); - - if (complete_set) { - if (start_set) - write_label_piece (dates->complete, buffer, 1024, _(" (Completed "), ")", NULL); - else - write_label_piece (dates->complete, buffer, 1024, _("Completed "), NULL, NULL); - } - - if (due_set && dates->complete == NULL) { - if (start_set) - write_label_piece (dates->due->value, buffer, 1024, _(" (Due "), ")", NULL); - else - write_label_piece (dates->due->value, buffer, 1024, _("Due "), NULL, NULL); - } - - gtk_label_set_text (GTK_LABEL (label), buffer); -} - -/** - * comp_editor_new_date_edit: - * @show_date: Whether to show a date picker in the widget. - * @show_time: Whether to show a time picker in the widget. - * @make_time_insensitive: Whether the time field is made insensitive rather - * than hiding it. This is useful if you want to preserve the layout of the - * widgets. - * - * Creates a new #EDateEdit widget, configured using the calendar's preferences. - * - * Return value: A newly-created #EDateEdit widget. - **/ -GtkWidget * -comp_editor_new_date_edit (gboolean show_date, gboolean show_time, - gboolean make_time_insensitive) -{ - EDateEdit *dedit; - - dedit = E_DATE_EDIT (e_date_edit_new ()); - - e_date_edit_set_show_date (dedit, show_date); - e_date_edit_set_show_time (dedit, show_time); -#if 0 - e_date_edit_set_make_time_insensitive (dedit, make_time_insensitive); -#else - e_date_edit_set_make_time_insensitive (dedit, FALSE); -#endif - calendar_config_configure_e_date_edit (dedit); - - return GTK_WIDGET (dedit); -} - - -/* Returns the current time, for EDateEdit widgets and ECalendar items in the - dialogs. - FIXME: Should probably use the timezone from somewhere in the component - rather than the current timezone. */ -struct tm -comp_editor_get_current_time (GtkObject *object, gpointer data) -{ - char *location; - icaltimezone *zone; - struct icaltimetype tt; - struct tm tmp_tm = { 0 }; - - /* Get the current timezone. */ - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - - tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone); - - /* Now copy it to the struct tm and return it. */ - tmp_tm.tm_year = tt.year - 1900; - tmp_tm.tm_mon = tt.month - 1; - tmp_tm.tm_mday = tt.day; - tmp_tm.tm_hour = tt.hour; - tmp_tm.tm_min = tt.minute; - tmp_tm.tm_sec = tt.second; - tmp_tm.tm_isdst = -1; - - return tmp_tm; -} - - - -/* - * These are utility functions to handle the SelectNames control we use - * for the contacts field, and its related dialog. - */ - -#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames" - -GNOME_Evolution_Addressbook_SelectNames -comp_editor_create_contacts_component (void) -{ - GNOME_Evolution_Addressbook_SelectNames corba_select_names; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFID, 0, - NULL, &ev); - - /* OAF seems to be broken -- it can return a CORBA_OBJECT_NIL without - raising an exception in `ev'. */ - if (ev._major != CORBA_NO_EXCEPTION - || corba_select_names == CORBA_OBJECT_NIL) { - g_warning ("Cannot activate -- %s", SELECT_NAMES_OAFID); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - - return corba_select_names; -} - - -GtkWidget * -comp_editor_create_contacts_control (GNOME_Evolution_Addressbook_SelectNames corba_select_names) -{ - Bonobo_Control corba_control; - GtkWidget *control_widget; - CORBA_Environment ev; - char *name = _("Contacts"); - - CORBA_exception_init (&ev); - - GNOME_Evolution_Addressbook_SelectNames_addSection ( - corba_select_names, name, name, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return NULL; - } - - corba_control = - GNOME_Evolution_Addressbook_SelectNames_getEntryBySection ( - corba_select_names, name, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - control_widget = bonobo_widget_new_control_from_objref ( - corba_control, CORBA_OBJECT_NIL); - - gtk_widget_show (control_widget); - - return control_widget; -} - - -Bonobo_EventSource_ListenerId -comp_editor_connect_contacts_changed (GtkWidget *contacts_entry, - BonoboListenerCallbackFn changed_cb, - gpointer changed_cb_data) -{ - BonoboControlFrame *cf; - Bonobo_PropertyBag pb = CORBA_OBJECT_NIL; - - cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (contacts_entry)); - pb = bonobo_control_frame_get_control_property_bag (cf, NULL); - - return bonobo_event_source_client_add_listener ( - pb, changed_cb, - "Bonobo/Property:change:entry_changed", - NULL, changed_cb_data); -} - - -void -comp_editor_show_contacts_dialog (GNOME_Evolution_Addressbook_SelectNames corba_select_names) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - GNOME_Evolution_Addressbook_SelectNames_activateDialog ( - corba_select_names, _("Contacts"), &ev); - CORBA_exception_free (&ev); -} - - -/* A simple 'name <email>' parser. Input should be UTF8. - FIXME: Should probably use camel functions or something. */ -static void -parse_contact_string (const char *value, char **name, char **email) -{ - char *lbracket, *rbracket, *name_end, *tmp_name, *tmp_email; - - if (!value) { - *name = g_strdup (""); - *email = g_strdup (""); - return; - } - - lbracket = g_utf8_strchr (value, '<'); - rbracket = g_utf8_strchr (value, '>'); - - if (!lbracket || !rbracket || rbracket < lbracket) { - *name = g_strdup (value); - *email = g_strdup (""); - return; - } - - name_end = g_utf8_prev_char (lbracket); - while (name_end > value && g_unichar_isspace (g_utf8_get_char (name_end))) - name_end = g_utf8_prev_char (name_end); - - tmp_name = g_malloc (name_end - value + 2); - strncpy (tmp_name, value, name_end - value + 1); - tmp_name[name_end - value + 1] = '\0'; - *name = tmp_name; - - tmp_email = g_malloc (rbracket - lbracket); - strncpy (tmp_email, lbracket + 1, rbracket - lbracket - 1); - tmp_email[rbracket - lbracket - 1] = '\0'; - *email = tmp_email; - -#if 0 - g_print ("Parsed: %s\n Name:'%s'\nEmail:'%s'\n", - value, *name, *email); -#endif -} - - -void -comp_editor_contacts_to_widget (GtkWidget *contacts_entry, - CalComponent *comp) -{ - GPtrArray *dest_array; - EDestination *dest; - GSList *contact_list, *elem; - char *contacts_string; - int i; - - cal_component_get_contact_list (comp, &contact_list); - dest_array = g_ptr_array_new (); - for (elem = contact_list; elem; elem = elem->next) { - CalComponentText *t = elem->data; - char *name, *email; - - parse_contact_string (t->value, &name, &email); - - dest = e_destination_new (); - e_destination_set_name (dest, name); - e_destination_set_email (dest, email); - g_ptr_array_add (dest_array, dest); - g_free (name); - g_free (email); - } - cal_component_free_text_list (contact_list); - - /* we need destv to be NULL terminated */ - g_ptr_array_add (dest_array, NULL); - - contacts_string = e_destination_exportv ((EDestination**) dest_array->pdata); -#if 0 - g_print ("Destinations: %s\n", contacts_string ? contacts_string : ""); -#endif - - bonobo_widget_set_property (BONOBO_WIDGET (contacts_entry), - "destinations", contacts_string, NULL); - - g_free (contacts_string); - - /* We free all dest_array except the last NULL we added. */ - for (i = 0; i < dest_array->len - 1; i++) { - dest = g_ptr_array_index (dest_array, i); - gtk_object_unref (GTK_OBJECT (dest)); - } - g_ptr_array_free (dest_array, TRUE); -} - - -void -comp_editor_contacts_to_component (GtkWidget *contacts_entry, - CalComponent *comp) -{ - EDestination **contact_destv; - GSList *contact_list = NULL, *elem; - char *contacts_string = NULL; - CalComponentText *t; - const char *name, *email; - int i; - - bonobo_widget_get_property (BONOBO_WIDGET (contacts_entry), - "destinations", &contacts_string, NULL); -#if 0 - g_print ("Contacts string: %s\n", contacts_string ? contacts_string : ""); -#endif - - contact_destv = e_destination_importv (contacts_string); - if (contact_destv) { - for (i = 0; contact_destv[i] != NULL; i++) { - name = e_destination_get_name (contact_destv[i]); - email = e_destination_get_email (contact_destv[i]); - - t = g_new0 (CalComponentText, 1); - t->altrep = NULL; - - /* If both name and email are given, use the standard - '"name" <email>' form, otherwise use just the name - or the email address. - FIXME: I'm not sure this is correct syntax etc. */ - if (name && name[0] && email && email[0]) - t->value = g_strdup_printf ("\"%s\" <%s>", - name, email); - else if (name && name[0]) - t->value = g_strdup_printf ("\"%s\"", - name); - else - t->value = g_strdup_printf ("<%s>", - email); - - contact_list = g_slist_prepend (contact_list, t); - - gtk_object_unref (GTK_OBJECT (contact_destv[i])); - } - } - g_free (contact_destv); - - contact_list = g_slist_reverse (contact_list); - cal_component_set_contact_list (comp, contact_list); - - for (elem = contact_list; elem; elem = elem->next) { - t = elem->data; - g_free ((char*)t->value); - g_free (t); - } - g_slist_free (contact_list); -} - -/** - * comp_editor_strip_categories: - * @categories: A string of category names entered by the user. - * - * Takes a string of the form "categ, categ, categ, ..." and removes the - * whitespace between categories to result in "categ,categ,categ,..." - * - * Return value: The category names stripped of surrounding whitespace - * and separated with commas. - **/ -char * -comp_editor_strip_categories (const char *categories) -{ - char *new_categories; - const char *start, *end; - const char *p; - char *new_p; - - if (!categories) - return NULL; - - new_categories = g_new (char, strlen (categories) + 1); - - start = end = NULL; - new_p = new_categories; - - for (p = categories; *p; p++) { - int c; - - c = *p; - - if (isspace (c)) - continue; - else if (c == ',') { - int len; - - if (!start) - continue; - - g_assert (start <= end); - - len = end - start + 1; - strncpy (new_p, start, len); - new_p[len] = ','; - new_p += len + 1; - - start = end = NULL; - } else { - if (!start) { - start = p; - end = p; - } else - end = p; - } - } - - if (start) { - int len; - - g_assert (start <= end); - - len = end - start + 1; - strncpy (new_p, start, len); - new_p += len; - } - - *new_p = '\0'; - - return new_categories; -} diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h deleted file mode 100644 index 948b34221c..0000000000 --- a/calendar/gui/dialogs/comp-editor-util.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Evolution calendar - Widget utilities - * - * Copyright (C) 2000 Ximian, Inc. - * - * Author: JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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 _COMP_EDITOR_UTIL_H_ -#define _COMP_EDITOR_UTIL_H_ - -#include <gtk/gtkwidget.h> -#include <bonobo/bonobo-control.h> -#include "Evolution-Addressbook-SelectNames.h" -#include "comp-editor-page.h" - -void comp_editor_dates (CompEditorPageDates *date, CalComponent *comp); -void comp_editor_free_dates (CompEditorPageDates *dates); - -void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label); - -GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time, - gboolean make_time_insensitive); - -struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); - - -GNOME_Evolution_Addressbook_SelectNames comp_editor_create_contacts_component (void); -GtkWidget * comp_editor_create_contacts_control (GNOME_Evolution_Addressbook_SelectNames corba_select_names); -Bonobo_EventSource_ListenerId comp_editor_connect_contacts_changed (GtkWidget *contacts_entry, - BonoboListenerCallbackFn changed_cb, - gpointer changed_cb_data); -void comp_editor_show_contacts_dialog (GNOME_Evolution_Addressbook_SelectNames corba_select_names); - -void comp_editor_contacts_to_widget (GtkWidget *contacts_entry, - CalComponent *comp); -void comp_editor_contacts_to_component (GtkWidget *contacts_entry, - CalComponent *comp); - -char *comp_editor_strip_categories (const char *categories); - -#endif diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c deleted file mode 100644 index 14bee4e9a7..0000000000 --- a/calendar/gui/dialogs/comp-editor.c +++ /dev/null @@ -1,1310 +0,0 @@ -/* Evolution calendar - Framework for a calendar component editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <glib.h> -#include <gdk/gdkkeysyms.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-uidefs.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-window-icon.h> -#include <bonobo/bonobo-ui-container.h> -#include <bonobo/bonobo-ui-util.h> -#include <gal/widgets/e-unicode.h> -#include <evolution-shell-component-utils.h> -#include "../print.h" -#include "save-comp.h" -#include "delete-comp.h" -#include "send-comp.h" -#include "changed-comp.h" -#include "comp-editor.h" - - - -/* Private part of the CompEditor structure */ -struct _CompEditorPrivate { - /* Client to use */ - CalClient *client; - - /* Calendar object/uid we are editing; this is an internal copy */ - CalComponent *comp; - - /* The pages we have */ - GList *pages; - - /* UI Component for the dialog */ - BonoboUIComponent *uic; - - /* Notebook to hold the pages */ - GtkNotebook *notebook; - - GtkWidget *filesel; - - gboolean changed; - gboolean needs_send; - gboolean needs_send_new; - gboolean updating; -}; - - - -static void comp_editor_class_init (CompEditorClass *class); -static void comp_editor_init (CompEditor *editor); -static gint comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e); -static void comp_editor_destroy (GtkObject *object); - -static void real_set_cal_client (CompEditor *editor, CalClient *client); -static void real_edit_comp (CompEditor *editor, CalComponent *comp); -static void real_send_comp (CompEditor *editor, CalComponentItipMethod method); -static gboolean prompt_to_save_changes (CompEditor *editor, gboolean send); -static void delete_comp (CompEditor *editor); -static void close_dialog (CompEditor *editor); - -static void page_changed_cb (GtkObject *obj, gpointer data); -static void page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data); -static void page_dates_changed_cb (GtkObject *obj, CompEditorPageDates *dates, gpointer data); - -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 save_cmd (GtkWidget *widget, gpointer data); -static void save_close_cmd (GtkWidget *widget, gpointer data); -static void save_as_cmd (GtkWidget *widget, gpointer data); -static void delete_cmd (GtkWidget *widget, gpointer data); -static void print_cmd (GtkWidget *widget, gpointer data); -static void print_preview_cmd (GtkWidget *widget, gpointer data); -static void print_setup_cmd (GtkWidget *widget, gpointer data); -static void close_cmd (GtkWidget *widget, gpointer data); - -static gint delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data); - -static EPixmap pixmaps [] = -{ - E_PIXMAP ("/menu/File/FileSave", "save-16.png"), - E_PIXMAP ("/menu/File/FileSaveAndClose", "save-16.png"), - E_PIXMAP ("/menu/File/FileSaveAs", "save-as-16.png"), - - E_PIXMAP ("/menu/File/FileDelete", "evolution-trash-mini.png"), - - E_PIXMAP ("/menu/File/FilePrint", "print.xpm"), - E_PIXMAP ("/menu/File/FilePrintPreview", "print-preview.xpm"), - - E_PIXMAP ("/Toolbar/FileSaveAndClose", "buttons/save-24.png"), - E_PIXMAP ("/Toolbar/FilePrint", "buttons/print.png"), - E_PIXMAP ("/Toolbar/FileDelete", "buttons/delete-message.png"), - - E_PIXMAP_END -}; - -static BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("FileSave", save_cmd), - BONOBO_UI_UNSAFE_VERB ("FileSaveAndClose", save_close_cmd), - BONOBO_UI_UNSAFE_VERB ("FileSaveAs", save_as_cmd), - BONOBO_UI_UNSAFE_VERB ("FileDelete", delete_cmd), - BONOBO_UI_UNSAFE_VERB ("FilePrint", print_cmd), - BONOBO_UI_UNSAFE_VERB ("FilePrintPreview", print_preview_cmd), - BONOBO_UI_UNSAFE_VERB ("FilePrintSetup", print_setup_cmd), - BONOBO_UI_UNSAFE_VERB ("FileClose", close_cmd), - - BONOBO_UI_VERB_END -}; - -static GtkObjectClass *parent_class; - - - -GtkType -comp_editor_get_type (void) -{ - static GtkType comp_editor_type = 0; - - if (!comp_editor_type) { - static const GtkTypeInfo comp_editor_info = { - "CompEditor", - sizeof (CompEditor), - sizeof (CompEditorClass), - (GtkClassInitFunc) comp_editor_class_init, - (GtkObjectInitFunc) comp_editor_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - comp_editor_type = gtk_type_unique (BONOBO_TYPE_WINDOW, - &comp_editor_info); - } - - return comp_editor_type; -} - -/* Class initialization function for the calendar component editor */ -static void -comp_editor_class_init (CompEditorClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - object_class = GTK_OBJECT_CLASS (klass); - widget_class = GTK_WIDGET_CLASS (klass); - - parent_class = gtk_type_class (BONOBO_TYPE_WINDOW); - - klass->set_cal_client = real_set_cal_client; - klass->edit_comp = real_edit_comp; - klass->send_comp = real_send_comp; - - widget_class->key_press_event = comp_editor_key_press_event; - object_class->destroy = comp_editor_destroy; -} - -/* Creates the basic in the editor */ -static void -setup_widgets (CompEditor *editor) -{ - CompEditorPrivate *priv; - BonoboUIContainer *container; - GtkWidget *vbox; - - priv = editor->priv; - - /* Window and basic vbox */ - bonobo_window_construct (BONOBO_WINDOW (editor), - "event-editor", "iCalendar Editor"); - gtk_signal_connect (GTK_OBJECT (editor), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), editor); - - priv->uic = bonobo_ui_component_new_default (); - container = bonobo_ui_container_new (); - bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor)); - bonobo_ui_component_set_container (priv->uic, BONOBO_OBJREF (container)); - bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (editor)), - "/evolution/UIConf/kvps"); - - bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor); - bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, - "evolution-comp-editor.xml", - "evolution-calendar"); - e_pixmaps_update (priv->uic, pixmaps); - - vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); - gtk_widget_show (vbox); - gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL); - bonobo_window_set_contents (BONOBO_WINDOW (editor), vbox); - - /* Notebook */ - priv->notebook = GTK_NOTEBOOK (gtk_notebook_new ()); - gtk_widget_show (GTK_WIDGET (priv->notebook)); - gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (priv->notebook), - TRUE, TRUE, 0); -} - -/* Object initialization function for the calendar component editor */ -static void -comp_editor_init (CompEditor *editor) -{ - CompEditorPrivate *priv; - - priv = g_new0 (CompEditorPrivate, 1); - editor->priv = priv; - - setup_widgets (editor); - - priv->pages = NULL; - priv->changed = FALSE; - priv->needs_send = FALSE; - priv->needs_send_new = FALSE; -} - - -static gint -comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e) -{ - if (e->keyval == GDK_Escape) { - if (prompt_to_save_changes (COMP_EDITOR (d), TRUE)) - close_dialog (COMP_EDITOR (d)); - return TRUE; - } - - if (GTK_WIDGET_CLASS (parent_class)->key_press_event) - return (* GTK_WIDGET_CLASS (parent_class)->key_press_event) (d, e); - - return FALSE; -} - -/* Destroy handler for the calendar component editor */ -static void -comp_editor_destroy (GtkObject *object) -{ - CompEditor *editor; - CompEditorPrivate *priv; - GList *l; - - editor = COMP_EDITOR (object); - priv = editor->priv; - - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), editor); - - /* We want to destroy the pages after the widgets get destroyed, - since they have lots of signal handlers connected to the widgets - with the pages as the data. */ - for (l = priv->pages; l != NULL; l = l->next) - gtk_object_unref (GTK_OBJECT (l->data)); - - if (priv->comp) { - gtk_object_unref (GTK_OBJECT (priv->comp)); - priv->comp = NULL; - } - - g_free (priv); - editor->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -static gboolean -save_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - CalComponent *clone; - GList *l; - - priv = editor->priv; - - if (!priv->changed) - return TRUE; - - clone = cal_component_clone (priv->comp); - for (l = priv->pages; l != NULL; l = l->next) { - if (!comp_editor_page_fill_component (l->data, clone)) { - gtk_object_unref (GTK_OBJECT (clone)); - return FALSE; - } - } - cal_component_commit_sequence (clone); - gtk_object_unref (GTK_OBJECT (priv->comp)); - priv->comp = clone; - - priv->updating = TRUE; - - if (!cal_client_update_object (priv->client, priv->comp)) { - GtkWidget *dlg; - - dlg = gnome_error_dialog (_("Could not update object!")); - gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - - return FALSE; - } else { - priv->changed = FALSE; - } - - priv->updating = FALSE; - - return TRUE; -} - -static gboolean -save_comp_with_send (CompEditor *editor) -{ - CompEditorPrivate *priv; - gboolean send; - - priv = editor->priv; - - send = priv->changed && priv->needs_send; - - if (!save_comp (editor)) - return FALSE; - - if (send && send_component_dialog (priv->comp, priv->needs_send_new)) - comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); - - return TRUE; -} - -static void -delete_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - const char *uid; - - priv = editor->priv; - - cal_component_get_uid (priv->comp, &uid); - priv->updating = TRUE; - cal_client_remove_object (priv->client, uid); - priv->updating = FALSE; - close_dialog (editor); -} - -static gboolean -prompt_to_save_changes (CompEditor *editor, gboolean send) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - if (!priv->changed) - return TRUE; - - switch (save_component_dialog (GTK_WINDOW (editor))) { - case 0: /* Save */ - if (send && save_comp_with_send (editor)) - return TRUE; - else if (!send && save_comp (editor)) - return TRUE; - else - return FALSE; - case 1: /* Discard */ - return TRUE; - case 2: /* Cancel */ - default: - return FALSE; - } -} - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (CompEditor *editor) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - gtk_object_destroy (GTK_OBJECT (editor)); -} - - - -/** - * comp_editor_set_changed: - * @editor: A component editor - * @changed: Value to set the changed state to - * - * Set the dialog changed state to the given value - **/ -void -comp_editor_set_changed (CompEditor *editor, gboolean changed) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - priv->changed = changed; -} - -/** - * comp_editor_get_changed: - * @editor: A component editor - * - * Gets the changed state of the dialog - * - * Return value: A boolean indicating if the dialog is in a changed - * state - **/ -gboolean -comp_editor_get_changed (CompEditor *editor) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - return priv->changed; -} - -/** - * comp_editor_set_needs_send: - * @editor: A component editor - * @needs_send: Value to set the needs send state to - * - * Set the dialog needs send state to the given value - **/ -void -comp_editor_set_needs_send (CompEditor *editor, gboolean needs_send) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - priv->needs_send = needs_send; -} - -/** - * comp_editor_get_needs_send: - * @editor: A component editor - * - * Gets the needs send state of the dialog - * - * Return value: A boolean indicating if the dialog is in a needs send - * state - **/ -gboolean -comp_editor_get_needs_send (CompEditor *editor) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - return priv->needs_send; -} - -static void page_mapped_cb (GtkWidget *page_widget, - CompEditorPage *page) -{ - GtkWidget *toplevel; - - toplevel = gtk_widget_get_toplevel (page_widget); - if (!GTK_IS_WINDOW (toplevel)) - return; - - if (page->accel_group) { - gtk_window_add_accel_group (GTK_WINDOW (toplevel), - page->accel_group); - } -} - -static void page_unmapped_cb (GtkWidget *page_widget, - CompEditorPage *page) -{ - GtkWidget *toplevel; - - toplevel = gtk_widget_get_toplevel (page_widget); - if (!GTK_IS_WINDOW (toplevel)) - return; - - if (page->accel_group) { - gtk_window_remove_accel_group (GTK_WINDOW (toplevel), - page->accel_group); - } -} - -/** - * comp_editor_append_page: - * @editor: A component editor - * @page: A component editor page - * @label: Label of the page - * - * Appends a page to the editor notebook with the given label - **/ -void -comp_editor_append_page (CompEditor *editor, - CompEditorPage *page, - const char *label) -{ - CompEditorPrivate *priv; - GtkWidget *page_widget; - GtkWidget *label_widget; - gboolean is_first_page; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - g_return_if_fail (label != NULL); - - priv = editor->priv; - - gtk_object_ref (GTK_OBJECT (page)); - - /* If we are editing something, fill the widgets with current info */ - if (priv->comp != NULL) { - CalComponent *comp; - - comp = comp_editor_get_current_comp (editor); - comp_editor_page_fill_widgets (page, comp); - gtk_object_unref (GTK_OBJECT (comp)); - } - - page_widget = comp_editor_page_get_widget (page); - g_assert (page_widget != NULL); - - label_widget = gtk_label_new (label); - - is_first_page = (priv->pages == NULL); - - priv->pages = g_list_append (priv->pages, page); - gtk_notebook_append_page (priv->notebook, page_widget, label_widget); - - /* Listen for things happening on the page */ - gtk_signal_connect (GTK_OBJECT (page), "changed", - GTK_SIGNAL_FUNC (page_changed_cb), editor); - gtk_signal_connect (GTK_OBJECT (page), "summary_changed", - GTK_SIGNAL_FUNC (page_summary_changed_cb), editor); - gtk_signal_connect (GTK_OBJECT (page), "dates_changed", - GTK_SIGNAL_FUNC (page_dates_changed_cb), editor); - - /* Listen for when the page is mapped/unmapped so we can - install/uninstall the appropriate GtkAccelGroup. */ - gtk_signal_connect (GTK_OBJECT (page_widget), "map", - GTK_SIGNAL_FUNC (page_mapped_cb), page); - gtk_signal_connect (GTK_OBJECT (page_widget), "unmap", - GTK_SIGNAL_FUNC (page_unmapped_cb), page); - - /* The first page is the main page of the editor, so we ask it to focus - * its main widget. - */ - if (is_first_page) - comp_editor_page_focus_main_widget (page); -} - -/** - * comp_editor_remove_page: - * @editor: A component editor - * @page: A component editor page - * - * Removes the page from the component editor - **/ -void -comp_editor_remove_page (CompEditor *editor, CompEditorPage *page) -{ - CompEditorPrivate *priv; - GtkWidget *page_widget; - gint page_num; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - priv = editor->priv; - - page_widget = comp_editor_page_get_widget (page); - page_num = gtk_notebook_page_num (priv->notebook, page_widget); - if (page_num == -1) - return; - - /* Disconnect all the signals added in append_page(). */ - gtk_signal_disconnect_by_data (GTK_OBJECT (page), editor); - gtk_signal_disconnect_by_data (GTK_OBJECT (page_widget), page); - - gtk_notebook_remove_page (priv->notebook, page_num); - - priv->pages = g_list_remove (priv->pages, page); - gtk_object_unref (GTK_OBJECT (page)); -} - -/** - * comp_editor_show_page: - * @editor: - * @page: - * - * - **/ -void -comp_editor_show_page (CompEditor *editor, CompEditorPage *page) -{ - CompEditorPrivate *priv; - GtkWidget *page_widget; - gint page_num; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - priv = editor->priv; - - page_widget = comp_editor_page_get_widget (page); - page_num = gtk_notebook_page_num (priv->notebook, page_widget); - gtk_notebook_set_page (priv->notebook, page_num); -} - -/** - * comp_editor_set_cal_client: - * @editor: A component editor - * @client: The calendar client to use - * - * Sets the calendar client used by the editor to update components - **/ -void -comp_editor_set_cal_client (CompEditor *editor, CalClient *client) -{ - CompEditorClass *klass; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); - - if (klass->set_cal_client) - klass->set_cal_client (editor, client); -} - -/** - * comp_editor_get_cal_client: - * @editor: A component editor - * - * Returns the calendar client of the editor - * - * Return value: The calendar client of the editor - **/ -CalClient * -comp_editor_get_cal_client (CompEditor *editor) -{ - CompEditorPrivate *priv; - - g_return_val_if_fail (editor != NULL, NULL); - g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); - - priv = editor->priv; - - return priv->client; -} - -/* Creates an appropriate title for the event editor dialog */ -static char * -make_title_from_comp (CalComponent *comp) -{ - char *title; - const char *type_string; - CalComponentVType type; - CalComponentText text; - - if (!comp) - return g_strdup (_("Edit Appointment")); - - type = cal_component_get_vtype (comp); - switch (type) { - case CAL_COMPONENT_EVENT: - type_string = _("Appointment - %s"); - break; - case CAL_COMPONENT_TODO: - type_string = _("Task - %s"); - break; - case CAL_COMPONENT_JOURNAL: - type_string = _("Journal entry - %s"); - break; - default: - g_message ("make_title_from_comp(): Cannot handle object of type %d", type); - return NULL; - } - - cal_component_get_summary (comp, &text); - if (text.value) { - char *summary; - summary = e_utf8_to_locale_string (text.value); - title = g_strdup_printf (type_string, summary); - g_free (summary); - } else - title = g_strdup_printf (type_string, _("No summary")); - - return title; -} - -static const char * -make_icon_from_comp (CalComponent *comp) -{ - CalComponentVType type; - - if (!comp) - return EVOLUTION_ICONSDIR "/evolution-calendar-mini.png"; - - type = cal_component_get_vtype (comp); - switch (type) { - case CAL_COMPONENT_EVENT: - return EVOLUTION_ICONSDIR "/buttons/new_appointment.png"; - break; - case CAL_COMPONENT_TODO: - return EVOLUTION_ICONSDIR "/buttons/new_task.png"; - break; - default: - return EVOLUTION_ICONSDIR "/evolution-calendar-mini.png"; - } -} - -/* Sets the event editor's window title from a calendar component */ -static void -set_title_from_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - char *title; - - priv = editor->priv; - title = make_title_from_comp (priv->comp); - gtk_window_set_title (GTK_WINDOW (editor), title); - g_free (title); -} - -static void -set_icon_from_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - const char *file; - - priv = editor->priv; - file = make_icon_from_comp (priv->comp); - gnome_window_icon_set_from_file (GTK_WINDOW (editor), file); -} - -static void -fill_widgets (CompEditor *editor) -{ - CompEditorPrivate *priv; - GList *l; - - priv = editor->priv; - - for (l = priv->pages; l != NULL; l = l->next) - comp_editor_page_fill_widgets (l->data, priv->comp); -} - -static void -real_set_cal_client (CompEditor *editor, CalClient *client) -{ - CompEditorPrivate *priv; - GList *elem; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - if (client == priv->client) - return; - - if (client) { - g_return_if_fail (IS_CAL_CLIENT (client)); - g_return_if_fail (cal_client_get_load_state (client) == - CAL_CLIENT_LOAD_LOADED); - gtk_object_ref (GTK_OBJECT (client)); - } - - if (priv->client) { - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), - editor); - gtk_object_unref (GTK_OBJECT (priv->client)); - } - - priv->client = client; - - /* Pass the client to any pages that need it. */ - for (elem = priv->pages; elem; elem = elem->next) - comp_editor_page_set_cal_client (elem->data, client); - - gtk_signal_connect (GTK_OBJECT (priv->client), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated_cb), editor); - - gtk_signal_connect (GTK_OBJECT (priv->client), "obj_removed", - GTK_SIGNAL_FUNC (obj_removed_cb), editor); -} - -static void -real_edit_comp (CompEditor *editor, CalComponent *comp) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - if (priv->comp) { - gtk_object_unref (GTK_OBJECT (priv->comp)); - priv->comp = NULL; - } - - if (comp) - priv->comp = cal_component_clone (comp); - - priv->needs_send_new = !priv->needs_send; - - set_title_from_comp (editor); - set_icon_from_comp (editor); - fill_widgets (editor); -} - - -static void -real_send_comp (CompEditor *editor, CalComponentItipMethod method) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - itip_send_comp (method, priv->comp); -} - - -/** - * comp_editor_edit_comp: - * @editor: A component editor - * @comp: A calendar component - * - * Starts the editor editing the given component - **/ -void -comp_editor_edit_comp (CompEditor *editor, CalComponent *comp) -{ - CompEditorClass *klass; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); - - if (klass->edit_comp) - klass->edit_comp (editor, comp); -} - -CalComponent * -comp_editor_get_current_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - CalComponent *comp; - GList *l; - - g_return_val_if_fail (editor != NULL, NULL); - g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); - - priv = editor->priv; - - comp = cal_component_clone (priv->comp); - if (priv->changed) { - for (l = priv->pages; l != NULL; l = l->next) - comp_editor_page_fill_component (l->data, comp); - } - - return comp; -} - -/** - * comp_editor_save_comp: - * @editor: - * - * - **/ -gboolean -comp_editor_save_comp (CompEditor *editor, gboolean send) -{ - return prompt_to_save_changes (editor, send); -} - -/** - * comp_editor_delete_comp: - * @editor: - * - * - **/ -void -comp_editor_delete_comp (CompEditor *editor) -{ - delete_comp (editor); -} - -/** - * comp_editor_send_comp: - * @editor: - * @method: - * - * - **/ -void -comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) -{ - CompEditorClass *klass; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); - - if (klass->send_comp) - klass->send_comp (editor, method); -} - -/** - * comp_editor_merge_ui: - * @editor: - * @filename: - * @verbs: - * - * - **/ -void -comp_editor_merge_ui (CompEditor *editor, const char *filename, BonoboUIVerb *verbs) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, filename, "evolution-calendar"); - bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor); -} - -/** - * comp_editor_set_ui_prop: - * @editor: - * @path: - * @attr: - * @val: - * - * - **/ -void -comp_editor_set_ui_prop (CompEditor *editor, - const char *path, - const char *attr, - const char *val) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - bonobo_ui_component_set_prop (priv->uic, path, attr, val, NULL); -} - - -/* 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); -} - -/** - * comp_editor_focus: - * @editor: A component editor - * - * Brings the editor window to the front and gives it focus - **/ -void -comp_editor_focus (CompEditor *editor) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - gtk_widget_show (GTK_WIDGET (editor)); - raise_and_focus (GTK_WIDGET (editor)); -} - -/* This sets the focus to the toplevel, so any field being edited is committed. - FIXME: In future we may also want to check some of the fields are valid, - e.g. the EDateEdit fields. */ -static void -commit_all_fields (CompEditor *editor) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - gtk_window_set_focus (GTK_WINDOW (editor), NULL); -} - -/* Menu Commands */ -static void -save_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - - commit_all_fields (editor); - - save_comp_with_send (editor); -} - -static void -save_close_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - - commit_all_fields (editor); - - if (save_comp_with_send (editor)) - close_dialog (editor); -} - -static void -save_as_ok (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - struct stat s; - char *path; - int ret = 0; - - priv = editor->priv; - - path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (priv->filesel)); - - if (stat (path, &s) == 0) { - GtkWidget *dlg; - GtkWidget *text; - - dlg = gnome_dialog_new (_("Overwrite file?"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?")); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4); - gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE); - gtk_widget_show (text); - - ret = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - } - - if (ret == 0) { - FILE *file; - gchar *ical_string; - - ical_string = cal_client_get_component_as_string (priv->client, priv->comp); - if (ical_string == NULL) { - g_warning ("Couldn't convert item to a string"); - gtk_main_quit (); - return; - } - - file = fopen (path, "w"); - if (file == NULL) { - g_warning ("Couldn't save item"); - gtk_main_quit (); - return; - } - - fprintf (file, ical_string); - g_free (ical_string); - fclose (file); - - gtk_main_quit (); - } -} - -static void -save_as_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - GtkFileSelection *fs; - char *path; - - priv = editor->priv; - - commit_all_fields (editor); - - fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save As..."))); - path = g_strdup_printf ("%s/", g_get_home_dir ()); - gtk_file_selection_set_filename (fs, path); - g_free (path); - - gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked", - GTK_SIGNAL_FUNC (save_as_ok), editor); - gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - - priv->filesel = GTK_WIDGET (fs); - gtk_widget_show (priv->filesel); - gtk_grab_add (priv->filesel); - gtk_main (); - - gtk_widget_destroy (priv->filesel); - priv->filesel = NULL; -} - -static void -delete_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - CalComponentVType vtype; - - priv = editor->priv; - - vtype = cal_component_get_vtype (priv->comp); - - if (delete_component_dialog (priv->comp, FALSE, 1, vtype, GTK_WIDGET (editor))) - delete_comp (editor); -} - -static void -print_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CalComponent *comp; - - commit_all_fields (editor); - - comp = comp_editor_get_current_comp (editor); - print_comp (comp, editor->priv->client, FALSE); - gtk_object_unref (GTK_OBJECT (comp)); -} - -static void -print_preview_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CalComponent *comp; - - commit_all_fields (editor); - - comp = comp_editor_get_current_comp (editor); - print_comp (comp, editor->priv->client, TRUE); - gtk_object_unref (GTK_OBJECT (comp)); -} - -static void -print_setup_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; - - print_setup (); -} - -static void -close_cmd (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - - commit_all_fields (editor); - - if (prompt_to_save_changes (editor, TRUE)) - close_dialog (editor); -} - -static void -page_changed_cb (GtkObject *obj, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; - - priv->changed = TRUE; -} - -/* Page signal callbacks */ -static void -page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - GList *l; - - priv = editor->priv; - - for (l = priv->pages; l != NULL; l = l->next) - if (obj != l->data) - comp_editor_page_set_summary (l->data, summary); - - priv->changed = TRUE; -} - -static void -page_dates_changed_cb (GtkObject *obj, - CompEditorPageDates *dates, - gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - GList *l; - - priv = editor->priv; - - for (l = priv->pages; l != NULL; l = l->next) - if (obj != l->data) - comp_editor_page_set_dates (l->data, dates); - - priv->changed = TRUE; -} - -static void -obj_updated_cb (CalClient *client, const char *uid, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - CalComponent *comp = NULL; - CalClientGetStatus status; - const char *edit_uid; - - priv = editor->priv; - - cal_component_get_uid (priv->comp, &edit_uid); - - if (!strcmp (uid, edit_uid) && !priv->updating) { - if (changed_component_dialog (priv->comp, FALSE, priv->changed)) { - status = cal_client_get_object (priv->client, uid, &comp); - if (status == CAL_CLIENT_GET_SUCCESS) { - comp_editor_edit_comp (editor, comp); - gtk_object_unref (GTK_OBJECT (comp)); - } else { - GtkWidget *dlg; - - dlg = gnome_error_dialog (_("Unable to obtain current version!")); - gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - } - } - } -} - -static void -obj_removed_cb (CalClient *client, const char *uid, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - const char *edit_uid; - - priv = editor->priv; - - cal_component_get_uid (priv->comp, &edit_uid); - - if (!strcmp (uid, edit_uid) && !priv->updating) { - if (changed_component_dialog (priv->comp, TRUE, priv->changed)) - close_dialog (editor); - } -} - -static gint -delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - - if (prompt_to_save_changes (editor, TRUE)) - close_dialog (editor); - - return TRUE; -} diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h deleted file mode 100644 index f789515ab1..0000000000 --- a/calendar/gui/dialogs/comp-editor.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Evolution calendar - Framework for a calendar component editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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 COMP_EDITOR_H -#define COMP_EDITOR_H - -#include <gtk/gtk.h> -#include <bonobo/bonobo-win.h> -#include <bonobo/bonobo-ui-engine.h> -#include <bonobo/bonobo-ui-component.h> -#include "cal-client.h" -#include "../itip-utils.h" -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_COMP_EDITOR (comp_editor_get_type ()) -#define COMP_EDITOR(obj) (GTK_CHECK_CAST ((obj), TYPE_COMP_EDITOR, CompEditor)) -#define COMP_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_COMP_EDITOR, CompEditorClass)) -#define IS_COMP_EDITOR(obj) (GTK_CHECK_TYPE ((obj), TYPE_COMP_EDITOR)) -#define IS_COMP_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_COMP_EDITOR)) - -typedef struct _CompEditorPrivate CompEditorPrivate; - -typedef struct { - BonoboWindow object; - - /* Private data */ - CompEditorPrivate *priv; -} CompEditor; - -typedef struct { - BonoboWindowClass parent_class; - - /* Virtual functions */ - void (* set_cal_client) (CompEditor *page, CalClient *client); - void (* edit_comp) (CompEditor *page, CalComponent *comp); - void (* send_comp) (CompEditor *page, CalComponentItipMethod method); -} CompEditorClass; - -GtkType comp_editor_get_type (void); -void comp_editor_set_changed (CompEditor *editor, - gboolean changed); -gboolean comp_editor_get_changed (CompEditor *editor); -void comp_editor_set_needs_send (CompEditor *editor, - gboolean needs_send); -gboolean comp_editor_get_needs_send (CompEditor *editor); -void comp_editor_append_page (CompEditor *editor, - CompEditorPage *page, - const char *label); -void comp_editor_remove_page (CompEditor *editor, - CompEditorPage *page); -void comp_editor_show_page (CompEditor *editor, - CompEditorPage *page); -void comp_editor_set_cal_client (CompEditor *editor, - CalClient *client); -CalClient *comp_editor_get_cal_client (CompEditor *editor); -void comp_editor_edit_comp (CompEditor *ee, - CalComponent *comp); -CalComponent *comp_editor_get_current_comp (CompEditor *editor); -gboolean comp_editor_save_comp (CompEditor *editor, - gboolean send); -void comp_editor_delete_comp (CompEditor *editor); -void comp_editor_send_comp (CompEditor *editor, - CalComponentItipMethod method); -void comp_editor_merge_ui (CompEditor *editor, - const char *filename, - BonoboUIVerb *verbs); -void comp_editor_set_ui_prop (CompEditor *editor, - const char *path, - const char *attr, - const char *val); -void comp_editor_focus (CompEditor *editor); - - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c deleted file mode 100644 index 405a9445b4..0000000000 --- a/calendar/gui/dialogs/delete-comp.c +++ /dev/null @@ -1,165 +0,0 @@ -/* Evolution calendar - Delete calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-stock.h> -#include <gal/widgets/e-unicode.h> -#include "widgets/misc/e-messagebox.h" -#include "../calendar-config.h" -#include "delete-comp.h" - - - -/** - * delete_component_dialog: - * @comp: A calendar component if a single component is to be deleted, or NULL - * if more that one component is to be deleted. - * @consider_as_untitled: If deleting more than one component, this is ignored. - * Otherwise, whether to consider the component as not having a summary; if - * FALSE then the component's summary string will be used. - * @n_comps: Number of components that are to be deleted. - * @vtype: Type of the components that are to be deleted. This is ignored - * if only one component is to be deleted, and the vtype is extracted from - * the component instead. - * @widget: A widget to use as a basis for conversion from UTF8 into font - * encoding. - * - * Pops up a dialog box asking the user whether he wants to delete a number of - * calendar components. The dialog will not appear, however, if the - * configuration option for confirmation is turned off. - * - * Return value: TRUE if the user clicked Yes, FALSE otherwise. If the - * configuration option for confirmation is turned off, this function will - * unconditionally return TRUE. - **/ -gboolean -delete_component_dialog (CalComponent *comp, - gboolean consider_as_untitled, - int n_comps, CalComponentVType vtype, - GtkWidget *widget) -{ - char *str; - GtkWidget *dialog; - - if (comp) { - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - g_return_val_if_fail (n_comps == 1, FALSE); - } else { - g_return_val_if_fail (n_comps > 1, FALSE); - g_return_val_if_fail (vtype != CAL_COMPONENT_NO_TYPE, FALSE); - } - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); - - if (!calendar_config_get_confirm_delete ()) - return TRUE; - - if (comp) { - CalComponentText summary; - char *tmp; - - vtype = cal_component_get_vtype (comp); - - if (!consider_as_untitled) { - cal_component_get_summary (comp, &summary); - tmp = e_utf8_to_gtk_string (widget, summary.value); - } else - tmp = NULL; - - switch (vtype) { - case CAL_COMPONENT_EVENT: - if (tmp) - str = g_strdup_printf (_("Are you sure you want to delete " - "the appointment `%s'?"), tmp); - else - str = g_strdup (_("Are you sure you want to delete this " - "untitled appointment?")); - break; - - case CAL_COMPONENT_TODO: - if (tmp) - str = g_strdup_printf (_("Are you sure you want to delete " - "the task `%s'?"), tmp); - else - str = g_strdup (_("Are you sure you want to delete this " - "untitled task?")); - break; - - case CAL_COMPONENT_JOURNAL: - if (tmp) - str = g_strdup_printf (_("Are you sure you want to delete " - "the journal entry `%s'?"), tmp); - else - str = g_strdup (_("Are you sure want to delete this " - "untitled journal entry?")); - break; - - default: - g_message ("delete_component_dialog(): Cannot handle object of type %d", - vtype); - g_free (tmp); - return FALSE; - } - - g_free (tmp); - } else { - switch (vtype) { - case CAL_COMPONENT_EVENT: - str = g_strdup_printf (_("Are you sure you want to delete " - "%d appointments?"), n_comps); - break; - - case CAL_COMPONENT_TODO: - str = g_strdup_printf (_("Are you sure you want to delete " - "%d tasks?"), n_comps); - break; - - case CAL_COMPONENT_JOURNAL: - str = g_strdup_printf (_("Are you sure you want to delete " - "%d journal entries?"), n_comps); - break; - - default: - g_message ("delete_component_dialog(): Cannot handle objects of type %d", - vtype); - return FALSE; - } - } - - dialog = e_message_box_new (str, E_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - g_free (str); - - gtk_widget_hide (e_message_box_get_checkbox (E_MESSAGE_BOX (dialog))); - - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == 0) - return TRUE; - else - return FALSE; -} diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h deleted file mode 100644 index 64945b5bee..0000000000 --- a/calendar/gui/dialogs/delete-comp.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Evolution calendar - Delete calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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 DELETE_COMP_H -#define DELETE_COMP_H - -#include <gtk/gtkwidget.h> -#include <cal-util/cal-component.h> - -gboolean delete_component_dialog (CalComponent *comp, - gboolean consider_as_untitled, - int n_comps, CalComponentVType vtype, - GtkWidget *widget); - -#endif diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c deleted file mode 100644 index 159d27e6a3..0000000000 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ /dev/null @@ -1,340 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Evolution calendar - Delegate selector dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Damon Chaplin <damon@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <liboaf/liboaf.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-widget.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkcombo.h> -#include <gtk/gtkentry.h> -#include <gtk/gtklabel.h> -#include <gnome.h> -#include <ical.h> -#include <glade/glade.h> -#include <widgets/misc/e-map.h> -#include <e-destination.h> -#include "Evolution-Addressbook-SelectNames.h" -#include "e-delegate-dialog.h" - -struct _EDelegateDialogPrivate { - char *name; - char *address; - - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - GtkWidget *app; - GtkWidget *hbox; - GtkWidget *addressbook; - - GNOME_Evolution_Addressbook_SelectNames corba_select_names; - GtkWidget *entry; -}; - -#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames" -static const char *section_name = "Delegate To"; - -static void e_delegate_dialog_class_init (EDelegateDialogClass *class); -static void e_delegate_dialog_init (EDelegateDialog *edd); -static void e_delegate_dialog_destroy (GtkObject *object); - -static gboolean get_widgets (EDelegateDialog *edd); -static void addressbook_clicked_cb (GtkWidget *widget, gpointer data); - -static GtkObjectClass *parent_class; - - -GtkType -e_delegate_dialog_get_type (void) -{ - static GtkType e_delegate_dialog_type = 0; - - if (!e_delegate_dialog_type) { - static const GtkTypeInfo e_delegate_dialog_info = { - "EDelegateDialog", - sizeof (EDelegateDialog), - sizeof (EDelegateDialogClass), - (GtkClassInitFunc) e_delegate_dialog_class_init, - (GtkObjectInitFunc) e_delegate_dialog_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - e_delegate_dialog_type = gtk_type_unique (GTK_TYPE_OBJECT, - &e_delegate_dialog_info); - } - - return e_delegate_dialog_type; -} - -/* Class initialization function for the event editor */ -static void -e_delegate_dialog_class_init (EDelegateDialogClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - object_class->destroy = e_delegate_dialog_destroy; -} - -/* Object initialization function for the event editor */ -static void -e_delegate_dialog_init (EDelegateDialog *edd) -{ - EDelegateDialogPrivate *priv; - - priv = g_new0 (EDelegateDialogPrivate, 1); - edd->priv = priv; - - priv->address = NULL; -} - -/* Destroy handler for the event editor */ -static void -e_delegate_dialog_destroy (GtkObject *object) -{ - EDelegateDialog *edd; - EDelegateDialogPrivate *priv; - GtkWidget *dialog; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_DELEGATE_DIALOG (object)); - - edd = E_DELEGATE_DIALOG (object); - priv = edd->priv; - - /* Destroy the actual dialog. */ - dialog = e_delegate_dialog_get_toplevel (edd); - gtk_widget_destroy (dialog); - - g_free (priv->address); - priv->address = NULL; - - g_free (priv); - edd->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - -EDelegateDialog * -e_delegate_dialog_construct (EDelegateDialog *edd, const char *name, const char *address) -{ - EDelegateDialogPrivate *priv; - EDestination *dest; - EDestination *destv[2] = {NULL, NULL}; - Bonobo_Control corba_control; - CORBA_Environment ev; - - g_return_val_if_fail (edd != NULL, NULL); - g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); - - priv = edd->priv; - - /* Load the content widgets */ - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/e-delegate-dialog.glade", - NULL); - if (!priv->xml) { - g_message ("e_delegate_dialog_construct(): Could not load the Glade XML file!"); - goto error; - } - - if (!get_widgets (edd)) { - g_message ("e_delegate_dialog_construct(): Could not find all widgets in the XML file!"); - goto error; - } - - CORBA_exception_init (&ev); - - priv->corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev); - GNOME_Evolution_Addressbook_SelectNames_addSectionWithLimit (priv->corba_select_names, - section_name, - section_name, - 1, &ev); - - if (BONOBO_EX (&ev)) { - g_message ("e_delegate_dialog_construct(): Unable to add section!"); - goto error; - } - - corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (priv->corba_select_names, - section_name, &ev); - - if (BONOBO_EX (&ev)) { - g_message ("e_delegate_dialog_construct(): Unable to get addressbook entry!"); - goto error; - } - - CORBA_exception_free (&ev); - - priv->entry = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL); - gtk_widget_show (priv->entry); - gtk_box_pack_start (GTK_BOX (priv->hbox), priv->entry, TRUE, TRUE, 0); - - dest = e_destination_new (); - destv[0] = dest; - if (name != NULL && *name) - e_destination_set_name (dest, name); - if (address != NULL && *address) - e_destination_set_email (dest, address); - bonobo_widget_set_property (BONOBO_WIDGET (priv->entry), "destinations", e_destination_exportv (destv), NULL); - gtk_object_unref (GTK_OBJECT (dest)); - - gtk_signal_connect (GTK_OBJECT (priv->addressbook), "clicked", - GTK_SIGNAL_FUNC (addressbook_clicked_cb), edd); - - return edd; - - error: - - gtk_object_unref (GTK_OBJECT (edd)); - return NULL; -} - -static gboolean -get_widgets (EDelegateDialog *edd) -{ - EDelegateDialogPrivate *priv; - - priv = edd->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->app = GW ("delegate-dialog"); - priv->hbox = GW ("delegate-hbox"); - priv->addressbook = GW ("addressbook"); - - return (priv->app - && priv->hbox - && priv->addressbook); -} - -static void -addressbook_clicked_cb (GtkWidget *widget, gpointer data) -{ - EDelegateDialog *edd = data; - EDelegateDialogPrivate *priv; - CORBA_Environment ev; - - priv = edd->priv; - - CORBA_exception_init (&ev); - - GNOME_Evolution_Addressbook_SelectNames_activateDialog (priv->corba_select_names, section_name, &ev); - - CORBA_exception_free (&ev); -} - - -/** - * e_delegate_dialog_new: - * - * Creates a new event editor dialog. - * - * Return value: A newly-created event editor dialog, or NULL if the event - * editor could not be created. - **/ -EDelegateDialog * -e_delegate_dialog_new (const char *name, const char *address) -{ - EDelegateDialog *edd; - - edd = E_DELEGATE_DIALOG (gtk_type_new (E_TYPE_DELEGATE_DIALOG)); - return e_delegate_dialog_construct (E_DELEGATE_DIALOG (edd), name, address); -} - -char * -e_delegate_dialog_get_delegate (EDelegateDialog *edd) -{ - EDelegateDialogPrivate *priv; - EDestination **destv; - char *string = NULL; - - g_return_val_if_fail (edd != NULL, NULL); - g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); - - priv = edd->priv; - - bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "destinations", &string, NULL); - destv = e_destination_importv (string); - - if (destv && destv[0] != NULL) { - g_free (priv->address); - priv->address = g_strdup (e_destination_get_email (destv[0])); - g_free (destv); - } - - g_free (string); - - return g_strdup (priv->address); -} - - -char * -e_delegate_dialog_get_delegate_name (EDelegateDialog *edd) -{ - EDelegateDialogPrivate *priv; - EDestination **destv; - char *string = NULL; - - g_return_val_if_fail (edd != NULL, NULL); - g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); - - priv = edd->priv; - - bonobo_widget_get_property (BONOBO_WIDGET (priv->entry), "destinations", &string, NULL); - destv = e_destination_importv (string); - - g_message ("importv: [%s]", string); - - if (destv && destv[0] != NULL) { - g_free (priv->name); - priv->name = g_strdup (e_destination_get_name (destv[0])); - g_free (destv); - } - - g_free (string); - - return g_strdup (priv->name); -} - -GtkWidget* -e_delegate_dialog_get_toplevel (EDelegateDialog *edd) -{ - EDelegateDialogPrivate *priv; - - g_return_val_if_fail (edd != NULL, NULL); - g_return_val_if_fail (E_IS_DELEGATE_DIALOG (edd), NULL); - - priv = edd->priv; - - return priv->app; -} - diff --git a/calendar/gui/dialogs/e-delegate-dialog.glade b/calendar/gui/dialogs/e-delegate-dialog.glade deleted file mode 100644 index 394c191682..0000000000 --- a/calendar/gui/dialogs/e-delegate-dialog.glade +++ /dev/null @@ -1,120 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>timezone-dialog</name> - <program_name>timezone-dialog</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GnomeDialog</class> - <name>delegate-dialog</name> - <visible>False</visible> - <title>Enter Delegate</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>True</auto_close> - <hide_on_close>True</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>dialog-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>ok-button</name> - <can_default>True</can_default> - <has_default>True</has_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>cancel-button</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>delegate-hbox</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label3</name> - <label>Delegate To:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>addressbook</name> - <can_focus>True</can_focus> - <label>Addressbook...</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - <pack>GTK_PACK_END</pack> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h deleted file mode 100644 index 311d22b4c7..0000000000 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Evolution calendar - Delegate selector dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: JP Rosevear <jpr@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef __E_DELEGATE_DIALOG_H__ -#define __E_DELEGATE_DIALOG_H__ - -#include <libgnome/gnome-defs.h> -#include <gtk/gtkwidget.h> - - - -#define E_TYPE_DELEGATE_DIALOG (e_delegate_dialog_get_type ()) -#define E_DELEGATE_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialog)) -#define E_DELEGATE_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_DELEGATE_DIALOG, \ - EDelegateDialogClass)) -#define E_IS_DELEGATE_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_DELEGATE_DIALOG)) -#define E_IS_DELEGATE_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_DELEGATE_DIALOG)) - - -typedef struct _EDelegateDialog EDelegateDialog; -typedef struct _EDelegateDialogClass EDelegateDialogClass; -typedef struct _EDelegateDialogPrivate EDelegateDialogPrivate; - -struct _EDelegateDialog { - GtkObject object; - - /* Private data */ - EDelegateDialogPrivate *priv; -}; - -struct _EDelegateDialogClass { - GtkObjectClass parent_class; -}; - -GtkType e_delegate_dialog_get_type (void); - -EDelegateDialog* e_delegate_dialog_construct (EDelegateDialog *etd, - const char *name, - const char *address); - -EDelegateDialog* e_delegate_dialog_new (const char *name, - const char *address); - -char* e_delegate_dialog_get_delegate (EDelegateDialog *etd); - -char* e_delegate_dialog_get_delegate_name (EDelegateDialog *etd); - -void e_delegate_dialog_set_delegate (EDelegateDialog *etd, - const char *address); - -GtkWidget* e_delegate_dialog_get_toplevel (EDelegateDialog *etd); - - - - -#endif /* __E_DELEGATE_DIALOG_H__ */ diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c deleted file mode 100644 index 1c70b36858..0000000000 --- a/calendar/gui/dialogs/event-editor.c +++ /dev/null @@ -1,430 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Event 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> - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <string.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include <libgnome/gnome-i18n.h> -#include <widgets/misc/e-dateedit.h> - -#include "event-page.h" -#include "alarm-page.h" -#include "recurrence-page.h" -#include "meeting-page.h" -#include "schedule-page.h" -#include "cancel-comp.h" -#include "event-editor.h" - -struct _EventEditorPrivate { - EventPage *event_page; - AlarmPage *alarm_page; - RecurrencePage *recur_page; - MeetingPage *meet_page; - SchedulePage *sched_page; - - EMeetingModel *model; - - gboolean meeting_shown; - gboolean existing_org; - gboolean updating; -}; - - - -static void event_editor_class_init (EventEditorClass *class); -static void event_editor_init (EventEditor *ee); -static void event_editor_set_cal_client (CompEditor *editor, CalClient *client); -static void event_editor_edit_comp (CompEditor *editor, CalComponent *comp); -static void event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); -static void event_editor_destroy (GtkObject *object); - -static void schedule_meeting_cmd (GtkWidget *widget, gpointer data); -static void refresh_meeting_cmd (GtkWidget *widget, gpointer data); -static void cancel_meeting_cmd (GtkWidget *widget, gpointer data); -static void forward_cmd (GtkWidget *widget, gpointer data); - -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); - -static BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ActionScheduleMeeting", schedule_meeting_cmd), - BONOBO_UI_UNSAFE_VERB ("ActionRefreshMeeting", refresh_meeting_cmd), - BONOBO_UI_UNSAFE_VERB ("ActionCancelMeeting", cancel_meeting_cmd), - BONOBO_UI_UNSAFE_VERB ("ActionForward", forward_cmd), - - BONOBO_UI_VERB_END -}; - -static CompEditorClass *parent_class; - - - -/** - * event_editor_get_type: - * - * Registers the #EventEditor class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #EventEditor class. - **/ -GtkType -event_editor_get_type (void) -{ - static GtkType event_editor_type = 0; - - if (!event_editor_type) { - static const GtkTypeInfo event_editor_info = { - "EventEditor", - sizeof (EventEditor), - sizeof (EventEditorClass), - (GtkClassInitFunc) event_editor_class_init, - (GtkObjectInitFunc) event_editor_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - event_editor_type = gtk_type_unique (TYPE_COMP_EDITOR, - &event_editor_info); - } - - return event_editor_type; -} - -/* Class initialization function for the event editor */ -static void -event_editor_class_init (EventEditorClass *klass) -{ - GtkObjectClass *object_class; - CompEditorClass *editor_class; - - object_class = (GtkObjectClass *) klass; - editor_class = (CompEditorClass *) klass; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR); - - editor_class->set_cal_client = event_editor_set_cal_client; - editor_class->edit_comp = event_editor_edit_comp; - editor_class->send_comp = event_editor_send_comp; - - object_class->destroy = event_editor_destroy; -} - -static void -set_menu_sens (EventEditor *ee) -{ - EventEditorPrivate *priv; - gboolean sens; - - priv = ee->priv; - - sens = priv->meeting_shown; - comp_editor_set_ui_prop (COMP_EDITOR (ee), - "/commands/ActionScheduleMeeting", - "sensitive", sens ? "0" : "1"); - - sens = sens && priv->existing_org; - comp_editor_set_ui_prop (COMP_EDITOR (ee), - "/commands/ActionRefreshMeeting", - "sensitive", sens ? "1" : "0"); - comp_editor_set_ui_prop (COMP_EDITOR (ee), - "/commands/ActionCancelMeeting", - "sensitive", sens ? "1" : "0"); -} - -static void -init_widgets (EventEditor *ee) -{ - EventEditorPrivate *priv; - - priv = ee->priv; - - gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed", - GTK_SIGNAL_FUNC (model_row_changed_cb), ee); - gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted", - GTK_SIGNAL_FUNC (row_count_changed_cb), ee); - gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted", - GTK_SIGNAL_FUNC (row_count_changed_cb), ee); -} - -/* Object initialization function for the event editor */ -static void -event_editor_init (EventEditor *ee) -{ - EventEditorPrivate *priv; - - priv = g_new0 (EventEditorPrivate, 1); - ee->priv = priv; - - priv->event_page = event_page_new (); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->event_page), - _("Appointment")); - - priv->alarm_page = alarm_page_new (); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->alarm_page), - _("Reminder")); - - priv->recur_page = recurrence_page_new (); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->recur_page), - _("Recurrence")); - - priv->model = E_MEETING_MODEL (e_meeting_model_new ()); - - priv->sched_page = schedule_page_new (priv->model); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->sched_page), - _("Scheduling")); - - priv->meet_page = meeting_page_new (priv->model); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->meet_page), - _("Meeting")); - - comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs); - - priv->meeting_shown = TRUE; - priv->existing_org = FALSE; - priv->updating = FALSE; - - init_widgets (ee); - set_menu_sens (ee); -} - -static void -event_editor_set_cal_client (CompEditor *editor, CalClient *client) -{ - EventEditor *ee; - EventEditorPrivate *priv; - - ee = EVENT_EDITOR (editor); - priv = ee->priv; - - e_meeting_model_set_cal_client (priv->model, client); - - if (parent_class->set_cal_client) - parent_class->set_cal_client (editor, client); -} - -static void -event_editor_edit_comp (CompEditor *editor, CalComponent *comp) -{ - EventEditor *ee; - EventEditorPrivate *priv; - GSList *attendees = NULL; - - ee = EVENT_EDITOR (editor); - priv = ee->priv; - - priv->updating = TRUE; - - priv->existing_org = cal_component_has_organizer (comp); - cal_component_get_attendee_list (comp, &attendees); - - e_meeting_model_remove_all_attendees (priv->model); - if (attendees == NULL) { - comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); - comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->sched_page)); - priv->meeting_shown = FALSE; - } else { - GSList *l; - - if (!priv->meeting_shown) { - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->sched_page), - _("Scheduling")); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->meet_page), - _("Meeting")); - } - - for (l = attendees; l != NULL; l = l->next) { - CalComponentAttendee *ca = l->data; - EMeetingAttendee *ia; - - 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)); - } - priv->meeting_shown = TRUE; - } - cal_component_free_attendee_list (attendees); - - set_menu_sens (ee); - comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown); - - priv->updating = FALSE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); -} - -static void -event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) -{ - EventEditor *ee = EVENT_EDITOR (editor); - EventEditorPrivate *priv; - CalComponent *comp = NULL; - - priv = ee->priv; - - /* Don't cancel more than once or when just publishing */ - if (method == CAL_COMPONENT_METHOD_PUBLISH || - method == CAL_COMPONENT_METHOD_CANCEL) - goto parent; - - comp = meeting_page_get_cancel_comp (priv->meet_page); - if (comp != NULL) { - itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp); - gtk_object_unref (GTK_OBJECT (comp)); - } - - parent: - if (parent_class->send_comp) - parent_class->send_comp (editor, method); -} - -/* Destroy handler for the event editor */ -static void -event_editor_destroy (GtkObject *object) -{ - EventEditor *ee; - EventEditorPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EVENT_EDITOR (object)); - - ee = EVENT_EDITOR (object); - priv = ee->priv; - - gtk_object_unref (GTK_OBJECT (priv->event_page)); - gtk_object_unref (GTK_OBJECT (priv->alarm_page)); - gtk_object_unref (GTK_OBJECT (priv->recur_page)); - gtk_object_unref (GTK_OBJECT (priv->meet_page)); - gtk_object_unref (GTK_OBJECT (priv->sched_page)); - - gtk_object_destroy (GTK_OBJECT (priv->model)); - gtk_object_unref (GTK_OBJECT (priv->model)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/** - * event_editor_new: - * - * Creates a new event editor dialog. - * - * Return value: A newly-created event editor dialog, or NULL if the event - * editor could not be created. - **/ -EventEditor * -event_editor_new (void) -{ - return EVENT_EDITOR (gtk_type_new (TYPE_EVENT_EDITOR)); -} - -static void -schedule_meeting_cmd (GtkWidget *widget, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - EventEditorPrivate *priv; - - priv = ee->priv; - - if (!priv->meeting_shown) { - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->sched_page), - _("Scheduling")); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->meet_page), - _("Meeting")); - priv->meeting_shown = TRUE; - - set_menu_sens (ee); - comp_editor_set_changed (COMP_EDITOR (ee), priv->meeting_shown); - comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown); - } - - comp_editor_show_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->meet_page)); -} - -static void -refresh_meeting_cmd (GtkWidget *widget, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - - comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_REFRESH); -} - -static void -cancel_meeting_cmd (GtkWidget *widget, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - CalComponent *comp; - - comp = comp_editor_get_current_comp (COMP_EDITOR (ee)); - if (cancel_component_dialog (comp)) { - comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_CANCEL); - comp_editor_delete_comp (COMP_EDITOR (ee)); - } -} - -static void -forward_cmd (GtkWidget *widget, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - - if (comp_editor_save_comp (COMP_EDITOR (ee), TRUE)) - comp_editor_send_comp (COMP_EDITOR (ee), CAL_COMPONENT_METHOD_PUBLISH); -} - -static void -model_row_changed_cb (ETableModel *etm, int row, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - EventEditorPrivate *priv; - - priv = ee->priv; - - if (!priv->updating) - comp_editor_set_changed (COMP_EDITOR (ee), TRUE); -} - -static void -row_count_changed_cb (ETableModel *etm, int row, int count, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - EventEditorPrivate *priv; - - priv = ee->priv; - - if (!priv->updating) - comp_editor_set_changed (COMP_EDITOR (ee), TRUE); -} diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h deleted file mode 100644 index f32877c864..0000000000 --- a/calendar/gui/dialogs/event-editor.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Evolution calendar - Event 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> - * - * 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. - * - * 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 __EVENT_EDITOR_H__ -#define __EVENT_EDITOR_H__ - -#include <libgnome/gnome-defs.h> -#include <gtk/gtkobject.h> -#include "comp-editor.h" - - - -#define TYPE_EVENT_EDITOR (event_editor_get_type ()) -#define EVENT_EDITOR(obj) (GTK_CHECK_CAST ((obj), TYPE_EVENT_EDITOR, EventEditor)) -#define EVENT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_EVENT_EDITOR, EventEditorClass)) -#define IS_EVENT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), TYPE_EVENT_EDITOR)) -#define IS_EVENT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_EVENT_EDITOR)) - -typedef struct _EventEditor EventEditor; -typedef struct _EventEditorClass EventEditorClass; -typedef struct _EventEditorPrivate EventEditorPrivate; - -struct _EventEditor { - CompEditor parent; - - /* Private data */ - EventEditorPrivate *priv; -}; - -struct _EventEditorClass { - CompEditorClass parent_class; -}; - -GtkType event_editor_get_type (void); -EventEditor *event_editor_construct (EventEditor *ee); -EventEditor *event_editor_new (void); - - - -#endif /* __EVENT_EDITOR_H__ */ diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c deleted file mode 100644 index a12bce2c47..0000000000 --- a/calendar/gui/dialogs/event-page.c +++ /dev/null @@ -1,1439 +0,0 @@ -/* Evolution calendar - Main page of the event editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtksignal.h> -#include <gtk/gtktogglebutton.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-categories.h> -#include "e-util/e-categories-config.h" -#include "e-util/e-dialog-widgets.h" -#include "widgets/misc/e-dateedit.h" -#include "cal-util/timeutil.h" -#include "../calendar-config.h" -#include "../e-timezone-entry.h" -#include "comp-editor-util.h" -#include "event-page.h" - - - -/* Private part of the EventPage structure */ -struct _EventPagePrivate { - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - - GtkWidget *main; - - GtkWidget *summary; - GtkWidget *location; - - GtkWidget *start_time; - GtkWidget *end_time; - GtkWidget *start_timezone; - GtkWidget *end_timezone; - GtkWidget *all_day_event; - - GtkWidget *description; - - GtkWidget *classification_public; - GtkWidget *classification_private; - GtkWidget *classification_confidential; - - GtkWidget *show_time_as_free; - GtkWidget *show_time_as_busy; - - GtkWidget *contacts_btn; - GtkWidget *contacts_box; - - GtkWidget *categories_btn; - GtkWidget *categories; - - gboolean updating; - - /* This is TRUE if both the start & end timezone are the same. If the - start timezone is then changed, we updated the end timezone to the - same value, since 99% of events start and end in one timezone. */ - gboolean sync_timezones; - - /* The Corba component for selecting contacts, and the entry field - which we place in the dialog. */ - GNOME_Evolution_Addressbook_SelectNames corba_select_names; - GtkWidget *contacts_entry; -}; - - - -static void event_page_class_init (EventPageClass *class); -static void event_page_init (EventPage *epage); -static void event_page_destroy (GtkObject *object); - -static GtkWidget *event_page_get_widget (CompEditorPage *page); -static void event_page_focus_main_widget (CompEditorPage *page); -static void event_page_fill_widgets (CompEditorPage *page, CalComponent *comp); -static gboolean event_page_fill_component (CompEditorPage *page, CalComponent *comp); -static void event_page_set_summary (CompEditorPage *page, const char *summary); -static void event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); - -static CompEditorPageClass *parent_class = NULL; - - - -/** - * event_page_get_type: - * - * Registers the #EventPage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #EventPage class. - **/ -GtkType -event_page_get_type (void) -{ - static GtkType event_page_type; - - if (!event_page_type) { - static const GtkTypeInfo event_page_info = { - "EventPage", - sizeof (EventPage), - sizeof (EventPageClass), - (GtkClassInitFunc) event_page_class_init, - (GtkObjectInitFunc) event_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - event_page_type = gtk_type_unique (TYPE_COMP_EDITOR_PAGE, - &event_page_info); - } - - return event_page_type; -} - -/* Class initialization function for the event page */ -static void -event_page_class_init (EventPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GtkObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); - - editor_page_class->get_widget = event_page_get_widget; - editor_page_class->focus_main_widget = event_page_focus_main_widget; - editor_page_class->fill_widgets = event_page_fill_widgets; - editor_page_class->fill_component = event_page_fill_component; - editor_page_class->set_summary = event_page_set_summary; - editor_page_class->set_dates = event_page_set_dates; - - object_class->destroy = event_page_destroy; -} - -/* Object initialization function for the event page */ -static void -event_page_init (EventPage *epage) -{ - EventPagePrivate *priv; - - priv = g_new0 (EventPagePrivate, 1); - epage->priv = priv; - - priv->xml = NULL; - - priv->main = NULL; - priv->summary = NULL; - priv->location = NULL; - priv->start_time = NULL; - priv->end_time = NULL; - priv->start_timezone = NULL; - priv->end_timezone = NULL; - priv->all_day_event = NULL; - priv->description = NULL; - priv->classification_public = NULL; - priv->classification_private = NULL; - priv->classification_confidential = NULL; - priv->show_time_as_free = NULL; - priv->show_time_as_busy = NULL; - priv->contacts_btn = NULL; - priv->contacts_box = NULL; - priv->categories_btn = NULL; - priv->categories = NULL; - - priv->updating = FALSE; - priv->sync_timezones = FALSE; - - priv->corba_select_names = CORBA_OBJECT_NIL; - priv->contacts_entry = NULL; -} - -/* Destroy handler for the event page */ -static void -event_page_destroy (GtkObject *object) -{ - EventPage *epage; - EventPagePrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_EVENT_PAGE (object)); - - epage = EVENT_PAGE (object); - priv = epage->priv; - - if (priv->corba_select_names != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->corba_select_names, &ev); - CORBA_exception_free (&ev); - } - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - g_free (priv); - epage->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -static const int classification_map[] = { - CAL_COMPONENT_CLASS_PUBLIC, - CAL_COMPONENT_CLASS_PRIVATE, - CAL_COMPONENT_CLASS_CONFIDENTIAL, - -1 -}; - -static const int transparency_map[] = { - CAL_COMPONENT_TRANSP_TRANSPARENT, - CAL_COMPONENT_TRANSP_OPAQUE, - -1 -}; - -/* get_widget handler for the event page */ -static GtkWidget * -event_page_get_widget (CompEditorPage *page) -{ - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (page); - priv = epage->priv; - - return priv->main; -} - -/* focus_main_widget handler for the event page */ -static void -event_page_focus_main_widget (CompEditorPage *page) -{ - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (page); - priv = epage->priv; - - gtk_widget_grab_focus (priv->summary); -} - -/* Sets the 'All Day Event' flag to the given value (without emitting signals), - * and shows or hides the widgets as appropriate. */ -static void -set_all_day (EventPage *epage, gboolean all_day) -{ - EventPagePrivate *priv; - - priv = epage->priv; - - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->all_day_event), - epage); - e_dialog_toggle_set (priv->all_day_event, all_day); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->all_day_event), - epage); - - e_date_edit_set_show_time (E_DATE_EDIT (priv->start_time), !all_day); - e_date_edit_set_show_time (E_DATE_EDIT (priv->end_time), !all_day); - - /* DATE values do not have timezones, so we hide the fields. */ - if (all_day) { - gtk_widget_hide (priv->start_timezone); - gtk_widget_hide (priv->end_timezone); - } else { - gtk_widget_show (priv->start_timezone); - gtk_widget_show (priv->end_timezone); - } -} - -static void -update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDateTime *end_date) -{ - EventPagePrivate *priv; - struct icaltimetype *start_tt, *end_tt; - icaltimezone *start_zone = NULL, *end_zone = NULL; - CalClientGetStatus status; - gboolean all_day_event; - - priv = epage->priv; - - /* Note that if we are creating a new event, the timezones may not be - on the server, so we try to get the builtin timezone with the TZID - first. */ - start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid); - if (!start_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client, - start_date->tzid, - &start_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - start_date->tzid ? start_date->tzid : ""); - } - - end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid); - if (!end_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client, - end_date->tzid, - &end_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - end_date->tzid ? end_date->tzid : ""); - } - - /* If both times are DATE values, we set the 'All Day Event' checkbox. - Also, if DTEND is after DTSTART, we subtract 1 day from it. */ - all_day_event = FALSE; - start_tt = start_date->value; - end_tt = end_date->value; - if (start_tt->is_date && end_tt->is_date) { - all_day_event = TRUE; - if (icaltime_compare_date_only (*end_tt, *start_tt) > 0) { - icaltime_adjust (end_tt, -1, 0, 0, 0); - } - } - - set_all_day (epage, all_day_event); - - /* If it is an all day event, we set both timezones to the current - timezone, so that if the user toggles the 'All Day Event' checkbox - the event uses the current timezone rather than none at all. */ - if (all_day_event) { - char *location = calendar_config_get_timezone (); - start_zone = end_zone = icaltimezone_get_builtin_timezone (location); - } - - - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), - epage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), epage); - - e_date_edit_set_date (E_DATE_EDIT (priv->start_time), start_tt->year, - start_tt->month, start_tt->day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_time), - start_tt->hour, start_tt->minute); - - e_date_edit_set_date (E_DATE_EDIT (priv->end_time), end_tt->year, - end_tt->month, end_tt->day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->end_time), - end_tt->hour, end_tt->minute); - - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), - epage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), - epage); - - /* Set the timezones, and set sync_timezones to TRUE if both timezones - are the same. */ - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_timezone), - epage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_timezone), epage); - - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), - start_zone); - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), - end_zone); - - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_timezone), - epage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_timezone), - epage); - - priv->sync_timezones = (start_zone == end_zone) ? TRUE : FALSE; - -} - -/* Fills the widgets with default values */ -static void -clear_widgets (EventPage *epage) -{ - EventPagePrivate *priv; - - priv = epage->priv; - - /* Summary, description */ - e_dialog_editable_set (priv->summary, NULL); - e_dialog_editable_set (priv->location, NULL); - e_dialog_editable_set (priv->description, NULL); - - /* Start and end times */ - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), - epage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), epage); - - e_date_edit_set_time (E_DATE_EDIT (priv->start_time), 0); - e_date_edit_set_time (E_DATE_EDIT (priv->end_time), 0); - - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), - epage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), - epage); - - set_all_day (epage, FALSE); - - /* Classification */ - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PRIVATE, classification_map); - - /* Show Time As (Transparency) */ - e_dialog_radio_set (priv->show_time_as_free, - CAL_COMPONENT_TRANSP_OPAQUE, transparency_map); - - /* Categories */ - e_dialog_editable_set (priv->categories, NULL); -} - - -static void -contacts_changed_cb (BonoboListener *listener, - char *event_name, - CORBA_any *arg, - CORBA_Environment *ev, - gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; - -#if 0 - g_print ("In contacts_changed_cb\n"); -#endif - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage)); -} - - -/* fill_widgets handler for the event page */ -static void -event_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - EventPage *epage; - EventPagePrivate *priv; - CalComponentText text; - CalComponentClassification cl; - CalComponentTransparency transparency; - CalComponentDateTime start_date, end_date; - const char *location; - const char *categories; - GSList *l; - - g_return_if_fail (page->client != NULL); - - epage = EVENT_PAGE (page); - priv = epage->priv; - - /* Don't send off changes during this time */ - priv->updating = TRUE; - - /* Clean the page */ - clear_widgets (epage); - - /* Summary, location, description(s) */ - - cal_component_get_summary (comp, &text); - e_dialog_editable_set (priv->summary, text.value); - - cal_component_get_location (comp, &location); - e_dialog_editable_set (priv->location, location); - - cal_component_get_description_list (comp, &l); - if (l) { - text = *(CalComponentText *)l->data; - e_dialog_editable_set (priv->description, text.value); - } - cal_component_free_text_list (l); - - /* Start and end times */ - - cal_component_get_dtstart (comp, &start_date); - cal_component_get_dtend (comp, &end_date); - - update_time (epage, &start_date, &end_date); - - cal_component_free_datetime (&start_date); - cal_component_free_datetime (&end_date); - - /* Classification */ - - cal_component_get_classification (comp, &cl); - - switch (cl) { - case CAL_COMPONENT_CLASS_PUBLIC: - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PUBLIC, - classification_map); - break; - - case CAL_COMPONENT_CLASS_PRIVATE: - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PRIVATE, - classification_map); - break; - - case CAL_COMPONENT_CLASS_CONFIDENTIAL: - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_CONFIDENTIAL, - classification_map); - break; - - default: - /* default to PUBLIC */ - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PUBLIC, - classification_map); - break; - } - - - /* Show Time As (Transparency) */ - cal_component_get_transparency (comp, &transparency); - switch (transparency) { - case CAL_COMPONENT_TRANSP_TRANSPARENT: - e_dialog_radio_set (priv->show_time_as_free, - CAL_COMPONENT_TRANSP_TRANSPARENT, - transparency_map); - break; - - default: - e_dialog_radio_set (priv->show_time_as_free, - CAL_COMPONENT_TRANSP_OPAQUE, - transparency_map); - break; - } - - - - /* Categories */ - cal_component_get_categories (comp, &categories); - e_dialog_editable_set (priv->categories, categories); - - /* Contacts */ - comp_editor_contacts_to_widget (priv->contacts_entry, comp); - - /* We connect the contacts changed signal here, as we have to be a bit - more careful with it due to the use of Corba. The priv->updating - flag won't work as we won't get the changed event immediately. - FIXME: Unfortunately this doesn't work either. We never get the - changed event now. */ - comp_editor_connect_contacts_changed (priv->contacts_entry, - contacts_changed_cb, epage); - - priv->updating = FALSE; -} - -/* fill_component handler for the event page */ -static gboolean -event_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - EventPage *epage; - EventPagePrivate *priv; - CalComponentDateTime start_date, end_date; - struct icaltimetype start_tt, end_tt; - gboolean all_day_event, start_date_set, end_date_set; - char *cat, *str; - CalComponentClassification classif; - CalComponentTransparency transparency; - - epage = EVENT_PAGE (page); - priv = epage->priv; - - /* Summary */ - - str = e_dialog_editable_get (priv->summary); - if (!str || strlen (str) == 0) - cal_component_set_summary (comp, NULL); - else { - CalComponentText text; - - text.value = str; - text.altrep = NULL; - - cal_component_set_summary (comp, &text); - } - - if (str) - g_free (str); - - /* Location */ - - str = e_dialog_editable_get (priv->location); - if (!str || strlen (str) == 0) - cal_component_set_location (comp, NULL); - else - cal_component_set_location (comp, str); - - if (str) - g_free (str); - - /* Description */ - - str = e_dialog_editable_get (priv->description); - if (!str || strlen (str) == 0) - cal_component_set_description_list (comp, NULL); - else { - GSList l; - CalComponentText text; - - text.value = str; - text.altrep = NULL; - l.data = &text; - l.next = NULL; - - cal_component_set_description_list (comp, &l); - } - - if (str) - g_free (str); - - /* Dates */ - - start_tt = icaltime_null_time (); - start_date.value = &start_tt; - start_date.tzid = NULL; - - end_tt = icaltime_null_time (); - end_date.value = &end_tt; - end_date.tzid = NULL; - - start_date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time), - &start_tt.year, - &start_tt.month, - &start_tt.day); - g_assert (start_date_set); - - end_date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time), - &end_tt.year, - &end_tt.month, - &end_tt.day); - g_assert (end_date_set); - - /* If the all_day toggle is set, we use DATE values for DTSTART and - DTEND. If not, we fetch the hour & minute from the widgets. */ - all_day_event = e_dialog_toggle_get (priv->all_day_event); - - if (all_day_event) { - start_tt.is_date = TRUE; - end_tt.is_date = TRUE; - - /* We have to add 1 day to DTEND, as it is not inclusive. */ - icaltime_adjust (&end_tt, 1, 0, 0, 0); - } else { - icaltimezone *start_zone, *end_zone; - - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), - &start_tt.hour, - &start_tt.minute); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_time), - &end_tt.hour, - &end_tt.minute); - start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - start_date.tzid = icaltimezone_get_tzid (start_zone); - end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); - end_date.tzid = icaltimezone_get_tzid (end_zone); - } - - cal_component_set_dtstart (comp, &start_date); - cal_component_set_dtend (comp, &end_date); - - - /* Categories */ - - cat = e_dialog_editable_get (priv->categories); - str = comp_editor_strip_categories (cat); - if (cat) - g_free (cat); - - cal_component_set_categories (comp, str); - - if (str) - g_free (str); - - /* Classification */ - - classif = e_dialog_radio_get (priv->classification_public, - classification_map); - cal_component_set_classification (comp, classif); - - /* Show Time As (Transparency) */ - - transparency = e_dialog_radio_get (priv->show_time_as_free, - transparency_map); - cal_component_set_transparency (comp, transparency); - - /* Contacts */ - - comp_editor_contacts_to_component (priv->contacts_entry, comp); - - return TRUE; -} - -/* set_summary handler for the event page */ -static void -event_page_set_summary (CompEditorPage *page, const char *summary) -{ - /* nothing */ -} - -static void -event_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - update_time (EVENT_PAGE (page), dates->start, dates->end); -} - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (EventPage *epage) -{ - CompEditorPage *page = COMP_EDITOR_PAGE (epage); - EventPagePrivate *priv; - GSList *accel_groups; - GtkWidget *toplevel; - - priv = epage->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->main = GW ("event-page"); - if (!priv->main) - return FALSE; - - /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ - toplevel = gtk_widget_get_toplevel (priv->main); - accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_widget_unparent (priv->main); - - priv->summary = GW ("general-summary"); - priv->location = GW ("location"); - - priv->start_time = GW ("start-time"); - priv->end_time = GW ("end-time"); - priv->start_timezone = GW ("start-timezone"); - priv->end_timezone = GW ("end-timezone"); - priv->all_day_event = GW ("all-day-event"); - - priv->description = GW ("description"); - - priv->classification_public = GW ("classification-public"); - priv->classification_private = GW ("classification-private"); - priv->classification_confidential = GW ("classification-confidential"); - - priv->show_time_as_free = GW ("show-time-as-free"); - priv->show_time_as_busy = GW ("show-time-as-busy"); - - priv->contacts_btn = GW ("contacts-button"); - priv->contacts_box = GW ("contacts-box"); - - priv->categories_btn = GW ("categories-button"); - priv->categories = GW ("categories"); - -#undef GW - - return (priv->summary - && priv->location - && priv->start_time - && priv->end_time - && priv->start_timezone - && priv->end_timezone - && priv->all_day_event - && priv->description - && priv->classification_public - && priv->classification_private - && priv->classification_confidential - && priv->show_time_as_free - && priv->show_time_as_busy - && priv->contacts_btn - && priv->contacts_box - && priv->categories_btn - && priv->categories); -} - -/* Callback used when the summary changes; we emit the notification signal. */ -static void -summary_changed_cb (GtkEditable *editable, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - gchar *summary; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - if (priv->updating) - return; - - summary = e_dialog_editable_get (GTK_WIDGET (editable)); - comp_editor_page_notify_summary_changed (COMP_EDITOR_PAGE (epage), - summary); - g_free (summary); -} - - -/* Note that this assumes that the start_tt and end_tt passed to it are the - dates visible to the user. For DATE values, we have to add 1 day to the - end_tt before emitting the signal. */ -static void -notify_dates_changed (EventPage *epage, struct icaltimetype *start_tt, - struct icaltimetype *end_tt) -{ - EventPagePrivate *priv; - CompEditorPageDates dates; - CalComponentDateTime start_dt, end_dt; - gboolean all_day_event; - icaltimezone *start_zone = NULL, *end_zone = NULL; - - priv = epage->priv; - - all_day_event = e_dialog_toggle_get (priv->all_day_event); - - start_dt.value = start_tt; - end_dt.value = end_tt; - - if (all_day_event) { - /* The actual DTEND is 1 day after the displayed date for - DATE values. */ - icaltime_adjust (end_tt, 1, 0, 0, 0); - } else { - start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); - } - - start_dt.tzid = start_zone ? icaltimezone_get_tzid (start_zone) : NULL; - end_dt.tzid = end_zone ? icaltimezone_get_tzid (end_zone) : NULL; - - dates.start = &start_dt; - dates.end = &end_dt; - - dates.due = NULL; - dates.complete = NULL; - - comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (epage), - &dates); -} - - -static gboolean -check_start_before_end (struct icaltimetype *start_tt, - icaltimezone *start_zone, - struct icaltimetype *end_tt, - icaltimezone *end_zone, - gboolean adjust_end_time) -{ - struct icaltimetype end_tt_copy; - int cmp; - - /* Convert the end time to the same timezone as the start time. */ - end_tt_copy = *end_tt; - icaltimezone_convert_time (&end_tt_copy, end_zone, start_zone); - - /* Now check if the start time is after the end time. If it is, - we need to modify one of the times. */ - cmp = icaltime_compare (*start_tt, end_tt_copy); - if (cmp > 0) { - if (adjust_end_time) { - /* Modify the end time, to be the start + 1 hour. */ - *end_tt = *start_tt; - icaltime_adjust (end_tt, 0, 1, 0, 0); - icaltimezone_convert_time (end_tt, start_zone, - end_zone); - } else { - /* Modify the start time, to be the end - 1 hour. */ - *start_tt = *end_tt; - icaltime_adjust (start_tt, 0, -1, 0, 0); - icaltimezone_convert_time (start_tt, end_zone, - start_zone); - } - return TRUE; - } - - return FALSE; -} - - -/* - * This is called whenever the start or end dates or timezones is changed. - * It makes sure that the start date < end date. It also emits the notification - * signals so the other event editor pages update their labels etc. - * - * If adjust_end_time is TRUE, if the start time < end time it will adjust - * the end time. If FALSE it will adjust the start time. If the user sets the - * start or end time, the other time is adjusted to make it valid. - */ -static void -times_updated (EventPage *epage, gboolean adjust_end_time) -{ - EventPagePrivate *priv; - struct icaltimetype start_tt = icaltime_null_time(); - struct icaltimetype end_tt = icaltime_null_time(); - gboolean date_set, all_day_event; - gboolean set_start_date = FALSE, set_end_date = FALSE; - icaltimezone *start_zone, *end_zone; - - priv = epage->priv; - - if (priv->updating) - return; - - /* Fetch the start and end times and timezones from the widgets. */ - all_day_event = e_dialog_toggle_get (priv->all_day_event); - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time), - &start_tt.year, - &start_tt.month, - &start_tt.day); - g_assert (date_set); - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time), - &end_tt.year, - &end_tt.month, - &end_tt.day); - g_assert (date_set); - - if (all_day_event) { - /* All Day Events are simple. We just compare the dates and if - start > end we copy one of them to the other. */ - int cmp = icaltime_compare_date_only (start_tt, end_tt); - if (cmp > 0) { - if (adjust_end_time) { - end_tt = start_tt; - set_end_date = TRUE; - } else { - start_tt = end_tt; - set_start_date = TRUE; - } - } - - start_tt.is_date = TRUE; - end_tt.is_date = TRUE; - } else { - /* For DATE-TIME events, we have to convert to the same - timezone before comparing. */ - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), - &start_tt.hour, - &start_tt.minute); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_time), - &end_tt.hour, - &end_tt.minute); - - start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); - - if (check_start_before_end (&start_tt, start_zone, - &end_tt, end_zone, - adjust_end_time)) { - if (adjust_end_time) - set_end_date = TRUE; - else - set_start_date = TRUE; - } - } - - - if (set_start_date) { - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), epage); - e_date_edit_set_date (E_DATE_EDIT (priv->start_time), - start_tt.year, start_tt.month, - start_tt.day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_time), - start_tt.hour, start_tt.minute); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), epage); - } - - if (set_end_date) { - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), epage); - e_date_edit_set_date (E_DATE_EDIT (priv->end_time), - end_tt.year, end_tt.month, end_tt.day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->end_time), - end_tt.hour, end_tt.minute); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), epage); - } - - /* Notify upstream */ - notify_dates_changed (epage, &start_tt, &end_tt); -} - -/* Callback used when the start or end date widgets change. We check that the - * start date < end date and we set the "all day event" button as appropriate. - */ -static void -date_changed_cb (GtkWidget *dedit, gpointer data) -{ - EventPage *epage; - - epage = EVENT_PAGE (data); - - times_updated (epage, dedit == epage->priv->start_time); -} - - -/* Callback used when the start timezone is changed. If sync_timezones is set, - * we set the end timezone to the same value. It also updates the start time - * labels on the other notebook pages. - */ -static void -start_timezone_changed_cb (GtkWidget *widget, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - icaltimezone *zone; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - if (priv->sync_timezones) { - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - priv->updating = TRUE; - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone); - priv->updating = FALSE; - } - - times_updated (epage, TRUE); -} - - -/* Callback used when the end timezone is changed. It checks if the end - * timezone is the same as the start timezone and sets sync_timezones if so. - */ -static void -end_timezone_changed_cb (GtkWidget *widget, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - icaltimezone *start_zone, *end_zone; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); - - priv->sync_timezones = (start_zone == end_zone) ? TRUE : FALSE; - - times_updated (epage, TRUE); -} - -/* Callback: all day event button toggled. - * Note that this should only be called when the user explicitly toggles the - * button. Be sure to block this handler when the toggle button's state is set - * within the code. - */ -static void -all_day_event_toggled_cb (GtkWidget *toggle, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - gboolean all_day; - struct icaltimetype start_tt = icaltime_null_time(); - struct icaltimetype end_tt = icaltime_null_time(); - gboolean date_set; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - /* When the all_day toggle is turned on, the start date is - * rounded down to the start of the day, and end date is - * rounded down to the start of the day on which the event - * ends. The event is then taken to be inclusive of the days - * between the start and end days. Note that if the event end - * is at midnight, we round it down to the previous day, so the - * event times stay the same. - * - * When the all_day_toggle is turned off, then if the event is within - * one day, we set the event start to the start of the working day, - * and set the event end to one hour after it. If the event is longer - * than one day, we set the event end to the end of the day it is on, - * so that the actual event times remain the same. - * - * This may need tweaking to work well with different timezones used - * in the event start & end. - */ - all_day = GTK_TOGGLE_BUTTON (toggle)->active; - - set_all_day (epage, all_day); - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time), - &start_tt.year, - &start_tt.month, - &start_tt.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), - &start_tt.hour, - &start_tt.minute); - g_assert (date_set); - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time), - &end_tt.year, - &end_tt.month, - &end_tt.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->end_time), - &end_tt.hour, - &end_tt.minute); - g_assert (date_set); - - if (all_day) { - /* Round down to the start of the day. */ - start_tt.hour = 0; - start_tt.minute = 0; - start_tt.second = 0; - start_tt.is_date = TRUE; - - /* Round down to the start of the day, or the start of the - previous day if it is midnight. */ - icaltime_adjust (&end_tt, 0, 0, 0, -1); - end_tt.hour = 0; - end_tt.minute = 0; - end_tt.second = 0; - end_tt.is_date = TRUE; - } else { - icaltimezone *start_zone, *end_zone; - - if (end_tt.year == start_tt.year - && end_tt.month == start_tt.month - && end_tt.day == start_tt.day) { - /* The event is within one day, so we set the event - start to the start of the working day, and the end - to one hour later. */ - start_tt.hour = calendar_config_get_day_start_hour (); - start_tt.minute = calendar_config_get_day_start_minute (); - start_tt.second = 0; - - end_tt = start_tt; - icaltime_adjust (&end_tt, 0, 1, 0, 0); - } else { - /* The event is longer than 1 day, so we keep exactly - the same times, just using DATE-TIME rather than - DATE. */ - icaltime_adjust (&end_tt, 1, 0, 0, 0); - } - - /* Make sure that end > start using the timezones. */ - start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); - check_start_before_end (&start_tt, start_zone, - &end_tt, end_zone, - TRUE); - } - - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), - epage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), - epage); - - e_date_edit_set_date (E_DATE_EDIT (priv->start_time), start_tt.year, - start_tt.month, start_tt.day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_time), - start_tt.hour, start_tt.minute); - - e_date_edit_set_date (E_DATE_EDIT (priv->end_time), end_tt.year, - end_tt.month, end_tt.day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->end_time), - end_tt.hour, end_tt.minute); - - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), - epage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), - epage); - - /* Notify upstream */ - notify_dates_changed (epage, &start_tt, &end_tt); -} - -/* Callback used when the contacts button is clicked; we must bring up the - * contact list dialog. - */ -static void -contacts_clicked_cb (GtkWidget *button, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - comp_editor_show_contacts_dialog (priv->corba_select_names); - - /* FIXME: Currently we aren't getting the changed event from the - SelectNames component correctly, so we aren't saving the event - if just the contacts are changed. To work around that, we assume - that if the contacts button is clicked it is changed. */ - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage)); -} - -/* Callback used when the categories button is clicked; we must bring up the - * category list dialog. - */ -static void -categories_clicked_cb (GtkWidget *button, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - GtkWidget *entry; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); -} - -/* This is called when any field is changed; it notifies upstream. */ -static void -field_changed_cb (GtkWidget *widget, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage)); -} - -/* Hooks the widget signals */ -static gboolean -init_widgets (EventPage *epage) -{ - EventPagePrivate *priv; - char *location; - icaltimezone *zone; - - priv = epage->priv; - - /* Make sure the EDateEdit widgets use our timezones to get the - current time. */ - e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_time), - (EDateEditGetTimeCallback) comp_editor_get_current_time, - epage, NULL); - e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->end_time), - (EDateEditGetTimeCallback) comp_editor_get_current_time, - epage, NULL); - - /* Summary */ - gtk_signal_connect (GTK_OBJECT (priv->summary), "changed", - GTK_SIGNAL_FUNC (summary_changed_cb), epage); - - /* Description - turn on word wrap. */ - gtk_text_set_word_wrap (GTK_TEXT (priv->description), TRUE); - - /* Start and end times */ - gtk_signal_connect (GTK_OBJECT (priv->start_time), "changed", - GTK_SIGNAL_FUNC (date_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->end_time), "changed", - GTK_SIGNAL_FUNC (date_changed_cb), epage); - - gtk_signal_connect (GTK_OBJECT (priv->start_timezone), "changed", - GTK_SIGNAL_FUNC (start_timezone_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->end_timezone), "changed", - GTK_SIGNAL_FUNC (end_timezone_changed_cb), epage); - - gtk_signal_connect (GTK_OBJECT (priv->all_day_event), "toggled", - GTK_SIGNAL_FUNC (all_day_event_toggled_cb), epage); - - /* Contacts button */ - gtk_signal_connect (GTK_OBJECT (priv->contacts_btn), "clicked", - GTK_SIGNAL_FUNC (contacts_clicked_cb), epage); - - /* Categories button */ - gtk_signal_connect (GTK_OBJECT (priv->categories_btn), "clicked", - GTK_SIGNAL_FUNC (categories_clicked_cb), epage); - - /* Connect the default signal handler to use to make sure we notify - * upstream of changes to the widget values. - */ - - gtk_signal_connect (GTK_OBJECT (priv->summary), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->location), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->start_time), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->end_time), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->start_timezone), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->end_timezone), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->all_day_event), "toggled", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->description), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - gtk_signal_connect (GTK_OBJECT (priv->classification_public), - "toggled", GTK_SIGNAL_FUNC (field_changed_cb), - epage); - gtk_signal_connect (GTK_OBJECT (priv->classification_private), - "toggled", GTK_SIGNAL_FUNC (field_changed_cb), - epage); - gtk_signal_connect (GTK_OBJECT (priv->classification_confidential), - "toggled", GTK_SIGNAL_FUNC (field_changed_cb), - epage); - gtk_signal_connect (GTK_OBJECT (priv->show_time_as_free), - "toggled", GTK_SIGNAL_FUNC (field_changed_cb), - epage); - gtk_signal_connect (GTK_OBJECT (priv->show_time_as_busy), - "toggled", GTK_SIGNAL_FUNC (field_changed_cb), - epage); - gtk_signal_connect (GTK_OBJECT (priv->categories), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), epage); - - /* Create the contacts entry, a corba control from the address book. */ - priv->corba_select_names = comp_editor_create_contacts_component (); - if (priv->corba_select_names == CORBA_OBJECT_NIL) - return FALSE; - - priv->contacts_entry = comp_editor_create_contacts_control (priv->corba_select_names); - if (priv->contacts_entry == NULL) - return FALSE; - - gtk_container_add (GTK_CONTAINER (priv->contacts_box), - priv->contacts_entry); - - /* Set the default timezone, so the timezone entry may be hidden. */ - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone); - e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone); - - return TRUE; -} - - - -/** - * event_page_construct: - * @epage: An event page. - * - * Constructs an event page by loading its Glade data. - * - * Return value: The same object as @epage, or NULL if the widgets could not be - * created. - **/ -EventPage * -event_page_construct (EventPage *epage) -{ - EventPagePrivate *priv; - - priv = epage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/event-page.glade", - NULL); - if (!priv->xml) { - g_message ("event_page_construct(): " - "Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (epage)) { - g_message ("event_page_construct(): " - "Could not find all widgets in the XML file!"); - return NULL; - } - - if (!init_widgets (epage)) { - g_message ("event_page_construct(): " - "Could not initialize the widgets!"); - return NULL; - } - - return epage; -} - -/** - * event_page_new: - * - * Creates a new event page. - * - * Return value: A newly-created event page, or NULL if the page could - * not be created. - **/ -EventPage * -event_page_new (void) -{ - EventPage *epage; - - epage = gtk_type_new (TYPE_EVENT_PAGE); - if (!event_page_construct (epage)) { - gtk_object_unref (GTK_OBJECT (epage)); - return NULL; - } - - return epage; -} - -GtkWidget *make_date_edit (void); - -GtkWidget * -make_date_edit (void) -{ - return comp_editor_new_date_edit (TRUE, TRUE, TRUE); -} - -GtkWidget *make_timezone_entry (void); - -GtkWidget * -make_timezone_entry (void) -{ - return e_timezone_entry_new (); -} diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade deleted file mode 100644 index 6be310448a..0000000000 --- a/calendar/gui/dialogs/event-page.glade +++ /dev/null @@ -1,601 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>event-page</name> - <program_name>event-page</program_name> - <directory></directory> - <source_directory>.</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> -</project> - -<widget> - <class>GtkWindow</class> - <name>event-toplevel</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>event-page</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>6</spacing> - - <widget> - <class>GtkTable</class> - <name>table11</name> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label56</name> - <label>Su_mmary:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>general-summary</default_focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>general-summary</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label61</name> - <label>L_ocation:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>7.45058e-09</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>location</default_focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>location</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame31</name> - <label>Date & Time</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table12</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>4</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label57</name> - <label>_Start time:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>start-time</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label58</name> - <label>_End time:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>end-time</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>start-time</name> - <can_focus>True</can_focus> - <creation_function>make_date_edit</creation_function> - <string1></string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 16 May 2000 19:11:05 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>end-time</name> - <can_focus>True</can_focus> - <creation_function>make_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 16 May 2000 19:11:10 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>end-timezone</name> - <creation_function>make_timezone_entry</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Mon, 18 Jun 2001 23:51:40 GMT</last_modification_time> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>start-timezone</name> - <creation_function>make_timezone_entry</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Mon, 18 Jun 2001 23:51:34 GMT</last_modification_time> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment1</name> - <xalign>1</xalign> - <yalign>7.45058e-09</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>0</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>all-day-event</name> - <can_focus>True</can_focus> - <label>A_ll day event</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow12</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkText</class> - <name>description</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox54</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame32</name> - <label>Classification</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox52</name> - <border_width>2</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkRadioButton</class> - <name>classification-public</name> - <can_focus>True</can_focus> - <label>Pu_blic</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>classification-private</name> - <can_focus>True</can_focus> - <label>Pri_vate</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>classification-confidential</name> - <can_focus>True</can_focus> - <label>Con_fidential</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame33</name> - <label>Show Time As</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox55</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkRadioButton</class> - <name>show-time-as-free</name> - <can_focus>True</can_focus> - <label>F_ree</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>show_time_as_radio_group</group> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>show-time-as-busy</name> - <can_focus>True</can_focus> - <label>B_usy</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>show_time_as_radio_group</group> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox53</name> - <homogeneous>False</homogeneous> - <spacing>2</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>contacts-button</name> - <can_focus>True</can_focus> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label59</name> - <label>_Contacts...</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>contacts-box</name> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - - <widget> - <class>GtkButton</class> - <name>categories-button</name> - <can_focus>True</can_focus> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label60</name> - <label>Ca_tegories...</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkEntry</class> - <name>categories</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h deleted file mode 100644 index 3da59f4ada..0000000000 --- a/calendar/gui/dialogs/event-page.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Evolution calendar - Main page of the event editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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 EVENT_PAGE_H -#define EVENT_PAGE_H - -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_EVENT_PAGE (event_page_get_type ()) -#define EVENT_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_EVENT_PAGE, EventPage)) -#define EVENT_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_EVENT_PAGE, EventPageClass)) -#define IS_EVENT_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_EVENT_PAGE)) -#define IS_EVENT_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_EVENT_PAGE)) - -typedef struct _EventPagePrivate EventPagePrivate; - -typedef struct { - CompEditorPage page; - - /* Private data */ - EventPagePrivate *priv; -} EventPage; - -typedef struct { - CompEditorPageClass parent_class; -} EventPageClass; - - -GtkType event_page_get_type (void); -EventPage *event_page_construct (EventPage *epage); -EventPage *event_page_new (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c deleted file mode 100644 index 51cfe045d9..0000000000 --- a/calendar/gui/dialogs/meeting-page.c +++ /dev/null @@ -1,860 +0,0 @@ -/* Evolution calendar - Main page of the task editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtkwindow.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <libgnomeui/gnome-stock.h> -#include <gal/e-table/e-cell-combo.h> -#include <gal/e-table/e-cell-text.h> -#include <gal/e-table/e-table-simple.h> -#include <gal/e-table/e-table-scrolled.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-gui-utils.h> -#include <widgets/misc/e-dateedit.h> -#include <e-util/e-dialog-widgets.h> -#include "../component-factory.h" -#include "../e-meeting-attendee.h" -#include "../e-meeting-model.h" -#include "../itip-utils.h" -#include "comp-editor-util.h" -#include "e-delegate-dialog.h" -#include "meeting-page.h" - - - -enum columns { - MEETING_ATTENDEE_COL, - MEETING_MEMBER_COL, - MEETING_TYPE_COL, - MEETING_ROLE_COL, - MEETING_RSVP_COL, - MEETING_DELTO_COL, - MEETING_DELFROM_COL, - MEETING_STATUS_COL, - MEETING_CN_COL, - MEETING_LANG_COL, - MEETING_COLUMN_COUNT -}; - -/* Private part of the MeetingPage structure */ -struct _MeetingPagePrivate { - /* Lists of attendees */ - GPtrArray *deleted_attendees; - - /* To use in case of cancellation */ - CalComponent *comp; - - /* List of identities */ - GList *addresses; - GList *address_strings; - gchar *default_address; - - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - GtkWidget *main; - GtkWidget *organizer_table; - GtkWidget *organizer; - GtkWidget *organizer_lbl; - GtkWidget *other_organizer; - GtkWidget *other_organizer_lbl; - GtkWidget *other_organizer_btn; - GtkWidget *existing_organizer_table; - GtkWidget *existing_organizer; - GtkWidget *existing_organizer_btn; - GtkWidget *invite; - - /* E Table stuff */ - EMeetingModel *model; - ETableScrolled *etable; - gint row; - - /* For handling who the organizer is */ - gboolean other; - gboolean existing; - gboolean updating; -}; - - - -static void meeting_page_class_init (MeetingPageClass *class); -static void meeting_page_init (MeetingPage *mpage); -static void meeting_page_destroy (GtkObject *object); - -static GtkWidget *meeting_page_get_widget (CompEditorPage *page); -static void meeting_page_focus_main_widget (CompEditorPage *page); -static void meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp); -static gboolean meeting_page_fill_component (CompEditorPage *page, CalComponent *comp); - -static gint right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer data); - -static CompEditorPageClass *parent_class = NULL; - - - -/** - * meeting_page_get_type: - * - * Registers the #MeetingPage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #MeetingPage class. - **/ -GtkType -meeting_page_get_type (void) -{ - static GtkType meeting_page_type; - - if (!meeting_page_type) { - static const GtkTypeInfo meeting_page_info = { - "MeetingPage", - sizeof (MeetingPage), - sizeof (MeetingPageClass), - (GtkClassInitFunc) meeting_page_class_init, - (GtkObjectInitFunc) meeting_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - meeting_page_type = - gtk_type_unique (TYPE_COMP_EDITOR_PAGE, - &meeting_page_info); - } - - return meeting_page_type; -} - -/* Class initialization function for the task page */ -static void -meeting_page_class_init (MeetingPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GtkObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); - - editor_page_class->get_widget = meeting_page_get_widget; - editor_page_class->focus_main_widget = meeting_page_focus_main_widget; - editor_page_class->fill_widgets = meeting_page_fill_widgets; - editor_page_class->fill_component = meeting_page_fill_component; - editor_page_class->set_summary = NULL; - editor_page_class->set_dates = NULL; - - object_class->destroy = meeting_page_destroy; -} - -/* Object initialization function for the task page */ -static void -meeting_page_init (MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - - priv = g_new0 (MeetingPagePrivate, 1); - mpage->priv = priv; - - priv->deleted_attendees = g_ptr_array_new (); - - priv->comp = NULL; - - priv->xml = NULL; - priv->main = NULL; - priv->invite = NULL; - - priv->model = NULL; - priv->etable = NULL; - - priv->updating = FALSE; -} - -static void -set_attendees (CalComponent *comp, const GPtrArray *attendees) -{ - GSList *comp_attendees = NULL, *l; - int i; - - for (i = 0; i < attendees->len; i++) { - EMeetingAttendee *ia = g_ptr_array_index (attendees, i); - CalComponentAttendee *ca; - - ca = e_meeting_attendee_as_cal_component_attendee (ia); - - comp_attendees = g_slist_prepend (comp_attendees, ca); - - } - comp_attendees = g_slist_reverse (comp_attendees); - cal_component_set_attendee_list (comp, comp_attendees); - - for (l = comp_attendees; l != NULL; l = l->next) - g_free (l->data); - g_slist_free (comp_attendees); -} - -static void -cleanup_attendees (GPtrArray *attendees) -{ - int i; - - for (i = 0; i < attendees->len; i++) - gtk_object_unref (GTK_OBJECT (g_ptr_array_index (attendees, i))); -} - -/* Destroy handler for the task page */ -static void -meeting_page_destroy (GtkObject *object) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_MEETING_PAGE (object)); - - mpage = MEETING_PAGE (object); - priv = mpage->priv; - - if (priv->comp != NULL) - gtk_object_unref (GTK_OBJECT (priv->comp)); - - cleanup_attendees (priv->deleted_attendees); - g_ptr_array_free (priv->deleted_attendees, FALSE); - - itip_addresses_free (priv->addresses); - g_list_foreach (priv->address_strings, (GFunc) g_free, NULL); - g_list_free (priv->address_strings); - - gtk_object_unref (GTK_OBJECT (priv->model)); - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - g_free (priv); - mpage->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* get_widget handler for the task page */ -static GtkWidget * -meeting_page_get_widget (CompEditorPage *page) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (page); - priv = mpage->priv; - - return priv->main; -} - -/* focus_main_widget handler for the task page */ -static void -meeting_page_focus_main_widget (CompEditorPage *page) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (page); - priv = mpage->priv; - - gtk_widget_grab_focus (priv->organizer); -} - -/* Fills the widgets with default values */ -static void -clear_widgets (MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - - priv = mpage->priv; - - gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), ""); - gtk_entry_set_text (GTK_ENTRY (priv->other_organizer), ""); - gtk_label_set_text (GTK_LABEL (priv->existing_organizer), _("None")); - - gtk_widget_show (priv->organizer_table); - gtk_widget_hide (priv->existing_organizer_table); - - gtk_widget_hide (priv->other_organizer_lbl); - gtk_widget_hide (priv->other_organizer); - - priv->existing = FALSE; - priv->other = FALSE; -} - -/* fill_widgets handler for the meeting page */ -static void -meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - CalComponentOrganizer organizer; - GList *l; - - mpage = MEETING_PAGE (page); - priv = mpage->priv; - - priv->updating = TRUE; - - /* Clean out old data */ - if (priv->comp != NULL) - gtk_object_unref (GTK_OBJECT (priv->comp)); - priv->comp = NULL; - - cleanup_attendees (priv->deleted_attendees); - - /* Clean the screen */ - clear_widgets (mpage); - - /* Component for cancellation */ - priv->comp = cal_component_clone (comp); - - /* Organizer */ - cal_component_get_organizer (comp, &organizer); - priv->addresses = itip_addresses_get (); - for (l = priv->addresses; l != NULL; l = l->next) { - ItipAddress *a = l->data; - char *s; - - s = e_utf8_to_gtk_string (GTK_COMBO (priv->organizer)->entry, a->full); - priv->address_strings = g_list_append (priv->address_strings, s); - if (a->default_address) - priv->default_address = s; - } - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - - if (organizer.value != NULL) { - const gchar *strip = itip_strip_mailto (organizer.value); - gchar *s, *string; - - gtk_widget_hide (priv->organizer_table); - gtk_widget_show (priv->existing_organizer_table); - gtk_widget_hide (priv->invite); - - if (organizer.cn != NULL) - string = g_strdup_printf ("%s <%s>", organizer.cn, strip); - else - string = g_strdup (strip); - s = e_utf8_to_gtk_string (priv->existing_organizer, string); - gtk_label_set_text (GTK_LABEL (priv->existing_organizer), s); - g_free (s); - g_free (string); - - priv->existing = TRUE; - } else { - gtk_widget_hide (priv->other_organizer_lbl); - gtk_widget_hide (priv->other_organizer); - - e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address); - } - - priv->updating = FALSE; -} - -/* fill_component handler for the meeting page */ -static gboolean -meeting_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - CalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; - - mpage = MEETING_PAGE (page); - priv = mpage->priv; - - if (!priv->existing) { - gchar *addr = NULL, *cn = NULL; - GList *l; - - if (priv->other) { - addr = e_dialog_editable_get (priv->other_organizer); - } else { - gchar *str = e_dialog_editable_get (GTK_COMBO (priv->organizer)->entry); - for (l = priv->addresses; l != NULL; l = l->next) { - ItipAddress *a = l->data; - - if (!strcmp (a->full, str)) { - addr = g_strdup (a->address); - cn = g_strdup (a->name); - } - } - g_free (str); - } - - if (addr == NULL || strlen (addr) == 0) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("An organizer is required.")); - g_free (addr); - g_free (cn); - return FALSE; - } else { - gchar *tmp; - - tmp = addr; - addr = g_strdup_printf ("MAILTO:%s", addr); - g_free (tmp); - } - - organizer.value = addr; - organizer.cn = cn; - cal_component_set_organizer (comp, &organizer); - g_free (addr); - g_free (cn); - } - - if (e_meeting_model_count_actual_attendees (priv->model) < 1) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("At least one attendee is required.")); - return FALSE; - } - set_attendees (comp, e_meeting_model_get_attendees (priv->model)); - - return TRUE; -} - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (MeetingPage *mpage) -{ - CompEditorPage *page = COMP_EDITOR_PAGE (mpage); - MeetingPagePrivate *priv; - GSList *accel_groups; - GtkWidget *toplevel; - - priv = mpage->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->main = GW ("meeting-page"); - if (!priv->main) - return FALSE; - - /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ - toplevel = gtk_widget_get_toplevel (priv->main); - accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_widget_unparent (priv->main); - - priv->organizer_table = GW ("organizer-table"); - priv->organizer = GW ("organizer"); - priv->organizer_lbl = GW ("organizer-label"); - priv->other_organizer = GW ("other-organizer"); - priv->other_organizer_lbl = GW ("other-organizer-label"); - priv->other_organizer_btn = GW ("other-organizer-button"); - priv->existing_organizer_table = GW ("existing-organizer-table"); - priv->existing_organizer = GW ("existing-organizer"); - priv->existing_organizer_btn = GW ("existing-organizer-button"); - priv->invite = GW ("invite"); - -#undef GW - - return (priv->invite - && priv->organizer_table - && priv->organizer - && priv->organizer_lbl - && priv->other_organizer - && priv->other_organizer_lbl - && priv->other_organizer_btn - && priv->existing_organizer_table - && priv->existing_organizer - && priv->existing_organizer_btn); -} - -/* This is called when any field is changed; it notifies upstream. */ -static void -field_changed_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); -} - -/* Function called to make the organizer other than the user */ -static void -other_clicked_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - gtk_widget_hide (priv->organizer_lbl); - gtk_widget_hide (priv->organizer); - gtk_widget_hide (priv->other_organizer_btn); - gtk_widget_show (priv->other_organizer_lbl); - gtk_widget_show (priv->other_organizer); - - priv->other = TRUE; -} - -/* Function called to change the organizer */ -static void -change_clicked_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - gtk_widget_show (priv->organizer_table); - gtk_widget_hide (priv->existing_organizer_table); - gtk_widget_show (priv->invite); - - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), priv->address_strings); - e_dialog_editable_set (GTK_COMBO (priv->organizer)->entry, priv->default_address); - - priv->existing = FALSE; -} - -/* Function called to invite more people */ -static void -invite_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - e_meeting_model_invite_others_dialog (priv->model); -} - -/* Hooks the widget signals */ -static void -init_widgets (MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - - priv = mpage->priv; - - /* Organizer */ - gtk_signal_connect (GTK_OBJECT (GTK_COMBO (priv->organizer)->entry), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), mpage); - - gtk_signal_connect (GTK_OBJECT (priv->other_organizer_btn), "clicked", - GTK_SIGNAL_FUNC (other_clicked_cb), mpage); - gtk_signal_connect (GTK_OBJECT (priv->existing_organizer_btn), "clicked", - GTK_SIGNAL_FUNC (change_clicked_cb), mpage); - - /* Invite button */ - gtk_signal_connect (GTK_OBJECT (priv->invite), "clicked", - GTK_SIGNAL_FUNC (invite_cb), mpage); -} - -#if 0 -static void -popup_delegate_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage = MEETING_PAGE (data); - MeetingPagePrivate *priv; - EDelegateDialog *edd; - GtkWidget *dialog; - EMeetingAttendee *ia; - char *address = NULL, *name = NULL; - - priv = mpage->priv; - - ia = e_meeting_model_find_attendee_at_row (priv->model, priv->row); - - /* Show dialog. */ - edd = e_delegate_dialog_new (NULL, itip_strip_mailto (e_meeting_attendee_get_delto (ia))); - dialog = e_delegate_dialog_get_toplevel (edd); - - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == 0){ - EMeetingAttendee *ic; - - name = e_delegate_dialog_get_delegate_name (edd); - address = e_delegate_dialog_get_delegate (edd); - - /* Make sure we can add the new delegatee person */ - if (e_meeting_model_find_attendee (priv->model, address, NULL) != NULL) { - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("That person is already attending the meeting!")); - goto cleanup; - } - - /* Update information for attendee */ - if (e_meeting_attendee_is_set_delto (ia)) { - EMeetingAttendee *ib; - - ib = e_meeting_model_find_attendee (priv->model, itip_strip_mailto (e_meeting_attendee_get_delto (ia)), NULL); - if (ib != NULL) { - gtk_object_ref (GTK_OBJECT (ib)); - g_ptr_array_add (priv->deleted_attendees, ib); - - e_meeting_model_remove_attendee (priv->model, ib); - } - } - e_meeting_attendee_set_delto (ia, g_strdup_printf ("MAILTO:%s", address)); - - /* Construct delegatee information */ - ic = e_meeting_model_add_attendee_with_defaults (priv->model); - - e_meeting_attendee_set_address (ic, g_strdup_printf ("MAILTO:%s", address)); - e_meeting_attendee_set_delfrom (ic, g_strdup (e_meeting_attendee_get_address (ia))); - e_meeting_attendee_set_cn (ic, g_strdup (name)); - } - - cleanup: - g_free (name); - g_free (address); - gtk_object_unref (GTK_OBJECT (edd)); -} -#endif - -static void -popup_delete_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage = MEETING_PAGE (data); - MeetingPagePrivate *priv; - EMeetingAttendee *ia; - int pos = 0; - - priv = mpage->priv; - - ia = e_meeting_model_find_attendee_at_row (priv->model, priv->row); - - /* If this was a delegatee, no longer delegate */ - if (e_meeting_attendee_is_set_delfrom (ia)) { - EMeetingAttendee *ib; - - ib = e_meeting_model_find_attendee (priv->model, e_meeting_attendee_get_delfrom (ia), &pos); - if (ib != NULL) - e_meeting_attendee_set_delto (ib, NULL); - } - - /* Handle deleting all attendees in the delegation chain */ - while (ia != NULL) { - EMeetingAttendee *ib = NULL; - - gtk_object_ref (GTK_OBJECT (ia)); - g_ptr_array_add (priv->deleted_attendees, ia); - e_meeting_model_remove_attendee (priv->model, ia); - - if (e_meeting_attendee_get_delto (ia) != NULL) - ib = e_meeting_model_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL); - ia = ib; - } -} - -enum { - CAN_DELEGATE = 2, - CAN_DELETE = 4 -}; - -static EPopupMenu context_menu[] = { -#if 0 - { N_("_Delegate To..."), NULL, - GTK_SIGNAL_FUNC (popup_delegate_cb),NULL, CAN_DELEGATE }, - - E_POPUP_SEPARATOR, -#endif - - { N_("_Delete"), GNOME_STOCK_MENU_TRASH, - GTK_SIGNAL_FUNC (popup_delete_cb), NULL, CAN_DELETE }, - - E_POPUP_TERMINATOR -}; - -/* handle context menu over message-list */ -static gint -right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer data) -{ - MeetingPage *mpage = MEETING_PAGE (data); - MeetingPagePrivate *priv; - GtkMenu *menu; - int enable_mask = 0, hide_mask = 0; - - priv = mpage->priv; - - priv->row = e_meeting_model_etable_view_to_model_row (priv->model, row); - - menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, data); - e_auto_kill_popup_menu_on_hide (menu); - - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, - event->button.button, event->button.time); - - return TRUE; -} - - - -/* Callback used when the ETable gets a focus-out event. We have to commit any - * pending click-to-add state for if the event editor is being destroyed. - */ -static gint -table_canvas_focus_out_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - ETable *etable; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - etable = e_table_scrolled_get_table (priv->etable); - - e_table_commit_click_to_add (etable); - return TRUE; -} - -/** - * meeting_page_construct: - * @mpage: An task details page. - * - * Constructs an task page by loading its Glade data. - * - * Return value: The same object as @mpage, or NULL if the widgets could not - * be created. - **/ -MeetingPage * -meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm) -{ - MeetingPagePrivate *priv; - ETable *real_table; - gchar *filename; - - priv = mpage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR - "/meeting-page.glade", NULL); - if (!priv->xml) { - g_message ("meeting_page_construct(): " - "Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (mpage)) { - g_message ("meeting_page_construct(): " - "Could not find all widgets in the XML file!"); - return NULL; - } - - /* The etable displaying attendees and their status */ - gtk_object_ref (GTK_OBJECT (emm)); - priv->model = emm; - - filename = g_strdup_printf ("%s/config/et-header-meeting-page", evolution_dir); - priv->etable = e_meeting_model_etable_from_model (priv->model, - EVOLUTION_ETSPECDIR "/meeting-page.etspec", - filename); - g_free (filename); - - real_table = e_table_scrolled_get_table (priv->etable); - gtk_signal_connect (GTK_OBJECT (real_table), - "right_click", GTK_SIGNAL_FUNC (right_click_cb), mpage); - - gtk_signal_connect (GTK_OBJECT (real_table->table_canvas), "focus_out_event", - GTK_SIGNAL_FUNC (table_canvas_focus_out_cb), mpage); - - gtk_widget_show (GTK_WIDGET (priv->etable)); - gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->etable), TRUE, TRUE, 2); - - /* Init the widget signals */ - init_widgets (mpage); - - return mpage; -} - -/** - * meeting_page_new: - * - * Creates a new task details page. - * - * Return value: A newly-created task details page, or NULL if the page could - * not be created. - **/ -MeetingPage * -meeting_page_new (EMeetingModel *emm) -{ - MeetingPage *mpage; - - mpage = gtk_type_new (TYPE_MEETING_PAGE); - if (!meeting_page_construct (mpage, emm)) { - gtk_object_unref (GTK_OBJECT (mpage)); - return NULL; - } - - return mpage; -} - -/** - * meeting_page_get_cancel_comp: - * @mpage: - * - * - * - * Return value: - **/ -CalComponent * -meeting_page_get_cancel_comp (MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - - g_return_val_if_fail (mpage != NULL, NULL); - g_return_val_if_fail (IS_MEETING_PAGE (mpage), NULL); - - priv = mpage->priv; - - if (priv->deleted_attendees->len == 0) - return NULL; - - set_attendees (priv->comp, priv->deleted_attendees); - - return cal_component_clone (priv->comp); -} diff --git a/calendar/gui/dialogs/meeting-page.etspec b/calendar/gui/dialogs/meeting-page.etspec deleted file mode 100644 index 96bc480fe9..0000000000 --- a/calendar/gui/dialogs/meeting-page.etspec +++ /dev/null @@ -1,21 +0,0 @@ -<ETableSpecification click-to-add="true" click-to-add-end="true" _click-to-add-message="Click here to add an attendee" draw-grid="true"> - <ETableColumn model_col= "0" _title="Attendee" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "1" _title="Member" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "2" _title="Type" expansion="1.0" minimum_width="10" resizable="true" cell="typeedit" compare="string"/> - <ETableColumn model_col= "3" _title="Role" expansion="1.0" minimum_width="10" resizable="true" cell="roleedit" compare="string"/> - <ETableColumn model_col= "4" _title="RSVP" expansion="1.0" minimum_width="10" resizable="true" cell="rsvpedit" compare="string"/> - <ETableColumn model_col= "5" _title="Delegated To" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "6" _title="Delegated From" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "7" _title="Status" expansion="1.0" minimum_width="10" resizable="true" cell="statusedit" compare="string"/> - <ETableColumn model_col= "8" _title="Common Name" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/> - <ETableColumn model_col= "9" _title="Language" expansion="2.0" minimum_width="10" resizable="true" cell="string" compare="string"/> - - <ETableState> - <column source="0"/> - <column source="2"/> - <column source="3"/> - <column source="4"/> - <column source="7"/> - <grouping></grouping> - </ETableState> -</ETableSpecification> diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade deleted file mode 100644 index f06f457d16..0000000000 --- a/calendar/gui/dialogs/meeting-page.glade +++ /dev/null @@ -1,306 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>task-details-page</name> - <program_name>task-details-page</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>meeting-toplevel</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>meeting-page</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>organizer-table</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCombo</class> - <name>organizer</name> - <value_in_list>True</value_in_list> - <ok_if_empty>False</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry2</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkButton</class> - <name>other-organizer-button</name> - <can_focus>True</can_focus> - <label>_Other Organizer</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>other-organizer</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>organizer-label</name> - <label>Organizer:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>other-organizer-label</name> - <label>Organizer:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>existing-organizer-table</name> - <border_width>4</border_width> - <rows>1</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>Organizer:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>existing-organizer-button</name> - <can_focus>True</can_focus> - <label>_Change Organizer</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>existing-organizer</name> - <label>None</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>Placeholder</class> - </widget> - - <widget> - <class>GtkButton</class> - <name>invite</name> - <can_focus>True</can_focus> - <label>_Invite Others...</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - <pack>GTK_PACK_END</pack> - </child> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/meeting-page.h b/calendar/gui/dialogs/meeting-page.h deleted file mode 100644 index b7c8571b44..0000000000 --- a/calendar/gui/dialogs/meeting-page.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Evolution calendar - Main page of the task editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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 MEETING_PAGE_H -#define MEETING_PAGE_H - -#include "../e-meeting-model.h" -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_MEETING_PAGE (meeting_page_get_type ()) -#define MEETING_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_MEETING_PAGE, MeetingPage)) -#define MEETING_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_MEETING_PAGE, MeetingPageClass)) -#define IS_MEETING_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_MEETING_PAGE)) -#define IS_MEETING_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_MEETING_PAGE)) - -typedef struct _MeetingPagePrivate MeetingPagePrivate; - -typedef struct { - CompEditorPage page; - - /* Private data */ - MeetingPagePrivate *priv; -} MeetingPage; - -typedef struct { - CompEditorPageClass parent_class; -} MeetingPageClass; - - -GtkType meeting_page_get_type (void); -MeetingPage *meeting_page_construct (MeetingPage *mpage, - EMeetingModel *emm); -MeetingPage *meeting_page_new (EMeetingModel *emm); -CalComponent *meeting_page_get_cancel_comp (MeetingPage *mpage); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c deleted file mode 100644 index c5c76b433c..0000000000 --- a/calendar/gui/dialogs/recurrence-page.c +++ /dev/null @@ -1,2257 +0,0 @@ -/* Evolution calendar - Recurrence page of the calendar component dialogs - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkspinbutton.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include <e-util/e-dialog-widgets.h> -#include <e-util/e-time-utils.h> -#include <widgets/misc/e-dateedit.h> -#include <cal-util/timeutil.h> -#include "../calendar-config.h" -#include "../tag-calendar.h" -#include "../weekday-picker.h" -#include "comp-editor-util.h" -#include "recurrence-page.h" - - - -enum month_day_options { - MONTH_DAY_NTH, - MONTH_DAY_MON, - MONTH_DAY_TUE, - MONTH_DAY_WED, - MONTH_DAY_THU, - MONTH_DAY_FRI, - MONTH_DAY_SAT, - MONTH_DAY_SUN -}; - -static const int month_day_options_map[] = { - MONTH_DAY_NTH, - MONTH_DAY_MON, - MONTH_DAY_TUE, - MONTH_DAY_WED, - MONTH_DAY_THU, - MONTH_DAY_FRI, - MONTH_DAY_SAT, - MONTH_DAY_SUN, - -1 -}; - -enum recur_type { - RECUR_NONE, - RECUR_SIMPLE, - RECUR_CUSTOM -}; - -static const int type_map[] = { - RECUR_NONE, - RECUR_SIMPLE, - RECUR_CUSTOM, - -1 -}; - -static const int freq_map[] = { - ICAL_DAILY_RECURRENCE, - ICAL_WEEKLY_RECURRENCE, - ICAL_MONTHLY_RECURRENCE, - ICAL_YEARLY_RECURRENCE, - -1 -}; - -enum ending_type { - ENDING_FOR, - ENDING_UNTIL, - ENDING_FOREVER -}; - -static const int ending_types_map[] = { - ENDING_FOR, - ENDING_UNTIL, - ENDING_FOREVER, - -1 -}; - -/* Private part of the RecurrencePage structure */ -struct _RecurrencePagePrivate { - /* Component we use to expand the recurrence rules for the preview */ - CalComponent *comp; - - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - - GtkWidget *main; - - GtkWidget *summary; - GtkWidget *date_time; - - GtkWidget *none; - GtkWidget *simple; - GtkWidget *custom; - - GtkWidget *params; - GtkWidget *interval_value; - GtkWidget *interval_unit; - GtkWidget *special; - GtkWidget *ending_menu; - GtkWidget *ending_special; - GtkWidget *custom_warning_bin; - - /* For weekly recurrences, created by hand */ - GtkWidget *weekday_picker; - guint8 weekday_day_mask; - guint8 weekday_blocked_day_mask; - - /* For monthly recurrences, created by hand */ - GtkWidget *month_index_spin; - int month_index; - - GtkWidget *month_day_menu; - enum month_day_options month_day; - - /* For ending date, created by hand */ - GtkWidget *ending_date_edit; - struct icaltimetype ending_date_tt; - - /* For ending count of occurrences, created by hand */ - GtkWidget *ending_count_spin; - int ending_count; - - /* More widgets from the Glade file */ - - GtkWidget *exception_date; - GtkWidget *exception_list; - GtkWidget *exception_add; - GtkWidget *exception_modify; - GtkWidget *exception_delete; - - GtkWidget *preview_bin; - - /* For the recurrence preview, the actual widget */ - GtkWidget *preview_calendar; - - gboolean updating; -}; - - - -static void recurrence_page_class_init (RecurrencePageClass *class); -static void recurrence_page_init (RecurrencePage *rpage); -static void recurrence_page_destroy (GtkObject *object); - -static GtkWidget *recurrence_page_get_widget (CompEditorPage *page); -static void recurrence_page_focus_main_widget (CompEditorPage *page); -static void recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp); -static gboolean recurrence_page_fill_component (CompEditorPage *page, CalComponent *comp); -static void recurrence_page_set_summary (CompEditorPage *page, const char *summary); -static void recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); - -static void field_changed (RecurrencePage *apage); - -static CompEditorPageClass *parent_class = NULL; - - - -/** - * recurrence_page_get_type: - * - * Registers the #RecurrencePage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #RecurrencePage class. - **/ -GtkType -recurrence_page_get_type (void) -{ - static GtkType recurrence_page_type; - - if (!recurrence_page_type) { - static const GtkTypeInfo recurrence_page_info = { - "RecurrencePage", - sizeof (RecurrencePage), - sizeof (RecurrencePageClass), - (GtkClassInitFunc) recurrence_page_class_init, - (GtkObjectInitFunc) recurrence_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - recurrence_page_type = gtk_type_unique (TYPE_COMP_EDITOR_PAGE, - &recurrence_page_info); - } - - return recurrence_page_type; -} - -/* Class initialization function for the recurrence page */ -static void -recurrence_page_class_init (RecurrencePageClass *class) -{ - CompEditorPageClass *editor_page_class; - GtkObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); - - editor_page_class->get_widget = recurrence_page_get_widget; - editor_page_class->focus_main_widget = recurrence_page_focus_main_widget; - editor_page_class->fill_widgets = recurrence_page_fill_widgets; - editor_page_class->fill_component = recurrence_page_fill_component; - editor_page_class->set_summary = recurrence_page_set_summary; - editor_page_class->set_dates = recurrence_page_set_dates; - - object_class->destroy = recurrence_page_destroy; -} - -/* Object initialization function for the recurrence page */ -static void -recurrence_page_init (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - - priv = g_new0 (RecurrencePagePrivate, 1); - rpage->priv = priv; - - priv->xml = NULL; - - priv->main = NULL; - priv->summary = NULL; - priv->date_time = NULL; - priv->none = NULL; - priv->simple = NULL; - priv->custom = NULL; - priv->params = NULL; - priv->interval_value = NULL; - priv->interval_unit = NULL; - priv->special = NULL; - priv->ending_menu = NULL; - priv->ending_special = NULL; - priv->custom_warning_bin = NULL; - priv->weekday_picker = NULL; - priv->month_index_spin = NULL; - priv->month_day_menu = NULL; - priv->ending_date_edit = NULL; - priv->ending_count_spin = NULL; - priv->exception_date = NULL; - priv->exception_list = NULL; - priv->exception_add = NULL; - priv->exception_modify = NULL; - priv->exception_delete = NULL; - priv->preview_bin = NULL; - priv->preview_calendar = NULL; - - priv->comp = NULL; -} - -/* Frees the CalComponentDateTime stored in the GtkCList */ -static void -free_exception_date_time (CalComponentDateTime *dt) -{ - g_free (dt->value); - g_free ((char*)dt->tzid); - g_free (dt); -} - -/* Destroy handler for the recurrence page */ -static void -recurrence_page_destroy (GtkObject *object) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_RECURRENCE_PAGE (object)); - - rpage = RECURRENCE_PAGE (object); - priv = rpage->priv; - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - if (priv->comp) { - gtk_object_unref (GTK_OBJECT (priv->comp)); - priv->comp = NULL; - } - - g_free (priv); - rpage->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* get_widget handler for the recurrence page */ -static GtkWidget * -recurrence_page_get_widget (CompEditorPage *page) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - - rpage = RECURRENCE_PAGE (page); - priv = rpage->priv; - - return priv->main; -} - -/* focus_main_widget handler for the recurrence page */ -static void -recurrence_page_focus_main_widget (CompEditorPage *page) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - - rpage = RECURRENCE_PAGE (page); - priv = rpage->priv; - - if (e_dialog_toggle_get (priv->none)) - gtk_widget_grab_focus (priv->none); - else if (e_dialog_toggle_get (priv->simple)) - gtk_widget_grab_focus (priv->simple); - else if (e_dialog_toggle_get (priv->custom)) - gtk_widget_grab_focus (priv->custom); - else - g_assert_not_reached (); -} - -/* Fills the widgets with default values */ -static void -clear_widgets (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - GtkAdjustment *adj; - GtkWidget *menu; - - priv = rpage->priv; - - priv->weekday_day_mask = 0; - - priv->month_index = 1; - priv->month_day = MONTH_DAY_NTH; - - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->none), rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->simple), rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->custom), rpage); - e_dialog_radio_set (priv->none, RECUR_NONE, type_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->none), rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->simple), rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->custom), rpage); - - adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->interval_value)); - gtk_signal_handler_block_by_data (GTK_OBJECT (adj), rpage); - e_dialog_spin_set (priv->interval_value, 1); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (adj), rpage); - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - gtk_signal_handler_block_by_data (GTK_OBJECT (menu), rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_DAILY_RECURRENCE, - freq_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - - priv->ending_date_tt = icaltime_today (); - priv->ending_count = 1; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); - gtk_signal_handler_block_by_data (GTK_OBJECT (menu), rpage); - e_dialog_option_menu_set (priv->ending_menu, - ENDING_FOREVER, - ending_types_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - - /* Exceptions list */ - gtk_clist_clear (GTK_CLIST (priv->exception_list)); -} - -/* Builds a static string out of an exception date */ -static char * -get_exception_string (CalComponentDateTime *dt) -{ - static char buf[256]; - struct tm tmp_tm; - - tmp_tm.tm_year = dt->value->year - 1900; - tmp_tm.tm_mon = dt->value->month - 1; - tmp_tm.tm_mday = dt->value->day; - tmp_tm.tm_hour = dt->value->hour; - tmp_tm.tm_min = dt->value->minute; - tmp_tm.tm_sec = dt->value->second; - tmp_tm.tm_isdst = -1; - - tmp_tm.tm_wday = time_day_of_week (dt->value->day, - dt->value->month - 1, - dt->value->year); - - e_time_format_date_and_time (&tmp_tm, calendar_config_get_24_hour_format(), FALSE, FALSE, buf, sizeof (buf)); - - return buf; -} - -/* Appends an exception date to the list */ -static void -append_exception (RecurrencePage *rpage, CalComponentDateTime *datetime) -{ - RecurrencePagePrivate *priv; - CalComponentDateTime *dt; - char *c[1]; - int i; - GtkCList *clist; - struct icaltimetype *tt; - - priv = rpage->priv; - - dt = g_new (CalComponentDateTime, 1); - dt->value = g_new (struct icaltimetype, 1); - *dt->value = *datetime->value; - dt->tzid = g_strdup (datetime->tzid); - - clist = GTK_CLIST (priv->exception_list); - - gtk_signal_handler_block_by_data (GTK_OBJECT (clist), rpage); - - c[0] = get_exception_string (dt); - i = gtk_clist_append (clist, c); - - gtk_clist_set_row_data_full (clist, i, dt, (GtkDestroyNotify) free_exception_date_time); - - gtk_clist_select_row (clist, i, 0); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (clist), rpage); - - tt = dt->value; - e_date_edit_set_date (E_DATE_EDIT (priv->exception_date), - tt->year, tt->month, tt->day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->exception_date), - tt->hour, tt->minute); - - gtk_widget_set_sensitive (priv->exception_modify, TRUE); - gtk_widget_set_sensitive (priv->exception_delete, TRUE); -} - -/* Fills in the exception widgets with the data from the calendar component */ -static void -fill_exception_widgets (RecurrencePage *rpage, CalComponent *comp) -{ - RecurrencePagePrivate *priv; - GSList *list, *l; - gboolean added; - - priv = rpage->priv; - - cal_component_get_exdate_list (comp, &list); - - added = FALSE; - - for (l = list; l; l = l->next) { - CalComponentDateTime *cdt; - - added = TRUE; - - cdt = l->data; - append_exception (rpage, cdt); - } - - cal_component_free_exdate_list (list); - - if (added) - gtk_clist_select_row (GTK_CLIST (priv->exception_list), 0, 0); -} - -/* Computes a weekday mask for the start day of a calendar component, - * for use in a WeekdayPicker widget. - */ -static guint8 -get_start_weekday_mask (CalComponent *comp) -{ - CalComponentDateTime dt; - guint8 retval; - - cal_component_get_dtstart (comp, &dt); - - if (dt.value) { - short weekday; - - weekday = icaltime_day_of_week (*dt.value); - retval = 0x1 << (weekday - 1); - } else - retval = 0; - - cal_component_free_datetime (&dt); - - return retval; -} - -/* Sets some sane defaults for the data sources for the recurrence special - * widgets, even if they will not be used immediately. - */ -static void -set_special_defaults (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - guint8 mask; - - priv = rpage->priv; - - mask = get_start_weekday_mask (priv->comp); - - priv->weekday_day_mask = mask; - priv->weekday_blocked_day_mask = mask; -} - -/* Sensitizes the recurrence widgets based on the state of the recurrence type - * radio group. - */ -static void -sensitize_recur_widgets (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - enum recur_type type; - GtkWidget *label; - - priv = rpage->priv; - - type = e_dialog_radio_get (priv->none, type_map); - - if (GTK_BIN (priv->custom_warning_bin)->child) - gtk_widget_destroy (GTK_BIN (priv->custom_warning_bin)->child); - - switch (type) { - case RECUR_NONE: - gtk_widget_set_sensitive (priv->params, FALSE); - gtk_widget_show (priv->params); - gtk_widget_hide (priv->custom_warning_bin); - break; - - case RECUR_SIMPLE: - gtk_widget_set_sensitive (priv->params, TRUE); - gtk_widget_show (priv->params); - gtk_widget_hide (priv->custom_warning_bin); - break; - - case RECUR_CUSTOM: - gtk_widget_set_sensitive (priv->params, FALSE); - gtk_widget_hide (priv->params); - - label = gtk_label_new (_("This appointment contains " - "recurrences that Evolution " - "cannot edit.")); - gtk_container_add (GTK_CONTAINER (priv->custom_warning_bin), - label); - gtk_widget_show_all (priv->custom_warning_bin); - break; - - default: - g_assert_not_reached (); - } -} - -#if 0 -/* Encondes a position/weekday pair into the proper format for - * icalrecurrencetype.by_day. Not needed at present. - */ -static short -nth_weekday (int pos, icalrecurrencetype_weekday weekday) -{ - g_assert (pos > 0 && pos <= 5); - - return (pos << 3) | (int) weekday; -} -#endif - -/* Gets the simple recurrence data from the recurrence widgets and stores it in - * the calendar component. - */ -static void -simple_recur_to_comp (RecurrencePage *rpage, CalComponent *comp) -{ - RecurrencePagePrivate *priv; - struct icalrecurrencetype r; - GSList l; - enum ending_type ending_type; - gboolean date_set; - - priv = rpage->priv; - - icalrecurrencetype_clear (&r); - - /* Frequency, interval, week start */ - - r.freq = e_dialog_option_menu_get (priv->interval_unit, freq_map); - r.interval = e_dialog_spin_get_int (priv->interval_value); - r.week_start = ICAL_SUNDAY_WEEKDAY - + calendar_config_get_week_start_day (); - - /* Frequency-specific data */ - - switch (r.freq) { - case ICAL_DAILY_RECURRENCE: - /* Nothing else is required */ - break; - - case ICAL_WEEKLY_RECURRENCE: { - guint8 day_mask; - int i; - - g_assert (GTK_BIN (priv->special)->child != NULL); - g_assert (priv->weekday_picker != NULL); - g_assert (IS_WEEKDAY_PICKER (priv->weekday_picker)); - - day_mask = weekday_picker_get_days (WEEKDAY_PICKER (priv->weekday_picker)); - - i = 0; - - if (day_mask & (1 << 0)) - r.by_day[i++] = ICAL_SUNDAY_WEEKDAY; - - if (day_mask & (1 << 1)) - r.by_day[i++] = ICAL_MONDAY_WEEKDAY; - - if (day_mask & (1 << 2)) - r.by_day[i++] = ICAL_TUESDAY_WEEKDAY; - - if (day_mask & (1 << 3)) - r.by_day[i++] = ICAL_WEDNESDAY_WEEKDAY; - - if (day_mask & (1 << 4)) - r.by_day[i++] = ICAL_THURSDAY_WEEKDAY; - - if (day_mask & (1 << 5)) - r.by_day[i++] = ICAL_FRIDAY_WEEKDAY; - - if (day_mask & (1 << 6)) - r.by_day[i++] = ICAL_SATURDAY_WEEKDAY; - - break; - } - - case ICAL_MONTHLY_RECURRENCE: { - int day_index; - enum month_day_options month_day; - - g_assert (GTK_BIN (priv->special)->child != NULL); - g_assert (priv->month_index_spin != NULL); - g_assert (GTK_IS_SPIN_BUTTON (priv->month_index_spin)); - g_assert (priv->month_day_menu != NULL); - g_assert (GTK_IS_OPTION_MENU (priv->month_day_menu)); - - day_index = e_dialog_spin_get_int (priv->month_index_spin); - month_day = e_dialog_option_menu_get (priv->month_day_menu, - month_day_options_map); - - switch (month_day) { - case MONTH_DAY_NTH: - r.by_month_day[0] = day_index; - break; - - /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not - accept BYDAY=2TU. So we now use the same as Outlook - by default. */ - case MONTH_DAY_MON: - r.by_day[0] = ICAL_MONDAY_WEEKDAY; - r.by_set_pos[0] = day_index; - break; - - case MONTH_DAY_TUE: - r.by_day[0] = ICAL_TUESDAY_WEEKDAY; - r.by_set_pos[0] = day_index; - break; - - case MONTH_DAY_WED: - r.by_day[0] = ICAL_WEDNESDAY_WEEKDAY; - r.by_set_pos[0] = day_index; - break; - - case MONTH_DAY_THU: - r.by_day[0] = ICAL_THURSDAY_WEEKDAY; - r.by_set_pos[0] = day_index; - break; - - case MONTH_DAY_FRI: - r.by_day[0] = ICAL_FRIDAY_WEEKDAY; - r.by_set_pos[0] = day_index; - break; - - case MONTH_DAY_SAT: - r.by_day[0] = ICAL_SATURDAY_WEEKDAY; - r.by_set_pos[0] = day_index; - break; - - case MONTH_DAY_SUN: - r.by_day[0] = ICAL_SUNDAY_WEEKDAY; - r.by_set_pos[0] = day_index; - break; - - default: - g_assert_not_reached (); - } - - break; - } - - case ICAL_YEARLY_RECURRENCE: - /* Nothing else is required */ - break; - - default: - g_assert_not_reached (); - } - - /* Ending date */ - - ending_type = e_dialog_option_menu_get (priv->ending_menu, - ending_types_map); - - switch (ending_type) { - case ENDING_FOR: - g_assert (priv->ending_count_spin != NULL); - g_assert (GTK_IS_SPIN_BUTTON (priv->ending_count_spin)); - - r.count = e_dialog_spin_get_int (priv->ending_count_spin); - break; - - case ENDING_UNTIL: - g_assert (priv->ending_date_edit != NULL); - g_assert (E_IS_DATE_EDIT (priv->ending_date_edit)); - - /* We only allow a DATE value to be set for the UNTIL property, - since we don't support sub-day recurrences. */ - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->ending_date_edit), - &r.until.year, - &r.until.month, - &r.until.day); - g_assert (date_set); - - r.until.is_date = 1; - - break; - - case ENDING_FOREVER: - /* Nothing to be done */ - break; - - default: - g_assert_not_reached (); - } - - /* Set the recurrence */ - - l.data = &r; - l.next = NULL; - - cal_component_set_rrule_list (comp, &l); -} - -/* Fills a component with the data from the recurrence page; in the case of a - * custom recurrence, it leaves it intact. - */ -static void -fill_component (RecurrencePage *rpage, CalComponent *comp) -{ - RecurrencePagePrivate *priv; - enum recur_type recur_type; - GtkCList *exception_list; - GSList *list; - int i; - - priv = rpage->priv; - - recur_type = e_dialog_radio_get (priv->none, type_map); - - switch (recur_type) { - case RECUR_NONE: - cal_component_set_rdate_list (comp, NULL); - cal_component_set_rrule_list (comp, NULL); - cal_component_set_exrule_list (comp, NULL); - break; - - case RECUR_SIMPLE: - cal_component_set_rdate_list (comp, NULL); - cal_component_set_exrule_list (comp, NULL); - simple_recur_to_comp (rpage, comp); - break; - - case RECUR_CUSTOM: - /* We just keep whatever the component has currently */ - break; - - default: - g_assert_not_reached (); - } - - /* Set exceptions */ - - list = NULL; - exception_list = GTK_CLIST (priv->exception_list); - for (i = 0; i < exception_list->rows; i++) { - CalComponentDateTime *cdt, *dt; - - cdt = g_new (CalComponentDateTime, 1); - cdt->value = g_new (struct icaltimetype, 1); - - dt = gtk_clist_get_row_data (exception_list, i); - g_assert (dt != NULL); - - *cdt->value = *dt->value; - cdt->tzid = g_strdup (dt->tzid); - -#if 0 - g_print ("Adding exception is_date: %i\n", cdt->value->is_date); -#endif - - list = g_slist_prepend (list, cdt); - } - - cal_component_set_exdate_list (comp, list); - cal_component_free_exdate_list (list); -} - -/* Re-tags the recurrence preview calendar based on the current information of - * the widgets in the recurrence page. - */ -static void -preview_recur (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - CalComponent *comp; - CalComponentDateTime cdt; - GSList *l; - - priv = rpage->priv; - - /* If our component has not been set yet through ::fill_widgets(), we - * cannot preview the recurrence. - */ - if (!priv->comp) - return; - - /* Create a scratch component with the start/end and - * recurrence/exception information from the one we are editing. - */ - - comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); - - cal_component_get_dtstart (priv->comp, &cdt); - cal_component_set_dtstart (comp, &cdt); - cal_component_free_datetime (&cdt); - - cal_component_get_dtend (priv->comp, &cdt); - cal_component_set_dtend (comp, &cdt); - cal_component_free_datetime (&cdt); - - cal_component_get_exdate_list (priv->comp, &l); - cal_component_set_exdate_list (comp, l); - cal_component_free_exdate_list (l); - - cal_component_get_exrule_list (priv->comp, &l); - cal_component_set_exrule_list (comp, l); - cal_component_free_recur_list (l); - - cal_component_get_rdate_list (priv->comp, &l); - cal_component_set_rdate_list (comp, l); - cal_component_free_period_list (l); - - cal_component_get_rrule_list (priv->comp, &l); - cal_component_set_rrule_list (comp, l); - cal_component_free_recur_list (l); - - fill_component (rpage, comp); - - tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp, - COMP_EDITOR_PAGE (rpage)->client, TRUE, FALSE); - gtk_object_unref (GTK_OBJECT (comp)); -} - -/* Callback used when the recurrence weekday picker changes */ -static void -weekday_picker_changed_cb (WeekdayPicker *wp, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - - field_changed (rpage); - preview_recur (rpage); -} - -/* Creates the special contents for weekly recurrences */ -static void -make_weekly_special (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - GtkWidget *hbox; - GtkWidget *label; - WeekdayPicker *wp; - - priv = rpage->priv; - - g_assert (GTK_BIN (priv->special)->child == NULL); - g_assert (priv->weekday_picker == NULL); - - /* Create the widgets */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (priv->special), hbox); - - label = gtk_label_new (_("on")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - wp = WEEKDAY_PICKER (weekday_picker_new ()); - - priv->weekday_picker = GTK_WIDGET (wp); - gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (wp), FALSE, FALSE, 0); - - gtk_widget_show_all (hbox); - - /* Set the weekdays */ - - weekday_picker_set_week_start_day (wp, calendar_config_get_week_start_day ()); - weekday_picker_set_days (wp, priv->weekday_day_mask); - weekday_picker_set_blocked_days (wp, priv->weekday_blocked_day_mask); - - gtk_signal_connect (GTK_OBJECT (wp), "changed", - GTK_SIGNAL_FUNC (weekday_picker_changed_cb), - rpage); -} - -/* Creates the option menu for the monthly recurrence days */ -static GtkWidget * -make_recur_month_menu (void) -{ - static const char *options[] = { - N_("day"), - N_("Monday"), - N_("Tuesday"), - N_("Wednesday"), - N_("Thursday"), - N_("Friday"), - N_("Saturday"), - N_("Sunday") - }; - - GtkWidget *menu; - GtkWidget *omenu; - int i; - - menu = gtk_menu_new (); - - for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) { - GtkWidget *item; - - item = gtk_menu_item_new_with_label (_(options[i])); - gtk_menu_append (GTK_MENU (menu), item); - gtk_widget_show (item); - } - - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - - return omenu; -} - -/* For monthly recurrences, changes the valid range of the recurrence day index - * spin button; e.g. month days are 1-31 while the valid range for a Sunday is - * the 1st through 5th of the month. - */ -static void -adjust_day_index_spin (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - GtkAdjustment *adj; - enum month_day_options month_day; - - priv = rpage->priv; - - g_assert (priv->month_day_menu != NULL); - g_assert (GTK_IS_OPTION_MENU (priv->month_day_menu)); - g_assert (priv->month_index_spin != NULL); - g_assert (GTK_IS_SPIN_BUTTON (priv->month_index_spin)); - - month_day = e_dialog_option_menu_get (priv->month_day_menu, - month_day_options_map); - - adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->month_index_spin)); - - switch (month_day) { - case MONTH_DAY_NTH: - adj->upper = 31; - gtk_adjustment_changed (adj); - break; - - case MONTH_DAY_MON: - case MONTH_DAY_TUE: - case MONTH_DAY_WED: - case MONTH_DAY_THU: - case MONTH_DAY_FRI: - case MONTH_DAY_SAT: - case MONTH_DAY_SUN: - adj->upper = 5; - gtk_adjustment_changed (adj); - - if (adj->value > 5) { - adj->value = 5; - gtk_adjustment_value_changed (adj); - } - - break; - - default: - g_assert_not_reached (); - } -} - -/* Callback used when the monthly day selection menu changes. We need - * to change the valid range of the day index spin button; e.g. days - * are 1-31 while a Sunday is the 1st through 5th. - */ -static void -month_day_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - - adjust_day_index_spin (rpage); - field_changed (rpage); - preview_recur (rpage); -} - -/* Callback used when the month index value changes. */ -static void -month_index_value_changed_cb (GtkAdjustment *adj, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - - field_changed (rpage); - preview_recur (rpage); -} - -/* Creates the special contents for monthly recurrences */ -static void -make_monthly_special (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - GtkWidget *hbox; - GtkWidget *label; - GtkAdjustment *adj; - GtkWidget *menu; - - priv = rpage->priv; - - g_assert (GTK_BIN (priv->special)->child == NULL); - g_assert (priv->month_index_spin == NULL); - g_assert (priv->month_day_menu == NULL); - - /* Create the widgets */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (priv->special), hbox); - - label = gtk_label_new (_("on the")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 31, 1, 10, 10)); - priv->month_index_spin = gtk_spin_button_new (adj, 1, 0); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_index_spin, - FALSE, FALSE, 0); - - label = gtk_label_new (_("th")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - priv->month_day_menu = make_recur_month_menu (); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_day_menu, - FALSE, FALSE, 0); - - gtk_widget_show_all (hbox); - - /* Set the options */ - - e_dialog_spin_set (priv->month_index_spin, priv->month_index); - e_dialog_option_menu_set (priv->month_day_menu, - priv->month_day, - month_day_options_map); - adjust_day_index_spin (rpage); - - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", - GTK_SIGNAL_FUNC (month_index_value_changed_cb), - rpage); - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->month_day_menu)); - gtk_signal_connect (GTK_OBJECT (menu), "selection_done", - GTK_SIGNAL_FUNC (month_day_menu_selection_done_cb), - rpage); -} - -/* Changes the recurrence-special widget to match the interval units. - * - * For daily recurrences: nothing. - * For weekly recurrences: weekday selector. - * For monthly recurrences: "on the" <nth> [day, Weekday] - * For yearly recurrences: nothing. - */ -static void -make_recurrence_special (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - icalrecurrencetype_frequency frequency; - - priv = rpage->priv; - - if (GTK_BIN (priv->special)->child != NULL) { - gtk_widget_destroy (GTK_BIN (priv->special)->child); - - priv->weekday_picker = NULL; - priv->month_index_spin = NULL; - priv->month_day_menu = NULL; - } - - frequency = e_dialog_option_menu_get (priv->interval_unit, freq_map); - - switch (frequency) { - case ICAL_DAILY_RECURRENCE: - gtk_widget_hide (priv->special); - break; - - case ICAL_WEEKLY_RECURRENCE: - make_weekly_special (rpage); - gtk_widget_show (priv->special); - break; - - case ICAL_MONTHLY_RECURRENCE: - make_monthly_special (rpage); - gtk_widget_show (priv->special); - break; - - case ICAL_YEARLY_RECURRENCE: - gtk_widget_hide (priv->special); - break; - - default: - g_assert_not_reached (); - } -} - -/* Counts the elements in the by_xxx fields of an icalrecurrencetype */ -static int -count_by_xxx (short *field, int max_elements) -{ - int i; - - for (i = 0; i < max_elements; i++) - if (field[i] == ICAL_RECURRENCE_ARRAY_MAX) - break; - - return i; -} - -/* Callback used when the ending-until date editor changes */ -static void -ending_until_changed_cb (EDateEdit *de, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - field_changed (rpage); - preview_recur (rpage); -} - -/* Creates the special contents for "ending until" (end date) recurrences */ -static void -make_ending_until_special (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - EDateEdit *de; - - priv = rpage->priv; - - g_assert (GTK_BIN (priv->ending_special)->child == NULL); - g_assert (priv->ending_date_edit == NULL); - - /* Create the widget */ - - priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE, - FALSE); - de = E_DATE_EDIT (priv->ending_date_edit); - - gtk_container_add (GTK_CONTAINER (priv->ending_special), - GTK_WIDGET (de)); - gtk_widget_show_all (GTK_WIDGET (de)); - - /* Set the value */ - - e_date_edit_set_date (de, priv->ending_date_tt.year, - priv->ending_date_tt.month, - priv->ending_date_tt.day); - - gtk_signal_connect (GTK_OBJECT (de), "changed", - GTK_SIGNAL_FUNC (ending_until_changed_cb), rpage); - - /* Make sure the EDateEdit widget uses our timezones to get the - current time. */ - e_date_edit_set_get_time_callback (de, - (EDateEditGetTimeCallback) comp_editor_get_current_time, - rpage, NULL); -} - -/* Callback used when the ending-count value changes */ -static void -ending_count_value_changed_cb (GtkAdjustment *adj, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - field_changed (rpage); - preview_recur (rpage); -} - -/* Creates the special contents for the occurrence count case */ -static void -make_ending_count_special (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - GtkWidget *hbox; - GtkWidget *label; - GtkAdjustment *adj; - - priv = rpage->priv; - - g_assert (GTK_BIN (priv->ending_special)->child == NULL); - g_assert (priv->ending_count_spin == NULL); - - /* Create the widgets */ - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (priv->ending_special), hbox); - - adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 10000, 1, 10, 10)); - priv->ending_count_spin = gtk_spin_button_new (adj, 1, 0); - gtk_box_pack_start (GTK_BOX (hbox), priv->ending_count_spin, - FALSE, FALSE, 0); - - label = gtk_label_new (_("occurrences")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - gtk_widget_show_all (hbox); - - /* Set the values */ - - e_dialog_spin_set (priv->ending_count_spin, priv->ending_count); - - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", - GTK_SIGNAL_FUNC (ending_count_value_changed_cb), - rpage); -} - -/* Changes the recurrence-ending-special widget to match the ending date option - * - * For: <n> [days, weeks, months, years, occurrences] - * Until: <date selector> - * Forever: nothing. - */ -static void -make_ending_special (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - enum ending_type ending_type; - - priv = rpage->priv; - - if (GTK_BIN (priv->ending_special)->child != NULL) { - gtk_widget_destroy (GTK_BIN (priv->ending_special)->child); - - priv->ending_date_edit = NULL; - priv->ending_count_spin = NULL; - } - - ending_type = e_dialog_option_menu_get (priv->ending_menu, - ending_types_map); - - switch (ending_type) { - case ENDING_FOR: - make_ending_count_special (rpage); - gtk_widget_show (priv->ending_special); - break; - - case ENDING_UNTIL: - make_ending_until_special (rpage); - gtk_widget_show (priv->ending_special); - break; - - case ENDING_FOREVER: - gtk_widget_hide (priv->ending_special); - break; - - default: - g_assert_not_reached (); - } -} - -/* Fills the recurrence ending date widgets with the values from the calendar - * component. - */ -static void -fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) -{ - RecurrencePagePrivate *priv; - GtkWidget *menu; - - priv = rpage->priv; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); - gtk_signal_handler_block_by_data (GTK_OBJECT (menu), rpage); - - if (r->count == 0) { - if (r->until.year == 0) { - /* Forever */ - - e_dialog_option_menu_set (priv->ending_menu, - ENDING_FOREVER, - ending_types_map); - } else { - /* Ending date */ - - priv->ending_date_tt = r->until; - e_dialog_option_menu_set (priv->ending_menu, - ENDING_UNTIL, - ending_types_map); - } - } else { - /* Count of occurrences */ - - priv->ending_count = r->count; - e_dialog_option_menu_set (priv->ending_menu, - ENDING_FOR, - ending_types_map); - } - - gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - - make_ending_special (rpage); -} - -/* fill_widgets handler for the recurrence page. This function is particularly - * tricky because it has to discriminate between recurrences we support for - * editing and the ones we don't. We only support at most one recurrence rule; - * no rdates or exrules (exdates are handled just fine elsewhere). - */ -static void -recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - CalComponentText text; - CompEditorPageDates dates; - GSList *rrule_list; - int len; - struct icalrecurrencetype *r; - int n_by_second, n_by_minute, n_by_hour; - int n_by_day, n_by_month_day, n_by_year_day; - int n_by_week_no, n_by_month, n_by_set_pos; - GtkWidget *menu; - GtkAdjustment *adj; - - rpage = RECURRENCE_PAGE (page); - priv = rpage->priv; - - /* Keep a copy of the component so that we can expand the recurrence - * set for the preview. - */ - - if (priv->comp) - gtk_object_unref (GTK_OBJECT (priv->comp)); - - priv->comp = cal_component_clone (comp); - - /* Don't send off changes during this time */ - priv->updating = TRUE; - - /* Clean the page */ - clear_widgets (rpage); - - /* Summary */ - cal_component_get_summary (comp, &text); - recurrence_page_set_summary (page, text.value); - - /* Dates */ - comp_editor_dates (&dates, comp); - recurrence_page_set_dates (page, &dates); - comp_editor_free_dates (&dates); - - /* Exceptions */ - fill_exception_widgets (rpage, comp); - - /* Set up defaults for the special widgets */ - set_special_defaults (rpage); - - /* No recurrences? */ - - if (!cal_component_has_rdates (comp) - && !cal_component_has_rrules (comp) - && !cal_component_has_exrules (comp)) { - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->none), - rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->simple), - rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->custom), - rpage); - e_dialog_radio_set (priv->none, RECUR_NONE, type_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->none), - rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->simple), - rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->custom), - rpage); - - gtk_widget_set_sensitive (priv->custom, FALSE); - - sensitize_recur_widgets (rpage); - preview_recur (rpage); - - priv->updating = FALSE; - return; - } - - /* See if it is a custom set we don't support */ - - cal_component_get_rrule_list (comp, &rrule_list); - len = g_slist_length (rrule_list); - if (len > 1 - || cal_component_has_rdates (comp) - || cal_component_has_exrules (comp)) - goto custom; - - /* Down to one rule, so test that one */ - - g_assert (len == 1); - r = rrule_list->data; - - /* Any funky frequency? */ - - if (r->freq == ICAL_SECONDLY_RECURRENCE - || r->freq == ICAL_MINUTELY_RECURRENCE - || r->freq == ICAL_HOURLY_RECURRENCE) - goto custom; - - /* Any funky shit? */ - -#define N_HAS_BY(field) (count_by_xxx (field, sizeof (field) / sizeof (field[0]))) - - n_by_second = N_HAS_BY (r->by_second); - n_by_minute = N_HAS_BY (r->by_minute); - n_by_hour = N_HAS_BY (r->by_hour); - n_by_day = N_HAS_BY (r->by_day); - n_by_month_day = N_HAS_BY (r->by_month_day); - n_by_year_day = N_HAS_BY (r->by_year_day); - n_by_week_no = N_HAS_BY (r->by_week_no); - n_by_month = N_HAS_BY (r->by_month); - n_by_set_pos = N_HAS_BY (r->by_set_pos); - - if (n_by_second != 0 - || n_by_minute != 0 - || n_by_hour != 0) - goto custom; - - /* Filter the funky shit based on the frequency; if there is nothing - * weird we can actually set the widgets. - */ - - switch (r->freq) { - case ICAL_DAILY_RECURRENCE: - if (n_by_day != 0 - || n_by_month_day != 0 - || n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos != 0) - goto custom; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - gtk_signal_handler_block_by_data (GTK_OBJECT (menu), rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_DAILY_RECURRENCE, - freq_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - break; - - case ICAL_WEEKLY_RECURRENCE: { - int i; - guint8 day_mask; - - if (n_by_month_day != 0 - || n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos != 0) - goto custom; - - day_mask = 0; - - for (i = 0; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { - enum icalrecurrencetype_weekday weekday; - int pos; - - weekday = icalrecurrencetype_day_day_of_week (r->by_day[i]); - pos = icalrecurrencetype_day_position (r->by_day[i]); - - if (pos != 0) - goto custom; - - switch (weekday) { - case ICAL_SUNDAY_WEEKDAY: - day_mask |= 1 << 0; - break; - - case ICAL_MONDAY_WEEKDAY: - day_mask |= 1 << 1; - break; - - case ICAL_TUESDAY_WEEKDAY: - day_mask |= 1 << 2; - break; - - case ICAL_WEDNESDAY_WEEKDAY: - day_mask |= 1 << 3; - break; - - case ICAL_THURSDAY_WEEKDAY: - day_mask |= 1 << 4; - break; - - case ICAL_FRIDAY_WEEKDAY: - day_mask |= 1 << 5; - break; - - case ICAL_SATURDAY_WEEKDAY: - day_mask |= 1 << 6; - break; - - default: - break; - } - } - - priv->weekday_day_mask = day_mask; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - gtk_signal_handler_block_by_data (GTK_OBJECT (menu), rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_WEEKLY_RECURRENCE, - freq_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - break; - } - - case ICAL_MONTHLY_RECURRENCE: - if (n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos > 1) - goto custom; - - if (n_by_month_day == 1) { - int nth; - - if (n_by_set_pos != 0) - goto custom; - - nth = r->by_month_day[0]; - if (nth < 1) - goto custom; - - priv->month_index = nth; - priv->month_day = MONTH_DAY_NTH; - } else if (n_by_day == 1) { - enum icalrecurrencetype_weekday weekday; - int pos; - enum month_day_options month_day; - - /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not - accept BYDAY=2TU. So we now use the same as Outlook - by default. */ - - weekday = icalrecurrencetype_day_day_of_week (r->by_day[0]); - pos = icalrecurrencetype_day_position (r->by_day[0]); - - if (pos == 0) { - if (n_by_set_pos != 1) - goto custom; - pos = r->by_set_pos[0]; - } else if (pos < 0) { - goto custom; - } - - switch (weekday) { - case ICAL_MONDAY_WEEKDAY: - month_day = MONTH_DAY_MON; - break; - - case ICAL_TUESDAY_WEEKDAY: - month_day = MONTH_DAY_TUE; - break; - - case ICAL_WEDNESDAY_WEEKDAY: - month_day = MONTH_DAY_WED; - break; - - case ICAL_THURSDAY_WEEKDAY: - month_day = MONTH_DAY_THU; - break; - - case ICAL_FRIDAY_WEEKDAY: - month_day = MONTH_DAY_FRI; - break; - - case ICAL_SATURDAY_WEEKDAY: - month_day = MONTH_DAY_SAT; - break; - - case ICAL_SUNDAY_WEEKDAY: - month_day = MONTH_DAY_SUN; - break; - - default: - goto custom; - } - - priv->month_index = pos; - priv->month_day = month_day; - } else - goto custom; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - gtk_signal_handler_block_by_data (GTK_OBJECT (menu), rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_MONTHLY_RECURRENCE, - freq_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - break; - - case ICAL_YEARLY_RECURRENCE: - if (n_by_day != 0 - || n_by_month_day != 0 - || n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos != 0) - goto custom; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - gtk_signal_handler_block_by_data (GTK_OBJECT (menu), rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_YEARLY_RECURRENCE, - freq_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - break; - - default: - goto custom; - } - - /* If we got here it means it is a simple recurrence */ - - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->none), rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->simple), rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->custom), rpage); - e_dialog_radio_set (priv->simple, RECUR_SIMPLE, type_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->none), rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->simple), rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->custom), rpage); - - gtk_widget_set_sensitive (priv->custom, FALSE); - - sensitize_recur_widgets (rpage); - make_recurrence_special (rpage); - - adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->interval_value)); - gtk_signal_handler_block_by_data (GTK_OBJECT (adj), rpage); - e_dialog_spin_set (priv->interval_value, r->interval); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (adj), rpage); - - fill_ending_date (rpage, r); - - goto out; - - custom: - - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->none), rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->simple), rpage); - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->custom), rpage); - e_dialog_radio_set (priv->custom, RECUR_CUSTOM, type_map); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->none), rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->simple), rpage); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->custom), rpage); - - gtk_widget_set_sensitive (priv->custom, TRUE); - sensitize_recur_widgets (rpage); - - out: - - cal_component_free_recur_list (rrule_list); - preview_recur (rpage); - - priv->updating = FALSE; -} - -/* fill_component handler for the recurrence page */ -static gboolean -recurrence_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (page); - fill_component (rpage, comp); - - return TRUE; -} - -/* set_summary handler for the recurrence page */ -static void -recurrence_page_set_summary (CompEditorPage *page, const char *summary) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - gchar *s; - - rpage = RECURRENCE_PAGE (page); - priv = rpage->priv; - - s = e_utf8_to_gtk_string (priv->summary, summary); - gtk_label_set_text (GTK_LABEL (priv->summary), s); - g_free (s); -} - -/* set_dates handler for the recurrence page */ -static void -recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - CalComponentDateTime dt; - struct icaltimetype icaltime; - guint8 mask; - - rpage = RECURRENCE_PAGE (page); - priv = rpage->priv; - - comp_editor_date_label (dates, priv->date_time); - - /* Copy the dates to our component */ - - if (!priv->comp) - return; - - dt.value = &icaltime; - - if (dates->start) { - icaltime = *dates->start->value; - dt.tzid = dates->start->tzid; - cal_component_set_dtstart (priv->comp, &dt); - } - - if (dates->end) { - icaltime = *dates->end->value; - dt.tzid = dates->end->tzid; - cal_component_set_dtend (priv->comp, &dt); - } - - /* Update the weekday picker if necessary */ - mask = get_start_weekday_mask (priv->comp); - if (mask == priv->weekday_blocked_day_mask) - return; - - priv->weekday_day_mask = priv->weekday_day_mask | mask; - priv->weekday_blocked_day_mask = mask; - - if (priv->weekday_picker != NULL) { - weekday_picker_set_days (WEEKDAY_PICKER (priv->weekday_picker), - priv->weekday_day_mask); - weekday_picker_set_blocked_days (WEEKDAY_PICKER (priv->weekday_picker), - priv->weekday_blocked_day_mask); - } - - /* Make sure the preview gets updated. */ - preview_recur (rpage); -} - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (RecurrencePage *rpage) -{ - CompEditorPage *page = COMP_EDITOR_PAGE (rpage); - RecurrencePagePrivate *priv; - GSList *accel_groups; - GtkWidget *toplevel; - - priv = rpage->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->main = GW ("recurrence-page"); - if (!priv->main) - return FALSE; - - /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ - toplevel = gtk_widget_get_toplevel (priv->main); - accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_widget_unparent (priv->main); - - priv->summary = GW ("summary"); - priv->date_time = GW ("date-time"); - - priv->none = GW ("none"); - priv->simple = GW ("simple"); - priv->custom = GW ("custom"); - priv->params = GW ("params"); - - priv->interval_value = GW ("interval-value"); - priv->interval_unit = GW ("interval-unit"); - priv->special = GW ("special"); - priv->ending_menu = GW ("ending-menu"); - priv->ending_special = GW ("ending-special"); - priv->custom_warning_bin = GW ("custom-warning-bin"); - - priv->exception_date = GW ("exception-date"); - priv->exception_list = GW ("exception-list"); - priv->exception_add = GW ("exception-add"); - priv->exception_modify = GW ("exception-modify"); - priv->exception_delete = GW ("exception-delete"); - - priv->preview_bin = GW ("preview-bin"); - -#undef GW - - return (priv->summary - && priv->date_time - && priv->none - && priv->simple - && priv->custom - && priv->params - && priv->interval_value - && priv->interval_unit - && priv->special - && priv->ending_menu - && priv->ending_special - && priv->custom_warning_bin - && priv->exception_date - && priv->exception_list - && priv->exception_add - && priv->exception_modify - && priv->exception_delete - && priv->preview_bin); -} - -/* Callback used when the displayed date range in the recurrence preview - * calendar changes. - */ -static void -preview_date_range_changed_cb (ECalendarItem *item, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - preview_recur (rpage); -} - -/* Callback used when one of the recurrence type radio buttons is toggled. We - * enable or disable the recurrence parameters. - */ -static void -type_toggled_cb (GtkToggleButton *toggle, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - - field_changed (rpage); - - if (toggle->active) { - sensitize_recur_widgets (rpage); - preview_recur (rpage); - } -} - -/* Callback used when the recurrence interval value spin button changes. */ -static void -interval_value_changed_cb (GtkAdjustment *adj, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - - field_changed (rpage); - preview_recur (rpage); -} - -/* Callback used when the recurrence interval option menu changes. We need to - * change the contents of the recurrence special widget. - */ -static void -interval_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - - field_changed (rpage); - make_recurrence_special (rpage); - preview_recur (rpage); -} - -/* Callback used when the recurrence ending option menu changes. We need to - * change the contents of the ending special widget. - */ -static void -ending_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (data); - - field_changed (rpage); - make_ending_special (rpage); - preview_recur (rpage); -} - -/* Callback for the "add exception" button */ -static void -exception_add_cb (GtkWidget *widget, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - CalComponentDateTime dt; - struct icaltimetype icaltime = icaltime_null_time (); - gboolean date_set; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - field_changed (rpage); - - dt.value = &icaltime; - - /* We use DATE values for exceptions, so we don't need a TZID. */ - dt.tzid = NULL; - icaltime.is_date = 1; - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->exception_date), - &icaltime.year, - &icaltime.month, - &icaltime.day); - g_assert (date_set); - - append_exception (rpage, &dt); - preview_recur (rpage); -} - -/* Callback for the "modify exception" button */ -static void -exception_modify_cb (GtkWidget *widget, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - GtkCList *clist; - CalComponentDateTime *dt; - struct icaltimetype *tt; - int sel; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - clist = GTK_CLIST (priv->exception_list); - if (!clist->selection) - return; - - field_changed (rpage); - - sel = GPOINTER_TO_INT (clist->selection->data); - - dt = gtk_clist_get_row_data (clist, sel); - tt = dt->value; - e_date_edit_get_date (E_DATE_EDIT (priv->exception_date), - &tt->year, &tt->month, &tt->day); - tt->hour = 0; - tt->minute = 0; - tt->second = 0; - tt->is_date = 1; - - /* We get rid of any old TZID, since we are using a DATE value now. */ - g_free ((char*)dt->tzid); - dt->tzid = NULL; - - gtk_clist_set_text (clist, sel, 0, get_exception_string (dt)); - - preview_recur (rpage); -} - -/* Callback for the "delete exception" button */ -static void -exception_delete_cb (GtkWidget *widget, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - GtkCList *clist; - int sel; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - clist = GTK_CLIST (priv->exception_list); - if (!clist->selection) - return; - - field_changed (rpage); - - sel = GPOINTER_TO_INT (clist->selection->data); - - gtk_clist_remove (clist, sel); - if (sel >= clist->rows) - sel--; - - if (clist->rows > 0) - gtk_clist_select_row (clist, sel, 0); - else { - gtk_widget_set_sensitive (priv->exception_modify, FALSE); - gtk_widget_set_sensitive (priv->exception_delete, FALSE); - } - - preview_recur (rpage); -} - -/* Callback used when a row is selected in the list of exception - * dates. We must update the date/time widgets to reflect the - * exception's value. - */ -static void -exception_select_row_cb (GtkCList *clist, gint row, gint col, - GdkEvent *event, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - CalComponentDateTime *dt; - struct icaltimetype *t; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - /* Sometimes GtkCList emits a 'row-selected' signal for row 0 when - there are 0 rows in the list (after you delete the last row). - So we check that the row is valid here. */ - if (row >= clist->rows) - return; - - dt = gtk_clist_get_row_data (clist, row); - g_assert (dt != NULL); - - t = dt->value; - - e_date_edit_set_date (E_DATE_EDIT (priv->exception_date), - t->year, t->month, t->day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->exception_date), - t->hour, t->minute); -} - -/* This is called when any field is changed; it notifies upstream. */ -static void -field_changed (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - - priv = rpage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (rpage)); -} - -/* Hooks the widget signals */ -static void -init_widgets (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - ECalendar *ecal; - GtkAdjustment *adj; - GtkWidget *menu; - - priv = rpage->priv; - - /* Recurrence preview */ - - priv->preview_calendar = e_calendar_new (); - ecal = E_CALENDAR (priv->preview_calendar); - gtk_signal_connect (GTK_OBJECT (ecal->calitem), "date_range_changed", - GTK_SIGNAL_FUNC (preview_date_range_changed_cb), - rpage); - calendar_config_configure_e_calendar (ecal); - e_calendar_item_set_max_days_sel (ecal->calitem, 0); - gtk_container_add (GTK_CONTAINER (priv->preview_bin), - priv->preview_calendar); - gtk_widget_show (priv->preview_calendar); - - /* Make sure the EDateEdit widgets and ECalendarItem use our timezones - to get the current time. */ - e_date_edit_set_show_time (E_DATE_EDIT (priv->exception_date), FALSE); - e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->exception_date), - (EDateEditGetTimeCallback) comp_editor_get_current_time, - rpage, NULL); - e_calendar_item_set_get_time_callback (ecal->calitem, - (ECalendarItemGetTimeCallback) comp_editor_get_current_time, - rpage, NULL); - - /* Recurrence types */ - - gtk_signal_connect (GTK_OBJECT (priv->none), "toggled", - GTK_SIGNAL_FUNC (type_toggled_cb), rpage); - gtk_signal_connect (GTK_OBJECT (priv->simple), "toggled", - GTK_SIGNAL_FUNC (type_toggled_cb), rpage); - gtk_signal_connect (GTK_OBJECT (priv->custom), "toggled", - GTK_SIGNAL_FUNC (type_toggled_cb), rpage); - - /* Recurrence interval */ - - adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->interval_value)); - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", - GTK_SIGNAL_FUNC (interval_value_changed_cb), - rpage); - - /* Recurrence units */ - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - gtk_signal_connect (GTK_OBJECT (menu), "selection_done", - GTK_SIGNAL_FUNC (interval_selection_done_cb), - rpage); - - /* Recurrence ending */ - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); - gtk_signal_connect (GTK_OBJECT (menu), "selection_done", - GTK_SIGNAL_FUNC (ending_selection_done_cb), rpage); - - /* Exception buttons */ - - gtk_signal_connect (GTK_OBJECT (priv->exception_add), "clicked", - GTK_SIGNAL_FUNC (exception_add_cb), rpage); - gtk_signal_connect (GTK_OBJECT (priv->exception_modify), "clicked", - GTK_SIGNAL_FUNC (exception_modify_cb), rpage); - gtk_signal_connect (GTK_OBJECT (priv->exception_delete), "clicked", - GTK_SIGNAL_FUNC (exception_delete_cb), rpage); - - /* Selections in the exceptions list */ - - gtk_signal_connect (GTK_OBJECT (priv->exception_list), "select_row", - GTK_SIGNAL_FUNC (exception_select_row_cb), rpage); -} - - - -/** - * recurrence_page_construct: - * @rpage: A recurrence page. - * - * Constructs a recurrence page by loading its Glade data. - * - * Return value: The same object as @rpage, or NULL if the widgets could not be - * created. - **/ -RecurrencePage * -recurrence_page_construct (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - - priv = rpage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR - "/recurrence-page.glade", NULL); - if (!priv->xml) { - g_message ("recurrence_page_construct(): " - "Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (rpage)) { - g_message ("recurrence_page_construct(): " - "Could not find all widgets in the XML file!"); - return NULL; - } - - init_widgets (rpage); - - return rpage; -} - -/** - * recurrence_page_new: - * - * Creates a new recurrence page. - * - * Return value: A newly-created recurrence page, or NULL if the page could not - * be created. - **/ -RecurrencePage * -recurrence_page_new (void) -{ - RecurrencePage *rpage; - - rpage = gtk_type_new (TYPE_RECURRENCE_PAGE); - if (!recurrence_page_construct (rpage)) { - gtk_object_unref (GTK_OBJECT (rpage)); - return NULL; - } - - return rpage; -} - - -GtkWidget *make_exdate_date_edit (void); - -GtkWidget * -make_exdate_date_edit (void) -{ - return comp_editor_new_date_edit (TRUE, TRUE, FALSE); -} - diff --git a/calendar/gui/dialogs/recurrence-page.glade b/calendar/gui/dialogs/recurrence-page.glade deleted file mode 100644 index a044a771aa..0000000000 --- a/calendar/gui/dialogs/recurrence-page.glade +++ /dev/null @@ -1,602 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>recurrence-page</name> - <program_name>recurrence-page</program_name> - <directory></directory> - <source_directory>.</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> -</project> - -<widget> - <class>GtkWindow</class> - <name>recurrence-toplevel</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>recurrence-page</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkFrame</class> - <name>frame35</name> - <label>Basics</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table14</name> - <border_width>4</border_width> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>2</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label66</name> - <label>Summary:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label67</name> - <label>Date/Time:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>summary</name> - <width>10</width> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>date-time</name> - <width>10</width> - <label></label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox55</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame36</name> - <label>Recurrence Rule</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox56</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox56</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>none</name> - <can_focus>True</can_focus> - <label>_No recurrence</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>recurrence-radio</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>simple</name> - <can_focus>True</can_focus> - <label>_Simple recurrence</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>recurrence-radio</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>custom</name> - <can_focus>True</can_focus> - <label>_Custom recurrence</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>recurrence-radio</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox57</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>params</name> - <homogeneous>False</homogeneous> - <spacing>2</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label68</name> - <label>Every</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>interval-value</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>True</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>1</value> - <lower>1</lower> - <upper>10000</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>interval-unit</name> - <can_focus>True</can_focus> - <items>day(s) -week(s) -month(s) -year(s) -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>special</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>ending-menu</name> - <can_focus>True</can_focus> - <items>for -until -forever -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>ending-special</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>custom-warning-bin</name> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox59</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame37</name> - <label>Exceptions</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox60</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox57</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>exception-add</name> - <can_focus>True</can_focus> - <label>A_dd</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>exception-modify</name> - <can_focus>True</can_focus> - <label>_Modify</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>exception-delete</name> - <can_focus>True</can_focus> - <label>_Remove</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox58</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Custom</class> - <name>exception-date</name> - <creation_function>make_exdate_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 16 May 2000 01:42:29 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow14</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkCList</class> - <name>exception-list</name> - <can_focus>True</can_focus> - <columns>1</columns> - <column_widths>80</column_widths> - <selection_mode>GTK_SELECTION_BROWSE</selection_mode> - <show_titles>False</show_titles> - <shadow_type>GTK_SHADOW_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label69</name> - <label>label21</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox59</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label70</name> - <label>Preview</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>preview-bin</name> - <xalign>0</xalign> - <yalign>0</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/recurrence-page.h b/calendar/gui/dialogs/recurrence-page.h deleted file mode 100644 index 29395f586f..0000000000 --- a/calendar/gui/dialogs/recurrence-page.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Evolution calendar - Recurrence page of the calendar component dialogs - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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 RECURRENCE_PAGE_H -#define RECURRENCE_PAGE_H - -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_RECURRENCE_PAGE (recurrence_page_get_type ()) -#define RECURRENCE_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_RECURRENCE_PAGE, RecurrencePage)) -#define RECURRENCE_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_RECURRENCE_PAGE, RecurrencePageClass)) -#define IS_RECURRENCE_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_RECURRENCE_PAGE)) -#define IS_RECURRENCE_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_RECURRENCE_PAGE)) - -typedef struct _RecurrencePagePrivate RecurrencePagePrivate; - -typedef struct { - CompEditorPage page; - - /* Private data */ - RecurrencePagePrivate *priv; -} RecurrencePage; - -typedef struct { - CompEditorPageClass parent_class; -} RecurrencePageClass; - - -GtkType recurrence_page_get_type (void); -RecurrencePage *recurrence_page_construct (RecurrencePage *rpage); -RecurrencePage *recurrence_page_new (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c deleted file mode 100644 index 67a43a7320..0000000000 --- a/calendar/gui/dialogs/save-comp.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Evolution calendar - Delete calendar component dialog - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> -#include <gal/widgets/e-unicode.h> -#include "save-comp.h" - - - -/** - * save_component_dialog: - * @parent: Window to use as the transient dialog's parent. - * - * Pops up a dialog box asking the user whether he wants to save changes for - * a calendar component. - * - * Return value: TRUE if changes shold be saved, FALSE otherwise. - **/ -gint -save_component_dialog (GtkWindow *parent) -{ - GtkWidget *dialog; - - dialog = gnome_message_box_new (_("Do you want to save changes?"), - GNOME_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - gnome_dialog_grab_focus (GNOME_DIALOG (dialog), 0); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent); - - return gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); -} diff --git a/calendar/gui/dialogs/save-comp.h b/calendar/gui/dialogs/save-comp.h deleted file mode 100644 index 7090464a4e..0000000000 --- a/calendar/gui/dialogs/save-comp.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Evolution calendar - Delete calendar component dialog - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * 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. - * - * 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 SAVE_COMP_H -#define SAVE_COMP_H - -#include <gtk/gtkwindow.h> - -gint save_component_dialog (GtkWindow *parent); - -#endif diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c deleted file mode 100644 index f9ee7a10a9..0000000000 --- a/calendar/gui/dialogs/schedule-page.c +++ /dev/null @@ -1,536 +0,0 @@ -/* Evolution calendar - Scheduling page - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtkwindow.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <glade/glade.h> -#include <gal/e-table/e-cell-combo.h> -#include <gal/e-table/e-cell-text.h> -#include <gal/e-table/e-table-simple.h> -#include <gal/e-table/e-table-scrolled.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-gui-utils.h> -#include <widgets/misc/e-dateedit.h> -#include <e-util/e-dialog-widgets.h> -#include "../e-meeting-time-sel.h" -#include "../itip-utils.h" -#include "comp-editor-util.h" -#include "e-delegate-dialog.h" -#include "schedule-page.h" - - - -/* Private part of the SchedulePage structure */ -struct _SchedulePagePrivate { - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - GtkWidget *main; - - /* Model */ - EMeetingModel *model; - - /* Selector */ - EMeetingTimeSelector *sel; - - /* The timezone we use. Note that we use the same timezone for the - start and end date. We convert the end date if it is passed in in - another timezone. */ - icaltimezone *zone; - - gboolean updating; -}; - - - -static void schedule_page_class_init (SchedulePageClass *class); -static void schedule_page_init (SchedulePage *spage); -static void schedule_page_destroy (GtkObject *object); - -static GtkWidget *schedule_page_get_widget (CompEditorPage *page); -static void schedule_page_focus_main_widget (CompEditorPage *page); -static void schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp); -static gboolean schedule_page_fill_component (CompEditorPage *page, CalComponent *comp); -static void schedule_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); - -static void times_changed_cb (GtkWidget *widget, gpointer data); - -static CompEditorPageClass *parent_class = NULL; - - - -/** - * schedule_page_get_type: - * - * Registers the #SchedulePage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #SchedulePage class. - **/ -GtkType -schedule_page_get_type (void) -{ - static GtkType schedule_page_type; - - if (!schedule_page_type) { - static const GtkTypeInfo schedule_page_info = { - "SchedulePage", - sizeof (SchedulePage), - sizeof (SchedulePageClass), - (GtkClassInitFunc) schedule_page_class_init, - (GtkObjectInitFunc) schedule_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - schedule_page_type = - gtk_type_unique (TYPE_COMP_EDITOR_PAGE, - &schedule_page_info); - } - - return schedule_page_type; -} - -/* Class initialization function for the schedule page */ -static void -schedule_page_class_init (SchedulePageClass *class) -{ - CompEditorPageClass *editor_page_class; - GtkObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); - - editor_page_class->get_widget = schedule_page_get_widget; - editor_page_class->focus_main_widget = schedule_page_focus_main_widget; - editor_page_class->fill_widgets = schedule_page_fill_widgets; - editor_page_class->fill_component = schedule_page_fill_component; - editor_page_class->set_summary = NULL; - editor_page_class->set_dates = schedule_page_set_dates; - - object_class->destroy = schedule_page_destroy; -} - -/* Object initialization function for the schedule page */ -static void -schedule_page_init (SchedulePage *spage) -{ - SchedulePagePrivate *priv; - - priv = g_new0 (SchedulePagePrivate, 1); - spage->priv = priv; - - priv->xml = NULL; - - priv->main = NULL; - - priv->zone = NULL; - - priv->updating = FALSE; -} - -/* Destroy handler for the schedule page */ -static void -schedule_page_destroy (GtkObject *object) -{ - SchedulePage *spage; - SchedulePagePrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_SCHEDULE_PAGE (object)); - - spage = SCHEDULE_PAGE (object); - priv = spage->priv; - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - gtk_object_unref (GTK_OBJECT (priv->model)); - - g_free (priv); - spage->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* get_widget handler for the schedule page */ -static GtkWidget * -schedule_page_get_widget (CompEditorPage *page) -{ - SchedulePage *spage; - SchedulePagePrivate *priv; - - spage = SCHEDULE_PAGE (page); - priv = spage->priv; - - return priv->main; -} - -/* focus_main_widget handler for the schedule page */ -static void -schedule_page_focus_main_widget (CompEditorPage *page) -{ - SchedulePage *spage; - SchedulePagePrivate *priv; - - spage = SCHEDULE_PAGE (page); - priv = spage->priv; - - gtk_widget_grab_focus (GTK_WIDGET (priv->sel)); -} - -/* Set date/time */ -static void -update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponentDateTime *end_date) -{ - SchedulePagePrivate *priv; - struct icaltimetype start_tt, end_tt; - icaltimezone *start_zone = NULL, *end_zone = NULL; - CalClientGetStatus status; - gboolean all_day; - - priv = spage->priv; - - /* Note that if we are creating a new event, the timezones may not be - on the server, so we try to get the builtin timezone with the TZID - first. */ - start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid); - if (!start_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client, - start_date->tzid, - &start_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - start_date->tzid ? start_date->tzid : ""); - } - - end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid); - if (!end_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client, - end_date->tzid, - &end_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - end_date->tzid ? end_date->tzid : ""); - } - - start_tt = *start_date->value; - end_tt = *end_date->value; - - /* If the end zone is not the same as the start zone, we convert it. */ - priv->zone = start_zone; - if (start_zone != end_zone) { - icaltimezone_convert_time (&end_tt, end_zone, start_zone); - } - e_meeting_model_set_zone (priv->model, priv->zone); - - all_day = (start_tt.is_date && end_tt.is_date) ? TRUE : FALSE; - - /* For All Day Events, if DTEND is after DTSTART, we subtract 1 day - from it. */ - if (all_day) { - if (icaltime_compare_date_only (end_tt, start_tt) > 0) { - icaltime_adjust (&end_tt, -1, 0, 0, 0); - } - } - - e_meeting_time_selector_set_all_day (priv->sel, all_day); - - e_date_edit_set_date (E_DATE_EDIT (priv->sel->start_date_edit), start_tt.year, - start_tt.month, start_tt.day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->sel->start_date_edit), - start_tt.hour, start_tt.minute); - - e_date_edit_set_date (E_DATE_EDIT (priv->sel->end_date_edit), end_tt.year, - end_tt.month, end_tt.day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->sel->end_date_edit), - end_tt.hour, end_tt.minute); - -} - - -/* Fills the widgets with default values */ -static void -clear_widgets (SchedulePage *spage) -{ - SchedulePagePrivate *priv; - - priv = spage->priv; -} - -/* fill_widgets handler for the schedule page */ -static void -schedule_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - SchedulePage *spage; - SchedulePagePrivate *priv; - CalComponentDateTime start_date, end_date; - - spage = SCHEDULE_PAGE (page); - priv = spage->priv; - - priv->updating = TRUE; - - /* Clean the screen */ - clear_widgets (spage); - - /* Start and end times */ - cal_component_get_dtstart (comp, &start_date); - cal_component_get_dtend (comp, &end_date); - update_time (spage, &start_date, &end_date); - - cal_component_free_datetime (&start_date); - cal_component_free_datetime (&end_date); - - priv->updating = FALSE; -} - -/* fill_component handler for the schedule page */ -static gboolean -schedule_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - SchedulePage *spage; - SchedulePagePrivate *priv; - - spage = SCHEDULE_PAGE (page); - priv = spage->priv; - - return TRUE; -} - -static void -schedule_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - SchedulePage *spage; - SchedulePagePrivate *priv; - - spage = SCHEDULE_PAGE (page); - priv = spage->priv; - - priv->updating = TRUE; - - update_time (spage, dates->start, dates->end); - - priv->updating = FALSE; -} - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (SchedulePage *spage) -{ - CompEditorPage *page = COMP_EDITOR_PAGE (spage); - SchedulePagePrivate *priv; - GSList *accel_groups; - GtkWidget *toplevel; - - priv = spage->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->main = GW ("schedule-page"); - if (!priv->main) - return FALSE; - - /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ - toplevel = gtk_widget_get_toplevel (priv->main); - accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_widget_unparent (priv->main); - -#undef GW - - return TRUE; -} - -static gboolean -init_widgets (SchedulePage *spage) -{ - SchedulePagePrivate *priv; - - priv = spage->priv; - - gtk_signal_connect (GTK_OBJECT (priv->sel), - "changed", times_changed_cb, spage); - - return TRUE; - -} - - - -/** - * schedule_page_construct: - * @spage: An schedule page. - * - * Constructs an schedule page by loading its Glade data. - * - * Return value: The same object as @spage, or NULL if the widgets could not - * be created. - **/ -SchedulePage * -schedule_page_construct (SchedulePage *spage, EMeetingModel *emm) -{ - SchedulePagePrivate *priv; - - priv = spage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR - "/schedule-page.glade", NULL); - if (!priv->xml) { - g_message ("schedule_page_construct(): " - "Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (spage)) { - g_message ("schedule_page_construct(): " - "Could not find all widgets in the XML file!"); - return NULL; - } - - /* Model */ - gtk_object_ref (GTK_OBJECT (emm)); - priv->model = emm; - - /* Selector */ - priv->sel = E_MEETING_TIME_SELECTOR (e_meeting_time_selector_new (emm)); - gtk_widget_show (GTK_WIDGET (priv->sel)); - gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 2); - - if (!init_widgets (spage)) { - g_message ("schedule_page_construct(): " - "Could not initialize the widgets!"); - return NULL; - } - - return spage; -} - -/** - * schedule_page_new: - * - * Creates a new schedule page. - * - * Return value: A newly-created schedule page, or NULL if the page could - * not be created. - **/ -SchedulePage * -schedule_page_new (EMeetingModel *emm) -{ - SchedulePage *spage; - - spage = gtk_type_new (TYPE_SCHEDULE_PAGE); - if (!schedule_page_construct (spage, emm)) { - gtk_object_unref (GTK_OBJECT (spage)); - return NULL; - } - - return spage; -} - -static void -times_changed_cb (GtkWidget *widget, gpointer data) -{ - SchedulePage *spage = data; - SchedulePagePrivate *priv; - CompEditorPageDates dates; - CalComponentDateTime start_dt, end_dt; - struct icaltimetype start_tt = icaltime_null_time (); - struct icaltimetype end_tt = icaltime_null_time (); - - priv = spage->priv; - - if (priv->updating) - return; - - e_date_edit_get_date (E_DATE_EDIT (priv->sel->start_date_edit), - &start_tt.year, - &start_tt.month, - &start_tt.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->sel->start_date_edit), - &start_tt.hour, - &start_tt.minute); - e_date_edit_get_date (E_DATE_EDIT (priv->sel->end_date_edit), - &end_tt.year, - &end_tt.month, - &end_tt.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->sel->end_date_edit), - &end_tt.hour, - &end_tt.minute); - - start_dt.value = &start_tt; - end_dt.value = &end_tt; - - if (e_date_edit_get_show_time (E_DATE_EDIT (priv->sel->start_date_edit))) { - /* We set the start and end to the same timezone. */ - start_dt.tzid = icaltimezone_get_tzid (priv->zone); - end_dt.tzid = start_dt.tzid; - } else { - /* For All-Day Events, we set the timezone to NULL, and add - 1 day to DTEND. */ - start_dt.value->is_date = TRUE; - start_dt.tzid = NULL; - end_dt.value->is_date = TRUE; - icaltime_adjust (&end_tt, 1, 0, 0, 0); - end_dt.tzid = NULL; - } - - dates.start = &start_dt; - dates.end = &end_dt; - dates.due = NULL; - dates.complete = NULL; - - comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (spage), - &dates); -} diff --git a/calendar/gui/dialogs/schedule-page.glade b/calendar/gui/dialogs/schedule-page.glade deleted file mode 100644 index 95a2147659..0000000000 --- a/calendar/gui/dialogs/schedule-page.glade +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>task-details-page</name> - <program_name>task-details-page</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>schedule-toplevel</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>schedule-page</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/schedule-page.h b/calendar/gui/dialogs/schedule-page.h deleted file mode 100644 index c485ba0f9e..0000000000 --- a/calendar/gui/dialogs/schedule-page.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Evolution calendar - Scheduling page - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: JP Rosevear <jpr@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 SCHEDULE_PAGE_H -#define SCHEDULE_PAGE_H - -#include "../e-meeting-model.h" -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_SCHEDULE_PAGE (schedule_page_get_type ()) -#define SCHEDULE_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_SCHEDULE_PAGE, SchedulePage)) -#define SCHEDULE_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_SCHEDULE_PAGE, SchedulePageClass)) -#define IS_SCHEDULE_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_SCHEDULE_PAGE)) -#define IS_SCHEDULE_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_SCHEDULE_PAGE)) - -typedef struct _SchedulePagePrivate SchedulePagePrivate; - -typedef struct { - CompEditorPage page; - - /* Private data */ - SchedulePagePrivate *priv; -} SchedulePage; - -typedef struct { - CompEditorPageClass parent_class; -} SchedulePageClass; - - -GtkType schedule_page_get_type (void); -SchedulePage *schedule_page_construct (SchedulePage *mpage, EMeetingModel *emm); -SchedulePage *schedule_page_new (EMeetingModel *emm); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c deleted file mode 100644 index 2afd92320e..0000000000 --- a/calendar/gui/dialogs/send-comp.c +++ /dev/null @@ -1,87 +0,0 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-uidefs.h> -#include <gal/widgets/e-unicode.h> -#include "send-comp.h" - - - -/** - * send_component_dialog: - * - * Pops up a dialog box asking the user whether he wants to send a - * iTip/iMip message - * - * Return value: TRUE if the user clicked Yes, FALSE otherwise. - **/ -gboolean -send_component_dialog (CalComponent *comp, gboolean new) -{ - GtkWidget *dialog; - CalComponentVType vtype; - char *str; - - vtype = cal_component_get_vtype (comp); - - switch (vtype) { - case CAL_COMPONENT_EVENT: - if (new) - str = g_strdup_printf (_("The meeting information has " - "been created. Send it?")); - else - str = g_strdup_printf (_("The meeting information has " - "changed. Send an updated " - "version?")); - break; - - case CAL_COMPONENT_TODO: - if (new) - str = g_strdup_printf (_("The task assignment " - "information has been " - "created. Send it?")); - else - str = g_strdup_printf (_("The task information has " - "changed. Send an updated " - "version?")); - break; - - default: - g_message ("send_component_dialog(): " - "Cannot handle object of type %d", vtype); - return FALSE; - } - - dialog = gnome_question_dialog_modal (str, NULL, NULL); - - if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_YES) - return TRUE; - else - return FALSE; -} diff --git a/calendar/gui/dialogs/send-comp.h b/calendar/gui/dialogs/send-comp.h deleted file mode 100644 index 9a77d8bd4e..0000000000 --- a/calendar/gui/dialogs/send-comp.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Evolution calendar - Send calendar component dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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 SEND_COMP_H -#define SEND_COMP_H - -#include <glib.h> -#include <cal-util/cal-component.h> - -gboolean send_component_dialog (CalComponent *comp, gboolean new); - -#endif diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c deleted file mode 100644 index 47fbf3a945..0000000000 --- a/calendar/gui/dialogs/task-details-page.c +++ /dev/null @@ -1,766 +0,0 @@ -/* Evolution calendar - task details page - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtksignal.h> -#include <gtk/gtktogglebutton.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include <widgets/misc/e-dateedit.h> -#include "e-util/e-dialog-widgets.h" -#include "../calendar-config.h" -#include "../e-timezone-entry.h" -#include "comp-editor-util.h" -#include "task-details-page.h" - - - -/* Private part of the TaskDetailsPage structure */ -struct _TaskDetailsPagePrivate { - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - GtkWidget *main; - - GtkWidget *status; - GtkWidget *priority; - GtkWidget *percent_complete; - - GtkWidget *completed_date; - - GtkWidget *url; - - gboolean updating; -}; - -/* 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 -}; - -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 void task_details_page_class_init (TaskDetailsPageClass *class); -static void task_details_page_init (TaskDetailsPage *tdpage); -static void task_details_page_destroy (GtkObject *object); - -static GtkWidget *task_details_page_get_widget (CompEditorPage *page); -static void task_details_page_focus_main_widget (CompEditorPage *page); -static void task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp); -static gboolean task_details_page_fill_component (CompEditorPage *page, CalComponent *comp); - -static CompEditorPageClass *parent_class = NULL; - - - -/** - * task_details_page_get_type: - * - * Registers the #TaskDetailsPage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #TaskDetailsPage class. - **/ -GtkType -task_details_page_get_type (void) -{ - static GtkType task_details_page_type; - - if (!task_details_page_type) { - static const GtkTypeInfo task_details_page_info = { - "TaskDetailsPage", - sizeof (TaskDetailsPage), - sizeof (TaskDetailsPageClass), - (GtkClassInitFunc) task_details_page_class_init, - (GtkObjectInitFunc) task_details_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - task_details_page_type = - gtk_type_unique (TYPE_COMP_EDITOR_PAGE, - &task_details_page_info); - } - - return task_details_page_type; -} - -/* Class initialization function for the task page */ -static void -task_details_page_class_init (TaskDetailsPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GtkObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); - - editor_page_class->get_widget = task_details_page_get_widget; - editor_page_class->focus_main_widget = task_details_page_focus_main_widget; - editor_page_class->fill_widgets = task_details_page_fill_widgets; - editor_page_class->fill_component = task_details_page_fill_component; - - object_class->destroy = task_details_page_destroy; -} - -/* Object initialization function for the task page */ -static void -task_details_page_init (TaskDetailsPage *tdpage) -{ - TaskDetailsPagePrivate *priv; - - priv = g_new0 (TaskDetailsPagePrivate, 1); - tdpage->priv = priv; - - priv->xml = NULL; - - priv->main = NULL; - - priv->status = NULL; - priv->priority = NULL; - priv->percent_complete = NULL; - - priv->completed_date = NULL; - priv->url = NULL; - - priv->updating = FALSE; -} - -/* Destroy handler for the task page */ -static void -task_details_page_destroy (GtkObject *object) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_TASK_DETAILS_PAGE (object)); - - tdpage = TASK_DETAILS_PAGE (object); - priv = tdpage->priv; - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - g_free (priv); - tdpage->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* get_widget handler for the task page */ -static GtkWidget * -task_details_page_get_widget (CompEditorPage *page) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - - tdpage = TASK_DETAILS_PAGE (page); - priv = tdpage->priv; - - return priv->main; -} - -/* focus_main_widget handler for the task page */ -static void -task_details_page_focus_main_widget (CompEditorPage *page) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - - tdpage = TASK_DETAILS_PAGE (page); - priv = tdpage->priv; - - gtk_widget_grab_focus (priv->status); -} - - -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; -} - -/* Fills the widgets with default values */ -static void -clear_widgets (TaskDetailsPage *tdpage) -{ - TaskDetailsPagePrivate *priv; - - priv = tdpage->priv; - - /* Date completed */ - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), -1); - - /* URL */ - e_dialog_editable_set (priv->url, NULL); -} - -/* fill_widgets handler for the task page */ -static void -task_details_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - int *priority_value, *percent; - TaskEditorPriority priority; - icalproperty_status status; - const char *url; - struct icaltimetype *completed = NULL; - - tdpage = TASK_DETAILS_PAGE (page); - priv = tdpage->priv; - - priv->updating = TRUE; - - /* Clean the screen */ - clear_widgets (tdpage); - - /* Percent Complete. */ - cal_component_get_percent (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 (comp, &status); - if (status == ICAL_STATUS_NONE) { - /* Try to use 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; - } - e_dialog_option_menu_set (priv->status, status, status_map); - - /* Completed Date. */ - cal_component_get_completed (comp, &completed); - if (completed) { - icaltimezone *utc_zone, *zone; - char *location; - - /* Completed is in UTC, but that would confuse the user, so - we convert it to local time. */ - utc_zone = icaltimezone_get_utc_timezone (); - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - - icaltimezone_convert_time (completed, utc_zone, zone); - - e_date_edit_set_date (E_DATE_EDIT (priv->completed_date), - completed->year, completed->month, - completed->day); - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->completed_date), - completed->hour, - completed->minute); - - cal_component_free_icaltimetype (completed); - } - - /* Priority. */ - cal_component_get_priority (comp, &priority_value); - if (priority_value) { - priority = priority_value_to_index (*priority_value); - cal_component_free_priority (priority_value); - } else { - priority = PRIORITY_UNDEFINED; - } - e_dialog_option_menu_set (priv->priority, priority, priority_map); - - /* URL */ - cal_component_get_url (comp, &url); - e_dialog_editable_set (priv->url, url); - - priv->updating = FALSE; -} - -/* fill_component handler for the task page */ -static gboolean -task_details_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - struct icaltimetype icaltime; - icalproperty_status status; - TaskEditorPriority priority; - int priority_value, percent; - char *url; - gboolean date_set; - - tdpage = TASK_DETAILS_PAGE (page); - priv = tdpage->priv; - - /* 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); - cal_component_set_status (comp, status); - - /* 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); - - icaltime = icaltime_null_time (); - - /* COMPLETED must be in UTC. */ - icaltime.is_utc = 1; - - /* Completed Date. */ - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->completed_date), - &icaltime.year, - &icaltime.month, - &icaltime.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->completed_date), - &icaltime.hour, - &icaltime.minute); - if (date_set) { - /* COMPLETED must be in UTC, so we assume that the date in the - dialog is in the current timezone, and we now convert it - to UTC. FIXME: We should really use one timezone for the - entire time the dialog is shown. Otherwise if the user - changes the timezone, the COMPLETED date may get changed - as well. */ - char *location = calendar_config_get_timezone (); - icaltimezone *zone = icaltimezone_get_builtin_timezone (location); - icaltimezone_convert_time (&icaltime, zone, - icaltimezone_get_utc_timezone ()); - cal_component_set_completed (comp, &icaltime); - } else { - cal_component_set_completed (comp, NULL); - } - - /* URL. */ - url = e_dialog_editable_get (priv->url); - cal_component_set_url (comp, url); - if (url) - g_free (url); - - return TRUE; -} - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (TaskDetailsPage *tdpage) -{ - CompEditorPage *page = COMP_EDITOR_PAGE (tdpage); - TaskDetailsPagePrivate *priv; - GSList *accel_groups; - GtkWidget *toplevel; - - priv = tdpage->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->main = GW ("task-details-page"); - if (!priv->main) - return FALSE; - - /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ - toplevel = gtk_widget_get_toplevel (priv->main); - accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_widget_unparent (priv->main); - - priv->status = GW ("status"); - priv->priority = GW ("priority"); - priv->percent_complete = GW ("percent-complete"); - - priv->completed_date = GW ("completed-date"); - - priv->url = GW ("url"); - -#undef GW - - return (priv->status - && priv->priority - && priv->percent_complete - && priv->completed_date - && priv->url); -} - - -static void -complete_date_changed (TaskDetailsPage *tdpage, time_t ctime, gboolean complete) -{ - TaskDetailsPagePrivate *priv; - CompEditorPageDates dates = {NULL, NULL, NULL, NULL}; - icaltimezone *zone; - struct icaltimetype completed_tt = icaltime_null_time(); - - priv = tdpage->priv; - - /* Get the current time in UTC. */ - zone = icaltimezone_get_utc_timezone (); - completed_tt = icaltime_from_timet_with_zone (ctime, FALSE, zone); - completed_tt.is_utc = TRUE; - - dates.start = NULL; - dates.end = NULL; - dates.due = NULL; - if (complete) - dates.complete = &completed_tt; - - /* Notify upstream */ - comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (tdpage), - &dates); -} - -static void -date_changed_cb (EDateEdit *dedit, gpointer data) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - CompEditorPageDates dates = {NULL, NULL, NULL, NULL}; - struct icaltimetype completed_tt = icaltime_null_time (); - icalproperty_status status; - gboolean date_set; - - tdpage = TASK_DETAILS_PAGE (data); - priv = tdpage->priv; - - if (priv->updating) - return; - - priv->updating = TRUE; - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->completed_date), - &completed_tt.year, - &completed_tt.month, - &completed_tt.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->completed_date), - &completed_tt.hour, - &completed_tt.minute); - - status = e_dialog_option_menu_get (priv->status, status_map); - - if (!date_set) { - completed_tt = icaltime_null_time (); - if (status == ICAL_STATUS_COMPLETED) { - e_dialog_option_menu_set (priv->status, - ICAL_STATUS_NEEDSACTION, - status_map); - e_dialog_spin_set (priv->percent_complete, 0); - } - } else { - if (status != ICAL_STATUS_COMPLETED) { - e_dialog_option_menu_set (priv->status, - ICAL_STATUS_COMPLETED, - status_map); - } - e_dialog_spin_set (priv->percent_complete, 100); - } - - priv->updating = FALSE; - - /* Notify upstream */ - dates.complete = &completed_tt; - comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (tdpage), &dates); -} - -static void -status_changed (GtkMenu *menu, TaskDetailsPage *tdpage) -{ - TaskDetailsPagePrivate *priv; - icalproperty_status status; - time_t ctime = -1; - - priv = tdpage->priv; - - if (priv->updating) - return; - - priv->updating = TRUE; - - status = e_dialog_option_menu_get (priv->status, status_map); - if (status == ICAL_STATUS_NEEDSACTION) { - e_dialog_spin_set (priv->percent_complete, 0); - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); - complete_date_changed (tdpage, 0, FALSE); - } else if (status == ICAL_STATUS_INPROCESS) { - e_dialog_spin_set (priv->percent_complete, 50); - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); - complete_date_changed (tdpage, 0, FALSE); - } else if (status == ICAL_STATUS_COMPLETED) { - e_dialog_spin_set (priv->percent_complete, 100); - ctime = time (NULL); - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); - complete_date_changed (tdpage, ctime, TRUE); - } - - priv->updating = FALSE; - - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage)); -} - -static void -percent_complete_changed (GtkAdjustment *adj, TaskDetailsPage *tdpage) -{ - TaskDetailsPagePrivate *priv; - gint percent; - icalproperty_status status; - gboolean complete; - time_t ctime = -1; - - priv = tdpage->priv; - - if (priv->updating) - return; - - priv->updating = TRUE; - - percent = e_dialog_spin_get_int (priv->percent_complete); - if (percent == 100) { - complete = TRUE; - ctime = time (NULL); - status = ICAL_STATUS_COMPLETED; - } else { - complete = FALSE; - - if (percent == 0) - status = ICAL_STATUS_NEEDSACTION; - else - status = ICAL_STATUS_INPROCESS; - } - - e_dialog_option_menu_set (priv->status, status, status_map); - e_date_edit_set_time (E_DATE_EDIT (priv->completed_date), ctime); - complete_date_changed (tdpage, ctime, complete); - - priv->updating = FALSE; - - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage)); -} - -/* This is called when any field is changed; it notifies upstream. */ -static void -field_changed_cb (GtkWidget *widget, gpointer data) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - - tdpage = TASK_DETAILS_PAGE (data); - priv = tdpage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tdpage)); -} - -/* Hooks the widget signals */ -static void -init_widgets (TaskDetailsPage *tdpage) -{ - TaskDetailsPagePrivate *priv; - - priv = tdpage->priv; - - /* Make sure the EDateEdit widgets use our timezones to get the - current time. */ - e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->completed_date), - (EDateEditGetTimeCallback) comp_editor_get_current_time, - tdpage, NULL); - - /* 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 (GTK_OPTION_MENU (priv->status)->menu), - "deactivate", - GTK_SIGNAL_FUNC (status_changed), tdpage); - - gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), - "value_changed", - GTK_SIGNAL_FUNC (percent_complete_changed), tdpage); - - /* Priority */ - gtk_signal_connect (GTK_OBJECT (GTK_OPTION_MENU (priv->priority)->menu), - "deactivate", - GTK_SIGNAL_FUNC (field_changed_cb), tdpage); - - /* Completed Date */ - gtk_signal_connect (GTK_OBJECT (priv->completed_date), "changed", - GTK_SIGNAL_FUNC (date_changed_cb), tdpage); - - /* URL */ - gtk_signal_connect (GTK_OBJECT (priv->url), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), tdpage); -} - - - -/** - * task_details_page_construct: - * @tdpage: An task details page. - * - * Constructs an task page by loading its Glade data. - * - * Return value: The same object as @tdpage, or NULL if the widgets could not - * be created. - **/ -TaskDetailsPage * -task_details_page_construct (TaskDetailsPage *tdpage) -{ - TaskDetailsPagePrivate *priv; - - priv = tdpage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR - "/task-details-page.glade", NULL); - if (!priv->xml) { - g_message ("task_details_page_construct(): " - "Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (tdpage)) { - g_message ("task_details_page_construct(): " - "Could not find all widgets in the XML file!"); - return NULL; - } - - init_widgets (tdpage); - - return tdpage; -} - -/** - * task_details_page_new: - * - * Creates a new task details page. - * - * Return value: A newly-created task details page, or NULL if the page could - * not be created. - **/ -TaskDetailsPage * -task_details_page_new (void) -{ - TaskDetailsPage *tdpage; - - tdpage = gtk_type_new (TYPE_TASK_DETAILS_PAGE); - if (!task_details_page_construct (tdpage)) { - gtk_object_unref (GTK_OBJECT (tdpage)); - return NULL; - } - - return tdpage; -} - -GtkWidget *task_details_page_create_date_edit (void); - -GtkWidget * -task_details_page_create_date_edit (void) -{ - GtkWidget *dedit; - - dedit = comp_editor_new_date_edit (TRUE, TRUE, FALSE); - e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); - - return dedit; -} diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade deleted file mode 100644 index 54ba5d35b5..0000000000 --- a/calendar/gui/dialogs/task-details-page.glade +++ /dev/null @@ -1,310 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>task-details-page</name> - <program_name>task-details-page</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>task-details-toplevel</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>task-details-page</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkFrame</class> - <name>frame2</name> - <label>Progress</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox1</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label17</name> - <label>_Status:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>status</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>status</name> - <can_focus>True</can_focus> - <items>Not Started -In Progress -Completed -Cancelled -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label18</name> - <label>_Priority:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>priority</default_focus_target> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkOptionMenu</class> - <name>priority</name> - <can_focus>True</can_focus> - <items>High -Normal -Low -Undefined -</items> - <initial_choice>0</initial_choice> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label19</name> - <label>% Complete</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>percent-complete</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>1</value> - <lower>0</lower> - <upper>100</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>4</border_width> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label12</name> - <label>Date Completed:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>completed-date</name> - <creation_function>task_details_page_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 01 Jun 2001 18:58:51 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkTable</class> - <name>table2</name> - <border_width>4</border_width> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label14</name> - <label>URL:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>url</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/task-details-page.h b/calendar/gui/dialogs/task-details-page.h deleted file mode 100644 index 580388cb8d..0000000000 --- a/calendar/gui/dialogs/task-details-page.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Evolution calendar - Main page of the task editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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_DETAILS_PAGE_H -#define TASK_DETAILS_PAGE_H - -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_TASK_DETAILS_PAGE (task_details_page_get_type ()) -#define TASK_DETAILS_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_TASK_DETAILS_PAGE, TaskDetailsPage)) -#define TASK_DETAILS_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_TASK_DETAILS_PAGE, TaskDetailsPageClass)) -#define IS_TASK_DETAILS_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_TASK_DETAILS_PAGE)) -#define IS_TASK_DETAILS_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_TASK_DETAILS_PAGE)) - -typedef struct _TaskDetailsPagePrivate TaskDetailsPagePrivate; - -typedef struct { - CompEditorPage page; - - /* Private data */ - TaskDetailsPagePrivate *priv; -} TaskDetailsPage; - -typedef struct { - CompEditorPageClass parent_class; -} TaskDetailsPageClass; - - -GtkType task_details_page_get_type (void); -TaskDetailsPage *task_details_page_construct (TaskDetailsPage *tdpage); -TaskDetailsPage *task_details_page_new (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c deleted file mode 100644 index e59582873f..0000000000 --- a/calendar/gui/dialogs/task-editor.c +++ /dev/null @@ -1,385 +0,0 @@ -/* -*- 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> - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <string.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include <libgnome/gnome-i18n.h> - -#include "task-page.h" -#include "task-details-page.h" -#include "meeting-page.h" -#include "cancel-comp.h" -#include "task-editor.h" - -struct _TaskEditorPrivate { - TaskPage *task_page; - TaskDetailsPage *task_details_page; - MeetingPage *meet_page; - - EMeetingModel *model; - - gboolean meeting_shown; - gboolean existing_org; - gboolean updating; -}; - - - -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 void task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); -static void task_editor_destroy (GtkObject *object); - -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 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); - -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), - - BONOBO_UI_VERB_END -}; - -static CompEditorClass *parent_class; - - - -/** - * 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); - } - - return task_editor_type; -} - -/* Class initialization function for the event editor */ -static void -task_editor_class_init (TaskEditorClass *klass) -{ - GtkObjectClass *object_class; - CompEditorClass *editor_class; - - object_class = (GtkObjectClass *) klass; - editor_class = (CompEditorClass *) klass; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR); - - editor_class->edit_comp = task_editor_edit_comp; - editor_class->send_comp = task_editor_send_comp; - - object_class->destroy = task_editor_destroy; -} - -static void -set_menu_sens (TaskEditor *te) -{ - TaskEditorPrivate *priv; - gboolean sens; - - priv = te->priv; - - sens = priv->meeting_shown; - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionAssignTask", - "sensitive", sens ? "0" : "1"); - - sens = sens && priv->existing_org; - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionRefreshTask", - "sensitive", sens ? "1" : "0"); - comp_editor_set_ui_prop (COMP_EDITOR (te), - "/commands/ActionCancelTask", - "sensitive", sens ? "1" : "0"); -} - -static void -init_widgets (TaskEditor *te) -{ - TaskEditorPrivate *priv; - - priv = te->priv; - - 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); -} - -/* Object initialization function for the task editor */ -static void -task_editor_init (TaskEditor *te) -{ - TaskEditorPrivate *priv; - - priv = g_new0 (TaskEditorPrivate, 1); - te->priv = priv; - - priv->task_page = task_page_new (); - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->task_page), - _("Basic")); - - priv->task_details_page = task_details_page_new (); - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->task_details_page), - _("Details")); - - priv->model = E_MEETING_MODEL (e_meeting_model_new ()); - - priv->meet_page = meeting_page_new (priv->model); - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page), - _("Assignment")); - - comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs); - - priv->meeting_shown = TRUE; - priv->existing_org = FALSE; - priv->updating = FALSE; - - init_widgets (te); - set_menu_sens (te); -} - -static void -task_editor_edit_comp (CompEditor *editor, CalComponent *comp) -{ - TaskEditor *te; - TaskEditorPrivate *priv; - GSList *attendees = NULL; - - te = TASK_EDITOR (editor); - priv = te->priv; - - priv->updating = TRUE; - - priv->existing_org = cal_component_has_organizer (comp); - cal_component_get_attendee_list (comp, &attendees); - - e_meeting_model_remove_all_attendees (priv->model); - if (attendees == NULL) { - comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); - priv->meeting_shown = FALSE; - } else { - GSList *l; - - if (!priv->meeting_shown) - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page), - _("Assignment")); - - 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)); - } - priv->meeting_shown = TRUE; - } - cal_component_free_attendee_list (attendees); - - set_menu_sens (te); - comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown); - - priv->updating = FALSE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); -} - -static void -task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) -{ - TaskEditor *te = TASK_EDITOR (editor); - TaskEditorPrivate *priv; - CalComponent *comp = NULL; - - priv = te->priv; - - /* Don't cancel more than once or when just publishing */ - if (method == CAL_COMPONENT_METHOD_PUBLISH || - method == CAL_COMPONENT_METHOD_CANCEL) - goto parent; - - comp = meeting_page_get_cancel_comp (priv->meet_page); - if (comp != NULL) { - itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp); - gtk_object_unref (GTK_OBJECT (comp)); - } - - parent: - if (parent_class->send_comp) - parent_class->send_comp (editor, method); -} - -/* 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: - * - * 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 (void) -{ - return TASK_EDITOR (gtk_type_new (TYPE_TASK_EDITOR)); -} - -static void -assign_task_cmd (GtkWidget *widget, gpointer data) -{ - TaskEditor *te = TASK_EDITOR (data); - TaskEditorPrivate *priv; - - priv = te->priv; - - if (!priv->meeting_shown) { - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page), - _("Assignment")); - priv->meeting_shown = TRUE; - - set_menu_sens (te); - comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown); - } - - comp_editor_show_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page)); -} - -static void -refresh_task_cmd (GtkWidget *widget, gpointer data) -{ - TaskEditor *te = TASK_EDITOR (data); - - comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_REFRESH); -} - -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)) { - comp_editor_send_comp (COMP_EDITOR (te), CAL_COMPONENT_METHOD_CANCEL); - comp_editor_delete_comp (COMP_EDITOR (te)); - } -} - -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); -} - -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); -} diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h deleted file mode 100644 index 3f17b6e45f..0000000000 --- a/calendar/gui/dialogs/task-editor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* 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> - * - * 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. - * - * 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 <libgnome/gnome-defs.h> -#include <gtk/gtkobject.h> -#include "comp-editor.h" - - - -#define TYPE_TASK_EDITOR (task_editor_get_type ()) -#define TASK_EDITOR(obj) (GTK_CHECK_CAST ((obj), TYPE_TASK_EDITOR, TaskEditor)) -#define TASK_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_TASK_EDITOR, \ - TaskEditorClass)) -#define IS_TASK_EDITOR(obj) (GTK_CHECK_TYPE ((obj), TYPE_TASK_EDITOR)) -#define IS_TASK_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_TASK_EDITOR)) - -typedef struct _TaskEditor TaskEditor; -typedef struct _TaskEditorClass TaskEditorClass; -typedef struct _TaskEditorPrivate TaskEditorPrivate; - -struct _TaskEditor { - CompEditor parent; - - /* Private data */ - TaskEditorPrivate *priv; -}; - -struct _TaskEditorClass { - CompEditorClass parent_class; -}; - -GtkType task_editor_get_type (void); -TaskEditor *task_editor_construct (TaskEditor *ee); -TaskEditor *task_editor_new (void); - - - -#endif /* __TASK_EDITOR_H__ */ diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c deleted file mode 100644 index 6b55b58c84..0000000000 --- a/calendar/gui/dialogs/task-page.c +++ /dev/null @@ -1,992 +0,0 @@ -/* Evolution calendar - Main page of the task editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktext.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtkoptionmenu.h> -#include <glade/glade.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-categories.h> -#include <widgets/misc/e-dateedit.h> -#include "e-util/e-dialog-widgets.h" -#include "e-util/e-categories-config.h" -#include "../e-timezone-entry.h" -#include "../calendar-config.h" -#include "comp-editor-util.h" -#include "task-page.h" - - - -/* Private part of the TaskPage structure */ -struct _TaskPagePrivate { - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - GtkWidget *main; - - GtkWidget *summary; - - GtkWidget *due_date; - GtkWidget *start_date; - GtkWidget *due_timezone; - GtkWidget *start_timezone; - - GtkWidget *description; - - GtkWidget *classification_public; - GtkWidget *classification_private; - GtkWidget *classification_confidential; - - GtkWidget *contacts_btn; - GtkWidget *contacts_box; - - GtkWidget *categories_btn; - GtkWidget *categories; - - gboolean updating; - - /* The Corba component for selecting contacts, and the entry field - which we place in the dialog. */ - GNOME_Evolution_Addressbook_SelectNames corba_select_names; - GtkWidget *contacts_entry; -}; - -static const int classification_map[] = { - CAL_COMPONENT_CLASS_PUBLIC, - CAL_COMPONENT_CLASS_PRIVATE, - CAL_COMPONENT_CLASS_CONFIDENTIAL, - -1 -}; - - - -static void task_page_class_init (TaskPageClass *class); -static void task_page_init (TaskPage *tpage); -static void task_page_destroy (GtkObject *object); - -static GtkWidget *task_page_get_widget (CompEditorPage *page); -static void task_page_focus_main_widget (CompEditorPage *page); -static void task_page_fill_widgets (CompEditorPage *page, CalComponent *comp); -static gboolean task_page_fill_component (CompEditorPage *page, CalComponent *comp); -static void task_page_set_summary (CompEditorPage *page, const char *summary); -static void task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates); - -static CompEditorPageClass *parent_class = NULL; - - - -/** - * task_page_get_type: - * - * Registers the #TaskPage class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #TaskPage class. - **/ -GtkType -task_page_get_type (void) -{ - static GtkType task_page_type; - - if (!task_page_type) { - static const GtkTypeInfo task_page_info = { - "TaskPage", - sizeof (TaskPage), - sizeof (TaskPageClass), - (GtkClassInitFunc) task_page_class_init, - (GtkObjectInitFunc) task_page_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - task_page_type = gtk_type_unique (TYPE_COMP_EDITOR_PAGE, - &task_page_info); - } - - return task_page_type; -} - -/* Class initialization function for the task page */ -static void -task_page_class_init (TaskPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GtkObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE); - - editor_page_class->get_widget = task_page_get_widget; - editor_page_class->focus_main_widget = task_page_focus_main_widget; - editor_page_class->fill_widgets = task_page_fill_widgets; - editor_page_class->fill_component = task_page_fill_component; - editor_page_class->set_summary = task_page_set_summary; - editor_page_class->set_dates = task_page_set_dates; - - object_class->destroy = task_page_destroy; -} - -/* Object initialization function for the task page */ -static void -task_page_init (TaskPage *tpage) -{ - TaskPagePrivate *priv; - - priv = g_new0 (TaskPagePrivate, 1); - tpage->priv = priv; - - priv->xml = NULL; - - priv->main = NULL; - priv->summary = NULL; - priv->due_date = NULL; - priv->start_date = NULL; - priv->due_timezone = NULL; - priv->start_timezone = NULL; - priv->description = NULL; - priv->classification_public = NULL; - priv->classification_private = NULL; - priv->classification_confidential = NULL; - priv->contacts_btn = NULL; - priv->contacts_box = NULL; - priv->categories_btn = NULL; - priv->categories = NULL; - - priv->updating = FALSE; - - priv->corba_select_names = CORBA_OBJECT_NIL; - priv->contacts_entry = NULL; -} - -/* Destroy handler for the task page */ -static void -task_page_destroy (GtkObject *object) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_TASK_PAGE (object)); - - tpage = TASK_PAGE (object); - priv = tpage->priv; - - if (priv->corba_select_names != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->corba_select_names, &ev); - CORBA_exception_free (&ev); - } - - if (priv->xml) { - gtk_object_unref (GTK_OBJECT (priv->xml)); - priv->xml = NULL; - } - - g_free (priv); - tpage->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* get_widget handler for the task page */ -static GtkWidget * -task_page_get_widget (CompEditorPage *page) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - - return priv->main; -} - -/* focus_main_widget handler for the task page */ -static void -task_page_focus_main_widget (CompEditorPage *page) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - - gtk_widget_grab_focus (priv->summary); -} - -/* Fills the widgets with default values */ -static void -clear_widgets (TaskPage *tpage) -{ - TaskPagePrivate *priv; - - priv = tpage->priv; - - /* Summary, description */ - e_dialog_editable_set (priv->summary, NULL); - e_dialog_editable_set (priv->description, NULL); - - /* Start, due times */ - e_date_edit_set_time (E_DATE_EDIT (priv->start_date), 0); - e_date_edit_set_time (E_DATE_EDIT (priv->due_date), 0); - - /* Classification */ - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PRIVATE, classification_map); - - /* Categories */ - e_dialog_editable_set (priv->categories, NULL); -} - -/* Decode the radio button group for classifications */ -static CalComponentClassification -classification_get (GtkWidget *widget) -{ - return e_dialog_radio_get (widget, classification_map); -} - -static void -contacts_changed_cb (BonoboListener *listener, - char *event_name, - CORBA_any *arg, - CORBA_Environment *ev, - gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); -} - -/* fill_widgets handler for the task page */ -static void -task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - CalComponentText text; - CalComponentDateTime d; - CalComponentClassification cl; - CalClientGetStatus get_tz_status; - GSList *l; - const char *categories; - icaltimezone *zone, *default_zone; - char *location; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - - priv->updating = TRUE; - - /* Clean the screen */ - clear_widgets (tpage); - - /* Summary, description(s) */ - cal_component_get_summary (comp, &text); - e_dialog_editable_set (priv->summary, text.value); - - cal_component_get_description_list (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); - - location = calendar_config_get_timezone (); - default_zone = icaltimezone_get_builtin_timezone (location); - - /* Due Date. */ - cal_component_get_due (comp, &d); - zone = NULL; - if (d.value) { - struct icaltimetype *due_tt = d.value; - e_date_edit_set_date (E_DATE_EDIT (priv->due_date), - due_tt->year, due_tt->month, - due_tt->day); - if (due_tt->is_date) { - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->due_date), - -1, -1); - zone = default_zone; - } else { - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->due_date), - due_tt->hour, - due_tt->minute); - } - } else { - e_date_edit_set_time (E_DATE_EDIT (priv->due_date), -1); - - /* If no time is set, we use the default timezone, so the - user usually doesn't have to set this when they set the - date. */ - zone = default_zone; - } - - /* Note that if we are creating a new task, the timezones may not be - on the server, so we try to get the builtin timezone with the TZID - first. */ - if (!zone) - zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid); - if (!zone) { - get_tz_status = cal_client_get_timezone (page->client, d.tzid, - &zone); - /* FIXME: Handle error better. */ - if (get_tz_status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - d.tzid ? d.tzid : ""); - } - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->due_timezone), - zone); - - cal_component_free_datetime (&d); - - - /* Start Date. */ - cal_component_get_dtstart (comp, &d); - zone = NULL; - if (d.value) { - struct icaltimetype *start_tt = d.value; - e_date_edit_set_date (E_DATE_EDIT (priv->start_date), - start_tt->year, start_tt->month, - start_tt->day); - if (start_tt->is_date) { - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_date), - -1, -1); - zone = default_zone; - } else { - e_date_edit_set_time_of_day (E_DATE_EDIT (priv->start_date), - start_tt->hour, - start_tt->minute); - } - } else { - e_date_edit_set_time (E_DATE_EDIT (priv->start_date), -1); - - /* If no time is set, we use the default timezone, so the - user usually doesn't have to set this when they set the - date. */ - zone = default_zone; - } - - if (!zone) - zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid); - if (!zone) { - get_tz_status = cal_client_get_timezone (page->client, d.tzid, - &zone); - /* FIXME: Handle error better. */ - if (get_tz_status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - d.tzid ? d.tzid : ""); - } - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), - zone); - - cal_component_free_datetime (&d); - - /* Classification. */ - cal_component_get_classification (comp, &cl); - - switch (cl) { - case CAL_COMPONENT_CLASS_PUBLIC: - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PUBLIC, - classification_map); - break; - - case CAL_COMPONENT_CLASS_PRIVATE: - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PRIVATE, - classification_map); - break; - - case CAL_COMPONENT_CLASS_CONFIDENTIAL: - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_CONFIDENTIAL, - classification_map); - break; - - default: - /* default to PUBLIC */ - e_dialog_radio_set (priv->classification_public, - CAL_COMPONENT_CLASS_PUBLIC, - classification_map); - break; - } - - /* Categories */ - cal_component_get_categories (comp, &categories); - e_dialog_editable_set (priv->categories, categories); - - - /* Contacts */ - comp_editor_contacts_to_widget (priv->contacts_entry, comp); - - /* We connect the contacts changed signal here, as we have to be a bit - more careful with it due to the use or Corba. The priv->updating - flag won't work as we won't get the changed event immediately. - FIXME: Unfortunately this doesn't work either. We never get the - changed event now. */ - comp_editor_connect_contacts_changed (priv->contacts_entry, - contacts_changed_cb, tpage); - - - priv->updating = FALSE; -} - -/* fill_component handler for the task page */ -static gboolean -task_page_fill_component (CompEditorPage *page, CalComponent *comp) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - CalComponentDateTime date; - struct icaltimetype icaltime; - char *cat, *str; - gboolean date_set, time_set; - icaltimezone *zone; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - - /* Summary. */ - - str = e_dialog_editable_get (priv->summary); - if (!str || strlen (str) == 0) - cal_component_set_summary (comp, NULL); - else { - CalComponentText text; - - text.value = str; - text.altrep = NULL; - - cal_component_set_summary (comp, &text); - } - - if (str) - g_free (str); - - /* Description */ - - str = e_dialog_editable_get (priv->description); - if (!str || strlen (str) == 0) - cal_component_set_description_list (comp, NULL); - else { - GSList l; - CalComponentText text; - - text.value = str; - text.altrep = NULL; - l.data = &text; - l.next = NULL; - - cal_component_set_description_list (comp, &l); - } - - if (!str) - g_free (str); - - /* Dates */ - - icaltime = icaltime_null_time (); - - date.value = &icaltime; - date.tzid = NULL; - - /* Due Date. */ - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->due_date), - &icaltime.year, - &icaltime.month, - &icaltime.day); - time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->due_date), - &icaltime.hour, - &icaltime.minute); - if (date_set) { - if (time_set) { - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone)); - date.tzid = icaltimezone_get_tzid (zone); - } else { - icaltime.is_date = TRUE; - date.tzid = NULL; - } - cal_component_set_due (comp, &date); - } else { - cal_component_set_due (comp, NULL); - } - - /* Start Date. */ - icaltime = icaltime_null_time (); - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_date), - &icaltime.year, - &icaltime.month, - &icaltime.day); - time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_date), - &icaltime.hour, - &icaltime.minute); - if (date_set) { - if (time_set) { - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - date.tzid = icaltimezone_get_tzid (zone); - } else { - icaltime.is_date = TRUE; - date.tzid = NULL; - } - cal_component_set_dtstart (comp, &date); - } else { - cal_component_set_dtstart (comp, NULL); - } - - /* Classification. */ - cal_component_set_classification (comp, classification_get (priv->classification_public)); - - /* Categories */ - cat = e_dialog_editable_get (priv->categories); - str = comp_editor_strip_categories (cat); - if (cat) - g_free (cat); - - cal_component_set_categories (comp, str); - - if (str) - g_free (str); - - /* Contacts */ - comp_editor_contacts_to_component (priv->contacts_entry, comp); - - return TRUE; -} - -/* set_summary handler for the task page */ -static void -task_page_set_summary (CompEditorPage *page, const char *summary) -{ - /* nothing */ -} - -static void -task_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - - if (priv->updating) - return; - - priv->updating = TRUE; - - priv->updating = FALSE; -} - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (TaskPage *tpage) -{ - CompEditorPage *page = COMP_EDITOR_PAGE (tpage); - TaskPagePrivate *priv; - GSList *accel_groups; - GtkWidget *toplevel; - - priv = tpage->priv; - -#define GW(name) glade_xml_get_widget (priv->xml, name) - - priv->main = GW ("task-page"); - if (!priv->main) - return FALSE; - - /* Get the GtkAccelGroup from the toplevel window, so we can install - it when the notebook page is mapped. */ - toplevel = gtk_widget_get_toplevel (priv->main); - accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_widget_unparent (priv->main); - - priv->summary = GW ("summary"); - - priv->due_date = GW ("due-date"); - priv->start_date = GW ("start-date"); - priv->due_timezone = GW ("due-timezone"); - priv->start_timezone = GW ("start-timezone"); - - priv->description = GW ("description"); - - priv->classification_public = GW ("classification-public"); - priv->classification_private = GW ("classification-private"); - priv->classification_confidential = GW ("classification-confidential"); - - priv->contacts_btn = GW ("contacts-button"); - priv->contacts_box = GW ("contacts-box"); - - priv->categories_btn = GW ("categories-button"); - priv->categories = GW ("categories"); - -#undef GW - - return (priv->summary - && priv->due_date - && priv->start_date - && priv->due_timezone - && priv->start_timezone - && priv->classification_public - && priv->classification_private - && priv->classification_confidential - && priv->description - && priv->contacts_btn - && priv->contacts_box - && priv->categories_btn - && priv->categories); -} - -/* Callback used when the summary changes; we emit the notification signal. */ -static void -summary_changed_cb (GtkEditable *editable, gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - gchar *summary; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - if (priv->updating) - return; - - summary = e_dialog_editable_get (GTK_WIDGET (editable)); - comp_editor_page_notify_summary_changed (COMP_EDITOR_PAGE (tpage), - summary); - g_free (summary); -} - -/* Callback used when the start or due date widgets change. We notify the - * other pages in the task editor, so they can update any labels. - */ -static void -date_changed_cb (EDateEdit *dedit, gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - CompEditorPageDates dates; - gboolean date_set, time_set; - CalComponentDateTime start_dt, due_dt; - struct icaltimetype start_tt = icaltime_null_time(); - struct icaltimetype due_tt = icaltime_null_time(); - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - if (priv->updating) - return; - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_date), - &start_tt.year, - &start_tt.month, - &start_tt.day); - time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_date), - &start_tt.hour, - &start_tt.minute); - if (date_set) { - if (time_set) { - icaltimezone *zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - start_dt.tzid = icaltimezone_get_tzid (zone); - } else { - start_tt.is_date = TRUE; - start_dt.tzid = NULL; - } - } else { - start_tt = icaltime_null_time (); - start_dt.tzid = NULL; - } - - date_set = e_date_edit_get_date (E_DATE_EDIT (priv->due_date), - &due_tt.year, - &due_tt.month, - &due_tt.day); - time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->due_date), - &due_tt.hour, - &due_tt.minute); - if (date_set) { - if (time_set) { - icaltimezone *zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone)); - due_dt.tzid = icaltimezone_get_tzid (zone); - } else { - due_tt.is_date = TRUE; - due_dt.tzid = NULL; - } - } else { - due_tt = icaltime_null_time (); - due_dt.tzid = NULL; - } - - start_dt.value = &start_tt; - dates.start = &start_dt; - dates.end = NULL; - due_dt.value = &due_tt; - dates.due = &due_dt; - dates.complete = NULL; - - /* Notify upstream */ - comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (tpage), - &dates); -} - -/* Callback used when the contacts button is clicked; we must bring up the - * contact list dialog. - */ -static void -contacts_clicked_cb (GtkWidget *button, gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - comp_editor_show_contacts_dialog (priv->corba_select_names); - - /* FIXME: Currently we aren't getting the changed event from the - SelectNames component correctly, so we aren't saving the event - if just the contacts are changed. To work around that, we assume - that if the contacts button is clicked it is changed. */ - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); -} - -/* Callback used when the categories button is clicked; we must bring up the - * category list dialog. - */ -static void -categories_clicked_cb (GtkWidget *button, gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - GtkWidget *entry; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); -} - -/* This is called when any field is changed; it notifies upstream. */ -static void -field_changed_cb (GtkWidget *widget, gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - if (!priv->updating) - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (tpage)); -} - -/* Hooks the widget signals */ -static gboolean -init_widgets (TaskPage *tpage) -{ - TaskPagePrivate *priv; - char *location; - icaltimezone *zone; - - priv = tpage->priv; - - /* Make sure the EDateEdit widgets use our timezones to get the - current time. */ - e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_date), - (EDateEditGetTimeCallback) comp_editor_get_current_time, - tpage, NULL); - e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->due_date), - (EDateEditGetTimeCallback) comp_editor_get_current_time, - tpage, NULL); - - /* Summary */ - gtk_signal_connect (GTK_OBJECT (priv->summary), "changed", - GTK_SIGNAL_FUNC (summary_changed_cb), tpage); - - /* Description - turn on word wrap. */ - gtk_text_set_word_wrap (GTK_TEXT (priv->description), TRUE); - - /* Dates */ - gtk_signal_connect (GTK_OBJECT (priv->start_date), "changed", - GTK_SIGNAL_FUNC (date_changed_cb), tpage); - gtk_signal_connect (GTK_OBJECT (priv->due_date), "changed", - GTK_SIGNAL_FUNC (date_changed_cb), tpage); - - gtk_signal_connect (GTK_OBJECT (priv->due_timezone), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); - gtk_signal_connect (GTK_OBJECT (priv->start_timezone), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); - - /* Classification */ - gtk_signal_connect (GTK_OBJECT (priv->classification_public), - "toggled", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); - gtk_signal_connect (GTK_OBJECT (priv->classification_private), - "toggled", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); - gtk_signal_connect (GTK_OBJECT (priv->classification_confidential), - "toggled", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); - - /* Connect the default signal handler to use to make sure the "changed" - field gets set whenever a field is changed. */ - gtk_signal_connect (GTK_OBJECT (priv->description), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); - gtk_signal_connect (GTK_OBJECT (priv->categories), "changed", - GTK_SIGNAL_FUNC (field_changed_cb), tpage); - - /* Contacts button */ - gtk_signal_connect (GTK_OBJECT (priv->contacts_btn), "clicked", - GTK_SIGNAL_FUNC (contacts_clicked_cb), tpage); - - /* Categories button */ - gtk_signal_connect (GTK_OBJECT (priv->categories_btn), "clicked", - GTK_SIGNAL_FUNC (categories_clicked_cb), tpage); - - - /* Create the contacts entry, a corba control from the address book. */ - priv->corba_select_names = comp_editor_create_contacts_component (); - if (priv->corba_select_names == CORBA_OBJECT_NIL) - return FALSE; - - priv->contacts_entry = comp_editor_create_contacts_control (priv->corba_select_names); - if (priv->contacts_entry == NULL) - return FALSE; - - gtk_container_add (GTK_CONTAINER (priv->contacts_box), - priv->contacts_entry); - - /* Set the default timezone, so the timezone entry may be hidden. */ - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone); - e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->due_timezone), zone); - - return TRUE; -} - - - -/** - * task_page_construct: - * @tpage: An task page. - * - * Constructs an task page by loading its Glade data. - * - * Return value: The same object as @tpage, or NULL if the widgets could not be - * created. - **/ -TaskPage * -task_page_construct (TaskPage *tpage) -{ - TaskPagePrivate *priv; - - priv = tpage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR "/task-page.glade", - NULL); - if (!priv->xml) { - g_message ("task_page_construct(): " - "Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (tpage)) { - g_message ("task_page_construct(): " - "Could not find all widgets in the XML file!"); - return NULL; - } - - if (!init_widgets (tpage)) { - g_message ("event_page_construct(): " - "Could not initialize the widgets!"); - return NULL; - } - - return tpage; -} - -/** - * task_page_new: - * - * Creates a new task page. - * - * Return value: A newly-created task page, or NULL if the page could - * not be created. - **/ -TaskPage * -task_page_new (void) -{ - TaskPage *tpage; - - tpage = gtk_type_new (TYPE_TASK_PAGE); - if (!task_page_construct (tpage)) { - gtk_object_unref (GTK_OBJECT (tpage)); - return NULL; - } - - return tpage; -} - -GtkWidget *task_page_create_date_edit (void); - -GtkWidget * -task_page_create_date_edit (void) -{ - GtkWidget *dedit; - - dedit = comp_editor_new_date_edit (TRUE, TRUE, TRUE); - e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); - - return dedit; -} diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade deleted file mode 100644 index 31a7ba2cbe..0000000000 --- a/calendar/gui/dialogs/task-page.glade +++ /dev/null @@ -1,493 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>task-page</name> - <program_name>task-page</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>task-toplevel</name> - <visible>False</visible> - <title>window1</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>task-page</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkTable</class> - <name>table3</name> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label3</name> - <label>Su_mmary:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <default_focus_target>summary</default_focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>False</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>summary</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame2</name> - <label>Date & Time</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox4</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <rows>2</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>2</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label6</name> - <label>Sta_rt Date:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>start-date</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>_Due Date:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>due-date</focus_target> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>due-date</name> - <can_focus>True</can_focus> - <creation_function>task_page_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 01 Jun 2001 18:59:52 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>start-date</name> - <can_focus>True</can_focus> - <creation_function>task_page_create_date_edit</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Fri, 01 Jun 2001 18:59:57 GMT</last_modification_time> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>due-timezone</name> - <creation_function>make_timezone_entry</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 19 Jun 2001 04:43:54 GMT</last_modification_time> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>start-timezone</name> - <creation_function>make_timezone_entry</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Tue, 19 Jun 2001 04:43:46 GMT</last_modification_time> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label18</name> - <label>Description:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy> - <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy> - <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy> - <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkText</class> - <name>description</name> - <height>80</height> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame24</name> - <label>Classification</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox6</name> - <border_width>2</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkRadioButton</class> - <name>classification-public</name> - <can_focus>True</can_focus> - <label>Pu_blic</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>classification-private</name> - <can_focus>True</can_focus> - <label>Pri_vate</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkRadioButton</class> - <name>classification-confidential</name> - <can_focus>True</can_focus> - <label>Con_fidential</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <group>classification_radio_group</group> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox2</name> - <homogeneous>False</homogeneous> - <spacing>2</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>contacts-button</name> - <can_focus>True</can_focus> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label16</name> - <label>_Contacts...</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>contacts-box</name> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - - <widget> - <class>GtkButton</class> - <name>categories-button</name> - <can_focus>True</can_focus> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label17</name> - <label>Ca_tegories...</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>4</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkEntry</class> - <name>categories</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h deleted file mode 100644 index 55c8ebc923..0000000000 --- a/calendar/gui/dialogs/task-page.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Evolution calendar - Main page of the task editor dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Seth Alves <alves@hungry.com> - * JP Rosevear <jpr@ximian.com> - * - * 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. - * - * 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_PAGE_H -#define TASK_PAGE_H - -#include "comp-editor-page.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_TASK_PAGE (task_page_get_type ()) -#define TASK_PAGE(obj) (GTK_CHECK_CAST ((obj), TYPE_TASK_PAGE, TaskPage)) -#define TASK_PAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_TASK_PAGE, TaskPageClass)) -#define IS_TASK_PAGE(obj) (GTK_CHECK_TYPE ((obj), TYPE_TASK_PAGE)) -#define IS_TASK_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_TASK_PAGE)) - -typedef struct _TaskPagePrivate TaskPagePrivate; - -typedef struct { - CompEditorPage page; - - /* Private data */ - TaskPagePrivate *priv; -} TaskPage; - -typedef struct { - CompEditorPageClass parent_class; -} TaskPageClass; - -GtkType task_page_get_type (void); -TaskPage *task_page_construct (TaskPage *epage); -TaskPage *task_page_new (void); - - - -END_GNOME_DECLS - -#endif |