Merge lp:~unity-team/unity/unity.fix-594232 into lp:unity

Proposed by Mirco Müller
Status: Merged
Merged at revision: 375
Proposed branch: lp:~unity-team/unity/unity.fix-594232
Merge into: lp:unity
Diff against target: 794 lines (+621/-88)
5 files modified
configure.ac (+2/-0)
unity-private/Makefile.am (+2/-0)
unity-private/testing/background.vala (+373/-87)
vapi/Makefile.am (+2/-1)
vapi/gnome-bg-2.0.vapi (+242/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix-594232
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+29959@code.launchpad.net

Description of the change

This branch monitors GNOME's desktop-background settings (wallpaper and gradient). Upon startup of unity the correct image or gradient (or solid color) is rendered. Changes to those settings after unity was started are also taken into account.

Remaining features to be implemented are filed as bugs LP: #605788 (support all picture-options) and LP: #605442 (wallpaper-slideshows).

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Nice stuff!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2010-07-13 15:04:53 +0000
+++ configure.ac 2010-07-15 08:32:44 +0000
@@ -105,8 +105,10 @@
105 gio-2.0 >= $GTK_REQUIRED105 gio-2.0 >= $GTK_REQUIRED
106 gee-1.0106 gee-1.0
107 gconf-2.0107 gconf-2.0
108 gnome-desktop-2.0
108 indicator109 indicator
109 libbamf >= 0.2110 libbamf >= 0.2
111 libgnomeui-2.0
110 unique-1.0112 unique-1.0
111 unity-misc113 unity-misc
112 x11)114 x11)
113115
=== modified file 'unity-private/Makefile.am'
--- unity-private/Makefile.am 2010-06-21 10:10:30 +0000
+++ unity-private/Makefile.am 2010-07-15 08:32:44 +0000
@@ -22,6 +22,7 @@
22 -DINDICATORICONSDIR=\""$(INDICATORICONSDIR)"\" \22 -DINDICATORICONSDIR=\""$(INDICATORICONSDIR)"\" \
23 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \23 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
24 -DG_LOG_DOMAIN=\"libunity-private\" \24 -DG_LOG_DOMAIN=\"libunity-private\" \
25 -DGNOME_DESKTOP_USE_UNSTABLE_API \
25 $(BASE_CFLAGS) \26 $(BASE_CFLAGS) \
26 $(MAINTAINER_CFLAGS) \27 $(MAINTAINER_CFLAGS) \
27 -I$(top_srcdir)/unity/ \28 -I$(top_srcdir)/unity/ \
@@ -51,6 +52,7 @@
51 --pkg gee-1.0 \52 --pkg gee-1.0 \
52 --pkg gio-unix-2.0 \53 --pkg gio-unix-2.0 \
53 --pkg gtk+-2.0 \54 --pkg gtk+-2.0 \
55 --pkg gnome-bg-2.0 \
54 --pkg indicator \56 --pkg indicator \
55 --pkg Bamf-0.2 \57 --pkg Bamf-0.2 \
56 --pkg libwnck-1.0 \58 --pkg libwnck-1.0 \
5759
=== modified file 'unity-private/testing/background.vala'
--- unity-private/testing/background.vala 2010-04-07 15:39:23 +0000
+++ unity-private/testing/background.vala 2010-07-15 08:32:44 +0000
@@ -15,115 +15,219 @@
15 *15 *
16 * Authored by Neil Jagdish Patel <neil.patel@canonical.com>16 * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
17 *17 *
18 * FIXME: wallpaper-slideshows are not yet supported by this class
18 */19 */
1920
20namespace Unity.Testing21namespace Unity.Testing
21{22{
22 public class Background : Ctk.Bin23 public class Background : Ctk.Bin
23 {24 {
24 /* Gnome Desktop background gconf keys */25 private string BG_DIR = "/desktop/gnome/background";
25 private string BG_DIR = "/desktop/gnome/background";26 private string BG_PIC_OPTS = "/desktop/gnome/background/picture_options";
26 private string BG_FILE = "/desktop/gnome/background/picture_filename";27 private string BG_SHADE_TYPE = "/desktop/gnome/background/color_shading_type";
27 private string BG_OPTION = "/desktop/gnome/background/picture_options";28 private string BG_PRIM_COL = "/desktop/gnome/background/primary_color";
2829 private string BG_SEC_COL = "/desktop/gnome/background/secondary_color";
30 private string BG_FILENAME = "/desktop/gnome/background/picture_filename";
31
32 private string DEFAULT_PIC_OPTS = "none";
33 private string DEFAULT_SHADE_TYPE = "solid";
34 private string DEFAULT_AMBIANCE_COL = "#2C2C00001E1E"; // Ubuntu Dark Purple
35 private string DEFAULT_RADIANCE_COL = "#AEAEA7A79F9F"; // Ubuntu Grey
36 private string DEFAULT_FILENAME = "/usr/share/backgrounds/warty-final.png";
37
38 private Clutter.CairoTexture bg_gradient;
39 private Clutter.Texture bg_image;
40 private Gnome.BG gbg;
41 private GConf.Client client;
42
43 private string pic_opts;
44 private string shade_type;
45 private string prim_col;
46 private string sec_col;
29 private string filename;47 private string filename;
30 private string option;
31
32 private Clutter.Texture bg;
3348
34 construct49 construct
35 {50 {
36 START_FUNCTION ();51 START_FUNCTION ();
37 var client = GConf.Client.get_default ();52
3853 this.gbg = new Gnome.BG ();
39 /* Setup the initial properties and notifies */54 this.client = GConf.Client.get_default ();
55
56 /* register monitoring background-directory with gconf */
40 try57 try
41 {58 {
42 client.add_dir (this.BG_DIR, GConf.ClientPreloadType.NONE);59 this.client.add_dir (this.BG_DIR, GConf.ClientPreloadType.NONE);
43 }60 }
44 catch (GLib.Error e)61 catch (GLib.Error e)
45 {62 {
63 warning ("Background: Unable to monitor background-settings: %s",
64 e.message);
65 }
66
67 /* load values from gconf */
68 try
69 {
70 this.pic_opts = this.client.get_string (this.BG_PIC_OPTS);
71 }
72 catch (Error e)
73 {
74 this.pic_opts = DEFAULT_PIC_OPTS;
75 }
76
77 try
78 {
79 this.shade_type = this.client.get_string (this.BG_SHADE_TYPE);
80 }
81 catch (Error e)
82 {
83 this.shade_type = DEFAULT_SHADE_TYPE;
84 }
85
86 try
87 {
88 this.prim_col = this.client.get_string (this.BG_PRIM_COL);
89 }
90 catch (Error e)
91 {
92 this.prim_col = DEFAULT_AMBIANCE_COL;
93 }
94
95 try
96 {
97 this.sec_col = this.client.get_string (this.BG_SEC_COL);
98 }
99 catch (Error e)
100 {
101 this.sec_col = DEFAULT_AMBIANCE_COL;
102 }
103
104 try
105 {
106 this.filename = this.client.get_string (this.BG_FILENAME);
107 }
108 catch (Error e)
109 {
110 this.filename = DEFAULT_FILENAME;
111 }
112
113 /* register monitor */
114 try
115 {
116 this.client.notify_add (this.BG_DIR, this._on_gconf_changed);
117 }
118 catch (Error e)
119 {
46 warning ("Background: Unable to monitor background: %s", e.message);120 warning ("Background: Unable to monitor background: %s", e.message);
47 }121 }
48122
49 try123 this.bg_gradient = new Clutter.CairoTexture (1, 1);
50 {124 this.bg_gradient.name = "bg_gradient";
51 this.filename = client.get_string (this.BG_FILE);125 this.bg_image = new Clutter.Texture ();
52 }126 this.bg_image.name = "bg_image";
53 catch (Error e)127
54 {128 // setting async. loading to TRUE here, requires hooking up to
55 this.filename = "/usr/share/backgrounds/warty-final.png";129 // "allocation-changed" for the texture-image, otherwise we cannot get
56 }130 // valid values for a texture-images base-size, which is needed to
57131 // correctly handle image-placement... this sucks balls!!!
58 try132 this.bg_image.set_load_async (true);
59 {133 this.bg_image.load_finished.connect (_handle_image_placement);
60 client.notify_add (this.BG_FILE, this.on_filename_changed);134
61 }135 this.gbg.load_from_preferences (client);
62 catch (Error e)136
63 {137 // this is needed for the bg_gradient to have the correct size
64 warning ("Background: Unable to monitor background filename: %s",138 this.allocation_changed.connect (_on_allocation_changed);
65 e.message);139
66 }
67 try
68 {
69 this.option = client.get_string (this.BG_OPTION);
70 }
71 catch (Error e)
72 {
73 this.option = "wallpaper";
74 }
75 try
76 {
77 client.notify_add (this.BG_OPTION, this.on_option_changed);
78 }
79 catch (Error e)
80 {
81 warning ("Background: Unable to monitor background options: %s",
82 e.message);
83 }
84
85 /* The texture that will show the background */
86 this.bg = new Clutter.Texture ();
87 this.bg.set_load_async (true);
88 this.add_actor (this.bg);
89 this.bg.show ();
90
91 /* Load the texture */
92 this.ensure_layout ();
93 END_FUNCTION ();140 END_FUNCTION ();
94 }141 }
95142
96 private void on_filename_changed (GConf.Client client,143 private void
97 uint cxnid,144 _handle_image_placement ()
98 GConf.Entry entry)145 {
99 {146 Gnome.BGPlacement placement = this.gbg.get_placement ();
100 var new_filename = entry.get_value ().get_string ();147
101148 switch (placement)
102 if (new_filename == this.filename)149 {
103 return;150 case Gnome.BGPlacement.TILED:
104151 {
105 this.filename = new_filename;152 this.bg_image.set_repeat (true, true);
106 this.ensure_layout ();153 this.bg_image.set_sync_size (true);
107 }154 this.x = 0.0f;
108155 this.y = 0.0f;
109 private void on_option_changed (GConf.Client client,156 }
110 uint cxnid,157 break;
111 GConf.Entry entry)158
112 {159 case Gnome.BGPlacement.ZOOMED:
113 var new_option = entry.get_value ().get_string ();160 {
114161 this.bg_image.set_repeat (false, false);
115 if (new_option == this.option)162 this.bg_image.set_sync_size (false);
116 return;163 this.bg_image.set_keep_aspect_ratio (true);
117164 this.x = 0.0f;
118 this.option = new_option;165 this.y = 0.0f;
119 this.ensure_layout ();166 }
120 }167 break;
121168
122 private void ensure_layout ()169 case Gnome.BGPlacement.CENTERED:
123 {170 {
171 this.bg_image.set_repeat (false, false);
172 this.bg_image.set_sync_size (false);
173 this.bg_image.set_keep_aspect_ratio (false);
174 this.x = 0.0f;
175 this.y = 0.0f;
176 }
177 break;
178
179 case Gnome.BGPlacement.SCALED:
180 {
181 this.bg_image.set_keep_aspect_ratio (true);
182 this.bg_image.set_sync_size (false);
183 this.x = 0.0f;
184 this.y = 0.0f;
185 }
186 break;
187
188 case Gnome.BGPlacement.FILL_SCREEN:
189 {
190 this.bg_image.set_keep_aspect_ratio (false);
191 this.x = 0.0f;
192 this.y = 0.0f;
193 }
194 break;
195
196 case Gnome.BGPlacement.SPANNED:
197 {
198 this.bg_image.set_repeat (false, false);
199 this.bg_image.set_sync_size (true);
200 this.bg_image.set_keep_aspect_ratio (true);
201 this.x = 0.0f;
202 this.y = 0.0f;
203 }
204 break;
205 }
206 }
207
208 private void
209 _on_allocation_changed ()
210 {
211 if (this.filename != "")
212 _update_image ();
213 else
214 _update_gradient ();
215 }
216
217 private void
218 _update_image ()
219 {
220
221 if (this.find_child_by_name ("bg_image") != this.bg_image)
222 {
223 this.remove_actor (this.bg_gradient);
224 this.add_actor (this.bg_image);
225 this.bg_image.show ();
226 }
227
124 try228 try
125 {229 {
126 this.bg.set_from_file (this.filename);230 this.bg_image.set_from_file (this.filename);
127 }231 }
128 catch (Error e)232 catch (Error e)
129 {233 {
@@ -131,8 +235,190 @@
131 this.filename,235 this.filename,
132 e.message);236 e.message);
133 }237 }
134238 }
135 this.queue_relayout ();239
240 private void
241 _update_gradient ()
242 {
243 Gnome.BGColorType type;
244 Gdk.Color primary;
245 Gdk.Color secondary;
246
247 if (this.find_child_by_name ("bg_gradient") != this.bg_gradient)
248 {
249 this.remove_actor (this.bg_image);
250 this.add_actor (this.bg_gradient);
251 this.bg_gradient.show ();
252 }
253
254 this.x = 0.0f;
255 this.y = 0.0f;
256
257 this.gbg.get_color (out type, out primary, out secondary);
258
259 this.bg_gradient.set_surface_size ((uint) this.width,
260 (uint) this.height);
261
262 switch (type)
263 {
264 case Gnome.BGColorType.SOLID:
265 {
266
267 Cairo.Context cr = this.bg_gradient.create ();
268 cr.set_operator (Cairo.Operator.OVER);
269 cr.scale (1.0f, 1.0f);
270 cr.set_source_rgb ((double) primary.red / (double) 0xffff,
271 (double) primary.green / (double) 0xffff,
272 (double) primary.blue / (double) 0xffff);
273 cr.rectangle (0.0f,
274 0.0f,
275 (double) this.width,
276 (double) this.height);
277 cr.fill ();
278 }
279 break;
280
281 case Gnome.BGColorType.V_GRADIENT:
282 {
283 Cairo.Context cr = this.bg_gradient.create ();
284 Cairo.Pattern pat = new Cairo.Pattern.linear (0.0f,
285 0.0f,
286 0.0f,
287 (double) this.height);
288 cr.set_operator (Cairo.Operator.OVER);
289 cr.scale (1.0f, 1.0f);
290 pat.add_color_stop_rgb (0.0f,
291 (double) primary.red / (double) 0xffff,
292 (double) primary.green / (double) 0xffff,
293 (double) primary.blue / (double) 0xffff);
294 pat.add_color_stop_rgb (1.0f,
295 (double) secondary.red / (double) 0xffff,
296 (double) secondary.green / (double) 0xffff,
297 (double) secondary.blue / (double) 0xffff);
298 cr.set_source (pat);
299 cr.rectangle (0.0f,
300 0.0f,
301 (double) this.width,
302 (double) this.height);
303 cr.fill ();
304 }
305 break;
306
307 case Gnome.BGColorType.H_GRADIENT:
308 {
309 Cairo.Context cr = this.bg_gradient.create ();
310 Cairo.Pattern pat = new Cairo.Pattern.linear (0.0f,
311 0.0f,
312 (double) this.width,
313 0.0f);
314 cr.set_operator (Cairo.Operator.OVER);
315 cr.scale (1.0f, 1.0f);
316 pat.add_color_stop_rgb (0.0f,
317 (double) primary.red / (double) 0xffff,
318 (double) primary.green / (double) 0xffff,
319 (double) primary.blue / (double) 0xffff);
320 pat.add_color_stop_rgb (1.0f,
321 (double) secondary.red / (double) 0xffff,
322 (double) secondary.green / (double) 0xffff,
323 (double) secondary.blue / (double) 0xffff);
324 cr.set_source (pat);
325 cr.rectangle (0.0f,
326 0.0f,
327 (double) this.width,
328 (double) this.height);
329 cr.fill ();
330 }
331 break;
332 }
333 }
334
335 private void
336 _on_gconf_changed (GConf.Client client,
337 uint cxnid,
338 GConf.Entry entry)
339 {
340 bool needs_update = false;
341 string new_value;
342
343 this.gbg.load_from_preferences (client);
344
345 try
346 {
347 new_value = this.client.get_string (this.BG_PIC_OPTS);
348 }
349 catch (Error e)
350 {
351 new_value = DEFAULT_PIC_OPTS;
352 }
353 if (new_value != this.pic_opts)
354 {
355 this.pic_opts = new_value;
356 needs_update = true;
357 }
358
359 try
360 {
361 new_value = this.client.get_string (this.BG_SHADE_TYPE);
362 }
363 catch (Error e)
364 {
365 new_value = DEFAULT_SHADE_TYPE;
366 }
367 if (new_value != this.shade_type)
368 {
369 this.shade_type = new_value;
370 needs_update = true;
371 }
372
373 try
374 {
375 new_value = this.client.get_string (this.BG_PRIM_COL);
376 }
377 catch (Error e)
378 {
379 new_value = DEFAULT_AMBIANCE_COL;
380 }
381 if (new_value != this.prim_col)
382 {
383 this.prim_col = new_value;
384 needs_update = true;
385 }
386
387 try
388 {
389 new_value = this.client.get_string (this.BG_SEC_COL);
390 }
391 catch (Error e)
392 {
393 new_value = DEFAULT_AMBIANCE_COL;
394 }
395 if (new_value != this.sec_col)
396 {
397 this.sec_col = new_value;
398 needs_update = true;
399 }
400
401 try
402 {
403 new_value = this.client.get_string (this.BG_FILENAME);
404 }
405 catch (Error e)
406 {
407 new_value = DEFAULT_FILENAME;
408 }
409 if (new_value != this.filename)
410 {
411 this.filename = new_value;
412 needs_update = true;
413 }
414
415 if (needs_update)
416 {
417 if (this.filename != "")
418 _update_image ();
419 else
420 _update_gradient ();
421 }
136 }422 }
137 }423 }
138}424}
139425
=== modified file 'vapi/Makefile.am'
--- vapi/Makefile.am 2010-06-02 12:05:59 +0000
+++ vapi/Makefile.am 2010-07-15 08:32:44 +0000
@@ -14,4 +14,5 @@
14 mutter-2.28.vapi \14 mutter-2.28.vapi \
15 mutter-2.28.deps \15 mutter-2.28.deps \
16 unity-const.vapi \16 unity-const.vapi \
17 unity-misc.vapi17 unity-misc.vapi \
18 gnome-bg-2.0.vapi
1819
=== added file 'vapi/gnome-bg-2.0.vapi'
--- vapi/gnome-bg-2.0.vapi 1970-01-01 00:00:00 +0000
+++ vapi/gnome-bg-2.0.vapi 2010-07-15 08:32:44 +0000
@@ -0,0 +1,242 @@
1/* gnome-desktop-2.0.vapi generated by vapigen, do not modify. */
2
3[CCode (cprefix = "Gnome", lower_case_cprefix = "gnome_")]
4namespace Gnome {
5 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
6 public class BG : GLib.Object {
7 [CCode (has_construct_function = false)]
8 public BG ();
9 public bool changes_with_time ();
10 public unowned Gdk.Pixbuf create_frame_thumbnail (Gnome.DesktopThumbnailFactory factory, Gdk.Screen screen, int dest_width, int dest_height, int frame_num);
11 public unowned Gdk.Pixmap create_pixmap (Gdk.Window window, int width, int height, bool root);
12 public unowned Gdk.Pixbuf create_thumbnail (Gnome.DesktopThumbnailFactory factory, Gdk.Screen screen, int dest_width, int dest_height);
13 public void draw (Gdk.Pixbuf dest, Gdk.Screen screen, bool is_root);
14 public void get_color (out Gnome.BGColorType type, out Gdk.Color primary, out Gdk.Color secondary);
15 public unowned string get_filename ();
16 public bool get_image_size (Gnome.DesktopThumbnailFactory factory, int best_width, int best_height, int width, int height);
17 public static unowned Gdk.Pixmap get_pixmap_from_root (Gdk.Screen screen);
18 public Gnome.BGPlacement get_placement ();
19 public bool has_multiple_sizes ();
20 public bool is_dark (int dest_width, int dest_height);
21 public void load_from_preferences (GConf.Client client);
22 public void save_to_preferences (GConf.Client client);
23 public void set_color (Gnome.BGColorType type, Gdk.Color primary, Gdk.Color secondary);
24 public void set_filename (string filename);
25 public static void set_pixmap_as_root (Gdk.Screen screen, Gdk.Pixmap pixmap);
26 public static unowned Gnome.BGCrossfade set_pixmap_as_root_with_crossfade (Gdk.Screen screen, Gdk.Pixmap pixmap);
27 public void set_placement (Gnome.BGPlacement placement);
28 public virtual signal void changed ();
29 public virtual signal void transitioned ();
30 }
31 [Compact]
32 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
33 public class BGClass {
34 }
35 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
36 public class BGCrossfade : GLib.Object {
37 [CCode (has_construct_function = false)]
38 public BGCrossfade (int width, int height);
39 public bool is_started ();
40 public bool set_end_pixmap (Gdk.Pixmap pixmap);
41 public bool set_start_pixmap (Gdk.Pixmap pixmap);
42 public void start (Gdk.Window window);
43 public void stop ();
44 [NoAccessorMethod]
45 public int height { get; construct; }
46 [NoAccessorMethod]
47 public int width { get; construct; }
48 public virtual signal void finished (GLib.Object window);
49 }
50 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
51 public class DesktopThumbnailFactory : GLib.Object {
52 [CCode (has_construct_function = false)]
53 public DesktopThumbnailFactory (Gnome.DesktopThumbnailSize size);
54 public bool can_thumbnail (string uri, string mime_type, ulong mtime);
55 public void create_failed_thumbnail (string uri, ulong mtime);
56 public unowned Gdk.Pixbuf generate_thumbnail (string uri, string mime_type);
57 public bool has_valid_failed_thumbnail (string uri, ulong mtime);
58 public unowned string lookup (string uri, ulong mtime);
59 public void save_thumbnail (Gdk.Pixbuf thumbnail, string uri, ulong original_mtime);
60 }
61 [Compact]
62 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
63 public class OutputInfo {
64 public double aspect;
65 public bool connected;
66 public weak string display_name;
67 public int height;
68 public weak string name;
69 public bool on;
70 public int pref_height;
71 public int pref_width;
72 public bool primary;
73 public uint product;
74 public int rate;
75 public Gnome.RRRotation rotation;
76 public uint serial;
77 public void* user_data;
78 [CCode (array_length = false)]
79 public weak string[] vendor;
80 public int width;
81 public int x;
82 public int y;
83 }
84 [Compact]
85 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
86 public class RRConfig {
87 public bool clone;
88 public weak Gnome.OutputInfo outputs;
89 public bool applicable (Gnome.RRScreen screen) throws GLib.Error;
90 public bool apply (Gnome.RRScreen screen) throws GLib.Error;
91 public static bool apply_from_filename (Gnome.RRScreen screen, string filename) throws GLib.Error;
92 public static bool apply_from_filename_with_time (Gnome.RRScreen screen, string filename, uint32 timestamp) throws GLib.Error;
93 public static bool apply_stored (Gnome.RRScreen screen) throws GLib.Error;
94 public bool apply_with_time (Gnome.RRScreen screen, uint32 timestamp) throws GLib.Error;
95 [CCode (has_construct_function = false)]
96 public RRConfig.current (Gnome.RRScreen screen);
97 public bool equal (Gnome.RRConfig config2);
98 public static unowned string get_backup_filename ();
99 public static unowned string get_intended_filename ();
100 public bool match (Gnome.RRConfig config2);
101 public void sanitize ();
102 public bool save () throws GLib.Error;
103 [CCode (has_construct_function = false)]
104 public RRConfig.stored (Gnome.RRScreen screen) throws GLib.Error;
105 }
106 [Compact]
107 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
108 public class RRCrtc {
109 public bool can_drive_output (Gnome.RROutput output);
110 public unowned Gnome.RRMode get_current_mode ();
111 public Gnome.RRRotation get_current_rotation ();
112 public bool get_gamma (int size, uint red, uint green, uint blue);
113 public uint32 get_id ();
114 public void get_position (int x, int y);
115 public Gnome.RRRotation get_rotations ();
116 public bool set_config (int x, int y, Gnome.RRMode mode, Gnome.RRRotation rotation, Gnome.RROutput[] outputs) throws GLib.Error;
117 public bool set_config_with_time (uint32 timestamp, int x, int y, Gnome.RRMode mode, Gnome.RRRotation rotation, Gnome.RROutput[] outputs) throws GLib.Error;
118 public void set_gamma (int size, uint red, uint green, uint blue);
119 public bool supports_rotation (Gnome.RRRotation rotation);
120 }
121 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
122 public class RRLabeler : GLib.Object {
123 [CCode (has_construct_function = false)]
124 public RRLabeler (Gnome.RRConfig config);
125 public void get_color_for_output (Gnome.OutputInfo output, Gdk.Color color_out);
126 public void hide ();
127 }
128 [Compact]
129 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
130 public class RRLabelerClass {
131 }
132 [Compact]
133 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
134 public class RRMode {
135 public int get_freq ();
136 public uint get_height ();
137 public uint32 get_id ();
138 public uint get_width ();
139 }
140 [Compact]
141 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
142 public class RROutput {
143 public bool can_clone (Gnome.RROutput clone);
144 public unowned string get_connector_type ();
145 public unowned Gnome.RRCrtc get_crtc ();
146 public unowned Gnome.RRMode get_current_mode ();
147 public uchar get_edid_data ();
148 public int get_height_mm ();
149 public uint32 get_id ();
150 public bool get_is_primary ();
151 public unowned string get_name ();
152 public void get_position (int x, int y);
153 public unowned Gnome.RRCrtc get_possible_crtcs ();
154 public unowned Gnome.RRMode get_preferred_mode ();
155 public int get_size_inches ();
156 public int get_width_mm ();
157 public bool is_connected ();
158 public bool is_laptop ();
159 public unowned Gnome.RRMode list_modes ();
160 public bool supports_mode (Gnome.RRMode mode);
161 }
162 [Compact]
163 [CCode (free_function = "gnome_rr_screen_destroy", cheader_filename = "libgnomeui/gnome-bg.h")]
164 public class RRScreen {
165 [CCode (has_construct_function = false)]
166 public RRScreen (Gdk.Screen screen, Gnome.RRScreenChanged callback, void* data) throws GLib.Error;
167 public unowned Gnome.RRCrtc get_crtc_by_id (uint32 id);
168 public unowned Gnome.RROutput get_output_by_id (uint32 id);
169 public unowned Gnome.RROutput get_output_by_name (string name);
170 public void get_ranges (int min_width, int max_width, int min_height, int max_height);
171 public void get_timestamps (uint32 change_timestamp_ret, uint32 config_timestamp_ret);
172 public unowned Gnome.RRMode list_clone_modes ();
173 public unowned Gnome.RRCrtc list_crtcs ();
174 public unowned Gnome.RRMode list_modes ();
175 public unowned Gnome.RROutput list_outputs ();
176 public bool refresh () throws GLib.Error;
177 public void set_primary_output (Gnome.RROutput output);
178 public void set_size (int width, int height, int mm_width, int mm_height);
179 }
180 [CCode (cprefix = "GNOME_BG_COLOR_", has_type_id = false, cheader_filename = "libgnomeui/gnome-bg.h")]
181 public enum BGColorType {
182 SOLID,
183 H_GRADIENT,
184 V_GRADIENT
185 }
186 [CCode (cprefix = "GNOME_BG_PLACEMENT_", has_type_id = false, cheader_filename = "libgnomeui/gnome-bg.h")]
187 public enum BGPlacement {
188 TILED,
189 ZOOMED,
190 CENTERED,
191 SCALED,
192 FILL_SCREEN,
193 SPANNED
194 }
195 [CCode (cprefix = "GNOME_DESKTOP_THUMBNAIL_SIZE_", has_type_id = false, cheader_filename = "libgnomeui/gnome-bg.h")]
196 public enum DesktopThumbnailSize {
197 NORMAL,
198 LARGE
199 }
200 [CCode (cprefix = "GNOME_RR_ERROR_", has_type_id = false, cheader_filename = "libgnomeui/gnome-bg.h")]
201 public enum RRError {
202 UNKNOWN,
203 NO_RANDR_EXTENSION,
204 RANDR_ERROR,
205 BOUNDS_ERROR,
206 CRTC_ASSIGNMENT,
207 NO_MATCHING_CONFIG
208 }
209 [CCode (cprefix = "GNOME_RR_", has_type_id = false, cheader_filename = "libgnomeui/gnome-bg.h")]
210 public enum RRRotation {
211 ROTATION_0,
212 ROTATION_90,
213 ROTATION_180,
214 ROTATION_270,
215 REFLECT_X,
216 REFLECT_Y
217 }
218 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
219 public delegate void RRScreenChanged (Gnome.RRScreen screen);
220 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
221 public const string BG_KEY_DIR;
222 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
223 public const string RR_CONNECTOR_TYPE_PANEL;
224 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
225 public static bool desktop_thumbnail_has_uri (Gdk.Pixbuf pixbuf, string uri);
226 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
227 public static bool desktop_thumbnail_is_valid (Gdk.Pixbuf pixbuf, string uri, ulong mtime);
228 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
229 public static unowned string desktop_thumbnail_md5 (string uri);
230 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
231 public static unowned string desktop_thumbnail_path_for_uri (string uri, Gnome.DesktopThumbnailSize size);
232 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
233 public static unowned Gdk.Pixbuf desktop_thumbnail_scale_down_pixbuf (Gdk.Pixbuf pixbuf, int dest_width, int dest_height);
234 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
235 public static unowned Gnome.RRMode rr_create_clone_modes (Gnome.RRScreen screen);
236 [CCode (cheader_filename = "libgnomeui/gnome-bg.h")]
237 public static GLib.Quark rr_error_quark ();
238 [CCode (cname = "ubuntu_compute_virtual_size_for_configuration", cheader_filename = "libgnomeui/gnome-bg.h")]
239 public static void ubuntu_compute_virtual_size_for_configuration (Gnome.RRConfig config, int ret_width, int ret_height);
240 [CCode (cname = "ubuntu_gnome_rr_config_save_desired", cheader_filename = "libgnomeui/gnome-bg.h")]
241 public static bool ubuntu_gnome_rr_config_save_desired (Gnome.RRConfig configuration) throws GLib.Error;
242}