diff options
Diffstat (limited to 'calendar/gui/dialogs')
69 files changed, 0 insertions, 25416 deletions
diff --git a/calendar/gui/dialogs/.cvsignore b/calendar/gui/dialogs/.cvsignore deleted file mode 100644 index 182657d5ac..0000000000 --- a/calendar/gui/dialogs/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.pure -Makefile -Makefile.in -Evolution-Addressbook-SelectNames-common.c -Evolution-Addressbook-SelectNames-skels.c -Evolution-Addressbook-SelectNames-stubs.c -Evolution-Addressbook-SelectNames.h diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am deleted file mode 100644 index 68d071fdd7..0000000000 --- a/calendar/gui/dialogs/Makefile.am +++ /dev/null @@ -1,108 +0,0 @@ -IDLS = $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl - -IDL_GENERATED_H = \ - Evolution-Addressbook-SelectNames.h -IDL_GENERATED = $(IDL_GENERATED_H) - -$(IDL_GENERATED_H): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ - --nostubs --noskels --nocommon \ - $(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_builddir) \ - -I$(top_srcdir)/calendar \ - -I$(top_srcdir)/calendar/cal-client \ - -I$(top_builddir)/calendar/cal-client \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/shell \ - -I$(top_srcdir)/widgets/misc \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \ - -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \ - -DPREFIX=\""$(prefix)"\" \ - $(EVOLUTION_CALENDAR_CFLAGS) - -noinst_LTLIBRARIES = libcal-dialogs.la - -libcal_dialogs_la_SOURCES = \ - $(IDL_GENERATED) \ - alarm-dialog.c \ - alarm-dialog.h \ - alarm-list-dialog.c \ - alarm-list-dialog.h \ - cal-prefs-dialog.c \ - cal-prefs-dialog.h \ - calendar-setup.c \ - calendar-setup.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 \ - copy-source-dialog.c \ - copy-source-dialog.h \ - delete-comp.c \ - delete-comp.h \ - delete-error.c \ - delete-error.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 \ - recur-comp.c \ - recur-comp.h \ - save-comp.c \ - save-comp.h \ - schedule-page.c \ - schedule-page.h \ - select-source-dialog.c \ - select-source-dialog.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 \ - url-editor-dialog.c \ - url-editor-dialog.h - -glade_DATA = \ - alarm-dialog.glade \ - alarm-list-dialog.glade \ - cal-prefs-dialog.glade \ - calendar-setup.glade \ - e-delegate-dialog.glade \ - event-page.glade \ - meeting-page.glade \ - recurrence-page.glade \ - schedule-page.glade \ - task-details-page.glade \ - task-page.glade \ - url-editor-dialog.glade - -CLEANFILES = $(BUILT_SOURCES) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) - -EXTRA_DIST = \ - $(glade_DATA) diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c deleted file mode 100644 index 6365009e14..0000000000 --- a/calendar/gui/dialogs/alarm-dialog.c +++ /dev/null @@ -1,967 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 2001-2003 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> - * Hans Petter Jansson <hpj@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/gtklabel.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtknotebook.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktreeview.h> -#include <gtk/gtktreeselection.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtktextbuffer.h> -#include <gtk/gtktextview.h> -#include <gtk/gtktogglebutton.h> -#include <libgnome/gnome-i18n.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-widget.h> -#include <glade/glade.h> -#include "e-util/e-dialog-widgets.h" -#include "e-util/e-time-utils.h" -#include <libecal/e-cal-util.h> -#include <libecal/e-cal-time-util.h> -#include "e-util/e-dialog-widgets.h" -#include "e-util/e-icon-factory.h" -#include <addressbook/util/e-destination.h> -#include "Evolution-Addressbook-SelectNames.h" -#include "../calendar-config.h" -#include "comp-editor-util.h" -#include "alarm-dialog.h" - - - -typedef struct { - /* Glade XML data */ - GladeXML *xml; - - /* The alarm */ - ECalComponentAlarm *alarm; - - /* The client */ - ECal *ecal; - - /* Toplevel */ - GtkWidget *toplevel; - - GtkWidget *action; - GtkWidget *interval_value; - GtkWidget *value_units; - GtkWidget *relative; - GtkWidget *time; - - /* Alarm repeat widgets */ - GtkWidget *repeat_toggle; - GtkWidget *repeat_group; - GtkWidget *repeat_quantity; - GtkWidget *repeat_value; - GtkWidget *repeat_unit; - - GtkWidget *option_notebook; - - /* Display alarm widgets */ - GtkWidget *dalarm_group; - GtkWidget *dalarm_message; - GtkWidget *dalarm_description; - - /* Audio alarm widgets */ - GtkWidget *aalarm_group; - GtkWidget *aalarm_sound; - GtkWidget *aalarm_attach; - - /* Mail alarm widgets */ - const char *email; - GtkWidget *malarm_group; - GtkWidget *malarm_address_group; - GtkWidget *malarm_addresses; - GtkWidget *malarm_addressbook; - GtkWidget *malarm_message; - GtkWidget *malarm_description; - GNOME_Evolution_Addressbook_SelectNames corba_select_names; - - /* Procedure alarm widgets */ - GtkWidget *palarm_group; - GtkWidget *palarm_program; - GtkWidget *palarm_args; -} Dialog; - -#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames:" BASE_VERSION -static const char *section_name = "Send To"; - -/* "relative" types */ -enum { - BEFORE, - AFTER -}; - -/* Time units */ -enum { - MINUTES, - HOURS, - DAYS -}; - -/* Option menu maps */ -static const int action_map[] = { - E_CAL_COMPONENT_ALARM_DISPLAY, - E_CAL_COMPONENT_ALARM_AUDIO, - E_CAL_COMPONENT_ALARM_PROCEDURE, - E_CAL_COMPONENT_ALARM_EMAIL, - -1 -}; - -static const char *action_map_cap[] = { - CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS, - CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS, - CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS, - CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS -}; - -static const int value_map[] = { - MINUTES, - HOURS, - DAYS, - -1 -}; - -static const int relative_map[] = { - BEFORE, - AFTER, - -1 -}; - -static const int time_map[] = { - E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, - E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END, - -1 -}; - -enum duration_units { - DUR_MINUTES, - DUR_HOURS, - DUR_DAYS -}; - -static const int duration_units_map[] = { - DUR_MINUTES, - DUR_HOURS, - DUR_DAYS, - -1 -}; - -/* Fills the widgets with default values */ -static void -clear_widgets (Dialog *dialog) -{ - /* Sane defaults */ - e_dialog_option_menu_set (dialog->action, E_CAL_COMPONENT_ALARM_DISPLAY, action_map); - e_dialog_spin_set (dialog->interval_value, 15); - e_dialog_option_menu_set (dialog->value_units, MINUTES, value_map); - e_dialog_option_menu_set (dialog->relative, BEFORE, relative_map); - e_dialog_option_menu_set (dialog->time, E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START, time_map); - - gtk_widget_set_sensitive (dialog->repeat_group, FALSE); - gtk_widget_set_sensitive (dialog->dalarm_group, FALSE); - gtk_widget_set_sensitive (dialog->aalarm_group, FALSE); - gtk_widget_set_sensitive (dialog->malarm_group, FALSE); - - gtk_notebook_set_current_page (GTK_NOTEBOOK (dialog->option_notebook), 0); -} - -/* fill_widgets handler for the alarm page */ -static void -alarm_to_dialog (Dialog *dialog) -{ - GtkWidget *menu; - GList *l; - gboolean repeat; - char *email; - int i; - - /* Clean the page */ - clear_widgets (dialog); - - /* Alarm types */ - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action)); - for (i = 0, l = GTK_MENU_SHELL (menu)->children; action_map[i] != -1; i++, l = l->next) { - if (e_cal_get_static_capability (dialog->ecal, action_map_cap[i])) - gtk_widget_set_sensitive (l->data, FALSE); - else - gtk_widget_set_sensitive (l->data, TRUE); - } - - /* Set a default address if possible */ - if (!e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS) - && e_cal_get_alarm_email_address (dialog->ecal, &email, NULL)) { - ECalComponentAttendee *a; - GSList attendee_list; - - a = g_new0 (ECalComponentAttendee, 1); - a->value = email; - attendee_list.data = a; - attendee_list.next = NULL; - e_cal_component_alarm_set_attendee_list (dialog->alarm, &attendee_list); - g_free (email); - g_free (a); - } - - /* If we can repeat */ - repeat = !e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT); - gtk_widget_set_sensitive (dialog->repeat_toggle, repeat); -} - -static void -repeat_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) -{ - ECalComponentAlarmRepeat repeat; - - if (!e_dialog_toggle_get (dialog->repeat_toggle)) { - repeat.repetitions = 0; - - e_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 (); - } - - e_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, ECalComponentAlarm *alarm) -{ - char *url; - icalattach *attach; - - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->aalarm_sound))) - return; - - url = e_dialog_editable_get (dialog->aalarm_attach); - attach = icalattach_new_from_url (url ? url : ""); - g_free (url); - - e_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, ECalComponentAlarm *alarm) -{ - char *str; - ECalComponentText description; - GtkTextBuffer *text_buffer; - GtkTextIter text_iter_start, text_iter_end; - icalcomponent *icalcomp; - icalproperty *icalprop; - - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->dalarm_message))) - return; - - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->dalarm_description)); - gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start); - gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end); - str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE); - - description.value = str; - description.altrep = NULL; - - e_cal_component_alarm_set_description (alarm, &description); - g_free (str); - - /* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that - * we don't re-set the alarm's description */ - icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); - icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); - while (icalprop) { - const char *x_name; - - x_name = icalproperty_get_x_name (icalprop); - if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { - icalcomponent_remove_property (icalcomp, icalprop); - break; - } - - icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY); - } -} - -/* Fills the mail alarm data with the values from the widgets */ -static void -malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) -{ - char *str; - ECalComponentText description; - GSList *attendee_list = NULL; - EDestination **destv; - GtkTextBuffer *text_buffer; - GtkTextIter text_iter_start, text_iter_end; - icalcomponent *icalcomp; - icalproperty *icalprop; - int i; - - /* Attendees */ - bonobo_widget_get_property (BONOBO_WIDGET (dialog->malarm_addresses), "destinations", - TC_CORBA_string, &str, NULL); - destv = e_destination_importv (str); - g_free (str); - - for (i = 0; destv[i] != NULL; i++) { - EDestination *dest; - ECalComponentAttendee *a; - - dest = destv[i]; - - a = g_new0 (ECalComponentAttendee, 1); - a->value = e_destination_get_email (dest); - a->cn = e_destination_get_name (dest); - - attendee_list = g_slist_append (attendee_list, a); - } - - e_cal_component_alarm_set_attendee_list (alarm, attendee_list); - - e_cal_component_free_attendee_list (attendee_list); - e_destination_freev (destv); - - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->malarm_message))) - return; - - /* Description */ - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description)); - gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start); - gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end); - str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE); - - description.value = str; - description.altrep = NULL; - - e_cal_component_alarm_set_description (alarm, &description); - g_free (str); - - /* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that - * we don't re-set the alarm's description */ - icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); - icalprop = icalcomponent_get_first_property(icalcomp, ICAL_X_PROPERTY); - while (icalprop) { - const char *x_name; - - x_name = icalproperty_get_x_name (icalprop); - if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { - icalcomponent_remove_property (icalcomp, icalprop); - break; - } - - icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY); - } -} - -/* Fills the procedure alarm data with the values from the widgets */ -static void -palarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) -{ - char *program; - icalattach *attach; - char *str; - ECalComponentText description; - icalcomponent *icalcomp; - icalproperty *icalprop; - - program = e_dialog_editable_get (dialog->palarm_program); - attach = icalattach_new_from_url (program ? program : ""); - g_free (program); - - e_cal_component_alarm_set_attach (alarm, attach); - icalattach_unref (attach); - - str = e_dialog_editable_get (dialog->palarm_args); - if (str && *str) { - description.value = str; - description.altrep = NULL; - - e_cal_component_alarm_set_description (alarm, &description); - } - g_free (str); - - /* remove the X-EVOLUTION-NEEDS-DESCRIPTION property, so that - * we don't re-set the alarm's description */ - icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); - icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); - while (icalprop) { - const char *x_name; - - x_name = icalproperty_get_x_name (icalprop); - if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { - icalcomponent_remove_property (icalcomp, icalprop); - break; - } - - icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY); - } -} - -/* fill_component handler for the alarm page */ -static void -dialog_to_alarm (Dialog *dialog) -{ - ECalComponentAlarmTrigger trigger; - ECalComponentAlarmAction action; - - /* Fill out the alarm */ - memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger)); - trigger.type = e_dialog_option_menu_get (dialog->time, time_map); - if (e_dialog_option_menu_get (dialog->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 (dialog->value_units, value_map)) { - case MINUTES: - trigger.u.rel_duration.minutes = - e_dialog_spin_get_int (dialog->interval_value); - break; - - case HOURS: - trigger.u.rel_duration.hours = - e_dialog_spin_get_int (dialog->interval_value); - break; - - case DAYS: - trigger.u.rel_duration.days = - e_dialog_spin_get_int (dialog->interval_value); - break; - - default: - g_assert_not_reached (); - } - e_cal_component_alarm_set_trigger (dialog->alarm, trigger); - - action = e_dialog_option_menu_get (dialog->action, action_map); - e_cal_component_alarm_set_action (dialog->alarm, action); - - /* Repeat stuff */ - repeat_widgets_to_alarm (dialog, dialog->alarm); - - /* Options */ - switch (action) { - case E_CAL_COMPONENT_ALARM_NONE: - g_assert_not_reached (); - break; - - case E_CAL_COMPONENT_ALARM_AUDIO: - aalarm_widgets_to_alarm (dialog, dialog->alarm); - break; - - case E_CAL_COMPONENT_ALARM_DISPLAY: - dalarm_widgets_to_alarm (dialog, dialog->alarm); - break; - - case E_CAL_COMPONENT_ALARM_EMAIL: - malarm_widgets_to_alarm (dialog, dialog->alarm); - break; - - case E_CAL_COMPONENT_ALARM_PROCEDURE: - palarm_widgets_to_alarm (dialog, dialog->alarm); - break; - - case E_CAL_COMPONENT_ALARM_UNKNOWN: - break; - - default: - g_assert_not_reached (); - } -} - -/* Gets the widgets from the XML file and returns TRUE 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-dialog"); - if (!dialog->toplevel) - return FALSE; - - dialog->action = GW ("action"); - dialog->interval_value = GW ("interval-value"); - dialog->value_units = GW ("value-units"); - dialog->relative = GW ("relative"); - dialog->time = GW ("time"); - - 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->option_notebook = GW ("option-notebook"); - - dialog->dalarm_group = GW ("dalarm-group"); - dialog->dalarm_message = GW ("dalarm-message"); - dialog->dalarm_description = GW ("dalarm-description"); - - dialog->aalarm_group = GW ("aalarm-group"); - dialog->aalarm_sound = GW ("aalarm-sound"); - dialog->aalarm_attach = GW ("aalarm-attach"); - - dialog->malarm_group = GW ("malarm-group"); - dialog->malarm_address_group = GW ("malarm-address-group"); - dialog->malarm_addressbook = GW ("malarm-addressbook"); - dialog->malarm_message = GW ("malarm-message"); - dialog->malarm_description = GW ("malarm-description"); - - dialog->palarm_group = GW ("palarm-group"); - dialog->palarm_program = GW ("palarm-program"); - dialog->palarm_args = GW ("palarm-args"); - -#undef GW - - return (dialog->action - && dialog->interval_value - && dialog->value_units - && dialog->relative - && dialog->time - && dialog->repeat_toggle - && dialog->repeat_group - && dialog->repeat_quantity - && dialog->repeat_value - && dialog->repeat_unit - && dialog->option_notebook - && dialog->dalarm_group - && dialog->dalarm_message - && dialog->dalarm_description - && dialog->aalarm_group - && dialog->aalarm_sound - && dialog->aalarm_attach - && dialog->malarm_group - && dialog->malarm_address_group - && dialog->malarm_addressbook - && dialog->malarm_message - && dialog->malarm_description - && dialog->palarm_group - && dialog->palarm_program - && dialog->palarm_args); -} - -#if 0 -/* Callback used when the alarm options button is clicked */ -static void -show_options (Dialog *dialog) -{ - gboolean repeat; - char *email; - - e_cal_component_alarm_set_action (dialog->alarm, - e_dialog_option_menu_get (dialog->action, action_map)); - - repeat = !e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT); - - if (e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS) - || e_cal_get_alarm_email_address (dialog->ecal, &email, NULL)) { - if (!alarm_options_dialog_run (dialog->toplevel, dialog->alarm, email, repeat)) - g_message (G_STRLOC ": not create the alarm options dialog"); - } -} -#endif - -static void -addressbook_clicked_cb (GtkWidget *widget, gpointer data) -{ - Dialog *dialog = data; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - GNOME_Evolution_Addressbook_SelectNames_activateDialog (dialog->corba_select_names, - section_name, &ev); - - CORBA_exception_free (&ev); -} - -static gboolean -setup_select_names (Dialog *dialog) -{ - Bonobo_Control corba_control; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - dialog->corba_select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev); - if (BONOBO_EX (&ev)) - return FALSE; - - GNOME_Evolution_Addressbook_SelectNames_addSection (dialog->corba_select_names, - section_name, section_name, &ev); - if (BONOBO_EX (&ev)) - return FALSE; - - corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (dialog->corba_select_names, - section_name, &ev); - - if (BONOBO_EX (&ev)) - return FALSE; - - CORBA_exception_free (&ev); - - dialog->malarm_addresses = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL); - gtk_widget_show (dialog->malarm_addresses); - gtk_box_pack_end_defaults (GTK_BOX (dialog->malarm_address_group), dialog->malarm_addresses); - - gtk_signal_connect (GTK_OBJECT (dialog->malarm_addressbook), "clicked", - GTK_SIGNAL_FUNC (addressbook_clicked_cb), dialog); - - return 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 = data; - gboolean active; - - active = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (dialog->repeat_group, active); -} - -static void -check_custom_sound (Dialog *dialog) -{ - char *str; - gboolean sens; - - str = e_dialog_editable_get (dialog->aalarm_attach); - - sens = e_dialog_toggle_get (dialog->aalarm_sound) ? str && *str : TRUE; - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens); - - g_free (str); -} - -static void -aalarm_sound_toggled_cb (GtkToggleButton *toggle, gpointer data) -{ - Dialog *dialog = data; - gboolean active; - - active = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (dialog->aalarm_group, active); - check_custom_sound (dialog); -} - -static void -aalarm_attach_changed_cb (GtkWidget *widget, gpointer data) -{ - Dialog *dialog = data; - - check_custom_sound (dialog); -} - -static void -check_custom_message (Dialog *dialog) -{ - char *str; - GtkTextBuffer *text_buffer; - GtkTextIter text_iter_start, text_iter_end; - gboolean sens; - - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->dalarm_description)); - gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start); - gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end); - str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE); - - sens = e_dialog_toggle_get (dialog->dalarm_message) ? str && *str : TRUE; - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens); - - g_free (str); -} - -static void -dalarm_message_toggled_cb (GtkToggleButton *toggle, gpointer data) -{ - Dialog *dialog = data; - gboolean active; - - active = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (dialog->dalarm_group, active); - check_custom_message (dialog); -} - -static void -dalarm_description_changed_cb (GtkWidget *widget, gpointer data) -{ - Dialog *dialog = data; - - check_custom_message (dialog); -} - -static void -check_custom_program (Dialog *dialog) -{ - char *str; - gboolean sens; - - str = e_dialog_editable_get (dialog->palarm_program); - - sens = str && *str; - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens); -} - -static void -palarm_program_changed_cb (GtkWidget *widget, gpointer data) -{ - Dialog *dialog = data; - - check_custom_program (dialog); -} - -static void -check_custom_email (Dialog *dialog) -{ - char *str; - GtkTextBuffer *text_buffer; - GtkTextIter text_iter_start, text_iter_end; - EDestination **destv; - gboolean sens; - - bonobo_widget_get_property (BONOBO_WIDGET (dialog->malarm_addresses), "destinations", - TC_CORBA_string, &str, NULL); - destv = e_destination_importv (str); - g_free (str); - - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description)); - gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start); - gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end); - str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE); - - sens = (destv != NULL) && (e_dialog_toggle_get (dialog->malarm_message) ? str && *str : TRUE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, sens); - - e_destination_freev (destv); -} - -static void -malarm_addresses_changed_cb (BonoboListener *listener, - const char *event_name, - const CORBA_any *arg, - CORBA_Environment *ev, - gpointer data) -{ - Dialog *dialog = data; - - check_custom_email (dialog); -} - -static void -malarm_message_toggled_cb (GtkToggleButton *toggle, gpointer data) -{ - Dialog *dialog = data; - gboolean active; - - active = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (dialog->malarm_group, active); - check_custom_email (dialog); -} - -static void -malarm_description_changed_cb (GtkWidget *widget, gpointer data) -{ - Dialog *dialog = data; - - check_custom_email (dialog); -} - -static void -action_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - Dialog *dialog = data; - ECalComponentAlarmAction action; - int page = 0, i; - - action = e_dialog_option_menu_get (dialog->action, action_map); - for (i = 0; action_map[i] != -1 ; i++) { - if (action == action_map[i]) { - page = i; - break; - } - } - - gtk_notebook_set_page (GTK_NOTEBOOK (dialog->option_notebook), page); - - switch (action) { - case E_CAL_COMPONENT_ALARM_AUDIO: - check_custom_sound (dialog); - break; - - case E_CAL_COMPONENT_ALARM_DISPLAY: - check_custom_message (dialog); - break; - - case E_CAL_COMPONENT_ALARM_EMAIL: - check_custom_email (dialog); - break; - - case E_CAL_COMPONENT_ALARM_PROCEDURE: - check_custom_program (dialog); - break; - default: - g_assert_not_reached (); - return; - } -} - -/* Hooks the widget signals */ -static void -init_widgets (Dialog *dialog) -{ - GtkWidget *menu; - GtkTextBuffer *text_buffer; - BonoboControlFrame *cf; - Bonobo_PropertyBag pb = CORBA_OBJECT_NIL; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (dialog->action)); - g_signal_connect (menu, "selection_done", - G_CALLBACK (action_selection_done_cb), - dialog); - - g_signal_connect (G_OBJECT (dialog->repeat_toggle), "toggled", - G_CALLBACK (repeat_toggle_toggled_cb), dialog); - - /* Handle custom sounds */ - g_signal_connect (G_OBJECT (dialog->aalarm_sound), "toggled", - G_CALLBACK (aalarm_sound_toggled_cb), dialog); - g_signal_connect (G_OBJECT (dialog->aalarm_attach), "changed", - G_CALLBACK (aalarm_attach_changed_cb), dialog); - - /* Handle custom messages */ - g_signal_connect (G_OBJECT (dialog->dalarm_message), "toggled", - G_CALLBACK (dalarm_message_toggled_cb), dialog); - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->dalarm_description)); - g_signal_connect (G_OBJECT (text_buffer), "changed", - G_CALLBACK (dalarm_description_changed_cb), dialog); - - /* Handle program */ - g_signal_connect (G_OBJECT (dialog->palarm_program), "changed", - G_CALLBACK (palarm_program_changed_cb), dialog); - - /* Handle custom email */ - g_signal_connect (G_OBJECT (dialog->malarm_message), "toggled", - G_CALLBACK (malarm_message_toggled_cb), dialog); - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description)); - g_signal_connect (G_OBJECT (text_buffer), "changed", - G_CALLBACK (malarm_description_changed_cb), dialog); - - cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (dialog->malarm_addresses)); - pb = bonobo_control_frame_get_control_property_bag (cf, NULL); - - bonobo_event_source_client_add_listener (pb, malarm_addresses_changed_cb, - "Bonobo/Property:change:entry_changed", - NULL, dialog); -} - -gboolean -alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) -{ - Dialog dialog; - int response_id; - GList *icon_list; - - g_return_val_if_fail (alarm != NULL, FALSE); - - dialog.alarm = alarm; - dialog.ecal = ecal; - - dialog.xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-dialog.glade", NULL, NULL); - if (!dialog.xml) { - g_message (G_STRLOC ": Could not load the Glade XML file!"); - return FALSE; - } - - if (!get_widgets (&dialog)) { - g_object_unref(dialog.xml); - return FALSE; - } - - if (!setup_select_names (&dialog)) { - g_object_unref (dialog.xml); - return FALSE; - } - - init_widgets (&dialog); - - alarm_to_dialog (&dialog); - - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), - GTK_WINDOW (parent)); - - response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel)); - - if (response_id == GTK_RESPONSE_OK) - dialog_to_alarm (&dialog); - - gtk_widget_destroy (dialog.toplevel); - g_object_unref (dialog.xml); - - return response_id == GTK_RESPONSE_OK ? TRUE : FALSE; -} diff --git a/calendar/gui/dialogs/alarm-dialog.glade b/calendar/gui/dialogs/alarm-dialog.glade deleted file mode 100644 index 0289ad2f4f..0000000000 --- a/calendar/gui/dialogs/alarm-dialog.glade +++ /dev/null @@ -1,1147 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="alarm-dialog"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="title" translatable="yes">Add Alarm</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">True</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancelbutton"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="okbutton"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Alarm</b> </property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox56"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox54"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkOptionMenu" id="action"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget1"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Pop up an alert</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Play a sound</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget4"> - <property name="visible">True</property> - <property name="label" translatable="yes">Run a program</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="send_an_email1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Send an email</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="interval-value"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 999 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="value-units"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget5"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget6"> - <property name="visible">True</property> - <property name="label" translatable="yes">minute(s)</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget7"> - <property name="visible">True</property> - <property name="label" translatable="yes">hour(s)</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget8"> - <property name="visible">True</property> - <property name="label" translatable="yes">day(s)</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="relative"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget9"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget10"> - <property name="visible">True</property> - <property name="label" translatable="yes">before</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget11"> - <property name="visible">True</property> - <property name="label" translatable="yes">after</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="time"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget12"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget13"> - <property name="visible">True</property> - <property name="label" translatable="yes">start of appointment</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget14"> - <property name="visible">True</property> - <property name="label" translatable="yes">end of appointment</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Repeat</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox57"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox5"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="repeat-toggle"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="has_focus">True</property> - <property name="label" translatable="yes">_Repeat the alarm</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="repeat-group"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkSpinButton" id="repeat-quantity"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 1 999 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">extra times every</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="repeat-value"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">5 0 999 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="repeat-unit"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget1"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget2"> - <property name="visible">True</property> - <property name="label" translatable="yes">minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget3"> - <property name="visible">True</property> - <property name="label" translatable="yes">hours</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget4"> - <property name="visible">True</property> - <property name="label" translatable="yes">days</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Options</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox55"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="option-notebook"> - <property name="visible">True</property> - <property name="show_tabs">False</property> - <property name="show_border">False</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkVBox" id="vbox3"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="dalarm-message"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Custom _message</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="dalarm-group"> - <property name="visible">True</property> - <property name="n_rows">1</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="dalarm-description"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Mes_sage:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">option-notebook</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="label" translatable="yes">label15</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="aalarm-sound"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Custom alarm sound</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="aalarm-group"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Sound:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">aalarm-attach</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GnomeFileEntry" id="file-entry1"> - <property name="visible">True</property> - <property name="max_saved">10</property> - <property name="directory_entry">False</property> - <property name="modal">True</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="aalarm-attach"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="label" translatable="yes">label16</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox2"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkTable" id="palarm-group"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Program:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">palarm-program</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Arguments:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">palarm-args</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="palarm-program"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="palarm-args"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label17"> - <property name="visible">True</property> - <property name="label" translatable="yes">label17</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox4"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkVBox" id="vbox6"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="malarm-address-group"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="malarm-addressbook"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Send To:</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox27"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="malarm-message"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Custom _message</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="malarm-group"> - <property name="visible">True</property> - <property name="n_rows">1</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow3"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="malarm-description"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label19"> - <property name="visible">True</property> - <property name="label" translatable="yes">Mes_sage:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">option-notebook</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="label" translatable="yes">label18</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/alarm-dialog.h b/calendar/gui/dialogs/alarm-dialog.h deleted file mode 100644 index 8e57579d9f..0000000000 --- a/calendar/gui/dialogs/alarm-dialog.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 2001-2003 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> - * Hans Petter Jansson <hpj@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_DIALOG_H -#define ALARM_DIALOG_H - -#include <libecal/e-cal.h> -#include <libecal/e-cal-component.h> - -G_BEGIN_DECLS - -gboolean alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm); - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c deleted file mode 100644 index add08c1dfa..0000000000 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 2001-2003 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> - * Hans Petter Jansson <hpj@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/gtklabel.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktreeview.h> -#include <gtk/gtktreeselection.h> -#include <gtk/gtkoptionmenu.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include "e-util/e-dialog-widgets.h" -#include "e-util/e-time-utils.h" -#include <libecal/e-cal-util.h> -#include <libecal/e-cal-time-util.h> -#include "e-util/e-dialog-widgets.h" -#include "e-util/e-icon-factory.h" -#include "alarm-dialog.h" -#include "alarm-list-dialog.h" - - - -typedef struct { - /* Glade XML data */ - GladeXML *xml; - - /* The client */ - ECal *ecal; - - /* The list store */ - EAlarmList *list_store; - - /* Toplevel */ - GtkWidget *toplevel; - - GtkWidget *list; - GtkWidget *add; - GtkWidget *delete; -} Dialog; - -/* Gets the widgets from the XML file and returns TRUE 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-list-dialog"); - if (!dialog->toplevel) - return FALSE; - - dialog->list = GW ("list"); - dialog->add = GW ("add"); - dialog->delete = GW ("delete"); - -#undef GW - - return (dialog->list - && dialog->add - && dialog->delete); -} - -static void -sensitize_buttons (Dialog *dialog) -{ - GtkTreeSelection *selection; - GtkTreeIter iter; - gboolean have_selected; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list)); - have_selected = gtk_tree_selection_get_selected (selection, NULL, &iter); - - if (e_cal_get_one_alarm_only (dialog->ecal) && have_selected) - gtk_widget_set_sensitive (dialog->add, FALSE); - else - gtk_widget_set_sensitive (dialog->add, TRUE); - gtk_widget_set_sensitive (dialog->delete, have_selected); -} - -/* Callback used for the "add reminder" button */ -static void -add_clicked_cb (GtkButton *button, gpointer data) -{ - Dialog *dialog = data; - ECalComponentAlarm *alarm; - GtkTreeView *view; - GtkTreeIter iter; - icalcomponent *icalcomp; - icalproperty *icalprop; - - view = GTK_TREE_VIEW (dialog->list); - - alarm = e_cal_component_alarm_new (); - - icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); - icalprop = icalproperty_new_x ("1"); - icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION"); - icalcomponent_add_property (icalcomp, icalprop); - - if (alarm_dialog_run (dialog->toplevel, dialog->ecal, alarm)) { - e_alarm_list_append (dialog->list_store, &iter, alarm); - gtk_tree_selection_select_iter (gtk_tree_view_get_selection (view), &iter); - } else { - e_cal_component_alarm_free (alarm); - } - - sensitize_buttons (dialog); -} - -/* Callback used for the "delete reminder" button */ -static void -delete_clicked_cb (GtkButton *button, gpointer data) -{ - Dialog *dialog = data; - GtkTreeSelection *selection; - GtkTreeIter iter; - GtkTreePath *path; - gboolean valid_iter; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list)); - if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { - g_warning ("Could not get a selection to delete."); - return; - } - - path = gtk_tree_model_get_path (GTK_TREE_MODEL (dialog->list_store), &iter); - e_alarm_list_remove (dialog->list_store, &iter); - - /* Select closest item after removal */ - valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->list_store), &iter, path); - if (!valid_iter) { - gtk_tree_path_prev (path); - valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->list_store), &iter, path); - } - - if (valid_iter) - gtk_tree_selection_select_iter (selection, &iter); - - sensitize_buttons (dialog); - - gtk_tree_path_free (path); -} - -static void -selection_changed_cb (GtkTreeSelection *selection, gpointer data) -{ - Dialog *dialog = data; - - sensitize_buttons (dialog); -} - -/* Hooks the widget signals */ -static void -init_widgets (Dialog *dialog) -{ - GtkTreeViewColumn *column; - GtkCellRenderer *cell_renderer; - - /* View */ - gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->list), - GTK_TREE_MODEL (dialog->list_store)); - - column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_title (column, _("Action/Trigger")); - cell_renderer = GTK_CELL_RENDERER (gtk_cell_renderer_text_new ()); - gtk_tree_view_column_pack_start (column, cell_renderer, TRUE); - gtk_tree_view_column_add_attribute (column, cell_renderer, "text", E_ALARM_LIST_COLUMN_DESCRIPTION); - gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->list), column); - - /* Reminder buttons */ - g_signal_connect (dialog->add, "clicked", - G_CALLBACK (add_clicked_cb), dialog); - g_signal_connect (dialog->delete, "clicked", - G_CALLBACK (delete_clicked_cb), dialog); - - g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list)), "changed", - G_CALLBACK (selection_changed_cb), dialog); -} - -gboolean -alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) -{ - Dialog dialog; - int response_id; - GList *icon_list; - - dialog.ecal = ecal; - dialog.list_store = list_store; - - dialog.xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-list-dialog.glade", NULL, NULL); - if (!dialog.xml) { - g_message (G_STRLOC ": Could not load the Glade XML file!"); - return FALSE; - } - - if (!get_widgets (&dialog)) { - g_object_unref(dialog.xml); - return FALSE; - } - - init_widgets (&dialog); - - sensitize_buttons (&dialog); - - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), - GTK_WINDOW (parent)); - - response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel)); - gtk_widget_hide (dialog.toplevel); - - gtk_widget_destroy (dialog.toplevel); - g_object_unref (dialog.xml); - - return response_id == GTK_RESPONSE_OK ? TRUE : FALSE; -} diff --git a/calendar/gui/dialogs/alarm-list-dialog.glade b/calendar/gui/dialogs/alarm-list-dialog.glade deleted file mode 100644 index 4987355f84..0000000000 --- a/calendar/gui/dialogs/alarm-list-dialog.glade +++ /dev/null @@ -1,219 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="alarm-list-dialog"> - <property name="visible">False</property> - <property name="title" translatable="yes">Alarms</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> - <property name="modal">True</property> - <property name="default_width">320</property> - <property name="default_height">240</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancelbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="okbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox53"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox55"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow13"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="list"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">True</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox2"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="add"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox56"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label65"> - <property name="visible">True</property> - <property name="label" translatable="yes">A_dd</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkButton" id="delete"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-remove</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/alarm-list-dialog.h b/calendar/gui/dialogs/alarm-list-dialog.h deleted file mode 100644 index a46bcccfa4..0000000000 --- a/calendar/gui/dialogs/alarm-list-dialog.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Evolution calendar - Alarm page of the calendar component dialogs - * - * Copyright (C) 2001-2003 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> - * Hans Petter Jansson <hpj@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_LIST_DIALOG_H -#define ALARM_LIST_DIALOG_H - -#include <libecal/e-cal.h> -#include <libecal/e-cal-component.h> -#include "../e-alarm-list.h" - -G_BEGIN_DECLS - -gboolean alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store); - -G_END_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 7d540fc1c2..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ /dev/null @@ -1,1026 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors : - * Damon Chaplin <damon@ximian.com> - * Ettore Perazzoli <ettore@ximian.com> - * - * Copyright 2000, 2001, 2002 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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "../e-timezone-entry.h" -#include "cal-prefs-dialog.h" -#include "../calendar-config.h" -#include "url-editor-dialog.h" - -#include <gtk/gtk.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtktogglebutton.h> -#include <libxml/tree.h> -#include <string.h> -#include <libgnome/gnome-i18n.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> - - -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 gboolean get_widgets (DialogData *data); - -static void setup_changes (DialogData *data); - -static void init_widgets (DialogData *data); -static void show_config (DialogData *data); - -static void config_control_destroy_callback (DialogData *dialog_data, GObject *deadbeef); - -static void cal_prefs_dialog_url_add_clicked (GtkWidget *button, DialogData *dialog_data); -static void cal_prefs_dialog_url_edit_clicked (GtkWidget *button, DialogData *dialog_data); -static void cal_prefs_dialog_url_remove_clicked (GtkWidget *button, DialogData *dialog_data); -static void cal_prefs_dialog_url_enable_clicked (GtkWidget *button, DialogData *dialog_data); -static void cal_prefs_dialog_url_list_change (GtkTreeSelection *selection, DialogData *dialog_data); -static void cal_prefs_dialog_url_list_enable_toggled (GtkCellRendererToggle *renderer, const char *path_string, DialogData *dialog_data); -static void cal_prefs_dialog_url_list_double_click(GtkTreeView *treeview, - GtkTreePath *path, - GtkTreeViewColumn *column, - DialogData *dialog_data); -static void show_fb_config (DialogData *dialog_data); - -GtkWidget *cal_prefs_dialog_create_time_edit (void); - -#define PREFS_WINDOW(dialog_data) GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (dialog_data), GTK_TYPE_WINDOW)) - -/** - * cal_prefs_dialog_new: - * - * Creates a new #CalPrefsDialog. - * - * Return value: a new #CalPrefsDialog. - **/ -EvolutionConfigControl * -cal_prefs_dialog_new (void) -{ - DialogData *dialog_data; - EvolutionConfigControl *config_control; - - dialog_data = g_new0 (DialogData, 1); - - /* Load the content widgets */ - - dialog_data->xml = glade_xml_new (EVOLUTION_GLADEDIR "/cal-prefs-dialog.glade", NULL, NULL); - if (!dialog_data->xml) { - g_message ("cal_prefs_dialog_construct(): Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (dialog_data)) { - g_message ("cal_prefs_dialog_construct(): Could not find all widgets in the XML file!"); - return NULL; - } - - init_widgets (dialog_data); - show_config (dialog_data); - - gtk_widget_ref (dialog_data->page); - gtk_container_remove (GTK_CONTAINER (dialog_data->page->parent), dialog_data->page); - config_control = evolution_config_control_new (dialog_data->page); - gtk_widget_unref (dialog_data->page); - - g_object_weak_ref ((GObject *) config_control, (GWeakNotify) config_control_destroy_callback, dialog_data); - - setup_changes (dialog_data); - - return config_control; -} - -/* 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; -} - -static void -working_days_changed (GtkWidget *widget, DialogData *dialog_data) -{ - CalWeekdays working_days = 0; - guint32 mask = 1; - int day; - - for (day = 0; day < 7; day++) { - if (e_dialog_toggle_get (dialog_data->working_days[day])) - working_days |= mask; - mask <<= 1; - } - - calendar_config_set_working_days (working_days); -} - -static void -timezone_changed (GtkWidget *widget, DialogData *dialog_data) -{ - icaltimezone *zone; - - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (dialog_data->timezone)); - calendar_config_set_timezone (icaltimezone_get_location (zone)); -} - -static void -start_of_day_changed (GtkWidget *widget, DialogData *dialog_data) -{ - int start_hour, start_minute, end_hour, end_minute; - EDateEdit *start, *end; - - start = E_DATE_EDIT (dialog_data->start_of_day); - end = E_DATE_EDIT (dialog_data->end_of_day); - - e_date_edit_get_time_of_day (start, &start_hour, &start_minute); - e_date_edit_get_time_of_day (end, &end_hour, &end_minute); - - if ((start_hour > end_hour) || (start_hour == end_hour && start_minute > end_minute)) { - if (start_hour < 23) - e_date_edit_set_time_of_day (end, start_hour + 1, start_minute); - else - e_date_edit_set_time_of_day (end, 23, 59); - - return; - } - - calendar_config_set_day_start_hour (start_hour); - calendar_config_set_day_start_minute (start_minute); -} - -static void -end_of_day_changed (GtkWidget *widget, DialogData *dialog_data) -{ - int start_hour, start_minute, end_hour, end_minute; - EDateEdit *start, *end; - - start = E_DATE_EDIT (dialog_data->start_of_day); - end = E_DATE_EDIT (dialog_data->end_of_day); - - e_date_edit_get_time_of_day (start, &start_hour, &start_minute); - e_date_edit_get_time_of_day (end, &end_hour, &end_minute); - - if ((end_hour < start_hour) || (end_hour == start_hour && end_minute < start_minute)) { - if (end_hour < 1) - e_date_edit_set_time_of_day (start, 0, 0); - else - e_date_edit_set_time_of_day (start, end_hour - 1, end_minute); - - return; - } - - calendar_config_set_day_end_hour (end_hour); - calendar_config_set_day_end_minute (end_minute); -} - -static void -week_start_day_changed (GtkWidget *widget, DialogData *dialog_data) -{ - int week_start_day; - - week_start_day = e_dialog_option_menu_get (dialog_data->week_start_day, week_start_day_map); - calendar_config_set_week_start_day (week_start_day); -} - -static void -use_24_hour_toggled (GtkToggleButton *toggle, DialogData *dialog_data) -{ - gboolean use_24_hour; - - use_24_hour = gtk_toggle_button_get_active (toggle); - - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (dialog_data->start_of_day), use_24_hour); - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (dialog_data->end_of_day), use_24_hour); - - calendar_config_set_24_hour_format (use_24_hour); -} - -static void -time_divisions_changed (GtkWidget *widget, DialogData *dialog_data) -{ - int time_divisions; - - time_divisions = e_dialog_option_menu_get (dialog_data->time_divisions, time_division_map); - calendar_config_set_time_divisions (time_divisions); -} - -static void -show_end_times_toggled (GtkToggleButton *toggle, DialogData *dialog_data) -{ - calendar_config_set_show_event_end (gtk_toggle_button_get_active (toggle)); -} - -static void -compress_weekend_toggled (GtkToggleButton *toggle, DialogData *dialog_data) -{ - calendar_config_set_compress_weekend (gtk_toggle_button_get_active (toggle)); -} - -static void -dnav_show_week_no_toggled (GtkToggleButton *toggle, DialogData *dialog_data) -{ - calendar_config_set_dnav_show_week_no (gtk_toggle_button_get_active (toggle)); -} - -static void -hide_completed_tasks_toggled (GtkToggleButton *toggle, DialogData *dialog_data) -{ - gboolean hide; - - hide = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (dialog_data->tasks_hide_completed_spinbutton, hide); - gtk_widget_set_sensitive (dialog_data->tasks_hide_completed_optionmenu, hide); - - calendar_config_set_hide_completed_tasks (hide); -} - -static void -hide_completed_tasks_changed (GtkWidget *widget, DialogData *dialog_data) -{ - calendar_config_set_hide_completed_tasks_value (e_dialog_spin_get_int (dialog_data->tasks_hide_completed_spinbutton)); -} - -static void -hide_completed_tasks_units_changed (GtkWidget *widget, DialogData *dialog_data) -{ - calendar_config_set_hide_completed_tasks_units ( - e_dialog_option_menu_get (dialog_data->tasks_hide_completed_optionmenu, hide_completed_units_map)); -} - -static void -tasks_due_today_set_color (GnomeColorPicker *picker, guint r, guint g, guint b, guint a, DialogData *dialog_data) -{ - calendar_config_set_tasks_due_today_color (spec_from_picker (dialog_data->tasks_due_today_color)); -} - -static void -tasks_overdue_set_color (GnomeColorPicker *picker, guint r, guint g, guint b, guint a, DialogData *dialog_data) -{ - calendar_config_set_tasks_overdue_color (spec_from_picker (dialog_data->tasks_overdue_color)); -} - -static void -confirm_delete_toggled (GtkToggleButton *toggle, DialogData *dialog_data) -{ - calendar_config_set_confirm_delete (gtk_toggle_button_get_active (toggle)); -} - -static void -default_reminder_toggled (GtkToggleButton *toggle, DialogData *dialog_data) -{ - calendar_config_set_use_default_reminder (gtk_toggle_button_get_active (toggle)); -} - -static void -default_reminder_interval_changed (GtkWidget *widget, DialogData *dialog_data) -{ - calendar_config_set_default_reminder_interval ( - e_dialog_spin_get_int (dialog_data->default_reminder_interval)); -} - -static void -default_reminder_units_changed (GtkWidget *widget, DialogData *dialog_data) -{ - calendar_config_set_default_reminder_units ( - e_dialog_option_menu_get (dialog_data->default_reminder_units, default_reminder_units_map)); -} - -static void -url_list_changed (DialogData *dialog_data) -{ - GtkListStore *model = NULL; - GSList *url_list = NULL; - GtkTreeIter iter; - gboolean valid; - - url_list = NULL; - - model = (GtkListStore *) gtk_tree_view_get_model (dialog_data->url_list); - - valid = gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter); - while (valid) { - EPublishUri *url; - char *xml; - - gtk_tree_model_get ((GtkTreeModel *) model, &iter, - URL_LIST_FREE_BUSY_URL_COLUMN, &url, - -1); - - if ((xml = e_pub_uri_to_xml (url))) - url_list = g_slist_append (url_list, xml); - - valid = gtk_tree_model_iter_next ((GtkTreeModel *) model, &iter); - } - - calendar_config_set_free_busy (url_list); - - g_slist_free (url_list); -} - -static void -setup_changes (DialogData *dialog_data) -{ - int i; - - for (i = 0; i < 7; i ++) - g_signal_connect (dialog_data->working_days[i], "toggled", G_CALLBACK (working_days_changed), dialog_data); - - g_signal_connect (dialog_data->timezone, "changed", G_CALLBACK (timezone_changed), dialog_data); - - g_signal_connect (dialog_data->start_of_day, "changed", G_CALLBACK (start_of_day_changed), dialog_data); - g_signal_connect (dialog_data->end_of_day, "changed", G_CALLBACK (end_of_day_changed), dialog_data); - - g_signal_connect (GTK_OPTION_MENU (dialog_data->week_start_day)->menu, "selection-done", - G_CALLBACK (week_start_day_changed), dialog_data); - - g_signal_connect (dialog_data->use_24_hour, "toggled", G_CALLBACK (use_24_hour_toggled), dialog_data); - - g_signal_connect (GTK_OPTION_MENU (dialog_data->time_divisions)->menu, "selection-done", - G_CALLBACK (time_divisions_changed), dialog_data); - - g_signal_connect (dialog_data->show_end_times, "toggled", G_CALLBACK (show_end_times_toggled), dialog_data); - g_signal_connect (dialog_data->compress_weekend, "toggled", G_CALLBACK (compress_weekend_toggled), dialog_data); - g_signal_connect (dialog_data->dnav_show_week_no, "toggled", G_CALLBACK (dnav_show_week_no_toggled), dialog_data); - - g_signal_connect (dialog_data->tasks_hide_completed_checkbutton, "toggled", - G_CALLBACK (hide_completed_tasks_toggled), dialog_data); - g_signal_connect (dialog_data->tasks_hide_completed_spinbutton, "value-changed", - G_CALLBACK (hide_completed_tasks_changed), dialog_data); - g_signal_connect (GTK_OPTION_MENU (dialog_data->tasks_hide_completed_optionmenu)->menu, "selection-done", - G_CALLBACK (hide_completed_tasks_units_changed), dialog_data); - g_signal_connect (dialog_data->tasks_due_today_color, "color-set", - G_CALLBACK (tasks_due_today_set_color), dialog_data); - g_signal_connect (dialog_data->tasks_overdue_color, "color-set", - G_CALLBACK (tasks_overdue_set_color), dialog_data); - - g_signal_connect (dialog_data->confirm_delete, "toggled", G_CALLBACK (confirm_delete_toggled), dialog_data); - g_signal_connect (dialog_data->default_reminder, "toggled", G_CALLBACK (default_reminder_toggled), dialog_data); - g_signal_connect (dialog_data->default_reminder_interval, "changed", - G_CALLBACK (default_reminder_interval_changed), dialog_data); - g_signal_connect (GTK_OPTION_MENU (dialog_data->default_reminder_units)->menu, "selection-done", - G_CALLBACK (default_reminder_units_changed), dialog_data); -} - -/* Gets the widgets from the XML file and returns if they are all available. - */ -static gboolean -get_widgets (DialogData *data) -{ -#define GW(name) glade_xml_get_widget (data->xml, name) - - data->page = GW ("toplevel-notebook"); - - /* The indices must be 0 (Sun) to 6 (Sat). */ - data->working_days[0] = GW ("sun_button"); - data->working_days[1] = GW ("mon_button"); - data->working_days[2] = GW ("tue_button"); - data->working_days[3] = GW ("wed_button"); - data->working_days[4] = GW ("thu_button"); - data->working_days[5] = GW ("fri_button"); - data->working_days[6] = GW ("sat_button"); - - data->timezone = GW ("timezone"); - data->week_start_day = GW ("first_day_of_week"); - data->start_of_day = GW ("start_of_day"); - gtk_widget_show (data->start_of_day); - data->end_of_day = GW ("end_of_day"); - gtk_widget_show (data->end_of_day); - data->use_12_hour = GW ("use_12_hour"); - data->use_24_hour = GW ("use_24_hour"); - data->time_divisions = GW ("time_divisions"); - data->show_end_times = GW ("show_end_times"); - data->compress_weekend = GW ("compress_weekend"); - data->dnav_show_week_no = GW ("dnav_show_week_no"); - - data->tasks_due_today_color = GW ("tasks_due_today_color"); - data->tasks_overdue_color = GW ("tasks_overdue_color"); - - data->tasks_hide_completed_checkbutton = GW ("tasks-hide-completed-checkbutton"); - data->tasks_hide_completed_spinbutton = GW ("tasks-hide-completed-spinbutton"); - data->tasks_hide_completed_optionmenu = GW ("tasks-hide-completed-optionmenu"); - - data->confirm_delete = GW ("confirm-delete"); - data->default_reminder = GW ("default-reminder"); - data->default_reminder_interval = GW ("default-reminder-interval"); - data->default_reminder_units = GW ("default-reminder-units"); - - data->url_add = GW ("url_add"); - data->url_edit = GW ("url_edit"); - data->url_remove = GW ("url_remove"); - data->url_enable = GW ("url_enable"); - data->url_list = GTK_TREE_VIEW (GW ("url_list")); - -#undef GW - - return (data->page - && data->timezone - && data->working_days[0] - && data->working_days[1] - && data->working_days[2] - && data->working_days[3] - && data->working_days[4] - && data->working_days[5] - && data->working_days[6] - && data->week_start_day - && data->start_of_day - && data->end_of_day - && data->use_12_hour - && data->use_24_hour - && data->time_divisions - && data->show_end_times - && data->compress_weekend - && data->dnav_show_week_no - && data->tasks_due_today_color - && data->tasks_overdue_color - && data->tasks_hide_completed_checkbutton - && data->tasks_hide_completed_spinbutton - && data->tasks_hide_completed_optionmenu - && data->confirm_delete - && data->default_reminder - && data->default_reminder_interval - && data->default_reminder_units - && data->url_add - && data->url_edit - && data->url_remove - && data->url_enable - && data->url_list); -} - - -static void -config_control_destroy_callback (DialogData *dialog_data, GObject *deadbeef) -{ - g_object_unref (dialog_data->xml); - - g_free (dialog_data); -} - -/* 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_use_24_hour_format (E_DATE_EDIT (dedit), calendar_config_get_24_hour_format ()); - 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; -} - - -/* Connects any necessary signal handlers. */ -static void -init_widgets (DialogData *dialog_data) -{ - GtkCellRenderer *renderer = NULL; - GtkTreeSelection *selection; - GtkListStore *model; - - dialog_data->url_editor = FALSE; - dialog_data->url_editor_dlg =NULL; - - /* Free/Busy ... */ - g_signal_connect (dialog_data->url_add, "clicked", - G_CALLBACK (cal_prefs_dialog_url_add_clicked), - dialog_data); - - g_signal_connect (dialog_data->url_edit, "clicked", - G_CALLBACK (cal_prefs_dialog_url_edit_clicked), - dialog_data); - - g_signal_connect (dialog_data->url_remove, "clicked", - G_CALLBACK (cal_prefs_dialog_url_remove_clicked), - dialog_data); - - g_signal_connect (dialog_data->url_enable, "clicked", - G_CALLBACK (cal_prefs_dialog_url_enable_clicked), - dialog_data); - - /* Free/Busy Listview */ - renderer = gtk_cell_renderer_toggle_new(); - g_object_set ((GObject *) renderer, "activatable", TRUE, NULL); - - model = gtk_list_store_new (URL_LIST_N_COLUMNS, G_TYPE_BOOLEAN, - G_TYPE_STRING, G_TYPE_POINTER); - - gtk_tree_view_set_model (dialog_data->url_list, - (GtkTreeModel *) model); - - gtk_tree_view_insert_column_with_attributes (dialog_data->url_list, -1, - _("Enabled"), renderer, - "active", - URL_LIST_ENABLED_COLUMN, - NULL); - - g_signal_connect (renderer, "toggled", - G_CALLBACK (cal_prefs_dialog_url_list_enable_toggled), - dialog_data); - - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (dialog_data->url_list, -1, - _("Location"), renderer, - "text", - URL_LIST_LOCATION_COLUMN, - NULL); - - selection = gtk_tree_view_get_selection ((GtkTreeView *) dialog_data->url_list); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - gtk_tree_view_set_headers_visible ((GtkTreeView *) dialog_data->url_list, TRUE); - - g_signal_connect (dialog_data->url_list, "row-activated", - G_CALLBACK (cal_prefs_dialog_url_list_double_click), - dialog_data); -} - -/* Sets the color in a color picker from an X color spec */ -static void -set_color_picker (GtkWidget *picker, const char *spec) -{ - GdkColor color; - - if (!spec || !gdk_color_parse (spec, &color)) - color.red = color.green = color.blue = 0; - - gnome_color_picker_set_i16 (GNOME_COLOR_PICKER (picker), - color.red, - color.green, - color.blue, - 65535); -} - -static void -cal_prefs_dialog_url_add_clicked (GtkWidget *button, DialogData *dialog_data) -{ - EPublishUri *url = NULL; - GtkTreeModel *model; - GtkTreeIter iter; - GtkTreeSelection *selection; - - model = gtk_tree_view_get_model (dialog_data->url_list); - url = g_new0 (EPublishUri, 1); - url->enabled = TRUE; - url->location = ""; - - if (!dialog_data->url_editor) { - dialog_data->url_editor = url_editor_dialog_new (dialog_data, - url); - - if (url->location != "") { - gtk_list_store_append(GTK_LIST_STORE (model), &iter); - gtk_list_store_set (GTK_LIST_STORE(model), &iter, - URL_LIST_ENABLED_COLUMN, - url->enabled, - URL_LIST_LOCATION_COLUMN, - g_strdup (url->location), - URL_LIST_FREE_BUSY_URL_COLUMN, url, - -1); - - url_list_changed (dialog_data); - - if (!GTK_WIDGET_SENSITIVE ((GtkWidget *) dialog_data->url_remove)) { - selection = gtk_tree_view_get_selection ((GtkTreeView *) dialog_data->url_list); - gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter); - gtk_widget_set_sensitive ((GtkWidget*) dialog_data->url_remove, TRUE); - gtk_tree_selection_select_iter (selection, &iter); - } - } - dialog_data->url_editor = FALSE; - dialog_data->url_editor_dlg = NULL; - } else { - gdk_window_raise (dialog_data->url_editor_dlg->window); - } -} - -static void -cal_prefs_dialog_url_edit_clicked (GtkWidget *button, DialogData *dialog_data) -{ - if (!dialog_data->url_editor) { - GtkTreeSelection *selection; - EPublishUri *url = NULL; - GtkTreeModel *model; - GtkTreeIter iter; - - selection = gtk_tree_view_get_selection ((GtkTreeView *) dialog_data->url_list); - if (gtk_tree_selection_get_selected (selection, &model, &iter)){ - gtk_tree_model_get (model, &iter, - URL_LIST_FREE_BUSY_URL_COLUMN, - &url, - -1); - - } - - if (url) { - dialog_data->url_editor = url_editor_dialog_new (dialog_data, url); - - gtk_list_store_set ((GtkListStore *) model, &iter, - URL_LIST_LOCATION_COLUMN, - g_strdup (url->location), - URL_LIST_ENABLED_COLUMN, - url->enabled, - URL_LIST_FREE_BUSY_URL_COLUMN, url, - -1); - - url_list_changed (dialog_data); - - if (!GTK_WIDGET_SENSITIVE ((GtkWidget *) dialog_data->url_remove)) { - selection = gtk_tree_view_get_selection ((GtkTreeView *) dialog_data->url_list); - gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter); - gtk_widget_set_sensitive ((GtkWidget*) dialog_data->url_remove, TRUE); - gtk_tree_selection_select_iter (selection, &iter); - } - dialog_data->url_editor = FALSE; - dialog_data->url_editor_dlg = NULL; - } - } else { - gdk_window_raise (dialog_data->url_editor_dlg->window); - } -} - -static void -cal_prefs_dialog_url_remove_clicked (GtkWidget *button, DialogData *dialog_data) -{ - EPublishUri *url = NULL; - GtkTreeSelection * selection; - GtkTreeModel *model; - GtkWidget *confirm; - GtkTreeIter iter; - int ans; - - selection = gtk_tree_view_get_selection (dialog_data->url_list); - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - gtk_tree_model_get (model, &iter, - URL_LIST_FREE_BUSY_URL_COLUMN, &url, - -1); - - /* make sure we have a valid account selected and that - we aren't editing anything... */ - if (url == NULL || dialog_data->url_editor) - return; - - confirm = gtk_message_dialog_new (PREFS_WINDOW (dialog_data), - GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, - _("Are you sure you want to remove this URL?")); - - button = gtk_button_new_from_stock (GTK_STOCK_YES); - gtk_button_set_label ((GtkButton *) button, _("Remove")); - gtk_dialog_add_action_widget ((GtkDialog *) confirm, (GtkWidget *) button, GTK_RESPONSE_YES); - gtk_widget_show ((GtkWidget *) button); - - button = gtk_button_new_from_stock (GTK_STOCK_NO); - gtk_button_set_label ((GtkButton *) button, _("Don't Remove")); - gtk_dialog_add_action_widget ((GtkDialog *) confirm, - (GtkWidget *) button, GTK_RESPONSE_NO); - - gtk_widget_show ((GtkWidget *) button); - - ans = gtk_dialog_run ((GtkDialog *) confirm); - gtk_widget_destroy (confirm); - - if (ans == GTK_RESPONSE_YES) { - int len; - - gtk_list_store_remove ((GtkListStore *) model, &iter); - - len = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL); - if (len > 0) { - gtk_tree_selection_select_iter (selection, &iter); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_edit), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_remove), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), FALSE); - } - g_free (url); - url_list_changed (dialog_data); - } -} - -static void -cal_prefs_dialog_url_enable_clicked (GtkWidget *button, DialogData *dialog_data) -{ - EPublishUri *url = NULL; - GtkTreeSelection * selection; - GtkTreeModel *model; - GtkTreeIter iter; - - selection = gtk_tree_view_get_selection (dialog_data->url_list); - if (gtk_tree_selection_get_selected (selection, &model, &iter)) { - gtk_tree_model_get (model, &iter, - URL_LIST_FREE_BUSY_URL_COLUMN, &url, - -1); - url->enabled = !url->enabled; - - gtk_tree_selection_select_iter (selection, &iter); - - gtk_list_store_set ((GtkListStore *) model, &iter, - URL_LIST_ENABLED_COLUMN, url->enabled, - -1); - - gtk_button_set_label ((GtkButton *) dialog_data->url_enable, - url->enabled ? _("Disable") : _("Enable")); - - url_list_changed (dialog_data); - } -} - -static void -cal_prefs_dialog_url_list_enable_toggled (GtkCellRendererToggle *renderer, - const char *path_string, - DialogData *dialog_data) -{ - GtkTreeSelection * selection; - EPublishUri *url = NULL; - GtkTreeModel *model; - GtkTreePath *path; - GtkTreeIter iter; - - path = gtk_tree_path_new_from_string (path_string); - model = gtk_tree_view_get_model (dialog_data->url_list); - selection = gtk_tree_view_get_selection (dialog_data->url_list); - - if (gtk_tree_model_get_iter (model, &iter, path)) { - gtk_tree_model_get (model, &iter, - URL_LIST_FREE_BUSY_URL_COLUMN, &url, - -1); - - url->enabled = !url->enabled; - gtk_list_store_set((GtkListStore *) model, &iter, - URL_LIST_ENABLED_COLUMN, - url->enabled, -1); - - if (gtk_tree_selection_iter_is_selected (selection, &iter)) - gtk_button_set_label ((GtkButton *) dialog_data->url_enable, - url->enabled ? _("Disable") : _("Enable")); - - url_list_changed (dialog_data); - } - - gtk_tree_path_free (path); -} - -static void -cal_prefs_dialog_url_list_double_click (GtkTreeView *treeview, - GtkTreePath *path, - GtkTreeViewColumn *column, - DialogData *dialog_data) -{ - cal_prefs_dialog_url_edit_clicked (NULL, dialog_data); -} - -static void -cal_prefs_dialog_url_list_change (GtkTreeSelection *selection, - DialogData *dialog_data) -{ - EPublishUri *url = NULL; - GtkTreeModel *model; - GtkTreeIter iter; - int state; - - state = gtk_tree_selection_get_selected (selection, &model, &iter); - if (state) { - gtk_tree_model_get (model, &iter, - URL_LIST_FREE_BUSY_URL_COLUMN, &url, - -1); - - if (url->location && url->enabled) - gtk_button_set_label ((GtkButton *) dialog_data->url_enable, _("Disable")); - else - gtk_button_set_label ((GtkButton *) dialog_data->url_enable, _("Enable")); - } else { - gtk_widget_grab_focus (GTK_WIDGET (dialog_data->url_add)); - } - - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_edit), state); - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_remove), state); - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), state); -} - -/* Shows the current Free/Busy settings in the dialog */ -static void -show_fb_config (DialogData *dialog_data) -{ - GSList *url_config_list = NULL; - GtkListStore *model; - GtkTreeIter iter; - - model = (GtkListStore *) gtk_tree_view_get_model (dialog_data->url_list); - gtk_list_store_clear (model); - - /* restore urls from gconf */ - url_config_list = calendar_config_get_free_busy(); - - if (!url_config_list) { - /* list is empty-disable edit, remove, and enable buttons */ - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_edit), - FALSE); - - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_remove), - FALSE); - - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), - FALSE); - } else { - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_edit), - TRUE); - - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_remove), - TRUE); - - gtk_widget_set_sensitive (GTK_WIDGET (dialog_data->url_enable), - TRUE); - } - - while (url_config_list) { - gchar *xml = (gchar *)url_config_list->data; - EPublishUri *url; - url = g_new0 (EPublishUri, 1); - - e_pub_uri_from_xml (url, xml); - if (url->location) { - gtk_list_store_append (model, &iter); - gtk_list_store_set (model, &iter, - URL_LIST_ENABLED_COLUMN, - url->enabled, - URL_LIST_LOCATION_COLUMN, - url->location, - URL_LIST_FREE_BUSY_URL_COLUMN, url, - -1); - } - - url_config_list = g_slist_next (url_config_list); - g_free (xml); - } - - g_slist_foreach (url_config_list, (GFunc) g_free, NULL); - g_slist_free (url_config_list); -} - -/* Shows the current task list settings in the dialog */ -static void -show_task_list_config (DialogData *dialog_data) -{ - CalUnits units; - gboolean hide_completed_tasks; - - set_color_picker (dialog_data->tasks_due_today_color, calendar_config_get_tasks_due_today_color ()); - set_color_picker (dialog_data->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 (dialog_data->tasks_hide_completed_checkbutton, - hide_completed_tasks); - - /* Hide Completed Tasks Units. */ - units = calendar_config_get_hide_completed_tasks_units (); - e_dialog_option_menu_set (dialog_data->tasks_hide_completed_optionmenu, - units, hide_completed_units_map); - - /* Hide Completed Tasks Value. */ - e_dialog_spin_set (dialog_data->tasks_hide_completed_spinbutton, - calendar_config_get_hide_completed_tasks_value ()); - - gtk_widget_set_sensitive (dialog_data->tasks_hide_completed_spinbutton, - hide_completed_tasks); - gtk_widget_set_sensitive (dialog_data->tasks_hide_completed_optionmenu, - hide_completed_tasks); -} - -/* Shows the current config settings in the dialog. */ -static void -show_config (DialogData *dialog_data) -{ - CalWeekdays working_days; - gint mask, day, week_start_day, time_divisions; - icaltimezone *zone; - gboolean sensitive; - - /* Timezone. */ - zone = calendar_config_get_icaltimezone (); - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (dialog_data->timezone), - zone); - - /* Working Days. */ - working_days = calendar_config_get_working_days (); - mask = 1 << 0; - for (day = 0; day < 7; day++) { - e_dialog_toggle_set (dialog_data->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 (dialog_data->week_start_day, week_start_day, - week_start_day_map); - - /* Start of Day. */ - e_date_edit_set_time_of_day (E_DATE_EDIT (dialog_data->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 (dialog_data->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 (dialog_data->use_24_hour, TRUE); - else - e_dialog_toggle_set (dialog_data->use_12_hour, TRUE); - - sensitive = calendar_config_locale_supports_12_hour_format (); - gtk_widget_set_sensitive (dialog_data->use_12_hour, sensitive); - gtk_widget_set_sensitive (dialog_data->use_24_hour, sensitive); - - - /* Time Divisions. */ - time_divisions = calendar_config_get_time_divisions (); - e_dialog_option_menu_set (dialog_data->time_divisions, time_divisions, - time_division_map); - - /* Show Appointment End Times. */ - e_dialog_toggle_set (dialog_data->show_end_times, calendar_config_get_show_event_end ()); - - /* Compress Weekend. */ - e_dialog_toggle_set (dialog_data->compress_weekend, calendar_config_get_compress_weekend ()); - - /* Date Navigator - Show Week Numbers. */ - e_dialog_toggle_set (dialog_data->dnav_show_week_no, calendar_config_get_dnav_show_week_no ()); - - /* Task list */ - - show_task_list_config (dialog_data); - - /* Free/Busy */ - show_fb_config (dialog_data); - - /* Other page */ - - e_dialog_toggle_set (dialog_data->confirm_delete, calendar_config_get_confirm_delete ()); - - e_dialog_toggle_set (dialog_data->default_reminder, - calendar_config_get_use_default_reminder ()); - e_dialog_spin_set (dialog_data->default_reminder_interval, - calendar_config_get_default_reminder_interval ()); - e_dialog_option_menu_set (dialog_data->default_reminder_units, - calendar_config_get_default_reminder_units (), - default_reminder_units_map); -} diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade deleted file mode 100644 index 02de705b30..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.glade +++ /dev/null @@ -1,1807 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="cal-prefs-dialog"> - <property name="title" translatable="yes">Calendar and Tasks Settings</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="has_separator">False</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="button1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button2"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-apply</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">0</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="button3"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-close</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">0</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkNotebook" id="toplevel-notebook"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_tabs">True</property> - <property name="show_border">True</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkVBox" id="vbox10"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label51"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Time</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox26"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label52"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table5"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">3</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="label" translatable="yes">Time _zone:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">timezone</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="label" translatable="yes">Time format:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox10"> - <property name="visible">True</property> - <property name="homogeneous">True</property> - <property name="spacing">4</property> - - <child> - <widget class="GtkAlignment" id="alignment2"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xscale">3.35276e-08</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkRadioButton" id="use_12_hour"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_12 hour (AM/PM)</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="use_24_hour"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_24 hour</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">use_12_hour</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="timezone"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="creation_function">make_timezone_entry</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Wed, 20 Jun 2001 02:22:46 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label49"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Work Week</b></property> - <property name="use_underline">True</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox25"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label50"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table8"> - <property name="visible">True</property> - <property name="n_rows">4</property> - <property name="n_columns">4</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox17"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="mon_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Mon</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="tue_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Tue</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="wed_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Wed</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="thu_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">T_hu</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="fri_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Fri</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="sat_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Sat</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="sun_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">S_un</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment3"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkOptionMenu" id="first_day_of_week"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget1"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Monday</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Tuesday</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget4"> - <property name="visible">True</property> - <property name="label" translatable="yes">Wednesday</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget5"> - <property name="visible">True</property> - <property name="label" translatable="yes">Thursday</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget6"> - <property name="visible">True</property> - <property name="label" translatable="yes">Friday</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget7"> - <property name="visible">True</property> - <property name="label" translatable="yes">Saturday</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget8"> - <property name="visible">True</property> - <property name="label" translatable="yes">Sunday</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label32"> - <property name="visible">True</property> - <property name="label" translatable="yes">W_eek starts:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">first_day_of_week</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label31"> - <property name="visible">True</property> - <property name="label" translatable="yes">Work days:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label34"> - <property name="visible">True</property> - <property name="label" translatable="yes">Day _ends:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_RIGHT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label33"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Day begins:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="start_of_day"> - <property name="visible">True</property> - <property name="creation_function">cal_prefs_dialog_create_time_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 30 May 2002 19:26:53 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="Custom" id="end_of_day"> - <property name="visible">True</property> - <property name="creation_function">cal_prefs_dialog_create_time_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 30 May 2002 19:27:35 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">4</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label53"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Alerts</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox27"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label54"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox13"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkCheckButton" id="confirm-delete"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Ask for confirmation when deleting items</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox19"> - <property name="border_width">3</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">3</property> - - <child> - <widget class="GtkCheckButton" id="default-reminder"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Sh_ow a reminder</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="default-reminder-interval"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">0 0 9999 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="alignment4"> - <property name="visible">True</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkOptionMenu" id="default-reminder-units"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget9"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget10"> - <property name="visible">True</property> - <property name="label" translatable="yes">Minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget11"> - <property name="visible">True</property> - <property name="label" translatable="yes">Hours</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget12"> - <property name="visible">True</property> - <property name="label" translatable="yes">Days</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label35"> - <property name="visible">True</property> - <property name="label" translatable="yes">before every appointment</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="label" translatable="yes">General</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox8"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label55"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>General</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox28"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label56"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox16"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox12"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label25"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Time divisions:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">time_divisions</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="time_divisions"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget13"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget14"> - <property name="visible">True</property> - <property name="label" translatable="yes">60 minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget15"> - <property name="visible">True</property> - <property name="label" translatable="yes">30 minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget16"> - <property name="visible">True</property> - <property name="label" translatable="yes">15 minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget17"> - <property name="visible">True</property> - <property name="label" translatable="yes">10 minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget18"> - <property name="visible">True</property> - <property name="label" translatable="yes">05 minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="show_end_times"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Show appointment end times in week and month views</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="compress_weekend"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Compress weekends in month view</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="dnav_show_week_no"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Show week _numbers in date navigator</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label57"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Task List</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox29"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label58"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox12"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkTable" id="table7"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label28"> - <property name="visible">True</property> - <property name="label" translatable="yes">T_asks due today:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">tasks_due_today_color</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label29"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Overdue tasks:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">tasks_overdue_color</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GnomeColorPicker" id="tasks_overdue_color"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="dither">True</property> - <property name="use_alpha">False</property> - <property name="title" translatable="yes">Color for overdue tasks</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GnomeColorPicker" id="tasks_due_today_color"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="dither">True</property> - <property name="use_alpha">False</property> - <property name="title" translatable="yes">Color for tasks due today</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox15"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="tasks-hide-completed-checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Hide completed tasks after</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="tasks-hide-completed-spinbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 0 9999 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="tasks-hide-completed-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget19"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget20"> - <property name="visible">True</property> - <property name="label" translatable="yes">Minutes</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget21"> - <property name="visible">True</property> - <property name="label" translatable="yes">Hours</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget22"> - <property name="visible">True</property> - <property name="label" translatable="yes">Days</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="label" translatable="yes">Display</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox20"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="url_list"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">True</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox15"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox3"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="url_add"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment5"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox22"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="labeladd"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Add URL</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkButton" id="url_edit"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment6"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox23"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="stock">gtk-properties</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label47"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Edit</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkButton" id="url_remove"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-remove</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="url_enable"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">E_nable</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox4"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">3</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label46"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label42"> - <property name="visible">True</property> - <property name="label" translatable="yes">Free/Busy Publishing</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h deleted file mode 100644 index 8905cb618b..0000000000 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ /dev/null @@ -1,100 +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/gtk.h> -#include <glade/glade.h> -#include <gconf/gconf.h> -#include <gconf/gconf-client.h> -#include "../e-pub-utils.h" -#include "evolution-config-control.h" - -G_BEGIN_DECLS - -enum { - URL_LIST_ENABLED_COLUMN, - URL_LIST_LOCATION_COLUMN, - URL_LIST_FREE_BUSY_URL_COLUMN, - URL_LIST_N_COLUMNS -}; - -struct _DialogData { - /* Glade XML data */ - GladeXML *xml; - - GConfClient *gconf; - - GtkWidget *page; - - 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; - - /* Widgets for the Free/Busy options */ - GtkWidget *url_add; - GtkWidget *url_edit; - GtkWidget *url_remove; - GtkWidget *url_enable; - GtkTreeView *url_list; - gboolean url_editor; - GtkWidget* url_editor_dlg; - guint destroyed : 1; - - - /* Other page options */ - GtkWidget *confirm_delete; - GtkWidget *default_reminder; - GtkWidget *default_reminder_interval; - GtkWidget *default_reminder_units; -}; -typedef struct _DialogData DialogData; - -EvolutionConfigControl *cal_prefs_dialog_new (void); - -G_END_DECLS - -#endif /* _CAL_PREFS_DIALOG_H_ */ diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c deleted file mode 100644 index 01b63b9c1d..0000000000 --- a/calendar/gui/dialogs/calendar-setup.c +++ /dev/null @@ -1,893 +0,0 @@ -/* Evolution calendar - Calendar properties dialogs - * - * Copyright (C) 2003 Novell, Inc. - * - * Author: Hans Petter Jansson <hpj@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 <bonobo/bonobo-i18n.h> -#include <gdk/gdkkeysyms.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkoptionmenu.h> -#include <libgnome/libgnome.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page.h> -#include <libgnomeui/gnome-color-picker.h> -#include <glade/glade.h> -#include <libedataserver/e-source-list.h> -#include <libecal/e-cal.h> -#include <e-util/e-dialog-utils.h> -#include <e-util/e-url.h> -#include <e-util/e-icon-factory.h> -#include "calendar-setup.h" - -#define GLADE_FILE_NAME "calendar-setup.glade" - -typedef struct -{ - GladeXML *gui_xml; - - /* Main widgets */ - GtkWidget *window; - GtkWidget *druid; - - /* Source selection */ - ESourceList *source_list; - GtkWidget *group_optionmenu; - - /* ESource we're currently editing (if any) */ - ESource *source; - - /* Source group we're creating/editing source in */ - ESourceGroup *source_group; - - /* General page fields */ - GtkWidget *name_entry; - GtkWidget *source_color; - - /* Location page fields */ - GtkWidget *uri_entry; - GtkWidget *refresh_spin; - - /* sensitive blocks */ - GtkWidget *uri_label; - GtkWidget *uri_hbox; - GtkWidget *refresh_label; - GtkWidget *refresh_hbox; - GtkWidget *refresh_optionmenu; - GtkWidget *add_button; -} -SourceDialog; - -static gchar * -print_uri_noproto (EUri *uri) -{ - gchar *uri_noproto; - - if (uri->port != 0) - uri_noproto = g_strdup_printf ( - "%s%s%s%s%s%s%s:%d%s%s%s", - uri->user ? uri->user : "", - uri->authmech ? ";auth=" : "", - uri->authmech ? uri->authmech : "", - uri->passwd ? ":" : "", - uri->passwd ? uri->passwd : "", - uri->user ? "@" : "", - uri->host ? uri->host : "", - uri->port, - uri->path ? uri->path : "", - uri->query ? "?" : "", - uri->query ? uri->query : ""); - else - uri_noproto = g_strdup_printf ( - "%s%s%s%s%s%s%s%s%s%s", - uri->user ? uri->user : "", - uri->authmech ? ";auth=" : "", - uri->authmech ? uri->authmech : "", - uri->passwd ? ":" : "", - uri->passwd ? uri->passwd : "", - uri->user ? "@" : "", - uri->host ? uri->host : "", - uri->path ? uri->path : "", - uri->query ? "?" : "", - uri->query ? uri->query : ""); - - return uri_noproto; -} - -static gboolean -source_group_is_remote (ESourceGroup *group) -{ - EUri *uri; - gboolean is_remote = FALSE; - - if (!group) - return FALSE; - - uri = e_uri_new (e_source_group_peek_base_uri (group)); - if (!uri) - return FALSE; - - if (uri->protocol && uri->protocol [0] && strcmp (uri->protocol, "file")) - is_remote = TRUE; - - e_uri_free (uri); - return is_remote; -} - -static gboolean -source_is_remote (ESource *source) -{ - gchar *uri_str; - EUri *uri; - gboolean is_remote = FALSE; - - uri_str = e_source_get_uri (source); - if (!uri_str) - return FALSE; - - uri = e_uri_new (uri_str); - g_free (uri_str); - - if (!uri) - return FALSE; - - if (uri->protocol && uri->protocol [0] && strcmp (uri->protocol, "file")) - is_remote = TRUE; - - e_uri_free (uri); - return is_remote; -} - -static gboolean -validate_remote_uri (const gchar *source_location, gboolean interactive, GtkWidget *parent) -{ - EUri *uri; - - if (!source_location || !strlen (source_location)) { - if (interactive) - e_notice (parent, GTK_MESSAGE_ERROR, - _("You must specify a location to get the calendar from.")); - return FALSE; - } - - uri = e_uri_new (source_location); - if (!uri) { - if (interactive) - e_notice (parent, GTK_MESSAGE_ERROR, - _("The source location '%s' is not well-formed."), - source_location); - return FALSE; - } - - /* Make sure we're in agreement with the protocol. Note that EUri sets it - * to 'file' if none was specified in the input URI. We don't want to - * silently translate an explicit file:// into http:// though. */ - if (uri->protocol && - strcmp (uri->protocol, "http") && - strcmp (uri->protocol, "webcal")) { - e_uri_free (uri); - - if (interactive) - e_notice (parent, GTK_MESSAGE_ERROR, - _("The source location '%s' is not a webcal source."), - source_location); - return FALSE; - } - - e_uri_free (uri); - return TRUE; -} - -static gboolean -source_group_is_mutable (ESourceGroup *source_group) -{ - gboolean mutable; - - if (!source_group) - return FALSE; - - mutable = !e_source_group_get_readonly (source_group); - - if (mutable) { - const char *uri = e_source_group_peek_base_uri (source_group); - - if (g_str_has_prefix (uri, "groupwise://") || g_str_has_prefix (uri, "exchange://")) - mutable = FALSE; - - } - - return mutable; -} - -static int -source_group_menu_add_groups (GtkMenuShell *menu_shell, SourceDialog *source_dialog) -{ - ESourceList *source_list = source_dialog->source_list; - GSList *groups, *sl; - int index=-1, i=0; - - - if (source_list == NULL) - return index; - - groups = e_source_list_peek_groups (source_list); - for (sl = groups; sl; sl = g_slist_next (sl)) { - GtkWidget *menu_item; - ESourceGroup *group = sl->data; - - menu_item = gtk_menu_item_new_with_label (e_source_group_peek_name (group)); - gtk_widget_show (menu_item); - - if (!source_group_is_mutable (group)) - gtk_widget_set_sensitive(menu_item, FALSE); - - if (source_dialog->source_group - && !strcmp (e_source_group_peek_uid (source_dialog->source_group), e_source_group_peek_uid (group))) - index = i; - - gtk_menu_shell_append (menu_shell, menu_item); - i++; - } - - if (!source_dialog->source_group && groups) { - source_dialog->source_group = groups->data; - return -1; - } - - return index; -} - -static ESource * -create_new_source_with_group (GtkWindow *parent, - ESourceGroup *group, - const char *source_name, - const char *source_location, - ECalSourceType source_type) -{ - ESource *source; - ECal *cal; - - if (e_source_group_peek_source_by_name (group, source_name)) { - e_notice (parent, GTK_MESSAGE_ERROR, - _("Source with name '%s' already exists in the selected group"), - source_name); - return NULL; - } - - if (source_group_is_remote (group)) { - EUri *uri; - gchar *relative_uri; - - /* Remote source */ - - if (!source_location || !strlen (source_location)) { - e_notice (parent, GTK_MESSAGE_ERROR, - _("The group '%s' is remote. You must specify a location " - "to get the calendar from"), - e_source_group_peek_name (group)); - return NULL; - } - - if (!validate_remote_uri (source_location, TRUE, GTK_WIDGET (parent))) - return NULL; - - /* Our relative_uri is everything but protocol, which is supplied by parent group */ - uri = e_uri_new (source_location); - relative_uri = print_uri_noproto (uri); - e_uri_free (uri); - - /* Create source */ - source = e_source_new (source_name, relative_uri); - - g_free (relative_uri); - } else { - /* Local source */ - source = e_source_new (source_name, source_name); - e_source_set_relative_uri (source, e_source_peek_uid (source)); - } - - e_source_group_add_source (group, source, -1); - - /* create the calendar in the backend */ - cal = e_cal_new (source, source_type); - if (!e_cal_open (cal, FALSE, NULL)) { - e_source_group_remove_source (group, source); - g_object_unref (source); - source = NULL; - } - - g_object_unref (cal); - - return source; -} - -static void -source_dialog_destroy (SourceDialog *source_dialog) -{ - g_object_unref (source_dialog->gui_xml); - - if (source_dialog->source) - g_object_unref (source_dialog->source); - - g_free (source_dialog); -} - -static gboolean -remote_page_verify (SourceDialog *source_dialog) -{ - const gchar *uri; - - uri = gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry)); - if (!uri || !uri [0]) - return FALSE; - - if (!validate_remote_uri (uri, FALSE, NULL)) - return FALSE; - - return TRUE; -} - -static void -general_entry_modified (SourceDialog *source_dialog) -{ - const char *text = gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)); - gboolean sensitive = text && *text != '\0'; - - sensitive = sensitive && (source_dialog->source_group != NULL); - - if (source_group_is_remote (source_dialog->source_group) && source_group_is_mutable (source_dialog->source_group)) { - sensitive = sensitive && remote_page_verify (source_dialog); - } - - gtk_widget_set_sensitive (source_dialog->add_button, sensitive); -} - -static void -general_update_dialog (SourceDialog *source_dialog) -{ - gboolean remote = FALSE; - gboolean mutable = source_group_is_mutable (source_dialog->source_group); - - if (source_dialog->source && e_source_get_readonly (source_dialog->source)) - gtk_widget_set_sensitive (glade_xml_get_widget (source_dialog->gui_xml, "settings-table"), FALSE); - - /* These are calendar specific so make sure we have them */ - if (source_dialog->uri_entry) - g_signal_handlers_block_matched (source_dialog->uri_entry, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); - - remote = (source_dialog->source && source_is_remote (source_dialog->source)) - || source_group_is_remote (source_dialog->source_group); - - - if (!remote) { - if (source_dialog->uri_entry) - gtk_entry_set_text (GTK_ENTRY (source_dialog->uri_entry), ""); - if (source_dialog->refresh_spin) - gtk_spin_button_set_value (GTK_SPIN_BUTTON (source_dialog->refresh_spin), 30); - } - - general_entry_modified (source_dialog); - - if (source_dialog->uri_hbox) - gtk_widget_set_sensitive (source_dialog->uri_hbox, remote && mutable); - if (source_dialog->uri_label) - gtk_widget_set_sensitive (source_dialog->uri_label, remote && mutable); - if (source_dialog->refresh_label) - gtk_widget_set_sensitive (source_dialog->refresh_label, remote && mutable); - if (source_dialog->refresh_hbox) - gtk_widget_set_sensitive (source_dialog->refresh_hbox, remote && mutable); - - if (source_dialog->uri_entry) - g_signal_handlers_unblock_matched (source_dialog->uri_entry, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); -} - -static void -colorpicker_set_color (GnomeColorPicker *color, guint32 rgb) -{ - gnome_color_picker_set_i8 (color, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff); -} - -static guint32 -colorpicker_get_color (GnomeColorPicker *color) -{ - guint8 r, g, b, a; - guint32 rgb = 0; - - gnome_color_picker_get_i8 (color, &r, &g, &b, &a); - - rgb = r; - rgb <<= 8; - rgb |= g; - rgb <<= 8; - rgb |= b; - - return rgb; -} - -static char * -get_refresh_minutes (SourceDialog *source_dialog) -{ - int setting = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (source_dialog->refresh_spin)); - - if (source_dialog->refresh_optionmenu) - switch (gtk_option_menu_get_history (GTK_OPTION_MENU (source_dialog->refresh_optionmenu))){ - case 0: /* minutes */ - break; - case 1: /* hours */ - setting *= 60; - break; - case 2: /* days */ - setting *= 1440; - break; - case 3: /* weeks wtf? why so long */ - setting *= 10080; - break; - default: - g_warning ("Time unit out of range"); - break; - } - - return g_strdup_printf ("%d", setting); -} - -static void -set_refresh_time (SourceDialog *source_dialog) { - int time; - int item_num = 0; - - const char *refresh_str = e_source_get_property (source_dialog->source, "refresh"); - time = refresh_str ? atoi (refresh_str) : 30; - - if (source_dialog->refresh_optionmenu) { - if (time && !(time % 10080)) { - /* weeks */ - item_num = 3; - time /= 10080; - } else if (time && !(time % 1440)) { - /* days */ - item_num = 2; - time /= 1440; - } else if (time && !(time % 60)) { - /* days */ - item_num = 1; - time /= 60; - } - - gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->refresh_optionmenu), item_num); - } - - gtk_spin_button_set_value (GTK_SPIN_BUTTON (source_dialog->refresh_spin), time); - return; -} - -static void -source_to_dialog (SourceDialog *source_dialog) -{ - ESource *source = source_dialog->source; - gboolean remote = FALSE; - - g_signal_handlers_block_matched (source_dialog->name_entry, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); - - /* These are calendar specific so make sure we have them */ - if (source_dialog->uri_entry) - g_signal_handlers_block_matched (source_dialog->uri_entry, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); - if (source_dialog->refresh_spin) - g_signal_handlers_block_matched (source_dialog->refresh_spin, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); - - gtk_entry_set_text (GTK_ENTRY (source_dialog->name_entry), source ? e_source_peek_name (source) : ""); - - if (source && source_is_remote (source)) { - gchar *uri_str; - - remote = TRUE; - - uri_str = e_source_get_uri (source); - gtk_entry_set_text (GTK_ENTRY (source_dialog->uri_entry), uri_str); - g_free (uri_str); - - set_refresh_time (source_dialog); - } else { - if (source_dialog->uri_entry) - gtk_entry_set_text (GTK_ENTRY (source_dialog->uri_entry), ""); - if (source_dialog->refresh_spin) - gtk_spin_button_set_value (GTK_SPIN_BUTTON (source_dialog->refresh_spin), 30); - } - - general_update_dialog (source_dialog); - - g_signal_handlers_unblock_matched (source_dialog->name_entry, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); - if (source_dialog->uri_entry) - g_signal_handlers_unblock_matched (source_dialog->uri_entry, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); - if (source_dialog->refresh_spin) - g_signal_handlers_unblock_matched (source_dialog->refresh_spin, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, source_dialog); - if (source_dialog->source_color) { - static guint32 assigned_colors[] = { - 0xBECEDD, /* 190 206 221 Blue */ - 0xE2F0EF, /* 226 240 239 Light Blue */ - 0xC6E2B7, /* 198 226 183 Green */ - 0xE2F0D3, /* 226 240 211 Light Green */ - 0xE2D4B7, /* 226 212 183 Khaki */ - 0xEAEAC1, /* 234 234 193 Light Khaki */ - 0xF0B8B7, /* 240 184 183 Pink */ - 0xFED4D3, /* 254 212 211 Light Pink */ - 0xE2C6E1, /* 226 198 225 Purple */ - 0xF0E2EF /* 240 226 239 Light Purple */ - }; - GRand *rand = g_rand_new (); - guint32 color; - - color = assigned_colors[g_rand_int_range (rand, 0, 9)]; - g_rand_free (rand); - - if (source_dialog->source) - e_source_get_color (source_dialog->source, &color); - else - /* FIXME */; - - colorpicker_set_color (GNOME_COLOR_PICKER (source_dialog->source_color), color); - } -} - -static void -dialog_to_source (SourceDialog *source_dialog) -{ - ESource *source = source_dialog->source; - - g_return_if_fail (source != NULL); - - e_source_set_name (source, gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry))); - if (source_is_remote (source)) { - EUri *uri; - gchar *relative_uri; - gchar *refresh_str; - - /* Our relative_uri is everything but protocol, which is supplied by parent group */ - uri = e_uri_new (gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry))); - if (!uri) { - g_warning ("Invalid remote URI!"); - return; - } - - relative_uri = print_uri_noproto (uri); - e_source_set_relative_uri (source, relative_uri); - g_free (relative_uri); - e_uri_free (uri); - - refresh_str = get_refresh_minutes (source_dialog); - e_source_set_property (source, "refresh", refresh_str); - g_free (refresh_str); - } - - if (source_dialog->source_color) - e_source_set_color (source, - colorpicker_get_color (GNOME_COLOR_PICKER (source_dialog->source_color))); -} - -static void -dialog_hide_unused_options (SourceDialog *source_dialog) -{ - ESource *source = source_dialog->source; - - if (source && (!source_is_remote (source) || !source_group_is_mutable (source_dialog->source_group))) { - if (source_dialog->uri_hbox) - gtk_widget_hide (source_dialog->uri_hbox); - if (source_dialog->uri_label) - gtk_widget_hide (source_dialog->uri_label); - if (source_dialog->refresh_label) - gtk_widget_hide (source_dialog->refresh_label); - if (source_dialog->refresh_hbox) - gtk_widget_hide (source_dialog->refresh_hbox); - } -} - -static void -source_group_changed_sensitive (SourceDialog *source_dialog) -{ - source_dialog->source_group = - g_slist_nth (e_source_list_peek_groups (source_dialog->source_list), - gtk_option_menu_get_history (GTK_OPTION_MENU (source_dialog->group_optionmenu)))->data; - - general_update_dialog (source_dialog); -} - -static gboolean -key_press_event (GtkWidget *widget, GdkEventKey *event) -{ - if (event->keyval == GDK_Escape) { - gtk_widget_destroy (widget); - return TRUE; - } - - return FALSE; -} - -static void -new_calendar_cancel (SourceDialog *source_dialog) -{ - gtk_widget_destroy (source_dialog->window); -} - -static void -new_calendar_add (SourceDialog *source_dialog) -{ - source_dialog->source = - create_new_source_with_group (GTK_WINDOW (source_dialog->window), source_dialog->source_group, - gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)), - gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry)), - E_CAL_SOURCE_TYPE_EVENT); - dialog_to_source (source_dialog); - - gtk_widget_destroy (source_dialog->window); -} - -static void -edit_calendar_finish (SourceDialog *source_dialog) -{ - dialog_to_source (source_dialog); - gtk_widget_destroy (source_dialog->window); -} - -gboolean -calendar_setup_edit_calendar (GtkWindow *parent, ESource *source) -{ - SourceDialog *source_dialog = g_new0 (SourceDialog, 1); - int index; - GList *icon_list; - - source_dialog->gui_xml = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "add-calendar-window", NULL); - if (!source_dialog->gui_xml) { - g_warning (G_STRLOC ": Cannot load Glade file."); - g_free (source_dialog); - return FALSE; - } - - source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "add-calendar-window"); - if (source) { - gtk_window_set_title (GTK_WINDOW (source_dialog->window), "Calendar Properties"); - source_dialog->source = source; - source_dialog->source_group = e_source_peek_group (source); - g_object_ref (source); - } - - g_signal_connect (source_dialog->window, "key-press-event", G_CALLBACK (key_press_event), NULL); - - source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); - g_signal_connect_swapped (source_dialog->name_entry, "changed", - G_CALLBACK (general_entry_modified), source_dialog); - source_dialog->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/calendar/sources"); - - source_dialog->group_optionmenu = - glade_xml_get_widget (source_dialog->gui_xml, "group-optionmenu"); - if (!GTK_IS_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu)))) { - GtkWidget *menu = gtk_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu), menu); - gtk_widget_show (menu); - } - gtk_widget_set_sensitive (source_dialog->group_optionmenu, source == NULL); - - /* NOTE: This assumes that we have sources. If they don't exist, they're set up - * on startup of the calendar component. */ - index = source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu ( - GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog); - gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index); - - g_signal_connect_swapped (source_dialog->group_optionmenu, "changed", - G_CALLBACK (source_group_changed_sensitive), source_dialog); - source_dialog->uri_entry = glade_xml_get_widget (source_dialog->gui_xml, "uri-entry"); - source_dialog->uri_label = glade_xml_get_widget (source_dialog->gui_xml, "uri-label"); - source_dialog->uri_hbox = glade_xml_get_widget (source_dialog->gui_xml, "uri-hbox"); - - g_signal_connect_swapped (source_dialog->uri_entry, "changed", - G_CALLBACK (general_entry_modified), source_dialog); - - source_dialog->refresh_spin = glade_xml_get_widget (source_dialog->gui_xml, "refresh-spin"); - source_dialog->refresh_optionmenu = glade_xml_get_widget (source_dialog->gui_xml, "refresh-optionmenu"); - source_dialog->refresh_label = glade_xml_get_widget (source_dialog->gui_xml, "refresh-label"); - source_dialog->refresh_hbox = glade_xml_get_widget (source_dialog->gui_xml, "refresh-hbox"); - - g_signal_connect_swapped (glade_xml_get_widget (source_dialog->gui_xml, "cancel-button"), "clicked", - G_CALLBACK (new_calendar_cancel), source_dialog); - - source_dialog->add_button = glade_xml_get_widget (source_dialog->gui_xml, "add-button"); - gtk_widget_set_sensitive (source_dialog->add_button, FALSE); - - if (source) { - gtk_button_set_use_stock (GTK_BUTTON (source_dialog->add_button), TRUE); - gtk_button_set_label (GTK_BUTTON (source_dialog->add_button), GTK_STOCK_OK); - - g_signal_connect_swapped (source_dialog->add_button, "clicked", - G_CALLBACK (edit_calendar_finish), source_dialog); - } else { - g_signal_connect_swapped (source_dialog->add_button, "clicked", - G_CALLBACK (new_calendar_add), source_dialog); - } - - source_dialog->source_color = glade_xml_get_widget (source_dialog->gui_xml, "source-color"); - - g_object_weak_ref (G_OBJECT (source_dialog->window), - (GWeakNotify) source_dialog_destroy, source_dialog); - - source_to_dialog (source_dialog); - - gtk_window_set_type_hint (GTK_WINDOW (source_dialog->window), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_modal (GTK_WINDOW (source_dialog->window), TRUE); - - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (source_dialog->window), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - dialog_hide_unused_options (source_dialog); - gtk_widget_show (source_dialog->window); - return TRUE; -} - -static void -new_task_list_cancel (SourceDialog *source_dialog) -{ - gtk_widget_destroy (source_dialog->window); -} - -static void -new_task_list_add (SourceDialog *source_dialog) -{ - source_dialog->source = - create_new_source_with_group (GTK_WINDOW (source_dialog->window), source_dialog->source_group, - gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)), - gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry)), - E_CAL_SOURCE_TYPE_TODO); - dialog_to_source (source_dialog); - - gtk_widget_destroy (source_dialog->window); -} - -gboolean -calendar_setup_new_calendar (GtkWindow *parent) -{ - return calendar_setup_edit_calendar (parent, NULL); -} - -static void -edit_task_list_finish (SourceDialog *source_dialog) -{ - dialog_to_source (source_dialog); - gtk_widget_destroy (source_dialog->window); -} - -gboolean -calendar_setup_edit_task_list (GtkWindow *parent, ESource *source) -{ - SourceDialog *source_dialog = g_new0 (SourceDialog, 1); - int index; - GList *icon_list; - - source_dialog->gui_xml = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "add-task-list-window", NULL); - if (!source_dialog->gui_xml) { - g_warning (G_STRLOC ": Cannot load Glade file."); - g_free (source_dialog); - return FALSE; - } - - source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "add-task-list-window"); - if (source) { - gtk_window_set_title (GTK_WINDOW (source_dialog->window), "Task List Properties"); - source_dialog->source = source; - source_dialog->source_group = e_source_peek_group (source); - g_object_ref (source); - } - - g_signal_connect (source_dialog->window, "key-press-event", G_CALLBACK (key_press_event), NULL); - - source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); - g_signal_connect_swapped (source_dialog->name_entry, "changed", - G_CALLBACK (general_entry_modified), source_dialog); - source_dialog->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/tasks/sources"); - - source_dialog->group_optionmenu = - glade_xml_get_widget (source_dialog->gui_xml, "group-optionmenu"); - if (!GTK_IS_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu)))) { - GtkWidget *menu = gtk_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu), menu); - gtk_widget_show (menu); - } - gtk_widget_set_sensitive (source_dialog->group_optionmenu, source == NULL); - - /* NOTE: This assumes that we have sources. If they don't exist, they're set up - * on startup of the calendar component. */ - index = source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu ( - GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog); - gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index); - - g_signal_connect_swapped (source_dialog->group_optionmenu, "changed", - G_CALLBACK (source_group_changed_sensitive), source_dialog); - - source_dialog->uri_entry = glade_xml_get_widget (source_dialog->gui_xml, "uri-entry"); - source_dialog->uri_label = glade_xml_get_widget (source_dialog->gui_xml, "uri-label"); - source_dialog->uri_hbox = glade_xml_get_widget (source_dialog->gui_xml, "uri-hbox"); - - g_signal_connect_swapped (source_dialog->uri_entry, "changed", - G_CALLBACK (general_entry_modified), source_dialog); - - source_dialog->refresh_spin = glade_xml_get_widget (source_dialog->gui_xml, "refresh-spin"); - source_dialog->refresh_optionmenu = glade_xml_get_widget (source_dialog->gui_xml, "refresh-optionmenu"); - source_dialog->refresh_label = glade_xml_get_widget (source_dialog->gui_xml, "refresh-label"); - source_dialog->refresh_hbox = glade_xml_get_widget (source_dialog->gui_xml, "refresh-hbox"); - - g_signal_connect_swapped (glade_xml_get_widget (source_dialog->gui_xml, "cancel-button"), "clicked", - G_CALLBACK (new_task_list_cancel), source_dialog); - - source_dialog->add_button = glade_xml_get_widget (source_dialog->gui_xml, "add-button"); - gtk_widget_set_sensitive (source_dialog->add_button, FALSE); - - if (source) { - gtk_button_set_use_stock (GTK_BUTTON (source_dialog->add_button), TRUE); - gtk_button_set_label (GTK_BUTTON (source_dialog->add_button), GTK_STOCK_OK); - - g_signal_connect_swapped (source_dialog->add_button, "clicked", - G_CALLBACK (edit_task_list_finish), source_dialog); - } else { - g_signal_connect_swapped (source_dialog->add_button, "clicked", - G_CALLBACK (new_task_list_add), source_dialog); - } - - g_object_weak_ref (G_OBJECT (source_dialog->window), - (GWeakNotify) source_dialog_destroy, source_dialog); - - source_dialog->source_color = glade_xml_get_widget (source_dialog->gui_xml, "source-color"); - - source_to_dialog (source_dialog); - - gtk_window_set_type_hint (GTK_WINDOW (source_dialog->window), GDK_WINDOW_TYPE_HINT_DIALOG); - gtk_window_set_modal (GTK_WINDOW (source_dialog->window), TRUE); - - icon_list = e_icon_factory_get_icon_list ("stock_task"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (source_dialog->window), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - dialog_hide_unused_options (source_dialog); - gtk_widget_show (source_dialog->window); - return TRUE; -} - -gboolean -calendar_setup_new_task_list (GtkWindow *parent) -{ - return calendar_setup_edit_task_list (parent, NULL); -} - diff --git a/calendar/gui/dialogs/calendar-setup.glade b/calendar/gui/dialogs/calendar-setup.glade deleted file mode 100644 index 4a59f20b72..0000000000 --- a/calendar/gui/dialogs/calendar-setup.glade +++ /dev/null @@ -1,922 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkWindow" id="add-calendar-window"> - <property name="title" translatable="yes">Add Calendar</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="default_width">320</property> - <property name="default_height">240</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkTable" id="settings-table"> - <property name="visible">True</property> - <property name="n_rows">5</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkEntry" id="name-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="uri-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_URL:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="refresh-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Refresh:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="refresh-hbox"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox2"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkSpinButton" id="refresh-spin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">30 0 100 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="refresh-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child> - <widget class="GtkMenu" id="menu3"> - - <child> - <widget class="GtkMenuItem" id="minutes1"> - <property name="visible">True</property> - <property name="label" translatable="yes">minutes</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_minutes1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="hours1"> - <property name="visible">True</property> - <property name="label" translatable="yes">hours</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_hours1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="days1"> - <property name="visible">True</property> - <property name="label" translatable="yes">days</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_days1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="weeks1"> - <property name="visible">True</property> - <property name="label" translatable="yes">weeks</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_weeks1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label35"> - <property name="visible">True</property> - <property name="label" translatable="yes">C_olor:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">source-color</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="uri-hbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkEntry" id="uri-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="group-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">-1</property> - - <child> - <widget class="GtkMenu" id="menu1"> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="group-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Type:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">group-optionmenu</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="name-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Name:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">name-entry</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GnomeColorPicker" id="source-color"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="dither">True</property> - <property name="use_alpha">False</property> - <property name="title" translatable="yes">Pick a color</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">10</property> - - <child> - <widget class="GtkButton" id="cancel-button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="add-button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Add Calendar</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="add-task-list-window"> - <property name="title" translatable="yes">Add Task List</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="default_width">320</property> - <property name="default_height">240</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="vbox87"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkTable" id="settings-table"> - <property name="visible">True</property> - <property name="n_rows">5</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkEntry" id="name-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="uri-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_URL:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="refresh-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Refresh:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label593"> - <property name="visible">True</property> - <property name="label" translatable="yes">C_olor:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">source-color</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GnomeColorPicker" id="source-color"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="dither">True</property> - <property name="use_alpha">False</property> - <property name="title" translatable="yes">Pick a color</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="uri-hbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkEntry" id="uri-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="group-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">-1</property> - - <child> - <widget class="GtkMenu" id="menu5"> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label594"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Type:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">group-optionmenu</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label595"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Name:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">name-entry</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="refresh-hbox"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox130"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkSpinButton" id="refresh-spin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">False</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">30 0 100 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="refresh-optionmenu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child> - <widget class="GtkMenu" id="menu6"> - - <child> - <widget class="GtkMenuItem" id="menuitem7"> - <property name="visible">True</property> - <property name="label" translatable="yes">minutes</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_minutes1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="menuitem8"> - <property name="visible">True</property> - <property name="label" translatable="yes">hours</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_hours1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="menuitem9"> - <property name="visible">True</property> - <property name="label" translatable="yes">days</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_days1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="menuitem10"> - <property name="visible">True</property> - <property name="label" translatable="yes">weeks</property> - <property name="use_underline">True</property> - <signal name="activate" handler="on_weeks1_activate" last_modification_time="Tue, 17 Feb 2004 17:39:35 GMT"/> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox22"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">10</property> - - <child> - <widget class="GtkButton" id="cancel-button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="add-button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment48"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox129"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image12"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="add-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Add Group</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/calendar-setup.h b/calendar/gui/dialogs/calendar-setup.h deleted file mode 100644 index c60afdf0e5..0000000000 --- a/calendar/gui/dialogs/calendar-setup.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Evolution calendar - Calendar properties dialogs. - * - * Copyright (C) 2004 Novell, Inc. - * - * Author: Hans Petter Jansson <hpj@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 CALENDAR_CONFIG_H -#define CALENDAR_CONFIG_H - -#include <gtk/gtkwindow.h> - -gboolean calendar_setup_new_calendar (GtkWindow *parent); -gboolean calendar_setup_edit_calendar (GtkWindow *parent, ESource *source); - -gboolean calendar_setup_new_task_list (GtkWindow *parent); -gboolean calendar_setup_edit_task_list (GtkWindow *parent, ESource *source); - -#endif diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c deleted file mode 100644 index eedd7ce49c..0000000000 --- a/calendar/gui/dialogs/cancel-comp.c +++ /dev/null @@ -1,85 +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 <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-uidefs.h> -#include <e-util/e-icon-factory.h> -#include "widgets/misc/e-error.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 (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean deleting) -{ - ECalComponentVType vtype; - const char *id; - - if (deleting && e_cal_get_save_schedules (client)) - return TRUE; - - vtype = e_cal_component_get_vtype (comp); - - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - if (deleting) - id = "calendar:prompt-cancel-meeting"; - else - id = "calendar:prompt-delete-meeting"; - break; - - case E_CAL_COMPONENT_TODO: - if (deleting) - id = "calendar:prompt-cancel-task"; - else - id = "calendar:prompt-delete-task"; - break; - - case E_CAL_COMPONENT_JOURNAL: - if (deleting) - id = "calendar:prompt-cancel-journal"; - else - id = "calendar:prompt-delete-journal"; - break; - - default: - g_message (G_STRLOC ": Cannot handle object of type %d", vtype); - return FALSE; - } - - if (e_error_run (parent, id, NULL) == GTK_RESPONSE_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 a43f24f2fe..0000000000 --- a/calendar/gui/dialogs/cancel-comp.h +++ /dev/null @@ -1,30 +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 <libecal/e-cal.h> -#include <libecal/e-cal-component.h> - -gboolean cancel_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean deleting); - -#endif diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c deleted file mode 100644 index a76b123b36..0000000000 --- a/calendar/gui/dialogs/changed-comp.c +++ /dev/null @@ -1,124 +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 <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-uidefs.h> -#include <e-util/e-icon-factory.h> -#include "changed-comp.h" - - - -/** - * changed_component_dialog: - * @parent: Parent window for the 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 (GtkWindow *parent, ECalComponent *comp, gboolean deleted, gboolean changed) -{ - GtkWidget *dialog; - ECalComponentVType vtype; - char *str; - gint response; - GList *icon_list; - - vtype = e_cal_component_get_vtype (comp); - - if (deleted) { - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - str = _("This event has been deleted."); - break; - - case E_CAL_COMPONENT_TODO: - str = _("This task has been deleted."); - break; - - case E_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 E_CAL_COMPONENT_EVENT: - str = _("This event has been changed."); - break; - - case E_CAL_COMPONENT_TODO: - str = _("This task has been changed."); - break; - - case E_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 = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, str); - - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - response = gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - - if (response == GTK_RESPONSE_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 f029f3388e..0000000000 --- a/calendar/gui/dialogs/changed-comp.h +++ /dev/null @@ -1,30 +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 <gtk/gtkwindow.h> -#include <libecal/e-cal-component.h> - -gboolean changed_component_dialog (GtkWindow *window, ECalComponent *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 2d656060e7..0000000000 --- a/calendar/gui/dialogs/comp-editor-page.c +++ /dev/null @@ -1,471 +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 <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.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, - NEEDS_SEND, - SUMMARY_CHANGED, - DATES_CHANGED, - CLIENT_CHANGED, - LAST_SIGNAL -}; - -static guint comp_editor_page_signals[LAST_SIGNAL]; - -#define CLASS(page) (COMP_EDITOR_PAGE_CLASS (G_OBJECT_GET_CLASS (page))) - - - -/** - * 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 = g_type_class_ref(GTK_TYPE_OBJECT); - - comp_editor_page_signals[CHANGED] = - g_signal_new ("changed", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CompEditorPageClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - comp_editor_page_signals[NEEDS_SEND] = - g_signal_new ("needs_send", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CompEditorPageClass, needs_send), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - comp_editor_page_signals[SUMMARY_CHANGED] = - g_signal_new ("summary_changed", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CompEditorPageClass, summary_changed), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - comp_editor_page_signals[DATES_CHANGED] = - g_signal_new ("dates_changed", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CompEditorPageClass, dates_changed), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - comp_editor_page_signals[CLIENT_CHANGED] = - g_signal_new ("client_changed", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CompEditorPageClass, client_changed), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, G_TYPE_OBJECT); - - 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->fill_timezones = 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) { - g_object_unref (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. - **/ -gboolean -comp_editor_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) -{ - g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE); - g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE); - - g_assert (CLASS (page)->fill_widgets != NULL); - return (* 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, ECalComponent *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_fill_timezones: - * @page: An editor page. - * @timezones: Hash table to which timezones will be added. - * - * Fills the given hash table with all the timezones used by the dates in the - * specific editor page. - * - * Returns: TRUE if the timezones were added, FALSE otherwise. - */ -gboolean -comp_editor_page_fill_timezones (CompEditorPage *page, GHashTable *timezones) -{ - g_return_val_if_fail (IS_COMP_EDITOR_PAGE (page), FALSE); - g_return_val_if_fail (timezones != NULL, FALSE); - - if (CLASS (page)->fill_timezones != NULL) - return (* CLASS (page)->fill_timezones) (page, timezones); - - return TRUE; -} - -/** - * comp_editor_page_set_e_cal: - * @page: An editor page - * @client: A #ECal object - * - * Sets the #ECal for the dialog page to use. - **/ -void -comp_editor_page_set_e_cal (CompEditorPage *page, ECal *client) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - if (client == page->client) - return; - - if (page->client) - g_object_unref (page->client); - - page->client = client; - if (page->client) - g_object_ref (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_needs_send: - * @page: - * - * - **/ -void -comp_editor_page_notify_needs_send (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[NEEDS_SEND]); -} - -/** - * 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); -} - -/** - * comp_editor_page_notify_client_changed: - * @page: An editor page. - * - * Makes an editor page emit the "client_changed" signal. This is meant to be - * used only by page implementations. - **/ -void -comp_editor_page_notify_client_changed (CompEditorPage *page, - ECal *client) -{ - g_return_if_fail (page != NULL); - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - - comp_editor_page_set_e_cal (page, client); - gtk_signal_emit (GTK_OBJECT (page), - comp_editor_page_signals[CLIENT_CHANGED], - client); -} - -/** - * comp_editor_page_display_validation_error: - * @page: An editor page. - * @msg: Error message to display. - * @field: Widget that caused the validation error. - * - * Displays an error message about a validation problem in the - * given field. Once the error message has been displayed, the - * focus is set to the widget that caused the validation error. - */ -void -comp_editor_page_display_validation_error (CompEditorPage *page, - const char *msg, - GtkWidget *field) -{ - GtkWidget *dialog; - char *real_msg; - - g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); - g_return_if_fail (msg != NULL); - g_return_if_fail (GTK_IS_WIDGET (field)); - - real_msg = g_strdup_printf (_("Validation error: %s"), msg); - dialog = gnome_error_dialog (real_msg); - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - gtk_widget_grab_focus (field); - - g_free (real_msg); -} diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h deleted file mode 100644 index 2b3c6c60ab..0000000000 --- a/calendar/gui/dialogs/comp-editor-page.h +++ /dev/null @@ -1,118 +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 <gtk/gtkwidget.h> -#include <libecal/e-cal-component.h> -#include <libecal/e-cal.h> - -G_BEGIN_DECLS - - - -#define TYPE_COMP_EDITOR_PAGE (comp_editor_page_get_type ()) -#define COMP_EDITOR_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMP_EDITOR_PAGE, CompEditorPage)) -#define COMP_EDITOR_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMP_EDITOR_PAGE, CompEditorPageClass)) -#define IS_COMP_EDITOR_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMP_EDITOR_PAGE)) -#define IS_COMP_EDITOR_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TYPE_COMP_EDITOR_PAGE)) - -typedef struct { - ECalComponentDateTime *start; - ECalComponentDateTime *end; - ECalComponentDateTime *due; - struct icaltimetype *complete; -} CompEditorPageDates; - -typedef struct { - GtkObject object; - - /* Some of the pages need the ECal to access timezone data. Also, - * the event page needs to know it to fill the source option menu. */ - ECal *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); - void (* client_changed) (CompEditorPage *page, ECal *client); - - /* Virtual methods */ - - GtkWidget *(* get_widget) (CompEditorPage *page); - void (* focus_main_widget) (CompEditorPage *page); - - gboolean (* fill_widgets) (CompEditorPage *page, ECalComponent *comp); - gboolean (* fill_component) (CompEditorPage *page, ECalComponent *comp); - gboolean (* fill_timezones) (CompEditorPage *page, GHashTable *timezones); - - 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); -gboolean comp_editor_page_fill_widgets (CompEditorPage *page, - ECalComponent *comp); -gboolean comp_editor_page_fill_component (CompEditorPage *page, - ECalComponent *comp); -gboolean comp_editor_page_fill_timezones (CompEditorPage *page, - GHashTable *timezones); -void comp_editor_page_set_e_cal (CompEditorPage *page, - ECal *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_needs_send (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); -void comp_editor_page_notify_client_changed (CompEditorPage *page, - ECal *client); -void comp_editor_page_display_validation_error (CompEditorPage *page, - const char *msg, - GtkWidget *field); - - - - -G_END_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 2383f760e0..0000000000 --- a/calendar/gui/dialogs/comp-editor-util.c +++ /dev/null @@ -1,349 +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 <libical/ical.h> -#include <glib.h> -#include <gtk/gtklabel.h> -#include <libgnome/gnome-i18n.h> -#include <bonobo-activation/bonobo-activation.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-widget.h> -#include <e-util/e-time-utils.h> -#include <libecal/e-cal-time-util.h> -#include "../calendar-config.h" -#include "../e-date-edit-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, ECalComponent *comp) -{ - ECalComponentDateTime dt; - - dates->start = NULL; - dates->end = NULL; - dates->due = NULL; - dates->complete = NULL; - - /* Note that the ECalComponentDateTime's returned contain allocated - icaltimetype and tzid values, so we just take over ownership of - those. */ - e_cal_component_get_dtstart (comp, &dt); - if (dt.value) { - dates->start = g_new (ECalComponentDateTime, 1); - *dates->start = dt; - } - - e_cal_component_get_dtend (comp, &dt); - if (dt.value) { - dates->end = g_new (ECalComponentDateTime, 1); - *dates->end = dt; - } - - e_cal_component_get_due (comp, &dt); - if (dt.value) { - dates->due = g_new (ECalComponentDateTime, 1); - *dates->due = dt; - } - - e_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 e_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) { - e_cal_component_free_datetime (dates->start); - g_free (dates->start); - } - - if (dates->end) { - e_cal_component_free_datetime (dates->end); - g_free (dates->end); - } - - if (dates->due) { - e_cal_component_free_datetime (dates->due); - g_free (dates->due); - } - - if (dates->complete) - e_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); -} - -static void -date_edit_destroy_cb (EDateEdit *date_edit, gpointer data) -{ - EDateEditConfig *config = data; - - g_object_unref (config); -} - -/** - * 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; - EDateEditConfig *config; - - 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 - - config = e_date_edit_config_new (dedit); - g_signal_connect (G_OBJECT (dedit), "destroy", G_CALLBACK (date_edit_destroy_cb), config); - - 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) -{ - icaltimezone *zone; - struct icaltimetype tt; - struct tm tmp_tm = { 0 }; - - /* Get the current timezone. */ - zone = calendar_config_get_icaltimezone (); - - 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; -} - - - -/** - * 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 078cd6508c..0000000000 --- a/calendar/gui/dialogs/comp-editor-util.h +++ /dev/null @@ -1,40 +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 "comp-editor-page.h" - -void comp_editor_dates (CompEditorPageDates *date, ECalComponent *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); - - -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 8d26689eca..0000000000 --- a/calendar/gui/dialogs/comp-editor.c +++ /dev/null @@ -1,1402 +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 <gtk/gtkstock.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-messagebox.h> -#include <e-util/e-dialog-utils.h> -#include <e-util/e-icon-factory.h> -#include <evolution-shell-component-utils.h> -#include "../print.h" -#include "../comp-util.h" -#include "save-comp.h" -#include "delete-comp.h" -#include "send-comp.h" -#include "changed-comp.h" -#include "cancel-comp.h" -#include "recur-comp.h" -#include "comp-editor.h" - - - -/* Private part of the CompEditor structure */ -struct _CompEditorPrivate { - /* Client to use */ - ECal *client; - - /* Source client (where comp lives currently) */ - ECal *source_client; - - /* View to listen for changes */ - ECalView *view; - - /* Calendar object/uid we are editing; this is an internal copy */ - ECalComponent *comp; - - /* The pages we have */ - GList *pages; - - /* Notebook to hold the pages */ - GtkNotebook *notebook; - - gboolean changed; - gboolean needs_send; - - CalObjModType mod; - - gboolean existing_org; - gboolean user_org; - - gboolean warned; -}; - - - -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_finalize (GObject *object); - -static void real_set_e_cal (CompEditor *editor, ECal *client); -static void real_edit_comp (CompEditor *editor, ECalComponent *comp); -static gboolean real_send_comp (CompEditor *editor, ECalComponentItipMethod 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 needs_send_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_modified_cb (ECal *client, GList *objs, gpointer data); -static void obj_removed_cb (ECal *client, GList *uids, gpointer data); - -static GtkObjectClass *parent_class; - - - -E_MAKE_TYPE (comp_editor, "CompEditor", CompEditor, comp_editor_class_init, comp_editor_init, - GTK_TYPE_DIALOG); - -/* Class initialization function for the calendar component editor */ -static void -comp_editor_class_init (CompEditorClass *klass) -{ - GObjectClass *object_class; - GtkWidgetClass *widget_class; - - parent_class = g_type_class_peek_parent (klass); - object_class = G_OBJECT_CLASS (klass); - widget_class = GTK_WIDGET_CLASS (klass); - - klass->set_e_cal = real_set_e_cal; - klass->edit_comp = real_edit_comp; - klass->send_comp = real_send_comp; - - widget_class->key_press_event = comp_editor_key_press_event; - object_class->finalize = comp_editor_finalize; -} - -static void -listen_for_changes (CompEditor *editor) -{ - CompEditorPrivate *priv; - const char *uid = NULL; - - priv = editor->priv; - - /* Discard change listener */ - if (priv->view) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - editor); - - g_object_unref (priv->view); - priv->view = NULL; - } - - /* Listen for changes */ - if (priv->comp) - e_cal_component_get_uid (priv->comp, &uid); - - if (uid) { - char *query; - - query = g_strdup_printf ("(uid? \"%s\")", uid); - e_cal_get_query (priv->source_client, query, &priv->view, NULL); - g_free (query); - } - - if (priv->view) { - g_signal_connect (priv->view, "objects_modified", - G_CALLBACK (obj_modified_cb), editor); - - g_signal_connect((priv->view), "objects_removed", - G_CALLBACK (obj_removed_cb), editor); - - e_cal_view_start (priv->view); - } -} - -/* 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); -} - -static void -send_timezone (gpointer key, gpointer value, gpointer user_data) -{ - icaltimezone *zone = value; - CompEditor *editor = user_data; - - e_cal_add_timezone (editor->priv->client, zone, NULL); -} - -static gboolean -save_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - ECalComponent *clone; - GList *l; - gboolean result; - GError *error = NULL; - GHashTable *timezones; - const char *orig_uid; - - priv = editor->priv; - - if (!priv->changed) - return TRUE; - - /* Stop listening because we are about to change things */ - if (priv->view) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - editor); - - g_object_unref (priv->view); - priv->view = NULL; - } - - /* Update on the server */ - timezones = g_hash_table_new (g_str_hash, g_str_equal); - - clone = e_cal_component_clone (priv->comp); - for (l = priv->pages; l != NULL; l = l->next) { - if (!comp_editor_page_fill_component (l->data, clone)) { - g_object_unref (clone); - g_hash_table_destroy (timezones); - comp_editor_show_page (editor, COMP_EDITOR_PAGE (l->data)); - return FALSE; - } - - /* retrieve all timezones */ - comp_editor_page_fill_timezones (l->data, timezones); - } - - /* If we are not the organizer, we don't update the sequence number */ - if (!e_cal_component_has_organizer (clone) || itip_organizer_is_user (clone, priv->client)) - e_cal_component_commit_sequence (clone); - else - e_cal_component_abort_sequence (clone); - - g_object_unref (priv->comp); - priv->comp = clone; - - e_cal_component_get_uid (priv->comp, &orig_uid); - - /* send timezones */ - g_hash_table_foreach (timezones, (GHFunc) send_timezone, editor); - g_hash_table_destroy (timezones); - - /* send the component to the server */ - if (!cal_comp_is_on_server (priv->comp, priv->client)) { - result = e_cal_create_object (priv->client, e_cal_component_get_icalcomponent (priv->comp), NULL, &error); - } else { - result = e_cal_modify_object (priv->client, e_cal_component_get_icalcomponent (priv->comp), priv->mod, &error); - } - - if (!result) { - GtkWidget *dlg; - char *msg; - - msg = g_strdup (error ? error->message : _("Could not update object")); - - dlg = gnome_error_dialog (msg); - gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - - g_free (msg); - if (error) - g_error_free (error); - - return FALSE; - } else { - if (priv->source_client && - !e_source_equal (e_cal_get_source (priv->client), - e_cal_get_source (priv->source_client)) && - cal_comp_is_on_server (priv->comp, priv->source_client)) { - /* Comp found a new home. Remove it from old one. */ - e_cal_remove_object (priv->source_client, orig_uid, NULL); - - /* Let priv->source_client point to new home, so we can move it - * again this session. */ - g_object_unref (priv->source_client); - priv->source_client = g_object_ref (priv->client); - - listen_for_changes (editor); - } - - priv->changed = 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 ((GtkWindow *) editor, priv->client, priv->comp, !priv->existing_org)) { - if (itip_organizer_is_user (priv->comp, priv->client)) - return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REQUEST); - else - return comp_editor_send_comp (editor, E_CAL_COMPONENT_METHOD_REPLY); - } - - return TRUE; -} - -static gboolean -prompt_to_save_changes (CompEditor *editor, gboolean send) -{ - CompEditorPrivate *priv; - gboolean read_only; - - priv = editor->priv; - - if (!priv->changed) - return TRUE; - - if (!e_cal_is_read_only (priv->client, &read_only, NULL) || read_only) - return TRUE; - - switch (save_component_dialog (GTK_WINDOW(editor), priv->comp)) { - case GTK_RESPONSE_YES: /* Save */ - if (e_cal_component_is_instance (priv->comp)) - if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor))) - return FALSE; - - if (send && save_comp_with_send (editor)) - return TRUE; - else if (!send && save_comp (editor)) - return TRUE; - else - return FALSE; - case GTK_RESPONSE_NO: /* Discard */ - return TRUE; - case GTK_RESPONSE_CANCEL: /* Cancel */ - default: - return FALSE; - } -} - -static void -response_cb (GtkWidget *widget, int response, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; - - switch (response) { - case GTK_RESPONSE_OK: - commit_all_fields (editor); - - if (e_cal_component_is_instance (priv->comp)) - if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor))) - return; - - if (save_comp_with_send (editor)) - close_dialog (editor); - break; - case GTK_RESPONSE_CANCEL: - case GTK_RESPONSE_DELETE_EVENT: - commit_all_fields (editor); - - if (prompt_to_save_changes (editor, TRUE)) - close_dialog (editor); - break; - } -} - -/* Creates the basic in the editor */ -static void -setup_widgets (CompEditor *editor) -{ - CompEditorPrivate *priv; - GtkWidget *vbox; - - priv = editor->priv; - - /* Basic vbox */ - vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL); - gtk_widget_show (vbox); - gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (editor)->vbox), vbox, - TRUE, TRUE, 6); - - /* 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, 6); - - /* Buttons */ - gtk_dialog_add_button (GTK_DIALOG (editor), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - gtk_dialog_add_button (GTK_DIALOG (editor), GTK_STOCK_OK, GTK_RESPONSE_OK); - gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, FALSE); - - g_signal_connect (editor, "response", G_CALLBACK (response_cb), editor); -} - -/* 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->mod = CALOBJ_MOD_ALL; - priv->existing_org = FALSE; - priv->user_org = FALSE; - priv->warned = FALSE; - - gtk_window_set_type_hint (GTK_WINDOW (editor), GDK_WINDOW_TYPE_HINT_NORMAL); -} - - -static gint -comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e) -{ -#if 0 - if (e->keyval == GDK_Escape) { - if (prompt_to_save_changes (COMP_EDITOR (d), TRUE)) - close_dialog (COMP_EDITOR (d)); - return TRUE; - } -#endif - - 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_finalize (GObject *object) -{ - CompEditor *editor; - CompEditorPrivate *priv; - GList *l; - - editor = COMP_EDITOR (object); - priv = editor->priv; - - if (priv->client) { - g_object_unref (priv->client); - priv->client = NULL; - } - - if (priv->source_client) { - g_object_unref (priv->source_client); - priv->source_client = NULL; - } - - if (priv->view) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - editor); - - g_object_unref (priv->view); - priv->view = NULL; - } - - /* 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) - g_object_unref (l->data); - - if (priv->comp) { - g_object_unref (priv->comp); - priv->comp = NULL; - } - - g_free (priv); - editor->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void -delete_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - const char *uid; - - priv = editor->priv; - - e_cal_component_get_uid (priv->comp, &uid); - e_cal_remove_object (priv->client, uid, NULL); - close_dialog (editor); -} - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (CompEditor *editor) -{ - CompEditorPrivate *priv; - - priv = editor->priv; - - /* FIXME Unfortunately we do this here because otherwise corba - calls happen during destruction and we might get a change - notification back when we are in an inconsistent state */ - if (priv->view) - g_signal_handlers_disconnect_matched (G_OBJECT (priv->view), - G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, editor); - - gtk_widget_destroy (GTK_WIDGET (editor)); -} - - - -void -comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - priv->existing_org = existing_org; -} - -gboolean -comp_editor_get_existing_org (CompEditor *editor) -{ - CompEditorPrivate *priv; - - g_return_val_if_fail (editor != NULL, FALSE); - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); - - priv = editor->priv; - - return priv->existing_org; -} - -void -comp_editor_set_user_org (CompEditor *editor, gboolean user_org) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - priv->user_org = user_org; -} - -gboolean -comp_editor_get_user_org (CompEditor *editor) -{ - CompEditorPrivate *priv; - - g_return_val_if_fail (editor != NULL, FALSE); - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); - - priv = editor->priv; - - return priv->user_org; -} - - -/** - * 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; - - gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, changed); - gtk_dialog_set_default_response (GTK_DIALOG (editor), GTK_RESPONSE_OK); -} - -/** - * 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; - - g_object_ref (page); - - /* If we are editing something, fill the widgets with current info */ - if (priv->comp != NULL) { - ECalComponent *comp; - - comp = comp_editor_get_current_comp (editor); - comp_editor_page_fill_widgets (page, comp); - g_object_unref (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 */ - g_signal_connect(page, "changed", - G_CALLBACK (page_changed_cb), editor); - g_signal_connect(page, "needs_send", - G_CALLBACK (needs_send_cb), editor); - g_signal_connect(page, "summary_changed", - G_CALLBACK (page_summary_changed_cb), editor); - g_signal_connect(page, "dates_changed", - G_CALLBACK (page_dates_changed_cb), editor); - - /* Listen for when the page is mapped/unmapped so we can - install/uninstall the appropriate GtkAccelGroup. */ - g_signal_connect((page_widget), "map", - G_CALLBACK (page_mapped_cb), page); - g_signal_connect((page_widget), "unmap", - G_CALLBACK (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(). */ - g_signal_handlers_disconnect_matched (page, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, editor); - g_signal_handlers_disconnect_matched (page_widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, page); - - gtk_notebook_remove_page (priv->notebook, page_num); - - priv->pages = g_list_remove (priv->pages, page); - g_object_unref (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_e_cal: - * @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_e_cal (CompEditor *editor, ECal *client) -{ - CompEditorClass *klass; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor)); - - if (klass->set_e_cal) - klass->set_e_cal (editor, client); -} - -/** - * comp_editor_get_e_cal: - * @editor: A component editor - * - * Returns the calendar client of the editor - * - * Return value: The calendar client of the editor - **/ -ECal * -comp_editor_get_e_cal (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 (ECalComponent *comp) -{ - char *title; - const char *type_string; - ECalComponentVType type; - ECalComponentText text; - - if (!comp) - return g_strdup (_("Edit Appointment")); - - type = e_cal_component_get_vtype (comp); - switch (type) { - case E_CAL_COMPONENT_EVENT: - type_string = _("Appointment - %s"); - break; - case E_CAL_COMPONENT_TODO: - type_string = _("Task - %s"); - break; - case E_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; - } - - e_cal_component_get_summary (comp, &text); - if (text.value) { - title = g_strdup_printf (type_string, text.value); - } else { - title = g_strdup_printf (type_string, _("No summary")); - } - - return title; -} - -/* Creates an appropriate title for the event editor dialog */ -static char * -make_title_from_string (ECalComponent *comp, const char *str) -{ - char *title; - const char *type_string; - ECalComponentVType type; - - if (!comp) - return g_strdup (_("Edit Appointment")); - - type = e_cal_component_get_vtype (comp); - switch (type) { - case E_CAL_COMPONENT_EVENT: - type_string = _("Appointment - %s"); - break; - case E_CAL_COMPONENT_TODO: - type_string = _("Task - %s"); - break; - case E_CAL_COMPONENT_JOURNAL: - type_string = _("Journal entry - %s"); - break; - default: - g_message ("make_title_from_string(): Cannot handle object of type %d", type); - return NULL; - } - - if (str) { - title = g_strdup_printf (type_string, str); - } else { - title = g_strdup_printf (type_string, _("No summary")); - } - - return title; -} - -static const char * -make_icon_from_comp (ECalComponent *comp) -{ - ECalComponentVType type; - - if (!comp) - return "stock_calendar"; - - type = e_cal_component_get_vtype (comp); - switch (type) { - case E_CAL_COMPONENT_EVENT: - return "stock_new-appointment"; - break; - case E_CAL_COMPONENT_TODO: - return "stock_task"; - break; - default: - return "stock_calendar"; - } -} - -/* 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_title_from_string (CompEditor *editor, const char *str) -{ - CompEditorPrivate *priv; - char *title; - - priv = editor->priv; - title = make_title_from_string (priv->comp, str); - gtk_window_set_title (GTK_WINDOW (editor), title); - g_free (title); -} - -static void -set_icon_from_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - const char *icon_name; - GList *icon_list; - - priv = editor->priv; - icon_name = make_icon_from_comp (priv->comp); - - icon_list = e_icon_factory_get_icon_list (icon_name); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (editor), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } -} - -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_e_cal (CompEditor *editor, ECal *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 (E_IS_CAL (client)); - g_return_if_fail (e_cal_get_load_state (client) == - E_CAL_LOAD_LOADED); - g_object_ref (client); - } - - if (priv->client) - g_object_unref (priv->client); - - priv->client = client; - if (!priv->source_client) - priv->source_client = g_object_ref (client); - - /* Pass the client to any pages that need it. */ - for (elem = priv->pages; elem; elem = elem->next) - comp_editor_page_set_e_cal (elem->data, client); -} - -static void -real_edit_comp (CompEditor *editor, ECalComponent *comp) -{ - CompEditorPrivate *priv; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - if (priv->comp) { - g_object_unref (priv->comp); - priv->comp = NULL; - } - - if (comp) - priv->comp = e_cal_component_clone (comp); - - priv->existing_org = e_cal_component_has_organizer (comp); - priv->user_org = itip_organizer_is_user (comp, priv->client); - priv->warned = FALSE; - - set_title_from_comp (editor); - set_icon_from_comp (editor); - fill_widgets (editor); - - listen_for_changes (editor); -} - - -static gboolean -real_send_comp (CompEditor *editor, ECalComponentItipMethod method) -{ - CompEditorPrivate *priv; - ECalComponent *tmp_comp; - - g_return_val_if_fail (editor != NULL, FALSE); - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); - - priv = editor->priv; - - if (itip_send_comp (method, priv->comp, priv->client, NULL)) { - tmp_comp = priv->comp; - g_object_ref (tmp_comp); - comp_editor_edit_comp (editor, tmp_comp); - g_object_unref (tmp_comp); - - comp_editor_set_changed (editor, TRUE); - save_comp (editor); - - return TRUE; - } - - comp_editor_set_changed (editor, TRUE); - - return FALSE; -} - - -/** - * 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, ECalComponent *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 (E_IS_CAL_COMPONENT (comp)); - - klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor)); - - if (klass->edit_comp) - klass->edit_comp (editor, comp); -} - -ECalComponent * -comp_editor_get_comp (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->comp; -} - -ECalComponent * -comp_editor_get_current_comp (CompEditor *editor) -{ - CompEditorPrivate *priv; - ECalComponent *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 = e_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: - * - * - **/ -gboolean -comp_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) -{ - CompEditorClass *klass; - - g_return_val_if_fail (editor != NULL, FALSE); - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); - - klass = COMP_EDITOR_CLASS (G_OBJECT_GET_CLASS (editor)); - - if (klass->send_comp) - return klass->send_comp (editor, method); - - return FALSE; -} - -gboolean -comp_editor_close (CompEditor *editor) -{ - gboolean close; - - g_return_val_if_fail (editor != NULL, FALSE); - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); - - commit_all_fields (editor); - - close = prompt_to_save_changes (editor, TRUE); - if (close) - close_dialog (editor); - - return close; -} - -/* 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)); -} - -/** - * comp_editor_notify_client_changed: - * @editor: A component editor. - * - * Makes an editor emit the "client_changed" signal. - **/ -void -comp_editor_notify_client_changed (CompEditor *editor, ECal *client) -{ - GList *l; - CompEditorPrivate *priv; - gboolean read_only; - - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - - priv->changed = TRUE; - - comp_editor_set_e_cal (editor, client); - for (l = priv->pages; l != NULL; l = l->next) - comp_editor_page_notify_client_changed (COMP_EDITOR_PAGE (l->data), client); - - if (!e_cal_is_read_only (client, &read_only, NULL)) - read_only = TRUE; - - gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, !read_only); -} - -static void -page_changed_cb (GtkObject *obj, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; - - comp_editor_set_changed (editor, TRUE); - - if (!priv->warned && priv->existing_org && !priv->user_org) { - e_notice (editor, GTK_MESSAGE_INFO, - _("Changes made to this item may be discarded if an update arrives")); - priv->warned = TRUE; - } - -} - -static void -needs_send_cb (GtkObject *obj, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; - - comp_editor_set_needs_send (editor, 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); - - if (!priv->warned && priv->existing_org && !priv->user_org) { - e_notice (editor, GTK_MESSAGE_INFO, - _("Changes made to this item may be discarded if an update arrives")); - priv->warned = TRUE; - } - - set_title_from_string (editor, summary); -} - -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); - - if (!priv->warned && priv->existing_org && !priv->user_org) { - e_notice (editor, GTK_MESSAGE_INFO, - _("Changes made to this item may be discarded if an update arrives")); - priv->warned = TRUE; - } -} - -static void -obj_modified_cb (ECal *client, GList *objects, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - ECalComponent *comp = NULL; - - priv = editor->priv; - - /* We queried based on a specific UID so we definitely changed */ - if (changed_component_dialog ((GtkWindow *) editor, priv->comp, FALSE, priv->changed)) { - icalcomponent *icalcomp = icalcomponent_new_clone (objects->data); - - comp = e_cal_component_new (); - if (e_cal_component_set_icalcomponent (comp, icalcomp)) { - comp_editor_edit_comp (editor, comp); - } else { - GtkWidget *dlg; - - dlg = gnome_error_dialog (_("Unable to use current version!")); - gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - icalcomponent_free (icalcomp); - } - - g_object_unref (comp); - } -} - -static void -obj_removed_cb (ECal *client, GList *uids, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; - - if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed)) - close_dialog (editor); -} diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h deleted file mode 100644 index 14846ec615..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 <libecal/e-cal.h> -#include "../itip-utils.h" -#include "comp-editor-page.h" -#include "evolution-shell-component-utils.h" - -G_BEGIN_DECLS - - - -#define TYPE_COMP_EDITOR (comp_editor_get_type ()) -#define COMP_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_COMP_EDITOR, CompEditor)) -#define COMP_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_COMP_EDITOR, CompEditorClass)) -#define IS_COMP_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_COMP_EDITOR)) -#define IS_COMP_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_COMP_EDITOR)) - -typedef struct _CompEditorPrivate CompEditorPrivate; - -typedef struct { - GtkDialog object; - - /* Private data */ - CompEditorPrivate *priv; -} CompEditor; - -typedef struct { - GtkDialogClass parent_class; - - /* Virtual functions */ - void (* set_e_cal) (CompEditor *page, ECal *client); - void (* edit_comp) (CompEditor *page, ECalComponent *comp); - gboolean (* send_comp) (CompEditor *page, ECalComponentItipMethod 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_set_existing_org (CompEditor *editor, - gboolean existing_org); -gboolean comp_editor_get_existing_org (CompEditor *editor); -void comp_editor_set_user_org (CompEditor *editor, - gboolean user_org); -gboolean comp_editor_get_user_org (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_e_cal (CompEditor *editor, - ECal *client); -ECal *comp_editor_get_e_cal (CompEditor *editor); -void comp_editor_edit_comp (CompEditor *ee, - ECalComponent *comp); -ECalComponent *comp_editor_get_comp (CompEditor *editor); -ECalComponent *comp_editor_get_current_comp (CompEditor *editor); -gboolean comp_editor_save_comp (CompEditor *editor, - gboolean send); -void comp_editor_delete_comp (CompEditor *editor); -gboolean comp_editor_send_comp (CompEditor *editor, - ECalComponentItipMethod method); -gboolean comp_editor_close (CompEditor *editor); -void comp_editor_focus (CompEditor *editor); - -void comp_editor_notify_client_changed (CompEditor *editor, ECal *client); - - - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/copy-source-dialog.c b/calendar/gui/dialogs/copy-source-dialog.c deleted file mode 100644 index 9fdfee16b2..0000000000 --- a/calendar/gui/dialogs/copy-source-dialog.c +++ /dev/null @@ -1,136 +0,0 @@ -/* Evolution calendar - Copy source dialog - * - * Copyright (C) 2003 Novell, Inc. - * - * Author: Rodrigo Moya <rodrigo@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/gtkmessagedialog.h> -#include <bonobo/bonobo-i18n.h> -#include "copy-source-dialog.h" -#include "select-source-dialog.h" -#include "common/authentication.h" - -typedef struct { - ESource *orig_source; - ECalSourceType obj_type; - ESource *selected_source; -} CopySourceDialogData; - -static void -show_error (GtkWindow *parent, const char *msg) -{ - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (parent, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, msg); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); -} - -static gboolean -copy_source (CopySourceDialogData *csdd) -{ - ECal *source_client, *dest_client; - gboolean read_only = TRUE; - GList *obj_list = NULL; - gboolean result = FALSE; - - if (!csdd->selected_source) - return FALSE; - - /* open the source */ - source_client = auth_new_cal_from_source (csdd->orig_source, csdd->obj_type); - if (!e_cal_open (source_client, TRUE, NULL)) { - show_error (NULL, _("Could not open source")); - g_object_unref (source_client); - return FALSE; - } - - /* open the destination */ - dest_client = auth_new_cal_from_source (csdd->selected_source, csdd->obj_type); - if (!e_cal_open (dest_client, FALSE, NULL)) { - show_error (NULL, _("Could not open destination")); - g_object_unref (dest_client); - g_object_unref (source_client); - return FALSE; - } - - /* check if the destination is read only */ - e_cal_is_read_only (dest_client, &read_only, NULL); - if (read_only) { - show_error (NULL, _("Destination is read only")); - } else { - if (e_cal_get_object_list (source_client, "#t", &obj_list, NULL)) { - GList *l; - const char *uid; - icalcomponent *icalcomp; - - for (l = obj_list; l != NULL; l = l->next) { - /* FIXME: process recurrences */ - /* FIXME: process errors */ - if (e_cal_get_object (dest_client, icalcomponent_get_uid (l->data), NULL, - &icalcomp, NULL)) { - e_cal_modify_object (dest_client, l->data, CALOBJ_MOD_ALL, NULL); - icalcomponent_free (icalcomp); - } else { - e_cal_create_object (dest_client, l->data, (char **) &uid, NULL); - g_free ((gpointer) uid); - } - } - - e_cal_free_object_list (obj_list); - } - } - - /* free memory */ - g_object_unref (dest_client); - g_object_unref (source_client); - - return result; -} - -/** - * copy_source_dialog - * - * Implements the Copy command for sources, allowing the user to select a target - * source to copy to. - */ -gboolean -copy_source_dialog (GtkWindow *parent, ESource *source, ECalSourceType obj_type) -{ - CopySourceDialogData csdd; - gboolean result = FALSE; - - g_return_val_if_fail (E_IS_SOURCE (source), FALSE); - - csdd.orig_source = source; - csdd.selected_source = NULL; - csdd.obj_type = obj_type; - - csdd.selected_source = select_source_dialog (parent, obj_type); - if (csdd.selected_source) { - result = copy_source (&csdd); - - /* free memory */ - g_object_unref (csdd.selected_source); - } - - return result; -} diff --git a/calendar/gui/dialogs/copy-source-dialog.h b/calendar/gui/dialogs/copy-source-dialog.h deleted file mode 100644 index 597b1f25fc..0000000000 --- a/calendar/gui/dialogs/copy-source-dialog.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Evolution calendar - Copy source dialog - * - * Copyright (C) 2003 Novell, Inc. - * - * Author: Rodrigo Moya <rodrigo@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 COPY_SOURCE_DIALOG_H -#define COPY_SOURCE_DIALOG_H - -#include <gtk/gtkwindow.h> -#include <libedataserver/e-source.h> -#include <libecal/e-cal.h> -#include <libecal/e-cal-util.h> - -gboolean copy_source_dialog (GtkWindow *parent, ESource *source, ECalSourceType type); - -#endif diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c deleted file mode 100644 index ed60def95e..0000000000 --- a/calendar/gui/dialogs/delete-comp.c +++ /dev/null @@ -1,160 +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 <gtk/gtkstock.h> -#include <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <e-util/e-icon-factory.h> -#include "widgets/misc/e-error.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 (ECalComponent *comp, - gboolean consider_as_untitled, - int n_comps, ECalComponentVType vtype, - GtkWidget *widget) -{ - const char *stock_icon, *id; - char *arg0 = NULL; - int response; - - if (comp) { - g_return_val_if_fail (E_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 != E_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) { - ECalComponentText summary; - - vtype = e_cal_component_get_vtype (comp); - - if (!consider_as_untitled) { - e_cal_component_get_summary (comp, &summary); - arg0 = g_strdup (summary.value); - } - - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - stock_icon = "stock_calendar"; - if (arg0) - id = "calendar:prompt-delete-titled-appointment"; - else - id = "calendar:prompt-delete-appointment"; - break; - - case E_CAL_COMPONENT_TODO: - stock_icon = "stock_todo"; - if (arg0) - id = "calendar:prompt-delete-named-task"; - else - id = "calendar:prompt-delete-task"; - break; - - case E_CAL_COMPONENT_JOURNAL: - stock_icon = "stock_calendar"; - if (arg0) - id = "calendar:prompt-delete-named-journal"; - else - id = "calendar:prompt-delete-journal"; - break; - - default: - g_message ("delete_component_dialog(): Cannot handle object of type %d", - vtype); - g_free (arg0); - return FALSE; - } - } else { - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - if (n_comps == 1) - id = "calendar:prompt-delete-appointment"; - else - id = "calendar:prompt-delete-appointments"; - break; - - case E_CAL_COMPONENT_TODO: - if (n_comps == 1) - id = "calendar:prompt-delete-task"; - else - id = "calendar:prompt-delete-tasks"; - break; - - case E_CAL_COMPONENT_JOURNAL: - if (n_comps == 1) - id = "calendar:prompt-delete-journal"; - else - id = "calendar:prompt-delete-journals"; - break; - - default: - g_message ("delete_component_dialog(): Cannot handle objects of type %d", - vtype); - return FALSE; - } - - if (n_comps > 1) - arg0 = g_strdup_printf ("%d", n_comps); - } - - response = e_error_run ((GtkWindow *) gtk_widget_get_toplevel (widget), id, arg0, NULL); - g_free (arg0); - - return response == GTK_RESPONSE_YES; -} diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h deleted file mode 100644 index f8773c25d0..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 <libecal/e-cal-component.h> - -gboolean delete_component_dialog (ECalComponent *comp, - gboolean consider_as_untitled, - int n_comps, ECalComponentVType vtype, - GtkWidget *widget); - -#endif diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c deleted file mode 100644 index 5932abeab8..0000000000 --- a/calendar/gui/dialogs/delete-error.c +++ /dev/null @@ -1,122 +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 <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-uidefs.h> -#include <e-util/e-icon-factory.h> -#include "delete-error.h" - - - -/** - * delete_error_dialog: - * - * Shows any applicable error messages as the result of deleting and object - * - **/ -void -delete_error_dialog (GError *error, ECalComponentVType vtype) -{ - GList *icon_list = NULL; - GtkWidget *dialog; - const char *str; - - if (!error) - return; - - switch (error->code) { - case E_CALENDAR_STATUS_CORBA_EXCEPTION: - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - str = _("The event could not be deleted due to a corba error"); - break; - case E_CAL_COMPONENT_TODO: - str = _("The task could not be deleted due to a corba error"); - break; - case E_CAL_COMPONENT_JOURNAL: - str = _("The journal entry could not be deleted due to a corba error"); - break; - default: - str = _("The item could not be deleted due to a corba error"); - break; - } - break; - case E_CALENDAR_STATUS_PERMISSION_DENIED: - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - str = _("The event could not be deleted because permission was denied"); - break; - case E_CAL_COMPONENT_TODO: - str = _("The task could not be deleted because permission was denied"); - break; - case E_CAL_COMPONENT_JOURNAL: - str = _("The journal entry could not be deleted because permission was denied"); - break; - default: - str = _("The item could not be deleted because permission was denied"); - break; - } - break; - case E_CALENDAR_STATUS_OTHER_ERROR: - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - str = _("The event could not be deleted due to an error"); - break; - case E_CAL_COMPONENT_TODO: - str = _("The task could not be deleted due to an error"); - break; - case E_CAL_COMPONENT_JOURNAL: - str = _("The journal entry could not be deleted due to an error"); - break; - default: - str = _("The item could not be deleted due to an error"); - break; - } - break; - case E_CALENDAR_STATUS_OK: - case E_CALENDAR_STATUS_OBJECT_NOT_FOUND: - default: - /* If not found, we don't care - its gone anyhow */ - return; - } - - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, str); - if (vtype == E_CAL_COMPONENT_EVENT) - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); - else if (vtype == E_CAL_COMPONENT_TODO) - icon_list = e_icon_factory_get_icon_list ("stock_todo"); - - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); -} diff --git a/calendar/gui/dialogs/delete-error.h b/calendar/gui/dialogs/delete-error.h deleted file mode 100644 index 68c132e479..0000000000 --- a/calendar/gui/dialogs/delete-error.h +++ /dev/null @@ -1,30 +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 DELETE_ERROR_H -#define DELETE_ERROR_H - -#include <glib.h> -#include <libecal/e-cal.h> -#include <libecal/e-cal-component.h> - -void delete_error_dialog (GError *error, ECalComponentVType vtype); - -#endif diff --git a/calendar/gui/dialogs/e-delegate-dialog.c b/calendar/gui/dialogs/e-delegate-dialog.c deleted file mode 100644 index ff27699011..0000000000 --- a/calendar/gui/dialogs/e-delegate-dialog.c +++ /dev/null @@ -1,322 +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 <bonobo-activation/bonobo-activation.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 <libical/ical.h> -#include <glade/glade.h> -#include <gal/util/e-util.h> -#include <widgets/misc/e-map.h> -#include <addressbook/util/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:" BASE_VERSION -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_finalize (GObject *object); - -static gboolean get_widgets (EDelegateDialog *edd); -static void addressbook_clicked_cb (GtkWidget *widget, gpointer data); - -static GtkObjectClass *parent_class; - -E_MAKE_TYPE (e_delegate_dialog, "EDelegateDialog", EDelegateDialog, e_delegate_dialog_class_init, - e_delegate_dialog_init, G_TYPE_OBJECT); - -/* Class initialization function for the event editor */ -static void -e_delegate_dialog_class_init (EDelegateDialogClass *class) -{ - GObjectClass *gobject_class; - - gobject_class = (GObjectClass *) class; - - parent_class = g_type_class_ref (G_TYPE_OBJECT); - - gobject_class->finalize = e_delegate_dialog_finalize; -} - -/* 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_finalize (GObject *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 (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (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; - char *str; - - 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, 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 = bonobo_activation_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, 6); - - 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); - str = e_destination_exportv(destv); - bonobo_widget_set_property (BONOBO_WIDGET (priv->entry), "destinations", TC_CORBA_string, str, NULL); - g_free(str); - g_object_unref (dest); - - g_signal_connect((priv->addressbook), "clicked", - G_CALLBACK (addressbook_clicked_cb), edd); - - return edd; - - error: - - g_object_unref (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 (g_object_new (E_TYPE_DELEGATE_DIALOG, NULL)); - 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", TC_CORBA_string, &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", TC_CORBA_string, &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 af24ca2b63..0000000000 --- a/calendar/gui/dialogs/e-delegate-dialog.glade +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="delegate-dialog"> - <property name="title" translatable="yes">Enter Delegate</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">8</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancel-button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="ok-button"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="delegate-hbox"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Delegate To:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="addressbook"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Contacts...</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/e-delegate-dialog.h b/calendar/gui/dialogs/e-delegate-dialog.h deleted file mode 100644 index 2acc853e0a..0000000000 --- a/calendar/gui/dialogs/e-delegate-dialog.h +++ /dev/null @@ -1,72 +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 <gtk/gtkwidget.h> - - - -#define E_TYPE_DELEGATE_DIALOG (e_delegate_dialog_get_type ()) -#define E_DELEGATE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DELEGATE_DIALOG, EDelegateDialog)) -#define E_DELEGATE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DELEGATE_DIALOG, \ - EDelegateDialogClass)) -#define E_IS_DELEGATE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DELEGATE_DIALOG)) -#define E_IS_DELEGATE_DIALOG_CLASS(klass) (G_TYPE_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 454e467a66..0000000000 --- a/calendar/gui/dialogs/event-editor.c +++ /dev/null @@ -1,464 +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/util/e-util.h> -#include <libgnome/gnome-i18n.h> -#include <widgets/misc/e-dateedit.h> -#include <e-util/e-icon-factory.h> - -#include "event-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; - RecurrencePage *recur_page; - MeetingPage *meet_page; - SchedulePage *sched_page; - - EMeetingStore *model; - - gboolean meeting_shown; - gboolean updating; -}; - - - -static void event_editor_class_init (EventEditorClass *class); -static void event_editor_init (EventEditor *ee); -static void event_editor_set_e_cal (CompEditor *editor, ECal *client); -static void event_editor_edit_comp (CompEditor *editor, ECalComponent *comp); -static gboolean event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method); -static void event_editor_finalize (GObject *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_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); -static void model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data); - - -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. - **/ - -E_MAKE_TYPE (event_editor, "EventEditor", EventEditor, event_editor_class_init, - event_editor_init, TYPE_COMP_EDITOR); - -/* Class initialization function for the event editor */ -static void -event_editor_class_init (EventEditorClass *klass) -{ - GObjectClass *gobject_class; - CompEditorClass *editor_class; - - gobject_class = (GObjectClass *) klass; - editor_class = (CompEditorClass *) klass; - - parent_class = g_type_class_ref(TYPE_COMP_EDITOR); - - editor_class->set_e_cal = event_editor_set_e_cal; - editor_class->edit_comp = event_editor_edit_comp; - editor_class->send_comp = event_editor_send_comp; - - gobject_class->finalize = event_editor_finalize; -} - -static void -init_widgets (EventEditor *ee) -{ - EventEditorPrivate *priv; - - priv = ee->priv; - - g_signal_connect((priv->model), "row_changed", - G_CALLBACK (model_row_change_insert_cb), ee); - g_signal_connect((priv->model), "row_inserted", - G_CALLBACK (model_row_change_insert_cb), ee); - g_signal_connect((priv->model), "row_deleted", - G_CALLBACK (model_row_delete_cb), ee); -} - -static void -client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) -{ - //set_menu_sens (EVENT_EDITOR (user_data)); -} - -/* 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->model = E_MEETING_STORE (e_meeting_store_new ()); - priv->meeting_shown = TRUE; - priv->updating = FALSE; -} - -EventEditor * -event_editor_construct (EventEditor *ee, ECal *client) -{ - EventEditorPrivate *priv; - - priv = ee->priv; - - priv->event_page = event_page_new (); - g_object_ref (priv->event_page); - gtk_object_sink (GTK_OBJECT (priv->event_page)); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->event_page), - _("Appointment")); - g_signal_connect (G_OBJECT (priv->event_page), "client_changed", - G_CALLBACK (client_changed_cb), ee); - - priv->recur_page = recurrence_page_new (); - g_object_ref (priv->recur_page); - gtk_object_sink (GTK_OBJECT (priv->recur_page)); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->recur_page), - _("Recurrence")); - - priv->sched_page = schedule_page_new (priv->model); - g_object_ref (priv->sched_page); - gtk_object_sink (GTK_OBJECT (priv->sched_page)); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->sched_page), - _("Scheduling")); - - priv->meet_page = meeting_page_new (priv->model, client); - g_object_ref (priv->meet_page); - gtk_object_sink (GTK_OBJECT (priv->meet_page)); - comp_editor_append_page (COMP_EDITOR (ee), - COMP_EDITOR_PAGE (priv->meet_page), - _("Invitations")); - - comp_editor_set_e_cal (COMP_EDITOR (ee), client); - - init_widgets (ee); - gtk_window_set_default_size (GTK_WINDOW (ee), 300, 225); - - return ee; -} - -static void -event_editor_set_e_cal (CompEditor *editor, ECal *client) -{ - EventEditor *ee; - EventEditorPrivate *priv; - - ee = EVENT_EDITOR (editor); - priv = ee->priv; - - e_meeting_store_set_e_cal (priv->model, client); - - if (parent_class->set_e_cal) - parent_class->set_e_cal (editor, client); -} - -static void -event_editor_edit_comp (CompEditor *editor, ECalComponent *comp) -{ - EventEditor *ee; - EventEditorPrivate *priv; - ECalComponentOrganizer organizer; - ECal *client; - GSList *attendees = NULL; - - ee = EVENT_EDITOR (editor); - priv = ee->priv; - - priv->updating = TRUE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); - - client = comp_editor_get_e_cal (COMP_EDITOR (editor)); - - /* Get meeting related stuff */ - e_cal_component_get_organizer (comp, &organizer); - e_cal_component_get_attendee_list (comp, &attendees); - - /* Clear things up */ - e_meeting_store_remove_all_attendees (priv->model); - - /* Set up the attendees */ - 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; - int row; - - 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), - _("Invitations")); - } - - for (l = attendees; l != NULL; l = l->next) { - ECalComponentAttendee *ca = l->data; - EMeetingAttendee *ia; - - ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_e_cal_component_attendee (ca)); - - /* If we aren't the organizer or the attendee is just delegating, don't allow editing */ - if (!comp_editor_get_user_org (editor) || e_meeting_attendee_is_set_delto (ia)) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); - e_meeting_store_add_attendee (priv->model, ia); - - g_object_unref(ia); - } - - /* If we aren't the organizer we can still change our own status */ - if (!comp_editor_get_user_org (editor)) { - EAccountList *accounts; - EAccount *account; - EIterator *it; - - accounts = itip_addresses_get (); - for (it = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(it);e_iterator_next(it)) { - EMeetingAttendee *ia; - - account = (EAccount*)e_iterator_get(it); - - ia = e_meeting_store_find_attendee (priv->model, account->id->address, &row); - if (ia != NULL) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_STATUS); - } - g_object_unref(it); - } else if (e_cal_get_organizer_must_attend (client)) { - EMeetingAttendee *ia; - - ia = e_meeting_store_find_attendee (priv->model, organizer.value, &row); - if (ia != NULL) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); - } - - priv->meeting_shown = TRUE; - } - e_cal_component_free_attendee_list (attendees); - - comp_editor_set_needs_send (COMP_EDITOR (ee), priv->meeting_shown && itip_organizer_is_user (comp, client)); - - priv->updating = FALSE; -} - -static gboolean -event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) -{ - EventEditor *ee = EVENT_EDITOR (editor); - EventEditorPrivate *priv; - ECalComponent *comp = NULL; - - priv = ee->priv; - - /* Don't cancel more than once or when just publishing */ - if (method == E_CAL_COMPONENT_METHOD_PUBLISH || - method == E_CAL_COMPONENT_METHOD_CANCEL) - goto parent; - - comp = meeting_page_get_cancel_comp (priv->meet_page); - if (comp != NULL) { - ECal *client; - gboolean result; - - client = e_meeting_store_get_e_cal (priv->model); - result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL); - g_object_unref (comp); - - if (!result) - return FALSE; - } - - parent: - if (parent_class->send_comp) - return parent_class->send_comp (editor, method); - - return FALSE; -} - -/* Destroy handler for the event editor */ -static void -event_editor_finalize (GObject *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; - - g_object_unref (priv->event_page); - g_object_unref (priv->recur_page); - g_object_unref (priv->meet_page); - g_object_unref (priv->sched_page); - - g_object_unref (priv->model); - - g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - -/** - * event_editor_new: - * @client: a ECal - * - * 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 (ECal *client) -{ - EventEditor *ee; - - ee = EVENT_EDITOR (g_object_new (TYPE_EVENT_EDITOR, NULL)); - return event_editor_construct (ee, client); -} - -static void -show_meeting (EventEditor *ee) -{ - 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), - _("Invitations")); - priv->meeting_shown = TRUE; - - 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)); -} - -void -event_editor_show_meeting (EventEditor *ee) -{ - g_return_if_fail (ee != NULL); - g_return_if_fail (IS_EVENT_EDITOR (ee)); - - - show_meeting (ee); -} - -static void -schedule_meeting_cmd (GtkWidget *widget, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - - show_meeting (ee); -} - -static void -refresh_meeting_cmd (GtkWidget *widget, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - - comp_editor_send_comp (COMP_EDITOR (ee), E_CAL_COMPONENT_METHOD_REFRESH); -} - -static void -cancel_meeting_cmd (GtkWidget *widget, gpointer data) -{ - EventEditor *ee = EVENT_EDITOR (data); - ECalComponent *comp; - - comp = comp_editor_get_current_comp (COMP_EDITOR (ee)); - if (cancel_component_dialog ((GtkWindow *) ee, - comp_editor_get_e_cal (COMP_EDITOR (ee)), comp, FALSE)) { - comp_editor_send_comp (COMP_EDITOR (ee), E_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), E_CAL_COMPONENT_METHOD_PUBLISH); -} - -static void -model_changed (EventEditor *ee) -{ - if (!ee->priv->updating) { - comp_editor_set_changed (COMP_EDITOR (ee), TRUE); - comp_editor_set_needs_send (COMP_EDITOR (ee), TRUE); - } -} - -static void -model_row_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -{ - model_changed (EVENT_EDITOR (data)); -} - -static void -model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data) -{ - model_changed (EVENT_EDITOR (data)); -} - diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h deleted file mode 100644 index 9234b8310e..0000000000 --- a/calendar/gui/dialogs/event-editor.h +++ /dev/null @@ -1,61 +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 <gtk/gtkobject.h> -#include "comp-editor.h" - - - -#define TYPE_EVENT_EDITOR (event_editor_get_type ()) -#define EVENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EVENT_EDITOR, EventEditor)) -#define EVENT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EVENT_EDITOR, EventEditorClass)) -#define IS_EVENT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EVENT_EDITOR)) -#define IS_EVENT_EDITOR_CLASS(klass) (G_TYPE_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, - ECal *client); -EventEditor *event_editor_new (ECal *client); -void event_editor_show_meeting (EventEditor *ee); - - - -#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 0b6fa70727..0000000000 --- a/calendar/gui/dialogs/event-page.c +++ /dev/null @@ -1,1987 +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 <string.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktextview.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <gal/widgets/e-categories.h> -#include "common/authentication.h" -#include "e-util/e-categories-config.h" -#include "e-util/e-dialog-widgets.h" -#include "widgets/misc/e-dateedit.h" -#include "widgets/misc/e-source-option-menu.h" -#include <libecal/e-cal-time-util.h> -#include "../calendar-config.h" -#include "../e-timezone-entry.h" -#include "comp-editor.h" -#include "comp-editor-util.h" -#include "../e-alarm-list.h" -#include "alarm-list-dialog.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 *summary_label; - GtkWidget *location; - GtkWidget *location_label; - - GtkWidget *start_time; - GtkWidget *end_time; - GtkWidget *start_timezone; - GtkWidget *end_timezone; - GtkWidget *all_day_event; - - GtkWidget *description; - - GtkWidget *classification; - - GtkWidget *show_time_as_busy; - - GtkWidget *alarm; - GtkWidget *alarm_time; - GtkWidget *alarm_warning; - GtkWidget *alarm_custom; - - GtkWidget *categories_btn; - GtkWidget *categories; - - GtkWidget *source_selector; - - EAlarmList *alarm_list_store; - - gboolean updating; - - char *old_summary; - CalUnits alarm_units; - int alarm_interval; - - /* 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; -}; - - - -static void event_page_class_init (EventPageClass *class); -static void event_page_init (EventPage *epage); -static void event_page_finalize (GObject *object); - -static GtkWidget *event_page_get_widget (CompEditorPage *page); -static void event_page_focus_main_widget (CompEditorPage *page); -static gboolean event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); -static gboolean event_page_fill_component (CompEditorPage *page, ECalComponent *comp); -static gboolean event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones); -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. - **/ - -E_MAKE_TYPE (event_page, "EventPage", EventPage, event_page_class_init, event_page_init, - TYPE_COMP_EDITOR_PAGE); - -/* Class initialization function for the event page */ -static void -event_page_class_init (EventPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GObjectClass *) class; - - parent_class = g_type_class_ref (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->fill_timezones = event_page_fill_timezones; - editor_page_class->set_summary = event_page_set_summary; - editor_page_class->set_dates = event_page_set_dates; - - object_class->finalize = event_page_finalize; -} - -/* 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->summary_label = NULL; - priv->location = NULL; - priv->location_label = 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 = NULL; - priv->show_time_as_busy = NULL; - priv->alarm = NULL; - priv->alarm_time = NULL; - priv->alarm_custom = NULL; - priv->categories_btn = NULL; - priv->categories = NULL; - - priv->alarm_interval = -1; - - priv->updating = FALSE; - priv->sync_timezones = FALSE; -} - -/* Destroy handler for the event page */ -static void -event_page_finalize (GObject *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->main) - gtk_widget_unref (priv->main); - - if (priv->xml) { - g_object_unref (priv->xml); - priv->xml = NULL; - } - - if (priv->alarm_list_store) { - g_object_unref (priv->alarm_list_store); - priv->alarm_list_store = NULL; - } - - g_free (priv->old_summary); - - g_free (priv); - epage->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - - -static const int classification_map[] = { - E_CAL_COMPONENT_CLASS_PUBLIC, - E_CAL_COMPONENT_CLASS_PRIVATE, - E_CAL_COMPONENT_CLASS_CONFIDENTIAL, - -1 -}; - -enum { - ALARM_15_MINUTES, - ALARM_1_HOUR, - ALARM_1_DAY, - ALARM_USER_TIME -}; - -static const int alarm_map[] = { - ALARM_15_MINUTES, - ALARM_1_HOUR, - ALARM_1_DAY, - ALARM_USER_TIME, - -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, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date) -{ - EventPagePrivate *priv; - struct icaltimetype *start_tt, *end_tt, implied_tt; - icaltimezone *start_zone = NULL, *end_zone = NULL; - 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) { - /* FIXME: Handle error better. */ - if (!e_cal_get_timezone (COMP_EDITOR_PAGE (epage)->client, - start_date->tzid, &start_zone, NULL)) { - 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) { - if (!e_cal_get_timezone (COMP_EDITOR_PAGE (epage)->client, - end_date->tzid, &end_zone, NULL)) { - /* FIXME: Handle error better. */ - 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 (!end_tt && start_tt->is_date) { - end_tt = &implied_tt; - *end_tt = *start_tt; - icaltime_adjust (end_tt, 1, 0, 0, 0); - } - - 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) - start_zone = end_zone = calendar_config_get_icaltimezone (); - - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), - epage); - g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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); - g_signal_handlers_block_matched (priv->end_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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); - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)), "", 0); - - /* Start and end times */ - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), - epage); - g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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_option_menu_set (priv->classification, E_CAL_COMPONENT_CLASS_PRIVATE, classification_map); - - /* Show Time As (Transparency) */ - e_dialog_toggle_set (priv->show_time_as_busy, TRUE); - - /* Alarm */ - e_dialog_toggle_set (priv->alarm, FALSE); - e_dialog_option_menu_set (priv->alarm_time, ALARM_15_MINUTES, alarm_map); - - /* Categories */ - e_dialog_editable_set (priv->categories, NULL); -} - -static gboolean -is_custom_alarm (ECalComponentAlarm *ca, char *old_summary, CalUnits user_units, int user_interval, int *alarm_type) -{ - ECalComponentAlarmTrigger trigger; - ECalComponentAlarmRepeat repeat; - ECalComponentAlarmAction action; - ECalComponentText desc; - icalcomponent *icalcomp; - icalproperty *icalprop; - icalattach *attach; - gboolean needs_desc = FALSE; - - e_cal_component_alarm_get_action (ca, &action); - if (action != E_CAL_COMPONENT_ALARM_DISPLAY) - return TRUE; - - e_cal_component_alarm_get_attach (ca, &attach); - if (attach) - return TRUE; - - icalcomp = e_cal_component_alarm_get_icalcomponent (ca); - icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); - while (icalprop) { - const char *x_name; - - x_name = icalproperty_get_x_name (icalprop); - if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) - needs_desc = TRUE; - - icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY); - } - - if (!needs_desc) { - e_cal_component_alarm_get_description (ca, &desc); - if (!desc.value || !old_summary || strcmp (desc.value, old_summary)) - return TRUE; - } - - e_cal_component_alarm_get_repeat (ca, &repeat); - if (repeat.repetitions != 0) - return TRUE; - - if (e_cal_component_alarm_has_attendees (ca)) - return TRUE; - - e_cal_component_alarm_get_trigger (ca, &trigger); - if (trigger.type != E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START) - return TRUE; - - if (trigger.u.rel_duration.is_neg != 1) - return TRUE; - - if (trigger.u.rel_duration.weeks != 0) - return TRUE; - - if (trigger.u.rel_duration.seconds != 0) - return TRUE; - - if (trigger.u.rel_duration.days == 1 - && trigger.u.rel_duration.hours == 0 - && trigger.u.rel_duration.minutes == 0) { - if (alarm_type) - *alarm_type = ALARM_1_DAY; - return FALSE; - } - - if (trigger.u.rel_duration.days == 0 - && trigger.u.rel_duration.hours == 1 - && trigger.u.rel_duration.minutes == 0) { - if (alarm_type) - *alarm_type = ALARM_1_HOUR; - return FALSE; - } - - if (trigger.u.rel_duration.days == 0 - && trigger.u.rel_duration.hours == 0 - && trigger.u.rel_duration.minutes == 15) { - if (alarm_type) - *alarm_type = ALARM_15_MINUTES; - return FALSE; - } - - if (user_interval != -1) { - switch (user_units) { - case CAL_DAYS: - if (trigger.u.rel_duration.days == user_interval - && trigger.u.rel_duration.hours == 0 - && trigger.u.rel_duration.minutes == 0) { - if (alarm_type) - *alarm_type = ALARM_USER_TIME; - return FALSE; - } - break; - - case CAL_HOURS: - if (trigger.u.rel_duration.days == 0 - && trigger.u.rel_duration.hours == user_interval - && trigger.u.rel_duration.minutes == 0) { - if (alarm_type) - *alarm_type = ALARM_USER_TIME; - return FALSE; - } - break; - - case CAL_MINUTES: - if (trigger.u.rel_duration.days == 0 - && trigger.u.rel_duration.hours == 0 - && trigger.u.rel_duration.minutes == user_interval) { - if (alarm_type) - *alarm_type = ALARM_USER_TIME; - return FALSE; - } - break; - } - } - - return TRUE; -} - -static gboolean -is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, char *old_summary, CalUnits user_units, int user_interval, int *alarm_type) -{ - ECalComponentAlarm *ca; - gboolean result; - - if (g_list_length (alarms) > 1) - return TRUE; - - ca = e_cal_component_get_alarm (comp, alarms->data); - result = is_custom_alarm (ca, old_summary, user_units, user_interval, alarm_type); - e_cal_component_alarm_free (ca); - - return result; -} - -static gboolean -is_custom_alarm_store (EAlarmList *alarm_list_store, char *old_summary, CalUnits user_units, int user_interval, int *alarm_type) -{ - const ECalComponentAlarm *alarm; - GtkTreeModel *model; - GtkTreeIter iter; - gboolean valid_iter; - - model = GTK_TREE_MODEL (alarm_list_store); - - valid_iter = gtk_tree_model_get_iter_first (model, &iter); - if (!valid_iter) - return FALSE; - - alarm = e_alarm_list_get_alarm (alarm_list_store, &iter); - if (is_custom_alarm ((ECalComponentAlarm *)alarm, old_summary, user_units, user_interval, alarm_type)) - return TRUE; - - valid_iter = gtk_tree_model_iter_next (model, &iter); - if (valid_iter) - return TRUE; - - return FALSE; -} - -static void -sensitize_widgets (EventPage *epage) -{ - gboolean read_only, custom, alarm; - EventPagePrivate *priv; - - priv = epage->priv; - - if (!e_cal_is_read_only (COMP_EDITOR_PAGE (epage)->client, &read_only, NULL)) - read_only = TRUE; - - custom = is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL); - alarm = e_dialog_toggle_get (priv->alarm); - - gtk_widget_set_sensitive (priv->summary_label, !read_only); - gtk_entry_set_editable (GTK_ENTRY (priv->summary), !read_only); - gtk_widget_set_sensitive (priv->location_label, !read_only); - gtk_entry_set_editable (GTK_ENTRY (priv->location), !read_only); - gtk_widget_set_sensitive (priv->start_time, !read_only); - gtk_widget_set_sensitive (priv->start_timezone, !read_only); - gtk_widget_set_sensitive (priv->end_time, !read_only); - gtk_widget_set_sensitive (priv->end_timezone, !read_only); - gtk_widget_set_sensitive (priv->all_day_event, !read_only); - gtk_widget_set_sensitive (priv->description, !read_only); - gtk_widget_set_sensitive (priv->classification, !read_only); - gtk_widget_set_sensitive (priv->show_time_as_busy, !read_only); - gtk_widget_set_sensitive (priv->alarm, !read_only); - gtk_widget_set_sensitive (priv->alarm_time, !read_only && !custom && alarm); - gtk_widget_set_sensitive (priv->alarm_custom, !read_only && alarm); - if (custom) - gtk_widget_show (priv->alarm_warning); - else - gtk_widget_hide (priv->alarm_warning); - gtk_widget_set_sensitive (priv->categories_btn, !read_only); - gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only); -} - -/* fill_widgets handler for the event page */ -static gboolean -event_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) -{ - EventPage *epage; - EventPagePrivate *priv; - ECalComponentText text; - ECalComponentClassification cl; - ECalComponentTransparency transparency; - ECalComponentDateTime start_date, end_date; - const char *location; - const char *categories; - ESource *source; - GSList *l; - gboolean validated = TRUE; - - g_return_val_if_fail (page->client != NULL, FALSE); - - 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) */ - - e_cal_component_get_summary (comp, &text); - e_dialog_editable_set (priv->summary, text.value); - priv->old_summary = g_strdup (text.value); - - e_cal_component_get_location (comp, &location); - e_dialog_editable_set (priv->location, location); - - e_cal_component_get_description_list (comp, &l); - if (l && l->data) { - ECalComponentText *dtext; - - dtext = l->data; - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)), - dtext->value ? dtext->value : "", -1); - } - e_cal_component_free_text_list (l); - - /* Start and end times */ - - e_cal_component_get_dtstart (comp, &start_date); - e_cal_component_get_dtend (comp, &end_date); - if (!start_date.value) { - comp_editor_page_display_validation_error (page, _("Event with no start date"), priv->start_time); - validated = FALSE; - } else if (!end_date.value) { - comp_editor_page_display_validation_error (page, _("Event with no end date"), priv->end_time); - validated = FALSE; - } else - update_time (epage, &start_date, &end_date); - - e_cal_component_free_datetime (&start_date); - e_cal_component_free_datetime (&end_date); - - /* Classification */ - e_cal_component_get_classification (comp, &cl); - - switch (cl) { - case E_CAL_COMPONENT_CLASS_PUBLIC: - case E_CAL_COMPONENT_CLASS_PRIVATE: - case E_CAL_COMPONENT_CLASS_CONFIDENTIAL: - break; - default: - cl = E_CAL_COMPONENT_CLASS_PUBLIC; - break; - } - e_dialog_option_menu_set (priv->classification, cl, classification_map); - - /* Show Time As (Transparency) */ - e_cal_component_get_transparency (comp, &transparency); - switch (transparency) { - case E_CAL_COMPONENT_TRANSP_TRANSPARENT: - e_dialog_toggle_set (priv->show_time_as_busy, FALSE); - break; - - default: - e_dialog_toggle_set (priv->show_time_as_busy, TRUE); - break; - } - if (e_cal_get_static_capability (page->client, CAL_STATIC_CAPABILITY_NO_TRANSPARENCY)) - gtk_widget_hide (priv->show_time_as_busy); - else - gtk_widget_show (priv->show_time_as_busy); - - /* Alarms */ - g_signal_handlers_block_matched (priv->alarm, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); - if (e_cal_component_has_alarms (comp)) { - GList *alarms, *l; - int alarm_type; - - e_dialog_toggle_set (priv->alarm, TRUE); - - alarms = e_cal_component_get_alarm_uids (comp); - if (!is_custom_alarm_uid_list (comp, alarms, priv->old_summary, priv->alarm_units, priv->alarm_interval, &alarm_type)) - e_dialog_option_menu_set (priv->alarm_time, alarm_type, alarm_map); - - for (l = alarms; l != NULL; l = l->next) { - ECalComponentAlarm *ca; - - ca = e_cal_component_get_alarm (comp, l->data); - e_alarm_list_append (priv->alarm_list_store, NULL, ca); - e_cal_component_alarm_free (ca); - } - - cal_obj_uid_list_free (alarms); - } else { - e_dialog_toggle_set (priv->alarm, FALSE); - e_dialog_option_menu_set (priv->alarm_time, priv->alarm_interval == -1 ? ALARM_15_MINUTES : ALARM_USER_TIME, alarm_map); - } - g_signal_handlers_unblock_matched (priv->alarm, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); - - /* Categories */ - e_cal_component_get_categories (comp, &categories); - e_dialog_editable_set (priv->categories, categories); - - /* Source */ - source = e_cal_get_source (page->client); - e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), source); - - priv->updating = FALSE; - - sensitize_widgets (epage); - - return validated; -} - -/* fill_component handler for the event page */ -static gboolean -event_page_fill_component (CompEditorPage *page, ECalComponent *comp) -{ - EventPage *epage; - EventPagePrivate *priv; - ECalComponentDateTime start_date, end_date; - struct icaltimetype start_tt, end_tt; - gboolean all_day_event, start_date_set, end_date_set, busy; - char *cat, *str; - ECalComponentClassification classif; - GtkTextBuffer *text_buffer; - GtkTextIter text_iter_start, text_iter_end; - - epage = EVENT_PAGE (page); - priv = epage->priv; - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)); - - /* Summary */ - - str = e_dialog_editable_get (priv->summary); - if (!str || strlen (str) == 0) - e_cal_component_set_summary (comp, NULL); - else { - ECalComponentText text; - - text.value = str; - text.altrep = NULL; - - e_cal_component_set_summary (comp, &text); - } - - if (str) - g_free (str); - - /* Location */ - - str = e_dialog_editable_get (priv->location); - if (!str || strlen (str) == 0) - e_cal_component_set_location (comp, NULL); - else - e_cal_component_set_location (comp, str); - - if (str) - g_free (str); - - /* Description */ - - gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start); - gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end); - str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE); - - if (!str || strlen (str) == 0) - e_cal_component_set_description_list (comp, NULL); - else { - GSList l; - ECalComponentText text; - - text.value = str; - text.altrep = NULL; - l.data = &text; - l.next = NULL; - - e_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; - - if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->start_time))) { - comp_editor_page_display_validation_error (page, _("Start date is wrong"), priv->start_time); - return FALSE; - } - 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); - - if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->end_time))) { - comp_editor_page_display_validation_error (page, _("End date is wrong"), priv->end_time); - return FALSE; - } - 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; - - if (!e_date_edit_time_is_valid (E_DATE_EDIT (priv->start_time))) { - comp_editor_page_display_validation_error (page, _("Start time is wrong"), priv->start_time); - return FALSE; - } - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_time), - &start_tt.hour, - &start_tt.minute); - if (!e_date_edit_time_is_valid (E_DATE_EDIT (priv->end_time))) { - comp_editor_page_display_validation_error (page, _("End time is wrong"), priv->end_time); - return FALSE; - } - 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); - } - - e_cal_component_set_dtstart (comp, &start_date); - e_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); - - e_cal_component_set_categories (comp, str); - - if (str) - g_free (str); - - /* Classification */ - classif = e_dialog_option_menu_get (priv->classification, classification_map); - e_cal_component_set_classification (comp, classif); - - /* Show Time As (Transparency) */ - busy = e_dialog_toggle_get (priv->show_time_as_busy); - e_cal_component_set_transparency (comp, busy ? E_CAL_COMPONENT_TRANSP_OPAQUE : E_CAL_COMPONENT_TRANSP_TRANSPARENT); - - /* Alarm */ - e_cal_component_remove_all_alarms (comp); - if (e_dialog_toggle_get (priv->alarm)) { - if (is_custom_alarm_store (priv->alarm_list_store, priv->old_summary, priv->alarm_units, priv->alarm_interval, NULL)) { - GtkTreeModel *model; - GtkTreeIter iter; - gboolean valid_iter; - - model = GTK_TREE_MODEL (priv->alarm_list_store); - - for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter; - valid_iter = gtk_tree_model_iter_next (model, &iter)) { - ECalComponentAlarm *alarm, *alarm_copy; - icalcomponent *icalcomp; - icalproperty *icalprop; - - alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (priv->alarm_list_store, &iter); - g_assert (alarm != NULL); - - /* We set the description of the alarm if it's got - * the X-EVOLUTION-NEEDS-DESCRIPTION property. - */ - icalcomp = e_cal_component_alarm_get_icalcomponent (alarm); - icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY); - while (icalprop) { - const char *x_name; - ECalComponentText summary; - - x_name = icalproperty_get_x_name (icalprop); - if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) { - e_cal_component_get_summary (comp, &summary); - e_cal_component_alarm_set_description (alarm, &summary); - - icalcomponent_remove_property (icalcomp, icalprop); - break; - } - - icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY); - } - - /* We clone the alarm to maintain the invariant that the alarm - * structures in the list did *not* come from the component. - */ - - alarm_copy = e_cal_component_alarm_clone (alarm); - e_cal_component_add_alarm (comp, alarm_copy); - e_cal_component_alarm_free (alarm_copy); - } - } else { - ECalComponentAlarm *ca; - ECalComponentText summary; - ECalComponentAlarmTrigger trigger; - int alarm_type; - - ca = e_cal_component_alarm_new (); - - e_cal_component_get_summary (comp, &summary); - e_cal_component_alarm_set_description (ca, &summary); - - e_cal_component_alarm_set_action (ca, E_CAL_COMPONENT_ALARM_DISPLAY); - - memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger)); - trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; - trigger.u.rel_duration.is_neg = 1; - - alarm_type = e_dialog_option_menu_get (priv->alarm_time, alarm_map); - switch (alarm_type) { - case ALARM_15_MINUTES: - trigger.u.rel_duration.minutes = 15; - break; - - case ALARM_1_HOUR: - trigger.u.rel_duration.hours = 1; - break; - - case ALARM_1_DAY: - trigger.u.rel_duration.days = 1; - break; - - case ALARM_USER_TIME: - switch (calendar_config_get_default_reminder_units ()) { - case CAL_DAYS: - trigger.u.rel_duration.days = priv->alarm_interval; - break; - - case CAL_HOURS: - trigger.u.rel_duration.hours = priv->alarm_interval; - break; - - case CAL_MINUTES: - trigger.u.rel_duration.minutes = priv->alarm_interval; - break; - } - break; - - default: - break; - } - e_cal_component_alarm_set_trigger (ca, trigger); - - e_cal_component_add_alarm (comp, ca); - } - } - - return TRUE; -} - -/* fill_timezones handler for the event page */ -static gboolean -event_page_fill_timezones (CompEditorPage *page, GHashTable *timezones) -{ - EventPage *epage; - EventPagePrivate *priv; - icaltimezone *zone; - - epage = EVENT_PAGE (page); - priv = epage->priv; - - /* add start date timezone */ - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - if (zone) { - if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); - } - - /* add end date timezone */ - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone)); - if (zone) { - if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); - } - - 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 (G_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - - priv->summary = GW ("summary"); - priv->summary_label = GW ("summary-label"); - priv->location = GW ("location"); - priv->location_label = GW ("location-label"); - - /* Glade's visibility flag doesn't seem to work for custom widgets */ - priv->start_time = GW ("start-time"); - gtk_widget_show (priv->start_time); - priv->end_time = GW ("end-time"); - gtk_widget_show (priv->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 = GW ("classification"); - - priv->show_time_as_busy = GW ("show-time-as-busy"); - - priv->alarm = GW ("alarm"); - priv->alarm_time = GW ("alarm-time"); - priv->alarm_warning = GW ("alarm-warning"); - priv->alarm_custom = GW ("alarm-custom"); - - priv->categories_btn = GW ("categories-button"); - priv->categories = GW ("categories"); - - priv->source_selector = GW ("source"); - -#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 - && priv->show_time_as_busy - && priv->alarm - && priv->alarm_time - && priv->alarm_warning - && priv->alarm_custom - && 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; - ECalComponentDateTime 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) { - g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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); - g_signal_handlers_unblock_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); - } - - if (set_end_date) { - g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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); - g_signal_handlers_unblock_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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 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)); -} - -static void -source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - if (!priv->updating) { - ECal *client; - - client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT); - if (!client || !e_cal_open (client, FALSE, NULL)) { - GtkWidget *dialog; - - if (client) - g_object_unref (client); - - e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), - e_cal_get_source (COMP_EDITOR_PAGE (epage)->client)); - - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open the calendar '%s'."), - e_source_peek_name (source)); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - } else { - icaltimezone *zone; - - zone = calendar_config_get_icaltimezone (); - e_cal_set_default_timezone (client, zone, NULL); - - comp_editor_notify_client_changed ( - COMP_EDITOR (gtk_widget_get_toplevel (priv->main)), - client); - sensitize_widgets (epage); - } - } -} - -static void -alarm_changed_cb (GtkWidget *widget, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - if (e_dialog_toggle_get (priv->alarm)) { - ECalComponentAlarm *ca; - ECalComponentAlarmTrigger trigger; - icalcomponent *icalcomp; - icalproperty *icalprop; - int alarm_type; - - ca = e_cal_component_alarm_new (); - - e_cal_component_alarm_set_action (ca, E_CAL_COMPONENT_ALARM_DISPLAY); - - memset (&trigger, 0, sizeof (ECalComponentAlarmTrigger)); - trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; - trigger.u.rel_duration.is_neg = 1; - - alarm_type = e_dialog_option_menu_get (priv->alarm_time, alarm_map); - switch (alarm_type) { - case ALARM_15_MINUTES: - trigger.u.rel_duration.minutes = 15; - break; - - case ALARM_1_HOUR: - trigger.u.rel_duration.hours = 1; - break; - - case ALARM_1_DAY: - trigger.u.rel_duration.days = 1; - break; - - case ALARM_USER_TIME: - switch (calendar_config_get_default_reminder_units ()) { - case CAL_DAYS: - trigger.u.rel_duration.days = priv->alarm_interval; - break; - - case CAL_HOURS: - trigger.u.rel_duration.hours = priv->alarm_interval; - break; - - case CAL_MINUTES: - trigger.u.rel_duration.minutes = priv->alarm_interval; - break; - } - break; - - default: - break; - } - e_cal_component_alarm_set_trigger (ca, trigger); - - icalcomp = e_cal_component_alarm_get_icalcomponent (ca); - icalprop = icalproperty_new_x ("1"); - icalproperty_set_x_name (icalprop, "X-EVOLUTION-NEEDS-DESCRIPTION"); - icalcomponent_add_property (icalcomp, icalprop); - - e_alarm_list_append (priv->alarm_list_store, NULL, ca); - } else { - e_alarm_list_clear (priv->alarm_list_store); - } - - sensitize_widgets (epage); -} - -static void -alarm_custom_clicked_cb (GtkWidget *widget, gpointer data) -{ - EventPage *epage; - EventPagePrivate *priv; - EAlarmList *temp_list_store; - GtkTreeModel *model; - GtkTreeIter iter; - gboolean valid_iter; - GtkWidget *toplevel; - - epage = EVENT_PAGE (data); - priv = epage->priv; - - /* Make a copy of the list store in case the user cancels */ - temp_list_store = e_alarm_list_new (); - model = GTK_TREE_MODEL (priv->alarm_list_store); - - for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter; - valid_iter = gtk_tree_model_iter_next (model, &iter)) { - ECalComponentAlarm *alarm; - - alarm = (ECalComponentAlarm *) e_alarm_list_get_alarm (priv->alarm_list_store, &iter); - g_assert (alarm != NULL); - - e_alarm_list_append (temp_list_store, NULL, alarm); - } - - toplevel = gtk_widget_get_toplevel (priv->main); - if (alarm_list_dialog_run (toplevel, COMP_EDITOR_PAGE (epage)->client, temp_list_store)) { - g_object_unref (priv->alarm_list_store); - priv->alarm_list_store = temp_list_store; - - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage)); - } else { - g_object_unref (temp_list_store); - } - - /* If the user erases everything, uncheck the alarm toggle */ - valid_iter = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->alarm_list_store), &iter); - if (!valid_iter) - e_dialog_toggle_set (priv->alarm, FALSE); - - sensitize_widgets (epage); -} - -/* Hooks the widget signals */ -static gboolean -init_widgets (EventPage *epage) -{ - EventPagePrivate *priv; - GtkTextBuffer *text_buffer; - icaltimezone *zone; - char *menu_label = NULL; - - 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 */ - g_signal_connect((priv->summary), "changed", - G_CALLBACK (summary_changed_cb), epage); - - /* Description */ - text_buffer = gtk_text_buffer_new (NULL); - gtk_text_view_set_buffer (GTK_TEXT_VIEW (priv->description), text_buffer); - g_object_unref (text_buffer); - - gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->description), GTK_WRAP_WORD); - - /* Start and end times */ - g_signal_connect((priv->start_time), "changed", - G_CALLBACK (date_changed_cb), epage); - g_signal_connect((priv->end_time), "changed", - G_CALLBACK (date_changed_cb), epage); - - g_signal_connect((priv->start_timezone), "changed", - G_CALLBACK (start_timezone_changed_cb), epage); - g_signal_connect((priv->end_timezone), "changed", - G_CALLBACK (end_timezone_changed_cb), epage); - - g_signal_connect((priv->all_day_event), "toggled", - G_CALLBACK (all_day_event_toggled_cb), epage); - - /* Categories button */ - g_signal_connect((priv->categories_btn), "clicked", - G_CALLBACK (categories_clicked_cb), epage); - - /* Source selector */ - g_signal_connect((priv->source_selector), "source_selected", - G_CALLBACK (source_changed_cb), epage); - - /* Alarms */ - priv->alarm_list_store = e_alarm_list_new (); - - /* Add the user defined time if necessary */ - priv->alarm_units = calendar_config_get_default_reminder_units (); - priv->alarm_interval = calendar_config_get_default_reminder_interval (); - - switch (priv->alarm_units) { - case CAL_DAYS: - if (priv->alarm_interval != 1) { - menu_label = g_strdup_printf (ngettext("%d day before appointment", "%d days before appointment", priv->alarm_interval), priv->alarm_interval); - } else { - priv->alarm_interval = -1; - } - break; - - case CAL_HOURS: - if (priv->alarm_interval != 1) { - menu_label = g_strdup_printf (ngettext("%d hour before appointment", "%d hours before appointment", priv->alarm_interval), priv->alarm_interval); - } else { - priv->alarm_interval = -1; - } - break; - - case CAL_MINUTES: - if (priv->alarm_interval != 15) { - menu_label = g_strdup_printf (ngettext("%d minute before appointement", "%d minutes before appointment", priv->alarm_interval), priv->alarm_interval); - } else { - priv->alarm_interval = -1; - } - break; - } - - if (menu_label) { - GtkWidget *item, *menu; - - item = gtk_menu_item_new_with_label (menu_label); - gtk_widget_show (item); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->alarm_time)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - } - - g_signal_connect (priv->alarm, - "toggled", G_CALLBACK (alarm_changed_cb), - epage); - g_signal_connect (priv->alarm_custom, "clicked", - G_CALLBACK (alarm_custom_clicked_cb), epage); - - /* Connect the default signal handler to use to make sure we notify - * upstream of changes to the widget values. - */ - - /* Belongs to priv->description */ - g_signal_connect((text_buffer), "changed", - G_CALLBACK (field_changed_cb), epage); - - g_signal_connect((priv->summary), "changed", - G_CALLBACK (field_changed_cb), epage); - g_signal_connect((priv->location), "changed", - G_CALLBACK (field_changed_cb), epage); - g_signal_connect((priv->start_time), "changed", - G_CALLBACK (field_changed_cb), epage); - g_signal_connect((priv->end_time), "changed", - G_CALLBACK (field_changed_cb), epage); - g_signal_connect((priv->start_timezone), "changed", - G_CALLBACK (field_changed_cb), epage); - g_signal_connect((priv->end_timezone), "changed", - G_CALLBACK (field_changed_cb), epage); - g_signal_connect((priv->all_day_event), "toggled", - G_CALLBACK (field_changed_cb), epage); - g_signal_connect((priv->classification), - "changed", G_CALLBACK (field_changed_cb), - epage); - g_signal_connect((priv->show_time_as_busy), - "toggled", G_CALLBACK (field_changed_cb), - epage); - g_signal_connect((priv->alarm), - "toggled", G_CALLBACK (field_changed_cb), - epage); - g_signal_connect((priv->alarm_time), - "changed", G_CALLBACK (field_changed_cb), - epage); - g_signal_connect((priv->categories), "changed", - G_CALLBACK (field_changed_cb), epage); - - /* Set the default timezone, so the timezone entry may be hidden. */ - zone = calendar_config_get_icaltimezone (); - 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, 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 = g_object_new (TYPE_EVENT_PAGE, NULL); - if (!event_page_construct (epage)) { - g_object_unref (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) -{ - GtkWidget *w; - - w = e_timezone_entry_new (); - gtk_widget_show (w); - return w; -} - -GtkWidget *event_page_create_source_option_menu (void); - -GtkWidget * -event_page_create_source_option_menu (void) -{ - GtkWidget *menu; - GConfClient *gconf_client; - ESourceList *source_list; - - gconf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources"); - - menu = e_source_option_menu_new (source_list); - g_object_unref (source_list); - - gtk_widget_show (menu); - return menu; -} diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade deleted file mode 100644 index 24bc132c00..0000000000 --- a/calendar/gui/dialogs/event-page.glade +++ /dev/null @@ -1,829 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="event-toplevel"> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="event-page"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label66"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Basics</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox56"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label67"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table11"> - <property name="visible">True</property> - <property name="n_rows">5</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="summary-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">Su_mmary:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">summary</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="summary"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="location-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">Locat_ion:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">location</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="location"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow12"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="description"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="overwrite">False</property> - <property name="accepts_tab">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label69"> - <property name="visible">True</property> - <property name="label" translatable="yes">Classi_fication:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">classification</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox57"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkOptionMenu" id="classification"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child> - <widget class="GtkMenu" id="menu1"> - - <child> - <widget class="GtkMenuItem" id="public1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Public</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="private1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Private</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="confidential1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Confidential</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label65"> - <property name="visible">True</property> - <property name="label" translatable="yes">Cale_ndar:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">source</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="Custom" id="source"> - <property name="visible">True</property> - <property name="creation_function">event_page_create_source_option_menu</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Wed, 17 Dec 2003 18:20:26 GMT</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="categories-button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Ca_tegories...</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="categories"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label68"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Description:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">7.45058e-09</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">description</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label70"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Date and Time</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox58"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label71"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table12"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="n_rows">4</property> - <property name="n_columns">4</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="Custom" id="start-time"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="creation_function">make_date_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 16 May 2000 19:11:05 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="end-time"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="creation_function">make_date_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 16 May 2000 19:11:10 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="end-timezone"> - <property name="visible">True</property> - <property name="creation_function">make_timezone_entry</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Mon, 18 Jun 2001 23:51:40 GMT</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options"></property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label57"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Start time:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">start-time</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label58"> - <property name="visible">True</property> - <property name="label" translatable="yes">_End time:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">end-time</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="all-day-event"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">A_ll day event</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="start-timezone"> - <property name="visible">True</property> - <property name="creation_function">make_timezone_entry</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Mon, 18 Jun 2001 23:51:34 GMT</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options"></property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="show-time-as-busy"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Show time as _busy</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">3</property> - <property name="right_attach">4</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="alarm"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Alarm</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox50"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkOptionMenu" id="alarm-time"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child> - <widget class="GtkMenu" id="menu2"> - - <child> - <widget class="GtkMenuItem" id="15_minutes_before_appointment1"> - <property name="visible">True</property> - <property name="label" translatable="yes">15 minutes before appointment</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="1_hour_before_appointment1"> - <property name="visible">True</property> - <property name="label" translatable="yes">1 hour before appointment</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="1_day_before_appointment1"> - <property name="visible">True</property> - <property name="label" translatable="yes">1 day before appointment</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="alarm-custom"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox59"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-preferences</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label72"> - <property name="visible">True</property> - <property name="label" translatable="yes">C_ustomize...</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">4</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="alarm-warning"> - <property name="label" translatable="yes">This appointment has customized alarms</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h deleted file mode 100644 index a21f084e01..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" - -G_BEGIN_DECLS - - - -#define TYPE_EVENT_PAGE (event_page_get_type ()) -#define EVENT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_EVENT_PAGE, EventPage)) -#define EVENT_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_EVENT_PAGE, EventPageClass)) -#define IS_EVENT_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_EVENT_PAGE)) -#define IS_EVENT_PAGE_CLASS(klass) (G_TYPE_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); - - - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c deleted file mode 100644 index b72bee0f75..0000000000 --- a/calendar/gui/dialogs/meeting-page.c +++ /dev/null @@ -1,996 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* 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/gtkcombo.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtkwindow.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <libgnomeui/gnome-stock-icons.h> -#include <gal/util/e-util.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-utils.h> -#include <e-util/e-dialog-widgets.h> - -#include "../calendar-component.h" -#include "../e-meeting-attendee.h" -#include "../e-meeting-store.h" -#include "../e-meeting-list-view.h" -#include "../itip-utils.h" -#include "comp-editor-util.h" -#include "e-delegate-dialog.h" -#include "meeting-page.h" - - -/* Private part of the MeetingPage structure */ -struct _MeetingPagePrivate { - /* Lists of attendees */ - GPtrArray *deleted_attendees; - - /* To use in case of cancellation */ - ECalComponent *comp; - - /* List of identities */ - EAccountList *accounts; - EMeetingAttendee *ia; - char *default_address; - - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - GtkWidget *main; - GtkWidget *list_box; - GtkWidget *organizer_table; - GtkWidget *organizer; - GtkWidget *existing_organizer_table; - GtkWidget *existing_organizer; - GtkWidget *existing_organizer_btn; - GtkWidget *add; - GtkWidget *remove; - GtkWidget *invite; - GtkWidget *att_label; - - /* ListView stuff */ - EMeetingStore *model; - EMeetingListView *list_view; - gint row; - - /* For handling who the organizer is */ - gboolean user_org; - gboolean existing; - - gboolean updating; -}; - - - -static void meeting_page_class_init (MeetingPageClass *class); -static void meeting_page_init (MeetingPage *mpage); -static void meeting_page_finalize (GObject *object); - -static GtkWidget *meeting_page_get_widget (CompEditorPage *page); -static void meeting_page_focus_main_widget (CompEditorPage *page); -static gboolean meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); -static gboolean meeting_page_fill_component (CompEditorPage *page, ECalComponent *comp); - -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. - **/ - -E_MAKE_TYPE (meeting_page, "MeetingPage", MeetingPage, meeting_page_class_init, meeting_page_init, - TYPE_COMP_EDITOR_PAGE); - -/* Class initialization function for the task page */ -static void -meeting_page_class_init (MeetingPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GObjectClass *) class; - - parent_class = g_type_class_ref (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->finalize = meeting_page_finalize; -} - -/* 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->accounts = NULL; - priv->ia = NULL; - priv->default_address = NULL; - - priv->xml = NULL; - priv->main = NULL; - priv->invite = NULL; - - priv->model = NULL; - priv->list_view = NULL; - - priv->updating = FALSE; -} - -static EAccount * -get_current_account (MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - EIterator *it; - const char *str; - - priv = mpage->priv; - - str = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry)); - if (!str) - return NULL; - - for (it = e_list_get_iterator((EList *)priv->accounts); e_iterator_is_valid(it); e_iterator_next(it)) { - EAccount *a = (EAccount *)e_iterator_get(it); - char *full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); - - if (!strcmp (full, str)) { - g_free (full); - g_object_unref (it); - - return a; - } - - g_free (full); - } - g_object_unref (it); - - return NULL; -} - -static void -set_attendees (ECalComponent *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); - ECalComponentAttendee *ca; - - ca = e_meeting_attendee_as_e_cal_component_attendee (ia); - - comp_attendees = g_slist_prepend (comp_attendees, ca); - - } - comp_attendees = g_slist_reverse (comp_attendees); - e_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++) - g_object_unref (g_ptr_array_index (attendees, i)); -} - -/* Destroy handler for the task page */ -static void -meeting_page_finalize (GObject *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) - g_object_unref (priv->comp); - - cleanup_attendees (priv->deleted_attendees); - g_ptr_array_free (priv->deleted_attendees, TRUE); - - if (priv->ia != NULL) - g_object_unref (priv->ia); - - g_object_unref (priv->model); - - if (priv->main) - gtk_widget_unref (priv->main); - - if (priv->xml) { - g_object_unref (priv->xml); - priv->xml = NULL; - } - - if (priv->default_address) { - g_free (priv->default_address); - priv->default_address = NULL; - } - - g_free (priv); - mpage->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (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), priv->default_address); - gtk_label_set_text (GTK_LABEL (priv->existing_organizer), _("None")); - - gtk_widget_show (priv->organizer_table); - gtk_widget_hide (priv->existing_organizer_table); - - priv->existing = FALSE; - priv->user_org = TRUE; -} - -static void -sensitize_widgets (MeetingPage *mpage) -{ - gboolean read_only, user_org; - MeetingPagePrivate *priv = mpage->priv; - - if (!e_cal_is_read_only (COMP_EDITOR_PAGE (mpage)->client, &read_only, NULL)) - read_only = TRUE; - - gtk_widget_set_sensitive (priv->organizer, !read_only); - gtk_widget_set_sensitive (priv->existing_organizer_btn, !read_only); - gtk_widget_set_sensitive (priv->add, !read_only && priv->user_org); - gtk_widget_set_sensitive (priv->remove, !read_only && priv->user_org); - gtk_widget_set_sensitive (priv->invite, !read_only && priv->user_org); - gtk_widget_set_sensitive (GTK_WIDGET (priv->list_view), !read_only); -} - -/* fill_widgets handler for the meeting page */ -static gboolean -meeting_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - ECalComponentOrganizer organizer; - - mpage = MEETING_PAGE (page); - priv = mpage->priv; - - priv->updating = TRUE; - - /* Clean out old data */ - if (priv->comp != NULL) - g_object_unref (priv->comp); - priv->comp = NULL; - - cleanup_attendees (priv->deleted_attendees); - g_ptr_array_set_size (priv->deleted_attendees, 0); - - /* Clean the screen */ - clear_widgets (mpage); - - /* Component for cancellation */ - priv->comp = e_cal_component_clone (comp); - - /* If there is an existing organizer show it properly */ - if (e_cal_component_has_organizer (comp)) { - e_cal_component_get_organizer (comp, &organizer); - if (organizer.value != NULL) { - const gchar *strip = itip_strip_mailto (organizer.value); - gchar *string; - - gtk_widget_hide (priv->organizer_table); - gtk_widget_show (priv->existing_organizer_table); - if (itip_organizer_is_user (comp, page->client)) { - gtk_widget_set_sensitive (priv->invite, TRUE); - gtk_widget_set_sensitive (priv->add, TRUE); - gtk_widget_set_sensitive (priv->remove, TRUE); - if (e_cal_get_static_capability ( - page->client, - CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) - gtk_widget_hide (priv->existing_organizer_btn); - priv->user_org = TRUE; - } else { - if (e_cal_get_static_capability ( - page->client, - CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) - gtk_widget_hide (priv->existing_organizer_btn); - gtk_widget_set_sensitive (priv->invite, FALSE); - gtk_widget_set_sensitive (priv->add, FALSE); - gtk_widget_set_sensitive (priv->remove, FALSE); - priv->user_org = FALSE; - } - - if (organizer.cn != NULL) - string = g_strdup_printf ("%s <%s>", organizer.cn, strip); - else - string = g_strdup (strip); - gtk_label_set_text (GTK_LABEL (priv->existing_organizer), string); - g_free (string); - - priv->existing = TRUE; - } - } else { - EAccount *a; - - a = get_current_account (mpage); - if (a != NULL) { - priv->ia = e_meeting_store_add_attendee_with_defaults (priv->model); - g_object_ref (priv->ia); - - e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address)); - e_meeting_attendee_set_cn (priv->ia, g_strdup (a->id->name)); - e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_ACCEPTED); - } - } - - priv->updating = FALSE; - - sensitize_widgets (mpage); - - return TRUE; -} - -/* fill_component handler for the meeting page */ -static gboolean -meeting_page_fill_component (CompEditorPage *page, ECalComponent *comp) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; - - mpage = MEETING_PAGE (page); - priv = mpage->priv; - - if (!priv->existing) { - EAccount *a; - gchar *addr = NULL; - - /* Find the identity for the organizer or sentby field */ - a = get_current_account (mpage); - - /* Sanity Check */ - if (a == NULL) { - e_notice (page, GTK_MESSAGE_ERROR, - _("The organizer selected no longer has an account.")); - return FALSE; - } - - if (a->id->address == NULL || strlen (a->id->address) == 0) { - e_notice (page, GTK_MESSAGE_ERROR, - _("An organizer is required.")); - return FALSE; - } - - addr = g_strdup_printf ("MAILTO:%s", a->id->address); - - organizer.value = addr; - organizer.cn = a->id->name; - e_cal_component_set_organizer (comp, &organizer); - - g_free (addr); - } - - if (e_meeting_store_count_actual_attendees (priv->model) < 1) { - e_notice (page, GTK_MESSAGE_ERROR, - _("At least one attendee is required.")); - return FALSE; - } - set_attendees (comp, e_meeting_store_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; - - priv->list_box = GW ("list-box"); - - /* 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 (G_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - - /* For making the user the organizer */ - priv->organizer_table = GW ("organizer-table"); - priv->organizer = GW ("organizer"); - gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), FALSE, FALSE); - gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (priv->organizer)->entry), FALSE); - - /* For showing existing organizers */ - priv->existing_organizer_table = GW ("existing-organizer-table"); - priv->existing_organizer = GW ("existing-organizer"); - priv->existing_organizer_btn = GW ("existing-organizer-button"); - - /* Buttons */ - priv->add = GW ("add-attendee"); - priv->remove = GW ("remove-attendee"); - priv->invite = GW ("invite"); - - /* Attendees Label */ - priv->att_label = GW ("attendees-label"); - -#undef GW - - return (priv->list_box - && priv->att_label - && priv->invite - && priv->add - && priv->remove - && priv->organizer_table - && priv->organizer - && priv->existing_organizer_table - && priv->existing_organizer - && priv->existing_organizer_btn); -} - -static void -org_changed_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage; - MeetingPagePrivate *priv; - - mpage = MEETING_PAGE (data); - priv = mpage->priv; - - if (priv->updating) - return; - - if (!priv->existing && priv->ia != NULL) { - EAccount *a; - - a = get_current_account (mpage); - if (a != NULL) { - e_meeting_attendee_set_address (priv->ia, g_strdup_printf ("MAILTO:%s", a->id->address)); - e_meeting_attendee_set_cn (priv->ia, g_strdup (a->id->name)); - - if (!e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_address (priv->ia), NULL)) - e_meeting_store_add_attendee (priv->model, priv->ia); - } else { - e_meeting_store_remove_attendee (priv->model, priv->ia); - } - } - - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); -} - -/* 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_set_sensitive (priv->invite, TRUE); - gtk_widget_set_sensitive (priv->add, TRUE); - gtk_widget_set_sensitive (priv->remove, TRUE); - - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (mpage)); - - priv->existing = FALSE; - priv->user_org = TRUE; -} - -static void -add_clicked_cb (GtkButton *btn, MeetingPage *mpage) -{ - EMeetingAttendee *attendee; - - attendee = e_meeting_store_add_attendee_with_defaults (mpage->priv->model); - e_meeting_list_view_edit (mpage->priv->list_view, attendee); -} - -static gboolean -existing_attendee (EMeetingAttendee *ia, ECalComponent *comp) -{ - GSList *attendees, *l; - const gchar *ia_address; - - ia_address = itip_strip_mailto (e_meeting_attendee_get_address (ia)); - if (!ia_address) - return FALSE; - - e_cal_component_get_attendee_list (comp, &attendees); - - for (l = attendees; l; l = l->next) { - ECalComponentAttendee *attendee = l->data; - const char *address; - - address = itip_strip_mailto (attendee->value); - if (address && !g_strcasecmp (ia_address, address)) - return TRUE; - } - - e_cal_component_free_attendee_list (attendees); - - return FALSE; -} - -static void -remove_attendee (MeetingPage *mpage, EMeetingAttendee *ia) -{ - MeetingPagePrivate *priv; - int pos = 0; - - priv = mpage->priv; - - /* If the user deletes the organizer attendee explicitly, - assume they no longer want the organizer showing up */ - if (ia == priv->ia) { - g_object_unref (priv->ia); - priv->ia = NULL; - } - - /* If this was a delegatee, no longer delegate */ - if (e_meeting_attendee_is_set_delfrom (ia)) { - EMeetingAttendee *ib; - - ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delfrom (ia), &pos); - if (ib != NULL) { - e_meeting_attendee_set_delto (ib, NULL); - e_meeting_attendee_set_edit_level (ib, E_MEETING_ATTENDEE_EDIT_FULL); - } - } - - /* Handle deleting all attendees in the delegation chain */ - while (ia != NULL) { - EMeetingAttendee *ib = NULL; - - if (existing_attendee (ia, priv->comp)) { - g_object_ref (ia); - g_ptr_array_add (priv->deleted_attendees, ia); - } - - if (e_meeting_attendee_get_delto (ia) != NULL) - ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL); - e_meeting_store_remove_attendee (priv->model, ia); - - ia = ib; - } - - sensitize_widgets (mpage); -} - -static void -remove_attendee_at_row (MeetingPage *mpage, int row) -{ - MeetingPagePrivate *priv; - EMeetingAttendee *ia; - - priv = mpage->priv; - - ia = e_meeting_store_find_attendee_at_row (priv->model, row); - remove_attendee (mpage, ia); -} - -static void -remove_clicked_cb (GtkButton *btn, MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - EMeetingAttendee *ia; - GtkTreeSelection *selection; - GtkTreeIter iter; - GtkTreePath *path; - gboolean valid_iter; - char *address; - - priv = mpage->priv; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view)); - if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { - g_warning ("Could not get a selection to delete."); - return; - } - path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->model), &iter); - - gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1); - ia = e_meeting_store_find_attendee (priv->model, address, NULL); - g_free (address); - if (!ia) - return; - - remove_attendee (mpage, ia); - - /* Select closest item after removal */ - valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path); - if (!valid_iter) { - gtk_tree_path_prev (path); - valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path); - } - - if (valid_iter) - gtk_tree_selection_select_iter (selection, &iter); - - gtk_tree_path_free (path); -} - -/* 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_list_view_invite_others_dialog (priv->list_view); -} - -/* Hooks the widget signals */ -static void -init_widgets (MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - - priv = mpage->priv; - - /* Organizer */ - g_signal_connect (GTK_COMBO (priv->organizer)->entry, "changed", - G_CALLBACK (org_changed_cb), mpage); - - g_signal_connect (priv->existing_organizer_btn, "clicked", - G_CALLBACK (change_clicked_cb), mpage); - - /* Add attendee button */ - g_signal_connect (priv->add, "clicked", G_CALLBACK (add_clicked_cb), mpage); - - /* Remove attendee button */ - g_signal_connect (priv->remove, "clicked", G_CALLBACK (remove_clicked_cb), mpage); - - /* Contacts button */ - g_signal_connect(priv->invite, "clicked", G_CALLBACK (invite_cb), mpage); -} - -static void -client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) -{ - MeetingPage *mpage = MEETING_PAGE (page); - - sensitize_widgets (mpage); -} - -static void -popup_delete_cb (GtkWidget *widget, gpointer data) -{ - MeetingPage *mpage = MEETING_PAGE (data); - MeetingPagePrivate *priv; - - priv = mpage->priv; - - remove_attendee_at_row (mpage, priv->row); -} - -enum { - CAN_DELEGATE = 2, - CAN_DELETE = 4 -}; - -static EPopupMenu context_menu[] = { -#if 0 - E_POPUP_ITEM (N_("_Delegate To..."), G_CALLBACK (popup_delegate_cb), CAN_DELEGATE), - - E_POPUP_SEPARATOR, -#endif - E_POPUP_ITEM (N_("_Remove"), G_CALLBACK (popup_delete_cb), CAN_DELETE), - - E_POPUP_TERMINATOR -}; - -static gint -button_press_event (GtkWidget *widget, GdkEventButton *event, MeetingPage *mpage) -{ - MeetingPagePrivate *priv; - GtkMenu *menu; - EMeetingAttendee *ia; - GtkTreePath *path; - GtkTreeIter iter; - char *address; - int disable_mask = 0, hide_mask = 0; - - priv = mpage->priv; - - /* only process right-clicks */ - if (event->button != 3 || event->type != GDK_BUTTON_PRESS) - return FALSE; - - /* only if we right-click on an attendee */ - if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->list_view), event->x, event->y, &path, NULL, NULL, NULL)) - return FALSE; - if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path)) - return FALSE; - - gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1); - ia = e_meeting_store_find_attendee (priv->model, address, &priv->row); - g_free (address); - if (!ia) - return FALSE; - - if (e_meeting_attendee_get_edit_level (ia) != E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask = CAN_DELETE; - - /* FIXME: if you enable Delegate, then change index to '1'. - * (This has now been enabled). */ - /* context_menu[1].pixmap_widget = gnome_stock_new_with_icon (GNOME_STOCK_MENU_TRASH); */ - context_menu[0].pixmap_widget = - gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU); - - menu = e_popup_menu_create (context_menu, disable_mask, hide_mask, mpage); - e_auto_kill_popup_menu_on_selection_done (menu); - - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time); - - 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, EMeetingStore *ems, - ECal *client) -{ - MeetingPagePrivate *priv; - char *backend_address; - EIterator *it; - EAccount *def_account; - GList *address_strings = NULL, *l; - GtkWidget *sw; - - priv = mpage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR - "/meeting-page.glade", NULL, NULL); - if (!priv->xml) { - g_message (G_STRLOC ": Could not load the Glade XML file!"); - return NULL; - } - - if (!get_widgets (mpage)) { - g_message (G_STRLOC ": Could not find all widgets in the XML file!"); - return NULL; - } - - /* Address information */ - if (!e_cal_get_cal_address (client, &backend_address, NULL)) - return NULL; - - priv->accounts = itip_addresses_get (); - def_account = itip_addresses_get_default(); - for (it = e_list_get_iterator((EList *)priv->accounts); - e_iterator_is_valid(it); - e_iterator_next(it)) { - EAccount *a = (EAccount *)e_iterator_get(it); - char *full; - - full = g_strdup_printf("%s <%s>", a->id->name, a->id->address); - - address_strings = g_list_append(address_strings, full); - - /* Note that the address specified by the backend gets - * precedence over the default mail address. - */ - if (backend_address && !strcmp (backend_address, a->id->address)) { - if (priv->default_address) - g_free (priv->default_address); - - priv->default_address = g_strdup (full); - } else if (a == def_account && !priv->default_address) { - priv->default_address = g_strdup (full); - } - } - g_object_unref(it); - g_free (backend_address); - - if (address_strings) - gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), address_strings); - else - g_warning ("No potential organizers!"); - - for (l = address_strings; l != NULL; l = l->next) - g_free (l->data); - g_list_free (address_strings); - - /* The etable displaying attendees and their status */ - g_object_ref (ems); - priv->model = ems; - - priv->list_view = e_meeting_list_view_new (priv->model); - g_signal_connect (G_OBJECT (priv->list_view), "button_press_event", G_CALLBACK (button_press_event), mpage); - - gtk_widget_show (GTK_WIDGET (priv->list_view)); - sw = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); - gtk_widget_show (sw); - gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (priv->list_view)); - gtk_box_pack_start (GTK_BOX (priv->list_box), sw, TRUE, TRUE, 0); - - /* Set the mnemonic widget for the Attendees label */ - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->att_label), - priv->list_view); - - /* Init the widget signals */ - init_widgets (mpage); - - g_signal_connect_after (G_OBJECT (mpage), "client_changed", - G_CALLBACK (client_changed_cb), NULL); - - 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 (EMeetingStore *ems, ECal *client) -{ - MeetingPage *mpage; - - mpage = g_object_new (TYPE_MEETING_PAGE, NULL); - if (!meeting_page_construct (mpage, ems, client)) { - g_object_unref (mpage); - return NULL; - } - - return mpage; -} - -/** - * meeting_page_get_cancel_comp: - * @mpage: - * - * - * - * Return value: - **/ -ECalComponent * -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 e_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 ed347b2432..0000000000 --- a/calendar/gui/dialogs/meeting-page.glade +++ /dev/null @@ -1,375 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="meeting-toplevel"> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="meeting-page"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="organizer-table"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="label" translatable="yes">Or_ganizer:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">organizer-entry</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkCombo" id="organizer"> - <property name="visible">True</property> - <property name="value_in_list">True</property> - <property name="allow_empty">False</property> - <property name="case_sensitive">False</property> - <property name="enable_arrow_keys">True</property> - <property name="enable_arrows_always">False</property> - - <child internal-child="entry"> - <widget class="GtkEntry" id="organizer-entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - </child> - - <child internal-child="list"> - <widget class="GtkList" id="convertwidget1"> - <property name="visible">True</property> - <property name="selection_mode">GTK_SELECTION_BROWSE</property> - - <child> - <widget class="GtkListItem" id="convertwidget2"> - <property name="visible">True</property> - - <child> - <widget class="GtkLabel" id="convertwidget3"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="existing-organizer-table"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="label" translatable="yes">Organizer:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">organizer-entry</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="existing-organizer"> - <property name="visible">True</property> - <property name="label" translatable="yes">None</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="existing-organizer-button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">C_hange Organizer</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="attendees-label"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Att_endees</b></property> - <property name="use_underline">True</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="list-box"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="add-attendee"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-add</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="remove-attendee"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-remove</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="invite"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-jump-to</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Con_tacts...</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/meeting-page.h b/calendar/gui/dialogs/meeting-page.h deleted file mode 100644 index 95533cd771..0000000000 --- a/calendar/gui/dialogs/meeting-page.h +++ /dev/null @@ -1,67 +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-store.h" -#include "../itip-utils.h" -#include "comp-editor-page.h" - -G_BEGIN_DECLS - - - -#define TYPE_MEETING_PAGE (meeting_page_get_type ()) -#define MEETING_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MEETING_PAGE, MeetingPage)) -#define MEETING_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MEETING_PAGE, MeetingPageClass)) -#define IS_MEETING_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MEETING_PAGE)) -#define IS_MEETING_PAGE_CLASS(klass) (G_TYPE_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, - EMeetingStore *ems, - ECal *client); -MeetingPage *meeting_page_new (EMeetingStore *ems, - ECal *client); -ECalComponent *meeting_page_get_cancel_comp (MeetingPage *mpage); - - - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/new-calendar.glade b/calendar/gui/dialogs/new-calendar.glade deleted file mode 100644 index 0a136ed7c8..0000000000 --- a/calendar/gui/dialogs/new-calendar.glade +++ /dev/null @@ -1,239 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkDialog" id="new-calendar-dialog"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="title" translatable="yes">Add New Calendar</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER</property> - <property name="modal">False</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancelbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="okbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table1"> - <property name="visible">True</property> - <property name="n_rows">4</property> - <property name="n_columns">3</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Calendar Group</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="calendar-group"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">-1</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="calendar-name"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">6</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Calendar options</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_padding">6</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Calendar Name</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="calendar-source-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">Calendar Location</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="calendar-location"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_padding">6</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/new-task-list.glade b/calendar/gui/dialogs/new-task-list.glade deleted file mode 100644 index ffc38582c8..0000000000 --- a/calendar/gui/dialogs/new-task-list.glade +++ /dev/null @@ -1,193 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="new-task-list-dialog"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="title" translatable="yes">Add New Task List</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER</property> - <property name="modal">False</property> - <property name="resizable">False</property> - <property name="destroy_with_parent">False</property> - <property name="has_separator">True</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancelbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="okbutton1"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table1"> - <property name="visible">True</property> - <property name="n_rows">3</property> - <property name="n_columns">3</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Task List Group</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="task-list-group"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">-1</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_padding">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="task-list-name"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">6</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Task List Options</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_padding">6</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="label" translatable="yes">Task List Name</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_padding">6</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">4</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c deleted file mode 100644 index bd0d7a1080..0000000000 --- a/calendar/gui/dialogs/recur-comp.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Evolution calendar - Recurring calendar component dialog - * - * Copyright (C) 2002 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 <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-uidefs.h> -#include "recur-comp.h" - - - -gboolean -recur_component_dialog (ECal *client, - ECalComponent *comp, - CalObjModType *mod, - GtkWindow *parent) -{ - char *str; - GtkWidget *dialog, *rb_this, *rb_prior, *rb_future, *rb_all, *hbox; - GtkWidget *placeholder, *vbox; - ECalComponentVType vtype; - gboolean ret; - - g_return_val_if_fail (E_IS_CAL_COMPONENT (comp), FALSE); - - vtype = e_cal_component_get_vtype (comp); - - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - str = g_strdup_printf (_("You are modifying a recurring event, what would you like to modify?")); - break; - - case E_CAL_COMPONENT_TODO: - str = g_strdup_printf (_("You are modifying a recurring task, what would you like to modify?")); - break; - - case E_CAL_COMPONENT_JOURNAL: - str = g_strdup_printf (_("You are modifying a recurring journal entry, what would you like to modify?")); - break; - - default: - g_message ("recur_component_dialog(): Cannot handle object of type %d", vtype); - return FALSE; - } - - - dialog = gtk_message_dialog_new (parent, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", str); - g_free (str); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); - gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); - - hbox = gtk_hbox_new (FALSE, 12); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox); - - placeholder = gtk_label_new (""); - gtk_widget_set_size_request (placeholder, 48, 48); - gtk_box_pack_start (GTK_BOX (hbox), placeholder, FALSE, FALSE, 0); - gtk_widget_show (placeholder); - - vbox = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); - gtk_widget_show (vbox); - - rb_this = gtk_radio_button_new_with_label (NULL, _("This Instance Only")); - gtk_container_add (GTK_CONTAINER (vbox), rb_this); - - if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDPRIOR)) { - rb_prior = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This and Prior Instances")); - gtk_container_add (GTK_CONTAINER (vbox), rb_prior); - } else - rb_prior = NULL; - - if (!e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) { - rb_future = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This and Future Instances")); - gtk_container_add (GTK_CONTAINER (vbox), rb_future); - } else - rb_future = NULL; - - rb_all = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("All Instances")); - gtk_container_add (GTK_CONTAINER (vbox), rb_all); - - gtk_widget_show_all (hbox); - - placeholder = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), placeholder, FALSE, FALSE, 0); - gtk_widget_show (placeholder); - - ret = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK; - - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_this))) - *mod = CALOBJ_MOD_THIS; - else if (rb_prior && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_prior))) - *mod = CALOBJ_MOD_THISANDPRIOR; - else if (rb_future && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_future))) - *mod = CALOBJ_MOD_THISANDFUTURE; - else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_all))) - *mod = CALOBJ_MOD_ALL; - - gtk_widget_destroy (dialog); - - return ret; -} diff --git a/calendar/gui/dialogs/recur-comp.h b/calendar/gui/dialogs/recur-comp.h deleted file mode 100644 index 94ccbdae87..0000000000 --- a/calendar/gui/dialogs/recur-comp.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Evolution calendar - Recurring calendar component dialog - * - * Copyright (C) 2002 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 RECUR_COMP_H -#define RECUR_COMP_H - -#include <gtk/gtkwindow.h> -#include <libecal/e-cal.h> -#include <libecal/e-cal-component.h> -#include <libecal/e-cal-util.h> - -gboolean recur_component_dialog (ECal *client, - ECalComponent *comp, - CalObjModType *mod, - GtkWindow *parent); - -#endif diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c deleted file mode 100644 index e58fb28906..0000000000 --- a/calendar/gui/dialogs/recurrence-page.c +++ /dev/null @@ -1,2397 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Recurrence page of the calendar component dialogs - * - * Copyright (C) 2001-2003 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> - * Hans Petter Jansson <hpj@ximiman.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/gtklabel.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtktreeview.h> -#include <gtk/gtktreeselection.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkstock.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <e-util/e-dialog-widgets.h> -#include <e-util/e-time-utils.h> -#include <widgets/misc/e-dateedit.h> -#include <libecal/e-cal-recur.h> -#include <libecal/e-cal-time-util.h> -#include "../calendar-config.h" -#include "../tag-calendar.h" -#include "../weekday-picker.h" -#include "comp-editor-util.h" -#include "../e-date-time-list.h" -#include "../e-mini-calendar-config.h" -#include "recurrence-page.h" - - - -enum month_num_options { - MONTH_NUM_FIRST, - MONTH_NUM_SECOND, - MONTH_NUM_THIRD, - MONTH_NUM_FOURTH, - MONTH_NUM_LAST, - MONTH_NUM_DAY, - MONTH_NUM_OTHER -}; - -static const int month_num_options_map[] = { - MONTH_NUM_FIRST, - MONTH_NUM_SECOND, - MONTH_NUM_THIRD, - MONTH_NUM_FOURTH, - MONTH_NUM_LAST, - MONTH_NUM_DAY, - MONTH_NUM_OTHER, - -1 -}; - -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 */ - ECalComponent *comp; - - /* Glade XML data */ - GladeXML *xml; - - /* Widgets from the Glade file */ - GtkWidget *main; - - GtkWidget *recurs; - gboolean 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 */ - int month_index; - - GtkWidget *month_day_menu; - enum month_day_options month_day; - - GtkWidget *month_num_menu; - enum month_num_options month_num; - - /* 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_list; /* This is a GtkTreeView now */ - GtkWidget *exception_add; - GtkWidget *exception_modify; - GtkWidget *exception_delete; - - GtkWidget *preview_bin; - - /* Store for exception_list */ - EDateTimeList *exception_list_store; - - /* For the recurrence preview, the actual widget */ - GtkWidget *preview_calendar; - EMiniCalendarConfig *preview_calendar_config; - - gboolean updating; -}; - - - -static void recurrence_page_class_init (RecurrencePageClass *class); -static void recurrence_page_init (RecurrencePage *rpage); -static void recurrence_page_finalize (GObject *object); - -static GtkWidget *recurrence_page_get_widget (CompEditorPage *page); -static void recurrence_page_focus_main_widget (CompEditorPage *page); -static gboolean recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); -static gboolean recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp); -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. - **/ - -E_MAKE_TYPE (recurrence_page, "RecurrencePage", RecurrencePage, recurrence_page_class_init, - recurrence_page_init, TYPE_COMP_EDITOR_PAGE); - -/* Class initialization function for the recurrence page */ -static void -recurrence_page_class_init (RecurrencePageClass *class) -{ - CompEditorPageClass *editor_page_class; - GObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GObjectClass *) class; - - parent_class = g_type_class_ref(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_dates = recurrence_page_set_dates; - - object_class->finalize = recurrence_page_finalize; -} - -/* 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->recurs = NULL; - priv->custom = FALSE; - 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_day_menu = NULL; - priv->month_num_menu = NULL; - priv->ending_date_edit = NULL; - priv->ending_count_spin = 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; -} - -/* Destroy handler for the recurrence page */ -static void -recurrence_page_finalize (GObject *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->main) - gtk_widget_unref (priv->main); - - if (priv->xml) { - g_object_unref (priv->xml); - priv->xml = NULL; - } - - if (priv->comp) { - g_object_unref (priv->comp); - priv->comp = NULL; - } - - if (priv->exception_list_store) { - g_object_unref (priv->exception_list_store); - priv->exception_list_store = NULL; - } - - if (priv->preview_calendar_config) { - g_object_unref (priv->preview_calendar_config); - priv->preview_calendar_config = NULL; - } - - g_free (priv); - rpage->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (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; - - gtk_widget_grab_focus (priv->recurs); -} - -/* Fills the widgets with default values */ -static void -clear_widgets (RecurrencePage *rpage) -{ - RecurrencePagePrivate *priv; - GtkAdjustment *adj; - GtkWidget *menu; - - priv = rpage->priv; - - priv->custom = FALSE; - - priv->weekday_day_mask = 0; - - priv->month_index = 1; - priv->month_num = MONTH_NUM_DAY; - priv->month_day = MONTH_DAY_NTH; - - g_signal_handlers_block_matched (priv->recurs, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_toggle_set (priv->recurs, FALSE); - g_signal_handlers_unblock_matched (priv->recurs, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - - adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->interval_value)); - g_signal_handlers_block_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_spin_set (priv->interval_value, 1); - g_signal_handlers_unblock_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_DAILY_RECURRENCE, - freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - - priv->ending_date_tt = icaltime_today (); - priv->ending_count = 1; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->ending_menu, - ENDING_FOREVER, - ending_types_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - - /* Exceptions list */ - e_date_time_list_clear (priv->exception_list_store); -} - -/* Appends an exception date to the list */ -static void -append_exception (RecurrencePage *rpage, ECalComponentDateTime *datetime) -{ - RecurrencePagePrivate *priv; - GtkTreeView *view; - GtkTreeIter iter; - - priv = rpage->priv; - view = GTK_TREE_VIEW (priv->exception_list); - - e_date_time_list_append (priv->exception_list_store, &iter, datetime); - gtk_tree_selection_select_iter (gtk_tree_view_get_selection (view), &iter); -} - -/* Fills in the exception widgets with the data from the calendar component */ -static void -fill_exception_widgets (RecurrencePage *rpage, ECalComponent *comp) -{ - RecurrencePagePrivate *priv; - GSList *list, *l; - gboolean added = FALSE; - - priv = rpage->priv; - e_cal_component_get_exdate_list (comp, &list); - - for (l = list; l; l = l->next) { - ECalComponentDateTime *cdt; - - added = TRUE; - - cdt = l->data; - append_exception (rpage, cdt); - } - - e_cal_component_free_exdate_list (list); -} - -/* Computes a weekday mask for the start day of a calendar component, - * for use in a WeekdayPicker widget. - */ -static guint8 -get_start_weekday_mask (ECalComponent *comp) -{ - ECalComponentDateTime dt; - guint8 retval; - - e_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; - - e_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; - gboolean recurs; - GtkWidget *label; - - priv = rpage->priv; - - recurs = e_dialog_toggle_get (priv->recurs); - - /* We can't preview that well for instances right now */ - if (e_cal_component_is_instance (priv->comp)) - gtk_widget_set_sensitive (priv->preview_calendar, FALSE); - else - gtk_widget_set_sensitive (priv->preview_calendar, TRUE); - - if (GTK_BIN (priv->custom_warning_bin)->child) - gtk_widget_destroy (GTK_BIN (priv->custom_warning_bin)->child); - - if (recurs && priv->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); - } else if (recurs) { - gtk_widget_set_sensitive (priv->params, TRUE); - gtk_widget_show (priv->params); - gtk_widget_hide (priv->custom_warning_bin); - } else { - gtk_widget_set_sensitive (priv->params, FALSE); - gtk_widget_show (priv->params); - gtk_widget_hide (priv->custom_warning_bin); - } -} - -static void -sensitize_buttons (RecurrencePage *rpage) -{ - gboolean read_only; - gint selected_rows; - RecurrencePagePrivate *priv; - - priv = rpage->priv; - - selected_rows = gtk_tree_selection_count_selected_rows ( - gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list))); - - if (!e_cal_is_read_only (COMP_EDITOR_PAGE (rpage)->client, &read_only, NULL)) - read_only = TRUE; - - if (!read_only) - sensitize_recur_widgets (rpage); - else - gtk_widget_set_sensitive (priv->params, FALSE); - - gtk_widget_set_sensitive (priv->recurs, !read_only); - gtk_widget_set_sensitive (priv->exception_add, !read_only && e_cal_component_has_recurrences (priv->comp)); - gtk_widget_set_sensitive (priv->exception_modify, !read_only && selected_rows > 0); - gtk_widget_set_sensitive (priv->exception_delete, !read_only && selected_rows > 0); -} - -#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, ECalComponent *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: { - enum month_num_options month_num; - enum month_day_options month_day; - - g_assert (GTK_BIN (priv->special)->child != NULL); - g_assert (priv->month_day_menu != NULL); - g_assert (GTK_IS_OPTION_MENU (priv->month_day_menu)); - g_assert (priv->month_num_menu != NULL); - g_assert (GTK_IS_OPTION_MENU (priv->month_num_menu)); - - month_num = e_dialog_option_menu_get (priv->month_num_menu, - month_num_options_map ); - month_day = e_dialog_option_menu_get (priv->month_day_menu, - month_day_options_map); - - if (month_num == MONTH_NUM_LAST) - month_num = -1; - else - month_num++; - - switch (month_day) { - case MONTH_DAY_NTH: - if (month_num == -1) - r.by_month_day[0] = -1; - else - r.by_month_day[0] = priv->month_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] = month_num; - break; - - case MONTH_DAY_TUE: - r.by_day[0] = ICAL_TUESDAY_WEEKDAY; - r.by_set_pos[0] = month_num; - break; - - case MONTH_DAY_WED: - r.by_day[0] = ICAL_WEDNESDAY_WEEKDAY; - r.by_set_pos[0] = month_num; - break; - - case MONTH_DAY_THU: - r.by_day[0] = ICAL_THURSDAY_WEEKDAY; - r.by_set_pos[0] = month_num; - break; - - case MONTH_DAY_FRI: - r.by_day[0] = ICAL_FRIDAY_WEEKDAY; - r.by_set_pos[0] = month_num; - break; - - case MONTH_DAY_SAT: - r.by_day[0] = ICAL_SATURDAY_WEEKDAY; - r.by_set_pos[0] = month_num; - break; - - case MONTH_DAY_SUN: - r.by_day[0] = ICAL_SUNDAY_WEEKDAY; - r.by_set_pos[0] = month_num; - 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; - - e_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 gboolean -fill_component (RecurrencePage *rpage, ECalComponent *comp) -{ - RecurrencePagePrivate *priv; - gboolean recurs; - GtkTreeModel *model; - GtkTreeIter iter; - gboolean valid_iter; - GSList *list; - - priv = rpage->priv; - model = GTK_TREE_MODEL (priv->exception_list_store); - - recurs = e_dialog_toggle_get (priv->recurs); - - if (recurs && priv->custom) { - /* We just keep whatever the component has currently */ - } else if (recurs) { - e_cal_component_set_rdate_list (comp, NULL); - e_cal_component_set_exrule_list (comp, NULL); - simple_recur_to_comp (rpage, comp); - } else { - e_cal_component_set_rdate_list (comp, NULL); - e_cal_component_set_rrule_list (comp, NULL); - e_cal_component_set_exrule_list (comp, NULL); - } - - /* Set exceptions */ - - list = NULL; - - for (valid_iter = gtk_tree_model_get_iter_first (model, &iter); valid_iter; - valid_iter = gtk_tree_model_iter_next (model, &iter)) { - const ECalComponentDateTime *dt; - ECalComponentDateTime *cdt; - - cdt = g_new (ECalComponentDateTime, 1); - cdt->value = g_new (struct icaltimetype, 1); - - dt = e_date_time_list_get_date_time (E_DATE_TIME_LIST (model), &iter); - g_assert (dt != NULL); - - if (!icaltime_is_valid_time (*dt->value)) { - comp_editor_page_display_validation_error (COMP_EDITOR_PAGE (rpage), - _("Recurrence date is invalid"), - priv->exception_list); - return FALSE; - } - - *cdt->value = *dt->value; - cdt->tzid = g_strdup (dt->tzid); - - list = g_slist_prepend (list, cdt); - } - - e_cal_component_set_exdate_list (comp, list); - e_cal_component_free_exdate_list (list); - - return TRUE; -} - -/* 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; - ECalComponent *comp; - ECalComponentDateTime cdt; - GSList *l; - icaltimezone *zone = NULL; - - priv = rpage->priv; - - /* If our component has not been set yet through ::fill_widgets(), we - * cannot preview the recurrence. - */ - if (!priv->comp || e_cal_component_is_instance (priv->comp)) - return; - - /* Create a scratch component with the start/end and - * recurrence/exception information from the one we are editing. - */ - - comp = e_cal_component_new (); - e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT); - - e_cal_component_get_dtstart (priv->comp, &cdt); - if (cdt.tzid != NULL) { - /* FIXME Will e_cal_get_timezone really not return builtin zones? */ - if (!e_cal_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone, NULL)) - zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid); - } - e_cal_component_set_dtstart (comp, &cdt); - e_cal_component_free_datetime (&cdt); - - e_cal_component_get_dtend (priv->comp, &cdt); - e_cal_component_set_dtend (comp, &cdt); - e_cal_component_free_datetime (&cdt); - - e_cal_component_get_exdate_list (priv->comp, &l); - e_cal_component_set_exdate_list (comp, l); - e_cal_component_free_exdate_list (l); - - e_cal_component_get_exrule_list (priv->comp, &l); - e_cal_component_set_exrule_list (comp, l); - e_cal_component_free_recur_list (l); - - e_cal_component_get_rdate_list (priv->comp, &l); - e_cal_component_set_rdate_list (comp, l); - e_cal_component_free_period_list (l); - - e_cal_component_get_rrule_list (priv->comp, &l); - e_cal_component_set_rrule_list (comp, l); - e_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, zone, TRUE, FALSE); - g_object_unref(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, 6); - - wp = WEEKDAY_PICKER (weekday_picker_new ()); - - priv->weekday_picker = GTK_WIDGET (wp); - gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (wp), FALSE, FALSE, 6); - - 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); - - g_signal_connect((wp), "changed", - G_CALLBACK (weekday_picker_changed_cb), - rpage); -} - - -static void -month_num_submenu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - GtkWidget *item; - int month_index; - - item = gtk_menu_get_active (GTK_MENU (menu_shell)); - item = gtk_menu_get_active (GTK_MENU (gtk_menu_item_get_submenu (GTK_MENU_ITEM (item)))); - - month_index = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (item))); - gtk_object_set_user_data (GTK_OBJECT (data), GINT_TO_POINTER (month_index)); -} - -/* Creates the option menu for the monthly recurrence number */ -static GtkWidget * -make_recur_month_num_submenu (const char *title, int start, int end) -{ - GtkWidget *submenu, *item; - int i; - - submenu = gtk_menu_new (); - for (i = start; i < end; i++) { - item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); - gtk_object_set_user_data (GTK_OBJECT (item), GINT_TO_POINTER (i + 1)); - gtk_widget_show (item); - } - - item = gtk_menu_item_new_with_label (_(title)); - gtk_widget_show (item); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu); - - return item; -} - -static GtkWidget * -make_recur_month_num_menu (int month_index) -{ - static const char *options[] = { - N_("first"), - N_("second"), - N_("third"), - N_("fourth"), - N_("last") - }; - - GtkWidget *menu, *submenu, *item, *submenu_item; - GtkWidget *omenu; - int i; - - menu = gtk_menu_new (); - - /* Relation */ - for (i = 0; i < sizeof (options) / sizeof (options[0]); i++) { - item = gtk_menu_item_new_with_label (_(options[i])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); - } - - /* Current date */ - item = gtk_menu_item_new_with_label (_(e_cal_recur_nth[month_index - 1])); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); - - /* Other Submenu */ - submenu = gtk_menu_new (); - submenu_item = gtk_menu_item_new_with_label (_("Other Date")); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), submenu_item); - gtk_widget_show (submenu_item); - - item = make_recur_month_num_submenu ("1st to 10th", 0, 10); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); - item = make_recur_month_num_submenu ("11th to 20th", 10, 20); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); - item = make_recur_month_num_submenu ("21st to 31st", 20, 31); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item); - - gtk_menu_item_set_submenu (GTK_MENU_ITEM (submenu_item), submenu); - gtk_object_set_user_data (GTK_OBJECT (submenu_item), GINT_TO_POINTER (month_index)); - g_signal_connect((submenu), "selection_done", - G_CALLBACK (month_num_submenu_selection_done_cb), - submenu_item); - - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - - return omenu; -} - -/* 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_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show (item); - } - - omenu = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - - return omenu; -} - -static void -month_num_menu_selection_done_cb (GtkMenuShell *menu_shell, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - enum month_num_options month_num; - enum month_day_options month_day; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - month_num = e_dialog_option_menu_get (priv->month_num_menu, - month_num_options_map); - month_day = e_dialog_option_menu_get (priv->month_day_menu, - month_day_options_map); - - if (month_num == MONTH_NUM_OTHER) { - GtkWidget *label, *item; - - item = gtk_menu_get_active (GTK_MENU (menu_shell)); - priv->month_index = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (item))); - - month_num = MONTH_NUM_DAY; - e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map); - - label = GTK_BIN (priv->month_num_menu)->child; - gtk_label_set_text (GTK_LABEL (label), _(e_cal_recur_nth[priv->month_index - 1])); - - e_dialog_option_menu_set (priv->month_num_menu, 0, month_num_options_map); - e_dialog_option_menu_set (priv->month_num_menu, month_num, month_num_options_map); - } - - if (month_num == MONTH_NUM_DAY && month_day != MONTH_DAY_NTH) - e_dialog_option_menu_set (priv->month_day_menu, - MONTH_DAY_NTH, - month_day_options_map); - else if (month_num != MONTH_NUM_DAY && month_num != MONTH_NUM_LAST && month_day == MONTH_DAY_NTH) - e_dialog_option_menu_set (priv->month_day_menu, - MONTH_DAY_MON, - month_num_options_map); - field_changed (rpage); - preview_recur (rpage); -} - -/* 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; - RecurrencePagePrivate *priv; - enum month_num_options month_num; - enum month_day_options month_day; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - month_num = e_dialog_option_menu_get (priv->month_num_menu, - month_num_options_map); - month_day = e_dialog_option_menu_get (priv->month_day_menu, - month_day_options_map); - if (month_day == MONTH_DAY_NTH && month_num != MONTH_NUM_LAST && month_num != MONTH_NUM_DAY) - e_dialog_option_menu_set (priv->month_num_menu, - MONTH_NUM_DAY, - month_num_options_map); - else if (month_day != MONTH_DAY_NTH && month_num == MONTH_NUM_DAY) - e_dialog_option_menu_set (priv->month_num_menu, - MONTH_NUM_FIRST, - month_num_options_map); - 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_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, 6); - - adj = GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 31, 1, 10, 10)); - - priv->month_num_menu = make_recur_month_num_menu (priv->month_index); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_num_menu, - FALSE, FALSE, 6); - - priv->month_day_menu = make_recur_month_menu (); - gtk_box_pack_start (GTK_BOX (hbox), priv->month_day_menu, - FALSE, FALSE, 6); - - gtk_widget_show_all (hbox); - - /* Set the options */ - e_dialog_option_menu_set (priv->month_num_menu, - priv->month_num, - month_num_options_map); - e_dialog_option_menu_set (priv->month_day_menu, - priv->month_day, - month_day_options_map); - - g_signal_connect((adj), "value_changed", G_CALLBACK (month_index_value_changed_cb), - rpage); - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->month_num_menu)); - g_signal_connect((menu), "selection_done", - G_CALLBACK (month_num_menu_selection_done_cb), - rpage); - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->month_day_menu)); - g_signal_connect((menu), "selection_done", - G_CALLBACK (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 (priv->month_num_menu != NULL) { - gtk_widget_destroy (priv->month_num_menu); - priv->month_num_menu = NULL; - } - if (GTK_BIN (priv->special)->child != NULL) { - gtk_widget_destroy (GTK_BIN (priv->special)->child); - - priv->weekday_picker = 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); - - g_signal_connect((de), "changed", - G_CALLBACK (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_spin_button_set_numeric ((GtkSpinButton *)priv->ending_count_spin, TRUE); - gtk_box_pack_start (GTK_BOX (hbox), priv->ending_count_spin, - FALSE, FALSE, 6); - - label = gtk_label_new (_("occurrences")); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); - - gtk_widget_show_all (hbox); - - /* Set the values */ - - e_dialog_spin_set (priv->ending_count_spin, priv->ending_count); - - g_signal_connect((adj), "value_changed", - G_CALLBACK (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)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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 */ - - if (!r->until.is_date) { - ECal *client = COMP_EDITOR_PAGE (rpage)->client; - ECalComponentDateTime dt; - icaltimezone *from_zone, *to_zone; - - e_cal_component_get_dtstart (priv->comp, &dt); - - if (dt.value->is_date) - to_zone = calendar_config_get_icaltimezone (); - else if (dt.tzid == NULL) - to_zone = icaltimezone_get_utc_timezone (); - else - /* FIXME Error checking? */ - e_cal_get_timezone (client, dt.tzid, &to_zone, NULL); - from_zone = icaltimezone_get_utc_timezone (); - - icaltimezone_convert_time (&r->until, from_zone, to_zone); - - r->until.hour = 0; - r->until.minute = 0; - r->until.second = 0; - r->until.is_date = TRUE; - r->until.is_utc = FALSE; - } - - 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); - } - - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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 gboolean -recurrence_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - ECalComponentText 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) - g_object_unref (priv->comp); - - priv->comp = e_cal_component_clone (comp); - - /* Don't send off changes during this time */ - priv->updating = TRUE; - - /* Clean the page */ - clear_widgets (rpage); - - /* Summary */ - e_cal_component_get_summary (comp, &text); - - /* 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 (!e_cal_component_has_rdates (comp) - && !e_cal_component_has_rrules (comp) - && !e_cal_component_has_exrules (comp)) { - gtk_signal_handler_block_by_data (GTK_OBJECT (priv->recurs), rpage); - e_dialog_toggle_set (priv->recurs, FALSE); - gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->recurs), rpage); - - sensitize_buttons (rpage); - preview_recur (rpage); - - priv->updating = FALSE; - return TRUE; - } - - /* See if it is a custom set we don't support */ - - e_cal_component_get_rrule_list (comp, &rrule_list); - len = g_slist_length (rrule_list); - if (len > 1 - || e_cal_component_has_rdates (comp) - || e_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)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_DAILY_RECURRENCE, - freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_WEEKLY_RECURRENCE, - freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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 && nth != -1) - goto custom; - - if (nth == -1) { - ECalComponentDateTime dt; - - e_cal_component_get_dtstart (comp, &dt); - priv->month_index = dt.value->day; - priv->month_num = MONTH_NUM_LAST; - } else { - priv->month_index = nth; - priv->month_num = MONTH_NUM_DAY; - } - 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; - } - - if (pos == -1) - priv->month_num = MONTH_NUM_LAST; - else - priv->month_num = pos - 1; - priv->month_day = month_day; - } else - goto custom; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_MONTHLY_RECURRENCE, - freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, 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)); - g_signal_handlers_block_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_option_menu_set (priv->interval_unit, - ICAL_YEARLY_RECURRENCE, - freq_map); - g_signal_handlers_unblock_matched (menu, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - break; - - default: - goto custom; - } - - /* If we got here it means it is a simple recurrence */ - - g_signal_handlers_block_matched (priv->recurs, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_toggle_set (priv->recurs, TRUE); - g_signal_handlers_unblock_matched (priv->recurs, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - - sensitize_buttons (rpage); - make_recurrence_special (rpage); - - adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->interval_value)); - g_signal_handlers_block_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - e_dialog_spin_set (priv->interval_value, r->interval); - g_signal_handlers_unblock_matched (adj, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - - fill_ending_date (rpage, r); - - goto out; - - custom: - - g_signal_handlers_block_matched (priv->recurs, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - priv->custom = TRUE; - e_dialog_toggle_set (priv->recurs, TRUE); - g_signal_handlers_unblock_matched (priv->recurs, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, rpage); - /* FIXME Desensitize recurrence page */ - - sensitize_buttons (rpage); - - out: - priv->custom = FALSE; - e_cal_component_free_recur_list (rrule_list); - preview_recur (rpage); - - priv->updating = FALSE; - - return TRUE; -} - -/* fill_component handler for the recurrence page */ -static gboolean -recurrence_page_fill_component (CompEditorPage *page, ECalComponent *comp) -{ - RecurrencePage *rpage; - - rpage = RECURRENCE_PAGE (page); - return fill_component (rpage, comp); -} - -/* set_dates handler for the recurrence page */ -static void -recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - ECalComponentDateTime dt; - struct icaltimetype icaltime; - guint8 mask; - - rpage = RECURRENCE_PAGE (page); - priv = rpage->priv; - - /* 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; - e_cal_component_set_dtstart (priv->comp, &dt); - } - - if (dates->end) { - icaltime = *dates->end->value; - dt.tzid = dates->end->tzid; - e_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) { - 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 (G_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - - priv->recurs = GW ("recurs"); - 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_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->recurs - && priv->params - && priv->interval_value - && priv->interval_unit - && priv->special - && priv->ending_menu - && priv->ending_special - && priv->custom_warning_bin - && 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; - RecurrencePagePrivate *priv; - gboolean read_only; - - rpage = RECURRENCE_PAGE (data); - - priv = rpage->priv; - - field_changed (rpage); - - sensitize_buttons (rpage); - preview_recur (rpage); - - /* enable/disable the 'Add' button */ - if (!e_cal_is_read_only (COMP_EDITOR_PAGE (rpage)->client, &read_only, NULL)) - read_only = TRUE; - - if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->recurs)) || read_only) - gtk_widget_set_sensitive (priv->exception_add, FALSE); - else - gtk_widget_set_sensitive (priv->exception_add, TRUE); -} - -/* 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); -} - -static GtkWidget * -create_exception_dialog (RecurrencePage *rpage, const char *title, GtkWidget **date_edit) -{ - RecurrencePagePrivate *priv; - GtkWidget *dialog, *toplevel; - - priv = rpage->priv; - - toplevel = gtk_widget_get_toplevel (priv->main); - dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (toplevel), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, - NULL); - - *date_edit = comp_editor_new_date_edit (TRUE, FALSE, TRUE); - gtk_widget_show (*date_edit); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), *date_edit, FALSE, TRUE, 6); - - return dialog; -} - -/* Callback for the "add exception" button */ -static void -exception_add_cb (GtkWidget *widget, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - GtkWidget *dialog, *date_edit; - gboolean date_set; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - dialog = create_exception_dialog (rpage, "Add exception", &date_edit); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { - ECalComponentDateTime dt; - struct icaltimetype icaltime = icaltime_null_time (); - - 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 (date_edit), - &icaltime.year, - &icaltime.month, - &icaltime.day); - g_assert (date_set); - - append_exception (rpage, &dt); - preview_recur (rpage); - } - - gtk_widget_destroy (dialog); -} - -/* Callback for the "modify exception" button */ -static void -exception_modify_cb (GtkWidget *widget, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - GtkWidget *dialog, *date_edit; - const ECalComponentDateTime *current_dt; - GtkTreeSelection *selection; - GtkTreeIter iter; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list)); - if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { - g_warning ("Could not get a selection to modify."); - return; - } - - current_dt = e_date_time_list_get_date_time (priv->exception_list_store, &iter); - - dialog = create_exception_dialog (rpage, "Modify exception", &date_edit); - e_date_edit_set_date (E_DATE_EDIT (date_edit), - current_dt->value->year, current_dt->value->month, current_dt->value->day); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { - ECalComponentDateTime dt; - struct icaltimetype icaltime = icaltime_null_time (); - struct icaltimetype *tt; - - field_changed (rpage); - - dt.value = &icaltime; - tt = dt.value; - e_date_edit_get_date (E_DATE_EDIT (date_edit), - &tt->year, &tt->month, &tt->day); - tt->hour = 0; - tt->minute = 0; - tt->second = 0; - tt->is_date = 1; - - /* No TZID, since we are using a DATE value now. */ - dt.tzid = NULL; - - e_date_time_list_set_date_time (priv->exception_list_store, &iter, &dt); - preview_recur (rpage); - } - - gtk_widget_destroy (dialog); -} - -/* Callback for the "delete exception" button */ -static void -exception_delete_cb (GtkWidget *widget, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - GtkTreeSelection *selection; - GtkTreeIter iter; - GtkTreePath *path; - gboolean valid_iter; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list)); - if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { - g_warning ("Could not get a selection to delete."); - return; - } - - field_changed (rpage); - - path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->exception_list_store), &iter); - e_date_time_list_remove (priv->exception_list_store, &iter); - - /* Select closest item after removal */ - valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->exception_list_store), &iter, path); - if (!valid_iter) { - gtk_tree_path_prev (path); - valid_iter = gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->exception_list_store), &iter, path); - } - - if (valid_iter) - gtk_tree_selection_select_iter (selection, &iter); - - gtk_tree_path_free (path); - 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_selection_changed_cb (GtkTreeSelection *selection, gpointer data) -{ - RecurrencePage *rpage; - RecurrencePagePrivate *priv; - GtkTreeIter iter; - - rpage = RECURRENCE_PAGE (data); - priv = rpage->priv; - - if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { - gtk_widget_set_sensitive (priv->exception_modify, FALSE); - gtk_widget_set_sensitive (priv->exception_delete, FALSE); - return; - } - - gtk_widget_set_sensitive (priv->exception_modify, TRUE); - gtk_widget_set_sensitive (priv->exception_delete, TRUE); -} - -/* 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; - GtkTreeViewColumn *column; - GtkCellRenderer *cell_renderer; - - priv = rpage->priv; - - /* Recurrence preview */ - - priv->preview_calendar = e_calendar_new (); - ecal = E_CALENDAR (priv->preview_calendar); - priv->preview_calendar_config = e_mini_calendar_config_new (ecal); - g_signal_connect((ecal->calitem), "date_range_changed", - G_CALLBACK (preview_date_range_changed_cb), - rpage); - 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); - - e_calendar_item_set_get_time_callback (ecal->calitem, - (ECalendarItemGetTimeCallback) comp_editor_get_current_time, - rpage, NULL); - - /* Recurrence types */ - - g_signal_connect(priv->recurs, "toggled", G_CALLBACK (type_toggled_cb), rpage); - - /* Recurrence interval */ - - adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (priv->interval_value)); - g_signal_connect((adj), "value_changed", - G_CALLBACK (interval_value_changed_cb), - rpage); - - /* Recurrence units */ - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->interval_unit)); - g_signal_connect((menu), "selection_done", - G_CALLBACK (interval_selection_done_cb), - rpage); - - /* Recurrence ending */ - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); - g_signal_connect((menu), "selection_done", - G_CALLBACK (ending_selection_done_cb), rpage); - - /* Exception buttons */ - - g_signal_connect((priv->exception_add), "clicked", - G_CALLBACK (exception_add_cb), rpage); - g_signal_connect((priv->exception_modify), "clicked", - G_CALLBACK (exception_modify_cb), rpage); - g_signal_connect((priv->exception_delete), "clicked", - G_CALLBACK (exception_delete_cb), rpage); - - gtk_widget_set_sensitive (priv->exception_modify, FALSE); - gtk_widget_set_sensitive (priv->exception_delete, FALSE); - - /* Exception list */ - - /* Model */ - priv->exception_list_store = e_date_time_list_new (); - gtk_tree_view_set_model (GTK_TREE_VIEW (priv->exception_list), - GTK_TREE_MODEL (priv->exception_list_store)); - - /* View */ - column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_title (column, _("Date/Time")); - cell_renderer = GTK_CELL_RENDERER (gtk_cell_renderer_text_new ()); - gtk_tree_view_column_pack_start (column, cell_renderer, TRUE); - gtk_tree_view_column_add_attribute (column, cell_renderer, "text", E_DATE_TIME_LIST_COLUMN_DESCRIPTION); - gtk_tree_view_append_column (GTK_TREE_VIEW (priv->exception_list), column); - - g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->exception_list)), "changed", - G_CALLBACK (exception_selection_changed_cb), rpage); -} - - - -static void -client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) -{ - RecurrencePage *rpage = RECURRENCE_PAGE (page); - - sensitize_buttons (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, 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); - - g_signal_connect_after (G_OBJECT (rpage), "client_changed", - G_CALLBACK (client_changed_cb), NULL); - - 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 = g_object_new (TYPE_RECURRENCE_PAGE, NULL); - if (!recurrence_page_construct (rpage)) { - g_object_unref (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 bcbfb7748e..0000000000 --- a/calendar/gui/dialogs/recurrence-page.glade +++ /dev/null @@ -1,637 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="recurrence-toplevel"> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="recurrence-page"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label71"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Recurrence</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox61"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label72"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox59"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkCheckButton" id="recurs"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">This appointment rec_urs</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox57"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="params"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkLabel" id="label68"> - <property name="visible">True</property> - <property name="label" translatable="yes">Every</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="interval-value"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">1 1 10000 1 10 10</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="interval-unit"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget1"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget2"> - <property name="visible">True</property> - <property name="label" translatable="yes">day(s)</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget3"> - <property name="visible">True</property> - <property name="label" translatable="yes">week(s)</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget4"> - <property name="visible">True</property> - <property name="label" translatable="yes">month(s)</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget5"> - <property name="visible">True</property> - <property name="label" translatable="yes">year(s)</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="special"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="ending-menu"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget6"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget7"> - <property name="visible">True</property> - <property name="label" translatable="yes">for</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget8"> - <property name="visible">True</property> - <property name="label" translatable="yes">until</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget9"> - <property name="visible">True</property> - <property name="label" translatable="yes">forever</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="ending-special"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkAlignment" id="custom-warning-bin"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label73"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Exceptions</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox60"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label75"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox63"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow14"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTreeView" id="exception-list"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVButtonBox" id="vbuttonbox1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_START</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="exception-add"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-add</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="exception-modify"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox64"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="stock">gtk-preferences</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label76"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Edit</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - </child> - - <child> - <widget class="GtkButton" id="exception-delete"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-remove</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label70"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Preview</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox62"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label74"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox60"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkAlignment" id="preview-bin"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/recurrence-page.h b/calendar/gui/dialogs/recurrence-page.h deleted file mode 100644 index 7a10eff069..0000000000 --- a/calendar/gui/dialogs/recurrence-page.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Evolution calendar - Recurrence page of the calendar component dialogs - * - * Copyright (C) 2001-2003 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> - * Hans Petter Jansson <hpj@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" - -G_BEGIN_DECLS - - - -#define TYPE_RECURRENCE_PAGE (recurrence_page_get_type ()) -#define RECURRENCE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_RECURRENCE_PAGE, RecurrencePage)) -#define RECURRENCE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_RECURRENCE_PAGE, RecurrencePageClass)) -#define IS_RECURRENCE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_RECURRENCE_PAGE)) -#define IS_RECURRENCE_PAGE_CLASS(klass) (G_TYPE_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); - - - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/save-comp.c b/calendar/gui/dialogs/save-comp.c deleted file mode 100644 index fa5eae8659..0000000000 --- a/calendar/gui/dialogs/save-comp.c +++ /dev/null @@ -1,54 +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 "widgets/misc/e-error.h" -#include "save-comp.h" -#include "comp-editor.h" - -/** - * save_component_dialog: - * @parent: Window to use as the transient dialog's parent. - * @comp: Pointer to the EcalComponent - * - * Pops up a dialog box asking the user whether he wants to save changes for - * a calendar component. - * - * Return value: the response_id of the button selected. - **/ - -GtkResponseType -save_component_dialog (GtkWindow *parent, ECalComponent *comp) -{ - ECalComponentVType vtype = e_cal_component_get_vtype(comp); - - switch(vtype) { - case E_CAL_COMPONENT_EVENT: - return e_error_run (parent, "calendar:prompt-save-appointment", NULL); - case E_CAL_COMPONENT_TODO: - return e_error_run (parent, "calendar:prompt-save-task", NULL); - default: - return GTK_RESPONSE_NO; - } -} diff --git a/calendar/gui/dialogs/save-comp.h b/calendar/gui/dialogs/save-comp.h deleted file mode 100644 index 79abe30453..0000000000 --- a/calendar/gui/dialogs/save-comp.h +++ /dev/null @@ -1,30 +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/gtkdialog.h> -#include <libecal/e-cal-component.h> - -GtkResponseType save_component_dialog (GtkWindow *parent, ECalComponent *comp); - -#endif diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c deleted file mode 100644 index 11a7e4a1f7..0000000000 --- a/calendar/gui/dialogs/schedule-page.c +++ /dev/null @@ -1,547 +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-i18n.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <glade/glade.h> -#include <gal/widgets/e-popup-menu.h> -#include <e-util/e-dialog-widgets.h> -#include "../calendar-config.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 */ - EMeetingStore *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_finalize (GObject *object); - -static GtkWidget *schedule_page_get_widget (CompEditorPage *page); -static void schedule_page_focus_main_widget (CompEditorPage *page); -static gboolean schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); -static gboolean schedule_page_fill_component (CompEditorPage *page, ECalComponent *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. - **/ - -E_MAKE_TYPE (schedule_page, "SchedulePage", SchedulePage, schedule_page_class_init, - schedule_page_init, TYPE_COMP_EDITOR_PAGE); - -/* Class initialization function for the schedule page */ -static void -schedule_page_class_init (SchedulePageClass *class) -{ - CompEditorPageClass *editor_page_class; - GObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GObjectClass *) class; - - parent_class = g_type_class_ref (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->finalize = schedule_page_finalize; -} - -/* 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_finalize (GObject *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->main) - gtk_widget_unref (priv->main); - - if (priv->xml) { - g_object_unref (priv->xml); - priv->xml = NULL; - } - - g_object_unref(priv->model); - - g_free (priv); - spage->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (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)); -} - -static void -sensitize_widgets (SchedulePage *spage) -{ - gboolean read_only; - SchedulePagePrivate *priv = spage->priv; - - if (!e_cal_is_read_only (COMP_EDITOR_PAGE (spage)->client, &read_only, NULL)) - read_only = TRUE; - - e_meeting_time_selector_set_read_only (GTK_WIDGET (priv->sel), read_only); -} - -static void -client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) -{ - SchedulePage *spage = SCHEDULE_PAGE (page); - - sensitize_widgets (spage); -} - -/* Set date/time */ -static void -update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalComponentDateTime *end_date) -{ - SchedulePagePrivate *priv; - struct icaltimetype start_tt, end_tt; - icaltimezone *start_zone = NULL, *end_zone = NULL; - 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) { - if (!e_cal_get_timezone (COMP_EDITOR_PAGE (spage)->client, - start_date->tzid, &start_zone, NULL)) { - /* FIXME: Handle error better. */ - 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) { - if (!e_cal_get_timezone (COMP_EDITOR_PAGE (spage)->client, - end_date->tzid, &end_zone, NULL)) { - /* FIXME: Handle error better. */ - g_warning ("Couldn't get timezone from server: %s", - end_date->tzid ? end_date->tzid : ""); - } - } - - start_tt = *start_date->value; - if (!end_date->value && start_tt.is_date) { - end_tt = start_tt; - icaltime_adjust (&end_tt, 1, 0, 0, 0); - } else { - 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_store_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 gboolean -schedule_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) -{ - SchedulePage *spage; - SchedulePagePrivate *priv; - ECalComponentDateTime start_date, end_date; - gboolean validated = TRUE; - - spage = SCHEDULE_PAGE (page); - priv = spage->priv; - - priv->updating = TRUE; - - /* Clean the screen */ - clear_widgets (spage); - - /* Start and end times */ - e_cal_component_get_dtstart (comp, &start_date); - e_cal_component_get_dtend (comp, &end_date); - if (!start_date.value) - validated = FALSE; - else if (!end_date.value) - validated = FALSE; - else - update_time (spage, &start_date, &end_date); - - e_cal_component_free_datetime (&start_date); - e_cal_component_free_datetime (&end_date); - - priv->updating = FALSE; - - sensitize_widgets (spage); - - return validated; -} - -/* fill_component handler for the schedule page */ -static gboolean -schedule_page_fill_component (CompEditorPage *page, ECalComponent *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 (G_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - -#undef GW - - return TRUE; -} - -static gboolean -init_widgets (SchedulePage *spage) -{ - SchedulePagePrivate *priv; - - priv = spage->priv; - - g_signal_connect (priv->sel, "changed", G_CALLBACK (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, EMeetingStore *ems) -{ - SchedulePagePrivate *priv; - - priv = spage->priv; - - priv->xml = glade_xml_new (EVOLUTION_GLADEDIR - "/schedule-page.glade", NULL, 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 */ - g_object_ref (ems); - priv->model = ems; - - /* Selector */ - priv->sel = E_MEETING_TIME_SELECTOR (e_meeting_time_selector_new (ems)); - e_meeting_time_selector_set_working_hours (priv->sel, - calendar_config_get_day_start_hour (), - calendar_config_get_day_start_minute (), - calendar_config_get_day_end_hour (), - calendar_config_get_day_end_minute ()); - gtk_widget_show (GTK_WIDGET (priv->sel)); - gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 6); - - if (!init_widgets (spage)) { - g_message ("schedule_page_construct(): " - "Could not initialize the widgets!"); - return NULL; - } - - g_signal_connect_after (G_OBJECT (spage), "client_changed", - G_CALLBACK (client_changed_cb), 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 (EMeetingStore *ems) -{ - SchedulePage *spage; - - spage = g_object_new (TYPE_SCHEDULE_PAGE, NULL); - if (!schedule_page_construct (spage, ems)) { - g_object_unref (spage); - return NULL; - } - - return spage; -} - -static void -times_changed_cb (GtkWidget *widget, gpointer data) -{ - SchedulePage *spage = data; - SchedulePagePrivate *priv; - CompEditorPageDates dates; - ECalComponentDateTime 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); - comp_editor_page_notify_changed (COMP_EDITOR_PAGE (spage)); -} diff --git a/calendar/gui/dialogs/schedule-page.glade b/calendar/gui/dialogs/schedule-page.glade deleted file mode 100644 index 2ef8a1d9f5..0000000000 --- a/calendar/gui/dialogs/schedule-page.glade +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="schedule-toplevel"> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - - <child> - <widget class="GtkVBox" id="schedule-page"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/schedule-page.h b/calendar/gui/dialogs/schedule-page.h deleted file mode 100644 index d4c7eafbdd..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-store.h" -#include "comp-editor-page.h" - -G_BEGIN_DECLS - - - -#define TYPE_SCHEDULE_PAGE (schedule_page_get_type ()) -#define SCHEDULE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCHEDULE_PAGE, SchedulePage)) -#define SCHEDULE_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCHEDULE_PAGE, SchedulePageClass)) -#define IS_SCHEDULE_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCHEDULE_PAGE)) -#define IS_SCHEDULE_PAGE_CLASS(klass) (G_TYPE_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, EMeetingStore *ems); -SchedulePage *schedule_page_new (EMeetingStore *ems); - - - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c deleted file mode 100644 index 6dd3d50cfd..0000000000 --- a/calendar/gui/dialogs/select-source-dialog.c +++ /dev/null @@ -1,185 +0,0 @@ -/* Evolution calendar - Select source dialog - * - * Copyright (C) 2004 Novell, Inc. - * - * Author: Rodrigo Moya <rodrigo@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 <bonobo/bonobo-i18n.h> -#include <gtk/gtkbox.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkscrolledwindow.h> -#include <gtk/gtkstock.h> -#include <e-util/e-icon-factory.h> -#include "widgets/misc/e-source-selector.h" -#include "select-source-dialog.h" - -static void -row_activated_cb (GtkTreeView *tree_view, GtkTreePath *path, - GtkTreeViewColumn *column, GtkWidget *dialog) -{ - gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); -} - -static void -primary_selection_changed_cb (ESourceSelector *selector, gpointer user_data) -{ - ESource **our_selection = user_data; - - if (*our_selection) - g_object_unref (*our_selection); - *our_selection = e_source_selector_peek_primary_selection (selector); - if (*our_selection) { - g_object_ref (*our_selection); - gtk_dialog_set_response_sensitive ( - GTK_DIALOG (gtk_widget_get_toplevel (selector)), GTK_RESPONSE_OK, TRUE); - } else { - gtk_dialog_set_response_sensitive ( - GTK_DIALOG (gtk_widget_get_toplevel (selector)), GTK_RESPONSE_OK, FALSE); - } -} - -/** - * select_source_dialog - * - * Implements dialog for allowing user to select a destination source. - */ -ESource * -select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) -{ - GtkWidget *dialog, *label, *scroll, *source_selector; - GtkWidget *vbox, *hbox, *spacer; - ESourceList *source_list; - ESource *selected_source = NULL; - const char *gconf_key; - char *label_text; - GConfClient *conf_client; - GList *icon_list = NULL; - - if (obj_type == E_CAL_SOURCE_TYPE_EVENT) - gconf_key = "/apps/evolution/calendar/sources"; - else if (obj_type == E_CAL_SOURCE_TYPE_TODO) - gconf_key = "/apps/evolution/tasks/sources"; - else - return NULL; - - /* create the dialog */ - dialog = gtk_dialog_new (); - gtk_window_set_title (GTK_WINDOW (dialog), _("Select destination")); - gtk_window_set_transient_for (GTK_WINDOW (dialog), - GTK_WINDOW (parent)); - gtk_window_set_default_size (GTK_WINDOW (dialog), 320, 240); - - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); - gtk_widget_ensure_style (dialog); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - - vbox = gtk_vbox_new (FALSE, 12); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 12); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox); - gtk_widget_show (vbox); - - label_text = g_strdup_printf ("<b>%s %s</b>", _("_Destination"), - obj_type == E_CAL_SOURCE_TYPE_EVENT ? - _("Calendar") : _("Task List")); - label = gtk_label_new_with_mnemonic (label_text); - gtk_label_set_use_markup (GTK_LABEL (label), TRUE); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - g_free (label_text); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - - hbox = gtk_hbox_new (FALSE, 12); - gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); - gtk_widget_show (hbox); - - spacer = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0); - gtk_widget_show (spacer); - - conf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (conf_client, gconf_key); - - scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), - GTK_SHADOW_IN); - gtk_widget_show (scroll); - source_selector = e_source_selector_new (source_list); - e_source_selector_show_selection (E_SOURCE_SELECTOR (source_selector), FALSE); - - g_signal_connect (G_OBJECT (source_selector), "row_activated", - G_CALLBACK (row_activated_cb), dialog); - - g_signal_connect (G_OBJECT (source_selector), "primary_selection_changed", - G_CALLBACK (primary_selection_changed_cb), &selected_source); - gtk_widget_show (source_selector); - gtk_container_add (GTK_CONTAINER (scroll), source_selector); - gtk_box_pack_start (GTK_BOX (hbox), scroll, TRUE, TRUE, 0); - - gtk_label_set_mnemonic_widget (GTK_LABEL (label), source_selector); - - if (obj_type == E_CAL_SOURCE_TYPE_EVENT) - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); - else if (obj_type == E_CAL_SOURCE_TYPE_TODO) - icon_list = e_icon_factory_get_icon_list ("stock_todo"); - - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - if (selected_source) { - char *absolute_uri; - - /* set the absolute URI on the source we keep around, since the group - will be unrefed */ - absolute_uri = e_source_build_absolute_uri (selected_source); - e_source_set_absolute_uri (selected_source, (const char *) absolute_uri); - - g_free (absolute_uri); - } - } else { - if (selected_source) - g_object_unref (selected_source); - selected_source = NULL; - } - - g_object_unref (conf_client); - g_object_unref (source_list); - gtk_widget_destroy (dialog); - - return selected_source; -} diff --git a/calendar/gui/dialogs/select-source-dialog.h b/calendar/gui/dialogs/select-source-dialog.h deleted file mode 100644 index d0656395bb..0000000000 --- a/calendar/gui/dialogs/select-source-dialog.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Evolution calendar - Select source dialog - * - * Copyright (C) 2004 Novell, Inc. - * - * Author: Rodrigo Moya <rodrigo@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 SELECT_SOURCE_DIALOG_H -#define SELECT_SOURCE_DIALOG_H - -#include <gtk/gtkwindow.h> -#include <libedataserver/e-source.h> -#include <libecal/e-cal.h> - -ESource *select_source_dialog (GtkWindow *parent, ECalSourceType type); - -#endif diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c deleted file mode 100644 index 882368a4d6..0000000000 --- a/calendar/gui/dialogs/send-comp.c +++ /dev/null @@ -1,75 +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 <gtk/gtkmessagedialog.h> -#include "widgets/misc/e-error.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 (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean new) -{ - ECalComponentVType vtype; - const char *id; - - if (e_cal_get_save_schedules (client)) - return FALSE; - - vtype = e_cal_component_get_vtype (comp); - - switch (vtype) { - case E_CAL_COMPONENT_EVENT: - if (new) - id = "calendar:prompt-meeting-invite"; - else - id = "calendar:prompt-send-updated-meeting-info"; - break; - - case E_CAL_COMPONENT_TODO: - if (new) - id = "calendar:prompt-send-task"; - else - id = "calendar:prompt-send-updated-task-info"; - break; - - default: - g_message ("send_component_dialog(): " - "Cannot handle object of type %d", vtype); - return FALSE; - } - - if (e_error_run (parent, id, NULL) == GTK_RESPONSE_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 86be94ccdb..0000000000 --- a/calendar/gui/dialogs/send-comp.h +++ /dev/null @@ -1,31 +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 <gtk/gtkwindow.h> -#include <libecal/e-cal.h> -#include <libecal/e-cal-component.h> - -gboolean send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *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 d5fa0465cf..0000000000 --- a/calendar/gui/dialogs/task-details-page.c +++ /dev/null @@ -1,835 +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 <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <widgets/misc/e-dateedit.h> -#include <widgets/misc/e-url-entry.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 *date_completed_label; - GtkWidget *completed_date; - - GtkWidget *url_label; - GtkWidget *url_entry; - GtkWidget *url; - - gboolean updating; -}; - -/* Note that these two arrays must match. */ -static const int status_map[] = { - ICAL_STATUS_NONE, - 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_finalize (GObject *object); - -static GtkWidget *task_details_page_get_widget (CompEditorPage *page); -static void task_details_page_focus_main_widget (CompEditorPage *page); -static gboolean task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); -static gboolean task_details_page_fill_component (CompEditorPage *page, ECalComponent *comp); -static gboolean task_details_page_fill_timezones (CompEditorPage *page, GHashTable *timezones); - -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. - **/ - -E_MAKE_TYPE (task_details_page, "TaskDetailsPage", TaskDetailsPage, task_details_page_class_init, - task_details_page_init, TYPE_COMP_EDITOR_PAGE); - -/* Class initialization function for the task page */ -static void -task_details_page_class_init (TaskDetailsPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GObjectClass *) class; - - parent_class = g_type_class_ref(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; - editor_page_class->fill_timezones = task_details_page_fill_timezones; - - object_class->finalize = task_details_page_finalize; -} - -/* 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->date_completed_label = NULL; - priv->completed_date = NULL; - - priv->url_label = NULL; - priv->url_entry = NULL; - priv->url = NULL; - - priv->updating = FALSE; -} - -/* Destroy handler for the task page */ -static void -task_details_page_finalize (GObject *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->main) - gtk_widget_unref (priv->main); - - if (priv->xml) { - g_object_unref (priv->xml); - priv->xml = NULL; - } - - g_free (priv); - tdpage->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (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); -} - -static void -sensitize_widgets (TaskDetailsPage *tdpage) -{ - gboolean read_only; - TaskDetailsPagePrivate *priv; - - priv = tdpage->priv; - - if (!e_cal_is_read_only (COMP_EDITOR_PAGE (tdpage)->client, &read_only, NULL)) - read_only = TRUE; - - gtk_widget_set_sensitive (priv->status, !read_only); - gtk_widget_set_sensitive (priv->priority, !read_only); - gtk_widget_set_sensitive (priv->percent_complete, !read_only); - gtk_widget_set_sensitive (priv->completed_date, !read_only); - gtk_widget_set_sensitive (priv->url_label, !read_only); - gtk_entry_set_editable (GTK_ENTRY (e_url_entry_get_entry (priv->url_entry)), !read_only); -} - -/* fill_widgets handler for the task page */ -static gboolean -task_details_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - int *priority_value, *percent = NULL; - 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. */ - e_cal_component_get_percent (comp, &percent); - if (percent) { - e_dialog_spin_set (priv->percent_complete, *percent); - } else { - /* FIXME: Could check if task is completed and set 100%. */ - e_dialog_spin_set (priv->percent_complete, 0); - } - - /* Status. */ - e_cal_component_get_status (comp, &status); - if (status == ICAL_STATUS_NONE || status == ICAL_STATUS_NEEDSACTION) { - /* Try to use the percent value. */ - if (percent) { - if (*percent == 100) - status = ICAL_STATUS_COMPLETED; - else if (*percent > 0) - status = ICAL_STATUS_INPROCESS; - else - status = ICAL_STATUS_NONE; - } else - status = ICAL_STATUS_NONE; - } - e_dialog_option_menu_set (priv->status, status, status_map); - - if (percent) - e_cal_component_free_percent (percent); - - /* Completed Date. */ - e_cal_component_get_completed (comp, &completed); - if (completed) { - icaltimezone *utc_zone, *zone; - - /* Completed is in UTC, but that would confuse the user, so - we convert it to local time. */ - utc_zone = icaltimezone_get_utc_timezone (); - zone = calendar_config_get_icaltimezone (); - - 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); - - e_cal_component_free_icaltimetype (completed); - } - - /* Priority. */ - e_cal_component_get_priority (comp, &priority_value); - if (priority_value) { - priority = priority_value_to_index (*priority_value); - e_cal_component_free_priority (priority_value); - } else { - priority = PRIORITY_UNDEFINED; - } - e_dialog_option_menu_set (priv->priority, priority, priority_map); - - /* URL */ - e_cal_component_get_url (comp, &url); - e_dialog_editable_set (priv->url, url); - - priv->updating = FALSE; - - sensitize_widgets (tdpage); - - return TRUE; -} - -/* fill_component handler for the task page */ -static gboolean -task_details_page_fill_component (CompEditorPage *page, ECalComponent *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); - e_cal_component_set_percent (comp, &percent); - - /* Status. */ - status = e_dialog_option_menu_get (priv->status, status_map); - e_cal_component_set_status (comp, status); - - /* Priority. */ - priority = e_dialog_option_menu_get (priv->priority, priority_map); - priority_value = priority_index_to_value (priority); - e_cal_component_set_priority (comp, &priority_value); - - icaltime = icaltime_null_time (); - - /* COMPLETED must be in UTC. */ - icaltime.is_utc = 1; - - /* Completed Date. */ - if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->completed_date)) || - !e_date_edit_time_is_valid (E_DATE_EDIT (priv->completed_date))) { - comp_editor_page_display_validation_error (page, _("Completed date is wrong"), priv->completed_date); - return FALSE; - } - - 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. */ - icaltimezone *zone = calendar_config_get_icaltimezone (); - icaltimezone_convert_time (&icaltime, zone, - icaltimezone_get_utc_timezone ()); - e_cal_component_set_completed (comp, &icaltime); - } else { - e_cal_component_set_completed (comp, NULL); - } - - /* URL. */ - url = e_dialog_editable_get (priv->url); - e_cal_component_set_url (comp, url); - if (url) - g_free (url); - - return TRUE; -} - -/* fill_timezones handler for the event page */ -static gboolean -task_details_page_fill_timezones (CompEditorPage *page, GHashTable *timezones) -{ - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; - icaltimezone *zone; - - tdpage = TASK_DETAILS_PAGE (page); - priv = tdpage->priv; - - /* add UTC timezone, which is the one used for the DATE-COMPLETED property */ - zone = icaltimezone_get_utc_timezone (); - if (zone) { - if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); - } - - 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 (G_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - - priv->status = GW ("status"); - priv->priority = GW ("priority"); - priv->percent_complete = GW ("percent-complete"); - - priv->date_completed_label = GW ("date_completed_label"); - - priv->completed_date = GW ("completed-date"); - gtk_widget_show (priv->completed_date); - - priv->url_label = GW ("url_label"); - - priv->url_entry = GW ("url_entry"); - gtk_widget_show (priv->url_entry); - priv->url = e_url_entry_get_entry (E_URL_ENTRY (priv->url_entry)); - -#undef GW - - return (priv->status - && priv->priority - && priv->percent_complete - && priv->date_completed_label - && priv->completed_date - && priv->url_label - && 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_NONE, - 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_NONE) { - 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) { - gint percent_complete = e_dialog_spin_get_int (priv->percent_complete); - if (percent_complete <= 0 || percent_complete >= 100) - 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_NONE; - 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); - - /* These are created by hand, so hook the mnemonics manually */ - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->date_completed_label), priv->completed_date); - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->url_label), priv->url_entry); - - /* Connect signals. The Status, Percent Complete & Date Completed - properties are closely related so whenever one changes we may need - to update the other 2. */ - g_signal_connect((GTK_OPTION_MENU (priv->status)->menu), - "deactivate", - G_CALLBACK (status_changed), tdpage); - - g_signal_connect((GTK_SPIN_BUTTON (priv->percent_complete)->adjustment), - "value_changed", - G_CALLBACK (percent_complete_changed), tdpage); - - /* Priority */ - g_signal_connect((GTK_OPTION_MENU (priv->priority)->menu), - "deactivate", - G_CALLBACK (field_changed_cb), tdpage); - - /* Completed Date */ - g_signal_connect((priv->completed_date), "changed", - G_CALLBACK (date_changed_cb), tdpage); - g_signal_connect (priv->completed_date, "changed", - G_CALLBACK (field_changed_cb), tdpage); - - /* URL */ - g_signal_connect((priv->url), "changed", - G_CALLBACK (field_changed_cb), tdpage); -} - -static void -client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) -{ - TaskDetailsPage *tdpage = TASK_DETAILS_PAGE (page); - - sensitize_widgets (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, 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); - - g_signal_connect_after (G_OBJECT (tdpage), "client_changed", - G_CALLBACK (client_changed_cb), NULL); - - 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 = g_object_new (TYPE_TASK_DETAILS_PAGE, NULL); - if (!task_details_page_construct (tdpage)) { - g_object_unref (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 5396696733..0000000000 --- a/calendar/gui/dialogs/task-details-page.glade +++ /dev/null @@ -1,460 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="task-details-toplevel"> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="task-details-page"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label20"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span weight="bold">Status</span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox2"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table3"> - <property name="visible">True</property> - <property name="n_rows">4</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - - <child> - <widget class="GtkLabel" id="label17"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Status:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">status</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label19"> - <property name="visible">True</property> - <property name="label" translatable="yes">P_ercent complete:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">percent-complete</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Priority:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">priority</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="date_completed_label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Date completed:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="priority"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget7"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget8"> - <property name="visible">True</property> - <property name="label" translatable="yes">High</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget9"> - <property name="visible">True</property> - <property name="label" translatable="yes">Normal</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget10"> - <property name="visible">True</property> - <property name="label" translatable="yes">Low</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget11"> - <property name="visible">True</property> - <property name="label" translatable="yes">Undefined</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkOptionMenu" id="status"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget1"> - <property name="visible">True</property> - - <child> - <widget class="GtkMenuItem" id="convertwidget2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Not Started</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget3"> - <property name="visible">True</property> - <property name="label" translatable="yes">In Progress</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget5"> - <property name="visible">True</property> - <property name="label" translatable="yes">Completed</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="convertwidget6"> - <property name="visible">True</property> - <property name="label" translatable="yes">Cancelled</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkSpinButton" id="percent-complete"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">0 0 100 1 10 10</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="completed-date"> - <property name="visible">True</property> - <property name="creation_function">task_details_page_create_date_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span weight="bold">Miscellaneous </span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox3"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label23"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table2"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="n_rows">1</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="url_label"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Web Page:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="Custom" id="url_entry"> - <property name="visible">True</property> - <property name="creation_function">e_url_entry_new</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 08 Feb 2002 21:02:37 GMT</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/task-details-page.h b/calendar/gui/dialogs/task-details-page.h deleted file mode 100644 index 98b6832bbf..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" - -G_BEGIN_DECLS - - - -#define TYPE_TASK_DETAILS_PAGE (task_details_page_get_type ()) -#define TASK_DETAILS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TASK_DETAILS_PAGE, TaskDetailsPage)) -#define TASK_DETAILS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TASK_DETAILS_PAGE, TaskDetailsPageClass)) -#define IS_TASK_DETAILS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TASK_DETAILS_PAGE)) -#define IS_TASK_DETAILS_PAGE_CLASS(klass) (G_TYPE_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); - - - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c deleted file mode 100644 index 1fe4023bde..0000000000 --- a/calendar/gui/dialogs/task-editor.c +++ /dev/null @@ -1,439 +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/util/e-util.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; - - EMeetingStore *model; - - gboolean assignment_shown; - gboolean updating; -}; - - - -static void task_editor_class_init (TaskEditorClass *class); -static void task_editor_init (TaskEditor *te); -static void task_editor_set_e_cal (CompEditor *editor, ECal *client); -static void task_editor_edit_comp (CompEditor *editor, ECalComponent *comp); -static gboolean task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method); -static void task_editor_finalize (GObject *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_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data); -static void model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data); - -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. - **/ - -E_MAKE_TYPE (task_editor, "TaskEditor", TaskEditor, task_editor_class_init, task_editor_init, - TYPE_COMP_EDITOR); - -/* Class initialization function for the event editor */ -static void -task_editor_class_init (TaskEditorClass *klass) -{ - GObjectClass *object_class; - CompEditorClass *editor_class; - - object_class = (GObjectClass *) klass; - editor_class = (CompEditorClass *) klass; - - parent_class = g_type_class_ref(TYPE_COMP_EDITOR); - - editor_class->set_e_cal = task_editor_set_e_cal; - editor_class->edit_comp = task_editor_edit_comp; - editor_class->send_comp = task_editor_send_comp; - - object_class->finalize = task_editor_finalize; -} - -static void -init_widgets (TaskEditor *te) -{ - TaskEditorPrivate *priv; - - priv = te->priv; - - g_signal_connect((priv->model), "row_changed", - G_CALLBACK (model_row_change_insert_cb), te); - g_signal_connect((priv->model), "row_inserted", - G_CALLBACK (model_row_change_insert_cb), te); - g_signal_connect((priv->model), "row_deleted", - G_CALLBACK (model_row_delete_cb), te); -} - -static void -client_changed_cb (CompEditorPage *page, ECal *client, gpointer user_data) -{ -// set_menu_sens (TASK_EDITOR (user_data)); -} - -/* 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->model = E_MEETING_STORE (e_meeting_store_new ()); - priv->assignment_shown = TRUE; - priv->updating = FALSE; - -} - -TaskEditor * -task_editor_construct (TaskEditor *te, ECal *client) -{ - TaskEditorPrivate *priv; - - priv = te->priv; - - priv->task_page = task_page_new (); - g_object_ref (priv->task_page); - gtk_object_sink (GTK_OBJECT (priv->task_page)); - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->task_page), - _("Task")); - g_signal_connect (G_OBJECT (priv->task_page), "client_changed", - G_CALLBACK (client_changed_cb), te); - - priv->task_details_page = task_details_page_new (); - g_object_ref (priv->task_details_page); - gtk_object_sink (GTK_OBJECT (priv->task_details_page)); - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->task_details_page), - _("Status")); - - priv->meet_page = meeting_page_new (priv->model, client); - g_object_ref (priv->meet_page); - gtk_object_sink (GTK_OBJECT (priv->meet_page)); - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page), - _("Assignment")); - - comp_editor_set_e_cal (COMP_EDITOR (te), client); - - init_widgets (te); - - return te; -} - -static void -task_editor_set_e_cal (CompEditor *editor, ECal *client) -{ - TaskEditor *te; - TaskEditorPrivate *priv; - - te = TASK_EDITOR (editor); - priv = te->priv; - - e_meeting_store_set_e_cal (priv->model, client); - - if (parent_class->set_e_cal) - parent_class->set_e_cal (editor, client); -} - -static void -task_editor_edit_comp (CompEditor *editor, ECalComponent *comp) -{ - TaskEditor *te; - TaskEditorPrivate *priv; - ECalComponentOrganizer organizer; - ECal *client; - GSList *attendees = NULL; - - te = TASK_EDITOR (editor); - priv = te->priv; - - priv->updating = TRUE; - - if (parent_class->edit_comp) - parent_class->edit_comp (editor, comp); - - client = comp_editor_get_e_cal (COMP_EDITOR (editor)); - - /* Get meeting related stuff */ - e_cal_component_get_organizer (comp, &organizer); - e_cal_component_get_attendee_list (comp, &attendees); - - /* Clear things up */ - e_meeting_store_remove_all_attendees (priv->model); - - if (attendees == NULL) { - comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); - priv->assignment_shown = FALSE; - } else { - GSList *l; - int row; - - if (!priv->assignment_shown) - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page), - _("Assignment")); - - for (l = attendees; l != NULL; l = l->next) { - ECalComponentAttendee *ca = l->data; - EMeetingAttendee *ia; - - ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_e_cal_component_attendee (ca)); - /* If we aren't the organizer or the attendee is just delegating, don't allow editing */ - if (!comp_editor_get_user_org (editor) || e_meeting_attendee_is_set_delto (ia)) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); - e_meeting_store_add_attendee (priv->model, ia); - - g_object_unref(ia); - } - - /* If we aren't the organizer we can still change our own status */ - if (!comp_editor_get_user_org (editor)) { - EAccountList *accounts; - EAccount *account; - EIterator *it; - - accounts = itip_addresses_get (); - for (it = e_list_get_iterator((EList *)accounts);e_iterator_is_valid(it);e_iterator_next(it)) { - EMeetingAttendee *ia; - - account = (EAccount*)e_iterator_get(it); - - ia = e_meeting_store_find_attendee (priv->model, account->id->address, &row); - if (ia != NULL) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_STATUS); - } - g_object_unref(it); - } else if (e_cal_get_organizer_must_attend (client)) { - EMeetingAttendee *ia; - - ia = e_meeting_store_find_attendee (priv->model, organizer.value, &row); - if (ia != NULL) - e_meeting_attendee_set_edit_level (ia, E_MEETING_ATTENDEE_EDIT_NONE); - } - - priv->assignment_shown = TRUE; - } - e_cal_component_free_attendee_list (attendees); - - comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown && itip_organizer_is_user (comp, client)); - - priv->updating = FALSE; -} - -static gboolean -task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method) -{ - TaskEditor *te = TASK_EDITOR (editor); - TaskEditorPrivate *priv; - ECalComponent *comp = NULL; - - priv = te->priv; - - /* Don't cancel more than once or when just publishing */ - if (method == E_CAL_COMPONENT_METHOD_PUBLISH || - method == E_CAL_COMPONENT_METHOD_CANCEL) - goto parent; - - comp = meeting_page_get_cancel_comp (priv->meet_page); - if (comp != NULL) { - ECal *client; - gboolean result; - - client = e_meeting_store_get_e_cal (priv->model); - result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL); - g_object_unref (comp); - - if (!result) - return FALSE; - } - - parent: - if (parent_class->send_comp) - return parent_class->send_comp (editor, method); - - return FALSE; -} - -/* Destroy handler for the event editor */ -static void -task_editor_finalize (GObject *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; - - g_object_unref (priv->task_page); - g_object_unref (priv->task_details_page); - g_object_unref (priv->meet_page); - - g_object_unref (priv->model); - - g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - -/** - * task_editor_new: - * @client: a ECal - * - * 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 (ECal *client) -{ - TaskEditor *te; - - te = g_object_new (TYPE_TASK_EDITOR, NULL); - return task_editor_construct (te, client); -} - -static void -show_assignment (TaskEditor *te) -{ - TaskEditorPrivate *priv; - - priv = te->priv; - - if (!priv->assignment_shown) { - comp_editor_append_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page), - _("Assignment")); - priv->assignment_shown = TRUE; - - comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown); - comp_editor_set_changed (COMP_EDITOR (te), TRUE); - } - - comp_editor_show_page (COMP_EDITOR (te), - COMP_EDITOR_PAGE (priv->meet_page)); -} - -void -task_editor_show_assignment (TaskEditor *te) -{ - g_return_if_fail (te != NULL); - g_return_if_fail (IS_TASK_EDITOR (te)); - - show_assignment (te); -} - -static void -assign_task_cmd (GtkWidget *widget, gpointer data) -{ - TaskEditor *te = TASK_EDITOR (data); - - show_assignment (te); -} - -static void -refresh_task_cmd (GtkWidget *widget, gpointer data) -{ - TaskEditor *te = TASK_EDITOR (data); - - comp_editor_send_comp (COMP_EDITOR (te), E_CAL_COMPONENT_METHOD_REFRESH); -} - -static void -cancel_task_cmd (GtkWidget *widget, gpointer data) -{ - TaskEditor *te = TASK_EDITOR (data); - ECalComponent *comp; - - comp = comp_editor_get_current_comp (COMP_EDITOR (te)); - if (cancel_component_dialog ((GtkWindow *) te, - comp_editor_get_e_cal (COMP_EDITOR (te)), comp, FALSE)) { - comp_editor_send_comp (COMP_EDITOR (te), E_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), E_CAL_COMPONENT_METHOD_PUBLISH); -} - -static void -model_changed (TaskEditor *te) -{ - if (!te->priv->updating) { - comp_editor_set_changed (COMP_EDITOR (te), TRUE); - comp_editor_set_needs_send (COMP_EDITOR (te), TRUE); - } -} - -static void -model_row_change_insert_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -{ - model_changed (TASK_EDITOR (data)); -} - -static void -model_row_delete_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data) -{ - model_changed (TASK_EDITOR (data)); -} diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h deleted file mode 100644 index e0e6ac75be..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 <gtk/gtkobject.h> -#include "comp-editor.h" - - - -#define TYPE_TASK_EDITOR (task_editor_get_type ()) -#define TASK_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TASK_EDITOR, TaskEditor)) -#define TASK_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TASK_EDITOR, \ - TaskEditorClass)) -#define IS_TASK_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TASK_EDITOR)) -#define IS_TASK_EDITOR_CLASS(klass) (G_TYPE_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 *te, - ECal *client); -TaskEditor *task_editor_new (ECal *client); -void task_editor_show_assignment(TaskEditor *te); - - -#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 4fe50f5bc5..0000000000 --- a/calendar/gui/dialogs/task-page.c +++ /dev/null @@ -1,1011 +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/gtktextview.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtkmessagedialog.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <gal/widgets/e-categories.h> -#include <widgets/misc/e-dateedit.h> -#include "widgets/misc/e-source-option-menu.h" -#include "common/authentication.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.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 *summary_label; - - GtkWidget *due_date; - GtkWidget *start_date; - GtkWidget *due_timezone; - GtkWidget *start_timezone; - - GtkWidget *description; - - GtkWidget *classification; - - GtkWidget *categories_btn; - GtkWidget *categories; - - GtkWidget *source_selector; - - gboolean updating; -}; - -static const int classification_map[] = { - E_CAL_COMPONENT_CLASS_PUBLIC, - E_CAL_COMPONENT_CLASS_PRIVATE, - E_CAL_COMPONENT_CLASS_CONFIDENTIAL, - -1 -}; - - - -static void task_page_class_init (TaskPageClass *class); -static void task_page_init (TaskPage *tpage); -static void task_page_finalize (GObject *object); - -static GtkWidget *task_page_get_widget (CompEditorPage *page); -static void task_page_focus_main_widget (CompEditorPage *page); -static gboolean task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp); -static gboolean task_page_fill_component (CompEditorPage *page, ECalComponent *comp); -static gboolean task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones); -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. - **/ - -E_MAKE_TYPE (task_page, "TaskPage", TaskPage, task_page_class_init, task_page_init, - TYPE_COMP_EDITOR_PAGE); - -/* Class initialization function for the task page */ -static void -task_page_class_init (TaskPageClass *class) -{ - CompEditorPageClass *editor_page_class; - GObjectClass *object_class; - - editor_page_class = (CompEditorPageClass *) class; - object_class = (GObjectClass *) class; - - parent_class = g_type_class_ref(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->fill_timezones = task_page_fill_timezones; - editor_page_class->set_summary = task_page_set_summary; - editor_page_class->set_dates = task_page_set_dates; - - object_class->finalize = task_page_finalize; -} - -/* 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->summary_label = NULL; - priv->due_date = NULL; - priv->start_date = NULL; - priv->due_timezone = NULL; - priv->start_timezone = NULL; - priv->description = NULL; - priv->classification = NULL; - priv->categories_btn = NULL; - priv->categories = NULL; - - priv->updating = FALSE; -} - -/* Destroy handler for the task page */ -static void -task_page_finalize (GObject *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->main) - gtk_widget_unref (priv->main); - - if (priv->xml) { - g_object_unref (priv->xml); - priv->xml = NULL; - } - - g_free (priv); - tpage->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (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); - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)), "", 0); - - /* 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_option_menu_set (priv->classification, E_CAL_COMPONENT_CLASS_PRIVATE, classification_map); - - /* Categories */ - e_dialog_editable_set (priv->categories, NULL); -} - -/* Decode the radio button group for classifications */ -static ECalComponentClassification -classification_get (GtkWidget *widget) -{ - return e_dialog_option_menu_get (widget, classification_map); -} - -static void -sensitize_widgets (TaskPage *tpage) -{ - gboolean read_only; - TaskPagePrivate *priv; - - priv = tpage->priv; - - if (!e_cal_is_read_only (COMP_EDITOR_PAGE (tpage)->client, &read_only, NULL)) - read_only = TRUE; - - gtk_widget_set_sensitive (priv->summary_label, !read_only); - gtk_entry_set_editable (GTK_ENTRY (priv->summary), !read_only); - gtk_widget_set_sensitive (priv->due_date, !read_only); - gtk_widget_set_sensitive (priv->start_date, !read_only); - gtk_widget_set_sensitive (priv->due_timezone, !read_only); - gtk_widget_set_sensitive (priv->start_timezone, !read_only); - gtk_widget_set_sensitive (priv->description, !read_only); - gtk_widget_set_sensitive (priv->classification, !read_only); - gtk_widget_set_sensitive (priv->categories_btn, !read_only); - gtk_entry_set_editable (GTK_ENTRY (priv->categories), !read_only); -} - -/* fill_widgets handler for the task page */ -static gboolean -task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - ECalComponentText text; - ECalComponentDateTime d; - ECalComponentClassification cl; - GSList *l; - const char *categories; - icaltimezone *zone, *default_zone; - ESource *source; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - - priv->updating = TRUE; - - /* Clean the screen */ - clear_widgets (tpage); - - /* Summary, description(s) */ - e_cal_component_get_summary (comp, &text); - e_dialog_editable_set (priv->summary, text.value); - - e_cal_component_get_description_list (comp, &l); - if (l && l->data) { - ECalComponentText *dtext; - - dtext = l->data; - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)), - dtext->value ? dtext->value : "", -1); - } else { - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)), - "", 0); - } - e_cal_component_free_text_list (l); - - default_zone = calendar_config_get_icaltimezone (); - - /* Due Date. */ - e_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) { - if (!e_cal_get_timezone (page->client, d.tzid, &zone, NULL)) - /* FIXME: Handle error better. */ - 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); - - e_cal_component_free_datetime (&d); - - - /* Start Date. */ - e_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) { - if (!e_cal_get_timezone (page->client, d.tzid, &zone, NULL)) - /* FIXME: Handle error better. */ - 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); - - e_cal_component_free_datetime (&d); - - /* Classification. */ - e_cal_component_get_classification (comp, &cl); - - switch (cl) { - case E_CAL_COMPONENT_CLASS_PUBLIC: - case E_CAL_COMPONENT_CLASS_PRIVATE: - case E_CAL_COMPONENT_CLASS_CONFIDENTIAL: - break; - default: - /* default to PUBLIC */ - cl = E_CAL_COMPONENT_CLASS_PUBLIC; - break; - } - e_dialog_option_menu_set (priv->classification, cl, classification_map); - - /* Categories */ - e_cal_component_get_categories (comp, &categories); - e_dialog_editable_set (priv->categories, categories); - - /* Source */ - source = e_cal_get_source (page->client); - e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), source); - - priv->updating = FALSE; - - sensitize_widgets (tpage); - - return TRUE; -} - -/* fill_component handler for the task page */ -static gboolean -task_page_fill_component (CompEditorPage *page, ECalComponent *comp) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - ECalComponentDateTime date; - struct icaltimetype start_tt, due_tt; - char *cat, *str; - gboolean start_date_set, due_date_set, time_set; - GtkTextBuffer *text_buffer; - GtkTextIter text_iter_start, text_iter_end; - icaltimezone *start_zone = NULL; - icaltimezone *due_zone = NULL; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->description)); - - /* Summary. */ - - str = e_dialog_editable_get (priv->summary); - if (!str || strlen (str) == 0) - e_cal_component_set_summary (comp, NULL); - else { - ECalComponentText text; - - text.value = str; - text.altrep = NULL; - - e_cal_component_set_summary (comp, &text); - } - - if (str) - g_free (str); - - /* Description */ - - gtk_text_buffer_get_start_iter (text_buffer, &text_iter_start); - gtk_text_buffer_get_end_iter (text_buffer, &text_iter_end); - str = gtk_text_buffer_get_text (text_buffer, &text_iter_start, &text_iter_end, FALSE); - - if (!str || strlen (str) == 0) - e_cal_component_set_description_list (comp, NULL); - else { - GSList l; - ECalComponentText text; - - text.value = str; - text.altrep = NULL; - l.data = &text; - l.next = NULL; - - e_cal_component_set_description_list (comp, &l); - } - - if (str) - g_free (str); - - /* Dates */ - - due_tt = icaltime_null_time (); - - date.value = &due_tt; - date.tzid = NULL; - - /* Due Date. */ - if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->due_date)) || - !e_date_edit_time_is_valid (E_DATE_EDIT (priv->due_date))) { - comp_editor_page_display_validation_error (page, _("Due date is wrong"), priv->due_date); - return FALSE; - } - - due_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 (due_date_set) { - if (time_set) { - due_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone)); - date.tzid = icaltimezone_get_tzid (due_zone); - } else { - due_tt.is_date = TRUE; - date.tzid = NULL; - } - e_cal_component_set_due (comp, &date); - } else { - e_cal_component_set_due (comp, NULL); - } - - /* Start Date. */ - if (!e_date_edit_date_is_valid (E_DATE_EDIT (priv->start_date)) || - !e_date_edit_time_is_valid (E_DATE_EDIT (priv->start_date))) { - comp_editor_page_display_validation_error (page, _("Start date is wrong"), priv->start_date); - return FALSE; - } - - start_tt = icaltime_null_time (); - date.value = &start_tt; - start_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 (start_date_set) { - if (time_set) { - start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - date.tzid = icaltimezone_get_tzid (start_zone); - } else { - start_tt.is_date = TRUE; - date.tzid = NULL; - } - e_cal_component_set_dtstart (comp, &date); - } else { - e_cal_component_set_dtstart (comp, NULL); - } - - /* Classification. */ - e_cal_component_set_classification (comp, classification_get (priv->classification)); - - /* Categories */ - cat = e_dialog_editable_get (priv->categories); - str = comp_editor_strip_categories (cat); - if (cat) - g_free (cat); - - e_cal_component_set_categories (comp, str); - - if (str) - g_free (str); - - return TRUE; -} - -/* fill_timezones handler for the event page */ -static gboolean -task_page_fill_timezones (CompEditorPage *page, GHashTable *timezones) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - icaltimezone *zone; - - tpage = TASK_PAGE (page); - priv = tpage->priv; - - /* add due date timezone */ - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone)); - if (zone) { - if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); - } - - /* add start date timezone */ - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); - if (zone) { - if (!g_hash_table_lookup (timezones, icaltimezone_get_tzid (zone))) - g_hash_table_insert (timezones, icaltimezone_get_tzid (zone), zone); - } - - 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 (G_OBJECT (toplevel)); - if (accel_groups) { - page->accel_group = accel_groups->data; - gtk_accel_group_ref (page->accel_group); - } - - gtk_widget_ref (priv->main); - gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main); - - priv->summary = GW ("summary"); - priv->summary_label = GW ("summary-label"); - - /* Glade's visibility flag doesn't seem to work for custom widgets */ - priv->due_date = GW ("due-date"); - gtk_widget_show (priv->due_date); - priv->start_date = GW ("start-date"); - gtk_widget_show (priv->start_date); - - priv->due_timezone = GW ("due-timezone"); - priv->start_timezone = GW ("start-timezone"); - - priv->description = GW ("description"); - - priv->classification = GW ("classification"); - - priv->categories_btn = GW ("categories-button"); - priv->categories = GW ("categories"); - - priv->source_selector = GW ("source"); - -#undef GW - - return (priv->summary - && priv->summary_label - && priv->due_date - && priv->start_date - && priv->due_timezone - && priv->start_timezone - && priv->classification - && priv->description - && 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; - ECalComponentDateTime 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 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)); -} - -static void -source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) -{ - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - if (!priv->updating) { - ECal *client; - - client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO); - if (!client || !e_cal_open (client, FALSE, NULL)) { - GtkWidget *dialog; - - if (client) - g_object_unref (client); - - e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->source_selector), - e_cal_get_source (COMP_EDITOR_PAGE (tpage)->client)); - - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - _("Unable to open tasks in '%s'."), - e_source_peek_name (source)); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - } else { - comp_editor_notify_client_changed ( - COMP_EDITOR (gtk_widget_get_toplevel (priv->main)), - client); - sensitize_widgets (tpage); - } - } -} - -/* Hooks the widget signals */ -static gboolean -init_widgets (TaskPage *tpage) -{ - TaskPagePrivate *priv; - GtkTextBuffer *text_buffer; - 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 */ - g_signal_connect((priv->summary), "changed", - G_CALLBACK (summary_changed_cb), tpage); - - /* Description */ - text_buffer = gtk_text_buffer_new (NULL); - gtk_text_view_set_buffer (GTK_TEXT_VIEW (priv->description), text_buffer); - g_object_unref (text_buffer); - - gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->description), GTK_WRAP_WORD); - - /* Dates */ - g_signal_connect((priv->start_date), "changed", - G_CALLBACK (date_changed_cb), tpage); - g_signal_connect((priv->due_date), "changed", - G_CALLBACK (date_changed_cb), tpage); - - /* Categories button */ - g_signal_connect((priv->categories_btn), "clicked", - G_CALLBACK (categories_clicked_cb), tpage); - - /* Source selector */ - g_signal_connect((priv->source_selector), "source_selected", - G_CALLBACK (source_changed_cb), tpage); - - /* Connect the default signal handler to use to make sure the "changed" - field gets set whenever a field is changed. */ - - /* Belongs to priv->description */ - g_signal_connect ((text_buffer), "changed", - G_CALLBACK (field_changed_cb), tpage); - - g_signal_connect((priv->summary), "changed", - G_CALLBACK (field_changed_cb), tpage); - g_signal_connect (priv->start_date, "changed", - G_CALLBACK (field_changed_cb), tpage); - g_signal_connect (priv->due_date, "changed", - G_CALLBACK (field_changed_cb), tpage); - g_signal_connect((priv->due_timezone), "changed", - G_CALLBACK (field_changed_cb), tpage); - g_signal_connect((priv->start_timezone), "changed", - G_CALLBACK (field_changed_cb), tpage); - g_signal_connect((priv->classification), "changed", - G_CALLBACK (field_changed_cb), tpage); - g_signal_connect((priv->categories), "changed", - G_CALLBACK (field_changed_cb), tpage); - - /* Set the default timezone, so the timezone entry may be hidden. */ - zone = calendar_config_get_icaltimezone (); - 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, 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 ("task_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)) { - g_object_unref (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; -} - -GtkWidget *task_page_create_source_option_menu (void); - -GtkWidget * -task_page_create_source_option_menu (void) -{ - GtkWidget *menu; - GConfClient *gconf_client; - ESourceList *source_list; - - gconf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/tasks/sources"); - - menu = e_source_option_menu_new (source_list); - g_object_unref (source_list); - - gtk_widget_show (menu); - return menu; -} diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade deleted file mode 100644 index e3248afd4b..0000000000 --- a/calendar/gui/dialogs/task-page.glade +++ /dev/null @@ -1,582 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="task-toplevel"> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="task-page"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label21"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span weight="bold">Basics</span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox7"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label22"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table3"> - <property name="visible">True</property> - <property name="n_rows">4</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - - <child> - <widget class="GtkEntry" id="summary"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="summary-label"> - <property name="visible">True</property> - <property name="label" translatable="yes">Su_mmary:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">summary</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label100"> - <property name="visible">True</property> - <property name="label" translatable="yes">Classi_fication:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">classification</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox10"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkOptionMenu" id="classification"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> - - <child> - <widget class="GtkMenu" id="menu1"> - - <child> - <widget class="GtkMenuItem" id="public1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Public</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="private1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Private</property> - <property name="use_underline">True</property> - </widget> - </child> - - <child> - <widget class="GtkMenuItem" id="confidential1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Confidential</property> - <property name="use_underline">True</property> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label23"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Group:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">source</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="Custom" id="source"> - <property name="visible">True</property> - <property name="creation_function">task_page_create_source_option_menu</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Thu, 18 Dec 2003 01:58:48 GMT</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="categories-button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">Ca_tegories...</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="categories"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> - <property name="visible">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="description"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="overwrite">False</property> - <property name="accepts_tab">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_WORD</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="label" translatable="yes">D_escription:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">description</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label24"> - <property name="visible">True</property> - <property name="label" translatable="yes"><span weight="bold">Date and Time</span></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox11"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label25"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">12</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table4"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - - <child> - <widget class="GtkLabel" id="label29"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Due date:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">due-date</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label30"> - <property name="visible">True</property> - <property name="label" translatable="yes">Sta_rt date:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">start-date</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox8"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="Custom" id="due-date"> - <property name="visible">True</property> - <property name="creation_function">task_page_create_date_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Mon, 14 Jun 2004 18:16:07 GMT</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="Custom" id="due-timezone"> - <property name="visible">True</property> - <property name="creation_function">make_timezone_entry</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 19 Jun 2001 04:43:54 GMT</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox9"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="Custom" id="start-date"> - <property name="visible">True</property> - <property name="creation_function">task_page_create_date_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Mon, 14 Jun 2004 18:16:13 GMT</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="Custom" id="start-timezone"> - <property name="visible">True</property> - <property name="creation_function">make_timezone_entry</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Tue, 19 Jun 2001 04:43:46 GMT</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/task-page.h b/calendar/gui/dialogs/task-page.h deleted file mode 100644 index 16ced619d7..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" - -G_BEGIN_DECLS - - - -#define TYPE_TASK_PAGE (task_page_get_type ()) -#define TASK_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TASK_PAGE, TaskPage)) -#define TASK_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TASK_PAGE, TaskPageClass)) -#define IS_TASK_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TASK_PAGE)) -#define IS_TASK_PAGE_CLASS(klass) (G_TYPE_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); - - - -G_END_DECLS - -#endif diff --git a/calendar/gui/dialogs/url-editor-dialog.c b/calendar/gui/dialogs/url-editor-dialog.c deleted file mode 100644 index a6972e4ef3..0000000000 --- a/calendar/gui/dialogs/url-editor-dialog.c +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Gary Ekker <gekker@novell.com> - * - * Copyright 2004 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 - */ - -/* - * UrlEditorDialog - a GtkObject which handles a libglade-loaded dialog - * to edit the calendar preference settings. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - - -#include "cal-prefs-dialog.h" -#include "url-editor-dialog.h" - -#include "e-util/e-passwords.h" -#include <gtk/gtk.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtktogglebutton.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 <e-util/e-icon-factory.h> -#include <widgets/misc/e-dateedit.h> -#include <stdlib.h> -#include <string.h> - -static gboolean get_widgets (UrlDialogData *data); -static void init_widgets (UrlDialogData *data); - -static void url_editor_dialog_fb_url_changed (GtkEntry *url_entry, void *data); -static void url_editor_dialog_fb_daily_toggled (GtkWidget *button, void *data); -static void url_editor_dialog_fb_url_activated (GtkEntry *url_entry, void *data); -static void url_editor_dialog_fb_ok_enable (GtkWidget *widget, void *data); - -/** - * url_editor_dialog_new: - * - * Creates a new #UrlEditorDialog. - * - * Return value: a new #UrlEditorDialog. - **/ -gboolean -url_editor_dialog_new (DialogData *dialog_data, EPublishUri *uri) -{ - int b; - - UrlDialogData *url_dlg_data = g_new0 (UrlDialogData, 1); - url_dlg_data->xml = glade_xml_new (EVOLUTION_GLADEDIR "/url-editor-dialog.glade", NULL, NULL); - if (!url_dlg_data->xml) { - g_message ("url_editor_dialog_construct(): Could not load the Glade XML file!"); - return FALSE; - } - - if (!get_widgets (url_dlg_data)) { - g_message ("url_editor_dialog_construct(): Could not find all widgets in the XML file!"); - return FALSE; - } - - url_dlg_data->url_dialog = (GtkWidget *) dialog_data; - url_dlg_data->url_data = uri; - - init_widgets (url_dlg_data); - - if (uri->location && uri->username) { - if (strlen(uri->location) != 0) { - gtk_entry_set_text (url_dlg_data->url_entry, - uri->location); - } - if (strlen(uri->username) != 0) { - gtk_entry_set_text (url_dlg_data->username_entry, - uri->username); - } - } - - uri->password = e_passwords_get_password ("Calendar", url_dlg_data->url_data->location); - - if (uri->password) { - if (strlen(uri->password) != 0) { - gtk_entry_set_text (url_dlg_data->password_entry, - uri->password); - - e_dialog_toggle_set (url_dlg_data->remember_pw, TRUE); - } else { - e_dialog_toggle_set (url_dlg_data->remember_pw, FALSE); - } - } - - switch (uri->publish_freq) { - case URI_PUBLISH_DAILY: - e_dialog_radio_set (url_dlg_data->daily, - URI_PUBLISH_DAILY, - pub_frequency_type_map); - break; - case URI_PUBLISH_WEEKLY: - e_dialog_radio_set (url_dlg_data->daily, - URI_PUBLISH_WEEKLY, - pub_frequency_type_map); - break; - case URI_PUBLISH_USER: - default: - e_dialog_radio_set (url_dlg_data->daily, - URI_PUBLISH_USER, - pub_frequency_type_map); - } - - dialog_data->url_editor=TRUE; - dialog_data->url_editor_dlg = (GtkWidget *) url_dlg_data; - gtk_widget_set_sensitive ((GtkWidget *) url_dlg_data->ok, FALSE); - - b = gtk_dialog_run ((GtkDialog *) url_dlg_data->url_editor); - - if (b == GTK_RESPONSE_OK) { - if ((GtkEntry *) url_dlg_data->url_entry) { - url_editor_dialog_fb_url_activated (url_dlg_data->url_entry, url_dlg_data); - url_dlg_data->url_data->username = g_strdup (gtk_entry_get_text ((GtkEntry *) url_dlg_data->username_entry)); - url_dlg_data->url_data->password = g_strdup (gtk_entry_get_text ((GtkEntry *) url_dlg_data->password_entry)); - if (e_dialog_toggle_get (url_dlg_data->remember_pw)) { - e_passwords_add_password (url_dlg_data->url_data->location, url_dlg_data->url_data->password); - e_passwords_remember_password ("Calendar", url_dlg_data->url_data->location); - } else { - e_passwords_forget_password ("Calendar", url_dlg_data->url_data->location); - } - } - } - - gtk_widget_destroy (url_dlg_data->url_editor); - g_object_unref (url_dlg_data->xml); - g_free (url_dlg_data); - url_dlg_data = NULL; - - return FALSE; -} - -static gboolean -get_widgets (UrlDialogData *data) -{ -#define GW(name) glade_xml_get_widget (data->xml, name) - - data->url_editor = GW ("url_editor"); - data->calendar_list_label = GW ("calendar_list_label"); - data->url_dialog = GW ("fb_dialog"); - data->url_entry = GTK_ENTRY (GW ("url_entry")); - data->daily = GW ("daily"); - data->weekly = GW ("weekly"); - data->user_publish = GW ("user_publish"); - data->scrolled_window = GW ("scrolled_window"); - data->username_entry = GTK_ENTRY (GW ("username_entry")); - data->password_entry = GTK_ENTRY (GW ("password_entry")); - data->remember_pw = GW ("remember_pw"); - data->cancel = GW ("cancel"); - data->ok = GW ("ok"); - -#undef GW - - return (data ->url_editor - && data->calendar_list_label - && data->url_entry - && data->daily - && data->weekly - && data->user_publish - && data->scrolled_window - && data->username_entry - && data->password_entry - && data->remember_pw - && data->cancel - && data->ok); -} - -static void -selection_changed_callback (ESourceSelector *selector, - void *data) -{ - UrlDialogData *url_dlg_data = (UrlDialogData *) data; - GSList *selection = e_source_selector_get_selection (selector); - - if (selection != NULL) { - GSList *p, *l = NULL; - - for (p = selection; p != NULL; p = p->next) { - ESource *source = E_SOURCE(p->data); - gchar* source_uid = g_strdup(e_source_peek_uid(source)); - - l = g_slist_append (l, source_uid); - } - url_dlg_data->url_data->calendars = l; - } - - e_source_selector_free_selection (selection); - gtk_widget_set_sensitive ((GtkWidget *) url_dlg_data->ok, TRUE); -} - -/* Connects any necessary signal handlers. */ -static void -init_widgets (UrlDialogData *url_dlg_data) -{ - GtkWidget *selector; - ESourceList *source_list; - GConfClient *gconf_client; - GList *icon_list; - GSList *p; - - gtk_widget_ensure_style (url_dlg_data->url_editor); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (url_dlg_data->url_editor)->vbox), 0); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (url_dlg_data->url_editor)->action_area), 12); - - g_signal_connect (url_dlg_data->url_entry, "changed", - G_CALLBACK (url_editor_dialog_fb_url_changed), - url_dlg_data); - - g_signal_connect (url_dlg_data->username_entry, "changed", - G_CALLBACK (url_editor_dialog_fb_ok_enable), - url_dlg_data); - - g_signal_connect (url_dlg_data->password_entry, "changed", - G_CALLBACK (url_editor_dialog_fb_ok_enable), - url_dlg_data); - - g_signal_connect (url_dlg_data->remember_pw, "toggled", - G_CALLBACK (url_editor_dialog_fb_ok_enable), - url_dlg_data); - - g_signal_connect (url_dlg_data->url_entry, "activate", - G_CALLBACK (url_editor_dialog_fb_url_activated), - url_dlg_data); - - g_signal_connect (url_dlg_data->daily, "toggled", - G_CALLBACK (url_editor_dialog_fb_daily_toggled), - url_dlg_data); - - g_signal_connect (url_dlg_data->weekly, "toggled", - G_CALLBACK (url_editor_dialog_fb_daily_toggled), - url_dlg_data); - - g_signal_connect (url_dlg_data->user_publish, "toggled", - G_CALLBACK (url_editor_dialog_fb_daily_toggled), - url_dlg_data); - - - if (url_dlg_data->url_data->calendars) { - ESource *source; - - gconf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources"); - selector = e_source_selector_new (source_list); - - p = url_dlg_data->url_data->calendars; - for (; p != NULL; p = p->next) { - gchar *source_uid; - - source_uid = g_strdup (p->data); - source = e_source_list_peek_source_by_uid (source_list, source_uid); - e_source_selector_select_source ((ESourceSelector *)selector, source); - g_free (source_uid); - } - } else { - gconf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/calendar/sources"); - selector = e_source_selector_new (source_list); - } - e_source_selector_show_selection ((ESourceSelector *) selector, TRUE); - g_signal_connect (selector, "selection_changed", - G_CALLBACK (selection_changed_callback), - url_dlg_data); - - gtk_label_set_mnemonic_widget (GTK_LABEL (url_dlg_data->calendar_list_label), - selector); - gtk_widget_show (selector); - gtk_container_add (GTK_CONTAINER (url_dlg_data->scrolled_window), - selector); - - icon_list = e_icon_factory_get_icon_list ("stock_calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (url_dlg_data->url_editor), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } - - gtk_widget_show (url_dlg_data->scrolled_window); -} - -static void -url_editor_dialog_fb_daily_toggled (GtkWidget *button, - void *data) -{ - UrlDialogData *url_dlg_data = (UrlDialogData *) data; - enum publish_frequency frequency; - - frequency = e_dialog_radio_get (url_dlg_data->daily, - pub_frequency_type_map); - url_dlg_data->url_data->publish_freq = frequency; - gtk_widget_set_sensitive ((GtkWidget *) url_dlg_data->ok, TRUE); -} - -static gboolean -is_valid_url (const gchar *url) -{ - const gchar *p = url; - - if (strlen (url) == 0) { - return FALSE; - } - while (*p) { - if ((*p == '\\') || (*p == ' ')) { - return FALSE; - } - p++; - } - return TRUE; -} - -static void -url_editor_dialog_fb_url_activated (GtkEntry *url_entry, void *data) -{ - UrlDialogData *url_dlg_data = (UrlDialogData *) data; - - url_dlg_data->url_data->location = g_strdup (gtk_entry_get_text ((GtkEntry *) url_entry)); -} - -static void -url_editor_dialog_fb_url_changed (GtkEntry *url_entry, void *data) -{ - UrlDialogData *url_dlg_data = (UrlDialogData *) data; - DialogData *url_dialog = (DialogData *) url_dlg_data->url_dialog; - - const gchar *entry_contents; - GtkListStore *model; - GtkTreeIter iter; - gboolean valid; - - model = (GtkListStore *) gtk_tree_view_get_model (url_dialog->url_list); - - entry_contents = gtk_entry_get_text ((GtkEntry *) url_entry); - if (!is_valid_url (entry_contents)) { - gtk_widget_set_sensitive ((GtkWidget *) url_dlg_data->ok, FALSE); - return; - } - /* duplicate check */ - valid = gtk_tree_model_get_iter_first ((GtkTreeModel *) model, &iter); - while (valid) { - gchar *url_name; - gtk_tree_model_get ((GtkTreeModel *) model, &iter, - URL_LIST_LOCATION_COLUMN, &url_name, - -1); - - if (!strcasecmp (url_name, entry_contents)) { - gtk_widget_set_sensitive ((GtkWidget *) url_dlg_data->ok, FALSE); - return; - } - valid = gtk_tree_model_iter_next ((GtkTreeModel *) model, &iter); - } - /* valid and unique */ - gtk_widget_set_sensitive (GTK_WIDGET (url_dlg_data->ok), TRUE); - gtk_widget_grab_default (GTK_WIDGET (url_dlg_data->ok)); - gtk_entry_set_activates_default ((GtkEntry*) url_dlg_data->url_entry, - TRUE); -} - -static void url_editor_dialog_fb_ok_enable (GtkWidget *widget, void *data) { - UrlDialogData *url_dlg_data = (UrlDialogData *) data; - - gtk_widget_set_sensitive (GTK_WIDGET (url_dlg_data->ok), TRUE); -} diff --git a/calendar/gui/dialogs/url-editor-dialog.glade b/calendar/gui/dialogs/url-editor-dialog.glade deleted file mode 100644 index 2415a78059..0000000000 --- a/calendar/gui/dialogs/url-editor-dialog.glade +++ /dev/null @@ -1,551 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkDialog" id="url_editor"> - <property name="visible">True</property> - <property name="title" translatable="yes">Free/Busy Editor</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> - <property name="modal">False</property> - <property name="default_width">380</property> - <property name="default_height">508</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="has_separator">False</property> - - <child internal-child="vbox"> - <widget class="GtkVBox" id="dialog-vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child internal-child="action_area"> - <widget class="GtkHButtonBox" id="dialog-action_area1"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - - <child> - <widget class="GtkButton" id="cancel"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-6</property> - </widget> - </child> - - <child> - <widget class="GtkButton" id="ok"> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-5</property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">GTK_PACK_END</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox13"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label26"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Publishing _Location</b></property> - <property name="use_underline">True</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">url_entry</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox9"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="url_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label25"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Publishing Frequency</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox10"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label29"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox12"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkRadioButton" id="daily"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Daily</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="weekly"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Weekly</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">daily</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="user_publish"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Manual</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">daily</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="calendar_list_label"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Free/Busy C_alendars</b></property> - <property name="use_underline">True</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox11"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label30"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolled_window"> - <property name="height_request">150</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_IN</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label27"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Authentication</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox12"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label31"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTable" id="table1"> - <property name="visible">True</property> - <property name="n_rows">3</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - - <child> - <widget class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Username:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">username_entry</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Password:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">password_entry</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="username_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="password_entry"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">False</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkCheckButton" id="remember_pw"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Remember password</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/url-editor-dialog.h b/calendar/gui/dialogs/url-editor-dialog.h deleted file mode 100644 index 12930f45cd..0000000000 --- a/calendar/gui/dialogs/url-editor-dialog.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Gary Ekker <gekker@novell.com> - * - * Copyright 2004, 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 - */ - -/* - * UrlEditorDialog - a GtkObject which handles a libglade-loaded dialog - * to edit the calendar preference settings. - */ - -#ifndef _URL_EDITOR_DIALOG_H_ -#define _URL_EDITOR_DIALOG_H_ - -G_BEGIN_DECLS - -#include <gtk/gtk.h> -#include <glade/glade.h> - -#include "cal-prefs-dialog.h" -#include "widgets/misc/e-source-selector.h" - -struct _UrlDialogData { - /* Glade XML data */ - GladeXML *xml; - GtkWidget *url_editor; - GtkWidget *url_dialog; - - GtkEntry *url_entry; - GtkWidget *daily; - GtkWidget *weekly; - GtkWidget *user_publish; - - GtkWidget *calendar_list_label; - GtkWidget *scrolled_window; - - GtkEntry *username_entry; - GtkEntry *password_entry; - GtkWidget *remember_pw; - - GtkWidget *cancel; - GtkWidget *ok; - EPublishUri *url_data; -}; -typedef struct _UrlDialogData UrlDialogData; - -gboolean -url_editor_dialog_new (DialogData *dialog_data, EPublishUri *pub_uri); - -G_END_DECLS - -#endif /* _URL_EDITOR_DIALOG_H_ */ |