[cheese] port cheese to gsettings
- From: Daniel G. Siegel <dgsiegel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] port cheese to gsettings
- Date: Mon, 15 Nov 2010 02:11:56 +0000 (UTC)
commit ea13e0cca3bece31379bf5a897a76b2af2a94b03
Author: daniel g. siegel <dgsiegel gnome org>
Date: Fri Aug 6 17:22:40 2010 +0530
port cheese to gsettings
this commit drops gconf entirely from cheese and uses
gsettings. glib and gio dependency was bumped to 2.26.0
INSTALL | 97 ++++++--
configure.ac | 10 +-
data/Makefile.am | 21 +--
data/cheese-prefs.ui | 127 ++++++----
data/cheese.schemas.in | 190 --------------
data/org.gnome.Cheese.gschema.xml | 136 ++++++++++
libcheese/Makefile.am | 2 -
libcheese/cheese-camera.c | 4 +-
libcheese/cheese-fileutil.c | 13 +-
libcheese/cheese-gconf.c | 506 -------------------------------------
libcheese/cheese-gconf.h | 67 -----
libcheese/cheese-gtk.symbols | 2 -
libcheese/cheese-widget-private.h | 4 +-
libcheese/cheese-widget.c | 35 ++--
src/Makefile.am | 2 -
src/cheese-countdown.vala | 8 +-
src/cheese-main.vala | 2 +-
src/cheese-preferences.vala | 93 +++++---
src/cheese-window.vala | 112 ++++++---
src/thumbview/cheese-gconf.c | 506 -------------------------------------
src/thumbview/cheese-gconf.h | 67 -----
src/vapi/cheese-common.vapi | 37 ---
22 files changed, 469 insertions(+), 1572 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 a5752be..34dcefa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,13 +75,12 @@ GNOME_DOC_INIT
# Check required libraries
#*******************************************************************************
-GLIB_REQUIRED=2.16.0
+GLIB_REQUIRED=2.26.0
GOBJECT_REQUIRED=2.12.0
-GIO_REQUIRED=2.16.0
+GIO_REQUIRED=2.26.0
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
@@ -140,7 +139,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 \
@@ -168,9 +166,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
#*******************************************************************************
AC_OUTPUT([
diff --git a/data/Makefile.am b/data/Makefile.am
index 45deae0..19bc2a6 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -5,10 +5,8 @@ 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)
+gsettings_SCHEMAS = org.gnome.Cheese.gschema.xml
+ GSETTINGS_RULES@
gtkrcdir = $(pkgdatadir)
gtkrc_DATA = gtkrc
@@ -31,27 +29,14 @@ pkgdata_DATA = \
EXTRA_DIST = \
$(desktop_in_files) \
- $(schema_in_files) \
+ $(gsettings_SCHEMAS) \
$(service_in_files) \
$(pkgdata_DATA) \
$(gtkrc_DATA)
-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/cheese-prefs.ui b/data/cheese-prefs.ui
index 29062f5..965daba 100644
--- a/data/cheese-prefs.ui
+++ b/data/cheese-prefs.ui
@@ -3,43 +3,39 @@
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkAdjustment" id="brightness_adjustment">
- <property name="value">0</property>
<property name="lower">-1</property>
<property name="upper">1</property>
- <property name="step_increment">0.1</property>
+ <property name="step_increment">0.10000000000000001</property>
<property name="page_increment">0.5</property>
- <signal name="value-changed" handler="cheese_preferences_dialog_on_brightness_change" />
+ <signal name="value_changed" handler="cheese_preferences_dialog_on_brightness_change"/>
</object>
<object class="GtkAdjustment" id="contrast_adjustment">
<property name="value">1</property>
- <property name="lower">0</property>
<property name="upper">2</property>
- <property name="step_increment">0.1</property>
+ <property name="step_increment">0.10000000000000001</property>
<property name="page_increment">0.5</property>
- <signal name="value-changed" handler="cheese_preferences_dialog_on_contrast_change" />
+ <signal name="value_changed" handler="cheese_preferences_dialog_on_contrast_change"/>
</object>
<object class="GtkAdjustment" id="hue_adjustment">
- <property name="value">0</property>
<property name="lower">-1</property>
<property name="upper">1</property>
- <property name="step_increment">0.1</property>
+ <property name="step_increment">0.10000000000000001</property>
<property name="page_increment">0.5</property>
- <signal name="value-changed" handler="cheese_preferences_dialog_on_hue_change" />
+ <signal name="value_changed" handler="cheese_preferences_dialog_on_hue_change"/>
</object>
<object class="GtkAdjustment" id="saturation_adjustment">
<property name="value">1</property>
- <property name="lower">0</property>
<property name="upper">2</property>
- <property name="step_increment">0.1</property>
+ <property name="step_increment">0.10000000000000001</property>
<property name="page_increment">0.5</property>
- <signal name="value-changed" handler="cheese_preferences_dialog_on_saturation_change" />
+ <signal name="value_changed" handler="cheese_preferences_dialog_on_saturation_change"/>
</object>
<object class="GtkAdjustment" id="burst_count_adjustment">
<property name="value">2</property>
<property name="lower">3</property>
<property name="upper">10000</property>
<property name="step_increment">1</property>
- <property name="page_increment">10</property>
+ <property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="burst_delay_adjustment">
<property name="lower">1</property>
@@ -77,7 +73,6 @@
<child>
<object class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkAlignment" id="alignment3">
@@ -123,12 +118,11 @@
<child>
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkComboBox" id="camera_combo_box">
<property name="visible">True</property>
- <signal name="changed" handler="cheese_preferences_dialog_on_source_change" />
+ <signal name="changed" handler="cheese_preferences_dialog_on_source_change"/>
</object>
<packing>
<property name="position">0</property>
@@ -138,7 +132,7 @@
<object class="GtkComboBox" id="resolution_combo_box">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal name="changed" handler="cheese_preferences_dialog_on_resolution_change" />
+ <signal name="changed" handler="cheese_preferences_dialog_on_resolution_change"/>
</object>
<packing>
<property name="position">1</property>
@@ -178,15 +172,13 @@
<child>
<object class="GtkVBox" id="vbox3">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">2</property>
-
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="xscale">0</property>
<property name="yalign">0</property>
+ <property name="xscale">0</property>
<property name="yscale">0</property>
<property name="left_padding">10</property>
<child>
@@ -197,17 +189,15 @@
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
-
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="xscale">0</property>
<property name="yalign">0</property>
+ <property name="xscale">0</property>
<property name="yscale">0</property>
<property name="left_padding">10</property>
<child>
@@ -225,10 +215,10 @@
<object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="xscale">0</property>
<property name="yalign">0</property>
+ <property name="xscale">0</property>
<property name="yscale">0</property>
- <property name="left_padding">10</property>
+ <property name="left_padding">10</property>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
@@ -237,8 +227,6 @@
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
@@ -246,8 +234,8 @@
<object class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="xscale">0</property>
<property name="yalign">0</property>
+ <property name="xscale">0</property>
<property name="yscale">0</property>
<property name="left_padding">10</property>
<child>
@@ -258,8 +246,6 @@
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
@@ -273,18 +259,15 @@
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkHScale" id="brightness_scale">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="draw_value">False</property>
<property name="adjustment">brightness_adjustment</property>
+ <property name="draw_value">False</property>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -292,8 +275,8 @@
<object class="GtkHScale" id="contrast_scale">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="draw_value">False</property>
<property name="adjustment">contrast_adjustment</property>
+ <property name="draw_value">False</property>
</object>
<packing>
<property name="position">1</property>
@@ -303,8 +286,8 @@
<object class="GtkHScale" id="saturation_scale">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="draw_value">False</property>
<property name="adjustment">saturation_adjustment</property>
+ <property name="draw_value">False</property>
</object>
<packing>
<property name="position">2</property>
@@ -314,8 +297,8 @@
<object class="GtkHScale" id="hue_scale">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="draw_value">False</property>
<property name="adjustment">hue_adjustment</property>
+ <property name="draw_value">False</property>
</object>
<packing>
<property name="position">3</property>
@@ -345,6 +328,62 @@
</packing>
</child>
<child>
+ <object class="GtkFrame" id="frame4">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment9">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkCheckButton" id="countdown">
+ <property name="label" translatable="yes">_Countdown</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="cheese_preferences_dialog_on_countdown_toggle"/>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="flash">
+ <property name="label" translatable="yes">Fire _Flash</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="cheese_preferences_dialog_on_flash_toggle"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Shutter</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
@@ -357,7 +396,6 @@
<child>
<object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkAlignment" id="alignment7">
@@ -403,7 +441,6 @@
<child>
<object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
<object class="GtkSpinButton" id="burst_repeat">
@@ -411,7 +448,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="adjustment">burst_count_adjustment</property>
- <signal name="value-changed" handler="cheese_preferences_dialog_on_burst_repeat_change" />
+ <signal name="value_changed" handler="cheese_preferences_dialog_on_burst_repeat_change"/>
</object>
<packing>
<property name="position">0</property>
@@ -423,7 +460,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="adjustment">burst_delay_adjustment</property>
- <signal name="value-changed" handler="cheese_preferences_dialog_on_burst_delay_change" />
+ <signal name="value_changed" handler="cheese_preferences_dialog_on_burst_delay_change"/>
</object>
<packing>
<property name="position">1</property>
@@ -447,7 +484,7 @@
</child>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
@@ -470,7 +507,7 @@
<property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_stock">True</property>
- <signal name="clicked" handler="cheese_preferences_dialog_on_dialog_close" />
+ <signal name="clicked" handler="cheese_preferences_dialog_on_dialog_close"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/data/org.gnome.Cheese.gschema.xml b/data/org.gnome.Cheese.gschema.xml
new file mode 100644
index 0000000..0e4dedb
--- /dev/null
+++ b/data/org.gnome.Cheese.gschema.xml
@@ -0,0 +1,136 @@
+<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='flash' type='b'>
+ <summary>Fire flash before taking a picture</summary>
+ <description>
+ Set to True to fire a flash before taking a picture
+ </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-effect' type='s'>
+ <summary>Name of last selected effect</summary>
+ <description>
+ Name of installed effect that was selected last
+ </description>
+ <default>'identity'</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='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='fullscreen' type='b'>
+ <summary>Whether to start in fullscreen</summary>
+ <description>
+ If set to true, Cheese will start up in a fullscreen mode.
+ </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 32de009..c7a4c05 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-camera.c b/libcheese/cheese-camera.c
index 33fd77f..ced9a4f 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -788,6 +788,7 @@ cheese_camera_element_from_effect (CheeseCamera *camera, CheeseEffect *effect)
{
g_error_free (err);
g_warning ("Error with effect filter %s. Ignored", name);
+ return NULL;
}
g_free (effects_pipeline_desc);
@@ -800,7 +801,8 @@ cheese_camera_set_effect (CheeseCamera *camera, CheeseEffect *effect)
GstElement *effect_filter;
effect_filter = cheese_camera_element_from_effect (camera, effect);
- cheese_camera_change_effect_filter (camera, effect_filter);
+ if (effect_filter != NULL)
+ cheese_camera_change_effect_filter (camera, effect_filter);
}
void
diff --git a/libcheese/cheese-fileutil.c b/libcheese/cheese-fileutil.c
index c684edc..80aca6a 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)
@@ -183,12 +182,12 @@ 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->video_path);
/* get the video path from gconf, xdg or hardcoded */
if (!priv->video_path || strcmp (priv->video_path, "") == 0)
@@ -202,7 +201,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 */
@@ -214,7 +213,7 @@ cheese_fileutil_init (CheeseFileUtil *fileutil)
}
}
- g_object_unref (gconf);
+ g_object_unref (settings);
}
CheeseFileUtil *
diff --git a/libcheese/cheese-gtk.symbols b/libcheese/cheese-gtk.symbols
index bd8dcd9..156543f 100644
--- a/libcheese/cheese-gtk.symbols
+++ b/libcheese/cheese-gtk.symbols
@@ -1,11 +1,9 @@
cheese_widget_get_type
cheese_widget_new
cheese_widget_get_camera
-cheese_widget_get_gconf
cheese_widget_get_video_area
cheese_widget_get_error
cheese_widget_state_get_type
-cheese_gconf_get_type
cheese_camera_get_type
cheese_camera_cat
cheese_camera_device_get_type
diff --git a/libcheese/cheese-widget-private.h b/libcheese/cheese-widget-private.h
index 886577a..96c6ca7 100644
--- a/libcheese/cheese-widget-private.h
+++ b/libcheese/cheese-widget-private.h
@@ -32,8 +32,8 @@ enum
LAST_PAGE = 3,
};
-GObject * cheese_widget_get_camera (CheeseWidget *widget);
-GObject * cheese_widget_get_gconf (CheeseWidget *widget);
+GObject *cheese_widget_get_camera (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 2bee0f9..7ba5c74 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"
@@ -52,7 +51,7 @@ typedef struct
GtkWidget *screen;
ClutterActor *texture;
GtkWidget *problem;
- CheeseGConf *gconf;
+ GSettings *settings;
CheeseCamera *webcam;
CheeseWidgetState state;
GError *error;
@@ -228,7 +227,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
@@ -236,10 +235,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)
{
@@ -311,16 +310,14 @@ setup_camera (CheeseWidget *widget)
gdouble contrast;
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 (CLUTTER_TEXTURE (priv->texture),
@@ -446,8 +443,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;
@@ -455,7 +452,7 @@ cheese_widget_get_gconf (CheeseWidget *widget)
priv = CHEESE_WIDGET_GET_PRIVATE (widget);
- return G_OBJECT (priv->gconf);
+ return G_OBJECT (priv->settings);
}
GObject *
diff --git a/src/Makefile.am b/src/Makefile.am
index 3d1c95b..23896c5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -42,13 +42,11 @@ cheese_SOURCES = \
cheese-countdown.vala \
cheese-effects-manager.vala \
cheese-preferences.vala \
- thumbview/cheese-gconf.c \
thumbview/cheese-thumb-view.c \
thumbview/cheese-thumbnail.c \
thumbview/eog-thumb-nav.c
noinst_HEADERS = \
- thumbview/cheese-gconf.h \
thumbview/cheese-thumb-view.h \
thumbview/cheese-thumbnail.h \
thumbview/eog-thumb-nav.h
diff --git a/src/cheese-countdown.vala b/src/cheese-countdown.vala
index 1dd426e..4969500 100644
--- a/src/cheese-countdown.vala
+++ b/src/cheese-countdown.vala
@@ -39,7 +39,7 @@ internal class Cheese.Countdown : GLib.Object
private static Clutter.Animation anim;
public bool running;
-
+
public Countdown (Clutter.Text countdown_actor)
{
this.countdown_actor = countdown_actor;
@@ -56,7 +56,7 @@ internal class Cheese.Countdown : GLib.Object
if (this.current_value <= 0)
{
this.completed_callback ();
- running = false;
+ running = false;
return;
}
this.countdown_actor.text = this.current_value.to_string ();
@@ -70,7 +70,7 @@ internal class Cheese.Countdown : GLib.Object
{
this.completed_callback = completed_callback;
this.current_value = COUNTDOWN_START;
- running = true;
+ running = true;
countdown_actor.show ();
fade_in ();
}
@@ -79,6 +79,6 @@ internal class Cheese.Countdown : GLib.Object
{
countdown_actor.hide ();
SignalHandler.disconnect (anim, signal_id);
- running = false;
+ running = false;
}
}
diff --git a/src/cheese-main.vala b/src/cheese-main.vala
index ccaff49..731b850 100644
--- a/src/cheese-main.vala
+++ b/src/cheese-main.vala
@@ -106,7 +106,7 @@ public class Cheese.Main
main_window.setup_ui ();
main_window.destroy.connect (Gtk.main_quit);
- main_window.show_all ();
+ main_window.show ();
main_window.setup_camera (device);
Gtk.main ();
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index e32c60e..9fa99b2 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -24,7 +24,8 @@ using Gtk;
public class Cheese.PreferencesDialog : GLib.Object
{
private Cheese.Camera camera;
- private Cheese.GConf conf;
+
+ private GLib.Settings settings;
private Gtk.Dialog dialog;
@@ -44,10 +45,13 @@ public class Cheese.PreferencesDialog : GLib.Object
private Gtk.SpinButton burst_repeat_spin;
private Gtk.SpinButton burst_delay_spin;
- public PreferencesDialog (Cheese.Camera camera, Cheese.GConf conf)
+ private Gtk.CheckButton countdown_check;
+ private Gtk.CheckButton flash_check;
+
+ public PreferencesDialog (Cheese.Camera camera, GLib.Settings settings)
{
this.camera = camera;
- this.conf = conf;
+ this.settings = settings;
Gtk.Builder builder = new Gtk.Builder ();
try
@@ -61,32 +65,35 @@ public class Cheese.PreferencesDialog : GLib.Object
this.dialog = (Gtk.Dialog)builder.get_object ("cheese_prefs_dialog");
- this.brightness_adjustment = (Gtk.Adjustment)builder.get_object ("brightness_adjustment");
- this.contrast_adjustment = (Gtk.Adjustment)builder.get_object ("contrast_adjustment");
- this.hue_adjustment = (Gtk.Adjustment)builder.get_object ("hue_adjustment");
- this.saturation_adjustment = (Gtk.Adjustment)builder.get_object ("saturation_adjustment");
+ this.brightness_adjustment = (Gtk.Adjustment) builder.get_object ("brightness_adjustment");
+ this.contrast_adjustment = (Gtk.Adjustment) builder.get_object ("contrast_adjustment");
+ this.hue_adjustment = (Gtk.Adjustment) builder.get_object ("hue_adjustment");
+ this.saturation_adjustment = (Gtk.Adjustment) builder.get_object ("saturation_adjustment");
/* Here instead of in cheese-prefs.ui because of https://bugzilla.gnome.org/show_bug.cgi?id=624443 */
- this.brightness_scale = (Gtk.Scale)builder.get_object ("brightness_scale");
- this.contrast_scale = (Gtk.Scale)builder.get_object ("contrast_scale");
- this.hue_scale = (Gtk.Scale)builder.get_object ("hue_scale");
- this.saturation_scale = (Gtk.Scale)builder.get_object ("saturation_scale");
+ this.brightness_scale = (Gtk.Scale) builder.get_object ("brightness_scale");
+ this.contrast_scale = (Gtk.Scale) builder.get_object ("contrast_scale");
+ this.hue_scale = (Gtk.Scale) builder.get_object ("hue_scale");
+ this.saturation_scale = (Gtk.Scale) builder.get_object ("saturation_scale");
this.brightness_scale.add_mark (0, Gtk.PositionType.BOTTOM, null);
this.contrast_scale.add_mark (1, Gtk.PositionType.BOTTOM, null);
this.hue_scale.add_mark (0, Gtk.PositionType.BOTTOM, null);
this.saturation_scale.add_mark (1, Gtk.PositionType.BOTTOM, null);
- this.resolution_combo = (Gtk.ComboBox)builder.get_object ("resolution_combo_box");
- this.source_combo = (Gtk.ComboBox)builder.get_object ("camera_combo_box");
+ this.resolution_combo = (Gtk.ComboBox) builder.get_object ("resolution_combo_box");
+ this.source_combo = (Gtk.ComboBox) builder.get_object ("camera_combo_box");
+
+ this.burst_repeat_spin = (Gtk.SpinButton) builder.get_object ("burst_repeat");
+ this.burst_delay_spin = (Gtk.SpinButton) builder.get_object ("burst_delay");
- this.burst_repeat_spin = (Gtk.SpinButton)builder.get_object ("burst_repeat");
- this.burst_delay_spin = (Gtk.SpinButton)builder.get_object ("burst_delay");
+ this.countdown_check = (Gtk.CheckButton) builder.get_object ("countdown");
+ this.flash_check = (Gtk.CheckButton) builder.get_object ("flash");
setup_combo_box_models ();
initialize_camera_devices ();
- initialize_values_from_conf ();
+ initialize_values_from_settings ();
/*
* Connect signals only after all the widgets have been setup
@@ -113,11 +120,13 @@ public class Cheese.PreferencesDialog : GLib.Object
ListStore camera_model = new ListStore (2, typeof (string), typeof (Cheese.CameraDevice));
source_combo.model = camera_model;
+ if (devices.len <= 1)
+ source_combo.sensitive = false;
for (int i = 0; i < devices.len; i++)
{
TreeIter iter;
- dev = (Cheese.CameraDevice)devices.index (i);
+ dev = (Cheese.CameraDevice) devices.index (i);
camera_model.append (out iter);
camera_model.set (iter,
0, dev.get_name () + " (" + dev.get_device_file () + " )",
@@ -128,6 +137,7 @@ public class Cheese.PreferencesDialog : GLib.Object
}
}
+ settings.set_string("camera", camera.get_selected_device ().get_device_file ());
setup_resolutions_for_device (camera.get_selected_device ());
}
@@ -151,19 +161,24 @@ public class Cheese.PreferencesDialog : GLib.Object
camera.get_current_video_format ().height == format.height)
{
resolution_combo.set_active_iter (iter);
+ settings.set_int("x-resolution", format.width);
+ settings.set_int("y-resolution", format.height);
}
}
}
- private void initialize_values_from_conf ()
+ private void initialize_values_from_settings ()
{
- brightness_adjustment.value = conf.gconf_prop_brightness;
- contrast_adjustment.value = conf.gconf_prop_contrast;
- hue_adjustment.value = conf.gconf_prop_hue;
- saturation_adjustment.value = conf.gconf_prop_saturation;
+ brightness_adjustment.value = settings.get_double("brightness");
+ contrast_adjustment.value = settings.get_double("contrast");
+ hue_adjustment.value = settings.get_double("hue");
+ saturation_adjustment.value = settings.get_double("saturation");
- burst_repeat_spin.value = conf.gconf_prop_burst_repeat;
- burst_delay_spin.value = conf.gconf_prop_burst_delay / 1000;
+ burst_repeat_spin.value = settings.get_int("burst-repeat");
+ burst_delay_spin.value = settings.get_int("burst-delay") / 1000;
+
+ countdown_check.active = settings.get_boolean("countdown");
+ flash_check.active = settings.get_boolean("flash");
}
[CCode (instance_pos = -1)]
@@ -178,7 +193,7 @@ public class Cheese.PreferencesDialog : GLib.Object
camera.set_device_by_dev_file (dev.get_device_file ());
camera.switch_camera_device ();
setup_resolutions_for_device (camera.get_selected_device ());
- conf.gconf_prop_camera = dev.get_device_file ();
+ settings.set_string("camera", dev.get_device_file ());
}
[CCode (instance_pos = -1)]
@@ -192,8 +207,8 @@ public class Cheese.PreferencesDialog : GLib.Object
combo.model.get (iter, 1, out format);
camera.set_video_format (format);
- conf.gconf_prop_x_resolution = format.width;
- conf.gconf_prop_y_resolution = format.height;
+ settings.set_int("x-resolution", format.width);
+ settings.set_int("y-resolution", format.height);
}
[CCode (instance_pos = -1)]
@@ -203,43 +218,55 @@ public class Cheese.PreferencesDialog : GLib.Object
}
[CCode (instance_pos = -1)]
+ public void on_countdown_toggle (Gtk.CheckButton checkbutton)
+ {
+ settings.set_boolean("countdown", checkbutton.active);
+ }
+
+ [CCode (instance_pos = -1)]
+ public void on_flash_toggle (Gtk.CheckButton checkbutton)
+ {
+ settings.set_boolean("flash", checkbutton.active);
+ }
+
+ [CCode (instance_pos = -1)]
public void on_burst_repeat_change (Gtk.SpinButton spinbutton)
{
- conf.gconf_prop_burst_repeat = (int) spinbutton.value;
+ settings.set_int("burst-repeat", (int) spinbutton.value);
}
[CCode (instance_pos = -1)]
public void on_burst_delay_change (Gtk.SpinButton spinbutton)
{
- conf.gconf_prop_burst_delay = (int) spinbutton.value * 1000;
+ settings.set_int("burst-delay", (int) spinbutton.value * 1000);
}
[CCode (instance_pos = -1)]
public void on_brightness_change (Gtk.Adjustment adjustment)
{
this.camera.set_balance_property ("brightness", adjustment.value);
- conf.gconf_prop_brightness = adjustment.value;
+ settings.set_double("brightness", adjustment.value);
}
[CCode (instance_pos = -1)]
public void on_contrast_change (Gtk.Adjustment adjustment)
{
this.camera.set_balance_property ("contrast", adjustment.value);
- conf.gconf_prop_contrast = adjustment.value;
+ settings.set_double("contrast", adjustment.value);
}
[CCode (instance_pos = -1)]
public void on_hue_change (Gtk.Adjustment adjustment)
{
this.camera.set_balance_property ("hue", adjustment.value);
- conf.gconf_prop_hue = adjustment.value;
+ settings.set_double("hue", adjustment.value);
}
[CCode (instance_pos = -1)]
public void on_saturation_change (Gtk.Adjustment adjustment)
{
this.camera.set_balance_property ("saturation", adjustment.value);
- conf.gconf_prop_saturation = adjustment.value;
+ settings.set_double("saturation", adjustment.value);
}
public void show ()
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 25872c5..bce24bf 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -39,6 +39,8 @@ public class Cheese.MainWindow : Gtk.Window
private Gtk.Builder gtk_builder;
private Clutter.Script clutter_builder;
+ private GLib.Settings settings;
+
private Gtk.Widget thumbnails;
private GtkClutter.Embed viewport_widget;
private Gtk.VBox main_vbox;
@@ -79,6 +81,7 @@ public class Cheese.MainWindow : Gtk.Window
private Gtk.Action burst_mode_action;
private Gtk.ToggleAction effects_toggle_action;
private Gtk.ToggleAction wide_mode_action;
+ private Gtk.ToggleAction fullscreen_action;
private Gtk.Action countdown_action;
private Gtk.Action effects_page_prev_action;
private Gtk.Action effects_page_next_action;
@@ -93,10 +96,10 @@ public class Cheese.MainWindow : Gtk.Window
private Gtk.Button[] buttons;
- private Cheese.Camera camera;
- private Cheese.FileUtil fileutil;
- private Cheese.Flash flash;
- private Cheese.GConf conf;
+ private Cheese.Camera camera;
+ private Cheese.FileUtil fileutil;
+ private Cheese.Flash flash;
+
private Cheese.EffectsManager effects_manager;
private Cheese.PreferencesDialog preferences_dialog;
@@ -112,7 +115,7 @@ public class Cheese.MainWindow : Gtk.Window
public void on_preferences_dialog (Gtk.Action action)
{
if (preferences_dialog == null)
- preferences_dialog = new Cheese.PreferencesDialog (camera, conf);
+ preferences_dialog = new Cheese.PreferencesDialog (camera, settings);
preferences_dialog.show ();
}
@@ -261,7 +264,7 @@ public class Cheese.MainWindow : Gtk.Window
file_to_trash = File.new_for_path (fileutil.get_photo_path () + GLib.Path.DIR_SEPARATOR_S + file_info.get_name ());
file_to_trash.trash (null);
}
- }catch (Error e)
+ } catch (Error e)
{
warning ("Error: %s\n", e.message);
return;
@@ -329,7 +332,7 @@ public class Cheese.MainWindow : Gtk.Window
screen = this.get_screen ();
try {
Gtk.show_uri (screen, "ghelp:cheese", Gtk.get_current_event_time ());
- }catch (Error err)
+ } catch (Error err)
{
warning ("Error: %s\n", err.message);
}
@@ -439,9 +442,9 @@ public class Cheese.MainWindow : Gtk.Window
{
fullscreen_timeout = new TimeoutSource (FULLSCREEN_TIMEOUT_INTERVAL);
fullscreen_timeout.attach (null);
- fullscreen_timeout.set_callback (() => { buttons_area.hide ();
- clear_fullscreen_timeout ();
- return true;});
+ fullscreen_timeout.set_callback (() => {buttons_area.hide ();
+ clear_fullscreen_timeout ();
+ return true; });
}
private bool fullscreen_motion_notify_callback (Gtk.Widget viewport, EventMotion e)
@@ -462,6 +465,7 @@ public class Cheese.MainWindow : Gtk.Window
* So that the next time leave_fullscreen_button_container.show_all() is called, the button is actually shown
* FIXME: If this code can be made cleaner/clearer, please do */
+ settings.set_boolean ("fullscreen", fullscreen_mode);
is_fullscreen = fullscreen_mode;
if (fullscreen_mode)
{
@@ -516,8 +520,8 @@ public class Cheese.MainWindow : Gtk.Window
private void set_wide_mode (bool wide_mode)
{
- is_wide_mode = wide_mode;
- conf.gconf_prop_wide_mode = wide_mode;
+ is_wide_mode = wide_mode;
+ settings.set_boolean ("wide-mode", wide_mode);
/* keep the viewport to its current size while rearranging the ui,
* so that thumbview moves from right to bottom and viceversa
@@ -577,7 +581,7 @@ public class Cheese.MainWindow : Gtk.Window
[CCode (instance_pos = -1)]
public void on_countdown_toggle (ToggleAction action)
{
- conf.gconf_prop_countdown = action.active;
+ settings.set_boolean ("countdown", action.active);
}
private void finish_countdown_callback ()
@@ -586,7 +590,10 @@ public class Cheese.MainWindow : Gtk.Window
{
string file_name = fileutil.get_new_media_filename (this.current_mode);
- this.flash.fire ();
+ if (settings.get_boolean ("flash"))
+ {
+ this.flash.fire ();
+ }
CanberraGtk.play_for_widget (this.main_vbox, 0,
Canberra.PROP_EVENT_ID, "camera-shutter",
Canberra.PROP_MEDIA_ROLE, "event",
@@ -605,7 +612,7 @@ public class Cheese.MainWindow : Gtk.Window
Countdown current_countdown;
public void take_photo ()
{
- if (conf.gconf_prop_countdown)
+ if (settings.get_boolean ("countdown"))
{
if (current_mode == MediaMode.PHOTO)
take_photo_action.sensitive = false;
@@ -623,7 +630,7 @@ public class Cheese.MainWindow : Gtk.Window
private bool burst_take_photo ()
{
- if (is_bursting && burst_count < conf.gconf_prop_burst_repeat)
+ if (is_bursting && burst_count < settings.get_int ("burst-repeat"))
{
this.take_photo ();
burst_count++;
@@ -724,7 +731,7 @@ public class Cheese.MainWindow : Gtk.Window
burst_take_photo ();
/* 3500 ms is approximate time for countdown animation to finish */
- burst_callback_id = GLib.Timeout.add ((conf.gconf_prop_burst_delay / 1000) * 3500, burst_take_photo);
+ burst_callback_id = GLib.Timeout.add ((settings.get_int ("burst-delay") / 1000) * 3500, burst_take_photo);
}
}
@@ -744,6 +751,7 @@ public class Cheese.MainWindow : Gtk.Window
{
selected_effect = event.source.get_data ("effect");
camera.set_effect (selected_effect);
+ settings.set_string ("selected-effect", selected_effect.name);
effects_toggle_action.set_active (false);
return false;
}
@@ -859,8 +867,8 @@ public class Cheese.MainWindow : Gtk.Window
for (int i = 0; i <= effects_manager.effects.size / EFFECTS_PER_PAGE; i++)
{
- Clutter.TableLayout table_layout = new TableLayout();
- Clutter.Box grid = new Clutter.Box (table_layout);
+ Clutter.TableLayout table_layout = new TableLayout();
+ Clutter.Box grid = new Clutter.Box (table_layout);
effects_grids.add (grid);
table_layout.column_spacing = 20;
@@ -907,12 +915,12 @@ public class Cheese.MainWindow : Gtk.Window
"y-align", Clutter.BinAlignment.END, null
);
- Clutter.TableLayout table_layout = (Clutter.TableLayout)effects_grids[i / EFFECTS_PER_PAGE].layout_manager;
+ Clutter.TableLayout table_layout = (Clutter.TableLayout)effects_grids[i / EFFECTS_PER_PAGE].layout_manager;
table_layout.pack (
- (Clutter.Actor)box,
- (i % EFFECTS_PER_PAGE) % 3,
- (i % EFFECTS_PER_PAGE) / 3
- );
+ (Clutter.Actor)box,
+ (i % EFFECTS_PER_PAGE) % 3,
+ (i % EFFECTS_PER_PAGE) / 3
+ );
}
setup_effects_page_switch_sensitivity ();
@@ -995,7 +1003,7 @@ public class Cheese.MainWindow : Gtk.Window
clutter_builder = new Clutter.Script ();
fileutil = new FileUtil ();
flash = new Flash (this);
- conf = new GConf ();
+ settings = new GLib.Settings ("org.gnome.Cheese");
try {
gtk_builder.add_from_file (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "cheese-actions.ui"));
@@ -1004,7 +1012,7 @@ public class Cheese.MainWindow : Gtk.Window
gtk_builder.connect_signals (this);
clutter_builder.load_from_file (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "cheese-viewport.json"));
- }catch (Error err)
+ } catch (Error err)
{
error ("Error: %s", err.message);
}
@@ -1037,17 +1045,18 @@ public class Cheese.MainWindow : Gtk.Window
effects_toggle_action = (Gtk.ToggleAction)gtk_builder.get_object ("effects_toggle");
countdown_action = (Gtk.Action)gtk_builder.get_object ("countdown");
wide_mode_action = (Gtk.ToggleAction)gtk_builder.get_object ("wide_mode");
+ fullscreen_action = (Gtk.ToggleAction)gtk_builder.get_object ("fullscreen");
effects_page_next_action = (Gtk.Action)gtk_builder.get_object ("effects_page_next");
effects_page_prev_action = (Gtk.Action)gtk_builder.get_object ("effects_page_prev");
/* Array contains all 'buttons', for easier manipulation
* IMPORTANT: IF ANOTHER BUTTON IS ADDED UNDER THE VIEWPORT, ADD IT TO THIS ARRAY */
- buttons = { photo_toggle_button,
- video_toggle_button,
- burst_toggle_button,
- take_action_button,
- effects_toggle_button,
- leave_fullscreen_button};
+ buttons = {photo_toggle_button,
+ video_toggle_button,
+ burst_toggle_button,
+ take_action_button,
+ effects_toggle_button,
+ leave_fullscreen_button};
video_preview = (Clutter.Texture)clutter_builder.get_object ("video_preview");
viewport_layout = (Clutter.Box)clutter_builder.get_object ("viewport_layout");
@@ -1079,12 +1088,12 @@ public class Cheese.MainWindow : Gtk.Window
/* call set_active instead of our set_wide_mode so that the toggle
* action state is updated */
- wide_mode_action.set_active (conf.gconf_prop_wide_mode);
+ wide_mode_action.set_active (settings.get_boolean ("wide-mode"));
/* apparently set_active doesn't emit toggled nothing has
* changed, do it manually */
- if (!conf.gconf_prop_wide_mode) wide_mode_action.toggled ();
-
+ if (!settings.get_boolean ("wide-mode"))
+ wide_mode_action.toggled ();
set_mode (MediaMode.PHOTO);
setup_effects_selector ();
@@ -1092,22 +1101,26 @@ public class Cheese.MainWindow : Gtk.Window
toggle_camera_actions_sensitivities (false);
this.key_release_event.connect (on_key_release);
+
+ if (settings.get_boolean ("fullscreen"))
+ fullscreen_action.active = true;
}
public void setup_camera (string ? uri)
{
string device;
+ Effect effect;
+ double value;
if (uri != null && uri.length > 0)
device = uri;
else
- device = conf.gconf_prop_camera;
+ device = settings.get_string ("camera");
camera = new Camera (video_preview,
device,
- conf.gconf_prop_x_resolution,
- conf.gconf_prop_y_resolution);
-
+ settings.get_int ("x-resolution"),
+ settings.get_int ("y-resolution"));
try {
camera.setup (device);
}
@@ -1117,10 +1130,31 @@ public class Cheese.MainWindow : Gtk.Window
warning ("Error: %s\n", err.message);
error_layer.text = err.message;
error_layer.show ();
+
toggle_camera_actions_sensitivities (false);
return;
}
+ effect = effects_manager.get_effect (settings.get_string ("selected-effect"));
+ if (effect != null)
+ camera.set_effect (effect);
+
+ value = settings.get_double("brightness");
+ if (value != 0.0)
+ camera.set_balance_property ("brightness", value);
+
+ value = settings.get_double("contrast");
+ if (value != 1.0)
+ camera.set_balance_property ("contrast", value);
+
+ value = settings.get_double("hue");
+ if (value != 0.0)
+ camera.set_balance_property ("hue", value);
+
+ value = settings.get_double("saturation");
+ if (value != 1.0)
+ camera.set_balance_property ("saturation", value);
+
camera.state_changed.connect (camera_state_changed);
camera.play ();
}
diff --git a/src/vapi/cheese-common.vapi b/src/vapi/cheese-common.vapi
index 4e62b3d..eee8cdc 100644
--- a/src/vapi/cheese-common.vapi
+++ b/src/vapi/cheese-common.vapi
@@ -114,43 +114,6 @@ namespace Cheese
public void fire ();
}
- [CCode (cheader_filename = "cheese-gconf.h")]
- public class GConf : GLib.Object
- {
- [CCode (has_construct_function = false)]
- public GConf ();
- [NoAccessorMethod]
- public double gconf_prop_brightness {get; set;}
- [NoAccessorMethod]
- public int gconf_prop_burst_delay {get; set;}
- [NoAccessorMethod]
- public int gconf_prop_burst_repeat {get; set;}
- [NoAccessorMethod]
- public string gconf_prop_camera {owned get; set;}
- [NoAccessorMethod]
- public double gconf_prop_contrast {get; set;}
- [NoAccessorMethod]
- public bool gconf_prop_countdown {get; set;}
- [NoAccessorMethod]
- public bool gconf_prop_enable_delete {get; set;}
- [NoAccessorMethod]
- public double gconf_prop_hue {get; set;}
- [NoAccessorMethod]
- public string gconf_prop_photo_path {owned get; set;}
- [NoAccessorMethod]
- public double gconf_prop_saturation {get; set;}
- [NoAccessorMethod]
- public string gconf_prop_selected_effects {owned get; set;}
- [NoAccessorMethod]
- public string gconf_prop_video_path {owned get; set;}
- [NoAccessorMethod]
- public bool gconf_prop_wide_mode {get; set;}
- [NoAccessorMethod]
- public int gconf_prop_x_resolution {get; set;}
- [NoAccessorMethod]
- public int gconf_prop_y_resolution {get; set;}
- }
-
[Compact]
[CCode (type_id = "CHEESE_TYPE_VIDEO_FORMAT", cheader_filename = "cheese-camera-device.h")]
public class VideoFormat
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]