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>
Rafael Monica <monraaf@gmail.com>
Paul Novak <pnovak@alumni.caltech.edu>
Martin Robinson <martin.james.robinson@gmail.com>
Marcel Stimberg <stimberg@users.sourceforge.net>
Shan Xiong <shan.xiong@gmail.com>
Translations courtesy of:
......
......@@ -1192,17 +1192,20 @@ public class WelcomeDialog : Gtk.Dialog {
}
public class PreferencesDialog {
private static PreferencesDialog preferences_dialog;
private Gtk.Dialog dialog;
private Gtk.Builder builder;
private Gtk.Adjustment bg_color_adjustment;
private Gtk.Entry library_dir_entry;
public PreferencesDialog() {
private PreferencesDialog() {
builder = AppWindow.create_builder();
dialog = builder.get_object("preferences_dialog") as Gtk.Dialog;
dialog.set_parent_window(AppWindow.get_instance().get_parent_window());
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.set_value(bg_color_adjustment.get_upper() -
......@@ -1221,13 +1224,21 @@ public class PreferencesDialog {
}
public void execute() {
dialog.show_all();
public static void show() {
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();
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() {
......
......@@ -701,8 +701,7 @@ public class LibraryWindow : AppWindow {
}
private void on_preferences() {
PreferencesDialog preferences_dialog = new PreferencesDialog();
preferences_dialog.execute();
PreferencesDialog.show();
}
private void on_display_basic_properties(Gtk.Action action) {
......
......@@ -100,7 +100,7 @@
<object class="GtkDialog" id="preferences_dialog">
<property name="title" translatable="yes">Shotwell Preferences</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="type_hint">dialog</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