From 801fe3e280e170c90f0c8f2bf4f7cfeea4d52160 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Tue, 11 Dec 2012 17:07:04 -0500 Subject: Add a gradient background to spoke headers (mizmo, clumens). The idea here is that by adding a gradient up top, the "Done" button looks more like it belongs with the header than with the widgets down in the spoke. It also subtly makes the spoke look like a subpart of the hub. Adding this required adding an additional internal widget, which means also changing all existing glade files to include this internal widget. Make sure to build new glade support and install locally (or use the proper makefile targets) before editing. --- data/pixmaps/anaconda_spoke_header.png | Bin 0 -> 185 bytes pyanaconda/ui/gui/hubs/progress.glade | 14 +++++--- pyanaconda/ui/gui/hubs/summary.glade | 14 +++++--- pyanaconda/ui/gui/spokes/custom.glade | 28 +++++++++------- pyanaconda/ui/gui/spokes/datetime_spoke.glade | 20 +++++++----- pyanaconda/ui/gui/spokes/keyboard.glade | 10 ++++-- pyanaconda/ui/gui/spokes/network.glade | 30 +++++++++++------- pyanaconda/ui/gui/spokes/password.glade | 16 ++++++---- pyanaconda/ui/gui/spokes/software.glade | 10 ++++-- pyanaconda/ui/gui/spokes/source.glade | 10 ++++-- pyanaconda/ui/gui/spokes/storage.glade | 10 ++++-- pyanaconda/ui/gui/spokes/welcome.glade | 44 +++++++++++++++----------- scripts/makeupdates | 2 ++ widgets/glade/AnacondaWidgets.xml | 12 +++++-- widgets/src/BaseWindow.c | 26 +++++++++++++-- widgets/src/BaseWindow.h | 1 + widgets/src/SpokeWindow.c | 35 +++++++++++++++++++- 17 files changed, 199 insertions(+), 83 deletions(-) create mode 100644 data/pixmaps/anaconda_spoke_header.png diff --git a/data/pixmaps/anaconda_spoke_header.png b/data/pixmaps/anaconda_spoke_header.png new file mode 100644 index 000000000..f1feefc06 Binary files /dev/null and b/data/pixmaps/anaconda_spoke_header.png differ diff --git a/pyanaconda/ui/gui/hubs/progress.glade b/pyanaconda/ui/gui/hubs/progress.glade index 37bd0bb39..11e29f550 100644 --- a/pyanaconda/ui/gui/hubs/progress.glade +++ b/pyanaconda/ui/gui/hubs/progress.glade @@ -11,11 +11,15 @@ False vertical - - - False - - + + + + + False + + + + diff --git a/pyanaconda/ui/gui/hubs/summary.glade b/pyanaconda/ui/gui/hubs/summary.glade index 2fd406563..36b7aef34 100644 --- a/pyanaconda/ui/gui/hubs/summary.glade +++ b/pyanaconda/ui/gui/hubs/summary.glade @@ -13,11 +13,15 @@ False vertical - - - False - - + + + + + False + + + + diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade index 67f41e5e6..9bf53d5da 100644 --- a/pyanaconda/ui/gui/spokes/custom.glade +++ b/pyanaconda/ui/gui/spokes/custom.glade @@ -326,18 +326,22 @@ use. Try something else? False vertical 6 - - - False - 6 - 6 - 6 - - - False - False - 0 - + + + + + False + 6 + 6 + 6 + + + + + False + False + 0 + diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.glade b/pyanaconda/ui/gui/spokes/datetime_spoke.glade index ecff05120..d30264518 100644 --- a/pyanaconda/ui/gui/spokes/datetime_spoke.glade +++ b/pyanaconda/ui/gui/spokes/datetime_spoke.glade @@ -35,14 +35,18 @@ False vertical 6 - - - False - 6 - 6 - 6 - 2 - 2 + + + + + False + 6 + 6 + 6 + 2 + 2 + + False diff --git a/pyanaconda/ui/gui/spokes/keyboard.glade b/pyanaconda/ui/gui/spokes/keyboard.glade index 9ca9aaf5e..6f63d8dbb 100644 --- a/pyanaconda/ui/gui/spokes/keyboard.glade +++ b/pyanaconda/ui/gui/spokes/keyboard.glade @@ -185,9 +185,13 @@ False vertical - - - False + + + + + False + + False diff --git a/pyanaconda/ui/gui/spokes/network.glade b/pyanaconda/ui/gui/spokes/network.glade index 27afea80a..5fc0613e1 100644 --- a/pyanaconda/ui/gui/spokes/network.glade +++ b/pyanaconda/ui/gui/spokes/network.glade @@ -41,14 +41,18 @@ False vertical 6 - - - False - 6 - 6 - 6 - - + + + + + False + 6 + 6 + 6 + + + + @@ -109,9 +113,13 @@ updates available for you. False vertical - - - False + + + + + False + + False diff --git a/pyanaconda/ui/gui/spokes/password.glade b/pyanaconda/ui/gui/spokes/password.glade index 31f07406b..043f0ada1 100644 --- a/pyanaconda/ui/gui/spokes/password.glade +++ b/pyanaconda/ui/gui/spokes/password.glade @@ -13,12 +13,16 @@ False vertical 6 - - - False - 6 - 6 - 6 + + + + + False + 6 + 6 + 6 + + False diff --git a/pyanaconda/ui/gui/spokes/software.glade b/pyanaconda/ui/gui/spokes/software.glade index 4f049fb8b..676c14d77 100644 --- a/pyanaconda/ui/gui/spokes/software.glade +++ b/pyanaconda/ui/gui/spokes/software.glade @@ -37,9 +37,13 @@ True True vertical - - - False + + + + + False + + False diff --git a/pyanaconda/ui/gui/spokes/source.glade b/pyanaconda/ui/gui/spokes/source.glade index f80f2f8a5..07fc23d5c 100644 --- a/pyanaconda/ui/gui/spokes/source.glade +++ b/pyanaconda/ui/gui/spokes/source.glade @@ -830,9 +830,13 @@ TeXlive 2012 repository False vertical - - - False + + + + + False + + False diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade index 68461f76c..8d7c47081 100644 --- a/pyanaconda/ui/gui/spokes/storage.glade +++ b/pyanaconda/ui/gui/spokes/storage.glade @@ -851,9 +851,13 @@ True vertical 6 - - - False + + + + + False + + False diff --git a/pyanaconda/ui/gui/spokes/welcome.glade b/pyanaconda/ui/gui/spokes/welcome.glade index 3a3135b2e..a10c136d2 100644 --- a/pyanaconda/ui/gui/spokes/welcome.glade +++ b/pyanaconda/ui/gui/spokes/welcome.glade @@ -136,12 +136,16 @@ False vertical 6 - - - False - 6 - 6 - 6 + + + + + False + 6 + 6 + 6 + + False @@ -205,18 +209,22 @@ False vertical - - - False - - - - - - False - False - 0 - + + + + + False + + + + + + + + False + False + 0 + diff --git a/scripts/makeupdates b/scripts/makeupdates index 1c482a4f0..c69cd0a22 100755 --- a/scripts/makeupdates +++ b/scripts/makeupdates @@ -165,6 +165,8 @@ def copyUpdatedFiles(tag, updates, cwd): install_to_dir(file, "usr/sbin") elif file == "data/70-anaconda.rules": install_to_dir(file, "lib/udev/rules.d") + elif file.startswith("data/pixmaps"): + install_to_dir(file, "usr/share/anaconda/pixmaps") elif file.startswith("data/ui/"): install_to_dir(file, "usr/share/anaconda/ui") elif file.startswith("data/post-scripts/"): diff --git a/widgets/glade/AnacondaWidgets.xml b/widgets/glade/AnacondaWidgets.xml index e0074cfba..1ede27520 100644 --- a/widgets/glade/AnacondaWidgets.xml +++ b/widgets/glade/AnacondaWidgets.xml @@ -38,7 +38,9 @@ - + + + @@ -58,7 +60,9 @@ - + + + @@ -80,7 +84,9 @@ - + + + diff --git a/widgets/src/BaseWindow.c b/widgets/src/BaseWindow.c index 510572249..23b9998e1 100644 --- a/widgets/src/BaseWindow.c +++ b/widgets/src/BaseWindow.c @@ -90,7 +90,7 @@ struct _AnacondaBaseWindowPrivate { gboolean is_beta, info_shown; GtkWidget *main_box, *event_box, *info_bar; GtkWidget *alignment; - GtkWidget *nav_area, *action_area; + GtkWidget *nav_box, *nav_area, *action_area; GtkWidget *name_label, *distro_label, *beta_label; /* Untranslated versions of various things. */ @@ -209,13 +209,19 @@ static void anaconda_base_window_init(AnacondaBaseWindow *win) { /* Then the navigation area that sits as the first item in the main box * for every Window class. */ + + win->priv->nav_box = gtk_event_box_new(); + gtk_widget_set_app_paintable(win->priv->nav_box, TRUE); + gtk_box_pack_start(GTK_BOX(win->priv->main_box), win->priv->nav_box, FALSE, FALSE, 0); + win->priv->nav_area = gtk_grid_new(); gtk_grid_set_row_homogeneous(GTK_GRID(win->priv->nav_area), FALSE); gtk_grid_set_column_homogeneous(GTK_GRID(win->priv->nav_area), FALSE); gtk_widget_set_margin_left(win->priv->nav_area, 6); gtk_widget_set_margin_right(win->priv->nav_area, 6); gtk_widget_set_margin_top(win->priv->nav_area, 6); - gtk_box_pack_start(GTK_BOX(win->priv->main_box), win->priv->nav_area, FALSE, FALSE, 0); + + gtk_container_add(GTK_CONTAINER(win->priv->nav_box), win->priv->nav_area); /* Second in the main box is an alignment, because we want to be able * to control the amount of space the Window's content takes up on the @@ -374,6 +380,20 @@ GtkWidget *anaconda_base_window_get_nav_area(AnacondaBaseWindow *win) { return win->priv->nav_area; } +/** + * anaconda_base_window_get_nav_area_background_window: + * @win: a #AnacondaBaseWindow + * + * Returns the event box that houses background window of the navigation area of @win. + * + * Returns: (transfer none): The event box + * + * Since: 1.0 + */ +GtkWidget *anaconda_base_window_get_nav_area_background_window(AnacondaBaseWindow *win) { + return win->priv->nav_box; +} + /** * anaconda_base_window_get_main_box: * @win: a #AnacondaBaseWindow @@ -576,6 +596,8 @@ anaconda_base_window_buildable_get_internal_child (GtkBuildable *buildable, return G_OBJECT(anaconda_base_window_get_main_box(ANACONDA_BASE_WINDOW(buildable))); else if (!strcmp(childname, "nav_area")) return G_OBJECT(ANACONDA_BASE_WINDOW(buildable)->priv->nav_area); + else if (!strcmp(childname, "nav_box")) + return G_OBJECT(ANACONDA_BASE_WINDOW(buildable)->priv->nav_box); else if (!strcmp(childname, "alignment")) return G_OBJECT(ANACONDA_BASE_WINDOW(buildable)->priv->alignment); else if (!strcmp(childname, "action_area")) diff --git a/widgets/src/BaseWindow.h b/widgets/src/BaseWindow.h index ef9c21068..6c08ee8c4 100644 --- a/widgets/src/BaseWindow.h +++ b/widgets/src/BaseWindow.h @@ -80,6 +80,7 @@ GtkWidget *anaconda_base_window_get_action_area (AnacondaBaseWindow *win); GtkWidget *anaconda_base_window_get_alignment (AnacondaBaseWindow *win); GtkWidget *anaconda_base_window_get_main_box (AnacondaBaseWindow *win); GtkWidget *anaconda_base_window_get_nav_area (AnacondaBaseWindow *win); +GtkWidget *anaconda_base_window_get_nav_area_background_window (AnacondaBaseWindow *win); G_END_DECLS diff --git a/widgets/src/SpokeWindow.c b/widgets/src/SpokeWindow.c index bafc5ab1f..16ce3f87a 100644 --- a/widgets/src/SpokeWindow.c +++ b/widgets/src/SpokeWindow.c @@ -124,12 +124,45 @@ GtkWidget *anaconda_spoke_window_new() { } static void anaconda_spoke_window_init(AnacondaSpokeWindow *win) { - GtkWidget *nav_area; + GError *error; + GtkWidget *nav_area, *nav_box; + GdkPixbuf *pixbuf; + cairo_pattern_t *pattern; + cairo_surface_t *surface; + cairo_t *cr; win->priv = G_TYPE_INSTANCE_GET_PRIVATE(win, ANACONDA_TYPE_SPOKE_WINDOW, AnacondaSpokeWindowPrivate); + /* Set the background gradient in the header. If we fail to load the + * background for any reason, just print an error message and display the + * header without an image. + */ + error = NULL; + pixbuf = gdk_pixbuf_new_from_file("/usr/share/anaconda/pixmaps/anaconda_spoke_header.png", &error); + if (!pixbuf) { + fprintf(stderr, "could not load header background: %s\n", error->message); + g_error_free(error); + } else { + nav_box = anaconda_base_window_get_nav_area_background_window(ANACONDA_BASE_WINDOW(win)); + gtk_widget_set_size_request(nav_box, -1, gdk_pixbuf_get_height (pixbuf)); + gtk_widget_realize(nav_box); + + 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); + + gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); + cairo_paint(cr); + cairo_destroy(cr); + pattern = cairo_pattern_create_for_surface(surface); + cairo_surface_destroy(surface); + + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT); + gdk_window_set_background_pattern(gtk_widget_get_window(nav_box), pattern); + } + /* Set some default properties. */ gtk_window_set_modal(GTK_WINDOW(win), TRUE); -- cgit