## GnomeBG GnomeBG |

## Synopsis

    #include <libgnomeui/gnome-bg.h>

                        GnomeBG;
    enum                GnomeBGColorType;
    enum                GnomeBGPlacement;
    #define             GNOME_BG_KEY_DIR
    GnomeBG *           gnome_bg_new                        (void);
    void                gnome_bg_load_from_preferences      (GnomeBG *bg,
                                                             GConfClient *client);
    void                gnome_bg_save_to_preferences        (GnomeBG *bg,
                                                             GConfClient *client);
    void                gnome_bg_set_filename               (GnomeBG *bg,
                                                             const char *filename);
    void                gnome_bg_set_placement              (GnomeBG *bg,
                                                             GnomeBGPlacement placement);
    void                gnome_bg_set_color                  (GnomeBG *bg,
                                                             GnomeBGColorType type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);
    const gchar *       gnome_bg_get_filename               (GnomeBG *bg);
    GnomeBGPlacement    gnome_bg_get_placement              (GnomeBG *bg);
    void                gnome_bg_get_color                  (GnomeBG *bg,
                                                             GnomeBGColorType *type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);
    void                gnome_bg_draw                       (GnomeBG *bg,
                                                             GdkPixbuf *dest,
                                                             GdkScreen *screen,
                                                             gboolean is_root);
    GdkPixmap *         gnome_bg_create_pixmap              (GnomeBG *bg,
                                                             GdkWindow *window,
                                                             int width,
                                                             int height,
                                                             gboolean root);
    gboolean            gnome_bg_get_image_size             (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             int best_width,
                                                             int best_height,
                                                             int *width,
                                                             int *height);
    GdkPixbuf *         gnome_bg_create_thumbnail           (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height);
    gboolean            gnome_bg_is_dark                    (GnomeBG *bg,
                                                             int dest_width,
                                                             int dest_height);
    void                gnome_bg_set_pixmap_as_root         (GdkScreen *screen,
                                                             GdkPixmap *pixmap);

## Object Hierarchy

      GObject
       +----GnomeBG

## Signals

      "changed"                                        : Run Last
      "transitioned"                                   : Run Last

## Description

## Details

### GnomeBG

    typedef struct _GnomeBG GnomeBG;

### enum GnomeBGColorType

    typedef enum {
    	GNOME_BG_COLOR_SOLID,
    	GNOME_BG_COLOR_H_GRADIENT,
    	GNOME_BG_COLOR_V_GRADIENT
    } GnomeBGColorType;

### enum GnomeBGPlacement

    typedef enum {
    	GNOME_BG_PLACEMENT_TILED,
    	GNOME_BG_PLACEMENT_ZOOMED,
    	GNOME_BG_PLACEMENT_CENTERED,
    	GNOME_BG_PLACEMENT_SCALED,
    	GNOME_BG_PLACEMENT_FILL_SCREEN,
    	GNOME_BG_PLACEMENT_SPANNED
    } GnomeBGPlacement;

### GNOME_BG_KEY_DIR

    #define GNOME_BG_KEY_DIR "/desktop/gnome/background"

### gnome_bg_new ()

    GnomeBG *           gnome_bg_new                        (void);

Returns : |

### gnome_bg_load_from_preferences ()

    void                gnome_bg_load_from_preferences      (GnomeBG *bg,
                                                             GConfClient *client);

`bg` : |
`client` : |

### gnome_bg_save_to_preferences ()

    void                gnome_bg_save_to_preferences        (GnomeBG *bg,
                                                             GConfClient *client);

`bg` : |
`client` : |

### gnome_bg_set_filename ()

    void                gnome_bg_set_filename               (GnomeBG *bg,
                                                             const char *filename);

`bg` : |
`filename` : |

### gnome_bg_set_placement ()

    void                gnome_bg_set_placement              (GnomeBG *bg,
                                                             GnomeBGPlacement placement);

`bg` : |
`placement` : |

### gnome_bg_set_color ()

    void                gnome_bg_set_color                  (GnomeBG *bg,
                                                             GnomeBGColorType type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);

`bg` : |
`type` : |
`primary` : |
`secondary` : |

### gnome_bg_get_filename ()

    const gchar *       gnome_bg_get_filename               (GnomeBG *bg);

`bg` : |
Returns : |

### gnome_bg_get_placement ()

    GnomeBGPlacement    gnome_bg_get_placement              (GnomeBG *bg);

`bg` : |
Returns : |

### gnome_bg_get_color ()

    void                gnome_bg_get_color                  (GnomeBG *bg,
                                                             GnomeBGColorType *type,
                                                             GdkColor *primary,
                                                             GdkColor *secondary);

`bg` : |
`type` : |
`primary` : |
`secondary` : |

### gnome_bg_draw ()

    void                gnome_bg_draw                       (GnomeBG *bg,
                                                             GdkPixbuf *dest,
                                                             GdkScreen *screen,
                                                             gboolean is_root);

`bg` : |
`dest` : |
`screen` : |
`is_root` : |

### gnome_bg_create_pixmap ()

    GdkPixmap *         gnome_bg_create_pixmap              (GnomeBG *bg,
                                                             GdkWindow *window,
                                                             int width,
                                                             int height,
                                                             gboolean root);

`bg` : |
`window` : |
`width` : |
`height` : |
`root` : |
Returns : |

### gnome_bg_get_image_size ()

    gboolean            gnome_bg_get_image_size             (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             int best_width,
                                                             int best_height,
                                                             int *width,
                                                             int *height);

`bg` : |
`factory` : |
`best_width` : |
`best_height` : |
`width` : |
`height` : |
Returns : |

### gnome_bg_create_thumbnail ()

    GdkPixbuf *         gnome_bg_create_thumbnail           (GnomeBG *bg,
                                                             GnomeDesktopThumbnailFactory *factory,
                                                             GdkScreen *screen,
                                                             int dest_width,
                                                             int dest_height);

`bg` : |
`factory` : |
`screen` : |
`dest_width` : |
`dest_height` : |
Returns : |

### gnome_bg_is_dark ()

    gboolean            gnome_bg_is_dark                    (GnomeBG *bg,
                                                             int dest_width,
                                                             int dest_height);

`bg` : |
`dest_width` : |
`dest_height` : |
Returns : |

### gnome_bg_set_pixmap_as_root ()

    void                gnome_bg_set_pixmap_as_root         (GdkScreen *screen,
                                                             GdkPixmap *pixmap);

Set the root pixmap, and properties pointing to it. We do this atomically with a server grab to make sure that we won't leak the pixmap if somebody else it setting it at the same time. (This assumes that they follow the same conventions we do). `pixmap` should come from a call to `gnome_bg_create_pixmap()`.

`screen` : | the GdkScreen to change root background on
`pixmap` : | the GdkPixmap to set root background from

## Signal Details

### The `"changed"` signal

    void                user_function                      (GnomeBG *bg,
                                                            gpointer user_data)      : Run Last

`bg` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"transitioned"` signal

    void                user_function                      (GnomeBG *bg,
                                                            gpointer user_data)      : Run Last

`bg` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.