Inhomogeneous nonlinear shallow-water equations are studied using the Carrier-Greenspan approach and the resulting equations are solved analytically. The Carrier-Greenspan transformations are commonly used hodograph transformations that transform the nonlinear shallow-water equations into a set of linear equations in which partial derivatives with respect to two auxiliary variables appear. Yet, when the resulting initial-value problem is treated analytically through the use of Green's functions, the partial derivatives of the Green's functions have non-integrable singularities. This has forced researchers to numerically differentiate the convolutions of the Green's functions. In this work we remedy this problem by differentiating the initial condition rather than the Green's function itself; we also perform a change of variables that renders the entire problem more easily treatable. This particular Green's function approach is especially useful to treat sources that are extended in time; we therefore apply it to model the run-down and run-up of the tsunami waves triggered by submarine landslides. Another advantage of the method presented is that the parametrization of the landslide using sources is done within the integral algorithm that is used for the rest of the problem instead of treating the landslide-generated wave as a separate incident wave. The method proves to be more accurate than the techniques based on Bessel function expansions if the sources are very localized.