diff options
author | David King <amigadave@amigadave.com> | 2013-09-17 07:58:07 +0100 |
---|---|---|
committer | David King <amigadave@amigadave.com> | 2013-09-17 07:58:07 +0100 |
commit | 4d5ceb9e994c11d0b67a09cce7d8ea912ae7bff6 (patch) | |
tree | d07752db2a3daf7cac5ae97e116b358703d85d1b | |
parent | 7ab9209f06b89f6f830169f1f3e4a2afda2c44aa (diff) |
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.
-rw-r--r-- | src/cheese-application.vala | 15 | ||||
-rw-r--r-- | 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). |