diff options
author | JP Rosevear <jpr@novell.com> | 2004-06-25 05:02:09 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-06-25 05:02:09 +0800 |
commit | 348fd04aee155d7f90d3e0c3115db83be57a2b98 (patch) | |
tree | 27e14467e0d2aaa95b70530dc5cb7050c721eeb5 /calendar | |
parent | 4633426c1b666ee82f6a5e663952d3370a5b572b (diff) | |
download | gsoc2013-evolution-348fd04aee155d7f90d3e0c3115db83be57a2b98.tar.gz gsoc2013-evolution-348fd04aee155d7f90d3e0c3115db83be57a2b98.tar.zst gsoc2013-evolution-348fd04aee155d7f90d3e0c3115db83be57a2b98.zip |
store all the custom alarms (alarm_custom_clicked_cb): emit changed signal
2004-06-24 JP Rosevear <jpr@novell.com>
* gui/dialogs/event-page.c (event_page_fill_component): store all
the custom alarms
(alarm_custom_clicked_cb): emit changed signal if necessary
* gui/dialogs/alarm-list-dialog.c (alarm_list_dialog_run): return
true/false based on button pushed
* gui/dialogs/alarm-dialog.c: move repeat options and per alarm
type options here
* gui/dialogs/alarm-dialog.glade: ditto
* gui/dialogs/Makefile.am: remove alarm options dialog
svn path=/trunk/; revision=26500
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 16 | ||||
-rw-r--r-- | calendar/gui/dialogs/Makefile.am | 3 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-dialog.c | 486 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-dialog.glade | 1022 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-list-dialog.c | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-list-dialog.glade | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-options.c | 824 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-options.glade | 573 | ||||
-rw-r--r-- | calendar/gui/dialogs/alarm-options.h | 28 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 110 |
10 files changed, 1410 insertions, 1661 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 82978774e1..f1780a9d05 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,19 @@ +2004-06-24 JP Rosevear <jpr@novell.com> + + * gui/dialogs/event-page.c (event_page_fill_component): store all + the custom alarms + (alarm_custom_clicked_cb): emit changed signal if necessary + + * gui/dialogs/alarm-list-dialog.c (alarm_list_dialog_run): return + true/false based on button pushed + + * gui/dialogs/alarm-dialog.c: move repeat options and per alarm + type options here + + * gui/dialogs/alarm-dialog.glade: ditto + + * gui/dialogs/Makefile.am: remove alarm options dialog + 2004-06-24 Rodney Dawes <dobey@novell.com> * gui/calendar-component.c (create_component_view): diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index 8a338f7fc1..68d071fdd7 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -36,8 +36,6 @@ libcal_dialogs_la_SOURCES = \ alarm-dialog.h \ alarm-list-dialog.c \ alarm-list-dialog.h \ - alarm-options.c \ - alarm-options.h \ cal-prefs-dialog.c \ cal-prefs-dialog.h \ calendar-setup.c \ @@ -90,7 +88,6 @@ libcal_dialogs_la_SOURCES = \ glade_DATA = \ alarm-dialog.glade \ alarm-list-dialog.glade \ - alarm-options.glade \ cal-prefs-dialog.glade \ calendar-setup.glade \ e-delegate-dialog.glade \ diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 0b886eabba..e3d4b12be2 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -32,11 +32,18 @@ #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" @@ -44,9 +51,10 @@ #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-options.h" #include "alarm-dialog.h" @@ -70,9 +78,41 @@ typedef struct { GtkWidget *relative; GtkWidget *time; - GtkWidget *button_options; + /* 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_description; + + /* Audio alarm widgets */ + GtkWidget *aalarm_group; + GtkWidget *aalarm_attach; + + /* Mail alarm widgets */ + const char *email; + GtkWidget *malarm_group; + GtkWidget *malarm_address_group; + GtkWidget *malarm_addresses; + GtkWidget *malarm_addressbook; + 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, @@ -121,6 +161,19 @@ static const int time_map[] = { -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) @@ -131,6 +184,10 @@ clear_widgets (Dialog *dialog) 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_notebook_set_current_page (GTK_NOTEBOOK (dialog->option_notebook), 0); } /* fill_widgets handler for the alarm page */ @@ -139,6 +196,7 @@ alarm_to_dialog (Dialog *dialog) { GtkWidget *menu; GList *l; + gboolean repeat; int i; /* Clean the page */ @@ -152,6 +210,209 @@ alarm_to_dialog (Dialog *dialog) else gtk_widget_set_sensitive (l->data, TRUE); } + + /* 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; + + 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; + + 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); + + /* 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); + 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 */ @@ -160,7 +421,8 @@ 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) @@ -191,22 +453,57 @@ dialog_to_alarm (Dialog *dialog) action = e_dialog_option_menu_get (dialog->action, action_map); e_cal_component_alarm_set_action (dialog->alarm, action); - if (action == E_CAL_COMPONENT_ALARM_EMAIL && !e_cal_component_alarm_has_attendees (dialog->alarm)) { - char *email; - - 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); + + /* 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); + + /* Set a default address if neccessary */ + if (!e_cal_component_alarm_has_attendees (dialog->alarm)) { + char *email; + + 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); + } } + + 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 (); } } @@ -226,7 +523,28 @@ get_widgets (Dialog *dialog) dialog->relative = GW ("relative"); dialog->time = GW ("time"); - dialog->button_options = GW ("button-options"); + 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_description = GW ("dalarm-description"); + + dialog->aalarm_group = GW ("aalarm-group"); + 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_description = GW ("malarm-description"); + + dialog->palarm_group = GW ("palarm-group"); + dialog->palarm_program = GW ("palarm-program"); + dialog->palarm_args = GW ("palarm-args"); #undef GW @@ -235,9 +553,26 @@ get_widgets (Dialog *dialog) && dialog->value_units && dialog->relative && dialog->time - && dialog->button_options); + && dialog->repeat_toggle + && dialog->repeat_group + && dialog->repeat_quantity + && dialog->repeat_value + && dialog->repeat_unit + && dialog->option_notebook + && dialog->dalarm_group + && dialog->dalarm_description + && dialog->aalarm_group + && dialog->aalarm_attach + && dialog->malarm_group + && dialog->malarm_address_group + && dialog->malarm_addressbook + && 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) @@ -256,12 +591,102 @@ show_options (Dialog *dialog) 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; +} + +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); +} + +/* 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); +} /* Hooks the widget signals */ static void init_widgets (Dialog *dialog) { + GtkWidget *menu; + + 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); } gboolean @@ -287,6 +712,11 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) return FALSE; } + if (!setup_select_names (&dialog)) { + g_object_unref (dialog.xml); + return FALSE; + } + init_widgets (&dialog); alarm_to_dialog (&dialog); @@ -301,21 +731,9 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), GTK_WINDOW (parent)); - keep_alive: response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel)); - switch (response_id) { - case GTK_RESPONSE_APPLY: - show_options (&dialog); - goto keep_alive; - - case GTK_RESPONSE_OK: - gtk_widget_hide (dialog.toplevel); - dialog_to_alarm (&dialog); - break; - - default: - break; - } + + dialog_to_alarm (&dialog); gtk_widget_destroy (dialog.toplevel); g_object_unref (dialog.xml); diff --git a/calendar/gui/dialogs/alarm-dialog.glade b/calendar/gui/dialogs/alarm-dialog.glade index e95e699453..b5f869e82a 100644 --- a/calendar/gui/dialogs/alarm-dialog.glade +++ b/calendar/gui/dialogs/alarm-dialog.glade @@ -2,20 +2,17 @@ <!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_CENTER_ON_PARENT</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="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"> @@ -30,98 +27,25 @@ <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="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="response_id">-10</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="hbox55"> - <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="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Options...</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="okbutton1"> + <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="focus_on_click">True</property> <property name="response_id">-6</property> </widget> </child> <child> - <widget class="GtkButton" id="button-options"> + <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="focus_on_click">True</property> <property name="response_id">-5</property> </widget> </child> @@ -135,197 +59,971 @@ </child> <child> - <widget class="GtkHBox" id="hbox54"> + <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">6</property> + <property name="spacing">0</property> <child> - <widget class="GtkOptionMenu" id="action"> + <widget class="GtkLabel" id="label13"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</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 internal-child="menu"> - <widget class="GtkMenu" id="convertwidget1"> + <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> - <widget class="GtkMenuItem" id="convertwidget2"> + <child internal-child="menu"> + <widget class="GtkMenu" id="convertwidget1"> <property name="visible">True</property> - <property name="label" translatable="yes">Pop up an alert</property> - <property name="use_underline">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="GtkMenuItem" id="convertwidget3"> + <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> - <property name="label" translatable="yes">Play a sound</property> - <property name="use_underline">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="GtkMenuItem" id="convertwidget4"> + <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> - <property name="label" translatable="yes">Run a program</property> - <property name="use_underline">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="GtkMenuItem" id="send_an_email1"> + <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> - <property name="label" translatable="yes">Send an email</property> - <property name="use_underline">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">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="GtkSpinButton" id="interval-value"> + <widget class="GtkLabel" id="label14"> <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="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="adjustment">1 0 999 1 10 10</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">True</property> + <property name="fill">False</property> </packing> </child> <child> - <widget class="GtkOptionMenu" id="value-units"> + <widget class="GtkVBox" id="vbox5"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> - <child internal-child="menu"> - <widget class="GtkMenu" id="convertwidget5"> + <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="GtkMenuItem" id="convertwidget6"> + <widget class="GtkSpinButton" id="repeat-quantity"> <property name="visible">True</property> - <property name="label" translatable="yes">minute(s)</property> - <property name="use_underline">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="GtkMenuItem" id="convertwidget7"> + <widget class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="label" translatable="yes">hour(s)</property> - <property name="use_underline">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="GtkMenuItem" id="convertwidget8"> + <widget class="GtkSpinButton" id="repeat-value"> <property name="visible">True</property> - <property name="label" translatable="yes">day(s)</property> - <property name="use_underline">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="GtkOptionMenu" id="relative"> + <widget class="GtkNotebook" id="option-notebook"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="history">0</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 internal-child="menu"> - <widget class="GtkMenu" id="convertwidget9"> + <child> + <widget class="GtkVBox" id="vbox3"> <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> <child> - <widget class="GtkMenuItem" id="convertwidget10"> + <widget class="GtkVBox" id="dalarm-group"> <property name="visible">True</property> - <property name="label" translatable="yes">before</property> - <property name="use_underline">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Message to Display:</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="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="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="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">0</property> <child> - <widget class="GtkMenuItem" id="convertwidget11"> + <widget class="GtkHBox" id="aalarm-group"> <property name="visible">True</property> - <property name="label" translatable="yes">after</property> - <property name="use_underline">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">Play sound:</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="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> - </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> + <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 internal-child="menu"> - <widget class="GtkMenu" id="convertwidget12"> + <child> + <widget class="GtkVBox" id="vbox2"> <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> <child> - <widget class="GtkMenuItem" id="convertwidget13"> + <widget class="GtkHBox" id="palarm-group"> <property name="visible">True</property> - <property name="label" translatable="yes">start of appointment</property> - <property name="use_underline">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Run program:</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="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="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes">With these arguments:</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="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="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="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="GtkMenuItem" id="convertwidget14"> + <widget class="GtkVBox" id="malarm-group"> <property name="visible">True</property> - <property name="label" translatable="yes">end of appointment</property> - <property name="use_underline">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="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="label" translatable="yes">Message to Send</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="GtkScrolledWindow" id="scrolledwindow2"> + <property name="visible">True</property> + <property name="can_focus">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="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="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">False</property> - <property name="fill">False</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="expand">True</property> <property name="fill">True</property> </packing> </child> diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 42b992dde7..827c5fff41 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -232,13 +232,8 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel)); gtk_widget_hide (dialog.toplevel); -#if 0 - if (response_id == GTK_RESPONSE_OK) - dialog_to_alarm (&dialog); -#endif - gtk_widget_destroy (dialog.toplevel); g_object_unref (dialog.xml); - return TRUE; + 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 index 6143b5c6a7..4987355f84 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.glade +++ b/calendar/gui/dialogs/alarm-list-dialog.glade @@ -4,7 +4,7 @@ <glade-interface> <widget class="GtkDialog" id="alarm-list-dialog"> - <property name="visible">True</property> + <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> diff --git a/calendar/gui/dialogs/alarm-options.c b/calendar/gui/dialogs/alarm-options.c deleted file mode 100644 index bb77cb61f4..0000000000 --- a/calendar/gui/dialogs/alarm-options.c +++ /dev/null @@ -1,824 +0,0 @@ -/* Evolution calendar - Alarm options dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include <gtk/gtkmain.h> -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkentry.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtktextbuffer.h> -#include <gtk/gtktextview.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-widget.h> -#include <libgnomeui/gnome-file-entry.h> -#include <glade/glade.h> -#include <addressbook/util/e-destination.h> -#include "Evolution-Addressbook-SelectNames.h" -#include "e-util/e-dialog-widgets.h" -#include "e-util/e-icon-factory.h" -#include "alarm-options.h" - - - -typedef struct { - /* Glade XML data */ - GladeXML *xml; - - /* The alarm action selected */ - ECalComponentAlarmAction action; - - /* Toplevel */ - GtkWidget *toplevel; - - /* Alarm repeat widgets */ - gboolean repeat; - GtkWidget *repeat_toggle; - GtkWidget *repeat_group; - GtkWidget *repeat_quantity; - GtkWidget *repeat_value; - GtkWidget *repeat_unit; - - /* Display alarm widgets */ - GtkWidget *dalarm_group; - GtkWidget *dalarm_description; - - /* Audio alarm widgets */ - GtkWidget *aalarm_group; - GtkWidget *aalarm_attach; - - /* Mail alarm widgets */ - const char *email; - GtkWidget *malarm_group; - GtkWidget *malarm_address_group; - GtkWidget *malarm_addresses; - GtkWidget *malarm_addressbook; - 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"; - - - -/* Gets the widgets from the XML file and returns if they are all available. */ -static gboolean -get_widgets (Dialog *dialog) -{ -#define GW(name) glade_xml_get_widget (dialog->xml, name) - - dialog->toplevel = GW ("alarm-options-toplevel"); - - dialog->repeat_toggle = GW ("repeat-toggle"); - dialog->repeat_group = GW ("repeat-group"); - dialog->repeat_quantity = GW ("repeat-quantity"); - dialog->repeat_value = GW ("repeat-value"); - dialog->repeat_unit = GW ("repeat-unit"); - - dialog->dalarm_group = GW ("dalarm-group"); - dialog->dalarm_description = GW ("dalarm-description"); - - dialog->aalarm_group = GW ("aalarm-group"); - dialog->aalarm_attach = GW ("aalarm-attach"); - - dialog->malarm_group = GW ("malarm-group"); - dialog->malarm_address_group = GW ("malarm-address-group"); - dialog->malarm_addressbook = GW ("malarm-addressbook"); - dialog->malarm_description = GW ("malarm-description"); - - dialog->palarm_group = GW ("palarm-group"); - dialog->palarm_program = GW ("palarm-program"); - dialog->palarm_args = GW ("palarm-args"); - - return (dialog->toplevel - && dialog->repeat_toggle - && dialog->repeat_group - && dialog->repeat_quantity - && dialog->repeat_value - && dialog->repeat_unit - && dialog->dalarm_group - && dialog->dalarm_description - && dialog->aalarm_group - && dialog->aalarm_attach - && dialog->malarm_group - && dialog->malarm_address_group - && dialog->malarm_addressbook - && dialog->malarm_description - && dialog->palarm_group - && dialog->palarm_program - && dialog->palarm_args); -} - -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; -} - -static void -palarm_options_changed_cb (GtkEditable *entry, gpointer user_data) -{ - const gchar *text; - Dialog *dialog = user_data; - - text = gtk_entry_get_text (GTK_ENTRY (dialog->palarm_program)); - if (text && *text) - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, TRUE); - else - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, FALSE); -} - -/* Callback used when the repeat toggle button is toggled. We sensitize the - * repeat group options as appropriate. - */ -static void -repeat_toggle_toggled_cb (GtkToggleButton *toggle, gpointer data) -{ - Dialog *dialog; - gboolean active; - - dialog = data; - - active = gtk_toggle_button_get_active (toggle); - - gtk_widget_set_sensitive (dialog->repeat_group, active); - - /* activate the 'OK' button */ - if (dialog->action == E_CAL_COMPONENT_ALARM_PROCEDURE) - palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog); -} - -static void -repeat_spin_button_changed_cb (GtkWidget *spin, gpointer user_data) -{ - Dialog *dialog = user_data; - - if (dialog->action == E_CAL_COMPONENT_ALARM_PROCEDURE) - palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog); -} - - -static void -repeat_unit_changed_cb (GtkWidget *option_menu, gpointer user_data) -{ - Dialog *dialog = user_data; - - if (dialog->action == E_CAL_COMPONENT_ALARM_PROCEDURE) - palarm_options_changed_cb (GTK_EDITABLE (dialog->palarm_program), dialog); -} - -/* Hooks the widget signals */ -static void -init_widgets (Dialog *dialog) -{ - /* Alarm repeat */ - - g_signal_connect (G_OBJECT (dialog->repeat_toggle), "toggled", - G_CALLBACK (repeat_toggle_toggled_cb), dialog); - - g_signal_connect (G_OBJECT (dialog->repeat_quantity), "value_changed", - G_CALLBACK (repeat_spin_button_changed_cb), dialog); - g_signal_connect (G_OBJECT (dialog->repeat_value), "value_changed", - G_CALLBACK (repeat_spin_button_changed_cb), dialog); - - g_signal_connect (G_OBJECT (dialog->repeat_unit), "changed", - G_CALLBACK (repeat_unit_changed_cb), dialog); -} - -/* Fills the audio alarm widgets with the values from the alarm component */ -static void -alarm_to_aalarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) -{ - icalattach *attach; - const char *url; - - e_cal_component_alarm_get_attach (alarm, &attach); - - if (!attach) { - e_dialog_editable_set (dialog->aalarm_attach, NULL); - return; - } - - /* FIXME: this does not support inline data */ - - url = NULL; - - if (icalattach_get_is_url (attach)) - url = icalattach_get_url (attach); - else - g_message ("alarm_to_aalarm_widgets(): FIXME: we don't support inline data yet"); - - e_dialog_editable_set (dialog->aalarm_attach, url); - - icalattach_unref (attach); -} - -/* Fills the display alarm widgets with the values from the alarm component */ -static void -alarm_to_dalarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) -{ - ECalComponentText description; - GtkTextBuffer *text_buffer; - - e_cal_component_alarm_get_description (alarm, &description); - - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->dalarm_description)); - gtk_text_buffer_set_text (text_buffer, description.value ? description.value : "", -1); -} - -/* Fills the mail alarm widgets with the values from the alarm component */ -static void -alarm_to_malarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) -{ - ECalComponentText description; - GtkTextBuffer *text_buffer; - GSList *attendee_list, *l; - EDestination **destv; - int len, i; - - /* Recipients */ - e_cal_component_alarm_get_attendee_list (alarm, &attendee_list); - len = g_slist_length (attendee_list); - - if (len <= 0) { - destv = g_new0 (EDestination *, 2); - destv[0] = e_destination_new (); - e_destination_set_email (destv[0], dialog->email); - destv[1] = NULL; - len = 1; - } else { - destv = g_new0 (EDestination *, len + 1); - for (l = attendee_list, i = 0; l != NULL; l = l->next, i++) { - ECalComponentAttendee *a = l->data; - EDestination *dest; - - dest = e_destination_new (); - if (a->cn != NULL && *a->cn) - e_destination_set_name (dest, a->cn); - if (a->value != NULL && *a->value) - e_destination_set_email (dest, a->value); - - destv[i] = dest; - } - destv[i] = NULL; - } - - bonobo_widget_set_property (BONOBO_WIDGET (dialog->malarm_addresses), - "destinations", e_destination_exportv (destv), NULL); - - for (i = 0; i < len; i++) - g_object_unref (GTK_OBJECT (destv[i])); - g_free (destv); - - e_cal_component_free_attendee_list (attendee_list); - - /* Description */ - e_cal_component_alarm_get_description (alarm, &description); - - text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description)); - gtk_text_buffer_set_text (text_buffer, description.value ? description.value : "", -1); -} - -/* Fills the procedure alarm widgets with the values from the alarm component */ -static void -alarm_to_palarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) -{ - icalattach *attach; - ECalComponentText description; - - e_cal_component_alarm_get_attach (alarm, &attach); - e_cal_component_alarm_get_description (alarm, &description); - - if (attach) { - const char *url; - - if (icalattach_get_is_url (attach)) { - url = icalattach_get_url (attach); - e_dialog_editable_set (dialog->palarm_program, url); - } else - g_message ("alarm_to_palarm_widgets(): Don't know what to do with non-URL " - "attachments"); - - icalattach_unref (attach); - } - - e_dialog_editable_set (dialog->palarm_args, description.value); -} - -enum duration_units { - DUR_MINUTES, - DUR_HOURS, - DUR_DAYS -}; - -static const int duration_units_map[] = { - DUR_MINUTES, - DUR_HOURS, - DUR_DAYS, - -1 -}; - -/* Sigh. Takes an overcomplicated duration value and reduces it to its lowest - * common denominator. - */ -static void -normalize_duration (struct icaldurationtype dur, int *value, enum duration_units *units) -{ - if (dur.seconds != 0 || dur.minutes != 0) { - *value = ((((dur.weeks * 7 + dur.days) * 24 + dur.hours) * 60) + dur.minutes - + dur.seconds / 60 + ((dur.seconds % 60) >= 30 ? 1 : 0)); - *units = DUR_MINUTES; - } else if (dur.hours) { - *value = ((dur.weeks * 7) + dur.days) * 24 + dur.hours; - *units = DUR_HOURS; - } else if (dur.days != 0 || dur.weeks != 0) { - *value = dur.weeks * 7 + dur.days; - *units = DUR_DAYS; - } else { - *value = 0; - *units = DUR_MINUTES; - } -} - -/* Fills the repeat widgets with the values from the alarm component */ -static void -alarm_to_repeat_widgets (Dialog *dialog, ECalComponentAlarm *alarm) -{ - ECalComponentAlarmRepeat repeat; - int value; - enum duration_units units; - - e_cal_component_alarm_get_repeat (alarm, &repeat); - - /* Sensitivity */ - - if (!dialog->repeat || repeat.repetitions == 0) { - gtk_widget_set_sensitive (dialog->repeat_toggle, dialog->repeat); - gtk_widget_set_sensitive (dialog->repeat_group, FALSE); - e_dialog_toggle_set (dialog->repeat_toggle, FALSE); - return; - } - - gtk_widget_set_sensitive (dialog->repeat_group, TRUE); - e_dialog_toggle_set (dialog->repeat_toggle, TRUE); - - /* Repetitions */ - e_dialog_spin_set (dialog->repeat_quantity, repeat.repetitions); - - /* Duration */ - - normalize_duration (repeat.duration, &value, &units); - - e_dialog_spin_set (dialog->repeat_value, value); - e_dialog_option_menu_set (dialog->repeat_unit, units, duration_units_map); -} - -/* Fills the widgets with the values from the alarm component */ -static void -alarm_to_dialog (Dialog *dialog, ECalComponentAlarm *alarm) -{ - ECalComponentAlarmAction action; - - alarm_to_repeat_widgets (dialog, alarm); - - e_cal_component_alarm_get_action (alarm, &action); - - switch (action) { - case E_CAL_COMPONENT_ALARM_NONE: - g_assert_not_reached (); - return; - - case E_CAL_COMPONENT_ALARM_AUDIO: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Audio Alarm Options")); - gtk_widget_show (dialog->aalarm_group); - gtk_widget_hide (dialog->dalarm_group); - gtk_widget_hide (dialog->malarm_group); - gtk_widget_hide (dialog->palarm_group); - alarm_to_aalarm_widgets (dialog, alarm); - break; - - case E_CAL_COMPONENT_ALARM_DISPLAY: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Message Alarm Options")); - gtk_widget_hide (dialog->aalarm_group); - gtk_widget_show (dialog->dalarm_group); - gtk_widget_hide (dialog->malarm_group); - gtk_widget_hide (dialog->palarm_group); - alarm_to_dalarm_widgets (dialog, alarm); - break; - - case E_CAL_COMPONENT_ALARM_EMAIL: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Email Alarm Options")); - gtk_widget_hide (dialog->aalarm_group); - gtk_widget_hide (dialog->dalarm_group); - gtk_widget_show (dialog->malarm_group); - gtk_widget_hide (dialog->palarm_group); - alarm_to_malarm_widgets (dialog, alarm); - break; - - case E_CAL_COMPONENT_ALARM_PROCEDURE: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Program Alarm Options")); - gtk_widget_hide (dialog->aalarm_group); - gtk_widget_hide (dialog->dalarm_group); - gtk_widget_hide (dialog->malarm_group); - gtk_widget_show (dialog->palarm_group); - alarm_to_palarm_widgets (dialog, alarm); - - /* make sure the 'OK' button is disabled while the program entry is empty */ - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog->toplevel), GTK_RESPONSE_OK, FALSE); - g_signal_connect (G_OBJECT (dialog->palarm_program), "changed", - G_CALLBACK (palarm_options_changed_cb), dialog); - g_signal_connect (G_OBJECT (dialog->palarm_args), "changed", - G_CALLBACK (palarm_options_changed_cb), dialog); - break; - - case E_CAL_COMPONENT_ALARM_UNKNOWN: - gtk_window_set_title (GTK_WINDOW (dialog->toplevel), _("Unknown Alarm Options")); - break; - - default: - g_assert_not_reached (); - return; - } - - dialog->action = action; -} - - - -/* Fills the alarm data with the values from the repeat/duration widgets */ -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; - - 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; - - 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); - - /* 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); - 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 alarm data with the values from the widgets */ -static void -dialog_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) -{ - ECalComponentAlarmAction action; - - repeat_widgets_to_alarm (dialog, alarm); - - e_cal_component_alarm_get_action (alarm, &action); - - switch (action) { - case E_CAL_COMPONENT_ALARM_NONE: - g_assert_not_reached (); - break; - - case E_CAL_COMPONENT_ALARM_AUDIO: - aalarm_widgets_to_alarm (dialog, alarm); - break; - - case E_CAL_COMPONENT_ALARM_DISPLAY: - dalarm_widgets_to_alarm (dialog, alarm); - break; - - case E_CAL_COMPONENT_ALARM_EMAIL: - malarm_widgets_to_alarm (dialog, alarm); - break; - - case E_CAL_COMPONENT_ALARM_PROCEDURE: - palarm_widgets_to_alarm (dialog, alarm); - break; - - case E_CAL_COMPONENT_ALARM_UNKNOWN: - break; - - default: - g_assert_not_reached (); - } -} - - - -/** - * alarm_options_dialog_run: - * @alarm: Alarm that is to be edited. - * - * Runs an alarm options dialog modally. - * - * Return value: TRUE if the dialog could be created, FALSE otherwise. - **/ -gboolean -alarm_options_dialog_run (GtkWidget *parent, ECalComponentAlarm *alarm, const char *email, gboolean repeat) -{ - Dialog dialog; - int response_id; - GList *icon_list; - - g_return_val_if_fail (alarm != NULL, FALSE); - - dialog.repeat = repeat; - dialog.email = email; - dialog.xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-options.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, alarm); - - 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); - - if (response_id == GTK_RESPONSE_OK) - dialog_to_alarm (&dialog, alarm); - - gtk_widget_destroy (dialog.toplevel); - g_object_unref(dialog.xml); - - return TRUE; -} - diff --git a/calendar/gui/dialogs/alarm-options.glade b/calendar/gui/dialogs/alarm-options.glade deleted file mode 100644 index d58e817ba3..0000000000 --- a/calendar/gui/dialogs/alarm-options.glade +++ /dev/null @@ -1,573 +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-options-toplevel"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="title" translatable="yes">dialog1</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">True</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="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="GtkVBox" id="vbox1"> - <property name="border_width">4</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkFrame" id="frame1"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="border_width">6</property> - <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">4</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">1 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">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">Alarm Repeat</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">label_item</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="GtkVBox" id="dalarm-group"> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="label" translatable="yes">Message to Display:</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="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="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="aalarm-group"> - <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">Play sound:</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="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">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="malarm-group"> - <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="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="label" translatable="yes">Message to Send</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="GtkScrolledWindow" id="scrolledwindow2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> - <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> - <property name="shadow_type">GTK_SHADOW_NONE</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="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="GtkHBox" id="palarm-group"> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkLabel" id="label5"> - <property name="visible">True</property> - <property name="label" translatable="yes">Run program:</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="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="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label6"> - <property name="visible">True</property> - <property name="label" translatable="yes">With these arguments:</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="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="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">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/calendar/gui/dialogs/alarm-options.h b/calendar/gui/dialogs/alarm-options.h deleted file mode 100644 index 9811edf253..0000000000 --- a/calendar/gui/dialogs/alarm-options.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Evolution calendar - Alarm options dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef ALARM_OPTIONS_H -#define ALARM_OPTIONS_H - -#include <libecal/e-cal-component.h> - -gboolean alarm_options_dialog_run (GtkWidget *parent, ECalComponentAlarm *alarm, const char *email, gboolean repeat); - -#endif diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 9c9d88f25b..e723d62fd2 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -872,42 +872,89 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) /* Alarm */ e_cal_component_remove_all_alarms (comp); if (e_dialog_toggle_get (priv->alarm)) { - 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); + if (is_custom_alarm_store (priv->alarm_list_store, 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); + 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; + 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; + 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_HOUR: + trigger.u.rel_duration.hours = 1; + break; - case ALARM_1_DAY: - trigger.u.rel_duration.days = 1; - break; + case ALARM_1_DAY: + trigger.u.rel_duration.days = 1; + break; - default: - break; - } - e_cal_component_alarm_set_trigger (ca, trigger); + default: + break; + } + e_cal_component_alarm_set_trigger (ca, trigger); - e_cal_component_add_alarm (comp, ca); + e_cal_component_add_alarm (comp, ca); + } } return TRUE; @@ -1547,11 +1594,14 @@ alarm_custom_clicked_cb (GtkWidget *widget, gpointer data) { EventPage *epage; EventPagePrivate *priv; + GtkWidget *toplevel; epage = EVENT_PAGE (data); priv = epage->priv; - alarm_list_dialog_run (gtk_widget_get_toplevel (priv->main), COMP_EDITOR_PAGE (epage)->client, priv->alarm_list_store); + toplevel = gtk_widget_get_toplevel (priv->main); + if (alarm_list_dialog_run (toplevel, COMP_EDITOR_PAGE (epage)->client, priv->alarm_list_store)) + comp_editor_page_notify_changed (COMP_EDITOR_PAGE (epage)); sensitize_widgets (epage); } |