Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ vala_precompile(VALA_C ${EXEC_NAME}
Dialogs/EditorPreferencesDialog.vala
Dialogs/NewFileDialog.vala
Dialogs/OpenProjectDialog.vala
Dialogs/PreferencesDialog.vala
Services/IDESettings.vala
config.vala
PACKAGES
Expand Down
48 changes: 48 additions & 0 deletions src/Dialogs/PreferencesDialog.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace IDE {
public class PreferencesDialog : BaseDialog {

construct {

resizable = false;

var general_grid = new Gtk.Grid ();
general_grid.row_spacing = 6;
general_grid.column_spacing = 12;
general_grid.margin = 12;

var general_header = new SettingsHeader (_("General"));

SettingsSwitch dark_mode_switch = new SettingsSwitch ("dark-theme");

general_grid.attach (general_header, 0, 0, 2, 1);
general_grid.attach (new SettingsLabel (_("Dark theme:")), 0, 1, 1, 1);
general_grid.attach (dark_mode_switch, 1, 1, 1, 1);

get_content_area ().add (general_grid);

}

private class SettingsSwitch : Gtk.Switch {
public SettingsSwitch (string setting) {
halign = Gtk.Align.START;
IDESettings.get_default ().schema.bind (setting, this, "active", SettingsBindFlags.DEFAULT);
}
}

private class SettingsHeader : Gtk.Label {
public SettingsHeader (string text) {
label = text;
get_style_context ().add_class ("h4");
halign = Gtk.Align.START;
}
}

private class SettingsLabel : Gtk.Label {
public SettingsLabel (string text) {
label = text;
halign = Gtk.Align.END;
margin_start = 12;
}
}
}
}
10 changes: 9 additions & 1 deletion src/ToolBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ namespace IDE {

menu_item = save_button.add_menu_item (_("Save all opened documents"));
menu_item.activate.connect (request_save_opened);

menu_item = preferences_button.add_menu_item (_("Preferences"));
menu_item.activate.connect (show_preferences);
}

private void build () {
Expand Down Expand Up @@ -100,5 +103,10 @@ namespace IDE {
new_file_dialog.show_all ();
new_file_dialog.hide.connect (() => new_button.sensitive = true);
}

private void show_preferences () {
var preferences_dialog = new PreferencesDialog ();
preferences_dialog.show_all ();
}
}
}
}