diff options
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/alarm-page.c | 38 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.c | 5 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 11 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 23 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 40 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 10 |
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 |