diff options
author | Leho Kraav <leho@kraav.com> | 2011-08-18 18:06:17 +0300 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2011-08-18 11:23:44 -0400 |
commit | 5439ef520d2bd9400555824ec28b435952260eba (patch) | |
tree | 55346b38320a07c996f59bdac4f82a3997f019b6 | |
parent | b7701d690a0ea1fda036d48aeda8ba85fd41257b (diff) |
throbgress: make colors configurable
This commit makes the background start and
background end colors configurable in throbgress.
-rw-r--r-- | src/plugins/splash/throbgress/plugin.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c index 895541cb..3737a9fa 100644 --- a/src/plugins/splash/throbgress/plugin.c +++ b/src/plugins/splash/throbgress/plugin.c | |||
@@ -94,6 +94,9 @@ struct _ply_boot_splash_plugin | |||
94 | char *image_dir; | 94 | char *image_dir; |
95 | ply_boot_splash_display_type_t state; | 95 | ply_boot_splash_display_type_t state; |
96 | 96 | ||
97 | uint32_t background_start_color; | ||
98 | uint32_t background_end_color; | ||
99 | |||
97 | ply_trigger_t *idle_trigger; | 100 | ply_trigger_t *idle_trigger; |
98 | 101 | ||
99 | uint32_t root_is_mounted : 1; | 102 | uint32_t root_is_mounted : 1; |
@@ -373,6 +376,7 @@ create_plugin (ply_key_file_t *key_file) | |||
373 | { | 376 | { |
374 | ply_boot_splash_plugin_t *plugin; | 377 | ply_boot_splash_plugin_t *plugin; |
375 | char *image_dir, *image_path; | 378 | char *image_dir, *image_path; |
379 | char *color; | ||
376 | 380 | ||
377 | srand ((int) ply_get_timestamp ()); | 381 | srand ((int) ply_get_timestamp ()); |
378 | plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); | 382 | plugin = calloc (1, sizeof (ply_boot_splash_plugin_t)); |
@@ -391,6 +395,24 @@ create_plugin (ply_key_file_t *key_file) | |||
391 | plugin->image_dir = image_dir; | 395 | plugin->image_dir = image_dir; |
392 | plugin->views = ply_list_new (); | 396 | plugin->views = ply_list_new (); |
393 | 397 | ||
398 | color = ply_key_file_get_value (key_file, "throbgress", "BackgroundStartColor"); | ||
399 | |||
400 | if (color != NULL) | ||
401 | plugin->background_start_color = strtol (color, NULL, 0); | ||
402 | else | ||
403 | plugin->background_start_color = PLYMOUTH_BACKGROUND_START_COLOR; | ||
404 | |||
405 | free (color); | ||
406 | |||
407 | color = ply_key_file_get_value (key_file, "throbgress", "BackgroundEndColor"); | ||
408 | |||
409 | if (color != NULL) | ||
410 | plugin->background_end_color = strtol (color, NULL, 0); | ||
411 | else | ||
412 | plugin->background_end_color = PLYMOUTH_BACKGROUND_END_COLOR; | ||
413 | |||
414 | free (color); | ||
415 | |||
394 | return plugin; | 416 | return plugin; |
395 | } | 417 | } |
396 | 418 | ||
@@ -427,14 +449,20 @@ draw_background (view_t *view, | |||
427 | { | 449 | { |
428 | ply_rectangle_t area; | 450 | ply_rectangle_t area; |
429 | 451 | ||
452 | plugin = view->plugin; | ||
453 | |||
430 | area.x = x; | 454 | area.x = x; |
431 | area.y = y; | 455 | area.y = y; |
432 | area.width = width; | 456 | area.width = width; |
433 | area.height = height; | 457 | area.height = height; |
434 | 458 | ||
435 | ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area, | 459 | if (plugin->background_start_color != plugin->background_end_color) |
436 | PLYMOUTH_BACKGROUND_START_COLOR, | 460 | ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area, |
437 | PLYMOUTH_BACKGROUND_END_COLOR); | 461 | plugin->background_start_color, |
462 | plugin->background_end_color); | ||
463 | else | ||
464 | ply_pixel_buffer_fill_with_hex_color (pixel_buffer, &area, | ||
465 | plugin->background_start_color); | ||
438 | } | 466 | } |
439 | 467 | ||
440 | static void | 468 | static void |