Rename preferences to bg_preferences to avoid possible namespace collision
2001-12-20 Bradford Hovinen <hovinen@ximian.com> * libbackground/preferences.[ch]: Rename preferences to bg_preferences to avoid possible namespace collision * All: Update to reflect the above
This commit is contained in:
parent
b65967ac90
commit
a2b2b7932a
7 changed files with 112 additions and 106 deletions
|
@ -110,13 +110,13 @@ get_legacy_settings (void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
real_realize_cb (Preferences *prefs)
|
real_realize_cb (BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
GtkWidget *color_frame;
|
GtkWidget *color_frame;
|
||||||
Applier *applier;
|
Applier *applier;
|
||||||
|
|
||||||
g_return_val_if_fail (prefs != NULL, TRUE);
|
g_return_val_if_fail (prefs != NULL, TRUE);
|
||||||
g_return_val_if_fail (IS_PREFERENCES (prefs), TRUE);
|
g_return_val_if_fail (IS_BG_PREFERENCES (prefs), TRUE);
|
||||||
|
|
||||||
if (G_OBJECT (prefs)->ref_count == 0)
|
if (G_OBJECT (prefs)->ref_count == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -132,14 +132,14 @@ real_realize_cb (Preferences *prefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
realize_2_cb (Preferences *prefs)
|
realize_2_cb (BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
gtk_idle_add ((GtkFunction) real_realize_cb, prefs);
|
gtk_idle_add ((GtkFunction) real_realize_cb, prefs);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
realize_cb (GtkWidget *widget, Preferences *prefs)
|
realize_cb (GtkWidget *widget, BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
gtk_timeout_add (100, (GtkFunction) realize_2_cb, prefs);
|
gtk_timeout_add (100, (GtkFunction) realize_2_cb, prefs);
|
||||||
}
|
}
|
||||||
|
@ -153,20 +153,20 @@ realize_cb (GtkWidget *widget, Preferences *prefs)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, Preferences *prefs)
|
peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
GConfEntry *entry;
|
GConfEntry *entry;
|
||||||
Applier *applier;
|
Applier *applier;
|
||||||
GtkWidget *color_frame;
|
GtkWidget *color_frame;
|
||||||
|
|
||||||
entry = gconf_entry_new (key, value);
|
entry = gconf_entry_new (key, value);
|
||||||
preferences_merge_entry (prefs, entry);
|
bg_preferences_merge_entry (prefs, entry);
|
||||||
gconf_entry_free (entry);
|
gconf_entry_free (entry);
|
||||||
|
|
||||||
applier = g_object_get_data (G_OBJECT (prefs), "applier");
|
applier = g_object_get_data (G_OBJECT (prefs), "applier");
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier)))
|
if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier)))
|
||||||
applier_apply_prefs (applier, PREFERENCES (prefs));
|
applier_apply_prefs (applier, BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
if (!strcmp (key, "/desktop/gnome/background/wallpaper-enabled") ||
|
if (!strcmp (key, "/desktop/gnome/background/wallpaper-enabled") ||
|
||||||
!strcmp (key, "/desktop/gnome/background/wallpaper-filename") ||
|
!strcmp (key, "/desktop/gnome/background/wallpaper-filename") ||
|
||||||
|
@ -193,8 +193,8 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, Applier *applier)
|
||||||
gconf_client_set_bool (client, "/desktop/gnome/background/enabled", TRUE, NULL);
|
gconf_client_set_bool (client, "/desktop/gnome/background/enabled", TRUE, NULL);
|
||||||
|
|
||||||
/* Load preferences */
|
/* Load preferences */
|
||||||
prefs = preferences_new ();
|
prefs = bg_preferences_new ();
|
||||||
preferences_load (PREFERENCES (prefs));
|
bg_preferences_load (BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
/* We need to be able to retrieve the applier and the color frame in
|
/* We need to be able to retrieve the applier and the color frame in
|
||||||
callbacks */
|
callbacks */
|
||||||
|
@ -229,7 +229,7 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, Applier *applier)
|
||||||
|
|
||||||
/* Make sure preferences get applied to the preview */
|
/* Make sure preferences get applied to the preview */
|
||||||
if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier)))
|
if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier)))
|
||||||
applier_apply_prefs (applier, PREFERENCES (prefs));
|
applier_apply_prefs (applier, BG_PREFERENCES (prefs));
|
||||||
else
|
else
|
||||||
g_signal_connect_after (G_OBJECT (applier_get_preview_widget (applier)), "realize",
|
g_signal_connect_after (G_OBJECT (applier_get_preview_widget (applier)), "realize",
|
||||||
(GCallback) realize_cb, prefs);
|
(GCallback) realize_cb, prefs);
|
||||||
|
|
|
@ -37,13 +37,13 @@
|
||||||
#include "applier.h"
|
#include "applier.h"
|
||||||
|
|
||||||
static Applier *applier;
|
static Applier *applier;
|
||||||
static Preferences *prefs;
|
static BGPreferences *prefs;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
background_callback (GConfEntry *entry)
|
background_callback (GConfEntry *entry)
|
||||||
{
|
{
|
||||||
preferences_merge_entry (prefs, entry);
|
bg_preferences_merge_entry (prefs, entry);
|
||||||
applier_apply_prefs (applier, PREFERENCES (prefs));
|
applier_apply_prefs (applier, prefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -51,8 +51,8 @@ gnome_settings_background_init (GConfEngine *engine)
|
||||||
{
|
{
|
||||||
applier = APPLIER (applier_new (APPLIER_ROOT));
|
applier = APPLIER (applier_new (APPLIER_ROOT));
|
||||||
|
|
||||||
prefs = preferences_new ();
|
prefs = BG_PREFERENCES (bg_preferences_new ());
|
||||||
preferences_load (PREFERENCES (prefs));
|
bg_preferences_load (prefs);
|
||||||
|
|
||||||
gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/keyboard", background_callback);
|
gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/keyboard", background_callback);
|
||||||
}
|
}
|
||||||
|
@ -60,5 +60,5 @@ gnome_settings_background_init (GConfEngine *engine)
|
||||||
void
|
void
|
||||||
gnome_settings_background_load (GConfEngine *engine)
|
gnome_settings_background_load (GConfEngine *engine)
|
||||||
{
|
{
|
||||||
applier_apply_prefs (applier, PREFERENCES (prefs));
|
applier_apply_prefs (applier, prefs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
|
||||||
|
|
||||||
|
* preferences.[ch]: Rename preferences to bg_preferences to avoid
|
||||||
|
possible namespace collision
|
||||||
|
|
||||||
2001-12-18 Bradford Hovinen <hovinen@ximian.com>
|
2001-12-18 Bradford Hovinen <hovinen@ximian.com>
|
||||||
|
|
||||||
* preferences.c: Update GConf keys to use /desktop/gnome/background
|
* preferences.c: Update GConf keys to use /desktop/gnome/background
|
||||||
|
|
|
@ -53,8 +53,8 @@ struct _ApplierPrivate
|
||||||
* -- this is not used for
|
* -- this is not used for
|
||||||
* actual rendering; it is
|
* actual rendering; it is
|
||||||
* returned if requested */
|
* returned if requested */
|
||||||
Preferences *last_prefs; /* A cache of the last
|
BGPreferences *last_prefs; /* A cache of the last
|
||||||
* preferences structure to
|
* bg_preferences structure to
|
||||||
* be applied */
|
* be applied */
|
||||||
|
|
||||||
GdkPixbuf *wallpaper_pixbuf; /* The "raw" wallpaper pixbuf */
|
GdkPixbuf *wallpaper_pixbuf; /* The "raw" wallpaper pixbuf */
|
||||||
|
@ -124,17 +124,17 @@ static void applier_dispose (GObject *object);
|
||||||
static void applier_finalize (GObject *object);
|
static void applier_finalize (GObject *object);
|
||||||
|
|
||||||
static void run_render_pipeline (Applier *applier,
|
static void run_render_pipeline (Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static void draw_disabled_message (GtkWidget *widget);
|
static void draw_disabled_message (GtkWidget *widget);
|
||||||
|
|
||||||
static void render_background (Applier *applier,
|
static void render_background (Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static void render_wallpaper (Applier *applier,
|
static void render_wallpaper (Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static void render_to_screen (Applier *applier,
|
static void render_to_screen (Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static void create_pixmap (Applier *applier,
|
static void create_pixmap (Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static void get_geometry (wallpaper_type_t wallpaper_type,
|
static void get_geometry (wallpaper_type_t wallpaper_type,
|
||||||
GdkPixbuf *pixbuf,
|
GdkPixbuf *pixbuf,
|
||||||
GdkRectangle *field_geom,
|
GdkRectangle *field_geom,
|
||||||
|
@ -159,12 +159,12 @@ static void fill_gradient (GdkPixbuf *pixbuf,
|
||||||
orientation_t orientation);
|
orientation_t orientation);
|
||||||
|
|
||||||
static gboolean need_wallpaper_load_p (const Applier *applier,
|
static gboolean need_wallpaper_load_p (const Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static gboolean need_root_pixmap_p (const Applier *applier,
|
static gboolean need_root_pixmap_p (const Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static gboolean wallpaper_full_cover_p (const Applier *applier,
|
static gboolean wallpaper_full_cover_p (const Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
static gboolean render_small_pixmap_p (const Preferences *prefs);
|
static gboolean render_small_pixmap_p (const BGPreferences *prefs);
|
||||||
|
|
||||||
static GdkPixmap *make_root_pixmap (gint width,
|
static GdkPixmap *make_root_pixmap (gint width,
|
||||||
gint height);
|
gint height);
|
||||||
|
@ -355,7 +355,7 @@ applier_new (ApplierType type)
|
||||||
|
|
||||||
void
|
void
|
||||||
applier_apply_prefs (Applier *applier,
|
applier_apply_prefs (Applier *applier,
|
||||||
const Preferences *prefs)
|
const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
g_return_if_fail (applier != NULL);
|
g_return_if_fail (applier != NULL);
|
||||||
g_return_if_fail (IS_APPLIER (applier));
|
g_return_if_fail (IS_APPLIER (applier));
|
||||||
|
@ -395,19 +395,19 @@ applier_apply_prefs (Applier *applier,
|
||||||
if (applier->p->last_prefs != NULL)
|
if (applier->p->last_prefs != NULL)
|
||||||
g_object_unref (G_OBJECT (applier->p->last_prefs));
|
g_object_unref (G_OBJECT (applier->p->last_prefs));
|
||||||
|
|
||||||
applier->p->last_prefs = PREFERENCES (preferences_clone (prefs));
|
applier->p->last_prefs = BG_PREFERENCES (bg_preferences_clone (prefs));
|
||||||
|
|
||||||
if (applier->p->type == APPLIER_PREVIEW && applier->p->preview_widget != NULL)
|
if (applier->p->type == APPLIER_PREVIEW && applier->p->preview_widget != NULL)
|
||||||
gtk_widget_queue_draw (applier->p->preview_widget);
|
gtk_widget_queue_draw (applier->p->preview_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
applier_render_color_p (const Applier *applier, const Preferences *prefs)
|
applier_render_color_p (const Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (applier != NULL, FALSE);
|
g_return_val_if_fail (applier != NULL, FALSE);
|
||||||
g_return_val_if_fail (IS_APPLIER (applier), FALSE);
|
g_return_val_if_fail (IS_APPLIER (applier), FALSE);
|
||||||
g_return_val_if_fail (prefs != NULL, FALSE);
|
g_return_val_if_fail (prefs != NULL, FALSE);
|
||||||
g_return_val_if_fail (IS_PREFERENCES (prefs), FALSE);
|
g_return_val_if_fail (IS_BG_PREFERENCES (prefs), FALSE);
|
||||||
|
|
||||||
return prefs->enabled && !wallpaper_full_cover_p (applier, prefs);
|
return prefs->enabled && !wallpaper_full_cover_p (applier, prefs);
|
||||||
}
|
}
|
||||||
|
@ -536,12 +536,12 @@ draw_disabled_message (GtkWidget *widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
run_render_pipeline (Applier *applier, const Preferences *prefs)
|
run_render_pipeline (Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
g_return_if_fail (applier != NULL);
|
g_return_if_fail (applier != NULL);
|
||||||
g_return_if_fail (IS_APPLIER (applier));
|
g_return_if_fail (IS_APPLIER (applier));
|
||||||
g_return_if_fail (prefs != NULL);
|
g_return_if_fail (prefs != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (prefs));
|
g_return_if_fail (IS_BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
g_assert (applier->p->pixbuf == NULL);
|
g_assert (applier->p->pixbuf == NULL);
|
||||||
|
|
||||||
|
@ -578,12 +578,12 @@ run_render_pipeline (Applier *applier, const Preferences *prefs)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
render_background (Applier *applier, const Preferences *prefs)
|
render_background (Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
g_return_if_fail (applier != NULL);
|
g_return_if_fail (applier != NULL);
|
||||||
g_return_if_fail (IS_APPLIER (applier));
|
g_return_if_fail (IS_APPLIER (applier));
|
||||||
g_return_if_fail (prefs != NULL);
|
g_return_if_fail (prefs != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (prefs));
|
g_return_if_fail (IS_BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
if (prefs->gradient_enabled && !wallpaper_full_cover_p (applier, prefs)) {
|
if (prefs->gradient_enabled && !wallpaper_full_cover_p (applier, prefs)) {
|
||||||
applier->p->grad_geom.x = applier->p->render_geom.width;
|
applier->p->grad_geom.x = applier->p->render_geom.width;
|
||||||
|
@ -629,7 +629,7 @@ render_background (Applier *applier, const Preferences *prefs)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
render_wallpaper (Applier *applier, const Preferences *prefs)
|
render_wallpaper (Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
GdkRectangle src_geom;
|
GdkRectangle src_geom;
|
||||||
GdkRectangle dest_geom;
|
GdkRectangle dest_geom;
|
||||||
|
@ -642,7 +642,7 @@ render_wallpaper (Applier *applier, const Preferences *prefs)
|
||||||
g_return_if_fail (applier != NULL);
|
g_return_if_fail (applier != NULL);
|
||||||
g_return_if_fail (IS_APPLIER (applier));
|
g_return_if_fail (IS_APPLIER (applier));
|
||||||
g_return_if_fail (prefs != NULL);
|
g_return_if_fail (prefs != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (prefs));
|
g_return_if_fail (IS_BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
if (prefs->wallpaper_enabled) {
|
if (prefs->wallpaper_enabled) {
|
||||||
if (applier->p->wallpaper_pixbuf == NULL)
|
if (applier->p->wallpaper_pixbuf == NULL)
|
||||||
|
@ -728,14 +728,14 @@ render_wallpaper (Applier *applier, const Preferences *prefs)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
render_to_screen (Applier *applier, const Preferences *prefs)
|
render_to_screen (Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
|
|
||||||
g_return_if_fail (applier != NULL);
|
g_return_if_fail (applier != NULL);
|
||||||
g_return_if_fail (IS_APPLIER (applier));
|
g_return_if_fail (IS_APPLIER (applier));
|
||||||
g_return_if_fail (prefs != NULL);
|
g_return_if_fail (prefs != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (prefs));
|
g_return_if_fail (IS_BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
gc = gdk_gc_new (GDK_ROOT_PARENT ());
|
gc = gdk_gc_new (GDK_ROOT_PARENT ());
|
||||||
|
|
||||||
|
@ -795,14 +795,14 @@ render_to_screen (Applier *applier, const Preferences *prefs)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_pixmap (Applier *applier, const Preferences *prefs)
|
create_pixmap (Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
g_return_if_fail (applier != NULL);
|
g_return_if_fail (applier != NULL);
|
||||||
g_return_if_fail (IS_APPLIER (applier));
|
g_return_if_fail (IS_APPLIER (applier));
|
||||||
g_return_if_fail (prefs != NULL);
|
g_return_if_fail (prefs != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (prefs));
|
g_return_if_fail (IS_BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
switch (applier->p->type) {
|
switch (applier->p->type) {
|
||||||
case APPLIER_ROOT:
|
case APPLIER_ROOT:
|
||||||
|
@ -1187,7 +1187,7 @@ fill_gradient (GdkPixbuf *pixbuf,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
need_wallpaper_load_p (const Applier *applier, const Preferences *prefs)
|
need_wallpaper_load_p (const Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
if (applier->p->last_prefs == NULL)
|
if (applier->p->last_prefs == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1204,7 +1204,7 @@ need_wallpaper_load_p (const Applier *applier, const Preferences *prefs)
|
||||||
/* Return TRUE iff we need to create a new root pixmap */
|
/* Return TRUE iff we need to create a new root pixmap */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
need_root_pixmap_p (const Applier *applier, const Preferences *prefs)
|
need_root_pixmap_p (const Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
if (applier->p->last_prefs == NULL)
|
if (applier->p->last_prefs == NULL)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1222,10 +1222,10 @@ need_root_pixmap_p (const Applier *applier, const Preferences *prefs)
|
||||||
/* Return TRUE iff the colors are equal */
|
/* Return TRUE iff the colors are equal */
|
||||||
|
|
||||||
/* Return TRUE iff the wallpaper completely covers the colors in the given
|
/* Return TRUE iff the wallpaper completely covers the colors in the given
|
||||||
* preferences structure, assuming we have already loaded the wallpaper pixbuf */
|
* bg_preferences structure, assuming we have already loaded the wallpaper pixbuf */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
wallpaper_full_cover_p (const Applier *applier, const Preferences *prefs)
|
wallpaper_full_cover_p (const Applier *applier, const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
gint swidth, sheight;
|
gint swidth, sheight;
|
||||||
gint pwidth, pheight;
|
gint pwidth, pheight;
|
||||||
|
@ -1270,7 +1270,7 @@ wallpaper_full_cover_p (const Applier *applier, const Preferences *prefs)
|
||||||
/* Return TRUE if we can optimize the rendering by using a small thin pixmap */
|
/* Return TRUE if we can optimize the rendering by using a small thin pixmap */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
render_small_pixmap_p (const Preferences *prefs)
|
render_small_pixmap_p (const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
return prefs->gradient_enabled && !prefs->wallpaper_enabled;
|
return prefs->gradient_enabled && !prefs->wallpaper_enabled;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,10 +61,10 @@ guint applier_get_type (void);
|
||||||
GObject *applier_new (ApplierType type);
|
GObject *applier_new (ApplierType type);
|
||||||
|
|
||||||
void applier_apply_prefs (Applier *applier,
|
void applier_apply_prefs (Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
|
|
||||||
gboolean applier_render_color_p (const Applier *applier,
|
gboolean applier_render_color_p (const Applier *applier,
|
||||||
const Preferences *prefs);
|
const BGPreferences *prefs);
|
||||||
|
|
||||||
GtkWidget *applier_get_preview_widget (Applier *applier);
|
GtkWidget *applier_get_preview_widget (Applier *applier);
|
||||||
GdkPixbuf *applier_get_wallpaper_pixbuf (Applier *applier);
|
GdkPixbuf *applier_get_wallpaper_pixbuf (Applier *applier);
|
||||||
|
|
|
@ -34,41 +34,42 @@
|
||||||
|
|
||||||
static GObjectClass *parent_class;
|
static GObjectClass *parent_class;
|
||||||
|
|
||||||
static void preferences_init (Preferences *prefs,
|
static void bg_preferences_init (BGPreferences *prefs,
|
||||||
PreferencesClass *class);
|
BGPreferencesClass *class);
|
||||||
static void preferences_class_init (PreferencesClass *class);
|
static void bg_preferences_class_init (BGPreferencesClass *class);
|
||||||
|
|
||||||
static void preferences_finalize (GObject *object);
|
static void bg_preferences_finalize (GObject *object);
|
||||||
|
|
||||||
static GdkColor *read_color_from_string (const gchar *string);
|
static GdkColor *read_color_from_string (const gchar *string);
|
||||||
|
|
||||||
GType
|
GType
|
||||||
preferences_get_type (void)
|
bg_preferences_get_type (void)
|
||||||
{
|
{
|
||||||
static GType preferences_type = 0;
|
static GType bg_preferences_type = 0;
|
||||||
|
|
||||||
if (!preferences_type) {
|
if (!bg_preferences_type) {
|
||||||
GTypeInfo preferences_info = {
|
GTypeInfo bg_preferences_info = {
|
||||||
sizeof (PreferencesClass),
|
sizeof (BGPreferencesClass),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(GClassInitFunc) preferences_class_init,
|
(GClassInitFunc) bg_preferences_class_init,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
sizeof (Preferences),
|
sizeof (BGPreferences),
|
||||||
0,
|
0,
|
||||||
(GInstanceInitFunc) preferences_init,
|
(GInstanceInitFunc) bg_preferences_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
preferences_type =
|
bg_preferences_type =
|
||||||
g_type_register_static (G_TYPE_OBJECT, "Preferences", &preferences_info, 0);
|
g_type_register_static (G_TYPE_OBJECT, "BGPreferences", &bg_preferences_info, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return preferences_type;
|
return bg_preferences_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
preferences_init (Preferences *prefs, PreferencesClass *class)
|
bg_preferences_init (BGPreferences *prefs,
|
||||||
|
BGPreferencesClass *class)
|
||||||
{
|
{
|
||||||
prefs->frozen = FALSE;
|
prefs->frozen = FALSE;
|
||||||
|
|
||||||
|
@ -89,40 +90,40 @@ preferences_init (Preferences *prefs, PreferencesClass *class)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
preferences_class_init (PreferencesClass *class)
|
bg_preferences_class_init (BGPreferencesClass *class)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class;
|
GObjectClass *object_class;
|
||||||
|
|
||||||
object_class = (GObjectClass *) class;
|
object_class = (GObjectClass *) class;
|
||||||
object_class->finalize = preferences_finalize;
|
object_class->finalize = bg_preferences_finalize;
|
||||||
|
|
||||||
parent_class =
|
parent_class =
|
||||||
G_OBJECT_CLASS (g_type_class_ref (G_TYPE_OBJECT));
|
G_OBJECT_CLASS (g_type_class_ref (G_TYPE_OBJECT));
|
||||||
}
|
}
|
||||||
|
|
||||||
GObject *
|
GObject *
|
||||||
preferences_new (void)
|
bg_preferences_new (void)
|
||||||
{
|
{
|
||||||
GObject *object;
|
GObject *object;
|
||||||
|
|
||||||
object = g_object_new (preferences_get_type (), NULL);
|
object = g_object_new (bg_preferences_get_type (), NULL);
|
||||||
PREFERENCES (object)->enabled = TRUE;
|
BG_PREFERENCES (object)->enabled = TRUE;
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
GObject *
|
GObject *
|
||||||
preferences_clone (const Preferences *prefs)
|
bg_preferences_clone (const BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
GObject *object;
|
GObject *object;
|
||||||
Preferences *new_prefs;
|
BGPreferences *new_prefs;
|
||||||
|
|
||||||
g_return_val_if_fail (prefs != NULL, NULL);
|
g_return_val_if_fail (prefs != NULL, NULL);
|
||||||
g_return_val_if_fail (IS_PREFERENCES (prefs), NULL);
|
g_return_val_if_fail (IS_BG_PREFERENCES (prefs), NULL);
|
||||||
|
|
||||||
object = preferences_new ();
|
object = bg_preferences_new ();
|
||||||
|
|
||||||
new_prefs = PREFERENCES (object);
|
new_prefs = BG_PREFERENCES (object);
|
||||||
|
|
||||||
new_prefs->enabled = prefs->enabled;
|
new_prefs->enabled = prefs->enabled;
|
||||||
new_prefs->gradient_enabled = prefs->gradient_enabled;
|
new_prefs->gradient_enabled = prefs->gradient_enabled;
|
||||||
|
@ -146,14 +147,14 @@ preferences_clone (const Preferences *prefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
preferences_finalize (GObject *object)
|
bg_preferences_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
Preferences *prefs;
|
BGPreferences *prefs;
|
||||||
|
|
||||||
g_return_if_fail (object != NULL);
|
g_return_if_fail (object != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (object));
|
g_return_if_fail (IS_BG_PREFERENCES (object));
|
||||||
|
|
||||||
prefs = PREFERENCES (object);
|
prefs = BG_PREFERENCES (object);
|
||||||
|
|
||||||
g_free (prefs->wallpaper_filename);
|
g_free (prefs->wallpaper_filename);
|
||||||
g_free (prefs->wallpaper_sel_path);
|
g_free (prefs->wallpaper_sel_path);
|
||||||
|
@ -162,13 +163,13 @@ preferences_finalize (GObject *object)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
preferences_load (Preferences *prefs)
|
bg_preferences_load (BGPreferences *prefs)
|
||||||
{
|
{
|
||||||
GConfClient *client;
|
GConfClient *client;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
g_return_if_fail (prefs != NULL);
|
g_return_if_fail (prefs != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (prefs));
|
g_return_if_fail (IS_BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
client = gconf_client_get_default ();
|
client = gconf_client_get_default ();
|
||||||
|
|
||||||
|
@ -191,18 +192,18 @@ preferences_load (Preferences *prefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the event name given (the event being notification of a property having
|
/* Parse the event name given (the event being notification of a property having
|
||||||
* changed and apply that change to the preferences structure. Eliminates the
|
* changed and apply that change to the bg_preferences structure. Eliminates the
|
||||||
* need to reload the structure entirely on every event notification
|
* need to reload the structure entirely on every event notification
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
preferences_merge_entry (Preferences *prefs,
|
bg_preferences_merge_entry (BGPreferences *prefs,
|
||||||
const GConfEntry *entry)
|
const GConfEntry *entry)
|
||||||
{
|
{
|
||||||
const GConfValue *value = gconf_entry_get_value (entry);
|
const GConfValue *value = gconf_entry_get_value (entry);
|
||||||
|
|
||||||
g_return_if_fail (prefs != NULL);
|
g_return_if_fail (prefs != NULL);
|
||||||
g_return_if_fail (IS_PREFERENCES (prefs));
|
g_return_if_fail (IS_BG_PREFERENCES (prefs));
|
||||||
|
|
||||||
if (!strcmp (entry->key, "/desktop/gnome/background/wallpaper_type")) {
|
if (!strcmp (entry->key, "/desktop/gnome/background/wallpaper_type")) {
|
||||||
prefs->wallpaper_type = gconf_value_get_int (value);
|
prefs->wallpaper_type = gconf_value_get_int (value);
|
||||||
|
|
|
@ -21,19 +21,19 @@
|
||||||
* 02111-1307, USA.
|
* 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PREFERENCES_H
|
#ifndef __BGPREFERENCES_H
|
||||||
#define __PREFERENCES_H
|
#define __BGPREFERENCES_H
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include <gconf/gconf-client.h>
|
#include <gconf/gconf-client.h>
|
||||||
|
|
||||||
#define PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, preferences_get_type (), Preferences)
|
#define BG_PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, bg_preferences_get_type (), BGPreferences)
|
||||||
#define PREFERENCES_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, preferences_get_type (), PreferencesClass)
|
#define BG_PREFERENCES_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, bg_preferences_get_type (), BGPreferencesClass)
|
||||||
#define IS_PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, preferences_get_type ())
|
#define IS_BG_PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, bg_preferences_get_type ())
|
||||||
|
|
||||||
typedef struct _Preferences Preferences;
|
typedef struct _BGPreferences BGPreferences;
|
||||||
typedef struct _PreferencesClass PreferencesClass;
|
typedef struct _BGPreferencesClass BGPreferencesClass;
|
||||||
|
|
||||||
typedef enum _orientation_t {
|
typedef enum _orientation_t {
|
||||||
ORIENTATION_SOLID, ORIENTATION_HORIZ, ORIENTATION_VERT
|
ORIENTATION_SOLID, ORIENTATION_HORIZ, ORIENTATION_VERT
|
||||||
|
@ -44,7 +44,7 @@ typedef enum _wallpaper_type_t {
|
||||||
WPTYPE_STRETCHED, WPTYPE_EMBOSSED
|
WPTYPE_STRETCHED, WPTYPE_EMBOSSED
|
||||||
} wallpaper_type_t;
|
} wallpaper_type_t;
|
||||||
|
|
||||||
struct _Preferences
|
struct _BGPreferences
|
||||||
{
|
{
|
||||||
GObject object;
|
GObject object;
|
||||||
|
|
||||||
|
@ -70,19 +70,19 @@ struct _Preferences
|
||||||
gint opacity;
|
gint opacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _PreferencesClass
|
struct _BGPreferencesClass
|
||||||
{
|
{
|
||||||
GObjectClass klass;
|
GObjectClass klass;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType preferences_get_type (void);
|
GType bg_preferences_get_type (void);
|
||||||
|
|
||||||
GObject *preferences_new (void);
|
GObject *bg_preferences_new (void);
|
||||||
GObject *preferences_clone (const Preferences *prefs);
|
GObject *bg_preferences_clone (const BGPreferences *prefs);
|
||||||
|
|
||||||
void preferences_load (Preferences *prefs);
|
void bg_preferences_load (BGPreferences *prefs);
|
||||||
|
|
||||||
void preferences_merge_entry (Preferences *prefs,
|
void bg_preferences_merge_entry (BGPreferences *prefs,
|
||||||
const GConfEntry *entry);
|
const GConfEntry *entry);
|
||||||
|
|
||||||
#endif /* __PREFERENCES_H */
|
#endif /* __PREFERENCES_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue