Put gnome-settings-daemon after libbackgrounds

2001-12-20  Bradford Hovinen  <hovinen@ximian.com>

	* Makefile.am (SUBDIRS): Put gnome-settings-daemon after
	libbackgrounds

	* background-properties-capplet.c: Update

	* capplets/background/Makefile.am: Update

	* background.desktop.in.in (Exec): Update

	* mouse.desktop.in.in (Exec): Update

	* capplets/keyboard/Makefile.am: Update

	* keyboard.desktop.in.in (Exec): Update

	* mouse.desktop.in.in (Exec): Update

	* gnome-settings-background.c: Update

	* applier.[ch]: Rename applier to bg_applier to avoid possible
	namespace collision
This commit is contained in:
Bradford Hovinen 2001-12-20 15:46:08 +00:00 committed by Bradford Hovinen (Gdict maintainer)
parent a2b2b7932a
commit 02397e55aa
16 changed files with 353 additions and 404 deletions

View file

@ -1,5 +1,8 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com> 2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* Makefile.am (SUBDIRS): Put gnome-settings-daemon after
libbackgrounds
* capplets/Makefile.am (always_built_SUBDIRS): Add common, * capplets/Makefile.am (always_built_SUBDIRS): Add common,
background, keyboard, mouse back in background, keyboard, mouse back in

View file

@ -1,4 +1,4 @@
SUBDIRS = schemas gnome-settings-daemon libsounds libbackground libsounds capplets control-center idl po SUBDIRS = schemas libsounds libbackground gnome-settings-daemon capplets control-center idl po
#I removed the root-manager for now #I removed the root-manager for now
# #

View file

@ -1,5 +1,11 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com> 2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* background-properties-capplet.c: Update
* Makefile.am: Update
* background.desktop.in.in (Exec): Update
* background-properties-capplet.c (dialog_button_clicked_cb): * background-properties-capplet.c (dialog_button_clicked_cb):
Remove call to apply_settings Remove call to apply_settings
(apply_settings): Remove (apply_settings): Remove

View file

@ -1,59 +1,19 @@
cappletname = background bin_PROGRAMS = gnome-background-properties
cappletgroup =
bin_PROGRAMS = background-properties-control
bin_SCRIPTS = background-properties-capplet
background_properties_control_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(top_builddir)/libbackground/libbackground.a gnome_background_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) $(top_builddir)/libbackground/libbackground.a
background_properties_control_SOURCES = \ gnome_background_properties_SOURCES = \
background-properties-capplet.c background-properties-capplet.c
DESKTOP_EXEC_LINE = gnomecc --run-capplet background-properties Gladedir = $(GNOMECC_GLADE_DIR)
BONOBO_CONF_DEFINE=-DBONOBO_CONF_ENABLE Glade_DATA = background-properties.glade
pixmap_DATA = iconsdir = $(GNOMECC_ICONS_DIR)
icons_DATA = background-capplet.png
defaultsdir= $(datadir)/control-center/defaults
defaults_DATA = background-properties.xml
oafdir = $(datadir)/oaf
oaf_DATA = Bonobo_Control_Capplet_background_properties.oaf
##
## You should not need to modify anything below this line
##
@INTLTOOL_DESKTOP_RULE@ @INTLTOOL_DESKTOP_RULE@
$(bin_SCRIPTS): $(top_srcdir)/capplets/common/wrapper-script.in INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) -I$(top_srcdir)/libbackground
sed -e "s#@BINDIR@#$(bindir)#" -e "s#@CAPPLET_NAME@#$(cappletname)-properties#" < $< > $@
chmod a+x $@
$(oaf_DATA): %.oaf: $(top_srcdir)/capplets/common/Bonobo_Control_Capplet_generic.oaf.in
sed -e "s#@BINDIR@#$(bindir)#" -e "s#@SHORT_CAPPLET_NAME@#$(cappletname)#" -e "s#@CAPPLET_BINARY_NAME@#$(bin_PROGRAMS)#" < $< > $@
####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
$(desktop).in: %.desktop.in: %.desktop.in.in
sed -e "s#@DESKTOP_EXEC_LINE@#$(DESKTOP_EXEC_LINE)#" -e "s#Icon=.*#Icon=$(GNOMECC_ICONS_DIR)/${cappletname}-capplet.png#" < $< > ${cappletname}.desktop.in
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup)
$(INSTALL_DATA) $(desktop) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup)$(desktop)
GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) gconftool --makefile-install-rule $(schema_DATA)
install-data-am: install-data-local
####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) $(BONOBO_CONF_DEFINE) -I$(top_srcdir)/libbackground
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
EXTRA_DIST = $(GNOMECC_CAPPLETS_EXTRA_DIST) $(defaults_DATA) $(oaf_DATA).in
iconsdir = $(GNOMECC_ICONS_DIR)
Gladedir = $(GNOMECC_GLADE_DIR)
pixmapdir = $(GNOMECC_PIXMAPS_DIR)
schemadir = $(sysconfdir)/control-center/schemas
Glade_DATA = $(cappletname)-properties.glade
icons_DATA = $(cappletname)-capplet.png
schema_DATA = background.schema
desktop = $(cappletname).desktop
all-local: $(desktop) $(oaffile)

View file

@ -41,11 +41,11 @@
static void static void
get_legacy_settings (void) get_legacy_settings (void)
{ {
int val_int; int val_int;
char *val_string; char *val_string;
gboolean val_boolean; gboolean val_boolean;
gboolean def; gboolean def;
gchar *val_filename; gchar *val_filename;
GConfClient *client; GConfClient *client;
@ -113,7 +113,7 @@ static gboolean
real_realize_cb (BGPreferences *prefs) real_realize_cb (BGPreferences *prefs)
{ {
GtkWidget *color_frame; GtkWidget *color_frame;
Applier *applier; BGApplier *bg_applier;
g_return_val_if_fail (prefs != NULL, TRUE); g_return_val_if_fail (prefs != NULL, TRUE);
g_return_val_if_fail (IS_BG_PREFERENCES (prefs), TRUE); g_return_val_if_fail (IS_BG_PREFERENCES (prefs), TRUE);
@ -121,12 +121,12 @@ real_realize_cb (BGPreferences *prefs)
if (G_OBJECT (prefs)->ref_count == 0) if (G_OBJECT (prefs)->ref_count == 0)
return FALSE; return FALSE;
applier = g_object_get_data (G_OBJECT (prefs), "applier"); bg_applier = g_object_get_data (G_OBJECT (prefs), "applier");
color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame"); color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame");
applier_apply_prefs (applier, prefs); bg_applier_apply_prefs (bg_applier, prefs);
gtk_widget_set_sensitive (color_frame, applier_render_color_p (applier, prefs)); gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (bg_applier, prefs));
return FALSE; return FALSE;
} }
@ -156,24 +156,24 @@ static void
peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, BGPreferences *prefs) peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, BGPreferences *prefs)
{ {
GConfEntry *entry; GConfEntry *entry;
Applier *applier; BGApplier *bg_applier;
GtkWidget *color_frame; GtkWidget *color_frame;
entry = gconf_entry_new (key, value); entry = gconf_entry_new (key, value);
bg_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"); bg_applier = g_object_get_data (G_OBJECT (prefs), "applier");
if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier))) if (GTK_WIDGET_REALIZED (bg_applier_get_preview_widget (bg_applier)))
applier_apply_prefs (applier, BG_PREFERENCES (prefs)); bg_applier_apply_prefs (bg_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") ||
!strcmp (key, "/desktop/gnome/background/wallpaper-type")) !strcmp (key, "/desktop/gnome/background/wallpaper-type"))
{ {
color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame"); color_frame = g_object_get_data (G_OBJECT (prefs), "color-frame");
gtk_widget_set_sensitive (color_frame, applier_render_color_p (applier, prefs)); gtk_widget_set_sensitive (color_frame, bg_applier_render_color_p (bg_applier, prefs));
} }
} }
@ -182,11 +182,11 @@ peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GCo
*/ */
static void static void
setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, Applier *applier) setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, BGApplier *bg_applier)
{ {
GObject *prefs; GObject *prefs;
GObject *peditor; GObject *peditor;
GConfClient *client; GConfClient *client;
/* Override the enabled setting to make sure background is enabled */ /* Override the enabled setting to make sure background is enabled */
client = gconf_client_get_default (); client = gconf_client_get_default ();
@ -199,7 +199,7 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, Applier *applier)
/* 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 */
g_object_set_data (prefs, "color-frame", WID ("color_frame")); g_object_set_data (prefs, "color-frame", WID ("color_frame"));
g_object_set_data (prefs, "applier", applier); g_object_set_data (prefs, "applier", bg_applier);
peditor = gconf_peditor_new_select_menu peditor = gconf_peditor_new_select_menu
(changeset, "/desktop/gnome/background/orientation", WID ("color_option")); (changeset, "/desktop/gnome/background/orientation", WID ("color_option"));
@ -228,10 +228,10 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, Applier *applier)
gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("picture_frame")); gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("picture_frame"));
/* 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 (bg_applier_get_preview_widget (bg_applier)))
applier_apply_prefs (applier, BG_PREFERENCES (prefs)); bg_applier_apply_prefs (bg_applier, BG_PREFERENCES (prefs));
else else
g_signal_connect_after (G_OBJECT (applier_get_preview_widget (applier)), "realize", g_signal_connect_after (G_OBJECT (bg_applier_get_preview_widget (bg_applier)), "realize",
(GCallback) realize_cb, prefs); (GCallback) realize_cb, prefs);
/* Make sure the preferences object gets destroyed when the dialog is /* Make sure the preferences object gets destroyed when the dialog is
@ -242,7 +242,7 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset, Applier *applier)
/* Construct the dialog */ /* Construct the dialog */
static GladeXML * static GladeXML *
create_dialog (Applier *applier) create_dialog (BGApplier *bg_applier)
{ {
GtkWidget *holder; GtkWidget *holder;
GtkWidget *widget; GtkWidget *widget;
@ -254,7 +254,7 @@ create_dialog (Applier *applier)
/* Minor GUI addition */ /* Minor GUI addition */
holder = WID ("prefs_widget"); holder = WID ("prefs_widget");
gtk_box_pack_start (GTK_BOX (holder), applier_get_preview_widget (applier), TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (holder), bg_applier_get_preview_widget (bg_applier), TRUE, TRUE, 0);
gtk_widget_show_all (holder); gtk_widget_show_all (holder);
g_object_weak_ref (G_OBJECT (widget), (GWeakNotify) g_object_unref, dialog); g_object_weak_ref (G_OBJECT (widget), (GWeakNotify) g_object_unref, dialog);
@ -280,7 +280,7 @@ main (int argc, char **argv)
GConfChangeSet *changeset; GConfChangeSet *changeset;
GladeXML *dialog; GladeXML *dialog;
GtkWidget *dialog_win; GtkWidget *dialog_win;
GObject *applier; GObject *bg_applier;
static gboolean get_legacy; static gboolean get_legacy;
static struct poptOption cap_options[] = { static struct poptOption cap_options[] = {
@ -306,13 +306,13 @@ main (int argc, char **argv)
get_legacy_settings (); get_legacy_settings ();
} else { } else {
changeset = gconf_change_set_new (); changeset = gconf_change_set_new ();
applier = applier_new (APPLIER_PREVIEW); bg_applier = bg_applier_new (BG_APPLIER_PREVIEW);
dialog = create_dialog (APPLIER (applier)); dialog = create_dialog (BG_APPLIER (bg_applier));
setup_dialog (dialog, changeset, APPLIER (applier)); setup_dialog (dialog, changeset, BG_APPLIER (bg_applier));
dialog_win = gnome_dialog_new (_("Background properties"), GTK_STOCK_APPLY, GTK_STOCK_CLOSE, NULL); dialog_win = gnome_dialog_new (_("Background properties"), GTK_STOCK_APPLY, GTK_STOCK_CLOSE, NULL);
g_signal_connect (G_OBJECT (dialog_win), "clicked", (GCallback) dialog_button_clicked_cb, changeset); g_signal_connect (G_OBJECT (dialog_win), "clicked", (GCallback) dialog_button_clicked_cb, changeset);
g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) g_object_unref, applier); g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) g_object_unref, bg_applier);
g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) gtk_main_quit, NULL); g_object_weak_ref (G_OBJECT (dialog_win), (GWeakNotify) gtk_main_quit, NULL);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog_win)->vbox), WID ("prefs_widget"), TRUE, TRUE, GNOME_PAD_SMALL);
gtk_widget_show_all (dialog_win); gtk_widget_show_all (dialog_win);

View file

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
_Name=Background _Name=Background
_Comment=Configuration of the desktop's background _Comment=Configuration of the desktop's background
Exec=background-properties-control Exec=gnome-background-properties
Icon=gnome-ccbackground.png Icon=gnome-ccbackground.png
Terminal=0 Terminal=0
Type=Application Type=Application

View file

@ -1,3 +1,9 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* Makefile.am: Update
* keyboard.desktop.in.in (Exec): Update
2001-12-19 Bradford Hovinen <hovinen@ximian.com> 2001-12-19 Bradford Hovinen <hovinen@ximian.com>
* keyboard-properties.c (apply_settings): Comment out; pending * keyboard-properties.c (apply_settings): Comment out; pending

View file

@ -1,55 +1,18 @@
cappletname = keyboard bin_PROGRAMS = gnome-keyboard-properties
cappletgroup =
bin_PROGRAMS = keyboard-properties-control
bin_SCRIPTS = keyboard-properties
keyboard_properties_control_LDADD = $(GNOMECC_CAPPLETS_LIBS) gnome_keyboard_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS)
keyboard_properties_control_SOURCES = \ gnome_keyboard_properties_SOURCES = \
keyboard-properties.c keyboard-properties.c
DESKTOP_EXEC_LINE = gnomecc --run-capplet keyboard-properties
## this is not generic
defaultsdir= $(datadir)/control-center/defaults
defaults_DATA = keyboard-properties.xml
oafdir = $(datadir)/oaf
oaf_DATA = Bonobo_Control_Capplet_keyboard_properties.oaf
##
## You should not need to modify anything below this line
##
@INTLTOOL_DESKTOP_RULE@ @INTLTOOL_DESKTOP_RULE@
$(bin_SCRIPTS): $(top_srcdir)/capplets/common/wrapper-script.in Gladedir = $(GNOMECC_GLADE_DIR)
sed -e "s#@BINDIR@#$(bindir)#" -e "s#@CAPPLET_NAME@#$(cappletname)-properties#" < $< > $@ Glade_DATA = keyboard-properties.glade
chmod a+x $@
$(oaf_DATA): %.oaf: $(top_srcdir)/capplets/common/Bonobo_Control_Capplet_generic.oaf.in iconsdir = $(GNOMECC_ICONS_DIR)
sed -e "s#@BINDIR@#$(bindir)#" -e "s#@SHORT_CAPPLET_NAME@#$(cappletname)#" -e "s#@CAPPLET_BINARY_NAME@#$(bin_PROGRAMS)#" < $< > $@ icons_DATA = keyboard-capplet.png
####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
$(desktop).in: %.desktop.in: %.desktop.in.in
sed -e "s#@DESKTOP_EXEC_LINE@#$(DESKTOP_EXEC_LINE)#" -e "s#Icon=.*#Icon=$(GNOMECC_ICONS_DIR)/${cappletname}-capplet.png#" < $< > ${cappletname}.desktop.in
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup)
$(INSTALL_DATA) $(desktop) $(DESTDIR)$(datadir)/control-center/capplets/$(cappletgroup)$(desktop)
install-data-am: install-data-local
####@###GNOMECC_CAPPLETS_DESKTOP_IN_RULE@
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
EXTRA_DIST = $(GNOMECC_CAPPLETS_EXTRA_DIST) $(defaults_DATA) $(oaf_DATA).in
iconsdir = $(GNOMECC_ICONS_DIR)
Gladedir = $(GNOMECC_GLADE_DIR)
pixmapdir = $(GNOMECC_PIXMAPS_DIR)
Glade_DATA = $(cappletname)-properties.glade
icons_DATA = $(cappletname)-capplet.png
desktop = $(cappletname).desktop
oaffile = $(oaf_DATA)
all-local: $(desktop) $(oaffile)

View file

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
_Name=Keyboard _Name=Keyboard
_Comment=Keyboard Properties _Comment=Keyboard Properties
Exec=@DESKTOP_EXEC_LINE@ Exec=gnome-keyboard-properties
Icon=gnome-cckeyboard.png Icon=gnome-cckeyboard.png
Terminal=0 Terminal=0
Type=Application Type=Application

View file

@ -1,3 +1,7 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* mouse.desktop.in.in (Exec): Update
2001-12-19 Bradford Hovinen <hovinen@ximian.com> 2001-12-19 Bradford Hovinen <hovinen@ximian.com>
* mouse-properties-capplet.c (double_click_from_gconf): Divide by * mouse-properties-capplet.c (double_click_from_gconf): Divide by

View file

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
_Name=Mouse _Name=Mouse
_Comment=Mouse Properties _Comment=Mouse Properties
Exec=@DESKTOP_EXEC_LINE@ Exec=gnome-mouse-properties
Icon=gnome-mouse.png Icon=gnome-mouse.png
Terminal=0 Terminal=0
Type=Application Type=Application

View file

@ -1,3 +1,7 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* gnome-settings-background.c: Update
2001-12-19 Bradford Hovinen <hovinen@ximian.com> 2001-12-19 Bradford Hovinen <hovinen@ximian.com>
* Makefile.am * Makefile.am

View file

@ -36,20 +36,20 @@
#include "preferences.h" #include "preferences.h"
#include "applier.h" #include "applier.h"
static Applier *applier; static BGApplier *bg_applier;
static BGPreferences *prefs; static BGPreferences *prefs;
static void static void
background_callback (GConfEntry *entry) background_callback (GConfEntry *entry)
{ {
bg_preferences_merge_entry (prefs, entry); bg_preferences_merge_entry (prefs, entry);
applier_apply_prefs (applier, prefs); bg_applier_apply_prefs (bg_applier, prefs);
} }
void void
gnome_settings_background_init (GConfEngine *engine) gnome_settings_background_init (GConfEngine *engine)
{ {
applier = APPLIER (applier_new (APPLIER_ROOT)); bg_applier = BG_APPLIER (bg_applier_new (BG_APPLIER_ROOT));
prefs = BG_PREFERENCES (bg_preferences_new ()); prefs = BG_PREFERENCES (bg_preferences_new ());
bg_preferences_load (prefs); bg_preferences_load (prefs);
@ -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, prefs); bg_applier_apply_prefs (bg_applier, prefs);
} }

View file

@ -1,5 +1,8 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com> 2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* applier.[ch]: Rename applier to bg_applier to avoid possible
namespace collision
* preferences.[ch]: Rename preferences to bg_preferences to avoid * preferences.[ch]: Rename preferences to bg_preferences to avoid
possible namespace collision possible namespace collision

View file

@ -47,7 +47,7 @@ enum {
PROP_TYPE PROP_TYPE
}; };
struct _ApplierPrivate struct _BGApplierPrivate
{ {
GtkWidget *preview_widget; /* The widget for previewing GtkWidget *preview_widget; /* The widget for previewing
* -- this is not used for * -- this is not used for
@ -63,7 +63,7 @@ struct _ApplierPrivate
* running, in which case we * running, in which case we
* block the renderer */ * block the renderer */
ApplierType type; /* Whether we render to the BGApplierType type; /* Whether we render to the
* root or the preview */ * root or the preview */
/* Where on the pixmap we should render the background image. Should /* Where on the pixmap we should render the background image. Should
@ -106,34 +106,34 @@ struct _ApplierPrivate
static GObjectClass *parent_class; static GObjectClass *parent_class;
static void applier_init (Applier *prefs, static void bg_applier_init (BGApplier *prefs,
ApplierClass *class); BGApplierClass *class);
static void applier_class_init (ApplierClass *class); static void bg_applier_class_init (BGApplierClass *class);
static void applier_base_init (ApplierClass *class); static void bg_applier_base_init (BGApplierClass *class);
static void applier_set_prop (GObject *object, static void bg_applier_set_prop (GObject *object,
guint prop_id, guint prop_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void applier_get_prop (GObject *object, static void bg_applier_get_prop (GObject *object,
guint prop_id, guint prop_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void applier_dispose (GObject *object); static void bg_applier_dispose (GObject *object);
static void applier_finalize (GObject *object); static void bg_applier_finalize (GObject *object);
static void run_render_pipeline (Applier *applier, static void run_render_pipeline (BGApplier *bg_applier,
const BGPreferences *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 (BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
static void render_wallpaper (Applier *applier, static void render_wallpaper (BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
static void render_to_screen (Applier *applier, static void render_to_screen (BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
static void create_pixmap (Applier *applier, static void create_pixmap (BGApplier *bg_applier,
const BGPreferences *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,
@ -158,11 +158,11 @@ static void fill_gradient (GdkPixbuf *pixbuf,
GdkColor *c2, GdkColor *c2,
orientation_t orientation); orientation_t orientation);
static gboolean need_wallpaper_load_p (const Applier *applier, static gboolean need_wallpaper_load_p (const BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
static gboolean need_root_pixmap_p (const Applier *applier, static gboolean need_root_pixmap_p (const BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
static gboolean wallpaper_full_cover_p (const Applier *applier, static gboolean wallpaper_full_cover_p (const BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
static gboolean render_small_pixmap_p (const BGPreferences *prefs); static gboolean render_small_pixmap_p (const BGPreferences *prefs);
@ -173,61 +173,61 @@ static void set_root_pixmap (GdkPixmap *pixmap);
static gboolean is_nautilus_running (void); static gboolean is_nautilus_running (void);
guint guint
applier_get_type (void) bg_applier_get_type (void)
{ {
static guint applier_type = 0; static guint bg_applier_type = 0;
if (!applier_type) { if (!bg_applier_type) {
static GTypeInfo applier_info = { static GTypeInfo bg_applier_info = {
sizeof (ApplierClass), sizeof (BGApplierClass),
(GBaseInitFunc) applier_base_init, (GBaseInitFunc) bg_applier_base_init,
NULL, /* GBaseFinalizeFunc */ NULL, /* GBaseFinalizeFunc */
(GClassInitFunc) applier_class_init, (GClassInitFunc) bg_applier_class_init,
NULL, /* GClassFinalizeFunc */ NULL, /* GClassFinalizeFunc */
NULL, /* user-supplied data */ NULL, /* user-supplied data */
sizeof (Applier), sizeof (BGApplier),
0, /* n_preallocs */ 0, /* n_preallocs */
(GInstanceInitFunc) applier_init, (GInstanceInitFunc) bg_applier_init,
NULL NULL
}; };
applier_type = bg_applier_type =
g_type_register_static (G_TYPE_OBJECT, g_type_register_static (G_TYPE_OBJECT,
"Applier", "BGApplier",
&applier_info, 0); &bg_applier_info, 0);
} }
return applier_type; return bg_applier_type;
} }
static void static void
applier_init (Applier *applier, ApplierClass *class) bg_applier_init (BGApplier *bg_applier, BGApplierClass *class)
{ {
applier->p = g_new0 (ApplierPrivate, 1); bg_applier->p = g_new0 (BGApplierPrivate, 1);
applier->p->last_prefs = NULL; bg_applier->p->last_prefs = NULL;
applier->p->pixbuf = NULL; bg_applier->p->pixbuf = NULL;
applier->p->wallpaper_pixbuf = NULL; bg_applier->p->wallpaper_pixbuf = NULL;
applier->p->nautilus_running = is_nautilus_running (); bg_applier->p->nautilus_running = is_nautilus_running ();
} }
static void static void
applier_class_init (ApplierClass *class) bg_applier_class_init (BGApplierClass *class)
{ {
GObjectClass *object_class; GObjectClass *object_class;
GdkVisual *visual; GdkVisual *visual;
object_class = G_OBJECT_CLASS (class); object_class = G_OBJECT_CLASS (class);
object_class->dispose = applier_dispose; object_class->dispose = bg_applier_dispose;
object_class->finalize = applier_finalize; object_class->finalize = bg_applier_finalize;
object_class->set_property = applier_set_prop; object_class->set_property = bg_applier_set_prop;
object_class->get_property = applier_get_prop; object_class->get_property = bg_applier_get_prop;
g_object_class_install_property g_object_class_install_property
(object_class, PROP_TYPE, (object_class, PROP_TYPE,
g_param_spec_int ("type", g_param_spec_int ("type",
_("Type"), _("Type"),
_("Type of applier: APPLIER_ROOT for root window or APPLIER_PREVIEW for preview"), _("Type of bg_applier: BG_APPLIER_ROOT for root window or BG_APPLIER_PREVIEW for preview"),
0, 1, 0, 0, 1, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
@ -236,43 +236,43 @@ applier_class_init (ApplierClass *class)
} }
static void static void
applier_base_init (ApplierClass *class) bg_applier_base_init (BGApplierClass *class)
{ {
} }
static void static void
applier_set_prop (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) bg_applier_set_prop (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{ {
Applier *applier; BGApplier *bg_applier;
g_return_if_fail (object != NULL); g_return_if_fail (object != NULL);
g_return_if_fail (IS_APPLIER (object)); g_return_if_fail (IS_BG_APPLIER (object));
applier = APPLIER (object); bg_applier = BG_APPLIER (object);
switch (prop_id) { switch (prop_id) {
case PROP_TYPE: case PROP_TYPE:
applier->p->type = g_value_get_int (value); bg_applier->p->type = g_value_get_int (value);
switch (applier->p->type) { switch (bg_applier->p->type) {
case APPLIER_ROOT: case BG_APPLIER_ROOT:
applier->p->render_geom.x = 0; bg_applier->p->render_geom.x = 0;
applier->p->render_geom.y = 0; bg_applier->p->render_geom.y = 0;
applier->p->render_geom.width = gdk_screen_width (); bg_applier->p->render_geom.width = gdk_screen_width ();
applier->p->render_geom.height = gdk_screen_height (); bg_applier->p->render_geom.height = gdk_screen_height ();
applier->p->pixmap = NULL; bg_applier->p->pixmap = NULL;
applier->p->pixmap_is_set = FALSE; bg_applier->p->pixmap_is_set = FALSE;
break; break;
case APPLIER_PREVIEW: case BG_APPLIER_PREVIEW:
applier->p->render_geom.x = MONITOR_CONTENTS_X; bg_applier->p->render_geom.x = MONITOR_CONTENTS_X;
applier->p->render_geom.y = MONITOR_CONTENTS_Y; bg_applier->p->render_geom.y = MONITOR_CONTENTS_Y;
applier->p->render_geom.width = MONITOR_CONTENTS_WIDTH; bg_applier->p->render_geom.width = MONITOR_CONTENTS_WIDTH;
applier->p->render_geom.height = MONITOR_CONTENTS_HEIGHT; bg_applier->p->render_geom.height = MONITOR_CONTENTS_HEIGHT;
break; break;
default: default:
g_critical ("Bad applier type: %d", applier->p->type); g_critical ("Bad bg_applier type: %d", bg_applier->p->type);
break; break;
} }
@ -285,18 +285,18 @@ applier_set_prop (GObject *object, guint prop_id, const GValue *value, GParamSpe
} }
static void static void
applier_get_prop (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) bg_applier_get_prop (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{ {
Applier *applier; BGApplier *bg_applier;
g_return_if_fail (object != NULL); g_return_if_fail (object != NULL);
g_return_if_fail (IS_APPLIER (object)); g_return_if_fail (IS_BG_APPLIER (object));
applier = APPLIER (object); bg_applier = BG_APPLIER (object);
switch (prop_id) { switch (prop_id) {
case PROP_TYPE: case PROP_TYPE:
g_value_set_int (value, applier->p->type); g_value_set_int (value, bg_applier->p->type);
break; break;
default: default:
@ -306,47 +306,47 @@ applier_get_prop (GObject *object, guint prop_id, GValue *value, GParamSpec *psp
} }
static void static void
applier_dispose (GObject *object) bg_applier_dispose (GObject *object)
{ {
Applier *applier; BGApplier *bg_applier;
g_return_if_fail (object != NULL); g_return_if_fail (object != NULL);
g_return_if_fail (IS_APPLIER (object)); g_return_if_fail (IS_BG_APPLIER (object));
applier = APPLIER (object); bg_applier = BG_APPLIER (object);
g_assert (applier->p->pixbuf == NULL); g_assert (bg_applier->p->pixbuf == NULL);
if (applier->p->last_prefs != NULL) if (bg_applier->p->last_prefs != NULL)
g_object_unref (G_OBJECT (applier->p->last_prefs)); g_object_unref (G_OBJECT (bg_applier->p->last_prefs));
if (applier->p->wallpaper_pixbuf != NULL) if (bg_applier->p->wallpaper_pixbuf != NULL)
gdk_pixbuf_unref (applier->p->wallpaper_pixbuf); gdk_pixbuf_unref (bg_applier->p->wallpaper_pixbuf);
parent_class->dispose (object); parent_class->dispose (object);
} }
static void static void
applier_finalize (GObject *object) bg_applier_finalize (GObject *object)
{ {
Applier *applier; BGApplier *bg_applier;
g_return_if_fail (object != NULL); g_return_if_fail (object != NULL);
g_return_if_fail (IS_APPLIER (object)); g_return_if_fail (IS_BG_APPLIER (object));
applier = APPLIER (object); bg_applier = BG_APPLIER (object);
g_free (applier->p); g_free (bg_applier->p);
parent_class->finalize (object); parent_class->finalize (object);
} }
GObject * GObject *
applier_new (ApplierType type) bg_applier_new (BGApplierType type)
{ {
GObject *object; GObject *object;
object = g_object_new (applier_get_type (), object = g_object_new (bg_applier_get_type (),
"type", type, "type", type,
NULL); NULL);
@ -354,66 +354,66 @@ applier_new (ApplierType type)
} }
void void
applier_apply_prefs (Applier *applier, bg_applier_apply_prefs (BGApplier *bg_applier,
const BGPreferences *prefs) const BGPreferences *prefs)
{ {
g_return_if_fail (applier != NULL); g_return_if_fail (bg_applier != NULL);
g_return_if_fail (IS_APPLIER (applier)); g_return_if_fail (IS_BG_APPLIER (bg_applier));
if (applier->p->type == APPLIER_ROOT && applier->p->nautilus_running) if (bg_applier->p->type == BG_APPLIER_ROOT && bg_applier->p->nautilus_running)
set_root_pixmap ((GdkPixmap *) -1); set_root_pixmap ((GdkPixmap *) -1);
if (!prefs->enabled) { if (!prefs->enabled) {
if (applier->p->type == APPLIER_PREVIEW) if (bg_applier->p->type == BG_APPLIER_PREVIEW)
draw_disabled_message (applier_get_preview_widget (applier)); draw_disabled_message (bg_applier_get_preview_widget (bg_applier));
return; return;
} }
if (need_wallpaper_load_p (applier, prefs)) { if (need_wallpaper_load_p (bg_applier, prefs)) {
if (applier->p->wallpaper_pixbuf != NULL) if (bg_applier->p->wallpaper_pixbuf != NULL)
gdk_pixbuf_unref (applier->p->wallpaper_pixbuf); gdk_pixbuf_unref (bg_applier->p->wallpaper_pixbuf);
applier->p->wallpaper_pixbuf = NULL; bg_applier->p->wallpaper_pixbuf = NULL;
if (prefs->wallpaper_enabled) { if (prefs->wallpaper_enabled) {
g_return_if_fail (prefs->wallpaper_filename != NULL); g_return_if_fail (prefs->wallpaper_filename != NULL);
applier->p->wallpaper_pixbuf = bg_applier->p->wallpaper_pixbuf =
gdk_pixbuf_new_from_file (prefs->wallpaper_filename, NULL); gdk_pixbuf_new_from_file (prefs->wallpaper_filename, NULL);
if (applier->p->wallpaper_pixbuf == NULL) if (bg_applier->p->wallpaper_pixbuf == NULL)
g_warning (_("Could not load pixbuf \"%s\"; disabling wallpaper."), g_warning (_("Could not load pixbuf \"%s\"; disabling wallpaper."),
prefs->wallpaper_filename); prefs->wallpaper_filename);
} }
} }
if (applier->p->type == APPLIER_ROOT) if (bg_applier->p->type == BG_APPLIER_ROOT)
nice (20); nice (20);
run_render_pipeline (applier, prefs); run_render_pipeline (bg_applier, prefs);
if (applier->p->last_prefs != NULL) if (bg_applier->p->last_prefs != NULL)
g_object_unref (G_OBJECT (applier->p->last_prefs)); g_object_unref (G_OBJECT (bg_applier->p->last_prefs));
applier->p->last_prefs = BG_PREFERENCES (bg_preferences_clone (prefs)); bg_applier->p->last_prefs = BG_PREFERENCES (bg_preferences_clone (prefs));
if (applier->p->type == APPLIER_PREVIEW && applier->p->preview_widget != NULL) if (bg_applier->p->type == BG_APPLIER_PREVIEW && bg_applier->p->preview_widget != NULL)
gtk_widget_queue_draw (applier->p->preview_widget); gtk_widget_queue_draw (bg_applier->p->preview_widget);
} }
gboolean gboolean
applier_render_color_p (const Applier *applier, const BGPreferences *prefs) bg_applier_render_color_p (const BGApplier *bg_applier, const BGPreferences *prefs)
{ {
g_return_val_if_fail (applier != NULL, FALSE); g_return_val_if_fail (bg_applier != NULL, FALSE);
g_return_val_if_fail (IS_APPLIER (applier), FALSE); g_return_val_if_fail (IS_BG_APPLIER (bg_applier), FALSE);
g_return_val_if_fail (prefs != NULL, FALSE); g_return_val_if_fail (prefs != NULL, FALSE);
g_return_val_if_fail (IS_BG_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 (bg_applier, prefs);
} }
GtkWidget * GtkWidget *
applier_get_preview_widget (Applier *applier) bg_applier_get_preview_widget (BGApplier *bg_applier)
{ {
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
GdkPixmap *pixmap; GdkPixmap *pixmap;
@ -423,14 +423,14 @@ applier_get_preview_widget (Applier *applier)
gchar *filename; gchar *filename;
GdkGC *gc; GdkGC *gc;
g_return_val_if_fail (applier != NULL, NULL); g_return_val_if_fail (bg_applier != NULL, NULL);
g_return_val_if_fail (IS_APPLIER (applier), NULL); g_return_val_if_fail (IS_BG_APPLIER (bg_applier), NULL);
if (applier->p->type != APPLIER_PREVIEW) if (bg_applier->p->type != BG_APPLIER_PREVIEW)
return NULL; return NULL;
if (applier->p->preview_widget != NULL) if (bg_applier->p->preview_widget != NULL)
return applier->p->preview_widget; return bg_applier->p->preview_widget;
filename = gnome_pixmap_file ("monitor.png"); filename = gnome_pixmap_file ("monitor.png");
visual = gdk_window_get_visual (GDK_ROOT_PARENT ()); visual = gdk_window_get_visual (GDK_ROOT_PARENT ());
@ -468,24 +468,24 @@ applier_get_preview_widget (Applier *applier)
gdk_pixbuf_get_height (pixbuf), gdk_pixbuf_get_height (pixbuf),
GDK_RGB_DITHER_MAX, 0, 0); GDK_RGB_DITHER_MAX, 0, 0);
applier->p->preview_widget = gtk_pixmap_new (pixmap, mask); bg_applier->p->preview_widget = gtk_pixmap_new (pixmap, mask);
gtk_widget_show (applier->p->preview_widget); gtk_widget_show (bg_applier->p->preview_widget);
gdk_pixbuf_unref (pixbuf); gdk_pixbuf_unref (pixbuf);
g_free (filename); g_free (filename);
gtk_widget_pop_visual (); gtk_widget_pop_visual ();
gtk_widget_pop_colormap (); gtk_widget_pop_colormap ();
return applier->p->preview_widget; return bg_applier->p->preview_widget;
} }
GdkPixbuf * GdkPixbuf *
applier_get_wallpaper_pixbuf (Applier *applier) bg_applier_get_wallpaper_pixbuf (BGApplier *bg_applier)
{ {
g_return_val_if_fail (applier != NULL, NULL); g_return_val_if_fail (bg_applier != NULL, NULL);
g_return_val_if_fail (IS_APPLIER (applier), NULL); g_return_val_if_fail (IS_BG_APPLIER (bg_applier), NULL);
return applier->p->wallpaper_pixbuf; return bg_applier->p->wallpaper_pixbuf;
} }
static void static void
@ -536,34 +536,34 @@ draw_disabled_message (GtkWidget *widget)
} }
static void static void
run_render_pipeline (Applier *applier, const BGPreferences *prefs) run_render_pipeline (BGApplier *bg_applier, const BGPreferences *prefs)
{ {
g_return_if_fail (applier != NULL); g_return_if_fail (bg_applier != NULL);
g_return_if_fail (IS_APPLIER (applier)); g_return_if_fail (IS_BG_APPLIER (bg_applier));
g_return_if_fail (prefs != NULL); g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_BG_PREFERENCES (prefs)); g_return_if_fail (IS_BG_PREFERENCES (prefs));
g_assert (applier->p->pixbuf == NULL); g_assert (bg_applier->p->pixbuf == NULL);
/* Initialize applier->p->render_geom */ /* Initialize bg_applier->p->render_geom */
applier->p->pixbuf_render_geom.x = applier->p->render_geom.x; bg_applier->p->pixbuf_render_geom.x = bg_applier->p->render_geom.x;
applier->p->pixbuf_render_geom.y = applier->p->render_geom.y; bg_applier->p->pixbuf_render_geom.y = bg_applier->p->render_geom.y;
applier->p->pixbuf_render_geom.width = applier->p->render_geom.width; bg_applier->p->pixbuf_render_geom.width = bg_applier->p->render_geom.width;
applier->p->pixbuf_render_geom.height = applier->p->render_geom.height; bg_applier->p->pixbuf_render_geom.height = bg_applier->p->render_geom.height;
applier->p->pixbuf_xlate.x = 0; bg_applier->p->pixbuf_xlate.x = 0;
applier->p->pixbuf_xlate.y = 0; bg_applier->p->pixbuf_xlate.y = 0;
render_background (applier, prefs); render_background (bg_applier, prefs);
if (need_root_pixmap_p (applier, prefs)) if (need_root_pixmap_p (bg_applier, prefs))
create_pixmap (applier, prefs); create_pixmap (bg_applier, prefs);
render_wallpaper (applier, prefs); render_wallpaper (bg_applier, prefs);
render_to_screen (applier, prefs); render_to_screen (bg_applier, prefs);
if (applier->p->pixbuf != NULL) { if (bg_applier->p->pixbuf != NULL) {
gdk_pixbuf_unref (applier->p->pixbuf); gdk_pixbuf_unref (bg_applier->p->pixbuf);
applier->p->pixbuf = NULL; bg_applier->p->pixbuf = NULL;
} }
} }
@ -571,43 +571,43 @@ run_render_pipeline (Applier *applier, const BGPreferences *prefs)
* *
* Preconditions: * Preconditions:
* 1. prefs is valid * 1. prefs is valid
* 2. The old applier->p->pixbuf, if it existed, has been destroyed * 2. The old bg_applier->p->pixbuf, if it existed, has been destroyed
* *
* Postconditions (assuming gradient is enabled): * Postconditions (assuming gradient is enabled):
* 1. applier->p->pixbuf contains a newly rendered gradient * 1. bg_applier->p->pixbuf contains a newly rendered gradient
*/ */
static void static void
render_background (Applier *applier, const BGPreferences *prefs) render_background (BGApplier *bg_applier, const BGPreferences *prefs)
{ {
g_return_if_fail (applier != NULL); g_return_if_fail (bg_applier != NULL);
g_return_if_fail (IS_APPLIER (applier)); g_return_if_fail (IS_BG_APPLIER (bg_applier));
g_return_if_fail (prefs != NULL); g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_BG_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 (bg_applier, prefs)) {
applier->p->grad_geom.x = applier->p->render_geom.width; bg_applier->p->grad_geom.x = bg_applier->p->render_geom.width;
applier->p->grad_geom.y = applier->p->render_geom.height; bg_applier->p->grad_geom.y = bg_applier->p->render_geom.height;
if (applier->p->type == APPLIER_ROOT && !prefs->wallpaper_enabled) { if (bg_applier->p->type == BG_APPLIER_ROOT && !prefs->wallpaper_enabled) {
if (prefs->orientation == ORIENTATION_HORIZ) if (prefs->orientation == ORIENTATION_HORIZ)
applier->p->grad_geom.y = 32; bg_applier->p->grad_geom.y = 32;
else else
applier->p->grad_geom.x = 32; bg_applier->p->grad_geom.x = 32;
} }
applier->p->pixbuf = bg_applier->p->pixbuf =
gdk_pixbuf_new (GDK_COLORSPACE_RGB, gdk_pixbuf_new (GDK_COLORSPACE_RGB,
FALSE, 8, FALSE, 8,
applier->p->grad_geom.x, bg_applier->p->grad_geom.x,
applier->p->grad_geom.y); bg_applier->p->grad_geom.y);
fill_gradient (applier->p->pixbuf, fill_gradient (bg_applier->p->pixbuf,
prefs->color1, prefs->color2, prefs->color1, prefs->color2,
prefs->orientation); prefs->orientation);
applier->p->pixbuf_render_geom.width = applier->p->grad_geom.x; bg_applier->p->pixbuf_render_geom.width = bg_applier->p->grad_geom.x;
applier->p->pixbuf_render_geom.height = applier->p->grad_geom.y; bg_applier->p->pixbuf_render_geom.height = bg_applier->p->grad_geom.y;
} }
} }
@ -615,21 +615,21 @@ render_background (Applier *applier, const BGPreferences *prefs)
* *
* Preconditions: * Preconditions:
* 1. The wallpaper pixbuf has been loaded and is in * 1. The wallpaper pixbuf has been loaded and is in
* applier->p->wallpaper_pixbuf. * bg_applier->p->wallpaper_pixbuf.
* 2. The structure applier->p->render_geom is filled out properly as * 2. The structure bg_applier->p->render_geom is filled out properly as
* described in the documentation above (this should be invariant). * described in the documentation above (this should be invariant).
* 3. The various fields in prefs are valid * 3. The various fields in prefs are valid
* *
* Postconditions (assuming wallpaper is enabled): * Postconditions (assuming wallpaper is enabled):
* 1. applier->p->pixbuf contains the pixbuf-in-progress with the wallpaper * 1. bg_applier->p->pixbuf contains the pixbuf-in-progress with the wallpaper
* correctly rendered. * correctly rendered.
* 2. applier->p->pixbuf_render_geom has been modified, if necessary, * 2. bg_applier->p->pixbuf_render_geom has been modified, if necessary,
* according to the requirements of the wallpaper; it should be set by * according to the requirements of the wallpaper; it should be set by
* default to be the same as applier->p->render_geom. * default to be the same as bg_applier->p->render_geom.
*/ */
static void static void
render_wallpaper (Applier *applier, const BGPreferences *prefs) render_wallpaper (BGApplier *bg_applier, const BGPreferences *prefs)
{ {
GdkRectangle src_geom; GdkRectangle src_geom;
GdkRectangle dest_geom; GdkRectangle dest_geom;
@ -639,13 +639,13 @@ render_wallpaper (Applier *applier, const BGPreferences *prefs)
gint tmp1, tmp2; gint tmp1, tmp2;
gint pwidth, pheight; gint pwidth, pheight;
g_return_if_fail (applier != NULL); g_return_if_fail (bg_applier != NULL);
g_return_if_fail (IS_APPLIER (applier)); g_return_if_fail (IS_BG_APPLIER (bg_applier));
g_return_if_fail (prefs != NULL); g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_BG_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 (bg_applier->p->wallpaper_pixbuf == NULL)
return; return;
gdk_window_get_size (GDK_ROOT_PARENT (), &tmp1, &tmp2); gdk_window_get_size (GDK_ROOT_PARENT (), &tmp1, &tmp2);
@ -653,31 +653,31 @@ render_wallpaper (Applier *applier, const BGPreferences *prefs)
virtual_geom.width = tmp1; virtual_geom.width = tmp1;
virtual_geom.height = tmp2; virtual_geom.height = tmp2;
pwidth = gdk_pixbuf_get_width (applier->p->wallpaper_pixbuf); pwidth = gdk_pixbuf_get_width (bg_applier->p->wallpaper_pixbuf);
pheight = gdk_pixbuf_get_height (applier->p->wallpaper_pixbuf); pheight = gdk_pixbuf_get_height (bg_applier->p->wallpaper_pixbuf);
get_geometry (prefs->wallpaper_type, get_geometry (prefs->wallpaper_type,
applier->p->wallpaper_pixbuf, bg_applier->p->wallpaper_pixbuf,
&(applier->p->render_geom), &(bg_applier->p->render_geom),
&virtual_geom, &dest_geom, &src_geom); &virtual_geom, &dest_geom, &src_geom);
/* Modify applier->p->pixbuf_render_geom if necessary */ /* Modify bg_applier->p->pixbuf_render_geom if necessary */
if (applier->p->pixbuf == NULL) { /* This means we didn't render a gradient */ if (bg_applier->p->pixbuf == NULL) { /* This means we didn't render a gradient */
applier->p->pixbuf_render_geom.x = dest_geom.x + applier->p->render_geom.x; bg_applier->p->pixbuf_render_geom.x = dest_geom.x + bg_applier->p->render_geom.x;
applier->p->pixbuf_render_geom.y = dest_geom.y + applier->p->render_geom.y; bg_applier->p->pixbuf_render_geom.y = dest_geom.y + bg_applier->p->render_geom.y;
applier->p->pixbuf_render_geom.width = dest_geom.width; bg_applier->p->pixbuf_render_geom.width = dest_geom.width;
applier->p->pixbuf_render_geom.height = dest_geom.height; bg_applier->p->pixbuf_render_geom.height = dest_geom.height;
} }
if (prefs->wallpaper_type == WPTYPE_TILED) { if (prefs->wallpaper_type == WPTYPE_TILED) {
if (dest_geom.width != pwidth || dest_geom.height != pheight) { if (dest_geom.width != pwidth || dest_geom.height != pheight) {
prescaled_pixbuf = gdk_pixbuf_scale_simple prescaled_pixbuf = gdk_pixbuf_scale_simple
(applier->p->wallpaper_pixbuf, (bg_applier->p->wallpaper_pixbuf,
pwidth * applier->p->render_geom.width / virtual_geom.width, pwidth * bg_applier->p->render_geom.width / virtual_geom.width,
pheight * applier->p->render_geom.height / virtual_geom.height, pheight * bg_applier->p->render_geom.height / virtual_geom.height,
GDK_INTERP_BILINEAR); GDK_INTERP_BILINEAR);
} else { } else {
prescaled_pixbuf = applier->p->wallpaper_pixbuf; prescaled_pixbuf = bg_applier->p->wallpaper_pixbuf;
gdk_pixbuf_ref (prescaled_pixbuf); gdk_pixbuf_ref (prescaled_pixbuf);
} }
} }
@ -691,19 +691,19 @@ render_wallpaper (Applier *applier, const BGPreferences *prefs)
} }
if (prefs->wallpaper_type == WPTYPE_TILED) if (prefs->wallpaper_type == WPTYPE_TILED)
applier->p->pixbuf = tile_pixbuf (applier->p->pixbuf, bg_applier->p->pixbuf = tile_pixbuf (bg_applier->p->pixbuf,
prescaled_pixbuf, prescaled_pixbuf,
&(applier->p->render_geom), &(bg_applier->p->render_geom),
alpha, prefs->color1); alpha, prefs->color1);
else else
applier->p->pixbuf = place_pixbuf (applier->p->pixbuf, bg_applier->p->pixbuf = place_pixbuf (bg_applier->p->pixbuf,
applier->p->wallpaper_pixbuf, bg_applier->p->wallpaper_pixbuf,
&dest_geom, &src_geom, &dest_geom, &src_geom,
alpha, prefs->color1); alpha, prefs->color1);
if (applier->p->pixbuf == applier->p->wallpaper_pixbuf) { if (bg_applier->p->pixbuf == bg_applier->p->wallpaper_pixbuf) {
applier->p->pixbuf_xlate.x = src_geom.x; bg_applier->p->pixbuf_xlate.x = src_geom.x;
applier->p->pixbuf_xlate.y = src_geom.y; bg_applier->p->pixbuf_xlate.y = src_geom.y;
} }
if (prescaled_pixbuf != NULL) if (prescaled_pixbuf != NULL)
@ -715,11 +715,11 @@ render_wallpaper (Applier *applier, const BGPreferences *prefs)
* *
* Preconditions: * Preconditions:
* 1. We have already rendered the gradient and wallpaper, and * 1. We have already rendered the gradient and wallpaper, and
* applier->p->pixbuf is a valid GdkPixbuf containing that rendered data. * bg_applier->p->pixbuf is a valid GdkPixbuf containing that rendered data.
* 2. The structure applier->p->pixbuf_render_geom contains the coordonites on * 2. The structure bg_applier->p->pixbuf_render_geom contains the coordonites on
* the destination visual to which we should render the contents of * the destination visual to which we should render the contents of
* applier->p->pixbuf * bg_applier->p->pixbuf
* 3. The structure applier->p->render_geom contains the total area that the * 3. The structure bg_applier->p->render_geom contains the total area that the
* background should cover (i.e. the whole desktop if we are rendering to * background should cover (i.e. the whole desktop if we are rendering to
* the root window, or the region inside the monitor if we are rendering to * the root window, or the region inside the monitor if we are rendering to
* the preview). * the preview).
@ -728,104 +728,104 @@ render_wallpaper (Applier *applier, const BGPreferences *prefs)
*/ */
static void static void
render_to_screen (Applier *applier, const BGPreferences *prefs) render_to_screen (BGApplier *bg_applier, const BGPreferences *prefs)
{ {
GdkGC *gc; GdkGC *gc;
g_return_if_fail (applier != NULL); g_return_if_fail (bg_applier != NULL);
g_return_if_fail (IS_APPLIER (applier)); g_return_if_fail (IS_BG_APPLIER (bg_applier));
g_return_if_fail (prefs != NULL); g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_BG_PREFERENCES (prefs)); g_return_if_fail (IS_BG_PREFERENCES (prefs));
gc = gdk_gc_new (GDK_ROOT_PARENT ()); gc = gdk_gc_new (GDK_ROOT_PARENT ());
if (applier->p->pixbuf != NULL) { if (bg_applier->p->pixbuf != NULL) {
if (applier->p->pixbuf_render_geom.x != 0 || if (bg_applier->p->pixbuf_render_geom.x != 0 ||
applier->p->pixbuf_render_geom.y != 0 || bg_applier->p->pixbuf_render_geom.y != 0 ||
applier->p->pixbuf_render_geom.width != applier->p->render_geom.width || bg_applier->p->pixbuf_render_geom.width != bg_applier->p->render_geom.width ||
applier->p->pixbuf_render_geom.height != applier->p->render_geom.height) bg_applier->p->pixbuf_render_geom.height != bg_applier->p->render_geom.height)
{ {
gdk_color_alloc (gdk_window_get_colormap (GDK_ROOT_PARENT ()), prefs->color1); gdk_color_alloc (gdk_window_get_colormap (GDK_ROOT_PARENT ()), prefs->color1);
gdk_gc_set_foreground (gc, prefs->color1); gdk_gc_set_foreground (gc, prefs->color1);
gdk_draw_rectangle (applier->p->pixmap, gc, TRUE, gdk_draw_rectangle (bg_applier->p->pixmap, gc, TRUE,
applier->p->render_geom.x, bg_applier->p->render_geom.x,
applier->p->render_geom.y, bg_applier->p->render_geom.y,
applier->p->render_geom.width, bg_applier->p->render_geom.width,
applier->p->render_geom.height); bg_applier->p->render_geom.height);
} }
gdk_pixbuf_render_to_drawable gdk_pixbuf_render_to_drawable
(applier->p->pixbuf, (bg_applier->p->pixbuf,
applier->p->pixmap, gc, bg_applier->p->pixmap, gc,
applier->p->pixbuf_xlate.x, bg_applier->p->pixbuf_xlate.x,
applier->p->pixbuf_xlate.y, bg_applier->p->pixbuf_xlate.y,
applier->p->pixbuf_render_geom.x, bg_applier->p->pixbuf_render_geom.x,
applier->p->pixbuf_render_geom.y, bg_applier->p->pixbuf_render_geom.y,
applier->p->pixbuf_render_geom.width, bg_applier->p->pixbuf_render_geom.width,
applier->p->pixbuf_render_geom.height, bg_applier->p->pixbuf_render_geom.height,
GDK_RGB_DITHER_MAX, 0, 0); GDK_RGB_DITHER_MAX, 0, 0);
} else { } else {
if (applier->p->type == APPLIER_ROOT) { if (bg_applier->p->type == BG_APPLIER_ROOT) {
gdk_color_alloc (gdk_window_get_colormap (GDK_ROOT_PARENT()), prefs->color1); gdk_color_alloc (gdk_window_get_colormap (GDK_ROOT_PARENT()), prefs->color1);
gdk_window_set_background (GDK_ROOT_PARENT (), prefs->color1); gdk_window_set_background (GDK_ROOT_PARENT (), prefs->color1);
gdk_window_clear (GDK_ROOT_PARENT ()); gdk_window_clear (GDK_ROOT_PARENT ());
} }
else if (applier->p->type == APPLIER_PREVIEW) { else if (bg_applier->p->type == BG_APPLIER_PREVIEW) {
gdk_color_alloc (gdk_window_get_colormap (applier->p->preview_widget->window), prefs->color1); gdk_color_alloc (gdk_window_get_colormap (bg_applier->p->preview_widget->window), prefs->color1);
gdk_gc_set_foreground (gc, prefs->color1); gdk_gc_set_foreground (gc, prefs->color1);
gdk_draw_rectangle (applier->p->pixmap, gc, TRUE, gdk_draw_rectangle (bg_applier->p->pixmap, gc, TRUE,
applier->p->render_geom.x, bg_applier->p->render_geom.x,
applier->p->render_geom.y, bg_applier->p->render_geom.y,
applier->p->render_geom.width, bg_applier->p->render_geom.width,
applier->p->render_geom.height); bg_applier->p->render_geom.height);
} }
} }
if (applier->p->type == APPLIER_ROOT && !applier->p->pixmap_is_set && if (bg_applier->p->type == BG_APPLIER_ROOT && !bg_applier->p->pixmap_is_set &&
(prefs->wallpaper_enabled || prefs->gradient_enabled)) (prefs->wallpaper_enabled || prefs->gradient_enabled))
set_root_pixmap (applier->p->pixmap); set_root_pixmap (bg_applier->p->pixmap);
else if (applier->p->type == APPLIER_ROOT && !applier->p->pixmap_is_set) else if (bg_applier->p->type == BG_APPLIER_ROOT && !bg_applier->p->pixmap_is_set)
set_root_pixmap (NULL); set_root_pixmap (NULL);
gdk_gc_destroy (gc); gdk_gc_destroy (gc);
} }
/* Create a pixmap that will replace the current root pixmap. This function has /* Create a pixmap that will replace the current root pixmap. This function has
* no effect if the applier is for the preview window * no effect if the bg_applier is for the preview window
*/ */
static void static void
create_pixmap (Applier *applier, const BGPreferences *prefs) create_pixmap (BGApplier *bg_applier, const BGPreferences *prefs)
{ {
gint width, height; gint width, height;
g_return_if_fail (applier != NULL); g_return_if_fail (bg_applier != NULL);
g_return_if_fail (IS_APPLIER (applier)); g_return_if_fail (IS_BG_APPLIER (bg_applier));
g_return_if_fail (prefs != NULL); g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_BG_PREFERENCES (prefs)); g_return_if_fail (IS_BG_PREFERENCES (prefs));
switch (applier->p->type) { switch (bg_applier->p->type) {
case APPLIER_ROOT: case BG_APPLIER_ROOT:
if (prefs->gradient_enabled && !prefs->wallpaper_enabled) { if (prefs->gradient_enabled && !prefs->wallpaper_enabled) {
width = applier->p->grad_geom.x; width = bg_applier->p->grad_geom.x;
height = applier->p->grad_geom.y; height = bg_applier->p->grad_geom.y;
} else { } else {
width = applier->p->render_geom.width; width = bg_applier->p->render_geom.width;
height = applier->p->render_geom.height; height = bg_applier->p->render_geom.height;
} }
applier->p->pixmap = make_root_pixmap (width, height); bg_applier->p->pixmap = make_root_pixmap (width, height);
applier->p->pixmap_is_set = FALSE; bg_applier->p->pixmap_is_set = FALSE;
break; break;
case APPLIER_PREVIEW: case BG_APPLIER_PREVIEW:
applier_get_preview_widget (applier); bg_applier_get_preview_widget (bg_applier);
if (!GTK_WIDGET_REALIZED (applier->p->preview_widget)) if (!GTK_WIDGET_REALIZED (bg_applier->p->preview_widget))
gtk_widget_realize (applier->p->preview_widget); gtk_widget_realize (bg_applier->p->preview_widget);
applier->p->pixmap = GTK_PIXMAP (applier->p->preview_widget)->pixmap; bg_applier->p->pixmap = GTK_PIXMAP (bg_applier->p->preview_widget)->pixmap;
applier->p->pixmap_is_set = TRUE; bg_applier->p->pixmap_is_set = TRUE;
break; break;
} }
} }
@ -1187,15 +1187,15 @@ fill_gradient (GdkPixbuf *pixbuf,
*/ */
static gboolean static gboolean
need_wallpaper_load_p (const Applier *applier, const BGPreferences *prefs) need_wallpaper_load_p (const BGApplier *bg_applier, const BGPreferences *prefs)
{ {
if (applier->p->last_prefs == NULL) if (bg_applier->p->last_prefs == NULL)
return TRUE; return TRUE;
else if (applier->p->last_prefs->wallpaper_enabled != prefs->wallpaper_enabled) else if (bg_applier->p->last_prefs->wallpaper_enabled != prefs->wallpaper_enabled)
return TRUE; return TRUE;
else if (!applier->p->last_prefs->wallpaper_enabled && !prefs->wallpaper_enabled) else if (!bg_applier->p->last_prefs->wallpaper_enabled && !prefs->wallpaper_enabled)
return FALSE; return FALSE;
else if (strcmp (applier->p->last_prefs->wallpaper_filename, prefs->wallpaper_filename)) else if (strcmp (bg_applier->p->last_prefs->wallpaper_filename, prefs->wallpaper_filename))
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@ -1204,16 +1204,16 @@ need_wallpaper_load_p (const Applier *applier, const BGPreferences *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 BGPreferences *prefs) need_root_pixmap_p (const BGApplier *bg_applier, const BGPreferences *prefs)
{ {
if (applier->p->last_prefs == NULL) if (bg_applier->p->last_prefs == NULL)
return TRUE; return TRUE;
else if (render_small_pixmap_p (applier->p->last_prefs) != render_small_pixmap_p (prefs)) else if (render_small_pixmap_p (bg_applier->p->last_prefs) != render_small_pixmap_p (prefs))
return TRUE; return TRUE;
else if (!render_small_pixmap_p (applier->p->last_prefs) && else if (!render_small_pixmap_p (bg_applier->p->last_prefs) &&
!render_small_pixmap_p (prefs)) !render_small_pixmap_p (prefs))
return FALSE; return FALSE;
else if (applier->p->last_prefs->orientation != prefs->orientation) else if (bg_applier->p->last_prefs->orientation != prefs->orientation)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@ -1225,7 +1225,7 @@ need_root_pixmap_p (const Applier *applier, const BGPreferences *prefs)
* bg_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 BGPreferences *prefs) wallpaper_full_cover_p (const BGApplier *bg_applier, const BGPreferences *prefs)
{ {
gint swidth, sheight; gint swidth, sheight;
gint pwidth, pheight; gint pwidth, pheight;
@ -1233,11 +1233,11 @@ wallpaper_full_cover_p (const Applier *applier, const BGPreferences *prefs)
/* We can't make this determination until the wallpaper is loaded, if /* We can't make this determination until the wallpaper is loaded, if
* wallpaper is enabled */ * wallpaper is enabled */
g_return_val_if_fail (!prefs->wallpaper_enabled || applier->p->wallpaper_pixbuf != NULL, TRUE); g_return_val_if_fail (!prefs->wallpaper_enabled || bg_applier->p->wallpaper_pixbuf != NULL, TRUE);
if (!prefs->wallpaper_enabled) if (!prefs->wallpaper_enabled)
return FALSE; return FALSE;
else if (gdk_pixbuf_get_has_alpha (applier->p->wallpaper_pixbuf)) else if (gdk_pixbuf_get_has_alpha (bg_applier->p->wallpaper_pixbuf))
return FALSE; return FALSE;
else if (prefs->wallpaper_type == WPTYPE_TILED) else if (prefs->wallpaper_type == WPTYPE_TILED)
return TRUE; return TRUE;
@ -1245,8 +1245,8 @@ wallpaper_full_cover_p (const Applier *applier, const BGPreferences *prefs)
return TRUE; return TRUE;
gdk_window_get_size (GDK_ROOT_PARENT (), &swidth, &sheight); gdk_window_get_size (GDK_ROOT_PARENT (), &swidth, &sheight);
pwidth = gdk_pixbuf_get_width (applier->p->wallpaper_pixbuf); pwidth = gdk_pixbuf_get_width (bg_applier->p->wallpaper_pixbuf);
pheight = gdk_pixbuf_get_height (applier->p->wallpaper_pixbuf); pheight = gdk_pixbuf_get_height (bg_applier->p->wallpaper_pixbuf);
if (prefs->wallpaper_type == WPTYPE_CENTERED) { if (prefs->wallpaper_type == WPTYPE_CENTERED) {
if (pwidth >= swidth && pheight >= sheight) if (pwidth >= swidth && pheight >= sheight)

View file

@ -32,41 +32,41 @@
#include "preferences.h" #include "preferences.h"
#define APPLIER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, applier_get_type (), Applier) #define BG_APPLIER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, bg_applier_get_type (), BGApplier)
#define APPLIER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, applier_get_type (), ApplierClass) #define BG_APPLIER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, bg_applier_get_type (), BGApplierClass)
#define IS_APPLIER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, applier_get_type ()) #define IS_BG_APPLIER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, bg_applier_get_type ())
typedef struct _Applier Applier; typedef struct _BGApplier BGApplier;
typedef struct _ApplierClass ApplierClass; typedef struct _BGApplierClass BGApplierClass;
typedef struct _ApplierPrivate ApplierPrivate; typedef struct _BGApplierPrivate BGApplierPrivate;
typedef enum _ApplierType { typedef enum _BGApplierType {
APPLIER_ROOT, APPLIER_PREVIEW BG_APPLIER_ROOT, BG_APPLIER_PREVIEW
} ApplierType; } BGApplierType;
struct _Applier struct _BGApplier
{ {
GObject object; GObject object;
ApplierPrivate *p; BGApplierPrivate *p;
}; };
struct _ApplierClass struct _BGApplierClass
{ {
GObjectClass klass; GObjectClass klass;
}; };
guint applier_get_type (void); guint bg_applier_get_type (void);
GObject *applier_new (ApplierType type); GObject *bg_applier_new (BGApplierType type);
void applier_apply_prefs (Applier *applier, void bg_applier_apply_prefs (BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
gboolean applier_render_color_p (const Applier *applier, gboolean bg_applier_render_color_p (const BGApplier *bg_applier,
const BGPreferences *prefs); const BGPreferences *prefs);
GtkWidget *applier_get_preview_widget (Applier *applier); GtkWidget *bg_applier_get_preview_widget (BGApplier *bg_applier);
GdkPixbuf *applier_get_wallpaper_pixbuf (Applier *applier); GdkPixbuf *bg_applier_get_wallpaper_pixbuf (BGApplier *bg_applier);
#endif /* __APPLIER_H */ #endif /* __APPLIER_H */