aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-09-04 08:36:49 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-09-04 08:36:49 +0800
commitb5660966bdf769a48a01efb003a9958d62b23140 (patch)
tree5c719303c3bffca8175259ca90ef361e9af85726 /calendar/gui/dialogs
parent154129242bc071ca620311184fa94b62e2e6684d (diff)
downloadgsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar.gz
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.tar.zst
gsoc2013-evolution-b5660966bdf769a48a01efb003a9958d62b23140.zip
don't call calendar_config_check_timezone_set() now, since the startup
2001-09-03 Damon Chaplin <damon@ximian.com> * gui/calendar-commands.c (calendar_control_activate): * gui/tasks-control.c (tasks_control_activate): don't call calendar_config_check_timezone_set() now, since the startup wizard handles that. * gui/e-tasks.c (e_tasks_class_init): changed selection_changed signal to GTK_RUN_LAST. It has no reason to be GTK_RUN_FIRST. * gui/gnome-cal.c: * gui/e-week-view.c: * gui/e-day-view.c: added "selection_changed" signal, XX_delete_event() and XX_get_num_events_selected(). * gui/e-day-view-top-item.c (e_day_view_top_item_draw): fix the shadow around the dates at the top - it was 1 pixel off. * gui/calendar-commands.c: added sensitize_commands(), similar to in tasks-control.c, so we only make Cut/Copy/Delete sensitive when an event is selected. Also added delete_event_cmd(). * gui/dialogs/task-page.c (task_page_set_summary): * gui/dialogs/event-page.c (event_page_set_summary): do nothing, since the summary only gets changed on the main event/task page now. Fixes bug #6939. * gui/e-day-view.c (e_day_view_on_main_canvas_drag_data_received): (e_day_view_on_top_canvas_drag_data_received): check that we are dragging an event from the same EDayView. We currently don't support DnD from other widgets. (e_day_view_update_top_canvas_drag): only get the summary if we actually have an event. Fixes bug #5162. * gui/e-day-view.c (e_day_view_on_editing_stopped): if the text hasn't changed we need to call e_day_view_update_event_label() to show the times again if necessary. Fixes bug #1813. * gui/dialogs/comp-editor.c (comp_editor_destroy): destroy the CompEditorPage objects here rather than in close_dialog(), after the widgets have been destroyed. We do this because the widgets have lots of signal handlers connected with the CompEditorPage objects as the signal data, so we want to ensure that the data pointer is always valid. (Alternatively we could disconnect all the handlers when the CompEditorPage objects are destroyed, or use connect_while_alive()). Fixes bug #7543. Note: there is still a small bug in that if you type in a time and then hit 'Save and Close', the time won't be saved. I'm not sure where this should be fixed - should the actions which close the dialog grab the focus to the toplevel, so any widgets currently being edited finish the edit and emit 'changed'? * gui/dialogs/recurrence-page.c (append_exception): use gtk_clist_set_row_data_full() so freeing is handled automatically by the GtkClist. This helps avoid problems at destroy-time. (exception_delete_cb): just call gtk_clist_remove() now. No need to free the row data as GtkCList now handles it. (recurrence_page_destroy): no need to free the data in the clist. * gui/dialogs/alarm-page.c: ditto. * gui/dialogs/meeting-page.c: ditto. (etable_destroy_cb): save the ETable state in this new handler cb rather than in the destroy method, since the widget will already be destroyed by then. svn path=/trunk/; revision=12575
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/alarm-page.c38
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c5
-rw-r--r--calendar/gui/dialogs/comp-editor.c11
-rw-r--r--calendar/gui/dialogs/event-page.c10
-rw-r--r--calendar/gui/dialogs/meeting-page.c23
-rw-r--r--calendar/gui/dialogs/recurrence-page.c40
-rw-r--r--calendar/gui/dialogs/task-page.c10
7 files changed, 36 insertions, 101 deletions
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c
index 9cf15bafd7..5ef9a2c15c 100644
--- a/calendar/gui/dialogs/alarm-page.c
+++ b/calendar/gui/dialogs/alarm-page.c
@@ -211,32 +211,6 @@ alarm_page_init (AlarmPage *apage)
priv->updating = FALSE;
}
-/* Frees all the alarm data and empties the list */
-static void
-free_alarms (AlarmPage *apage)
-{
- AlarmPagePrivate *priv;
- int i;
-
- priv = apage->priv;
-
- if (priv->list != NULL) {
- GtkCList *clist = GTK_CLIST (priv->list);
-
- for (i = 0; i < clist->rows; i++) {
- CalComponentAlarm *alarm;
-
- alarm = gtk_clist_get_row_data (clist, i);
- g_assert (alarm != NULL);
- cal_component_alarm_free (alarm);
-
- gtk_clist_set_row_data (clist, i, NULL);
- }
-
- gtk_clist_clear (clist);
- }
-}
-
/* Destroy handler for the alarm page */
static void
alarm_page_destroy (GtkObject *object)
@@ -255,8 +229,6 @@ alarm_page_destroy (GtkObject *object)
priv->xml = NULL;
}
- free_alarms (apage);
-
if (priv->alarm) {
cal_component_alarm_free (priv->alarm);
priv->alarm = NULL;
@@ -319,7 +291,7 @@ clear_widgets (AlarmPage *apage)
e_dialog_option_menu_set (priv->time, CAL_ALARM_TRIGGER_RELATIVE_START, time_map);
/* List data */
- free_alarms (apage);
+ gtk_clist_clear (GTK_CLIST (priv->list));
}
static char *
@@ -453,7 +425,7 @@ append_reminder (AlarmPage *apage, CalComponentAlarm *alarm)
c[0] = get_alarm_string (alarm);
i = gtk_clist_append (clist, c);
- gtk_clist_set_row_data (clist, i, alarm);
+ gtk_clist_set_row_data_full (clist, i, alarm, (GtkDestroyNotify) cal_component_alarm_free);
gtk_clist_select_row (clist, i, 0);
g_free (c[0]);
@@ -704,7 +676,6 @@ delete_clicked_cb (GtkButton *button, gpointer data)
AlarmPage *apage;
AlarmPagePrivate *priv;
GtkCList *clist;
- CalComponentAlarm *alarm;
int sel;
apage = ALARM_PAGE (data);
@@ -716,11 +687,6 @@ delete_clicked_cb (GtkButton *button, gpointer data)
sel = GPOINTER_TO_INT (clist->selection->data);
- alarm = gtk_clist_get_row_data (clist, sel);
- g_assert (alarm != NULL);
- cal_component_alarm_free (alarm);
- gtk_clist_set_row_data (clist, sel, NULL);
-
gtk_clist_remove (clist, sel);
if (sel >= clist->rows)
sel--;
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 630c6b78de..375d51918f 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -339,8 +339,9 @@ comp_editor_show_contacts_dialog (GNOME_Evolution_Addressbook_SelectNames corba_
}
-/* A simple 'name <email>' parser.
- FIXME: Should probably use camel functions or something. */
+/* A simple 'name <email>' parser. Input should be UTF8.
+ FIXME: Should probably use camel functions or something.
+ Also note that this is broken wrt UTF8 - can't use strchr etc. */
static void
parse_contact_string (const char *value, char **name, char **email)
{
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 5b80de6bee..433a9879aa 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -242,6 +242,7 @@ comp_editor_destroy (GtkObject *object)
{
CompEditor *editor;
CompEditorPrivate *priv;
+ GList *l;
editor = COMP_EDITOR (object);
priv = editor->priv;
@@ -251,6 +252,12 @@ comp_editor_destroy (GtkObject *object)
priv->window = NULL;
}
+ /* We want to destroy the pages after the widgets get destroyed,
+ since they have lots of signal handlers connected to the widgets
+ with the pages as the data. */
+ for (l = priv->pages; l != NULL; l = l->next)
+ gtk_object_unref (GTK_OBJECT (l->data));
+
gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), editor);
g_free (priv);
@@ -807,15 +814,11 @@ static void
close_dialog (CompEditor *editor)
{
CompEditorPrivate *priv;
- GList *l;
priv = editor->priv;
g_assert (priv->window != NULL);
- for (l = priv->pages; l != NULL; l = l->next)
- gtk_object_unref (GTK_OBJECT (l->data));
-
gtk_object_destroy (GTK_OBJECT (editor));
}
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index a8ab66af6a..74fdecb6ee 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -696,15 +696,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
static void
event_page_set_summary (CompEditorPage *page, const char *summary)
{
- EventPage *epage;
- EventPagePrivate *priv;
-
- epage = EVENT_PAGE (page);
- priv = epage->priv;
-
- gtk_signal_handler_block_by_data (GTK_OBJECT (priv->summary), epage);
- e_utf8_gtk_entry_set_text (GTK_ENTRY (priv->summary), summary);
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->summary), epage);
+ /* nothing */
}
static void
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 529ea63c6e..2af24d2400 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -291,8 +291,6 @@ meeting_page_destroy (GtkObject *object)
{
MeetingPage *mpage;
MeetingPagePrivate *priv;
- ETable *real_table;
- char *filename;
g_return_if_fail (object != NULL);
g_return_if_fail (IS_MEETING_PAGE (object));
@@ -309,12 +307,6 @@ meeting_page_destroy (GtkObject *object)
itip_addresses_free (priv->addresses);
g_list_free (priv->address_strings);
- filename = g_strdup_printf ("%s/config/et-header-meeting-page",
- evolution_dir);
- real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (priv->etable));
- e_table_save_state (real_table, filename);
- g_free (filename);
-
if (priv->xml) {
gtk_object_unref (GTK_OBJECT (priv->xml));
priv->xml = NULL;
@@ -1227,6 +1219,17 @@ value_to_string (ETableModel *etm, int col, const void *val, void *data)
}
static void
+etable_destroy_cb (ETable *real_table, MeetingPage *mpage)
+{
+ char *filename;
+
+ filename = g_strdup_printf ("%s/config/et-header-meeting-page",
+ evolution_dir);
+ e_table_save_state (real_table, filename);
+ g_free (filename);
+}
+
+static void
build_etable (MeetingPage *mpage)
{
MeetingPagePrivate *priv;
@@ -1330,6 +1333,10 @@ build_etable (MeetingPage *mpage)
g_free (filename);
gtk_signal_connect (GTK_OBJECT (real_table),
+ "destroy", GTK_SIGNAL_FUNC (etable_destroy_cb),
+ mpage);
+
+ gtk_signal_connect (GTK_OBJECT (real_table),
"right_click", GTK_SIGNAL_FUNC (right_click_cb), mpage);
gtk_object_unref (GTK_OBJECT (extras));
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 586a291bfb..ff9485d8ff 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -277,30 +277,13 @@ recurrence_page_init (RecurrencePage *rpage)
priv->comp = NULL;
}
-/* Frees the rows and the row data in the exceptions GtkCList */
+/* Frees the CalComponentDateTime stored in the GtkCList */
static void
-free_exception_clist_data (RecurrencePage *rpage)
+free_exception_date_time (CalComponentDateTime *dt)
{
- RecurrencePagePrivate *priv;
- int i;
-
- priv = rpage->priv;
-
- if (priv->exception_list) {
- GtkCList *clist = GTK_CLIST (priv->exception_list);
-
- for (i = 0; i < clist->rows; i++) {
- CalComponentDateTime *dt;
-
- dt = gtk_clist_get_row_data (clist, i);
- g_free (dt->value);
- g_free ((char*)dt->tzid);
- g_free (dt);
- gtk_clist_set_row_data (clist, i, NULL);
- }
-
- gtk_clist_clear (clist);
- }
+ g_free (dt->value);
+ g_free ((char*)dt->tzid);
+ g_free (dt);
}
/* Destroy handler for the recurrence page */
@@ -321,8 +304,6 @@ recurrence_page_destroy (GtkObject *object)
priv->xml = NULL;
}
- free_exception_clist_data (rpage);
-
g_free (priv);
rpage->priv = NULL;
@@ -411,7 +392,7 @@ clear_widgets (RecurrencePage *rpage)
gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage);
/* Exceptions list */
- free_exception_clist_data (rpage);
+ gtk_clist_clear (GTK_CLIST (priv->exception_list));
}
/* Builds a static string out of an exception date */
@@ -462,7 +443,7 @@ append_exception (RecurrencePage *rpage, CalComponentDateTime *datetime)
c[0] = get_exception_string (dt);
i = gtk_clist_append (clist, c);
- gtk_clist_set_row_data (clist, i, dt);
+ gtk_clist_set_row_data_full (clist, i, dt, (GtkDestroyNotify) free_exception_date_time);
gtk_clist_select_row (clist, i, 0);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (clist), rpage);
@@ -2026,7 +2007,6 @@ exception_delete_cb (GtkWidget *widget, gpointer data)
RecurrencePagePrivate *priv;
GtkCList *clist;
int sel;
- CalComponentDateTime *dt;
rpage = RECURRENCE_PAGE (data);
priv = rpage->priv;
@@ -2039,12 +2019,6 @@ exception_delete_cb (GtkWidget *widget, gpointer data)
sel = GPOINTER_TO_INT (clist->selection->data);
- dt = gtk_clist_get_row_data (clist, sel);
- g_assert (dt != NULL);
- g_free (dt->value);
- g_free ((char*)dt->tzid);
- g_free (dt);
-
gtk_clist_remove (clist, sel);
if (sel >= clist->rows)
sel--;
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 729ec8c641..048adf31ad 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -571,15 +571,7 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
static void
task_page_set_summary (CompEditorPage *page, const char *summary)
{
- TaskPage *tpage;
- TaskPagePrivate *priv;
-
- tpage = TASK_PAGE (page);
- priv = tpage->priv;
-
- priv->updating = TRUE;
- e_utf8_gtk_entry_set_text (GTK_ENTRY (priv->summary), summary);
- priv->updating = FALSE;
+ /* nothing */
}
static void