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:
Bradford Hovinen 2001-12-20 14:24:56 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent b65967ac90
commit a2b2b7932a
7 changed files with 112 additions and 106 deletions

View file

@ -110,13 +110,13 @@ get_legacy_settings (void)
*/
static gboolean
real_realize_cb (Preferences *prefs)
real_realize_cb (BGPreferences *prefs)
{
GtkWidget *color_frame;
Applier *applier;
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)
return FALSE;
@ -132,14 +132,14 @@ real_realize_cb (Preferences *prefs)
}
static gboolean
realize_2_cb (Preferences *prefs)
realize_2_cb (BGPreferences *prefs)
{
gtk_idle_add ((GtkFunction) real_realize_cb, prefs);
return FALSE;
}
static void
realize_cb (GtkWidget *widget, Preferences *prefs)
realize_cb (GtkWidget *widget, BGPreferences *prefs)
{
gtk_timeout_add (100, (GtkFunction) realize_2_cb, prefs);
}
@ -153,20 +153,20 @@ realize_cb (GtkWidget *widget, Preferences *prefs)
*/
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;
Applier *applier;
GtkWidget *color_frame;
entry = gconf_entry_new (key, value);
preferences_merge_entry (prefs, entry);
bg_preferences_merge_entry (prefs, entry);
gconf_entry_free (entry);
applier = g_object_get_data (G_OBJECT (prefs), "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") ||
!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);
/* Load preferences */
prefs = preferences_new ();
preferences_load (PREFERENCES (prefs));
prefs = bg_preferences_new ();
bg_preferences_load (BG_PREFERENCES (prefs));
/* We need to be able to retrieve the applier and the color frame in
callbacks */
@ -229,7 +229,7 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, Applier *applier)
/* Make sure preferences get applied to the preview */
if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier)))
applier_apply_prefs (applier, PREFERENCES (prefs));
applier_apply_prefs (applier, BG_PREFERENCES (prefs));
else
g_signal_connect_after (G_OBJECT (applier_get_preview_widget (applier)), "realize",
(GCallback) realize_cb, prefs);

View file

@ -37,13 +37,13 @@
#include "applier.h"
static Applier *applier;
static Preferences *prefs;
static BGPreferences *prefs;
static void
background_callback (GConfEntry *entry)
{
preferences_merge_entry (prefs, entry);
applier_apply_prefs (applier, PREFERENCES (prefs));
bg_preferences_merge_entry (prefs, entry);
applier_apply_prefs (applier, prefs);
}
void
@ -51,8 +51,8 @@ gnome_settings_background_init (GConfEngine *engine)
{
applier = APPLIER (applier_new (APPLIER_ROOT));
prefs = preferences_new ();
preferences_load (PREFERENCES (prefs));
prefs = BG_PREFERENCES (bg_preferences_new ());
bg_preferences_load (prefs);
gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/keyboard", background_callback);
}
@ -60,5 +60,5 @@ gnome_settings_background_init (GConfEngine *engine)
void
gnome_settings_background_load (GConfEngine *engine)
{
applier_apply_prefs (applier, PREFERENCES (prefs));
applier_apply_prefs (applier, prefs);
}

View file

@ -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>
* preferences.c: Update GConf keys to use /desktop/gnome/background

View file

@ -53,8 +53,8 @@ struct _ApplierPrivate
* -- this is not used for
* actual rendering; it is
* returned if requested */
Preferences *last_prefs; /* A cache of the last
* preferences structure to
BGPreferences *last_prefs; /* A cache of the last
* bg_preferences structure to
* be applied */
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 run_render_pipeline (Applier *applier,
const Preferences *prefs);
const BGPreferences *prefs);
static void draw_disabled_message (GtkWidget *widget);
static void render_background (Applier *applier,
const Preferences *prefs);
const BGPreferences *prefs);
static void render_wallpaper (Applier *applier,
const Preferences *prefs);
const BGPreferences *prefs);
static void render_to_screen (Applier *applier,
const Preferences *prefs);
const BGPreferences *prefs);
static void create_pixmap (Applier *applier,
const Preferences *prefs);
const BGPreferences *prefs);
static void get_geometry (wallpaper_type_t wallpaper_type,
GdkPixbuf *pixbuf,
GdkRectangle *field_geom,
@ -159,12 +159,12 @@ static void fill_gradient (GdkPixbuf *pixbuf,
orientation_t orientation);
static gboolean need_wallpaper_load_p (const Applier *applier,
const Preferences *prefs);
const BGPreferences *prefs);
static gboolean need_root_pixmap_p (const Applier *applier,
const Preferences *prefs);
const BGPreferences *prefs);
static gboolean wallpaper_full_cover_p (const Applier *applier,
const Preferences *prefs);
static gboolean render_small_pixmap_p (const Preferences *prefs);
const BGPreferences *prefs);
static gboolean render_small_pixmap_p (const BGPreferences *prefs);
static GdkPixmap *make_root_pixmap (gint width,
gint height);
@ -355,7 +355,7 @@ applier_new (ApplierType type)
void
applier_apply_prefs (Applier *applier,
const Preferences *prefs)
const BGPreferences *prefs)
{
g_return_if_fail (applier != NULL);
g_return_if_fail (IS_APPLIER (applier));
@ -395,19 +395,19 @@ applier_apply_prefs (Applier *applier,
if (applier->p->last_prefs != NULL)
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)
gtk_widget_queue_draw (applier->p->preview_widget);
}
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 (IS_APPLIER (applier), 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);
}
@ -536,12 +536,12 @@ draw_disabled_message (GtkWidget *widget)
}
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 (IS_APPLIER (applier));
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);
@ -578,12 +578,12 @@ run_render_pipeline (Applier *applier, const Preferences *prefs)
*/
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 (IS_APPLIER (applier));
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)) {
applier->p->grad_geom.x = applier->p->render_geom.width;
@ -629,7 +629,7 @@ render_background (Applier *applier, const Preferences *prefs)
*/
static void
render_wallpaper (Applier *applier, const Preferences *prefs)
render_wallpaper (Applier *applier, const BGPreferences *prefs)
{
GdkRectangle src_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 (IS_APPLIER (applier));
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 (applier->p->wallpaper_pixbuf == NULL)
@ -728,14 +728,14 @@ render_wallpaper (Applier *applier, const Preferences *prefs)
*/
static void
render_to_screen (Applier *applier, const Preferences *prefs)
render_to_screen (Applier *applier, const BGPreferences *prefs)
{
GdkGC *gc;
g_return_if_fail (applier != NULL);
g_return_if_fail (IS_APPLIER (applier));
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 ());
@ -795,14 +795,14 @@ render_to_screen (Applier *applier, const Preferences *prefs)
*/
static void
create_pixmap (Applier *applier, const Preferences *prefs)
create_pixmap (Applier *applier, const BGPreferences *prefs)
{
gint width, height;
g_return_if_fail (applier != NULL);
g_return_if_fail (IS_APPLIER (applier));
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) {
case APPLIER_ROOT:
@ -1187,7 +1187,7 @@ fill_gradient (GdkPixbuf *pixbuf,
*/
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)
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 */
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)
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 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
wallpaper_full_cover_p (const Applier *applier, const Preferences *prefs)
wallpaper_full_cover_p (const Applier *applier, const BGPreferences *prefs)
{
gint swidth, sheight;
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 */
static gboolean
render_small_pixmap_p (const Preferences *prefs)
render_small_pixmap_p (const BGPreferences *prefs)
{
return prefs->gradient_enabled && !prefs->wallpaper_enabled;
}

View file

@ -56,17 +56,17 @@ struct _ApplierClass
GObjectClass klass;
};
guint applier_get_type (void);
guint applier_get_type (void);
GObject *applier_new (ApplierType type);
GObject *applier_new (ApplierType type);
void applier_apply_prefs (Applier *applier,
const Preferences *prefs);
void applier_apply_prefs (Applier *applier,
const BGPreferences *prefs);
gboolean applier_render_color_p (const Applier *applier,
const Preferences *prefs);
gboolean applier_render_color_p (const Applier *applier,
const BGPreferences *prefs);
GtkWidget *applier_get_preview_widget (Applier *applier);
GdkPixbuf *applier_get_wallpaper_pixbuf (Applier *applier);
GtkWidget *applier_get_preview_widget (Applier *applier);
GdkPixbuf *applier_get_wallpaper_pixbuf (Applier *applier);
#endif /* __APPLIER_H */

View file

@ -34,41 +34,42 @@
static GObjectClass *parent_class;
static void preferences_init (Preferences *prefs,
PreferencesClass *class);
static void preferences_class_init (PreferencesClass *class);
static void bg_preferences_init (BGPreferences *prefs,
BGPreferencesClass *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
preferences_get_type (void)
bg_preferences_get_type (void)
{
static GType preferences_type = 0;
static GType bg_preferences_type = 0;
if (!preferences_type) {
GTypeInfo preferences_info = {
sizeof (PreferencesClass),
if (!bg_preferences_type) {
GTypeInfo bg_preferences_info = {
sizeof (BGPreferencesClass),
NULL,
NULL,
(GClassInitFunc) preferences_class_init,
(GClassInitFunc) bg_preferences_class_init,
NULL,
NULL,
sizeof (Preferences),
sizeof (BGPreferences),
0,
(GInstanceInitFunc) preferences_init,
(GInstanceInitFunc) bg_preferences_init,
};
preferences_type =
g_type_register_static (G_TYPE_OBJECT, "Preferences", &preferences_info, 0);
bg_preferences_type =
g_type_register_static (G_TYPE_OBJECT, "BGPreferences", &bg_preferences_info, 0);
}
return preferences_type;
return bg_preferences_type;
}
static void
preferences_init (Preferences *prefs, PreferencesClass *class)
bg_preferences_init (BGPreferences *prefs,
BGPreferencesClass *class)
{
prefs->frozen = FALSE;
@ -89,40 +90,40 @@ preferences_init (Preferences *prefs, PreferencesClass *class)
}
static void
preferences_class_init (PreferencesClass *class)
bg_preferences_class_init (BGPreferencesClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
object_class->finalize = preferences_finalize;
object_class->finalize = bg_preferences_finalize;
parent_class =
G_OBJECT_CLASS (g_type_class_ref (G_TYPE_OBJECT));
}
GObject *
preferences_new (void)
bg_preferences_new (void)
{
GObject *object;
object = g_object_new (preferences_get_type (), NULL);
PREFERENCES (object)->enabled = TRUE;
object = g_object_new (bg_preferences_get_type (), NULL);
BG_PREFERENCES (object)->enabled = TRUE;
return object;
}
GObject *
preferences_clone (const Preferences *prefs)
bg_preferences_clone (const BGPreferences *prefs)
{
GObject *object;
Preferences *new_prefs;
BGPreferences *new_prefs;
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->gradient_enabled = prefs->gradient_enabled;
@ -146,14 +147,14 @@ preferences_clone (const Preferences *prefs)
}
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 (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_sel_path);
@ -162,13 +163,13 @@ preferences_finalize (GObject *object)
}
void
preferences_load (Preferences *prefs)
bg_preferences_load (BGPreferences *prefs)
{
GConfClient *client;
GError *error = 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 ();
@ -191,18 +192,18 @@ preferences_load (Preferences *prefs)
}
/* 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
*/
void
preferences_merge_entry (Preferences *prefs,
const GConfEntry *entry)
bg_preferences_merge_entry (BGPreferences *prefs,
const GConfEntry *entry)
{
const GConfValue *value = gconf_entry_get_value (entry);
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")) {
prefs->wallpaper_type = gconf_value_get_int (value);

View file

@ -21,19 +21,19 @@
* 02111-1307, USA.
*/
#ifndef __PREFERENCES_H
#define __PREFERENCES_H
#ifndef __BGPREFERENCES_H
#define __BGPREFERENCES_H
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gconf/gconf-client.h>
#define PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, preferences_get_type (), Preferences)
#define PREFERENCES_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, preferences_get_type (), PreferencesClass)
#define IS_PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, preferences_get_type ())
#define BG_PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, bg_preferences_get_type (), BGPreferences)
#define BG_PREFERENCES_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, bg_preferences_get_type (), BGPreferencesClass)
#define IS_BG_PREFERENCES(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, bg_preferences_get_type ())
typedef struct _Preferences Preferences;
typedef struct _PreferencesClass PreferencesClass;
typedef struct _BGPreferences BGPreferences;
typedef struct _BGPreferencesClass BGPreferencesClass;
typedef enum _orientation_t {
ORIENTATION_SOLID, ORIENTATION_HORIZ, ORIENTATION_VERT
@ -44,7 +44,7 @@ typedef enum _wallpaper_type_t {
WPTYPE_STRETCHED, WPTYPE_EMBOSSED
} wallpaper_type_t;
struct _Preferences
struct _BGPreferences
{
GObject object;
@ -70,19 +70,19 @@ struct _Preferences
gint opacity;
};
struct _PreferencesClass
struct _BGPreferencesClass
{
GObjectClass klass;
};
GType preferences_get_type (void);
GType bg_preferences_get_type (void);
GObject *preferences_new (void);
GObject *preferences_clone (const Preferences *prefs);
GObject *bg_preferences_new (void);
GObject *bg_preferences_clone (const BGPreferences *prefs);
void preferences_load (Preferences *prefs);
void bg_preferences_load (BGPreferences *prefs);
void preferences_merge_entry (Preferences *prefs,
const GConfEntry *entry);
void bg_preferences_merge_entry (BGPreferences *prefs,
const GConfEntry *entry);
#endif /* __PREFERENCES_H */