[cheese/gsettings] GSettings port
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/gsettings] GSettings port
- Date: Fri, 2 Jul 2010 12:51:52 +0000 (UTC)
commit be022266796757752b5b60c91a57ad9f26e2a7de
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jul 2 08:46:28 2010 -0400
GSettings port
INSTALL | 97 ++++++--
configure.ac | 7 +-
data/Makefile.am | 23 +--
data/org.gnome.Cheese.gschema.xml | 143 ++++++++++
libcheese/Makefile.am | 2 -
libcheese/cheese-fileutil.c | 15 +-
libcheese/cheese-gconf.c | 506 -----------------------------------
libcheese/cheese-gconf.h | 67 -----
libcheese/cheese-gtk.symbols | 2 +-
libcheese/cheese-widget-private.h | 2 +-
libcheese/cheese-widget.c | 33 +--
libcheese/cheese-widget.h | 1 +
src/cheese-effect-chooser.c | 121 +++------
src/cheese-effect-chooser.h | 3 +-
src/cheese-prefs-balance-scale.c | 30 +-
src/cheese-prefs-burst-spinbox.c | 34 ++--
src/cheese-prefs-burst-spinbox.h | 2 +-
src/cheese-prefs-camera-combo.c | 19 +-
src/cheese-prefs-dialog-widgets.c | 14 +-
src/cheese-prefs-dialog-widgets.h | 2 +-
src/cheese-prefs-dialog.c | 4 +-
src/cheese-prefs-dialog.h | 2 +-
src/cheese-prefs-resolution-combo.c | 6 +-
src/cheese-prefs-widget.c | 4 +-
src/cheese-prefs-widget.h | 3 +-
src/cheese-window.c | 45 ++--
src/cheese-window.h | 3 +-
27 files changed, 379 insertions(+), 811 deletions(-)
---
diff --git a/INSTALL b/INSTALL
index 2550dab..7d1c323 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,8 +4,10 @@ Installation Instructions
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007, 2008, 2009 Free Software Foundation, Inc.
- This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
Basic Installation
==================
@@ -13,7 +15,11 @@ Basic Installation
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -42,7 +48,7 @@ may remove or edit it.
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
-The simplest way to compile this package is:
+ The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
- the package.
+ the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -67,8 +83,15 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
- 6. Often, you can also type `make uninstall' to remove the installed
- files again.
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
Compilers and Options
=====================
@@ -93,7 +116,8 @@ same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
@@ -120,7 +144,8 @@ Installation Names
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
@@ -131,15 +156,46 @@ Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-Optional Features
-=================
-
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -152,6 +208,13 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
Particular systems
==================
@@ -288,7 +351,7 @@ operates.
`configure' can determine that directory automatically.
`--prefix=DIR'
- Use DIR as the installation prefix. *Note Installation Names::
+ Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
diff --git a/configure.ac b/configure.ac
index 80f283e..9e5e88d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,11 +75,10 @@ GNOME_DOC_INIT
GLIB_REQUIRED=2.16.0
GOBJECT_REQUIRED=2.12.0
-GIO_REQUIRED=2.16.0
+GIO_REQUIRED=2.25.11
GTK_REQUIRED=2.19.1
GDK_REQUIRED=2.14.0
LIBGNOMEDESKTOP_REQUIRED=2.26.0
-GCONF_REQUIRED=2.16.0
GSTREAMER_REQUIRED=0.10.23
CAIRO_REQUIRED=1.4.0
DBUS_REQUIRED=1.0
@@ -133,7 +132,6 @@ PKG_CHECK_MODULES(CHEESE, \
gtk+-2.0 >= $GTK_REQUIRED \
gdk-2.0 >= $GDK_REQUIRED \
gnome-desktop-2.0 >= $LIBGNOMEDESKTOP_REQUIRED \
- gconf-2.0 >= $GCONF_REQUIRED \
gstreamer-0.10 >= $GSTREAMER_REQUIRED \
gstreamer-plugins-base-0.10 >= $GSTREAMER_REQUIRED \
cairo >= $CAIRO_REQUIRED \
@@ -153,8 +151,7 @@ GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)
AC_SUBST(GLIB_MKENUMS)
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
-AM_GCONF_SOURCE_2
+GLIB_GSETTINGS
#*******************************************************************************
diff --git a/data/Makefile.am b/data/Makefile.am
index fd51161..b74ea30 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,15 +1,13 @@
SUBDIRS = icons effects pixmaps
+gsettings_SCHEMAS = org.gnome.Cheese.gschema.xml
+ GSETTINGS_RULES@
+
@INTLTOOL_DESKTOP_RULE@
desktopdir = $(datadir)/applications
desktop_in_files = cheese.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
- INTLTOOL_SCHEMAS_RULE@
-schemadir = $(sysconfdir)/gconf/schemas
-schema_in_files = cheese.schemas.in
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
-
gtkrcdir = $(pkgdatadir)
gtkrc_DATA = gtkrc
@@ -29,7 +27,7 @@ pkgdata_DATA = \
EXTRA_DIST = \
$(desktop_in_files) \
- $(schema_in_files) \
+ $(gsettings_SCHEMAS) \
$(service_in_files) \
$(pkgdata_DATA) \
$(gtkrc_DATA) \
@@ -38,22 +36,9 @@ EXTRA_DIST = \
bugreportdir = $(libexecdir)/cheese
bugreport_SCRIPTS = cheese-bugreport.sh
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- -GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
- $(GCONFTOOL) --makefile-install-rule $(schema_DATA)
-endif
-
-if GCONF_SCHEMAS_INSTALL
-uninstall-local:
- -GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
- $(GCONFTOOL) --makefile-uninstall-rule $(schema_DATA)
-endif
-
clean-local :
rm -f *~
DISTCLEANFILES = \
cheese.desktop \
- cheese.schemas \
org.gnome.Cheese.service
diff --git a/data/org.gnome.Cheese.gschema.xml b/data/org.gnome.Cheese.gschema.xml
new file mode 100644
index 0000000..8e23b1d
--- /dev/null
+++ b/data/org.gnome.Cheese.gschema.xml
@@ -0,0 +1,143 @@
+<schemalist>
+ <schema id='org.gnome.Cheese' path='/apps/cheese/'>
+ <key name='countdown' type='b'>
+ <summary>Use a countdown</summary>
+ <description>
+ Set to True to show countdown when taking a photo
+ </description>
+ <default>true</default>
+ </key>
+
+ <key name='camera' type='s'>
+ <summary>Camera device string indicator</summary>
+ <description>
+ The device which points to the camera (e.g. /dev/video0)
+ </description>
+ <default>''</default>
+ </key>
+
+ <key name='selected-effects' type='as'>
+ <summary>Selected Effects</summary>
+ <description>
+ A list of effects applied on startup.
+ </description>
+ <choices>
+ <choice value='mauve'/>
+ <choice value='noir_blanc'/>
+ <choice value='saturation'/>
+ <choice value='hulk'/>
+ <choice value='vertical-flip'/>
+ <choice value='horizontal-flip'/>
+ <choice value='shagadelic'/>
+ <choice value='vertigo'/>
+ <choice value='edge'/>
+ <choice value='dice'/>
+ <choice value='warp'/>
+ </choices>
+ <default>[]</default>
+ </key>
+
+ <key name='x-resolution' type='i'>
+ <summary>Width resolution</summary>
+ <description>
+ The width resolution of the image captured from the camera
+ </description>
+ <default>0</default>
+ </key>
+
+ <key name='y-resolution' type='i'>
+ <summary>Height resolution</summary>
+ <description>
+ The height resolution of the image captured from the camera
+ </description>
+ <default>0</default>
+ </key>
+
+ <key name='brightness' type='d'>
+ <summary>Picture brightness</summary>
+ <description>
+ Adjusts brightness level of the picture coming from the camera
+ </description>
+ <default>0</default>
+ </key>
+
+ <key name='contrast' type='d'>
+ <summary>Picture contrast</summary>
+ <description>
+ Adjusts contrast level of the picture coming from the camera
+ </description>
+ <default>0</default>
+ </key>
+
+ <key name='saturation' type='d'>
+ <summary>Picture saturation</summary>
+ <description>
+ Adjusts saturation level of the picture coming from the camera
+ </description>
+ <default>0</default>
+ </key>
+
+ <key name='hue' type='d'>
+ <summary>Picture hue</summary>
+ <description>
+ Adjusts hue level of the picture coming from the camera
+ </description>
+ <default>0</default>
+ </key>
+
+ <key name='video-path' type='s'>
+ <summary>Video Path</summary>
+ <description>
+ Defines the path where the videos are stored, if empty
+ "XDG_VIDEO/Webcam" will be used.
+ </description>
+ <default>''</default>
+ </key>
+
+ <key name='photo-path' type='s'>
+ <summary>Photo Path</summary>
+ <description>
+ Defines the path where the photos are stored, if empty
+ "XDG_PHOTO/Webcam" will be used.
+ </description>
+ <default>''</default>
+ </key>
+
+ <key name='enable-delete' type='b'>
+ <summary>Whether to enable immediate deletion</summary>
+ <description>
+ If set to true, then Cheese will have a feature allowing you to
+ delete a file immediately and in-place, instead of moving it to
+ the trash. This feature can be dangerous, so use caution.
+ </description>
+ <default>false</default>
+ </key>
+
+ <key name='wide-mode' type='b'>
+ <summary>Whether to start in wide mode</summary>
+ <description>
+ If set to true, Cheese will start up in a wide mode with the
+ image collection placed on the right-hand side. Useful with
+ small screens.
+ </description>
+ <default>false</default>
+ </key>
+
+ <key name='burst-delay' type='i'>
+ <summary>Time between photos in burst mode</summary>
+ <description>
+ The length of time, in milliseconds, to delay between taking
+ each photo in a burst sequence of photos.
+ </description>
+ <default>1000</default>
+ </key>
+
+ <key name='burst-repeat' type='i'>
+ <summary>Number of photos in burst mode</summary>
+ <description>
+ The number of photos to take in a single burst.
+ </description>
+ <default>4</default>
+ </key>
+ </schema>
+</schemalist>
diff --git a/libcheese/Makefile.am b/libcheese/Makefile.am
index 524f6f7..ccdb5b0 100644
--- a/libcheese/Makefile.am
+++ b/libcheese/Makefile.am
@@ -29,8 +29,6 @@ include $(top_srcdir)/Makefile.am.enums
libcheese_gtk_la_CFLAGS = $(CHEESE_CFLAGS)
libcheesecommon_la_SOURCES = \
- cheese-gconf.c \
- cheese-gconf.h \
cheese-fileutil.c \
cheese-fileutil.h \
cheese-camera.c \
diff --git a/libcheese/cheese-fileutil.c b/libcheese/cheese-fileutil.c
index 90acd26..2b44b65 100644
--- a/libcheese/cheese-fileutil.c
+++ b/libcheese/cheese-fileutil.c
@@ -28,7 +28,6 @@
#include <string.h>
#include "cheese-fileutil.h"
-#include "cheese-gconf.h"
G_DEFINE_TYPE (CheeseFileUtil, cheese_fileutil, G_TYPE_OBJECT)
@@ -197,14 +196,14 @@ cheese_fileutil_init (CheeseFileUtil *fileutil)
priv->burst_count = 0;
priv->burst_raw_name = "";
- CheeseGConf *gconf;
+ GSettings *settings;
- gconf = cheese_gconf_new ();
+ settings = g_settings_new ("org.gnome.Cheese");
- g_object_get (gconf, "gconf_prop_video_path", &priv->video_path, NULL);
- g_object_get (gconf, "gconf_prop_photo_path", &priv->photo_path, NULL);
+ g_settings_get (settings, "video-path", "s", &priv->video_path);
+ g_settings_get (settings, "photo-path", "s", &priv->photo_path);
- /* get the video path from gconf, xdg or hardcoded */
+ /* get the video path from GSettings, xdg or hardcoded */
if (!priv->video_path || strcmp (priv->video_path, "") == 0)
{
/* get xdg */
@@ -216,7 +215,7 @@ cheese_fileutil_init (CheeseFileUtil *fileutil)
}
}
- /* get the photo path from gconf, xdg or hardcoded */
+ /* get the photo path from GSettings, xdg or hardcoded */
if (!priv->photo_path || strcmp (priv->photo_path, "") == 0)
{
/* get xdg */
@@ -231,7 +230,7 @@ cheese_fileutil_init (CheeseFileUtil *fileutil)
/* FIXME: use the xdg log path */
priv->log_path = g_strjoin (G_DIR_SEPARATOR_S, g_get_home_dir (), ".gnome2", "cheese", NULL);
- g_object_unref (gconf);
+ g_object_unref (settings);
}
CheeseFileUtil *
diff --git a/libcheese/cheese-gtk.symbols b/libcheese/cheese-gtk.symbols
index bd8dcd9..d74b63a 100644
--- a/libcheese/cheese-gtk.symbols
+++ b/libcheese/cheese-gtk.symbols
@@ -1,7 +1,7 @@
cheese_widget_get_type
cheese_widget_new
cheese_widget_get_camera
-cheese_widget_get_gconf
+cheese_widget_get_settings
cheese_widget_get_video_area
cheese_widget_get_error
cheese_widget_state_get_type
diff --git a/libcheese/cheese-widget-private.h b/libcheese/cheese-widget-private.h
index 2cba699..32e8f7d 100644
--- a/libcheese/cheese-widget-private.h
+++ b/libcheese/cheese-widget-private.h
@@ -33,7 +33,7 @@ enum
};
GObject *cheese_widget_get_camera (CheeseWidget *widget);
-GObject *cheese_widget_get_gconf (CheeseWidget *widget);
+GSettings *cheese_widget_get_settings (CheeseWidget *widget);
GtkWidget *cheese_widget_get_video_area (CheeseWidget *widget);
G_END_DECLS
diff --git a/libcheese/cheese-widget.c b/libcheese/cheese-widget.c
index d61b956..1c75e89 100644
--- a/libcheese/cheese-widget.c
+++ b/libcheese/cheese-widget.c
@@ -22,7 +22,6 @@
#include <glib/gi18n.h>
#include "cheese-widget.h"
-#include "cheese-gconf.h"
#include "cheese-camera.h"
#include "cheese-enum-types.h"
@@ -51,7 +50,7 @@ typedef struct
GtkWidget *spinner;
GtkWidget *screen;
GtkWidget *problem;
- CheeseGConf *gconf;
+ GSettings *settings;
CheeseCamera *webcam;
CheeseWidgetState state;
GError *error;
@@ -219,7 +218,7 @@ cheese_widget_init (CheeseWidget *widget)
priv->problem,
gtk_label_new ("got problems"));
- priv->gconf = cheese_gconf_new ();
+ priv->settings = g_settings_new ("org.gnome.Cheese");
}
static void
@@ -227,10 +226,10 @@ cheese_widget_finalize (GObject *object)
{
CheeseWidgetPrivate *priv = CHEESE_WIDGET_GET_PRIVATE (object);
- if (priv->gconf)
+ if (priv->settings)
{
- g_object_unref (priv->gconf);
- priv->gconf = NULL;
+ g_object_unref (priv->settings);
+ priv->settings = NULL;
}
if (priv->webcam)
{
@@ -302,15 +301,13 @@ setup_camera (CheeseWidget *widget)
gdouble saturation;
gdouble hue;
- g_object_get (priv->gconf,
- "gconf_prop_x_resolution", &x_resolution,
- "gconf_prop_y_resolution", &y_resolution,
- "gconf_prop_camera", &webcam_device,
- "gconf_prop_brightness", &brightness,
- "gconf_prop_contrast", &contrast,
- "gconf_prop_saturation", &saturation,
- "gconf_prop_hue", &hue,
- NULL);
+ g_settings_get (priv->settings, "x-resolution", "i", &x_resolution);
+ g_settings_get (priv->settings, "y-resolution", "i", &y_resolution);
+ g_settings_get (priv->settings, "camera", "s", &webcam_device);
+ g_settings_get (priv->settings, "brightness", "d", &brightness);
+ g_settings_get (priv->settings, "contrast", "d", &contrast);
+ g_settings_get (priv->settings, "saturation", "d", &saturation);
+ g_settings_get (priv->settings, "hue", "d", &hue);
gdk_threads_enter ();
priv->webcam = cheese_camera_new (priv->screen,
@@ -436,8 +433,8 @@ cheese_widget_new (void)
return g_object_new (CHEESE_TYPE_WIDGET, NULL);
}
-GObject *
-cheese_widget_get_gconf (CheeseWidget *widget)
+GSettings *
+cheese_widget_get_settings (CheeseWidget *widget)
{
CheeseWidgetPrivate *priv;
@@ -445,7 +442,7 @@ cheese_widget_get_gconf (CheeseWidget *widget)
priv = CHEESE_WIDGET_GET_PRIVATE (widget);
- return G_OBJECT (priv->gconf);
+ return priv->settings;
}
GObject *
diff --git a/libcheese/cheese-widget.h b/libcheese/cheese-widget.h
index 62c2092..e0b2d21 100644
--- a/libcheese/cheese-widget.h
+++ b/libcheese/cheese-widget.h
@@ -52,6 +52,7 @@ GType cheese_widget_get_type (void) G_GNUC_CONST;
GtkWidget *cheese_widget_new (void);
void cheese_widget_get_error (CheeseWidget *widget, GError **error);
+GSettings *cheese_widget_get_settings (CheeseWidget *widget);
/**
diff --git a/src/cheese-effect-chooser.c b/src/cheese-effect-chooser.c
index 8ee7d9c..9636045 100644
--- a/src/cheese-effect-chooser.c
+++ b/src/cheese-effect-chooser.c
@@ -44,43 +44,42 @@ G_DEFINE_TYPE (CheeseEffectChooser, cheese_effect_chooser, GTK_TYPE_DRAWING_AREA
typedef struct
{
- gboolean selected[NUM_EFFECTS];
+ CheeseCameraEffect selected_effects;
} CheeseEffectChooserPrivate;
typedef struct
{
- CheeseCameraEffect effect;
- char *name;
- char *filename;
+ const char *name;
+ const char *filename;
gboolean is_black;
} GstEffect;
static const GstEffect GST_EFFECT[] = {
- {CHEESE_CAMERA_EFFECT_NO_EFFECT, N_("No Effect"),
- PACKAGE_DATADIR "/effects/identity.png", FALSE},
- {CHEESE_CAMERA_EFFECT_MAUVE, N_("Mauve"),
- PACKAGE_DATADIR "/effects/Mauve.png", FALSE},
- {CHEESE_CAMERA_EFFECT_NOIR_BLANC, N_("Noir/Blanc"),
- PACKAGE_DATADIR "/effects/NoirBlanc.png", FALSE},
- {CHEESE_CAMERA_EFFECT_SATURATION, N_("Saturation"),
- PACKAGE_DATADIR "/effects/Saturation.png", FALSE},
- {CHEESE_CAMERA_EFFECT_HULK, N_("Hulk"),
- PACKAGE_DATADIR "/effects/Hulk.png", FALSE},
- {CHEESE_CAMERA_EFFECT_VERTICAL_FLIP, N_("Vertical Flip"),
- PACKAGE_DATADIR "/effects/videoflip_v.png", FALSE},
- {CHEESE_CAMERA_EFFECT_HORIZONTAL_FLIP, N_("Horizontal Flip"),
- PACKAGE_DATADIR "/effects/videoflip_h.png", FALSE},
- {CHEESE_CAMERA_EFFECT_SHAGADELIC, N_("Shagadelic"),
- PACKAGE_DATADIR "/effects/shagadelictv.png", FALSE},
- {CHEESE_CAMERA_EFFECT_VERTIGO, N_("Vertigo"),
- PACKAGE_DATADIR "/effects/vertigotv.png", FALSE},
- {CHEESE_CAMERA_EFFECT_EDGE, N_("Edge"),
- PACKAGE_DATADIR "/effects/edgetv.png", TRUE},
- {CHEESE_CAMERA_EFFECT_DICE, N_("Dice"),
- PACKAGE_DATADIR "/effects/dicetv.png", FALSE},
- {CHEESE_CAMERA_EFFECT_WARP, N_("Warp"),
- PACKAGE_DATADIR "/effects/warptv.png", FALSE}
+ /* CHEESE_CAMERA_EFFECT_NO_EFFECT */
+ { N_("No Effect"), PACKAGE_DATADIR "/effects/identity.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_MAUVE */
+ { N_("Mauve"), PACKAGE_DATADIR "/effects/Mauve.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_NOIR_BLANC */
+ { N_("Noir/Blanc"), PACKAGE_DATADIR "/effects/NoirBlanc.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_SATURATION */
+ { N_("Saturation"), PACKAGE_DATADIR "/effects/Saturation.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_HULK */
+ { N_("Hulk"), PACKAGE_DATADIR "/effects/Hulk.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_VERTICAL_FLIP */
+ { N_("Vertical Flip"), PACKAGE_DATADIR "/effects/videoflip_v.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_HORIZONTAL_FLIP */
+ { N_("Horizontal Flip"), PACKAGE_DATADIR "/effects/videoflip_h.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_SHAGADELIC */
+ { N_("Shagadelic"), PACKAGE_DATADIR "/effects/shagadelictv.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_VERTIGO */
+ { N_("Vertigo"), PACKAGE_DATADIR "/effects/vertigotv.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_EDGE */
+ { N_("Edge"), PACKAGE_DATADIR "/effects/edgetv.png", TRUE },
+ /* CHEESE_CAMERA_EFFECT_DICE */
+ { N_("Dice"), PACKAGE_DATADIR "/effects/dicetv.png", FALSE },
+ /* CHEESE_CAMERA_EFFECT_WARP */
+ { N_("Warp"), PACKAGE_DATADIR "/effects/warptv.png", FALSE }
};
@@ -222,11 +221,18 @@ cheese_effect_chooser_expose_cb (GtkWidget *widget, GdkEventExpose *expose_event
for (i = 0; i < NUM_EFFECTS; i++)
{
+ gboolean selected;
+
+ if (i == 0)
+ selected = priv->selected_effects == 0;
+ else
+ selected = (priv->selected_effects >> (i - 1)) & 1;
+
cairo_save (cr);
cairo_translate (cr, 1.0 / BOARD_COLS * (i % BOARD_COLS),
1.0 / BOARD_ROWS * (i / BOARD_COLS));
cairo_scale (cr, 1.0 / BOARD_COLS, 1.0 / BOARD_ROWS);
- cheese_cairo_draw_card (cr, &(GST_EFFECT[i]), priv->selected[i]);
+ cheese_cairo_draw_card (cr, &(GST_EFFECT[i]), selected);
cairo_restore (cr);
}
@@ -238,7 +244,6 @@ cheese_effect_chooser_button_press_event_cb (GtkWidget *widget, GdkEventButton *
{
CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (widget);
GtkAllocation allocation;
- int i;
int col, row;
int slot;
@@ -247,13 +252,10 @@ cheese_effect_chooser_button_press_event_cb (GtkWidget *widget, GdkEventButton *
row = (int) (button_event->y / allocation.height * BOARD_ROWS);
slot = (row * BOARD_COLS + col);
- priv->selected[slot] = !priv->selected[slot];
-
- if (priv->selected[0] == TRUE)
- {
- for (i = 0; i < NUM_EFFECTS; i++)
- priv->selected[i] = FALSE;
- }
+ if (slot == 0)
+ priv->selected_effects = 0;
+ else
+ priv->selected_effects ^= 1 << (slot - 1);
gtk_widget_queue_draw (widget);
@@ -265,38 +267,7 @@ cheese_effect_chooser_get_selection (CheeseEffectChooser *effect_chooser)
{
CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
- int i;
- CheeseCameraEffect effect = 0;
-
- for (i = 0; i < NUM_EFFECTS; i++)
- {
- if (priv->selected[i])
- {
- effect |= GST_EFFECT[i].effect;
- }
- }
- return effect;
-}
-
-char *
-cheese_effect_chooser_get_selection_string (CheeseEffectChooser *effect_chooser)
-{
- CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
-
- int i;
- char *effects = NULL;
-
- for (i = 0; i < NUM_EFFECTS; i++)
- {
- if (priv->selected[i])
- {
- if (effects == NULL)
- effects = GST_EFFECT[i].name;
- else
- effects = g_strjoin (",", effects, GST_EFFECT[i].name, NULL);
- }
- }
- return effects;
+ return priv->selected_effects;
}
static void
@@ -327,23 +298,15 @@ cheese_effect_chooser_init (CheeseEffectChooser *effect_chooser)
}
GtkWidget *
-cheese_effect_chooser_new (char *selected_effects)
+cheese_effect_chooser_new (CheeseCameraEffect selected_effects)
{
CheeseEffectChooser *effect_chooser;
- int i;
effect_chooser = g_object_new (CHEESE_TYPE_EFFECT_CHOOSER, NULL);
CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (effect_chooser);
- if (selected_effects != NULL)
- {
- for (i = 1; i < NUM_EFFECTS; i++)
- {
- if (strstr (selected_effects, GST_EFFECT[i].name) != NULL)
- priv->selected[i] = TRUE;
- }
- }
+ priv->selected_effects = selected_effects;
return GTK_WIDGET (effect_chooser);
}
diff --git a/src/cheese-effect-chooser.h b/src/cheese-effect-chooser.h
index 3cbc07e..ce0155d 100644
--- a/src/cheese-effect-chooser.h
+++ b/src/cheese-effect-chooser.h
@@ -48,10 +48,9 @@ typedef struct
GType cheese_effect_chooser_get_type (void);
-GtkWidget *cheese_effect_chooser_new (char *selected_effects);
+GtkWidget *cheese_effect_chooser_new (CheeseCameraEffect selected_effects);
CheeseCameraEffect cheese_effect_chooser_get_selection (CheeseEffectChooser *effect_chooser);
-char * cheese_effect_chooser_get_selection_string (CheeseEffectChooser *effect_chooser);
void cheese_effect_chooser_unselect_all (CheeseEffectChooser *effect_chooser);
G_END_DECLS
diff --git a/src/cheese-prefs-balance-scale.c b/src/cheese-prefs-balance-scale.c
index 789d260..1b217cc 100644
--- a/src/cheese-prefs-balance-scale.c
+++ b/src/cheese-prefs-balance-scale.c
@@ -30,7 +30,7 @@ enum
{
PROP_0,
PROP_PROPERTY_NAME,
- PROP_GCONF_KEY,
+ PROP_SETTINGS_KEY,
PROP_CAMERA
};
@@ -38,7 +38,7 @@ typedef struct CheesePrefsBalanceScalePrivate
{
CheeseCamera *camera;
gchar *property_name;
- gchar *gconf_key;
+ gchar *settings_key;
gboolean has_been_synchronized; /* Make sure we don't synchronize if client
* sets camera on construction. */
} CheesePrefsBalanceScalePrivate;
@@ -55,7 +55,7 @@ cheese_prefs_balance_scale_init (CheesePrefsBalanceScale *self)
CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (self);
priv->property_name = NULL;
- priv->gconf_key = NULL;
+ priv->settings_key = NULL;
priv->has_been_synchronized = FALSE;
}
@@ -66,7 +66,7 @@ cheese_prefs_balance_scale_finalize (GObject *object)
CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (self);
g_free (priv->property_name);
- g_free (priv->gconf_key);
+ g_free (priv->settings_key);
G_OBJECT_CLASS (cheese_prefs_balance_scale_parent_class)->finalize (object);
}
@@ -79,7 +79,7 @@ cheese_prefs_balance_scale_value_changed (GtkRange *scale, CheesePrefsBalanceSca
cheese_camera_set_balance_property (priv->camera, priv->property_name, value);
- g_object_set (CHEESE_PREFS_WIDGET (self)->gconf, priv->gconf_key, value, NULL);
+ g_settings_set (CHEESE_PREFS_WIDGET (self)->settings, priv->settings_key, "d", value);
cheese_prefs_widget_notify_changed (CHEESE_PREFS_WIDGET (self));
}
@@ -113,7 +113,7 @@ cheese_prefs_balance_scale_synchronize (CheesePrefsWidget *prefs_widget)
if (can_balance)
{
- g_object_get (CHEESE_PREFS_WIDGET (self)->gconf, priv->gconf_key, &stored_value, NULL);
+ g_settings_get (CHEESE_PREFS_WIDGET (self)->settings, priv->settings_key, "d", &stored_value);
gtk_range_set_value (GTK_RANGE (scale), stored_value);
}
@@ -134,8 +134,8 @@ cheese_prefs_balance_scale_set_property (GObject *object, guint prop_id,
case PROP_PROPERTY_NAME:
priv->property_name = g_value_dup_string (value);
break;
- case PROP_GCONF_KEY:
- priv->gconf_key = g_value_dup_string (value);
+ case PROP_SETTINGS_KEY:
+ priv->settings_key = g_value_dup_string (value);
break;
case PROP_CAMERA:
priv->camera = CHEESE_CAMERA (g_value_get_object (value));
@@ -161,8 +161,8 @@ cheese_prefs_balance_scale_get_property (GObject *object, guint prop_id,
case PROP_PROPERTY_NAME:
g_value_set_string (value, priv->property_name);
break;
- case PROP_GCONF_KEY:
- g_value_set_string (value, priv->gconf_key);
+ case PROP_SETTINGS_KEY:
+ g_value_set_string (value, priv->settings_key);
break;
case PROP_CAMERA:
g_value_set_object (value, priv->camera);
@@ -195,10 +195,10 @@ cheese_prefs_balance_scale_class_init (CheesePrefsBalanceScaleClass *klass)
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
- PROP_GCONF_KEY,
- g_param_spec_string ("gconf_key",
+ PROP_SETTINGS_KEY,
+ g_param_spec_string ("settings_key",
"",
- "GConf key for balance",
+ "GSettings key for balance",
"",
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
@@ -215,7 +215,7 @@ CheesePrefsBalanceScale *
cheese_prefs_balance_scale_new (GtkWidget *scale,
CheeseCamera *camera,
const gchar *property,
- const gchar *gconf_key)
+ const gchar *settings_key)
{
CheesePrefsBalanceScale *self;
CheesePrefsBalanceScalePrivate *priv;
@@ -224,7 +224,7 @@ cheese_prefs_balance_scale_new (GtkWidget *scale,
"widget", scale,
"camera", camera,
"property_name", property,
- "gconf_key", gconf_key,
+ "settings_key", settings_key,
NULL);
priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (self);
diff --git a/src/cheese-prefs-burst-spinbox.c b/src/cheese-prefs-burst-spinbox.c
index b71ff53..7598b1f 100644
--- a/src/cheese-prefs-burst-spinbox.c
+++ b/src/cheese-prefs-burst-spinbox.c
@@ -28,12 +28,12 @@
enum
{
PROP_0,
- PROP_GCONF_KEY,
+ PROP_SETTINGS_KEY,
};
typedef struct CheesePrefsBurstSpinboxPrivate
{
- gchar *gconf_key;
+ gchar *settings_key;
} CheesePrefsBurstSpinboxPrivate;
#define CHEESE_PREFS_BURST_SPINBOX_GET_PRIVATE(o) \
@@ -47,7 +47,7 @@ cheese_prefs_burst_spinbox_init (CheesePrefsBurstSpinbox *self)
{
CheesePrefsBurstSpinboxPrivate *priv = CHEESE_PREFS_BURST_SPINBOX_GET_PRIVATE (self);
- priv->gconf_key = NULL;
+ priv->settings_key = NULL;
}
static void
@@ -56,7 +56,7 @@ cheese_prefs_burst_spinbox_finalize (GObject *object)
CheesePrefsBurstSpinbox *self = CHEESE_PREFS_BURST_SPINBOX (object);
CheesePrefsBurstSpinboxPrivate *priv = CHEESE_PREFS_BURST_SPINBOX_GET_PRIVATE (self);
- g_free (priv->gconf_key);
+ g_free (priv->settings_key);
G_OBJECT_CLASS (cheese_prefs_burst_spinbox_parent_class)->finalize (object);
}
@@ -67,7 +67,7 @@ cheese_prefs_burst_spinbox_value_changed (GtkSpinButton *spinbox, CheesePrefsBur
CheesePrefsBurstSpinboxPrivate *priv = CHEESE_PREFS_BURST_SPINBOX_GET_PRIVATE (self);
int value = 0;
- if (strcmp ("gconf_prop_burst_delay", priv->gconf_key) == 0)
+ if (strcmp ("burst-delay", priv->settings_key) == 0)
{
/* Inputted f is eg: 1.5s. Convert to millisec */
gdouble d = gtk_spin_button_get_value (spinbox);
@@ -78,7 +78,7 @@ cheese_prefs_burst_spinbox_value_changed (GtkSpinButton *spinbox, CheesePrefsBur
value = gtk_spin_button_get_value_as_int (spinbox);
}
- g_object_set (CHEESE_PREFS_WIDGET (self)->gconf, priv->gconf_key, value, NULL);
+ g_settings_set (CHEESE_PREFS_WIDGET (self)->settings, priv->settings_key, "i", value);
cheese_prefs_widget_notify_changed (CHEESE_PREFS_WIDGET (self));
}
@@ -93,9 +93,9 @@ cheese_prefs_burst_spinbox_synchronize (CheesePrefsWidget *prefs_widget)
g_object_get (prefs_widget, "widget", &spinbox, NULL);
- g_object_get (CHEESE_PREFS_WIDGET (self)->gconf, priv->gconf_key, &stored_value, NULL);
+ g_settings_get (CHEESE_PREFS_WIDGET (self)->settings, priv->settings_key, "i", &stored_value);
- if (!g_ascii_strncasecmp ("gconf_prop_burst_delay", priv->gconf_key, 22))
+ if (!strcmp ("burst-delay", priv->settings_key))
{
stored_value = (int) (stored_value / 1000.0);
}
@@ -118,8 +118,8 @@ cheese_prefs_burst_spinbox_set_property (GObject *object, guint prop_id,
switch (prop_id)
{
- case PROP_GCONF_KEY:
- priv->gconf_key = g_value_dup_string (value);
+ case PROP_SETTINGS_KEY:
+ priv->settings_key = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -137,8 +137,8 @@ cheese_prefs_burst_spinbox_get_property (GObject *object, guint prop_id,
switch (prop_id)
{
- case PROP_GCONF_KEY:
- g_value_set_string (value, priv->gconf_key);
+ case PROP_SETTINGS_KEY:
+ g_value_set_string (value, priv->settings_key);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -160,24 +160,24 @@ cheese_prefs_burst_spinbox_class_init (CheesePrefsBurstSpinboxClass *klass)
parent_class->synchronize = cheese_prefs_burst_spinbox_synchronize;
g_object_class_install_property (object_class,
- PROP_GCONF_KEY,
- g_param_spec_string ("gconf_key",
+ PROP_SETTINGS_KEY,
+ g_param_spec_string ("settings_key",
"",
- "GConf key for burst mode",
+ "GSettings key for burst mode",
"",
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
}
CheesePrefsBurstSpinbox *
cheese_prefs_burst_spinbox_new (GtkWidget *spinbox,
- const gchar *gconf_key)
+ const gchar *settings_key)
{
CheesePrefsBurstSpinbox *self;
CheesePrefsBurstSpinboxPrivate *priv;
self = g_object_new (CHEESE_TYPE_PREFS_BURST_SPINBOX,
"widget", spinbox,
- "gconf_key", gconf_key,
+ "settings_key", settings_key,
NULL);
priv = CHEESE_PREFS_BURST_SPINBOX_GET_PRIVATE (self);
diff --git a/src/cheese-prefs-burst-spinbox.h b/src/cheese-prefs-burst-spinbox.h
index 3d67ebd..e7d6c9b 100644
--- a/src/cheese-prefs-burst-spinbox.h
+++ b/src/cheese-prefs-burst-spinbox.h
@@ -51,6 +51,6 @@ struct _CheesePrefsBurstSpinbox
GType cheese_prefs_burst_spinbox_get_type (void) G_GNUC_CONST;
CheesePrefsBurstSpinbox *cheese_prefs_burst_spinbox_new (GtkWidget *scale,
- const gchar *gconf_key);
+ const gchar *settings_key);
#endif /* _CHEESE_PREFS_BURST_SPINBOX_H_ */
diff --git a/src/cheese-prefs-camera-combo.c b/src/cheese-prefs-camera-combo.c
index 6bcc826..2eed884 100644
--- a/src/cheese-prefs-camera-combo.c
+++ b/src/cheese-prefs-camera-combo.c
@@ -86,7 +86,7 @@ cheese_prefs_camera_combo_selection_changed (GtkComboBox *combo_box, CheesePrefs
/* Put it into gconf */
char *new_device = cheese_prefs_camera_combo_get_selected_camera (self);
- g_object_set (CHEESE_PREFS_WIDGET (self)->gconf, priv->camera_device_key, new_device, NULL);
+ g_settings_set (CHEESE_PREFS_WIDGET (self)->settings, priv->camera_device_key, "s", new_device);
g_free (new_device);
cheese_prefs_widget_notify_changed (CHEESE_PREFS_WIDGET (self));
@@ -102,7 +102,7 @@ cheese_prefs_camera_combo_synchronize (CheesePrefsWidget *prefs_widget)
GPtrArray *camera_devices;
int num_devices;
CheeseCameraDevice *selected_device;
- char *gconf_device_name;
+ char *settings_device_name;
char *product_name;
char *device_name;
CheeseCameraDevice *device_ptr;
@@ -125,18 +125,19 @@ cheese_prefs_camera_combo_synchronize (CheesePrefsWidget *prefs_widget)
num_devices = cheese_camera_get_num_camera_devices (priv->camera);
selected_device = cheese_camera_get_selected_device (priv->camera);
- /* If the selected device is not the same device as the one in gconf, the
- * selected device isn't available or was set by --hal-device. Set it now.
- * Not sure if this is desired behavior */
+ /* If the selected device is not the same device as the one in
+ * GSettings, the selected device isn't available or was set by
+ * --hal-device. Set it now. Not sure if this is desired behavior
+ */
if (num_devices > 0)
{
const gchar *devpath = cheese_camera_device_get_device_file (selected_device);
- g_object_get (prefs_widget->gconf, priv->camera_device_key, &gconf_device_name, NULL);
- if (!gconf_device_name || strcmp (devpath, gconf_device_name) != 0)
+ g_settings_get (prefs_widget->settings, priv->camera_device_key, "s", &settings_device_name);
+ if (!settings_device_name || strcmp (devpath, settings_device_name) != 0)
{
- g_object_set (prefs_widget->gconf, priv->camera_device_key, devpath, NULL);
+ g_settings_set (prefs_widget->settings, priv->camera_device_key, "s", devpath);
}
- g_free (gconf_device_name);
+ g_free (settings_device_name);
}
gtk_list_store_clear (priv->list_store);
diff --git a/src/cheese-prefs-dialog-widgets.c b/src/cheese-prefs-dialog-widgets.c
index 1f42c8d..e36a886 100644
--- a/src/cheese-prefs-dialog-widgets.c
+++ b/src/cheese-prefs-dialog-widgets.c
@@ -22,7 +22,7 @@
typedef struct
{
GList *widgets;
- CheeseGConf *gconf;
+ GSettings *settings;
} CheesePrefsDialogWidgetsPrivate;
#define CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE(o) \
@@ -36,8 +36,8 @@ cheese_prefs_dialog_widgets_init (CheesePrefsDialogWidgets *self)
{
CheesePrefsDialogWidgetsPrivate *priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (self);
- priv->widgets = NULL;
- priv->gconf = NULL;
+ priv->widgets = NULL;
+ priv->settings = NULL;
}
static void
@@ -71,15 +71,15 @@ cheese_prefs_dialog_widgets_class_init (CheesePrefsDialogWidgetsClass *klass)
}
CheesePrefsDialogWidgets *
-cheese_prefs_dialog_widgets_new (CheeseGConf *gconf)
+cheese_prefs_dialog_widgets_new (GSettings *settings)
{
CheesePrefsDialogWidgets *self;
CheesePrefsDialogWidgetsPrivate *priv;
self = g_object_new (CHEESE_TYPE_PREFS_DIALOG_WIDGETS, NULL);
- priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (self);
- priv->gconf = gconf;
+ priv = CHEESE_PREFS_DIALOG_WIDGETS_GET_PRIVATE (self);
+ priv->settings = settings;
return self;
}
@@ -93,7 +93,7 @@ cheese_prefs_dialog_widgets_add (CheesePrefsDialogWidgets *prefs_widgets,
if (!g_list_find (priv->widgets, widget))
{
priv->widgets = g_list_append (priv->widgets, widget);
- widget->gconf = priv->gconf;
+ widget->settings = priv->settings;
}
}
diff --git a/src/cheese-prefs-dialog-widgets.h b/src/cheese-prefs-dialog-widgets.h
index 43a745a..cec069a 100644
--- a/src/cheese-prefs-dialog-widgets.h
+++ b/src/cheese-prefs-dialog-widgets.h
@@ -51,7 +51,7 @@ struct _CheesePrefsDialogWidgets
};
GType cheese_prefs_dialog_widgets_get_type (void) G_GNUC_CONST;
-CheesePrefsDialogWidgets *cheese_prefs_dialog_widgets_new (CheeseGConf *gconf);
+CheesePrefsDialogWidgets *cheese_prefs_dialog_widgets_new (GSettings *settings);
void cheese_prefs_dialog_widgets_add (CheesePrefsDialogWidgets *prefs_widgets,
CheesePrefsWidget *widget);
diff --git a/src/cheese-prefs-dialog.c b/src/cheese-prefs-dialog.c
index 979ffc7..c15ba31 100644
--- a/src/cheese-prefs-dialog.c
+++ b/src/cheese-prefs-dialog.c
@@ -200,7 +200,7 @@ cheese_prefs_dialog_response (GtkDialog *dialog,
}
void
-cheese_prefs_dialog_run (GtkWidget *parent, CheeseGConf *gconf, CheeseCamera *camera)
+cheese_prefs_dialog_run (GtkWidget *parent, GSettings *settings, CheeseCamera *camera)
{
CheesePrefsDialog *prefs_dialog;
@@ -208,7 +208,7 @@ cheese_prefs_dialog_run (GtkWidget *parent, CheeseGConf *gconf, CheeseCamera *ca
prefs_dialog->parent = parent;
prefs_dialog->camera = camera;
- prefs_dialog->widgets = cheese_prefs_dialog_widgets_new (gconf);
+ prefs_dialog->widgets = cheese_prefs_dialog_widgets_new (settings);
cheese_prefs_dialog_create_dialog (prefs_dialog);
cheese_prefs_dialog_setup_widgets (prefs_dialog);
diff --git a/src/cheese-prefs-dialog.h b/src/cheese-prefs-dialog.h
index ed768a1..b392fc4 100644
--- a/src/cheese-prefs-dialog.h
+++ b/src/cheese-prefs-dialog.h
@@ -31,6 +31,6 @@
#include "cheese-prefs-balance-scale.h"
#include "cheese-prefs-burst-spinbox.h"
-void cheese_prefs_dialog_run (GtkWidget *parent, CheeseGConf *gconf, CheeseCamera *camera);
+void cheese_prefs_dialog_run (GtkWidget *parent, GSettings *settings, CheeseCamera *camera);
#endif /* _CHEESE_PREFS_DIALOG_H_ */
diff --git a/src/cheese-prefs-resolution-combo.c b/src/cheese-prefs-resolution-combo.c
index 545008a..78002f5 100644
--- a/src/cheese-prefs-resolution-combo.c
+++ b/src/cheese-prefs-resolution-combo.c
@@ -97,8 +97,10 @@ combo_selection_changed (GtkComboBox *combo_box,
gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store), &iter, COL_FORMAT,
&format, -1);
- g_object_set (CHEESE_PREFS_WIDGET (self)->gconf, priv->x_resolution_key,
- format->width, priv->y_resolution_key, format->height, NULL);
+ g_settings_set (CHEESE_PREFS_WIDGET (self)->settings,
+ priv->x_resolution_key, "i", format->width);
+ g_settings_set (CHEESE_PREFS_WIDGET (self)->settings,
+ priv->y_resolution_key, "i", format->height);
priv->selected_format = format;
diff --git a/src/cheese-prefs-widget.c b/src/cheese-prefs-widget.c
index 584bd80..f40e8bc 100644
--- a/src/cheese-prefs-widget.c
+++ b/src/cheese-prefs-widget.c
@@ -50,8 +50,8 @@ cheese_prefs_widget_init (CheesePrefsWidget *prefs_widget)
{
CheesePrefsWidgetPrivate *priv = CHEESE_PREFS_WIDGET_GET_PRIVATE (prefs_widget);
- prefs_widget->gconf = NULL;
- priv->widget = NULL;
+ prefs_widget->settings = NULL;
+ priv->widget = NULL;
}
static void
diff --git a/src/cheese-prefs-widget.h b/src/cheese-prefs-widget.h
index c20fa71..1bc5feb 100644
--- a/src/cheese-prefs-widget.h
+++ b/src/cheese-prefs-widget.h
@@ -22,7 +22,6 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include "cheese-gconf.h"
G_BEGIN_DECLS
@@ -54,7 +53,7 @@ struct _CheesePrefsWidget
{
GObject parent_instance;
- CheeseGConf *gconf;
+ GSettings *settings;
};
GType cheese_prefs_widget_get_type (void) G_GNUC_CONST;
diff --git a/src/cheese-window.c b/src/cheese-window.c
index 01bbb9f..cd4e928 100644
--- a/src/cheese-window.c
+++ b/src/cheese-window.c
@@ -93,7 +93,7 @@ typedef struct
CheeseCamera *camera;
CameraMode camera_mode;
- CheeseGConf *gconf;
+ GSettings *settings;
CheeseFileUtil *fileutil;
/* if you come up with a better name ping me */
@@ -438,7 +438,7 @@ cheese_window_toggle_wide_mode (GtkWidget *widget, CheeseWindow *cheese_window)
gtk_window_resize (GTK_WINDOW (cheese_window), req.width, req.height);
gtk_widget_set_size_request (priv->thewidget, -1, -1);
- g_object_set (priv->gconf, "gconf_prop_wide_mode", toggled, NULL);
+ g_settings_set (priv->settings, "wide-mode", "b", toggled);
}
static void
@@ -744,7 +744,7 @@ cheese_window_take_photo (gpointer data)
return FALSE;
}
- g_object_get (priv->gconf, "gconf_prop_countdown", &countdown, NULL);
+ g_settings_get (priv->settings, "countdown", "b", &countdown);
if (countdown)
{
if (priv->isFullscreen)
@@ -784,8 +784,8 @@ cheese_window_take_photo (gpointer data)
guint repeat_delay = 1000;
gboolean countdown = FALSE;
- g_object_get (priv->gconf, "gconf_prop_burst_delay", &repeat_delay, NULL);
- g_object_get (priv->gconf, "gconf_prop_countdown", &countdown, NULL);
+ g_settings_get (priv->settings, "burst-delay", "i", &repeat_delay);
+ g_settings_get (priv->settings, "countdown", "b", &countdown);
if (countdown && repeat_delay < 5000)
{
@@ -827,7 +827,7 @@ cheese_window_action_button_clicked_cb (GtkWidget *widget, CheeseWindow *cheese_
}
gtk_action_group_set_sensitive (priv->actions_effects, FALSE);
gtk_action_group_set_sensitive (priv->actions_toggle, FALSE);
- g_object_get (priv->gconf, "gconf_prop_burst_repeat", &priv->repeat_count, NULL); /* reset burst counter */
+ g_settings_get (priv->settings, "burst-repeat", "i", &priv->repeat_count); /* reset burst counter */
cheese_fileutil_reset_burst (priv->fileutil); /* reset filename counter */
case CAMERA_MODE_PHOTO:
cheese_window_take_photo (cheese_window);
@@ -885,9 +885,8 @@ cheese_window_effect_button_pressed_cb (GtkWidget *widget, CheeseWindow *cheese_
}
cheese_camera_set_effect (priv->camera,
cheese_effect_chooser_get_selection (CHEESE_EFFECT_CHOOSER (priv->effect_chooser)));
- g_object_set (priv->gconf, "gconf_prop_selected_effects",
- cheese_effect_chooser_get_selection_string (CHEESE_EFFECT_CHOOSER (priv->effect_chooser)),
- NULL);
+ g_settings_set_flags (priv->settings, "selected-effects",
+ cheese_effect_chooser_get_selection (CHEESE_EFFECT_CHOOSER (priv->effect_chooser)));
}
else
{
@@ -904,7 +903,7 @@ void
cheese_window_preferences_cb (GtkAction *action, CheeseWindow *cheese_window)
{
CheeseWindowPrivate *priv = CHEESE_WINDOW_GET_PRIVATE (cheese_window);
- cheese_prefs_dialog_run (GTK_WIDGET (cheese_window), priv->gconf,
+ cheese_prefs_dialog_run (GTK_WIDGET (cheese_window), priv->settings,
priv->camera);
}
@@ -914,7 +913,7 @@ cheese_window_toggle_countdown (GtkWidget *widget, CheeseWindow *window)
CheeseWindowPrivate *priv = CHEESE_WINDOW_GET_PRIVATE (window);
gboolean countdown = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget));
- g_object_set (priv->gconf, "gconf_prop_countdown", countdown, NULL);
+ g_settings_set (priv->settings, "countdown", "b", countdown);
}
static void
@@ -1161,7 +1160,7 @@ setup_menubar_and_actions (CheeseWindow *cheese_window)
GtkAction *action = gtk_ui_manager_get_action (priv->ui_manager, "/MainMenu/Cheese/CountdownToggle");
gboolean countdown;
- g_object_get (priv->gconf, "gconf_prop_countdown", &countdown, NULL);
+ g_settings_get (priv->settings, "countdown", "b", &countdown);
if (countdown)
{
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
@@ -1169,7 +1168,7 @@ setup_menubar_and_actions (CheeseWindow *cheese_window)
action = gtk_ui_manager_get_action (priv->ui_manager, "/ThumbnailPopup/Delete");
gboolean enable_delete;
- g_object_get (priv->gconf, "gconf_prop_enable_delete", &enable_delete, NULL);
+ g_settings_get (priv->settings, "enable-delete", "b", &enable_delete);
gtk_action_set_visible (GTK_ACTION (action), enable_delete);
@@ -1283,7 +1282,7 @@ cheese_window_init (CheeseWindow *cheese_window)
priv->fullscreen_timeout_source = NULL;
priv->thewidget = cheese_widget_new ();
- priv->gconf = CHEESE_GCONF (cheese_widget_get_gconf (CHEESE_WIDGET (priv->thewidget)));
+ priv->settings = cheese_widget_get_settings (CHEESE_WIDGET (priv->thewidget));
priv->video_area = cheese_widget_get_video_area (CHEESE_WIDGET (priv->thewidget));
setup_widgets_from_builder (cheese_window);
@@ -1330,12 +1329,11 @@ cheese_window_init (CheeseWindow *cheese_window)
/* show the scroll window to get it included in the size requisition done later */
gtk_widget_show_all (priv->thumb_scrollwindow);
- char *gconf_effects;
- g_object_get (priv->gconf, "gconf_prop_selected_effects", &gconf_effects, NULL);
- priv->effect_chooser = cheese_effect_chooser_new (gconf_effects);
+ CheeseCameraEffect settings_effects;
+ settings_effects = g_settings_get_flags (priv->settings, "selected-effects");
+ priv->effect_chooser = cheese_effect_chooser_new (settings_effects);
gtk_container_add (GTK_CONTAINER (priv->effect_frame), priv->effect_chooser);
gtk_widget_show_all (priv->effect_vbox);
- g_free (gconf_effects);
priv->countdown = cheese_countdown_new ();
gtk_container_add (GTK_CONTAINER (priv->countdown_frame), priv->countdown);
@@ -1377,10 +1375,7 @@ cheese_window_constructed (GObject *object)
g_object_set (G_OBJECT (priv->flash), "parent", GTK_WIDGET (window), NULL);
- g_object_get (priv->gconf,
- "gconf_prop_wide_mode",
- &startup_wide_saved,
- NULL);
+ g_settings_get (priv->settings, "wide-mode", "b", &startup_wide_saved);
/* TODO: understand why this is needed for sizing trick below to work */
/* or at least make sure it doesn't cause any harm */
@@ -1518,11 +1513,11 @@ cheese_window_get_camera (CheeseWindow *window)
return priv->camera;
}
-CheeseGConf *
-cheese_window_get_gconf (CheeseWindow *window)
+GSettings *
+cheese_window_get_settings (CheeseWindow *window)
{
CheeseWindowPrivate *priv = CHEESE_WINDOW_GET_PRIVATE (window);
- return priv->gconf;
+ return priv->settings;
}
CheeseFileUtil *
diff --git a/src/cheese-window.h b/src/cheese-window.h
index a18834d..240f328 100644
--- a/src/cheese-window.h
+++ b/src/cheese-window.h
@@ -23,7 +23,6 @@
#include <gtk/gtk.h>
#include "cheese-camera.h"
-#include "cheese-gconf.h"
#include "cheese-thumb-view.h"
#include "cheese-fileutil.h"
@@ -53,7 +52,7 @@ CheeseWindow *cheese_window_new (void);
void cheese_window_bring_to_front (CheeseWindow *window);
CheeseThumbView *cheese_window_get_thumbview (CheeseWindow *window);
CheeseCamera * cheese_window_get_camera (CheeseWindow *window);
-CheeseGConf *cheese_window_get_gconf (CheeseWindow *window);
+GSettings * cheese_window_get_settings (CheeseWindow *window);
CheeseFileUtil *cheese_window_get_fileutil (CheeseWindow *window);
/* not so public ideally but ok for internal consumption */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]