[california] Handle null (or empty-string) colors from EDS: Closes bgo#727860
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california] Handle null (or empty-string) colors from EDS: Closes bgo#727860
- Date: Mon, 14 Apr 2014 21:38:43 +0000 (UTC)
commit c1fe3db13c3f69a2d67789ec4a6606814898ed4e
Author: Jim Nelson <jim yorba org>
Date: Mon Apr 14 14:38:14 2014 -0700
Handle null (or empty-string) colors from EDS: Closes bgo#727860
src/util/util-gfx.vala | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/util/util-gfx.vala b/src/util/util-gfx.vala
index 53e09d5..e9c83a5 100644
--- a/src/util/util-gfx.vala
+++ b/src/util/util-gfx.vala
@@ -16,7 +16,13 @@ public const Gdk.RGBA RGBA_BLACK = { 0.0, 0.0, 0.0, 0.0 };
* The string can be in any of the forms that Gdk.Color.parse accepts. If unable to parse the
* string, the { link default_rgb} is returned and { link used_default} is set to true.
*/
-public Gdk.Color rgb_string_to_rgb(string rgb_string, Gdk.Color default_rgb, out bool used_default) {
+public Gdk.Color rgb_string_to_rgb(string? rgb_string, Gdk.Color default_rgb, out bool used_default) {
+ if (String.is_empty(rgb_string)) {
+ used_default = true;
+
+ return default_rgb;
+ }
+
Gdk.Color rgb;
if (!Gdk.Color.parse(rgb_string, out rgb)) {
debug("Unable to parse RGB color \"%s\"", rgb_string);
@@ -37,7 +43,13 @@ public Gdk.Color rgb_string_to_rgb(string rgb_string, Gdk.Color default_rgb, out
* The string can be in any of the forms that Gdk.Color.parse accepts. If unable to parse the
* string, the { link default_rgba} is returned and { link used_default} is set to true.
*/
-public Gdk.RGBA rgb_string_to_rgba(string rgb_string, Gdk.RGBA default_rgba, out bool used_default) {
+public Gdk.RGBA rgb_string_to_rgba(string? rgb_string, Gdk.RGBA default_rgba, out bool used_default) {
+ if (String.is_empty(rgb_string)) {
+ used_default = true;
+
+ return default_rgba;
+ }
+
Gdk.Color rgb;
if (!Gdk.Color.parse(rgb_string, out rgb)) {
debug("Unable to parse RGB color \"%s\"", rgb_string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]