[cheese/gnome-2-32] Added menu option to toggle flash when taking a picture.
- From: Daniel G. Siegel <dgsiegel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/gnome-2-32] Added menu option to toggle flash when taking a picture.
- Date: Fri, 13 Aug 2010 15:16:59 +0000 (UTC)
commit b2cb8c3cb67bf738c66ef748109097e41d53df52
Author: Yuvaraj Pandian T <yuvipanda gmail com>
Date: Fri Apr 2 13:39:51 2010 +0530
Added menu option to toggle flash when taking a picture.
Backed by gconf setting /apps/cheese/flash (True by default).
data/cheese-ui.xml | 1 +
data/cheese.schemas.in | 12 ++++++++++++
libcheese/cheese-gconf.c | 21 +++++++++++++++++++++
libcheese/cheese-gconf.h | 1 +
src/cheese-ui.h | 4 ++++
src/cheese-window.c | 31 ++++++++++++++++++++++++++++++-
src/cheese-window.h | 1 +
7 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/data/cheese-ui.xml b/data/cheese-ui.xml
index f21a254..049e3e1 100644
--- a/data/cheese-ui.xml
+++ b/data/cheese-ui.xml
@@ -2,6 +2,7 @@
<menubar name="MainMenu" name="MainMenu">
<menu action="Cheese" name="Cheese">
<menuitem name="CountdownToggle" action="Countdown" />
+ <menuitem name="FlashToggle" action="Flash" />
<separator />
<menuitem action="TakePhoto" />
<menuitem action="TakeVideo" />
diff --git a/data/cheese.schemas.in b/data/cheese.schemas.in
index 0d1a754..0dd67aa 100644
--- a/data/cheese.schemas.in
+++ b/data/cheese.schemas.in
@@ -13,6 +13,18 @@
</schema>
<schema>
+ <key>/schemas/apps/cheese/flash</key>
+ <applyto>/apps/cheese/flash</applyto>
+ <owner>cheese</owner>
+ <type>bool</type>
+ <default>1</default>
+ <locale name="C">
+ <short>Use a flash</short>
+ <long>Set to True to use flash when taking a photo</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/cheese/camera</key>
<applyto>/apps/cheese/camera</applyto>
<owner>cheese</owner>
diff --git a/libcheese/cheese-gconf.c b/libcheese/cheese-gconf.c
index 984e0a7..97a4e2d 100644
--- a/libcheese/cheese-gconf.c
+++ b/libcheese/cheese-gconf.c
@@ -60,6 +60,11 @@ cheese_gconf_get_property (GObject *object, guint prop_id, GValue *value,
CHEESE_GCONF_PREFIX "/countdown",
NULL));
break;
+ case GCONF_PROP_FLASH:
+ g_value_set_boolean (value, gconf_client_get_bool (priv->client,
+ CHEESE_GCONF_PREFIX "/flash",
+ NULL));
+ break;
case GCONF_PROP_CAMERA:
g_value_set_string (value, gconf_client_get_string (priv->client,
CHEESE_GCONF_PREFIX "/camera",
@@ -214,6 +219,14 @@ cheese_gconf_set_property (GObject *object, guint prop_id, const GValue *value,
g_value_get_boolean (value),
NULL);
break;
+
+ case GCONF_PROP_FLASH:
+ gconf_client_set_bool (priv->client,
+ CHEESE_GCONF_PREFIX "/flash",
+ g_value_get_boolean (value),
+ NULL);
+ break;
+
case GCONF_PROP_CAMERA:
gconf_client_set_string (priv->client,
CHEESE_GCONF_PREFIX "/camera",
@@ -366,6 +379,14 @@ cheese_gconf_class_init (CheeseGConfClass *klass)
NULL,
FALSE,
G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, GCONF_PROP_FLASH,
+ g_param_spec_boolean ("gconf_prop_flash",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
g_object_class_install_property (object_class, GCONF_PROP_CAMERA,
g_param_spec_string ("gconf_prop_camera",
NULL,
diff --git a/libcheese/cheese-gconf.h b/libcheese/cheese-gconf.h
index 9b9b308..3ac495f 100644
--- a/libcheese/cheese-gconf.h
+++ b/libcheese/cheese-gconf.h
@@ -43,6 +43,7 @@ enum
{
GCONF_PROP_0,
GCONF_PROP_COUNTDOWN,
+ GCONF_PROP_FLASH,
GCONF_PROP_CAMERA,
GCONF_PROP_SELECTED_EFFECTS,
GCONF_PROP_X_RESOLUTION,
diff --git a/src/cheese-ui.h b/src/cheese-ui.h
index 129e828..692c585 100644
--- a/src/cheese-ui.h
+++ b/src/cheese-ui.h
@@ -53,6 +53,10 @@ const GtkRadioActionEntry action_entries_toggle[] = {
const GtkToggleActionEntry action_entries_countdown[] = {
{"Countdown", NULL, N_("Countdown"), NULL, NULL, G_CALLBACK (cheese_window_toggle_countdown), FALSE},
};
+const GtkToggleActionEntry action_entries_flash[] = {
+ {"Flash", NULL, N_("Flash"), NULL, NULL, G_CALLBACK (cheese_window_toggle_flash), FALSE},
+};
+
const GtkToggleActionEntry action_entries_effects[] = {
{"Effects", NULL, N_("_Effects"), NULL, NULL, G_CALLBACK (cheese_window_effect_button_pressed_cb), FALSE},
};
diff --git a/src/cheese-window.c b/src/cheese-window.c
index 48b87ad..b1dd26a 100644
--- a/src/cheese-window.c
+++ b/src/cheese-window.c
@@ -159,6 +159,7 @@ typedef struct
GtkActionGroup *actions_main;
GtkActionGroup *actions_prefs;
GtkActionGroup *actions_countdown;
+ GtkActionGroup *actions_flash;
GtkActionGroup *actions_effects;
GtkActionGroup *actions_file;
GtkActionGroup *actions_photo;
@@ -627,7 +628,12 @@ cheese_window_countdown_picture_cb (gpointer data)
if (cheese_camera_take_photo (priv->camera, photo_filename))
{
- cheese_flash_fire (priv->flash);
+ gboolean flash;
+ g_object_get (priv->gconf, "gconf_prop_flash", &flash, NULL);
+ if(flash)
+ {
+ cheese_flash_fire (priv->flash);
+ }
ca_gtk_play_for_widget (priv->video_area, 0,
CA_PROP_EVENT_ID, "camera-shutter",
CA_PROP_MEDIA_ROLE, "event",
@@ -924,6 +930,15 @@ cheese_window_toggle_countdown (GtkWidget *widget, CheeseWindow *window)
g_object_set (priv->gconf, "gconf_prop_countdown", countdown, NULL);
}
+void
+cheese_window_toggle_flash (GtkWidget *widget, CheeseWindow *window)
+{
+ CheeseWindowPrivate *priv = CHEESE_WINDOW_GET_PRIVATE (window);
+ gboolean flash = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget));
+
+ g_object_set (priv->gconf, "gconf_prop_flash", flash, NULL);
+}
+
static void
cheese_window_set_mode (CheeseWindow *cheese_window, CameraMode mode)
{
@@ -1116,6 +1131,11 @@ setup_menubar_and_actions (CheeseWindow *cheese_window)
action_entries_countdown,
G_N_ELEMENTS (action_entries_countdown));
+ priv->actions_countdown = cheese_window_toggle_action_group_new (cheese_window,
+ "ActionsFlash",
+ action_entries_flash,
+ G_N_ELEMENTS (action_entries_flash));
+
priv->actions_effects = cheese_window_toggle_action_group_new (cheese_window,
"ActionsEffects",
action_entries_effects,
@@ -1174,6 +1194,15 @@ setup_menubar_and_actions (CheeseWindow *cheese_window)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
}
+ gboolean flash;
+ action = gtk_ui_manager_get_action (priv->ui_manager, "/MainMenu/Cheese/FlashToggle");
+ g_object_get (priv->gconf, "gconf_prop_flash", &flash, NULL);
+ if (flash)
+ {
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+ }
+
+
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);
diff --git a/src/cheese-window.h b/src/cheese-window.h
index a18834d..b4a8b18 100644
--- a/src/cheese-window.h
+++ b/src/cheese-window.h
@@ -58,6 +58,7 @@ CheeseFileUtil *cheese_window_get_fileutil (CheeseWindow *window);
/* not so public ideally but ok for internal consumption */
void cheese_window_toggle_countdown (GtkWidget *widget, CheeseWindow *window);
+void cheese_window_toggle_flash (GtkWidget *widget, CheeseWindow *window);
void cheese_window_preferences_cb (GtkAction *action, CheeseWindow *cheese_window);
void cheese_window_effect_button_pressed_cb (GtkWidget *widget, CheeseWindow *cheese_window);
void cheese_window_toggle_fullscreen (GtkWidget *widget, CheeseWindow *cheese_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]