mirror of
https://github.com/elementary/gala.git
synced 2024-10-26 07:51:41 +03:00
Do not use color properties directly
They are being copied when retrieving as they are simple structs.
This commit is contained in:
parent
5f26f2fd0c
commit
78abc34aca
@ -94,19 +94,17 @@ namespace Gala {
|
||||
var settings = background_source.settings;
|
||||
|
||||
color_string = settings.get_string ("primary-color");
|
||||
var color = Clutter.Color ();
|
||||
color.from_string (color_string);
|
||||
|
||||
color_string = settings.get_string ("secondary-color");
|
||||
var second_color = Clutter.Color ();
|
||||
second_color.from_string (color_string);
|
||||
var color = Clutter.Color.from_string (color_string);
|
||||
|
||||
var shading_type = settings.get_enum ("color-shading-type");
|
||||
|
||||
if (shading_type == GDesktop.BackgroundShading.SOLID)
|
||||
if (shading_type == GDesktop.BackgroundShading.SOLID) {
|
||||
background.set_color (color);
|
||||
else
|
||||
} else {
|
||||
color_string = settings.get_string ("secondary-color");
|
||||
var second_color = Clutter.Color.from_string (color_string);
|
||||
background.set_gradient ((GDesktop.BackgroundShading) shading_type, color, second_color);
|
||||
}
|
||||
}
|
||||
|
||||
void watch_file (string filename) {
|
||||
|
@ -132,7 +132,7 @@ namespace Gala {
|
||||
on_user_became_active ();
|
||||
});
|
||||
|
||||
background_color.from_string ("black");
|
||||
background_color = Clutter.Color.from_string ("black");
|
||||
|
||||
expand_to_screen_size ();
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class Gala.Tooltip : Clutter.Actor {
|
||||
|
||||
padding = style_context.get_padding (Gtk.StateFlags.NORMAL);
|
||||
|
||||
text_color.from_string ("#ffffff");
|
||||
text_color = Clutter.Color.from_string ("#ffffff");
|
||||
}
|
||||
|
||||
construct {
|
||||
|
@ -185,7 +185,7 @@ namespace Gala {
|
||||
stage = display.get_stage () as Clutter.Stage;
|
||||
var background_settings = new GLib.Settings ("org.gnome.desktop.background");
|
||||
var color = background_settings.get_string ("primary-color");
|
||||
stage.background_color.from_string (color);
|
||||
stage.background_color = Clutter.Color.from_string (color);
|
||||
|
||||
Meta.Util.later_add (Meta.LaterType.BEFORE_REDRAW, () => {
|
||||
WorkspaceManager.init (this);
|
||||
|
@ -1,4 +1,27 @@
|
||||
namespace Clutter {
|
||||
public struct Color {
|
||||
[CCode (cname = "_vala_clutter_color_from_hls")]
|
||||
public static Clutter.Color? from_hls (float hue, float luminance, float saturation) {
|
||||
var color = Clutter.Color.alloc ();
|
||||
color.init_from_hls (hue, luminance, saturation);
|
||||
return color;
|
||||
}
|
||||
[CCode (cname = "_vala_clutter_color_from_pixel")]
|
||||
public static Clutter.Color? from_pixel (uint32 pixel) {
|
||||
var color = Clutter.Color.alloc ();
|
||||
color.init_from_pixel (pixel);
|
||||
return color;
|
||||
}
|
||||
[CCode (cname = "_vala_clutter_color_from_string")]
|
||||
public static Clutter.Color? from_string (string str) {
|
||||
var color = Clutter.Color.alloc ();
|
||||
color.init_from_string (str);
|
||||
return color;
|
||||
}
|
||||
[CCode (cname = "clutter_color_from_string")]
|
||||
public bool parse_string (string str);
|
||||
}
|
||||
|
||||
public interface Container : GLib.Object {
|
||||
public void add (params Clutter.Actor[] actors);
|
||||
[CCode (cname = "clutter_container_class_find_child_property")]
|
||||
|
@ -106,8 +106,6 @@ ActorBox
|
||||
.new skip
|
||||
.from_vertices skip
|
||||
Units.from_* skip
|
||||
Color
|
||||
.new skip
|
||||
Margin
|
||||
.new skip
|
||||
|
||||
@ -116,7 +114,6 @@ container_class_find_child_property skip
|
||||
container_class_list_child_properties skip
|
||||
|
||||
// Move symbols
|
||||
color_from_* skip
|
||||
units_from_* skip
|
||||
|
||||
// Struct return values
|
||||
@ -178,6 +175,22 @@ threads_add_timeout_full name="add_full" parent="Clutter.Threads.Timeout"
|
||||
// Backwards compatibility
|
||||
Color.alloc symbol_type="function"
|
||||
|
||||
Color.from_hls name="init_from_hls"
|
||||
Color.from_pixel name="init_from_pixel"
|
||||
Color.from_string name="init_from_string"
|
||||
|
||||
Color.new name="from_rgba" symbol_type="function"
|
||||
.alpha default=0
|
||||
.blue default=0
|
||||
.green default=0
|
||||
.red default=0
|
||||
|
||||
Color.init
|
||||
.alpha default=0
|
||||
.blue default=0
|
||||
.green default=0
|
||||
.red default=0
|
||||
|
||||
BinAlignment deprecated=false deprecated_since=null
|
||||
BinAlignment.* deprecated
|
||||
BinAlignment.start deprecated=false
|
||||
|
@ -8187,16 +8187,40 @@ namespace Clutter {
|
||||
public bool equal (Clutter.Color v2);
|
||||
[Version (since = "0.2")]
|
||||
public void free ();
|
||||
public void from_hls (float hue, float luminance, float saturation);
|
||||
public void from_pixel (uint32 pixel);
|
||||
[Version (since = "1.0")]
|
||||
public bool from_string (string str);
|
||||
[CCode (cname = "_vala_clutter_color_from_hls")]
|
||||
public static Clutter.Color? from_hls (float hue, float luminance, float saturation) {
|
||||
Clutter.Color? color = Clutter.Color.alloc ();
|
||||
color.init_from_hls (hue, luminance, saturation);
|
||||
return color;
|
||||
}
|
||||
[CCode (cname = "_vala_clutter_color_from_pixel")]
|
||||
public static Clutter.Color? from_pixel (uint32 pixel) {
|
||||
Clutter.Color? color = Clutter.Color.alloc ();
|
||||
color.init_from_pixel (pixel);
|
||||
return color;
|
||||
}
|
||||
[CCode (cname = "clutter_color_new")]
|
||||
[Version (since = "0.8")]
|
||||
public static Clutter.Color? from_rgba (uint8 red = 0, uint8 green = 0, uint8 blue = 0, uint8 alpha = 0);
|
||||
[CCode (cname = "_vala_clutter_color_from_string")]
|
||||
public static Clutter.Color? from_string (string str) {
|
||||
Clutter.Color? color = Clutter.Color.alloc ();
|
||||
color.init_from_string (str);
|
||||
return color;
|
||||
}
|
||||
[Version (since = "1.6")]
|
||||
public static unowned Clutter.Color? get_static (Clutter.StaticColor color);
|
||||
[Version (since = "1.0")]
|
||||
public uint hash ();
|
||||
[Version (since = "1.12")]
|
||||
public unowned Clutter.Color? init (uint8 red, uint8 green, uint8 blue, uint8 alpha);
|
||||
public unowned Clutter.Color? init (uint8 red = 0, uint8 green = 0, uint8 blue = 0, uint8 alpha = 0);
|
||||
[CCode (cname = "clutter_color_from_hls")]
|
||||
public void init_from_hls (float hue, float luminance, float saturation);
|
||||
[CCode (cname = "clutter_color_from_pixel")]
|
||||
public void init_from_pixel (uint32 pixel);
|
||||
[CCode (cname = "clutter_color_from_string")]
|
||||
[Version (since = "1.0")]
|
||||
public bool init_from_string (string str);
|
||||
[Version (since = "1.6")]
|
||||
public Clutter.Color interpolate (Clutter.Color final, double progress);
|
||||
public Clutter.Color lighten ();
|
||||
|
Loading…
Reference in New Issue
Block a user