[cheese] Close the preferences if the action is disabled
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese] Close the preferences if the action is disabled
- Date: Tue, 17 Sep 2013 07:11:43 +0000 (UTC)
commit 4d5ceb9e994c11d0b67a09cce7d8ea912ae7bff6
Author: David King <amigadave amigadave com>
Date: Tue Sep 17 07:58:07 2013 +0100
Close the preferences if the action is disabled
When shooting, the preferences action is disabled. If the preferences
dialog is shown, the resolution and capture device can still be changed,
so hide the dialog when the preferences action is disabled.
src/cheese-application.vala | 15 +++++++++++++++
src/cheese-preferences.vala | 8 ++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/cheese-application.vala b/src/cheese-application.vala
index 4cbfa49..253e57c 100644
--- a/src/cheese-application.vala
+++ b/src/cheese-application.vala
@@ -160,6 +160,8 @@ public class Cheese.Application : Gtk.Application
main_window.show ();
setup_camera ();
preferences_dialog = new PreferencesDialog (camera);
+ var preferences = this.lookup_action ("preferences");
+ preferences.notify["enabled"].connect (on_preferences_enabled);
this.add_window (main_window);
}
}
@@ -622,4 +624,17 @@ public class Cheese.Application : Gtk.Application
{
main_window.destroy ();
}
+
+ /**
+ * Close the preferences dialog when the preferences action is disabled.
+ */
+ private void on_preferences_enabled ()
+ {
+ var preferences = this.lookup_action ("preferences");
+
+ if (!preferences.enabled)
+ {
+ preferences_dialog.hide ();
+ }
+ }
}
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index e078cbb..f04660a 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -554,6 +554,14 @@ public class Cheese.PreferencesDialog : GLib.Object
{
this.dialog.show_all ();
}
+
+ /**
+ * Hide the dialog.
+ */
+ public void hide ()
+ {
+ this.dialog.hide ();
+ }
/**
* Set the current media mode (photo, video or burst).
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]