Delete this directory since it's not used any more

Fri May 16 21:55:52 2008  Søren Sandmann  <sandmann@redhat.com>

	* libbackground: Delete this directory since it's not used any
	more


svn path=/trunk/; revision=8708
This commit is contained in:
Søren Sandmann 2008-05-17 02:00:50 +00:00 committed by Søren Sandmann Pedersen
parent 97cd93b9ef
commit 8c9c2abbac
9 changed files with 7 additions and 2942 deletions

View file

@ -1,3 +1,8 @@
Fri May 16 21:55:52 2008 Søren Sandmann <sandmann@redhat.com>
* libbackground: Delete this directory since it's not used any
more
2008-04-28 Sergey Udaltsov <svu@gnome.org>
* configure.in: Dependency on iso-codes moved to libxklavier

View file

@ -1,4 +1,4 @@
SUBDIRS = po libsounds libbackground libwindow-settings libslab capplets shell help vfs-methods $(TYPING_BREAK)
SUBDIRS = po libsounds libwindow-settings libslab capplets shell help vfs-methods $(TYPING_BREAK)
ACLOCAL_AMFLAGS = -I m4

View file

@ -7,7 +7,6 @@ INCLUDES = \
-DG_LOG_DOMAIN=\"capplet-common\" \
-DINSTALL_PREFIX=\"$(prefix)\" \
-I$(top_srcdir) \
-I$(top_srcdir)/libbackground \
-I$(top_srcdir)/libwindow-settings \
$(DBUS_CFLAGS) \
$(GNOME_DESKTOP_CFLAGS) \
@ -41,7 +40,7 @@ libcommon_la_SOURCES = \
wm-common.c \
wm-common.h
libcommon_la_LIBADD = $(top_builddir)/libbackground/libbackground.la \
libcommon_la_LIBADD = \
$(top_builddir)/libwindow-settings/libgnome-window-settings.la \
$(METACITY_LIBS) \
$(DBUS_LIBS) \

View file

@ -1,535 +0,0 @@
2008-02-07 Vincent Untz <vuntz@gnome.org>
* preferences.c: (bg_preferences_load): don't pass a GError to the
gconf_client_*() calls since we don't use it anyway.
Fix bug #510421 since the crash happens because the GError wasn't
reset to NULL between two calls.
2008-02-06 Jens Granseuer <jensgr@gmx.net>
* Makefile.am: use LIBBACKGROUND_{CFLAGS,...} instead of CAPPLET_...
so we can use libbackground from gnome-settings-daemon, too
2008-01-14 Soren Sandmann <sandmann@daimi.au.dk>
* applier.[ch]: Delete these files
* Makefile.am: Remove them here.
2007-04-16 Jens Granseuer <jensgr@gmx.net>
Patch by: Erich Schubert <erich@debian.org>
* applier.c: (get_geometry): fix scaling for WPTYPE_ZOOM. Fixes
bug #342356.
2007-01-08 Rodney Dawes <dobey@novell.com>
* preferences.c (bg_preferences_merge_entry):
Set prefs->enabled not prefs->wallpaper_enabled
Patch from Jean-Christophe Jaskula
Fixes #339404
2006-08-23 Kjartan Maraas <kmaraas@gnome.org>
* preferences.c: (bg_preferences_load),
(bg_preferences_merge_entry), (read_wptype_from_string),
(read_orientation_from_string): Make read_orientation_from_string()
and read_wptype_from_string() behave like read_color_from_string()
and adjust all callers. Avoids some excess strduping too I guess.
Closes bug #352252.
2006-08-21 Rodney Dawes <dobey@novell.com>
* preferences.c (bg_preferences_load): Revert previous leak fix from
Kjartan Maraas as it seems to cause crashes in nautilus
see bug #352279
2006-08-21 Kjartan Maraas <kmaraas@gnome.org>
* preferences.c: (bg_preferences_load): Don't leak gconf strings.
2006-06-27 Sergey Udaltsov <svu@gnome.org>
* Makefile.am: redundant GNOMELOCALEDIR removed. Patch from #345178
applied.
2006-01-14 Alan Swanson <swanson@ukfsn.org>
* applier.c (get_geometry): Handle the new WPTYPE_ZOOM setting and
return proper geometry for it
* preferences.c (_bg_wptype_values[]): Add the alias for the zoom type
(read_wptype_from_string): Handle setting the type for zoom
(bg_preferences_get_wptype_as_string): Return the string for the new
zoom setting type
* preferences.h (_wallpaper_type_t): Add the new zoom type
Partial code for #105231
2005-11-07 Alexis Robert <alexis@linuxcode.eu.org>
Fixes #320647
* libbackground/preferences.c (bg_preferences_load): only use strings
returned from GConf when not NULL.
2005-10-01 Rodney Dawes <dobey@novell.com>
* preferences.c (bg_preferences_load, bg_preferences_merge_entry):
Make sure that the UTF8 filename is valid and exists before trying
to use it, otherwise fall back to using the filename encoding specified
by the user with the environment variables used by glib to determine
the locale encoding of filenames
Fixes #168604
2005-06-10 Kjartan Maraas <kmaraas@gnome.org>
* applier.c: (render_wallpaper), (is_nautilus_running): GCC4
build issues.
2005-05-08 Richard Hoelscher <rah@rahga.com>
* applier.c (refresh_render): Remove egg_pixbuf_new_from_file_at_size,
using the gtk+-2.6 function for this instead.
Fixes #169757
2005-02-10 Rodney Dawes <dobey@novell.com>
* Makefile.am: Don't define GNOME_ICONDIR as libbackground does not
use it in any of the code
2004-10-14 Jody Goldberg <jody@gnome.org>
* Release 2.8.1
2004-06-27 Rodney Dawes <dobey@novell.com>
* applier.c: Remove all references to #ifdef HAVE_GTK_MULTIHEAD
Patch from Kjartan Maraas <kmaraas@gnome.org>
Fixes #142749
2004-04-15 Jody Goldberg <jody@gnome.org>
* Release 2.6.1
2004-03-12 Chris Lahey <clahey@rigger.boston.ximian.com>
* applier.c (refresh_render): Move the image reload into a separate function.
(size_changed_cb): Handle screen resolution changes.
2004-03-11 Chris Lahey <clahey@rigger.boston.ximian.com>
* applier.c (bg_applier_apply_prefs): If the image is going to be
scaled or stretched, load it at the size it's going to be
displayed.
(need_wallpaper_load_p): If the wallpaper type changed, unless it
changed between TILED and CENTERED, we need to reload the image.
2004-04-01 Jody Goldberg <jody@gnome.org>
* Release 2.6.0.3
2004-03-30 Jody Goldberg <jody@gnome.org>
* Release 2.6.0.1
2004-03-23 Jody Goldberg <jody@gnome.org>
* Release 2.6.0
2004-03-11 Jody Goldberg <jody@gnome.org>
* Release 2.5.4
2003-12-07 Jan Arne Petersen <jpetersen@uni-bonn.de>
* Makefile.am: remove ununsed preview-file-selection.[ch] from
build.
2004-02-13 Jody Goldberg <jody@gnome.org>
* Release 2.5.3
2004-01-14 Jody Goldberg <jody@gnome.org>
* Release 2.5.2
2003-12-30 Jody Goldberg <jody@gnome.org>
* Release 2.5.1.1
2003-12-30 Jody Goldberg <jody@gnome.org>
* Release 2.5.1
2003-10-28 Jody Goldberg <jody@gnome.org>
* Release 2.5.0
2003-07-07 Jody Goldberg <jody@gnome.org>
* Release 2.3.4
2003-06-24 Jody Goldberg <jody@gnome.org>
* Release 2.3.3
Mon Jun 2 13:35:49 2003 Jonathan Blandford <jrb@redhat.com>
* preview-file-selection.c
(preview_file_selection_intelligent_scale): scaling fix. Patch
from Marcus Matèrn <marcus.matern@safecareab.com>, #113816
2003-05-07 Jody Goldberg <jody@gnome.org>
* Release 2.3.1
2003-04-07 Pasupathi Duraisamy <pasupathi.duraisamy@wipro.com>
* applier.c (set_root_pixmap): Fixes bogus GC creation.
patch from Anders Carlsson <andersca@gnu.org>
2003-02-16 Kjartan Maraas <kmaraas@gnome.org>
* applier.c: Fix a typo in a comment.
Tue Feb 4 17:09:18 2003 Jonathan Blandford <jrb@redhat.com>
* Release 2.2.0.1
Tue Jan 21 01:15:14 2003 Jonathan Blandford <jrb@gnome.org>
* Release 2.2.0
Thu Jan 16 02:41:09 2003 Jonathan Blandford <jrb@gnome.org>
* Release 2.1.7
2003-01-10 Jody Goldberg <jody@gnome.org>
* Release 2.1.6
2002-12-18 Jody Goldberg <jody@gnome.org>
* Release 2.1.5
2002-11-23 Jody Goldberg <jody@gnome.org>
* Release 2.1.3
2002-11-02 Jody Goldberg <jody@gnome.org>
* Release 2.1.2
2002-10-21 Jody Goldberg <jody@gnome.org>
* Release 2.1.1
2002-09-13 Iain <iain@prettypeople.org>
* preview-file-selection.c (preview_file_selection_update): Update the
label with the size of the image.
(preview_file_selection_add_preview): Add a label below the preview.
2002-10-01 Jody Goldberg <jody@gnome.org>
* Release 2.1.0.1
2002-08-21 Jody Goldberg <jody@gnome.org>
* Release 2.1.0
2002-07-29 jacob berkman <jacob@ximian.com>
* applier.c (set_root_pixmap):
(make_root_pixmap): fixes for building with gdk 2.0
2002-07-27 Mark McLoughlin <mark@skynet.ie>
Add support for rendering the wallpaper on
a particular physical screen.
* applier.[ch]:
(bg_applier_init): init screen and root_window.
(bg_applier_class_init), (bg_applier_set_prop),
(bg_applier_get_prop): add "screen" property.
(bg_applier_new_for_screen): implement.
(render_wallpaper), (render_to_screen),
(create_pixmap), (wallpaper_full_cover_p): use the
screen and root window information.
(make_root_pixmap): add a GdkScreen arg, actually
use the display we opened, use the correct root
window and not the default one
(set_root_pixmap): add a GdkScreen arg, use the
default display, use the correct root window.
2002-06-18 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=85224
* applier.c (render_wallpaper) : clamp to avoid underflow
2002-06-17 Jody Goldberg <jody@gnome.org>
* Release 2.0.0
2002-05-31 Damon Chaplin <damon@ximian.com>
* applier.c (bg_applier_apply_prefs): don't call set_root_pixmap() at
all if nautilus is running. It didn't do anything in this case anyway.
Removed the nice(20). A library function shouldn't do this. If
gnome-settings-daemon wants to be niced then it should do it in main()
or something like that.
(set_root_pixmap): do a final check to see if nautilus is running
before setting the pixmap.
Fixes part of #74311.
2002-05-21 jacob berkman <jacob@ximian.com>
* applier.c (render_to_screen): use a gc for the pixmap not the
root window
(bg_applier_get_preview_widget): don't create the pixmap until we
are realized
(make_root_pixmap): use gdk_get_display(), not getenv ("DISPLAY"),
and set the colormap for our GdkPixmap so we can draw on it
(preview_realized_cb): create the pixmap here, and set it on our
GtkImage
fixes #73496
2002-05-16 jacob berkman <jacob@ximian.com>
* applier.c (bg_applier_apply_prefs): don't spew a warning when
files can't be loaded (helps fix #76993)
2002-04-19 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=79149
* preferences.c (bg_preferences_clone) : fix leaks and use
gdk_color_free because some wiseguy thought GdkColours should use
memchunks.
(bg_preferences_load) : ditto.
(bg_preferences_merge_entry) : ditto.
(read_color_from_string) : ditto.
(bg_preferences_finalize) : ditto. clean out pointers to protect
against multiple calls.
2002-04-17 Rachel Hestilow <hestilow@ximian.com>
* applier.c (need_root_pixmap_p): Return TRUE if pixmap is NULL.
(create_pixmap): Only set pixmap if not already set.
2002-04-17 Anders Carlsson <andersca@gnu.org>
* preferences.c: (bg_preferences_finalize), (bg_preferences_load):
Plug leaks. Sigh.
2002-04-07 Rachel Hestilow <hestilow@ximian.com>
* applier.c (bg_applier_get_preview_widget): Connect to "realize"
on preview.
(preview_realized_cb): Added function to initialize preview pixmap.
2002-03-28 Richard Hestilow <hestilow@ximian.com>
* applier.c (bg_applier_set_prop): Only set size for preview modes.
2002-03-28 Richard Hestilow <hestilow@ximian.com>
* applier.c (MONITOR_CONTENTS_WIDTH, MONITOR_CONTENTS_HEIGHT):
Rename to _DEFAULT_WIDTH, _DEFAULT_HEIGHT.
(draw_disabled_message): Accept width and height as variables.
(bg_applier_class_init): Install props preview_width, preview_height.
(bg_applier_set_prop): Accept new size properties, only set to
default width/height on mode PREVIEW if uninitialized.
(bg_applier_new_at_size): Added.
(bg_applier_apply_prefs): Call draw_disabled_message with actual
width/height.
(bg_applier_get_preview_width): Create pixmap based on set size.
2002-03-26 Dave Camp <dave@ximian.com>
* applier.c: (bg_applier_init): Don't initialize
is_nautilus_running here (check it each time in appy_prefs).
(bg_applier_apply_prefs): Don't try to apply the background if
nautilus is running.
2002-03-19 Richard Hestilow <hestilow@ximian.com>
* preferences.h (wallpaper_type_t): Remove EMBOSSED since we
don't support it.
* preferences.c:
(_bg_wptype_values, _bg_orientation_values): Move name values
to nick, change name to "correct" form.
(read_wptype_from_string, bg_preferences_get_wptype_as_string):
Remove EMBOSSSED option.
* preview-file-selection.[ch]: Add function
preview_file_selection_intelligent_scale.
* applier.c: Change MONITOR_CONTENTS_WIDTH/HEIGHT to 64/48
(correct monitor ratio).
(bg_applier_apply_prefs): Disable wallpaper if WPTYPE_NONE.
(bg_applier_get_preview_widget): Create to WIDTH/HEIGHT.
(get_geometry): Remove reference to EMBOSSED.
2002-03-17 Darin Adler <darin@bentspoon.com>
* preferences.c: (bg_preferences_merge_entry):
Use G_GNUC_FUNCTION so we're not gcc-specific.
2002-03-15 Seth Nickell <snickell@stanford.edu>
* preferences.c: (bg_preferences_load),
(bg_preferences_merge_entry), (read_wptype_from_string),
(read_color_from_string), (bg_preferences_get_wptype_as_string):
* preferences.h:
Add an enum type for specifying that we don't know the type (i.e. the
key was not available, or set to something invalid). Currently it
was using -1, which barfs with some compilers that set enums
to be uint.
2002-03-09 Richard Hestilow <hestilow@ximian.com>
* preview-file-selection.[ch]: Added.
* Makefile.am: Compile preview-file-selection.c.
* preferences.c (bg_preferences_init): Initialize adjust_opacity
to FALSE.
2002-03-03 Alexander Larsson <alla@lysator.liu.se>
* preferences.c (bg_preferences_save):
Save wallpaper-enabled too.
2002-02-22 Richard Hestilow <hestilow@ximian.com>
* preferences.[ch]: Add function bg_preferences_save.
2002-02-17 Bradford Hovinen <hovinen@ximian.com>
* applier.c (need_root_pixmap_p): We don't need a root pixmap if
neither a wallpaper nor a gradient is enabled
(render_to_screen): Use set_back_pixmap/set_background when just
setting a color with a root applier
(need_root_pixmap_p): If the last preferences structure had
neither gradient nor wallpaper enabled, we need a new root pixmap
(need_wallpaper_load_p): We need to reload the wallpaper pixbuf if
it is enabled and not loaded
(cleanup_cb): Free bg_applier->p->pixbuf too
(bg_applier_apply_prefs): Only add the timeout for cleanup if we
are in a root renderer; we don't need it for preview
2002-02-12 Lauris Kaplinski <lauris@ximian.com>
* applier.c (draw_disabled_message): Use g_object_unref for GdkGC
(render_wallpaper): Use gdk_drawable_get_size
(render_to_screen): Use gdk_get_default_root_window
(wallpaper_full_cover_p): Ditto
* preferences.c (read_color_from_string): Use gdk_rgb_find_color
* applier.c (bg_applier_get_preview_widget): Use gnome_program_locate_file,
replace GDK_ROOT_PARENT with gdk_get_default_root_window, deprecated
gdk_window_* methods with gdk_drawable_* ones
(bg_applier_get_preview_widget): Removed gtk_widget_push_visual,
gtk_widget_pop_visual, use gtk_image instead of gtk_pixmap
2002-02-07 Richard Hestilow <hestilow@ximian.com>
* applier.c (BGApplierPrivate): Add "timeout" field.
(bg_apply_cleanup_cb): Added.
(bg_applier_apply_prefs): Add/reset timeout for cleanup function
if we load a pixbuf.
2002-02-04 Lauris Kaplinski <lauris@ximian.com>
* preferences.c (read_wptype_from_string): Do not crash on NULL
(read_orientation_from_string): Ditto
* applier.c (bg_applier_dispose): Replace deprecated methods
(draw_disabled_message): Use gtk_image instead of gtk_pixmap,
replace deprecated methods
(render_wallpaper): Replace deprecated methods
2002-01-13 Seth Nickell <snickell@stanford.edu>
reviewed by: <delete if not using a buddy>
* Makefile.am:
* applier.c: (bg_applier_apply_prefs),
(bg_applier_get_preview_widget), (draw_disabled_message),
(create_pixmap), (get_geometry):
* preferences.c: (bg_preferences_load),
(bg_preferences_merge_entry), (read_wptype_from_string),
(read_orientation_from_string):
* preferences.h:
2002-01-28 Richard Hestilow <hestilow@ximian.com>
* Makefile.am: Use libtool to create the static library, thus
allowing shlibs to link to libbackground (needed for metatheme).
2002-01-10 Bradford Hovinen <hovinen@ximian.com>
Courtesy of Jean Schurger <jschurger@schurger.org>:
* preferences.c (bg_preferences_merge_entry): Make sure the
wallpaper filename is non-NULL before doing anything with it
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
* applier.c (bg_applier_apply_prefs): Disable the wallpaper if we
couldn't load it
(bg_applier_apply_prefs): Create a clone of the preferences
structure first and work off of that
(wallpaper_full_cover_p): Return FALSE if the wallpaper pixbuf is NULL
* preferences.c (bg_preferences_merge_entry): Don't actually set
the wallpaper to "enabled" unless we can load the thing
* applier.c: Eliminate compiler warnings
* applier.[ch]: Rename applier to bg_applier to avoid possible
namespace collision
* 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
(preferences_load): Use gconf_client rather than gconf_engine
2001-12-17 Bradford Hovinen <hovinen@ximian.com>
* applier.c (set_root_pixmap): Set the pixmap_id correctly if
pixmap is NULL or -1.
* preferences.c (preferences_merge_entry): Eliminate name; use
entry->key on the warning
(preferences_merge_entry): Use correct keys
* applier.c (applier_get_preview_widget): Make sure the pixmap is
masked correctly
(applier_apply_prefs): s/gtk_object_destroy/g_object_unref/
2001-12-07 Bradford Hovinen <hovinen@ximian.com>
* preferences.c (read_color_from_string): Check if string is
non-NULL
(preferences_load): Initialize the error structure
* applier.c (applier_class_init): Initialize object_class properly
before using it; install property after {get|set}_property are set
(applier_get_preview_widget): Construct the GC before using it

View file

@ -1,12 +0,0 @@
EXTRA_DIST = ChangeLog
INCLUDES = \
-DG_LOG_DOMAIN=\"capplet-common\" \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-I$(top_srcdir)/ \
@LIBBACKGROUND_CFLAGS@
noinst_LTLIBRARIES = libbackground.la
libbackground_la_SOURCES = \
preferences.c preferences.h

File diff suppressed because it is too large Load diff

View file

@ -1,76 +0,0 @@
/* -*- mode: c; style: linux -*- */
/* applier.h
* Copyright (C) 2000 Helix Code, Inc.
*
* Written by Bradford Hovinen <hovinen@helixcode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __APPLIER_H
#define __APPLIER_H
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <X11/Xlib.h>
#include "preferences.h"
#define BG_APPLIER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, bg_applier_get_type (), BGApplier)
#define BG_APPLIER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, bg_applier_get_type (), BGApplierClass)
#define IS_BG_APPLIER(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, bg_applier_get_type ())
typedef struct _BGApplier BGApplier;
typedef struct _BGApplierClass BGApplierClass;
typedef struct _BGApplierPrivate BGApplierPrivate;
typedef enum _BGApplierType {
BG_APPLIER_ROOT, BG_APPLIER_PREVIEW
} BGApplierType;
struct _BGApplier
{
GObject object;
BGApplierPrivate *p;
};
struct _BGApplierClass
{
GObjectClass klass;
};
GType bg_applier_get_type (void);
GObject *bg_applier_new (BGApplierType type);
GObject *bg_applier_new_at_size (BGApplierType type,
const guint width,
const guint height);
GObject *bg_applier_new_for_screen (BGApplierType type,
GdkScreen *screen);
void bg_applier_apply_prefs (BGApplier *bg_applier,
const BGPreferences *prefs);
gboolean bg_applier_render_color_p (const BGApplier *bg_applier,
const BGPreferences *prefs);
GtkWidget *bg_applier_get_preview_widget (BGApplier *bg_applier);
GdkPixbuf *bg_applier_get_wallpaper_pixbuf (BGApplier *bg_applier);
#endif /* __APPLIER_H */

View file

@ -1,509 +0,0 @@
/* -*- mode: c; style: linux -*- */
/* preferences.c
* Copyright (C) 2001 Ximian, Inc.
*
* Written by Bradford Hovinen <hovinen@ximian.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gdk/gdk.h>
#include "preferences.h"
static GObjectClass *parent_class;
static void bg_preferences_init (BGPreferences *prefs,
BGPreferencesClass *class);
static void bg_preferences_class_init (BGPreferencesClass *class);
static void bg_preferences_finalize (GObject *object);
static GdkColor *read_color_from_string (const gchar *string);
static orientation_t read_orientation_from_string (const gchar *string);
static wallpaper_type_t read_wptype_from_string (const gchar *string);
static GEnumValue _bg_wptype_values[] = {
{ WPTYPE_TILED, "WPTYPE_TILED", "wallpaper"},
{ WPTYPE_CENTERED, "WPTYPE_CENTERED", "centered"},
{ WPTYPE_SCALED, "WPTYPE_SCALED", "scaled"},
{ WPTYPE_STRETCHED, "WPTYPE_STRETCHED", "stretched"},
{ WPTYPE_ZOOM, "WPTYPE_ZOOM", "zoom"},
{ WPTYPE_NONE, "WPTYPE_NONE", "none"},
{ 0, NULL, NULL }
};
static GEnumValue _bg_orientation_values[] = {
{ ORIENTATION_SOLID, "ORIENTATION_SOLID", "solid"},
{ ORIENTATION_HORIZ, "ORIENTATION_HORIZ", "horizontal-gradient"},
{ ORIENTATION_VERT, "ORIENTATION_VERT", "vertical-gradient"},
{ 0, NULL, NULL }
};
GType
bg_preferences_wptype_get_type (void)
{
static GType type = 0;
if (!type)
{
type = g_enum_register_static ("BgPreferencesWptype",
_bg_wptype_values);
}
return type;
}
GType
bg_preferences_orientation_get_type (void)
{
static GType type = 0;
if (!type)
{
type = g_enum_register_static ("BgPreferencesOrientation",
_bg_orientation_values);
}
return type;
}
GType
bg_preferences_get_type (void)
{
static GType bg_preferences_type = 0;
if (!bg_preferences_type) {
GTypeInfo bg_preferences_info = {
sizeof (BGPreferencesClass),
NULL,
NULL,
(GClassInitFunc) bg_preferences_class_init,
NULL,
NULL,
sizeof (BGPreferences),
0,
(GInstanceInitFunc) bg_preferences_init,
};
bg_preferences_type =
g_type_register_static (G_TYPE_OBJECT, "BGPreferences", &bg_preferences_info, 0);
}
return bg_preferences_type;
}
static void
bg_preferences_init (BGPreferences *prefs,
BGPreferencesClass *class)
{
prefs->frozen = FALSE;
/* Load default values */
prefs->color1 = read_color_from_string ("#39374b");
prefs->color2 = read_color_from_string ("#42528f");
prefs->enabled = TRUE;
prefs->wallpaper_enabled = FALSE;
prefs->gradient_enabled = TRUE;
prefs->orientation = ORIENTATION_VERT;
prefs->wallpaper_type = WPTYPE_TILED;
prefs->wallpaper_filename = NULL;
prefs->wallpaper_sel_path = g_strdup (g_get_home_dir ());
prefs->auto_apply = TRUE;
prefs->wallpapers = NULL;
prefs->adjust_opacity = TRUE;
prefs->opacity = 255;
}
static void
bg_preferences_class_init (BGPreferencesClass *class)
{
GObjectClass *object_class;
object_class = (GObjectClass *) class;
object_class->finalize = bg_preferences_finalize;
parent_class =
G_OBJECT_CLASS (g_type_class_ref (G_TYPE_OBJECT));
}
GObject *
bg_preferences_new (void)
{
GObject *object;
object = g_object_new (bg_preferences_get_type (), NULL);
BG_PREFERENCES (object)->enabled = TRUE;
return object;
}
GObject *
bg_preferences_clone (const BGPreferences *prefs)
{
GObject *object;
BGPreferences *new_prefs;
g_return_val_if_fail (prefs != NULL, NULL);
g_return_val_if_fail (IS_BG_PREFERENCES (prefs), NULL);
object = bg_preferences_new ();
new_prefs = BG_PREFERENCES (object);
new_prefs->enabled = prefs->enabled;
new_prefs->gradient_enabled = prefs->gradient_enabled;
new_prefs->wallpaper_enabled = prefs->wallpaper_enabled;
new_prefs->orientation = prefs->orientation;
new_prefs->wallpaper_type = prefs->wallpaper_type;
if (new_prefs->color1 != NULL)
gdk_color_free (new_prefs->color1);
new_prefs->color1 = (prefs->color1 != NULL)
? gdk_color_copy (prefs->color1) : NULL;
if (new_prefs->color2 != NULL)
gdk_color_free (new_prefs->color2);
new_prefs->color2 = (prefs->color2 != NULL)
? gdk_color_copy (prefs->color2) : NULL;
if (new_prefs->wallpaper_filename != NULL)
g_free (new_prefs->wallpaper_filename);
new_prefs->wallpaper_filename = g_strdup (prefs->wallpaper_filename);
if (new_prefs->wallpaper_sel_path != NULL)
g_free (new_prefs->wallpaper_sel_path);
new_prefs->wallpaper_sel_path = g_strdup (prefs->wallpaper_sel_path);;
new_prefs->auto_apply = prefs->auto_apply;
new_prefs->adjust_opacity = prefs->adjust_opacity;
new_prefs->opacity = prefs->opacity;
return object;
}
static void
bg_preferences_finalize (GObject *object)
{
BGPreferences *prefs;
g_return_if_fail (object != NULL);
g_return_if_fail (IS_BG_PREFERENCES (object));
prefs = BG_PREFERENCES (object);
g_free (prefs->wallpaper_filename);
prefs->wallpaper_filename = NULL;
g_free (prefs->wallpaper_sel_path);
prefs->wallpaper_sel_path = NULL;
if (prefs->color1 != NULL) {
gdk_color_free (prefs->color1);
prefs->color1 = NULL;
}
if (prefs->color2 != NULL) {
gdk_color_free (prefs->color2);
prefs->color2 = NULL;
}
parent_class->finalize (object);
}
void
bg_preferences_load (BGPreferences *prefs)
{
GConfClient *client;
char *tmp;
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_BG_PREFERENCES (prefs));
client = gconf_client_get_default ();
prefs->enabled = gconf_client_get_bool (client, BG_PREFERENCES_DRAW_BACKGROUND, NULL);
tmp = gconf_client_get_string (client, BG_PREFERENCES_PICTURE_FILENAME, NULL);
if (tmp) {
if (g_utf8_validate (tmp, -1, NULL) &&
g_file_test (tmp, G_FILE_TEST_EXISTS))
prefs->wallpaper_filename = g_strdup (tmp);
else
prefs->wallpaper_filename = g_filename_from_utf8 (tmp, -1, NULL,
NULL, NULL);
}
g_free (tmp);
if (prefs->color1 != NULL)
gdk_color_free (prefs->color1);
tmp = gconf_client_get_string (client, BG_PREFERENCES_PRIMARY_COLOR, NULL);
prefs->color1 = read_color_from_string (tmp);
g_free (tmp);
if (prefs->color2 != NULL)
gdk_color_free (prefs->color2);
tmp = gconf_client_get_string (client, BG_PREFERENCES_SECONDARY_COLOR, NULL);
prefs->color2 = read_color_from_string (tmp);
g_free (tmp);
prefs->opacity = gconf_client_get_int (client, BG_PREFERENCES_PICTURE_OPACITY, NULL);
if (prefs->opacity >= 100 || prefs->opacity < 0)
prefs->adjust_opacity = FALSE;
tmp = gconf_client_get_string (client, BG_PREFERENCES_COLOR_SHADING_TYPE, NULL);
prefs->orientation = read_orientation_from_string (tmp);
g_free (tmp);
if (prefs->orientation == ORIENTATION_SOLID)
prefs->gradient_enabled = FALSE;
else
prefs->gradient_enabled = TRUE;
tmp = gconf_client_get_string (client, BG_PREFERENCES_PICTURE_OPTIONS, NULL);
prefs->wallpaper_type = read_wptype_from_string (tmp);
g_free (tmp);
if (prefs->wallpaper_type == WPTYPE_UNSET) {
prefs->wallpaper_enabled = FALSE;
prefs->wallpaper_type = WPTYPE_CENTERED;
} else {
prefs->wallpaper_enabled = TRUE;
}
g_object_unref (client);
}
/* Parse the event name given (the event being notification of a property having
* changed and apply that change to the bg_preferences structure. Eliminates the
* need to reload the structure entirely on every event notification
*/
void
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_BG_PREFERENCES (prefs));
if (!strcmp (entry->key, BG_PREFERENCES_PICTURE_OPTIONS)) {
wallpaper_type_t wallpaper_type = read_wptype_from_string (gconf_value_get_string (value));
if (wallpaper_type == WPTYPE_UNSET) {
prefs->wallpaper_enabled = FALSE;
} else {
prefs->wallpaper_type = wallpaper_type;
prefs->wallpaper_enabled = TRUE;
}
}
else if (!strcmp (entry->key, BG_PREFERENCES_PICTURE_FILENAME)) {
const char *tmp;
tmp = gconf_value_get_string (value);
if (g_utf8_validate (tmp, -1, NULL) &&
g_file_test (tmp, G_FILE_TEST_EXISTS))
prefs->wallpaper_filename = g_strdup (tmp);
else
prefs->wallpaper_filename = g_filename_from_utf8 (tmp, -1,
NULL,
NULL,
NULL);
if (prefs->wallpaper_filename != NULL &&
strcmp (prefs->wallpaper_filename, "") != 0 &&
strcmp (prefs->wallpaper_filename, "(none)") != 0)
prefs->wallpaper_enabled = TRUE;
else
prefs->wallpaper_enabled = FALSE;
}
else if (!strcmp (entry->key, BG_PREFERENCES_PRIMARY_COLOR)) {
if (prefs->color1 != NULL)
gdk_color_free (prefs->color1);
prefs->color1 = read_color_from_string (gconf_value_get_string (value));
}
else if (!strcmp (entry->key, BG_PREFERENCES_SECONDARY_COLOR)) {
if (prefs->color2 != NULL)
gdk_color_free (prefs->color2);
prefs->color2 = read_color_from_string (gconf_value_get_string (value));
}
else if (!strcmp (entry->key, BG_PREFERENCES_PICTURE_OPACITY)) {
prefs->opacity = gconf_value_get_int (value);
if (prefs->opacity >= 100)
prefs->adjust_opacity = FALSE;
}
else if (!strcmp (entry->key, BG_PREFERENCES_COLOR_SHADING_TYPE)) {
prefs->orientation = read_orientation_from_string (gconf_value_get_string (value));
if (prefs->orientation == ORIENTATION_SOLID)
prefs->gradient_enabled = FALSE;
else
prefs->gradient_enabled = TRUE;
}
else if (!strcmp (entry->key, BG_PREFERENCES_DRAW_BACKGROUND)) {
if (gconf_value_get_bool (value) &&
(prefs->wallpaper_filename != NULL) &&
strcmp (prefs->wallpaper_filename, "") != 0 &&
strcmp (prefs->wallpaper_filename, "(none)") != 0)
prefs->enabled = TRUE;
else
prefs->enabled = FALSE;
} else {
g_warning ("%s: Unknown property: %s", G_GNUC_FUNCTION, entry->key);
}
}
static wallpaper_type_t
read_wptype_from_string (const gchar *string)
{
wallpaper_type_t type = WPTYPE_UNSET;
if (string) {
if (!strncmp (string, "wallpaper", sizeof ("wallpaper"))) {
type = WPTYPE_TILED;
} else if (!strncmp (string, "centered", sizeof ("centered"))) {
type = WPTYPE_CENTERED;
} else if (!strncmp (string, "scaled", sizeof ("scaled"))) {
type = WPTYPE_SCALED;
} else if (!strncmp (string, "stretched", sizeof ("stretched"))) {
type = WPTYPE_STRETCHED;
} else if (!strncmp (string, "zoom", sizeof ("zoom"))) {
type = WPTYPE_ZOOM;
}
}
return type;
}
static orientation_t
read_orientation_from_string (const gchar *string)
{
orientation_t type = ORIENTATION_SOLID;
if (string) {
if (!strncmp (string, "vertical-gradient", sizeof ("vertical-gradient"))) {
type = ORIENTATION_VERT;
} else if (!strncmp (string, "horizontal-gradient", sizeof ("horizontal-gradient"))) {
type = ORIENTATION_HORIZ;
}
}
return type;
}
static GdkColor *
read_color_from_string (const gchar *string)
{
GdkColor color;
/* If all else fails use black */
if (string == NULL || !gdk_color_parse (string, &color))
gdk_color_parse ("black", &color);
gdk_rgb_find_color (gdk_rgb_get_colormap (), &color);
return gdk_color_copy (&color);
}
const gchar*
bg_preferences_get_wptype_as_string (wallpaper_type_t wp)
{
switch (wp)
{
case WPTYPE_TILED:
return "wallpaper";
case WPTYPE_CENTERED:
return "centered";
case WPTYPE_SCALED:
return "scaled";
case WPTYPE_STRETCHED:
return "stretched";
case WPTYPE_ZOOM:
return "zoom";
case WPTYPE_NONE:
return "none";
case WPTYPE_UNSET:
return NULL;
}
return NULL;
}
const gchar*
bg_preferences_get_orientation_as_string (orientation_t o)
{
switch (o)
{
case ORIENTATION_SOLID:
return "solid";
case ORIENTATION_HORIZ:
return "horizontal-gradient";
case ORIENTATION_VERT:
return "vertical-gradient";
}
return NULL;
}
void
bg_preferences_save (BGPreferences *prefs)
{
GConfChangeSet *cs;
gchar *tmp;
GConfClient *client;
g_return_if_fail (prefs != NULL);
g_return_if_fail (IS_BG_PREFERENCES (prefs));
client = gconf_client_get_default();
cs = gconf_change_set_new ();
gconf_change_set_set_bool (cs, BG_PREFERENCES_DRAW_BACKGROUND, prefs->enabled);
if (prefs->wallpaper_enabled)
gconf_change_set_set_string (cs, BG_PREFERENCES_PICTURE_OPTIONS, bg_preferences_get_wptype_as_string (prefs->wallpaper_type));
else
gconf_change_set_set_string (cs, BG_PREFERENCES_PICTURE_OPTIONS, "none");
gconf_change_set_set_string (cs, BG_PREFERENCES_PICTURE_FILENAME, prefs->wallpaper_filename);
tmp = g_strdup_printf ("#%02x%02x%02x",
prefs->color1->red >> 8,
prefs->color1->green >> 8,
prefs->color1->blue >> 8);
gconf_change_set_set_string (cs, BG_PREFERENCES_PRIMARY_COLOR, tmp);
g_free (tmp);
tmp = g_strdup_printf ("#%02x%02x%02x",
prefs->color2->red >> 8,
prefs->color2->green >> 8,
prefs->color2->blue >> 8);
gconf_change_set_set_string (cs, BG_PREFERENCES_SECONDARY_COLOR, tmp);
g_free (tmp);
gconf_change_set_set_string (cs, BG_PREFERENCES_COLOR_SHADING_TYPE, bg_preferences_get_orientation_as_string (prefs->orientation));
gconf_client_commit_change_set (client, cs, TRUE, NULL);
gconf_change_set_unref (cs);
g_object_unref (client);
}

View file

@ -1,108 +0,0 @@
/* -*- mode: c; style: linux -*- */
/* preferences.h
* Copyright (C) 2000 Helix Code, Inc.
*
* Written by Bradford Hovinen <hovinen@helixcode.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __BGPREFERENCES_H
#define __BGPREFERENCES_H
#include <glib-object.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gconf/gconf-client.h>
#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 ())
#define BG_PREFERENCES_DRAW_BACKGROUND "/desktop/gnome/background/draw_background"
#define BG_PREFERENCES_PRIMARY_COLOR "/desktop/gnome/background/primary_color"
#define BG_PREFERENCES_SECONDARY_COLOR "/desktop/gnome/background/secondary_color"
#define BG_PREFERENCES_COLOR_SHADING_TYPE "/desktop/gnome/background/color_shading_type"
#define BG_PREFERENCES_PICTURE_OPTIONS "/desktop/gnome/background/picture_options"
#define BG_PREFERENCES_PICTURE_OPACITY "/desktop/gnome/background/picture_opacity"
#define BG_PREFERENCES_PICTURE_FILENAME "/desktop/gnome/background/picture_filename"
typedef struct _BGPreferences BGPreferences;
typedef struct _BGPreferencesClass BGPreferencesClass;
typedef enum _orientation_t {
ORIENTATION_SOLID = 0,
ORIENTATION_HORIZ,
ORIENTATION_VERT
} orientation_t;
typedef enum _wallpaper_type_t {
WPTYPE_TILED = 0, WPTYPE_CENTERED, WPTYPE_SCALED,
WPTYPE_STRETCHED, WPTYPE_ZOOM, WPTYPE_NONE,
WPTYPE_UNSET
} wallpaper_type_t;
struct _BGPreferences
{
GObject object;
gint frozen;
gboolean auto_apply;
guint timeout_id;
gboolean enabled;
gboolean gradient_enabled;
gboolean wallpaper_enabled;
orientation_t orientation;
wallpaper_type_t wallpaper_type;
GdkColor *color1;
GdkColor *color2;
gchar *wallpaper_filename;
gchar *wallpaper_sel_path;
GSList *wallpapers;
gboolean adjust_opacity;
gint opacity;
};
struct _BGPreferencesClass
{
GObjectClass klass;
};
GType bg_preferences_get_type (void);
GObject *bg_preferences_new (void);
GObject *bg_preferences_clone (const BGPreferences *prefs);
void bg_preferences_load (BGPreferences *prefs);
void bg_preferences_merge_entry (BGPreferences *prefs,
const GConfEntry *entry);
void bg_preferences_save (BGPreferences *prefs);
const gchar *bg_preferences_get_wptype_as_string (wallpaper_type_t wp);
const gchar *bg_preferences_get_orientation_as_string (orientation_t o);
GType bg_preferences_wptype_get_type (void);
GType bg_preferences_orientation_get_type (void);
#endif /* __PREFERENCES_H */