Skip to content

Commit

Permalink
Various fixes and more Helium used
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Feb 9, 2024
1 parent bec0374 commit da70be6
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 133 deletions.
3 changes: 0 additions & 3 deletions data/style-dark.css
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
.gutter-padding-fix {
padding: 0;
}
8 changes: 0 additions & 8 deletions data/style.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
entry.search {
border-radius: 999px;
}

.disclosure-button button {
border-radius: 999px;
}

textview text {
background: linear-gradient(0deg, alpha(@accent_bg_color, 0.03), alpha(@accent_bg_color, 0.03)), image(@view_bg_color);
}
Expand Down
107 changes: 47 additions & 60 deletions data/ui/contentview.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,30 @@
<object class="HeAppBar" id="title">
<property name="show-left-title-buttons">0</property>
<property name="show-back">false</property>

<child type="titlebar-button">
<object class="HeDisclosureButton" id="open_button">
<property name="icon-name">document-open-symbolic</property>
</object>
</child>
<child type="titlebar-button">
<object class="HeDisclosureButton" id="save_as_button">
<property name="icon">document-save-as-symbolic</property>
</object>
</child>
<child type="titlebar-button">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSearchEntry" id="search_entry">
<property name="placeholder-text">Search text…</property>
<property name="visible" bind-source="search_button" bind-property="active" bind-flags="sync-create"/>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<signal name="search-changed" handler="on_search_activate"/>
Expand All @@ -29,72 +45,43 @@
</object>
</child>
<child>
<object class="GtkOverlay">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkSourceView" id="textbox">
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<property name="wrap-mode">word</property>
<property name="left-margin">18</property>
<property name="right-margin">18</property>
<property name="top-margin">18</property>
<property name="bottom-margin">101</property>
<property name="pixels-above-lines">3</property>
<property name="pixels-inside-wrap">3</property>
</object>
</child>
</object>
</child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkBox" id="vim_status_bar">
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="spacing">6</property>
<property name="visible">0</property>
<property name="css-classes">vim-status-bar</property>
<child>
<object class="GtkLabel" id="command_bar">
<property name="halign">start</property>
</object>
</child>
<child>
<object class="GtkLabel" id="command_text">
<property name="halign">end</property>
<property name="hexpand">1</property>
<property name="ellipsize">end</property>
</object>
</child>
<object class="GtkSourceView" id="textbox">
<property name="vexpand">true</property>
<property name="hexpand">true</property>
<property name="monospace">true</property>
<property name="wrap-mode">word</property>
<property name="left-margin">18</property>
<property name="right-margin">18</property>
<property name="top-margin">18</property>
<property name="bottom-margin">18</property>
<property name="pixels-above-lines">3</property>
<property name="pixels-inside-wrap">3</property>
</object>
</child>
</object>
</child>
<child type="overlay">
<object class="HeBottomBar">
<property name="collapse_actions">0</property>
<property name="valign">end</property>
<child type="left">
<object class="HeIconicButton" id="open_button">
<property name="icon-name">document-open-symbolic</property>
</object>
</child>
<child type="left">
<object class="HeIconicButton" id="save_as_button">
<property name="icon">document-save-as-symbolic</property>
<child>
<object class="GtkBox" id="vim_status_bar">
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="spacing">6</property>
<property name="visible">0</property>
<property name="css-classes">vim-status-bar</property>
<child>
<object class="GtkLabel" id="command_bar">
<property name="halign">start</property>
</object>
</child>
<child type="right">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property>
<property name="valign">center</property>
<style>
<class name="flat" />
<class name="iconic-button" />
</style>
<child>
<object class="GtkLabel" id="command_text">
<property name="halign">end</property>
<property name="hexpand">1</property>
<property name="ellipsize">end</property>
</object>
</child>
</object>
Expand Down
60 changes: 12 additions & 48 deletions data/ui/docrowcontent.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,18 @@
<interface>
<template class="EnigmaDocRowContent" parent="HeBin">
<child>
<object class="GtkBox" id="row_box">
<property name="orientation">horizontal</property>
<property name="valign">center</property>
<property name="spacing">6</property>
<style>
<class name="mini-content-block"/>
</style>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="valign">center</property>
<property name="spacing">6</property>
<property name="margin-start">6</property>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="ellipsize">end</property>
<property name="single-line-mode">yes</property>
<binding name="label">
<lookup name="title" type="EnigmaDoc">
<lookup name="doc">EnigmaDocRowContent</lookup>
</lookup>
</binding>
<style>
<class name="cb-title"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="halign">start</property>
<property name="hexpand">1</property>
<property name="ellipsize">end</property>
<property name="single-line-mode">yes</property>
<property name="max-width-chars">25</property>
<property name="use-markup">1</property>
<binding name="label">
<lookup name="subtitle" type="EnigmaDoc">
<lookup name="doc">EnigmaDocRowContent</lookup>
</lookup>
</binding>
<style>
<class name="cb-subtitle"/>
</style>
</object>
</child>
</object>
</child>
<object class="HeMiniContentBlock" id="row_box">
<property name="hexpand">true</property>
<binding name="title">
<lookup name="title" type="EnigmaDoc">
<lookup name="doc">EnigmaDocRowContent</lookup>
</lookup>
</binding>
<binding name="subtitle">
<lookup name="subtitle" type="EnigmaDoc">
<lookup name="doc">EnigmaDocRowContent</lookup>
</lookup>
</binding>
</object>
</child>
</template>
Expand Down
10 changes: 5 additions & 5 deletions data/ui/prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<property name="title">Font Size</property>
<property name="hexpand">true</property>
<child>
<object class="GtkBox">
<object class="HeSegmentedButton">
<child>
<object class="GtkCheckButton" id="sml">
<property name="label">Small</property>
Expand Down Expand Up @@ -42,7 +42,7 @@
<property name="hexpand">true</property>
<property name="activatable-widget">sn</property>
<child>
<object class="GtkSwitch" id="sn">
<object class="HeSwitch" id="sn">
<property name="valign">start</property>
</object>
</child>
Expand All @@ -54,7 +54,7 @@
<property name="hexpand">true</property>
<property name="activatable-widget">hcl</property>
<child>
<object class="GtkSwitch" id="hcl">
<object class="HeSwitch" id="hcl">
<property name="valign">start</property>
</object>
</child>
Expand All @@ -67,7 +67,7 @@
<property name="hexpand">true</property>
<property name="activatable-widget">hmb</property>
<child>
<object class="GtkSwitch" id="hmb">
<object class="HeSwitch" id="hmb">
<property name="valign">start</property>
</object>
</child>
Expand All @@ -80,7 +80,7 @@
<property name="hexpand">true</property>
<property name="activatable-widget">ve</property>
<child>
<object class="GtkSwitch" id="ve">
<object class="HeSwitch" id="ve">
<property name="valign">start</property>
</object>
</child>
Expand Down
2 changes: 2 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ namespace Enigma {
[GtkCallback]
void on_new_doc_requested () {
view_model.create_new_doc (null);
view_model.update_doc (null);
sidebar.lv.get_model ().select_item (0, true);
}

[GtkCallback]
Expand Down
2 changes: 1 addition & 1 deletion src/ViewModels/DocViewModel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Enigma.DocViewModel : Object {
save_docs ();
}

public void update_doc (Doc doc) {
public void update_doc (Doc? doc) {
repository.update_doc (doc);
save_docs ();
}
Expand Down
16 changes: 8 additions & 8 deletions src/Widgets/PreferencesWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ namespace Enigma {
[GtkChild]
unowned Gtk.CheckButton big;
[GtkChild]
unowned Gtk.Switch sn;
unowned He.Switch sn;
[GtkChild]
unowned Gtk.Switch hcl;
unowned He.Switch hcl;
[GtkChild]
unowned Gtk.Switch hmb;
unowned He.Switch hmb;
[GtkChild]
unowned Gtk.Switch ve;
unowned He.Switch ve;

public Preferences (MainWindow win) {
Object (parent: win);
Expand Down Expand Up @@ -75,10 +75,10 @@ namespace Enigma {
}
});

settings.settings.bind ("show-line-numbers", sn, "active", DEFAULT);
settings.settings.bind ("hilight-curr-line", hcl, "active", DEFAULT);
settings.settings.bind ("hilight-brackets", hmb, "active", DEFAULT);
settings.settings.bind ("vim-emulation", ve, "active", DEFAULT);
settings.settings.bind ("show-line-numbers", sn.iswitch, "active", DEFAULT);
settings.settings.bind ("hilight-curr-line", hcl.iswitch, "active", DEFAULT);
settings.settings.bind ("hilight-brackets", hmb.iswitch, "active", DEFAULT);
settings.settings.bind ("vim-emulation", ve.iswitch, "active", DEFAULT);
}
}
}

0 comments on commit da70be6

Please sign in to comment.