[PATCH] Grow the spoke gradient image to fit the nav_area (#1035772).

Vratislav Podzimek vpodzime at redhat.com
Mon Jan 13 10:03:51 UTC 2014


On Fri, 2014-01-10 at 17:21 -0500, Chris Lumens wrote:
> The nav_area might be taller than we expect on certain languages, like Kannada.
> Because we were shrinking the nav_area to fit the size of the image, widgets
> in the nav_area looked like they were spilling over.  Instead, we should force
> the image to fit in however big GTK decides to make the nav_area.
> ---
>  widgets/src/SpokeWindow.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/widgets/src/SpokeWindow.c b/widgets/src/SpokeWindow.c
> index 6b87785..a214665 100644
> --- a/widgets/src/SpokeWindow.c
> +++ b/widgets/src/SpokeWindow.c
> @@ -134,6 +134,7 @@ static void anaconda_spoke_window_init(AnacondaSpokeWindow *win) {
>  }
>  
>  static void anaconda_spoke_window_realize(GtkWidget *widget, gpointer user_data) {
> +    GtkWidget *nav_box;
>      GtkAccelGroup *accel_group;
>      GError *error;
>      GdkPixbuf *pixbuf;
> @@ -150,15 +151,15 @@ static void anaconda_spoke_window_realize(GtkWidget *widget, gpointer user_data)
>       */
>      error = NULL;
>      file = g_strdup_printf("%s/pixmaps/anaconda_spoke_header.png", get_widgets_datadir());
> -    pixbuf = gdk_pixbuf_new_from_file(file, &error);
> +
> +    nav_box = anaconda_base_window_get_nav_area_background_window(ANACONDA_BASE_WINDOW(window));
> +    pixbuf = gdk_pixbuf_new_from_file_at_scale(file, -1, gdk_window_get_height(gtk_widget_get_window(nav_box)), FALSE, &error);
> +
>      g_free(file);
>      if (!pixbuf) {
>          fprintf(stderr, "could not load header background: %s\n", error->message);
>          g_error_free(error);
>      } else {
> -        GtkWidget *nav_box = anaconda_base_window_get_nav_area_background_window(ANACONDA_BASE_WINDOW(window));
> -        gtk_widget_set_size_request(nav_box, -1, gdk_pixbuf_get_height (pixbuf));
> -
>          surface = gdk_window_create_similar_surface(gtk_widget_get_window(nav_box), CAIRO_CONTENT_COLOR_ALPHA,
>                                                      gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
>          cr = cairo_create(surface);
ACK. I had no idea something like that is possible.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list