Skip to content

Commit

Permalink
Added new option, fixed accel warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunn1 committed Dec 31, 2015
1 parent 203eee6 commit c641925
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
5 changes: 5 additions & 0 deletions data/gsettings/com.gexperts.Terminix.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
<!-- Global settings -->
<schema id="com.gexperts.Terminix.Settings" path="/com/gexperts/Terminix/">

<key name="prompt-on-new-session" type="b">
<default>true</default>
<summary>Whether to prompt for session settings or use defaults.</summary>
<description>If true, when creating a new session a prompt will appear to pick the session name and profile used.</description>
</key>
<!-- Dark Theme -->
<key name="theme-variant" enum="com.gexperts.Terminix.ThemeVariant">
<default>'system'</default>
Expand Down
9 changes: 4 additions & 5 deletions source/gx/gtk/actions.d
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,16 @@ SimpleAction registerActionWithSettings(
void delegate(glib.Variant.Variant, SimpleAction) cbStateChange = null
) {

string shortcut = null;
string[] shortcuts;
try {
shortcut = settings.getString(getActionKey(prefix, id));
if (shortcut.length == 0) shortcut = SHORTCUT_DISABLED;
string shortcut = settings.getString(getActionKey(prefix, id));
if (shortcut.length > 0 && shortcut != SHORTCUT_DISABLED) shortcuts = [shortcut];
} catch (Exception e) {
//TODO - This does not work, figure out to catch GLib-GIO-ERROR
trace(format("No shortcut for action %s.%s", prefix, id));
}
if (SHORTCUT_DISABLED == shortcut) shortcut = null;

return registerAction(actionMap, prefix, id, [shortcut], cbActivate, type, state, cbStateChange);
return registerAction(actionMap, prefix, id, shortcuts, cbActivate, type, state, cbStateChange);
}

/**
Expand Down
1 change: 1 addition & 0 deletions source/gx/terminix/appwindow.d
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ private:

//View sessions button
mbSessions = new MenuButton();
mbSessions.setTooltipText(_("Switch to a new session"));
mbSessions.setFocusOnClick(false);
Image iList = new Image("view-list-symbolic", IconSize.MENU);
mbSessions.add(iList);
Expand Down
2 changes: 2 additions & 0 deletions source/gx/terminix/preferences.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ enum SETTINGS_THEME_VARIANT_SYSTEM_VALUE = "system";
enum SETTINGS_THEME_VARIANT_LIGHT_VALUE = "light";
enum SETTINGS_THEME_VARIANT_DARK_VALUE = "dark";

enum SETTINGS_PROMPT_ON_NEW_SESSION_KEY = "prompt-on-new-session";

enum SETTINGS_SEARCH_DEFAULT_MATCH_CASE = "search-default-match-case";
enum SETTINGS_SEARCH_DEFAULT_MATCH_ENTIRE_WORD = "search-default-match-entire-word";
enum SETTINGS_SEARCH_DEFAULT_MATCH_AS_REGEX = "search-default-match-as-regex";
Expand Down
21 changes: 21 additions & 0 deletions source/gx/terminix/prefwindow.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import gtk.Button;
import gtk.CellRendererAccel;
import gtk.CellRendererText;
import gtk.CellRendererToggle;
import gtk.CheckButton;
import gtk.ComboBox;
import gtk.Grid;
import gtk.HeaderBar;
Expand Down Expand Up @@ -356,6 +357,26 @@ private:
Settings settings = new Settings(SETTINGS_ID);

int row = 0;
Label lblBehavior = new Label("");
lblBehavior.setUseMarkup(true);
lblBehavior.setHalign(Align.START);
lblBehavior.setMarkup(format("<b>%s</b>", _("Behavior")));
attach(lblBehavior, 0, row, 2, 1);
row++;

//Prompt on new session
CheckButton cbPrompt = new CheckButton(_("Prompt when creating a new session"));
settings.bind(SETTINGS_PROMPT_ON_NEW_SESSION_KEY, cbPrompt, "active", GSettingsBindFlags.DEFAULT);
attach(cbPrompt, 0, row, 2, 1);
row++;

Label lblAppearance = new Label("");
lblAppearance.setUseMarkup(true);
lblAppearance.setHalign(Align.START);
lblAppearance.setMarkup(format("<b>%s</b>", _("Appearance")));
attach(lblAppearance, 0, row, 2, 1);
row++;

//Dark Theme
attach(createLabel(_("Theme Variant")), 0, row, 1, 1);

Expand Down
4 changes: 2 additions & 2 deletions source/gx/terminix/session.d
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ private:

Label label = new Label(format("<b>%s</b>", _("Name")));
label.setUseMarkup(true);
label.setHalign(Align.START);
label.setHalign(Align.END);
grid.attach(label, 0, 0, 1, 1);

eName = new Entry();
Expand All @@ -492,7 +492,7 @@ private:

label = new Label(format("<b>%s</b>", _("Profile")));
label.setUseMarkup(true);
label.setHalign(Align.START);
label.setHalign(Align.END);
grid.attach(label, 0, 1, 1, 1);

ProfileInfo[] profiles = prfMgr.getProfiles();
Expand Down

0 comments on commit c641925

Please sign in to comment.