[cheese] Enable effects state change action
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Enable effects state change action
- Date: Mon, 25 Jun 2012 21:41:53 +0000 (UTC)
commit add573a510267e9bcb8168fc09e8403195c5d21c
Author: David King <amigadave amigadave com>
Date: Sun Jun 24 15:21:02 2012 +0100
Enable effects state change action
data/cheese-actions.ui | 7 -------
data/cheese-main-window.ui | 2 +-
src/cheese-main.vala | 20 +++++++++++++++++++-
src/cheese-window.vala | 21 +++++++++------------
4 files changed, 29 insertions(+), 21 deletions(-)
---
diff --git a/data/cheese-actions.ui b/data/cheese-actions.ui
index 8f10992..2374c36 100644
--- a/data/cheese-actions.ui
+++ b/data/cheese-actions.ui
@@ -69,13 +69,6 @@
<child>
<object class="GtkActionGroup" id="effects_actions">
<child>
- <object class="GtkToggleAction" id="effects_toggle">
- <property name="name">Effects</property>
- <property name="label" translatable="yes">_Effects</property>
- <signal name="toggled" handler="cheese_main_window_on_effects_toggle"/>
- </object>
- </child>
- <child>
<object class="GtkAction" id="effects_page_prev">
<property name="name">Previous Effects</property>
<property name="label" translatable="yes">P_revious Effects</property>
diff --git a/data/cheese-main-window.ui b/data/cheese-main-window.ui
index 9141265..b0bec1a 100644
--- a/data/cheese-main-window.ui
+++ b/data/cheese-main-window.ui
@@ -136,7 +136,7 @@
<property name="vexpand">False</property>
<property name="hexpand">False</property>
<property name="use-action-appearance">False</property>
- <property name="related-action">effects_toggle</property>
+ <property name="action-name">app.effects</property>
<property name="tooltip_text" translatable="yes">Effects</property>
<child>
<object class="GtkGrid" id="effects_toggle_button_internal_hbox">
diff --git a/src/cheese-main.vala b/src/cheese-main.vala
index 0d1aca0..1d80ef8 100644
--- a/src/cheese-main.vala
+++ b/src/cheese-main.vala
@@ -38,9 +38,10 @@ public class Cheese.Main : Gtk.Application
private const GLib.ActionEntry action_entries[] = {
{ "mode", on_action_radio, "s", "'photo'", on_mode_change },
{ "fullscreen", on_action_toggle, null, "false", on_fullscreen_change },
+ { "effects", on_action_toggle, null, "false", on_effects_change },
{ "preferences", on_preferences },
- { "help", on_help },
{ "about", on_about },
+ { "help", on_help },
{ "quit", on_quit }
};
@@ -259,6 +260,23 @@ public class Cheese.Main : Gtk.Application
}
/**
+ * Handle the effects state being changed.
+ *
+ * @param action the action that emitted the signal
+ * @param value the state to switch to
+ */
+ private void on_effects_change (SimpleAction action, Variant? value)
+ {
+ return_if_fail (value != null);
+
+ var state = value.get_boolean ();
+
+ main_window.set_effects (state);
+
+ action.set_state (value);
+ }
+
+ /**
* Change the media capture mode (photo, video or burst).
*
* @param action the action that emitted the signal
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index a2831b4..9f1a9eb 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -42,8 +42,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
{
// Actions for the app menu.
private const GLib.ActionEntry entries[] = {
- { "shoot", on_take_action },
- { "effects", null, null, "false", on_effects_toggle }
+ { "shoot", on_take_action }
};
private MediaMode current_mode;
@@ -85,7 +84,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
private int current_effects_page = 0;
private ArrayList<Clutter.Box> effects_grids;
- private Gtk.ToggleAction effects_toggle_action;
private Gtk.ToggleAction wide_mode_action;
private Gtk.Action countdown_action;
private Gtk.Action effects_page_prev_action;
@@ -540,7 +538,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
private void enable_mode_change ()
{
// FIXME: Set the mode action to be sensitive
- effects_toggle_action.sensitive = true;
+ // FIXME: Set the effects action to be sensitive.
}
/**
@@ -549,7 +547,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
private void disable_mode_change ()
{
// FIXME: Set the mode action to be sensitive
- effects_toggle_action.sensitive = false;
+ // FIXME: Set the effects action to be insensitive.
}
/**
@@ -902,7 +900,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
else
if (is_effects_selector_active)
{
- effects_toggle_action.set_active (false);
+ // FIXME: Set the effects action to be inactive.
}
}
return false;
@@ -973,7 +971,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
{
is_bursting = true;
this.disable_mode_change ();
- effects_toggle_action.sensitive = false;
+ // FIXME: Set the effects action to be inactive.
take_action_button_label.label = "<b>" + _("Stop _Taking Pictures") + "</b>";
take_action_button.tooltip_text = _("Stop taking pictures");
burst_take_photo ();
@@ -1034,12 +1032,12 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
/**
* Toggle the display of the effect selector.
*
- * @param action the action that emitted the signal
+ * @param effects whether effects should be enabled
*/
[CCode (instance_pos = -1)]
- public void on_effects_toggle (SimpleAction action, Variant value)
+ public void set_effects (bool effects)
{
- toggle_effects_selector (action.enabled);
+ toggle_effects_selector (effects);
// FIXME: Set the mode action to be inverse sensitivity to effects.
}
@@ -1056,7 +1054,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
selected_effect = source.get_data ("effect");
camera.set_effect (selected_effect);
settings.set_string ("selected-effect", selected_effect.name);
- effects_toggle_action.set_active (false);
+ // FIXME: Set the effects action to be inactive.
return false;
}
@@ -1402,7 +1400,6 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
buttons_area = gtk_builder.get_object ("buttons_area") as Gtk.Box;
thumbnail_popup = gtk_builder.get_object ("thumbnail_popup") as Gtk.Menu;
- effects_toggle_action = gtk_builder.get_object ("effects_toggle") as Gtk.ToggleAction;
countdown_action = gtk_builder.get_object ("countdown") as Gtk.Action;
wide_mode_action = gtk_builder.get_object ("wide_mode") as Gtk.ToggleAction;
effects_page_next_action = gtk_builder.get_object ("effects_page_next") as Gtk.Action;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]