Skip to content

Commit

Permalink
Fix #22
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunn1 committed Jan 15, 2016
1 parent a85f525 commit f50ea9e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
6 changes: 5 additions & 1 deletion source/gx/terminix/preferences.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import gio.Settings : GSettings = Settings;
import gx.i18n.l10n;
import gx.util.array;

//Gnome Desktop Settings
enum SETTINGS_DESKTOP_ID = "org.gnome.desktop.interface";
enum SETTINGS_MONOSPACE_FONT_KEY = "monospace-font-name";

//Preference Constants
enum SETTINGS_ID = "com.gexperts.Terminix.Settings";
enum SETTINGS_BASE_PATH = "/com/gexperts/Terminix";
Expand Down Expand Up @@ -53,7 +57,7 @@ enum SETTINGS_PROFILE_CURSOR_SHAPE_UNDERLINE_VALUE = "underline";
enum SETTINGS_PROFILE_CURSOR_BLINK_MODE_KEY = "cursor-blink-mode";
immutable string[] SETTINGS_PROFILE_CURSOR_BLINK_MODE_VALUES = ["system", "on", "off"];
enum SETTINGS_PROFILE_USE_SYSTEM_FONT_KEY = "use-system-font";
enum SETTINGS_PROFILE_SYSTEM_FONT_KEY = "font";
enum SETTINGS_PROFILE_FONT_KEY = "font";

enum SETTINGS_PROFILE_BG_COLOR_KEY = "background-color";
enum SETTINGS_PROFILE_FG_COLOR_KEY = "foreground-color";
Expand Down
2 changes: 1 addition & 1 deletion source/gx/terminix/profilewindow.d
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private:
//Font Selector
FontButton fbFont = new FontButton();
fbFont.setTitle(_("Choose A Terminal Font"));
gsProfile.bind(SETTINGS_PROFILE_SYSTEM_FONT_KEY, fbFont, "font-name", GSettingsBindFlags.DEFAULT);
gsProfile.bind(SETTINGS_PROFILE_FONT_KEY, fbFont, "font-name", GSettingsBindFlags.DEFAULT);
gsProfile.bind(SETTINGS_PROFILE_USE_SYSTEM_FONT_KEY, fbFont, "sensitive", GSettingsBindFlags.GET | GSettingsBindFlags.NO_SENSITIVITY | GSettingsBindFlags
.INVERT_BOOLEAN);
bFont.add(fbFont);
Expand Down
18 changes: 18 additions & 0 deletions source/gx/terminix/terminal/terminal.d
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ import gtk.TargetEntry;
import gtk.Widget;
import gtk.Window;

import pango.PgFontDescription;

import vte.Terminal : VTE = Terminal;
import vtec.vtetypes;

Expand Down Expand Up @@ -204,6 +206,7 @@ private:

GSettings gsProfile;
GSettings gsShortcuts;
GSettings gsDesktop;

/**
* Create the user interface of the TerminalPane
Expand Down Expand Up @@ -687,6 +690,15 @@ private:
case SETTINGS_PROFILE_TITLE_KEY:
updateTitle();
break;
case SETTINGS_PROFILE_USE_SYSTEM_FONT_KEY, SETTINGS_PROFILE_FONT_KEY:
PgFontDescription desc;
if (gsProfile.getBoolean(SETTINGS_PROFILE_USE_SYSTEM_FONT_KEY)) {
desc = PgFontDescription.fromString(SETTINGS_MONOSPACE_FONT_KEY);
} else {
desc = PgFontDescription.fromString(gsProfile.getString(SETTINGS_PROFILE_FONT_KEY));
}
vte.setFont(desc);
break;
default:
break;
}
Expand Down Expand Up @@ -1033,6 +1045,12 @@ public:
_profileUUID = profileUUID;
gsProfile = prfMgr.getProfileSettings(profileUUID);
gsShortcuts = new GSettings(SETTINGS_PROFILE_KEY_BINDINGS_ID);
gsDesktop = new GSettings(SETTINGS_DESKTOP_ID);
gsDesktop.addOnChanged(delegate(string key, GSettings) {
if (key == SETTINGS_MONOSPACE_FONT_KEY) {
applyPreference(SETTINGS_PROFILE_FONT_KEY);
}
});
createUI();
trace("Apply preferences");
applyPreferences();
Expand Down

0 comments on commit f50ea9e

Please sign in to comment.