Commit e92a4820 authored by Jim Nelson's avatar Jim Nelson

#1834: Preferences dialog now non-modal thanks to Marcel Stimberg.

parent b14d0bcf
...@@ -10,6 +10,7 @@ Dominic Lloyd <dwlloyd@telus.net> ...@@ -10,6 +10,7 @@ Dominic Lloyd <dwlloyd@telus.net>
Rafael Monica <monraaf@gmail.com> Rafael Monica <monraaf@gmail.com>
Paul Novak <pnovak@alumni.caltech.edu> Paul Novak <pnovak@alumni.caltech.edu>
Martin Robinson <martin.james.robinson@gmail.com> Martin Robinson <martin.james.robinson@gmail.com>
Marcel Stimberg <stimberg@users.sourceforge.net>
Shan Xiong <shan.xiong@gmail.com> Shan Xiong <shan.xiong@gmail.com>
Translations courtesy of: Translations courtesy of:
......
...@@ -1192,17 +1192,20 @@ public class WelcomeDialog : Gtk.Dialog { ...@@ -1192,17 +1192,20 @@ public class WelcomeDialog : Gtk.Dialog {
} }
public class PreferencesDialog { public class PreferencesDialog {
private static PreferencesDialog preferences_dialog;
private Gtk.Dialog dialog; private Gtk.Dialog dialog;
private Gtk.Builder builder; private Gtk.Builder builder;
private Gtk.Adjustment bg_color_adjustment; private Gtk.Adjustment bg_color_adjustment;
private Gtk.Entry library_dir_entry; private Gtk.Entry library_dir_entry;
public PreferencesDialog() { private PreferencesDialog() {
builder = AppWindow.create_builder(); builder = AppWindow.create_builder();
dialog = builder.get_object("preferences_dialog") as Gtk.Dialog; dialog = builder.get_object("preferences_dialog") as Gtk.Dialog;
dialog.set_parent_window(AppWindow.get_instance().get_parent_window()); dialog.set_parent_window(AppWindow.get_instance().get_parent_window());
dialog.set_transient_for(AppWindow.get_instance()); dialog.set_transient_for(AppWindow.get_instance());
dialog.delete_event += on_delete;
dialog.response += on_close;
bg_color_adjustment = builder.get_object("bg_color_adjustment") as Gtk.Adjustment; bg_color_adjustment = builder.get_object("bg_color_adjustment") as Gtk.Adjustment;
bg_color_adjustment.set_value(bg_color_adjustment.get_upper() - bg_color_adjustment.set_value(bg_color_adjustment.get_upper() -
...@@ -1221,13 +1224,21 @@ public class PreferencesDialog { ...@@ -1221,13 +1224,21 @@ public class PreferencesDialog {
} }
public void execute() { public static void show() {
dialog.show_all(); if (preferences_dialog == null)
preferences_dialog = new PreferencesDialog();
if (dialog.run() == Gtk.ResponseType.CLOSE) preferences_dialog.dialog.show_all();
}
private bool on_delete() {
Config.get_instance().commit_bg_color(); Config.get_instance().commit_bg_color();
return dialog.hide_on_delete(); //prevent widgets from getting destroyed
}
dialog.destroy(); private void on_close() {
dialog.hide();
Config.get_instance().commit_bg_color();
} }
private void on_value_changed() { private void on_value_changed() {
......
...@@ -701,8 +701,7 @@ public class LibraryWindow : AppWindow { ...@@ -701,8 +701,7 @@ public class LibraryWindow : AppWindow {
} }
private void on_preferences() { private void on_preferences() {
PreferencesDialog preferences_dialog = new PreferencesDialog(); PreferencesDialog.show();
preferences_dialog.execute();
} }
private void on_display_basic_properties(Gtk.Action action) { private void on_display_basic_properties(Gtk.Action action) {
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<object class="GtkDialog" id="preferences_dialog"> <object class="GtkDialog" id="preferences_dialog">
<property name="title" translatable="yes">Shotwell Preferences</property> <property name="title" translatable="yes">Shotwell Preferences</property>
<property name="resizable">False</property> <property name="resizable">False</property>
<property name="modal">True</property> <property name="modal">False</property>
<property name="destroy_with_parent">True</property> <property name="destroy_with_parent">True</property>
<property name="type_hint">dialog</property> <property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property> <property name="skip_taskbar_hint">True</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment