Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
gtk
Commits
3070d6e3
Commit
3070d6e3
authored
Dec 09, 2010
by
Benjamin Otte
Browse files
Revert "docs: Reinstate pixbufs section in GDK docs"
I committed my whole working tee instead of just one file. Ooops. This reverts commit
ded14b25
.
parent
ded14b25
Changes
14
Hide whitespace changes
Inline
Side-by-side
docs/reference/gdk/gdk-docs.sgml
View file @
3070d6e3
...
...
@@ -22,7 +22,6 @@
<xi:include
href=
"xml/gdkdisplaymanager.xml"
/>
<xi:include
href=
"xml/gdkscreen.xml"
/>
<xi:include
href=
"xml/regions.xml"
/>
<xi:include
href=
"xml/pixbufs.xml"
/>
<xi:include
href=
"xml/colors.xml"
/>
<xi:include
href=
"xml/rgba_colors.xml"
/>
<xi:include
href=
"xml/visuals.xml"
/>
...
...
gtk/gtkgradient.c
View file @
3070d6e3
...
...
@@ -226,6 +226,7 @@ gtk_gradient_unref (GtkGradient *gradient)
* gtk_gradient_resolve:
* @gradient: a #GtkGradient
* @props: #GtkStyleProperties to use when resolving named colors
* @resolved_gradient: (out): return location for the resolved pattern
*
* If @gradient is resolvable, @resolved_gradient will be filled in
* with the resolved gradient as a cairo_pattern_t, and %TRUE will
...
...
@@ -233,20 +234,21 @@ gtk_gradient_unref (GtkGradient *gradient)
* due to it being defined on top of a named color that doesn't
* exist in @props.
*
* Returns: the resolved pattern. Use cairo_pattern_destroy()
* after use.
* Returns: %TRUE if the gradient has been resolved
*
* Since: 3.0
**/
cairo_pattern_t
*
gboolean
gtk_gradient_resolve
(
GtkGradient
*
gradient
,
GtkStyleProperties
*
props
)
GtkStyleProperties
*
props
,
cairo_pattern_t
**
resolved_gradient
)
{
cairo_pattern_t
*
pattern
;
guint
i
;
g_return_val_if_fail
(
gradient
!=
NULL
,
NULL
);
g_return_val_if_fail
(
GTK_IS_STYLE_PROPERTIES
(
props
),
NULL
);
g_return_val_if_fail
(
gradient
!=
NULL
,
FALSE
);
g_return_val_if_fail
(
GTK_IS_STYLE_PROPERTIES
(
props
),
FALSE
);
g_return_val_if_fail
(
resolved_gradient
!=
NULL
,
FALSE
);
if
(
gradient
->
radius0
==
0
&&
gradient
->
radius1
==
0
)
pattern
=
cairo_pattern_create_linear
(
gradient
->
x0
,
gradient
->
y0
,
...
...
@@ -264,12 +266,17 @@ gtk_gradient_resolve (GtkGradient *gradient,
stop
=
&
g_array_index
(
gradient
->
stops
,
ColorStop
,
i
);
gtk_symbolic_color_resolve
(
stop
->
color
,
props
,
&
color
);
if
(
!
gtk_symbolic_color_resolve
(
stop
->
color
,
props
,
&
color
))
{
cairo_pattern_destroy
(
pattern
);
return
FALSE
;
}
cairo_pattern_add_color_stop_rgba
(
pattern
,
stop
->
offset
,
color
.
red
,
color
.
green
,
color
.
blue
,
color
.
alpha
);
}
return
pattern
;
*
resolved_gradient
=
pattern
;
return
TRUE
;
}
gtk/gtkgradient.h
View file @
3070d6e3
...
...
@@ -52,9 +52,9 @@ void gtk_gradient_add_color_stop (GtkGradient *gradient,
GtkGradient
*
gtk_gradient_ref
(
GtkGradient
*
gradient
);
void
gtk_gradient_unref
(
GtkGradient
*
gradient
);
cairo_pattern_t
*
gtk_gradient_resolve
(
GtkGradient
*
gradient
,
GtkStyleProperties
*
props
);
gboolean
gtk_gradient_resolve
(
GtkGradient
*
gradient
,
GtkStyleProperties
*
props
,
cairo_pattern_t
**
resolved_gradient
);
G_END_DECLS
...
...
gtk/gtkicontheme.c
View file @
3070d6e3
...
...
@@ -3060,7 +3060,16 @@ gtk_icon_info_load_icon (GtkIconInfo *icon_info,
}
static
gchar
*
gdk_rgba_to_css
(
const
GdkRGBA
*
color
)
gdk_color_to_css
(
GdkColor
*
color
)
{
return
g_strdup_printf
(
"rgb(%d,%d,%d)"
,
color
->
red
>>
8
,
color
->
green
>>
8
,
color
->
blue
>>
8
);
}
static
gchar
*
gdk_rgba_to_css
(
GdkRGBA
*
color
)
{
return
g_strdup_printf
(
"rgba(%d,%d,%d,%f)"
,
(
gint
)(
color
->
red
*
255
),
...
...
@@ -3069,40 +3078,41 @@ gdk_rgba_to_css (const GdkRGBA *color)
color
->
alpha
);
}
static
char
*
_gtk_icon_info_color_to_css
(
const
GdkRGBA
*
rgba
,
const
char
*
color_name
)
{
GdkRGBA
color
;
if
(
rgba
)
return
gdk_rgba_to_css
(
rgba
);
gtk_style_context_lookup_default_color
(
color_name
,
&
color
);
return
gdk_rgba_to_css
(
&
color
);
}
static
GdkPixbuf
*
_gtk_icon_info_load_symbolic_internal
(
GtkIconInfo
*
icon_info
,
const
GdkRGBA
*
fg
,
const
GdkRGBA
*
success
_rgba
,
const
GdkRGBA
*
warning
_rgba
,
const
GdkRGBA
*
error_rgba
,
GError
**
error
)
_gtk_icon_info_load_symbolic_internal
(
GtkIconInfo
*
icon_info
,
const
gchar
*
css_
fg
,
const
gchar
*
css_
success
,
const
gchar
*
css_
warning
,
const
gchar
*
css_error
,
GError
**
error
)
{
GInputStream
*
stream
;
GdkPixbuf
*
pixbuf
;
gchar
*
data
;
char
*
css_fg
,
*
css_
success
,
*
css_
warning
,
*
css_erro
r
;
g
char
*
success
,
*
warning
,
*
er
r
;
/* css_fg can't possibly have failed, otherwise
* that would mean we have a broken style */
g_return_val_if_fail
(
fg
!=
NULL
,
NULL
);
g_return_val_if_fail
(
css_fg
!=
NULL
,
NULL
);
success
=
warning
=
err
=
NULL
;
if
(
!
css_success
)
{
GdkColor
success_default_color
=
{
0
,
0x4e00
,
0x9a00
,
0x0600
};
success
=
gdk_color_to_css
(
&
success_default_color
);
}
if
(
!
css_warning
)
{
GdkColor
warning_default_color
=
{
0
,
0xf500
,
0x7900
,
0x3e00
};
warning
=
gdk_color_to_css
(
&
warning_default_color
);
}
if
(
!
css_error
)
{
GdkColor
error_default_color
=
{
0
,
0xcc00
,
0x0000
,
0x0000
};
err
=
gdk_color_to_css
(
&
error_default_color
);
}
css_fg
=
_gtk_icon_info_color_to_css
(
fg
,
"color"
);
css_warning
=
_gtk_icon_info_color_to_css
(
warning_rgba
,
"warning_color"
);
css_error
=
_gtk_icon_info_color_to_css
(
error_rgba
,
"error_color"
);
css_success
=
_gtk_icon_info_color_to_css
(
success_rgba
,
"success_color"
);
data
=
g_strconcat
(
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
standalone=
\"
no
\"
?>
\n
"
"<svg version=
\"
1.1
\"\n
"
...
...
@@ -3112,26 +3122,24 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
" height=
\"
16
\"
>
\n
"
" <style type=
\"
text/css
\"
>
\n
"
" rect,path {
\n
"
" fill: "
,
css_fg
,
" !important;
\n
"
" fill: "
,
css_fg
,
" !important;
\n
"
" }
\n
"
" .warning {
\n
"
" fill: "
,
css_warning
,
" !important;
\n
"
" fill: "
,
css_warning
?
css_warning
:
warning
,
" !important;
\n
"
" }
\n
"
" .error {
\n
"
" fill: "
,
css_error
,
" !important;
\n
"
" fill: "
,
css_error
?
css_error
:
err
,
" !important;
\n
"
" }
\n
"
" .success {
\n
"
" fill: "
,
css_success
,
" !important;
\n
"
" fill: "
,
css_success
?
css_success
:
success
,
" !important;
\n
"
" }
\n
"
" </style>
\n
"
" <xi:include href=
\"
"
,
icon_info
->
filename
,
"
\"
/>
\n
"
"</svg>"
,
NULL
);
g_free
(
css_fg
);
g_free
(
css_warning
);
g_free
(
css_error
);
g_free
(
css_success
);
g_free
(
warning
);
g_free
(
err
);
g_free
(
success
);
stream
=
g_memory_input_stream_new_from_data
(
data
,
-
1
,
g_free
);
pixbuf
=
gdk_pixbuf_new_from_stream_at_scale
(
stream
,
...
...
@@ -3191,6 +3199,10 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
GError
**
error
)
{
GdkPixbuf
*
pixbuf
;
gchar
*
css_fg
;
gchar
*
css_success
;
gchar
*
css_warning
;
gchar
*
css_error
;
g_return_val_if_fail
(
fg
!=
NULL
,
NULL
);
...
...
@@ -3205,10 +3217,27 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
if
(
was_symbolic
)
*
was_symbolic
=
TRUE
;
css_fg
=
gdk_rgba_to_string
(
fg
);
css_success
=
css_warning
=
css_error
=
NULL
;
if
(
warning_color
)
css_warning
=
gdk_rgba_to_string
(
warning_color
);
if
(
error_color
)
css_error
=
gdk_rgba_to_string
(
error_color
);
if
(
success_color
)
css_success
=
gdk_rgba_to_string
(
success_color
);
pixbuf
=
_gtk_icon_info_load_symbolic_internal
(
icon_info
,
fg
,
success
_color
,
warning
_color
,
error_col
or
,
css_fg
,
css_
success
,
css_
warning
,
css_err
or
,
error
);
g_free
(
css_fg
);
g_free
(
css_warning
);
g_free
(
css_success
);
g_free
(
css_error
);
return
pixbuf
;
}
...
...
@@ -3242,7 +3271,9 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
{
GdkPixbuf
*
pixbuf
;
GdkRGBA
*
color
=
NULL
;
GdkRGBA
success_color
,
warning_color
,
error_color
;
GdkRGBA
rgba
;
gchar
*
css_fg
=
NULL
,
*
css_success
;
gchar
*
css_warning
,
*
css_error
;
GtkStateFlags
state
;
if
(
!
icon_info
->
filename
||
...
...
@@ -3258,30 +3289,36 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
state
=
gtk_style_context_get_state
(
context
);
gtk_style_context_get
(
context
,
state
,
"color"
,
&
color
,
NULL
);
gtk_style_context_lookup_color
(
context
,
"success_color"
,
&
success_color
);
gtk_style_context_lookup_color
(
context
,
"warning_color"
,
&
warning_color
);
gtk_style_context_lookup_color
(
context
,
"error_color"
,
&
error_color
);
if
(
color
)
{
css_fg
=
gdk_rgba_to_css
(
color
);
gdk_rgba_free
(
color
);
}
css_success
=
css_warning
=
css_error
=
NULL
;
if
(
gtk_style_context_lookup_color
(
context
,
"success_color"
,
&
rgba
))
css_success
=
gdk_rgba_to_css
(
&
rgba
);
if
(
gtk_style_context_lookup_color
(
context
,
"warning_color"
,
&
rgba
))
css_warning
=
gdk_rgba_to_css
(
&
rgba
);
if
(
gtk_style_context_lookup_color
(
context
,
"error_color"
,
&
rgba
))
css_error
=
gdk_rgba_to_css
(
&
rgba
);
pixbuf
=
_gtk_icon_info_load_symbolic_internal
(
icon_info
,
c
olor
,
&
success
_color
,
&
warning
_color
,
&
error_col
or
,
c
ss_fg
,
css_
success
,
css_
warning
,
css_err
or
,
error
);
gdk_rgba_free
(
color
);
g_free
(
css_fg
);
g_free
(
css_success
);
g_free
(
css_warning
);
g_free
(
css_error
);
return
pixbuf
;
}
static
void
_color_to_rgba
(
const
GdkColor
*
color
,
GdkRGBA
*
rgba
)
{
rgba
->
red
=
color
->
red
/
65535
.
0
;
rgba
->
green
=
color
->
green
/
65535
.
0
;
rgba
->
blue
=
color
->
blue
/
65535
.
0
;
rgba
->
alpha
=
1
.
0
;
}
/**
* gtk_icon_info_load_symbolic_for_style:
* @icon_info: a #GtkIconInfo
...
...
@@ -3314,8 +3351,12 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
GError
**
error
)
{
GdkPixbuf
*
pixbuf
;
GdkColor
success_color
,
warning_color
,
error_color
;
GdkRGBA
fg_rgba
,
success_rgba
,
warning_rgba
,
error_rgba
;
GdkColor
success_color
;
GdkColor
warning_color
;
GdkColor
error_color
;
GdkColor
*
fg
;
gchar
*
css_fg
,
*
css_success
;
gchar
*
css_warning
,
*
css_error
;
if
(
!
icon_info
->
filename
||
!
g_str_has_suffix
(
icon_info
->
filename
,
"-symbolic.svg"
))
...
...
@@ -3328,22 +3369,30 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
if
(
was_symbolic
)
*
was_symbolic
=
TRUE
;
_color_to_rgba
(
&
style
->
fg
[
state
],
&
fg_rgba
);
fg
=
&
style
->
fg
[
state
];
css_fg
=
gdk_color_to_css
(
fg
);
gtk_style_lookup_color
(
style
,
"success_color"
,
&
success_color
);
_color_to_rgba
(
&
success_color
,
&
success_rgba
);
css_success
=
css_warning
=
css_error
=
NULL
;
gtk_style_lookup_color
(
style
,
"
warning
_color"
,
&
warning
_color
)
;
_color_to_rgba
(
&
warning_color
,
&
warning_rgba
);
if
(
gtk_style_lookup_color
(
style
,
"
success
_color"
,
&
success
_color
)
)
css_success
=
gdk_color_to_css
(
&
success_color
);
gtk_style_lookup_color
(
style
,
"error_color"
,
&
error_color
);
_color_to_rgba
(
&
error_color
,
&
error_rgba
);
if
(
gtk_style_lookup_color
(
style
,
"warning_color"
,
&
warning_color
))
css_warning
=
gdk_color_to_css
(
&
warning_color
);
if
(
gtk_style_lookup_color
(
style
,
"error_color"
,
&
error_color
))
css_error
=
gdk_color_to_css
(
&
error_color
);
pixbuf
=
_gtk_icon_info_load_symbolic_internal
(
icon_info
,
&
fg_rgba
,
&
success
_rgba
,
&
warning
_rgba
,
&
error_rgba
,
css_fg
,
css_
success
,
css_
warning
,
css_error
,
error
);
g_free
(
css_fg
);
g_free
(
css_success
);
g_free
(
css_warning
);
g_free
(
css_error
);
return
pixbuf
;
}
...
...
gtk/gtkinfobar.c
View file @
3070d6e3
...
...
@@ -495,7 +495,18 @@ gtk_info_bar_update_colors (GtkInfoBar *info_bar)
{
GtkWidget
*
widget
=
GTK_WIDGET
(
info_bar
);
GtkInfoBarPrivate
*
priv
=
info_bar
->
priv
;
GdkRGBA
fg
,
bg
;
GdkRGBA
info_default_border_color
=
{
0
.
71
,
0
.
67
,
0
.
61
,
1
.
0
};
GdkRGBA
info_default_fill_color
=
{
0
.
99
,
0
.
99
,
0
.
74
,
1
.
0
};
GdkRGBA
warning_default_border_color
=
{
0
.
68
,
0
.
47
,
0
.
16
,
1
.
0
};
GdkRGBA
warning_default_fill_color
=
{
0
.
98
,
0
.
68
,
0
.
24
,
1
.
0
};
GdkRGBA
question_default_border_color
=
{
0
.
38
,
0
.
48
,
0
.
84
,
1
.
0
};
GdkRGBA
question_default_fill_color
=
{
0
.
54
,
0
.
68
,
0
.
83
,
1
.
0
};
GdkRGBA
error_default_border_color
=
{
0
.
65
,
0
.
15
,
0
.
15
,
1
.
0
};
GdkRGBA
error_default_fill_color
=
{
0
.
93
,
0
.
21
,
0
.
21
,
1
.
0
};
GdkRGBA
other_default_border_color
=
{
0
.
71
,
0
.
67
,
0
.
61
,
1
.
0
};
GdkRGBA
other_default_fill_color
=
{
0
.
99
,
0
.
99
,
0
.
74
,
1
.
0
};
GdkRGBA
*
fg
,
*
bg
;
GdkRGBA
sym_fg
,
sym_bg
;
GdkRGBA
*
color
,
*
bg_color
;
GtkStyleContext
*
context
;
...
...
@@ -516,17 +527,56 @@ gtk_info_bar_update_colors (GtkInfoBar *info_bar)
context
=
gtk_widget_get_style_context
(
widget
);
gtk_style_context_lookup_color
(
context
,
fg_color_name
[
priv
->
message_type
],
&
fg
);
gtk_style_context_lookup_color
(
context
,
bg_color_name
[
priv
->
message_type
],
&
bg
);
if
(
gtk_style_context_lookup_color
(
context
,
fg_color_name
[
priv
->
message_type
],
&
sym_fg
)
&&
gtk_style_context_lookup_color
(
context
,
bg_color_name
[
priv
->
message_type
],
&
sym_bg
))
{
fg
=
&
sym_fg
;
bg
=
&
sym_bg
;
}
else
{
switch
(
priv
->
message_type
)
{
case
GTK_MESSAGE_INFO
:
fg
=
&
info_default_border_color
;
bg
=
&
info_default_fill_color
;
break
;
case
GTK_MESSAGE_WARNING
:
fg
=
&
warning_default_border_color
;
bg
=
&
warning_default_fill_color
;
break
;
case
GTK_MESSAGE_QUESTION
:
fg
=
&
question_default_border_color
;
bg
=
&
question_default_fill_color
;
break
;
case
GTK_MESSAGE_ERROR
:
fg
=
&
error_default_border_color
;
bg
=
&
error_default_fill_color
;
break
;
case
GTK_MESSAGE_OTHER
:
fg
=
&
other_default_border_color
;
bg
=
&
other_default_fill_color
;
break
;
default:
g_assert_not_reached
();
fg
=
NULL
;
bg
=
NULL
;
}
}
gtk_style_context_get
(
context
,
0
,
"color"
,
&
color
,
"background-color"
,
&
bg_color
,
NULL
);
if
(
!
gdk_rgba_equal
(
bg_color
,
&
bg
))
gtk_widget_override_background_color
(
widget
,
0
,
&
bg
);
if
(
!
gdk_rgba_equal
(
color
,
&
fg
))
gtk_widget_override_color
(
widget
,
0
,
&
fg
);
if
(
!
gdk_rgba_equal
(
bg_color
,
bg
))
gtk_widget_override_background_color
(
widget
,
0
,
bg
);
if
(
!
gdk_rgba_equal
(
color
,
fg
))
gtk_widget_override_color
(
widget
,
0
,
fg
);
gdk_rgba_free
(
color
);
gdk_rgba_free
(
bg_color
);
...
...
gtk/gtkstyle.c
View file @
3070d6e3
...
...
@@ -1071,25 +1071,35 @@ gtk_style_lookup_icon_set (GtkStyle *style,
*
* Deprecated:3.0: Use gtk_style_context_lookup_color() instead
**/
void
gboolean
gtk_style_lookup_color
(
GtkStyle
*
style
,
const
char
*
color_name
,
GdkColor
*
color
)
{
GtkStylePrivate
*
priv
;
gboolean
result
;
GdkRGBA
rgba
;
g_return_if_fail
(
GTK_IS_STYLE
(
style
));
g_return_if_fail
(
color_name
!=
NULL
);
g_return_val_if_fail
(
GTK_IS_STYLE
(
style
),
FALSE
);
g_return_val_if_fail
(
color_name
!=
NULL
,
FALSE
);
g_return_val_if_fail
(
color
!=
NULL
,
FALSE
);
priv
=
GTK_STYLE_GET_PRIVATE
(
style
);
gtk_style_context_lookup_color
(
priv
->
context
,
color_name
,
&
rgba
);
if
(
!
priv
->
context
)
return
FALSE
;
result
=
gtk_style_context_lookup_color
(
priv
->
context
,
color_name
,
&
rgba
);
if
(
color
)
{
color
->
red
=
(
guint16
)
(
rgba
.
red
*
65535
);
color
->
green
=
(
guint16
)
(
rgba
.
green
*
65535
);
color
->
blue
=
(
guint16
)
(
rgba
.
blue
*
65535
);
color
->
pixel
=
0
;
}
color
->
red
=
(
guint16
)
(
rgba
.
red
*
65535
);
color
->
green
=
(
guint16
)
(
rgba
.
green
*
65535
);
color
->
blue
=
(
guint16
)
(
rgba
.
blue
*
65535
);
color
->
pixel
=
0
;
return
result
;
}
/**
...
...
gtk/gtkstyle.h
View file @
3070d6e3
...
...
@@ -402,7 +402,7 @@ void gtk_style_apply_default_background (GtkStyle *style,
GtkIconSet
*
gtk_style_lookup_icon_set
(
GtkStyle
*
style
,
const
gchar
*
stock_id
);
void
gtk_style_lookup_color
(
GtkStyle
*
style
,
gboolean
gtk_style_lookup_color
(
GtkStyle
*
style
,
const
gchar
*
color_name
,
GdkColor
*
color
);
...
...
gtk/gtkstylecontext.c
View file @
3070d6e3
...
...
@@ -2317,25 +2317,29 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
color
=
g_value_get_boxed
(
&
pcache
->
value
);
gtk_symbolic_color_resolve
(
color
,
data
->
store
,
&
rgba
);
g_value_unset
(
&
pcache
->
value
);
if
(
G_PARAM_SPEC_VALUE_TYPE
(
pspec
)
==
GDK_TYPE_RGBA
)
if
(
gtk_symbolic_color_resolve
(
color
,
data
->
store
,
&
rgba
))
{
g_value_init
(
&
pcache
->
value
,
GDK_TYPE_RGBA
);
g_value_set_boxed
(
&
pcache
->
value
,
&
rgba
);
g_value_unset
(
&
pcache
->
value
);
if
(
G_PARAM_SPEC_VALUE_TYPE
(
pspec
)
==
GDK_TYPE_RGBA
)
{
g_value_init
(
&
pcache
->
value
,
GDK_TYPE_RGBA
);
g_value_set_boxed
(
&
pcache
->
value
,
&
rgba
);
}
else
{
GdkColor
rgb
;
rgb
.
red
=
rgba
.
red
*
65535
.
+
0
.
5
;
rgb
.
green
=
rgba
.
green
*
65535
.
+
0
.
5
;
rgb
.
blue
=
rgba
.
blue
*
65535
.
+
0
.
5
;
g_value_init
(
&
pcache
->
value
,
GDK_TYPE_COLOR
);
g_value_set_boxed
(
&
pcache
->
value
,
&
rgb
);
}
}
else
{
GdkColor
rgb
;
rgb
.
red
=
rgba
.
red
*
65535
.
+
0
.
5
;
rgb
.
green
=
rgba
.
green
*
65535
.
+
0
.
5
;
rgb
.
blue
=
rgba
.
blue
*
65535
.
+
0
.
5
;
g_value_init
(
&
pcache
->
value
,
GDK_TYPE_COLOR
);
g_value_set_boxed
(
&
pcache
->
value
,
&
rgb
);
}
g_param_value_set_default
(
pspec
,
&
pcache
->
value
);
}
return
&
pcache
->
value
;
...
...
@@ -2704,44 +2708,6 @@ gtk_style_context_get_junction_sides (GtkStyleContext *context)
return
info
->
junction_sides
;
}
gboolean
gtk_style_context_lookup_default_color
(
const
gchar
*
color_name
,
GdkRGBA
*
color
)
{
static
const
GdkRGBA
fallback_color
=
{
1
.
0
,
0
.
0
,
1
.
0
,
1
.
0
};
static
const
struct
{
const
char
*
name
;
const
GdkRGBA
rgba
;
}
colors
[]
=
{
{
"success_color"
,
{
0
.
3
,
0
.
6
,
0
.
02
,
1
.
0
}
},
{
"warning_color"
,
{
0
.
96
,
0
.
474
,
0
.
24
,
1
.
0
}
},
{
"error_color"
,
{
0
.
8
,
0
.
0
,
0
.
0
,
1
.
0
}
},
{
"info_fg_color"
,
{
0
.
71
,
0
.
67
,
0
.
61
,
1
.
0
}
},
{
"info_bg_color"
,
{
0
.
99
,
0
.
99
,
0
.
74
,
1
.
0
}
},
{
"warning_fg_color"
,
{
0
.
68
,
0
.
47
,
0
.
16
,
1
.
0
}
},
{
"warning_bg_color"
,
{
0
.
98
,
0
.
68
,
0
.
24
,
1
.
0
}
},
{
"question_fg_color"
,
{
0
.
38
,
0
.
48
,
0
.
84
,
1
.
0
}
},
{
"question_bg_color"
,
{
0
.
54
,
0
.
68
,
0
.
83
,
1
.
0
}
},
{
"error_fg_color"
,
{
0
.
65
,
0
.
15
,
0
.
15
,
1
.
0
}
},
{
"error_bg_color"
,
{
0
.
93
,
0
.
21
,
0
.
21
,
1
.
0
}
},
{
"other_fg_color"
,
{
0
.
71
,
0
.
67
,
0
.
61
,
1
.
0
}
},
{
"other_bg_color"
,
{
0
.
99
,
0
.
99
,
0
.
74
,
1
.
0
}
}
};
guint
i
;
for
(
i
=
0
;
i
<
G_N_ELEMENTS
(
colors
);
i
++
)
{
if
(
g_str_equal
(
color_name
,
colors
[
i
].
name
))
{
*
color
=
colors
[
i
].
rgba
;
return
TRUE
;
}
}
*
color
=
fallback_color
;
return
FALSE
;
}
/**
* gtk_style_context_lookup_color:
* @context: a #GtkStyleContext
...
...
@@ -2752,7 +2718,7 @@ gtk_style_context_lookup_default_color (const gchar *color_name,
*
* Returns: %TRUE if @color_name was found and resolved, %FALSE otherwise
**/
void
gboolean
gtk_style_context_lookup_color
(
GtkStyleContext
*
context
,
const
gchar
*
color_name
,
GdkRGBA
*
color
)
...
...
@@ -2761,20 +2727,20 @@ gtk_style_context_lookup_color (GtkStyleContext *context,
GtkSymbolicColor
*
sym_color
;
StyleData
*
data
;
g_return_if_fail
(
GTK_IS_STYLE_CONTEXT
(
context
));
g_return_if_fail
(
color_name
!=
NULL
);
g_return_if_fail
(
color
!=
NULL
);
g_return_
val_
if_fail
(
GTK_IS_STYLE_CONTEXT
(
context
)
,
FALSE
);
g_return_
val_
if_fail
(
color_name
!=
NULL
,
FALSE
);
g_return_
val_
if_fail
(
color
!=
NULL
,
FALSE
);
priv
=
context
->
priv
;
g_return_if_fail
(
priv
->
widget_path
!=
NULL
);
g_return_
val_
if_fail
(
priv
->
widget_path
!=
NULL
,
FALSE
);