[cheese/gnome-3-10] Refactor effects page next/previous logic
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/gnome-3-10] Refactor effects page next/previous logic
- Date: Thu, 12 Dec 2013 10:49:25 +0000 (UTC)
commit 18148b1aa4d104513f709e98d13b2570206acd9d
Author: David King <amigadave amigadave com>
Date: Thu Dec 12 10:19:52 2013 +0000
Refactor effects page next/previous logic
Add is_next_effects_page() and is_previous_effects_page() to
CheeseWindow.
src/cheese-window.vala | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 4585a66..a386d9c 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -940,7 +940,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
*/
private void on_effects_previous ()
{
- if (current_effects_page != 0)
+ if (is_previous_effects_page ())
{
activate_effects_page ((int)current_effects_page - 1);
}
@@ -951,8 +951,7 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
*/
private void on_effects_next ()
{
- if (current_effects_page != (effects_manager.effects.length ()
- / EFFECTS_PER_PAGE))
+ if (is_next_effects_page ())
{
activate_effects_page ((int)current_effects_page + 1);
}
@@ -1018,9 +1017,19 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
var effects_previous = this.lookup_action ("effects-previous") as SimpleAction;
effects_next.set_enabled (is_effects_selector_active
- && current_effects_page != effects_manager.effects.length () /
EFFECTS_PER_PAGE);
+ && is_next_effects_page ());
effects_previous.set_enabled (is_effects_selector_active
- && current_effects_page != 0);
+ && is_previous_effects_page ());
+ }
+
+ private bool is_next_effects_page ()
+ {
+ return current_effects_page != effects_manager.effects.length () / EFFECTS_PER_PAGE;
+ }
+
+ private bool is_previous_effects_page ()
+ {
+ return current_effects_page != 0;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]