From db14454c1d9f8a89e13e4469c771d9ce5d543135 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 19 Dec 2003 19:50:50 +0000 Subject: make sure there is a ui container 2003-12-19 JP Rosevear * gui/tasks-control.c (tasks_control_sensitize_commands): make sure there is a ui container * gui/calendar-commands.c (calendar_control_sensitize_calendar_commands): ditto * gui/tasks-component.c (impl_createControls): update after the signals are connected so that the ecal's are actually loaded * gui/calendar-component.c: ditto svn path=/trunk/; revision=23990 --- calendar/ChangeLog | 12 ++++++++++++ calendar/gui/calendar-commands.c | 3 +++ calendar/gui/calendar-component.c | 9 +++++---- calendar/gui/tasks-component.c | 12 ++++++------ calendar/gui/tasks-control.c | 3 +++ 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 4275af7a1d..bdccbfb0b8 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,15 @@ +2003-12-19 JP Rosevear + + * gui/tasks-control.c (tasks_control_sensitize_commands): make + sure there is a ui container + + * gui/calendar-commands.c (calendar_control_sensitize_calendar_commands): ditto + + * gui/tasks-component.c (impl_createControls): update after the + signals are connected so that the ecal's are actually loaded + + * gui/calendar-component.c: ditto + 2003-12-19 William Jon McCann * gui/dialogs/task-page.c (source_changed_cb): diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index cc7896bd13..c03b722de9 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -513,6 +513,9 @@ calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalen uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); + if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL) + return; + view = gnome_calendar_get_current_view_widget (gcal); list = e_calendar_view_get_selected_events (E_CALENDAR_VIEW (view)); diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index b978c003a6..bf29355b9d 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -196,6 +196,7 @@ update_uri_for_primary_selection (CalendarComponent *calendar_component) gnome_calendar_set_default_uri (priv->calendar, uri); g_free (uri); + /* Make sure we are embedded first */ calendar_control_sensitize_calendar_commands (priv->view_control, priv->calendar, TRUE); /* Save the selection for next time we start up */ @@ -573,10 +574,6 @@ impl_createControls (PortableServer_Servant servant, e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget)); statusbar_control = bonobo_control_new (statusbar_widget); - /* Load the selection from the last run */ - update_selection (calendar_component); - update_primary_selection (calendar_component); - /* connect after setting the initial selections, or we'll get unwanted calls to calendar_control_sensitize_calendar_commands */ g_signal_connect_object (priv->source_selector, "selection_changed", @@ -589,6 +586,10 @@ impl_createControls (PortableServer_Servant servant, G_CALLBACK (fill_popup_menu_cb), G_OBJECT (calendar_component), 0); + /* Load the selection from the last run */ + update_selection (calendar_component); + update_primary_selection (calendar_component); + /* If it gets fiddled with update */ not = calendar_config_add_notification_calendars_selected (config_selection_changed_cb, calendar_component); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 2b57dc5411..2f89ea31bb 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -198,8 +198,9 @@ update_uri_for_primary_selection (TasksComponent *component) cal_table = e_tasks_get_calendar_table (priv->tasks); etable = e_calendar_table_get_table (cal_table); - tasks_control_sensitize_commands (priv->view_control, priv->tasks, e_table_selected_count (etable)); + tasks_control_sensitize_commands (priv->view_control, priv->tasks, e_table_selected_count (etable)); + /* Save the selection for next time we start up */ calendar_config_set_primary_tasks (e_source_peek_uid (source)); } @@ -529,11 +530,6 @@ impl_createControls (PortableServer_Servant servant, priv->tasks = (ETasks *) bonobo_control_get_widget (priv->view_control); - - /* Load the selection from the last run */ - update_selection (component); - update_primary_selection (component); - /* connect after setting the initial selections, or we'll get unwanted calls to tasks_control_sensitize_commands */ g_signal_connect_object (priv->source_selector, "selection_changed", @@ -546,6 +542,10 @@ impl_createControls (PortableServer_Servant servant, G_CALLBACK (fill_popup_menu_cb), G_OBJECT (component), 0); + /* Load the selection from the last run */ + update_selection (component); + update_primary_selection (component); + /* If it gets fiddled with update */ not = calendar_config_add_notification_tasks_selected (config_selection_changed_cb, component); diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index cd1e00fedf..fc4b560f76 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -240,6 +240,9 @@ tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, int n_s uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); + if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL) + return; + model = e_calendar_table_get_model (e_tasks_get_calendar_table (tasks)); e_cal_is_read_only (e_cal_model_get_default_client (model), &read_only, NULL); -- cgit v1.2.3